@ainyc/canonry 1.32.0 → 1.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,246 +0,0 @@
1
- function lk(e,t){for(var n=0;n<t.length;n++){const a=t[n];if(typeof a!="string"&&!Array.isArray(a)){for(const o in a)if(o!=="default"&&!(o in e)){const c=Object.getOwnPropertyDescriptor(a,o);c&&Object.defineProperty(e,o,c.get?c:{enumerable:!0,get:()=>a[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))a(o);new MutationObserver(o=>{for(const c of o)if(c.type==="childList")for(const u of c.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&a(u)}).observe(document,{childList:!0,subtree:!0});function n(o){const c={};return o.integrity&&(c.integrity=o.integrity),o.referrerPolicy&&(c.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?c.credentials="include":o.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function a(o){if(o.ep)return;o.ep=!0;const c=n(o);fetch(o.href,c)}})();function vS(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Th={exports:{}},qo={};var Qv;function ck(){if(Qv)return qo;Qv=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(a,o,c){var u=null;if(c!==void 0&&(u=""+c),o.key!==void 0&&(u=""+o.key),"key"in o){c={};for(var f in o)f!=="key"&&(c[f]=o[f])}else c=o;return o=c.ref,{$$typeof:e,type:a,key:u,ref:o!==void 0?o:null,props:c}}return qo.Fragment=t,qo.jsx=n,qo.jsxs=n,qo}var Yv;function uk(){return Yv||(Yv=1,Th.exports=ck()),Th.exports}var r=uk(),Rh={exports:{}},Te={};var Jv;function dk(){if(Jv)return Te;Jv=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),u=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),y=Symbol.for("react.activity"),b=Symbol.iterator;function x(R){return R===null||typeof R!="object"?null:(R=b&&R[b]||R["@@iterator"],typeof R=="function"?R:null)}var N={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,C={};function k(R,M,J){this.props=R,this.context=M,this.refs=C,this.updater=J||N}k.prototype.isReactComponent={},k.prototype.setState=function(R,M){if(typeof R!="object"&&typeof R!="function"&&R!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,R,M,"setState")},k.prototype.forceUpdate=function(R){this.updater.enqueueForceUpdate(this,R,"forceUpdate")};function T(){}T.prototype=k.prototype;function A(R,M,J){this.props=R,this.context=M,this.refs=C,this.updater=J||N}var z=A.prototype=new T;z.constructor=A,S(z,k.prototype),z.isPureReactComponent=!0;var $=Array.isArray;function P(){}var E={H:null,A:null,T:null,S:null},O=Object.prototype.hasOwnProperty;function K(R,M,J){var V=J.ref;return{$$typeof:e,type:R,key:M,ref:V!==void 0?V:null,props:J}}function ee(R,M){return K(R.type,M,R.props)}function X(R){return typeof R=="object"&&R!==null&&R.$$typeof===e}function se(R){var M={"=":"=0",":":"=2"};return"$"+R.replace(/[=:]/g,function(J){return M[J]})}var de=/\/+/g;function Ee(R,M){return typeof R=="object"&&R!==null&&R.key!=null?se(""+R.key):M.toString(36)}function be(R){switch(R.status){case"fulfilled":return R.value;case"rejected":throw R.reason;default:switch(typeof R.status=="string"?R.then(P,P):(R.status="pending",R.then(function(M){R.status==="pending"&&(R.status="fulfilled",R.value=M)},function(M){R.status==="pending"&&(R.status="rejected",R.reason=M)})),R.status){case"fulfilled":return R.value;case"rejected":throw R.reason}}throw R}function H(R,M,J,V,Q){var me=typeof R;(me==="undefined"||me==="boolean")&&(R=null);var ge=!1;if(R===null)ge=!0;else switch(me){case"bigint":case"string":case"number":ge=!0;break;case"object":switch(R.$$typeof){case e:case t:ge=!0;break;case v:return ge=R._init,H(ge(R._payload),M,J,V,Q)}}if(ge)return Q=Q(R),ge=V===""?"."+Ee(R,0):V,$(Q)?(J="",ge!=null&&(J=ge.replace(de,"$&/")+"/"),H(Q,M,J,"",function(Me){return Me})):Q!=null&&(X(Q)&&(Q=ee(Q,J+(Q.key==null||R&&R.key===Q.key?"":(""+Q.key).replace(de,"$&/")+"/")+ge)),M.push(Q)),1;ge=0;var Ne=V===""?".":V+":";if($(R))for(var he=0;he<R.length;he++)V=R[he],me=Ne+Ee(V,he),ge+=H(V,M,J,me,Q);else if(he=x(R),typeof he=="function")for(R=he.call(R),he=0;!(V=R.next()).done;)V=V.value,me=Ne+Ee(V,he++),ge+=H(V,M,J,me,Q);else if(me==="object"){if(typeof R.then=="function")return H(be(R),M,J,V,Q);throw M=String(R),Error("Objects are not valid as a React child (found: "+(M==="[object Object]"?"object with keys {"+Object.keys(R).join(", ")+"}":M)+"). If you meant to render a collection of children, use an array instead.")}return ge}function ae(R,M,J){if(R==null)return R;var V=[],Q=0;return H(R,V,"","",function(me){return M.call(J,me,Q++)}),V}function pe(R){if(R._status===-1){var M=R._result;M=M(),M.then(function(J){(R._status===0||R._status===-1)&&(R._status=1,R._result=J)},function(J){(R._status===0||R._status===-1)&&(R._status=2,R._result=J)}),R._status===-1&&(R._status=0,R._result=M)}if(R._status===1)return R._result.default;throw R._result}var ce=typeof reportError=="function"?reportError:function(R){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var M=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof R=="object"&&R!==null&&typeof R.message=="string"?String(R.message):String(R),error:R});if(!window.dispatchEvent(M))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",R);return}console.error(R)},U={map:ae,forEach:function(R,M,J){ae(R,function(){M.apply(this,arguments)},J)},count:function(R){var M=0;return ae(R,function(){M++}),M},toArray:function(R){return ae(R,function(M){return M})||[]},only:function(R){if(!X(R))throw Error("React.Children.only expected to receive a single React element child.");return R}};return Te.Activity=y,Te.Children=U,Te.Component=k,Te.Fragment=n,Te.Profiler=o,Te.PureComponent=A,Te.StrictMode=a,Te.Suspense=m,Te.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=E,Te.__COMPILER_RUNTIME={__proto__:null,c:function(R){return E.H.useMemoCache(R)}},Te.cache=function(R){return function(){return R.apply(null,arguments)}},Te.cacheSignal=function(){return null},Te.cloneElement=function(R,M,J){if(R==null)throw Error("The argument must be a React element, but you passed "+R+".");var V=S({},R.props),Q=R.key;if(M!=null)for(me in M.key!==void 0&&(Q=""+M.key),M)!O.call(M,me)||me==="key"||me==="__self"||me==="__source"||me==="ref"&&M.ref===void 0||(V[me]=M[me]);var me=arguments.length-2;if(me===1)V.children=J;else if(1<me){for(var ge=Array(me),Ne=0;Ne<me;Ne++)ge[Ne]=arguments[Ne+2];V.children=ge}return K(R.type,Q,V)},Te.createContext=function(R){return R={$$typeof:u,_currentValue:R,_currentValue2:R,_threadCount:0,Provider:null,Consumer:null},R.Provider=R,R.Consumer={$$typeof:c,_context:R},R},Te.createElement=function(R,M,J){var V,Q={},me=null;if(M!=null)for(V in M.key!==void 0&&(me=""+M.key),M)O.call(M,V)&&V!=="key"&&V!=="__self"&&V!=="__source"&&(Q[V]=M[V]);var ge=arguments.length-2;if(ge===1)Q.children=J;else if(1<ge){for(var Ne=Array(ge),he=0;he<ge;he++)Ne[he]=arguments[he+2];Q.children=Ne}if(R&&R.defaultProps)for(V in ge=R.defaultProps,ge)Q[V]===void 0&&(Q[V]=ge[V]);return K(R,me,Q)},Te.createRef=function(){return{current:null}},Te.forwardRef=function(R){return{$$typeof:f,render:R}},Te.isValidElement=X,Te.lazy=function(R){return{$$typeof:v,_payload:{_status:-1,_result:R},_init:pe}},Te.memo=function(R,M){return{$$typeof:p,type:R,compare:M===void 0?null:M}},Te.startTransition=function(R){var M=E.T,J={};E.T=J;try{var V=R(),Q=E.S;Q!==null&&Q(J,V),typeof V=="object"&&V!==null&&typeof V.then=="function"&&V.then(P,ce)}catch(me){ce(me)}finally{M!==null&&J.types!==null&&(M.types=J.types),E.T=M}},Te.unstable_useCacheRefresh=function(){return E.H.useCacheRefresh()},Te.use=function(R){return E.H.use(R)},Te.useActionState=function(R,M,J){return E.H.useActionState(R,M,J)},Te.useCallback=function(R,M){return E.H.useCallback(R,M)},Te.useContext=function(R){return E.H.useContext(R)},Te.useDebugValue=function(){},Te.useDeferredValue=function(R,M){return E.H.useDeferredValue(R,M)},Te.useEffect=function(R,M){return E.H.useEffect(R,M)},Te.useEffectEvent=function(R){return E.H.useEffectEvent(R)},Te.useId=function(){return E.H.useId()},Te.useImperativeHandle=function(R,M,J){return E.H.useImperativeHandle(R,M,J)},Te.useInsertionEffect=function(R,M){return E.H.useInsertionEffect(R,M)},Te.useLayoutEffect=function(R,M){return E.H.useLayoutEffect(R,M)},Te.useMemo=function(R,M){return E.H.useMemo(R,M)},Te.useOptimistic=function(R,M){return E.H.useOptimistic(R,M)},Te.useReducer=function(R,M,J){return E.H.useReducer(R,M,J)},Te.useRef=function(R){return E.H.useRef(R)},Te.useState=function(R){return E.H.useState(R)},Te.useSyncExternalStore=function(R,M,J){return E.H.useSyncExternalStore(R,M,J)},Te.useTransition=function(){return E.H.useTransition()},Te.version="19.2.4",Te}var Xv;function pl(){return Xv||(Xv=1,Rh.exports=dk()),Rh.exports}var w=pl();const us=vS(w),sp=lk({__proto__:null,default:us},[w]);var Oh={exports:{}},Ko={},Lh={exports:{}},Dh={};var Wv;function fk(){return Wv||(Wv=1,(function(e){function t(H,ae){var pe=H.length;H.push(ae);e:for(;0<pe;){var ce=pe-1>>>1,U=H[ce];if(0<o(U,ae))H[ce]=ae,H[pe]=U,pe=ce;else break e}}function n(H){return H.length===0?null:H[0]}function a(H){if(H.length===0)return null;var ae=H[0],pe=H.pop();if(pe!==ae){H[0]=pe;e:for(var ce=0,U=H.length,R=U>>>1;ce<R;){var M=2*(ce+1)-1,J=H[M],V=M+1,Q=H[V];if(0>o(J,pe))V<U&&0>o(Q,J)?(H[ce]=Q,H[V]=pe,ce=V):(H[ce]=J,H[M]=pe,ce=M);else if(V<U&&0>o(Q,pe))H[ce]=Q,H[V]=pe,ce=V;else break e}}return ae}function o(H,ae){var pe=H.sortIndex-ae.sortIndex;return pe!==0?pe:H.id-ae.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var u=Date,f=u.now();e.unstable_now=function(){return u.now()-f}}var m=[],p=[],v=1,y=null,b=3,x=!1,N=!1,S=!1,C=!1,k=typeof setTimeout=="function"?setTimeout:null,T=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;function z(H){for(var ae=n(p);ae!==null;){if(ae.callback===null)a(p);else if(ae.startTime<=H)a(p),ae.sortIndex=ae.expirationTime,t(m,ae);else break;ae=n(p)}}function $(H){if(S=!1,z(H),!N)if(n(m)!==null)N=!0,P||(P=!0,se());else{var ae=n(p);ae!==null&&be($,ae.startTime-H)}}var P=!1,E=-1,O=5,K=-1;function ee(){return C?!0:!(e.unstable_now()-K<O)}function X(){if(C=!1,P){var H=e.unstable_now();K=H;var ae=!0;try{e:{N=!1,S&&(S=!1,T(E),E=-1),x=!0;var pe=b;try{t:{for(z(H),y=n(m);y!==null&&!(y.expirationTime>H&&ee());){var ce=y.callback;if(typeof ce=="function"){y.callback=null,b=y.priorityLevel;var U=ce(y.expirationTime<=H);if(H=e.unstable_now(),typeof U=="function"){y.callback=U,z(H),ae=!0;break t}y===n(m)&&a(m),z(H)}else a(m);y=n(m)}if(y!==null)ae=!0;else{var R=n(p);R!==null&&be($,R.startTime-H),ae=!1}}break e}finally{y=null,b=pe,x=!1}ae=void 0}}finally{ae?se():P=!1}}}var se;if(typeof A=="function")se=function(){A(X)};else if(typeof MessageChannel<"u"){var de=new MessageChannel,Ee=de.port2;de.port1.onmessage=X,se=function(){Ee.postMessage(null)}}else se=function(){k(X,0)};function be(H,ae){E=k(function(){H(e.unstable_now())},ae)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(H){H.callback=null},e.unstable_forceFrameRate=function(H){0>H||125<H?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):O=0<H?Math.floor(1e3/H):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_next=function(H){switch(b){case 1:case 2:case 3:var ae=3;break;default:ae=b}var pe=b;b=ae;try{return H()}finally{b=pe}},e.unstable_requestPaint=function(){C=!0},e.unstable_runWithPriority=function(H,ae){switch(H){case 1:case 2:case 3:case 4:case 5:break;default:H=3}var pe=b;b=H;try{return ae()}finally{b=pe}},e.unstable_scheduleCallback=function(H,ae,pe){var ce=e.unstable_now();switch(typeof pe=="object"&&pe!==null?(pe=pe.delay,pe=typeof pe=="number"&&0<pe?ce+pe:ce):pe=ce,H){case 1:var U=-1;break;case 2:U=250;break;case 5:U=1073741823;break;case 4:U=1e4;break;default:U=5e3}return U=pe+U,H={id:v++,callback:ae,priorityLevel:H,startTime:pe,expirationTime:U,sortIndex:-1},pe>ce?(H.sortIndex=pe,t(p,H),n(m)===null&&H===n(p)&&(S?(T(E),E=-1):S=!0,be($,pe-ce))):(H.sortIndex=U,t(m,H),N||x||(N=!0,P||(P=!0,se()))),H},e.unstable_shouldYield=ee,e.unstable_wrapCallback=function(H){var ae=b;return function(){var pe=b;b=ae;try{return H.apply(this,arguments)}finally{b=pe}}}})(Dh)),Dh}var eb;function hk(){return eb||(eb=1,Lh.exports=fk()),Lh.exports}var Mh={exports:{}},an={};var tb;function mk(){if(tb)return an;tb=1;var e=pl();function t(m){var p="https://react.dev/errors/"+m;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var v=2;v<arguments.length;v++)p+="&args[]="+encodeURIComponent(arguments[v])}return"Minified React error #"+m+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var a={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},o=Symbol.for("react.portal");function c(m,p,v){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:y==null?null:""+y,children:m,containerInfo:p,implementation:v}}var u=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function f(m,p){if(m==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return an.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,an.createPortal=function(m,p){var v=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(t(299));return c(m,p,null,v)},an.flushSync=function(m){var p=u.T,v=a.p;try{if(u.T=null,a.p=2,m)return m()}finally{u.T=p,a.p=v,a.d.f()}},an.preconnect=function(m,p){typeof m=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,a.d.C(m,p))},an.prefetchDNS=function(m){typeof m=="string"&&a.d.D(m)},an.preinit=function(m,p){if(typeof m=="string"&&p&&typeof p.as=="string"){var v=p.as,y=f(v,p.crossOrigin),b=typeof p.integrity=="string"?p.integrity:void 0,x=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;v==="style"?a.d.S(m,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:y,integrity:b,fetchPriority:x}):v==="script"&&a.d.X(m,{crossOrigin:y,integrity:b,fetchPriority:x,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},an.preinitModule=function(m,p){if(typeof m=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var v=f(p.as,p.crossOrigin);a.d.M(m,{crossOrigin:v,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&a.d.M(m)},an.preload=function(m,p){if(typeof m=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var v=p.as,y=f(v,p.crossOrigin);a.d.L(m,v,{crossOrigin:y,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,type:typeof p.type=="string"?p.type:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0,referrerPolicy:typeof p.referrerPolicy=="string"?p.referrerPolicy:void 0,imageSrcSet:typeof p.imageSrcSet=="string"?p.imageSrcSet:void 0,imageSizes:typeof p.imageSizes=="string"?p.imageSizes:void 0,media:typeof p.media=="string"?p.media:void 0})}},an.preloadModule=function(m,p){if(typeof m=="string")if(p){var v=f(p.as,p.crossOrigin);a.d.m(m,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:v,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else a.d.m(m)},an.requestFormReset=function(m){a.d.r(m)},an.unstable_batchedUpdates=function(m,p){return m(p)},an.useFormState=function(m,p,v){return u.H.useFormState(m,p,v)},an.useFormStatus=function(){return u.H.useHostTransitionStatus()},an.version="19.2.4",an}var nb;function bS(){if(nb)return Mh.exports;nb=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Mh.exports=mk(),Mh.exports}var sb;function pk(){if(sb)return Ko;sb=1;var e=hk(),t=pl(),n=bS();function a(s){var i="https://react.dev/errors/"+s;if(1<arguments.length){i+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)i+="&args[]="+encodeURIComponent(arguments[l])}return"Minified React error #"+s+"; visit "+i+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function c(s){var i=s,l=s;if(s.alternate)for(;i.return;)i=i.return;else{s=i;do i=s,(i.flags&4098)!==0&&(l=i.return),s=i.return;while(s)}return i.tag===3?l:null}function u(s){if(s.tag===13){var i=s.memoizedState;if(i===null&&(s=s.alternate,s!==null&&(i=s.memoizedState)),i!==null)return i.dehydrated}return null}function f(s){if(s.tag===31){var i=s.memoizedState;if(i===null&&(s=s.alternate,s!==null&&(i=s.memoizedState)),i!==null)return i.dehydrated}return null}function m(s){if(c(s)!==s)throw Error(a(188))}function p(s){var i=s.alternate;if(!i){if(i=c(s),i===null)throw Error(a(188));return i!==s?null:s}for(var l=s,d=i;;){var h=l.return;if(h===null)break;var g=h.alternate;if(g===null){if(d=h.return,d!==null){l=d;continue}break}if(h.child===g.child){for(g=h.child;g;){if(g===l)return m(h),s;if(g===d)return m(h),i;g=g.sibling}throw Error(a(188))}if(l.return!==d.return)l=h,d=g;else{for(var j=!1,_=h.child;_;){if(_===l){j=!0,l=h,d=g;break}if(_===d){j=!0,d=h,l=g;break}_=_.sibling}if(!j){for(_=g.child;_;){if(_===l){j=!0,l=g,d=h;break}if(_===d){j=!0,d=g,l=h;break}_=_.sibling}if(!j)throw Error(a(189))}}if(l.alternate!==d)throw Error(a(190))}if(l.tag!==3)throw Error(a(188));return l.stateNode.current===l?s:i}function v(s){var i=s.tag;if(i===5||i===26||i===27||i===6)return s;for(s=s.child;s!==null;){if(i=v(s),i!==null)return i;s=s.sibling}return null}var y=Object.assign,b=Symbol.for("react.element"),x=Symbol.for("react.transitional.element"),N=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),k=Symbol.for("react.profiler"),T=Symbol.for("react.consumer"),A=Symbol.for("react.context"),z=Symbol.for("react.forward_ref"),$=Symbol.for("react.suspense"),P=Symbol.for("react.suspense_list"),E=Symbol.for("react.memo"),O=Symbol.for("react.lazy"),K=Symbol.for("react.activity"),ee=Symbol.for("react.memo_cache_sentinel"),X=Symbol.iterator;function se(s){return s===null||typeof s!="object"?null:(s=X&&s[X]||s["@@iterator"],typeof s=="function"?s:null)}var de=Symbol.for("react.client.reference");function Ee(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===de?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case S:return"Fragment";case k:return"Profiler";case C:return"StrictMode";case $:return"Suspense";case P:return"SuspenseList";case K:return"Activity"}if(typeof s=="object")switch(s.$$typeof){case N:return"Portal";case A:return s.displayName||"Context";case T:return(s._context.displayName||"Context")+".Consumer";case z:var i=s.render;return s=s.displayName,s||(s=i.displayName||i.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case E:return i=s.displayName||null,i!==null?i:Ee(s.type)||"Memo";case O:i=s._payload,s=s._init;try{return Ee(s(i))}catch{}}return null}var be=Array.isArray,H=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ae=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,pe={pending:!1,data:null,method:null,action:null},ce=[],U=-1;function R(s){return{current:s}}function M(s){0>U||(s.current=ce[U],ce[U]=null,U--)}function J(s,i){U++,ce[U]=s.current,s.current=i}var V=R(null),Q=R(null),me=R(null),ge=R(null);function Ne(s,i){switch(J(me,i),J(Q,s),J(V,null),i.nodeType){case 9:case 11:s=(s=i.documentElement)&&(s=s.namespaceURI)?vv(s):0;break;default:if(s=i.tagName,i=i.namespaceURI)i=vv(i),s=bv(i,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}M(V),J(V,s)}function he(){M(V),M(Q),M(me)}function Me(s){s.memoizedState!==null&&J(ge,s);var i=V.current,l=bv(i,s.type);i!==l&&(J(Q,s),J(V,l))}function Je(s){Q.current===s&&(M(V),M(Q)),ge.current===s&&(M(ge),Po._currentValue=pe)}var le,Ie;function Ye(s){if(le===void 0)try{throw Error()}catch(l){var i=l.stack.trim().match(/\n( *(at )?)/);le=i&&i[1]||"",Ie=-1<l.stack.indexOf(`
2
- at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
3
- `+le+s+Ie}var Vt=!1;function Ut(s,i){if(!s||Vt)return"";Vt=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var d={DetermineComponentFrameRoot:function(){try{if(i){var ie=function(){throw Error()};if(Object.defineProperty(ie.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ie,[])}catch(Y){var Z=Y}Reflect.construct(s,[],ie)}else{try{ie.call()}catch(Y){Z=Y}s.call(ie.prototype)}}else{try{throw Error()}catch(Y){Z=Y}(ie=s())&&typeof ie.catch=="function"&&ie.catch(function(){})}}catch(Y){if(Y&&Z&&typeof Y.stack=="string")return[Y.stack,Z.stack]}return[null,null]}};d.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var h=Object.getOwnPropertyDescriptor(d.DetermineComponentFrameRoot,"name");h&&h.configurable&&Object.defineProperty(d.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var g=d.DetermineComponentFrameRoot(),j=g[0],_=g[1];if(j&&_){var D=j.split(`
4
- `),F=_.split(`
5
- `);for(h=d=0;d<D.length&&!D[d].includes("DetermineComponentFrameRoot");)d++;for(;h<F.length&&!F[h].includes("DetermineComponentFrameRoot");)h++;if(d===D.length||h===F.length)for(d=D.length-1,h=F.length-1;1<=d&&0<=h&&D[d]!==F[h];)h--;for(;1<=d&&0<=h;d--,h--)if(D[d]!==F[h]){if(d!==1||h!==1)do if(d--,h--,0>h||D[d]!==F[h]){var W=`
6
- `+D[d].replace(" at new "," at ");return s.displayName&&W.includes("<anonymous>")&&(W=W.replace("<anonymous>",s.displayName)),W}while(1<=d&&0<=h);break}}}finally{Vt=!1,Error.prepareStackTrace=l}return(l=s?s.displayName||s.name:"")?Ye(l):""}function Mn(s,i){switch(s.tag){case 26:case 27:case 5:return Ye(s.type);case 16:return Ye("Lazy");case 13:return s.child!==i&&i!==null?Ye("Suspense Fallback"):Ye("Suspense");case 19:return Ye("SuspenseList");case 0:case 15:return Ut(s.type,!1);case 11:return Ut(s.type.render,!1);case 1:return Ut(s.type,!0);case 31:return Ye("Activity");default:return""}}function nn(s){try{var i="",l=null;do i+=Mn(s,l),l=s,s=s.return;while(s);return i}catch(d){return`
7
- Error generating stack: `+d.message+`
8
- `+d.stack}}var At=Object.prototype.hasOwnProperty,re=e.unstable_scheduleCallback,Ze=e.unstable_cancelCallback,ut=e.unstable_shouldYield,Qt=e.unstable_requestPaint,Ve=e.unstable_now,$e=e.unstable_getCurrentPriorityLevel,Xe=e.unstable_ImmediatePriority,Ct=e.unstable_UserBlockingPriority,Ke=e.unstable_NormalPriority,Ma=e.unstable_LowPriority,gn=e.unstable_IdlePriority,st=e.log,Xr=e.unstable_setDisableYieldValue,ns=null,mt=null;function yn(s){if(typeof st=="function"&&Xr(s),mt&&typeof mt.setStrictMode=="function")try{mt.setStrictMode(ns,s)}catch{}}var ue=Math.clz32?Math.clz32:Cl,zn=Math.log,$a=Math.LN2;function Cl(s){return s>>>=0,s===0?32:31-(zn(s)/$a|0)|0}var Gi=256,Pa=262144,Cs=4194304;function ms(s){var i=s&42;if(i!==0)return i;switch(s&-s){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return s&261888;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function Ua(s,i,l){var d=s.pendingLanes;if(d===0)return 0;var h=0,g=s.suspendedLanes,j=s.pingedLanes;s=s.warmLanes;var _=d&134217727;return _!==0?(d=_&~g,d!==0?h=ms(d):(j&=_,j!==0?h=ms(j):l||(l=_&~s,l!==0&&(h=ms(l))))):(_=d&~g,_!==0?h=ms(_):j!==0?h=ms(j):l||(l=d&~s,l!==0&&(h=ms(l)))),h===0?0:i!==0&&i!==h&&(i&g)===0&&(g=h&-h,l=i&-i,g>=l||g===32&&(l&4194048)!==0)?i:h}function Ys(s,i){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&i)===0}function jd(s,i){switch(s){case 1:case 2:case 4:case 8:case 64:return i+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return i+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function kl(){var s=Cs;return Cs<<=1,(Cs&62914560)===0&&(Cs=4194304),s}function Wr(s){for(var i=[],l=0;31>l;l++)i.push(s);return i}function Fi(s,i){s.pendingLanes|=i,i!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function zl(s,i,l,d,h,g){var j=s.pendingLanes;s.pendingLanes=l,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=l,s.entangledLanes&=l,s.errorRecoveryDisabledLanes&=l,s.shellSuspendCounter=0;var _=s.entanglements,D=s.expirationTimes,F=s.hiddenUpdates;for(l=j&~l;0<l;){var W=31-ue(l),ie=1<<W;_[W]=0,D[W]=-1;var Z=F[W];if(Z!==null)for(F[W]=null,W=0;W<Z.length;W++){var Y=Z[W];Y!==null&&(Y.lane&=-536870913)}l&=~ie}d!==0&&B(s,d,0),g!==0&&h===0&&s.tag!==0&&(s.suspendedLanes|=g&~(j&~i))}function B(s,i,l){s.pendingLanes|=i,s.suspendedLanes&=~i;var d=31-ue(i);s.entangledLanes|=i,s.entanglements[d]=s.entanglements[d]|1073741824|l&261930}function fe(s,i){var l=s.entangledLanes|=i;for(s=s.entanglements;l;){var d=31-ue(l),h=1<<d;h&i|s[d]&i&&(s[d]|=i),l&=~h}}function bt(s,i){var l=i&-i;return l=(l&42)!==0?1:Gt(l),(l&(s.suspendedLanes|i))!==0?0:l}function Gt(s){switch(s){case 2:s=1;break;case 8:s=4;break;case 32:s=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:s=128;break;case 268435456:s=134217728;break;default:s=0}return s}function ln(s){return s&=-s,2<s?8<s?(s&134217727)!==0?32:268435456:8:2}function Ia(){var s=ae.p;return s!==0?s:(s=window.event,s===void 0?32:qv(s.type))}function ps(s,i){var l=ae.p;try{return ae.p=s,i()}finally{ae.p=l}}var cn=Math.random().toString(36).slice(2),it="__reactFiber$"+cn,sn="__reactProps$"+cn,_n="__reactContainer$"+cn,ks="__reactEvents$"+cn,Ba="__reactListeners$"+cn,_l="__reactHandles$"+cn,El="__reactResources$"+cn,gs="__reactMarker$"+cn;function Js(s){delete s[it],delete s[sn],delete s[ks],delete s[Ba],delete s[_l]}function Xs(s){var i=s[it];if(i)return i;for(var l=s.parentNode;l;){if(i=l[_n]||l[it]){if(l=i.alternate,i.child!==null||l!==null&&l.child!==null)for(s=kv(s);s!==null;){if(l=s[it])return l;s=kv(s)}return i}s=l,l=s.parentNode}return null}function Ws(s){if(s=s[it]||s[_n]){var i=s.tag;if(i===5||i===6||i===13||i===31||i===26||i===27||i===3)return s}return null}function Pe(s){var i=s.tag;if(i===5||i===26||i===27||i===6)return s.stateNode;throw Error(a(33))}function We(s){var i=s[El];return i||(i=s[El]={hoistableStyles:new Map,hoistableScripts:new Map}),i}function at(s){s[gs]=!0}var ss=new Set,Zi={};function ys(s,i){qa(s,i),qa(s+"Capture",i)}function qa(s,i){for(Zi[s]=i,s=0;s<i.length;s++)ss.add(i[s])}var WN=RegExp("^[: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]*$"),lg={},cg={};function e1(s){return At.call(cg,s)?!0:At.call(lg,s)?!1:WN.test(s)?cg[s]=!0:(lg[s]=!0,!1)}function Al(s,i,l){if(e1(i))if(l===null)s.removeAttribute(i);else{switch(typeof l){case"undefined":case"function":case"symbol":s.removeAttribute(i);return;case"boolean":var d=i.toLowerCase().slice(0,5);if(d!=="data-"&&d!=="aria-"){s.removeAttribute(i);return}}s.setAttribute(i,""+l)}}function Tl(s,i,l){if(l===null)s.removeAttribute(i);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(i);return}s.setAttribute(i,""+l)}}function zs(s,i,l,d){if(d===null)s.removeAttribute(l);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(l);return}s.setAttributeNS(i,l,""+d)}}function $n(s){switch(typeof s){case"bigint":case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function ug(s){var i=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function t1(s,i,l){var d=Object.getOwnPropertyDescriptor(s.constructor.prototype,i);if(!s.hasOwnProperty(i)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var h=d.get,g=d.set;return Object.defineProperty(s,i,{configurable:!0,get:function(){return h.call(this)},set:function(j){l=""+j,g.call(this,j)}}),Object.defineProperty(s,i,{enumerable:d.enumerable}),{getValue:function(){return l},setValue:function(j){l=""+j},stopTracking:function(){s._valueTracker=null,delete s[i]}}}}function wd(s){if(!s._valueTracker){var i=ug(s)?"checked":"value";s._valueTracker=t1(s,i,""+s[i])}}function dg(s){if(!s)return!1;var i=s._valueTracker;if(!i)return!0;var l=i.getValue(),d="";return s&&(d=ug(s)?s.checked?"true":"false":s.value),s=d,s!==l?(i.setValue(s),!0):!1}function Rl(s){if(s=s||(typeof document<"u"?document:void 0),typeof s>"u")return null;try{return s.activeElement||s.body}catch{return s.body}}var n1=/[\n"\\]/g;function Pn(s){return s.replace(n1,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function Nd(s,i,l,d,h,g,j,_){s.name="",j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"?s.type=j:s.removeAttribute("type"),i!=null?j==="number"?(i===0&&s.value===""||s.value!=i)&&(s.value=""+$n(i)):s.value!==""+$n(i)&&(s.value=""+$n(i)):j!=="submit"&&j!=="reset"||s.removeAttribute("value"),i!=null?Cd(s,j,$n(i)):l!=null?Cd(s,j,$n(l)):d!=null&&s.removeAttribute("value"),h==null&&g!=null&&(s.defaultChecked=!!g),h!=null&&(s.checked=h&&typeof h!="function"&&typeof h!="symbol"),_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"?s.name=""+$n(_):s.removeAttribute("name")}function fg(s,i,l,d,h,g,j,_){if(g!=null&&typeof g!="function"&&typeof g!="symbol"&&typeof g!="boolean"&&(s.type=g),i!=null||l!=null){if(!(g!=="submit"&&g!=="reset"||i!=null)){wd(s);return}l=l!=null?""+$n(l):"",i=i!=null?""+$n(i):l,_||i===s.value||(s.value=i),s.defaultValue=i}d=d??h,d=typeof d!="function"&&typeof d!="symbol"&&!!d,s.checked=_?s.checked:!!d,s.defaultChecked=!!d,j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"&&(s.name=j),wd(s)}function Cd(s,i,l){i==="number"&&Rl(s.ownerDocument)===s||s.defaultValue===""+l||(s.defaultValue=""+l)}function Ka(s,i,l,d){if(s=s.options,i){i={};for(var h=0;h<l.length;h++)i["$"+l[h]]=!0;for(l=0;l<s.length;l++)h=i.hasOwnProperty("$"+s[l].value),s[l].selected!==h&&(s[l].selected=h),h&&d&&(s[l].defaultSelected=!0)}else{for(l=""+$n(l),i=null,h=0;h<s.length;h++){if(s[h].value===l){s[h].selected=!0,d&&(s[h].defaultSelected=!0);return}i!==null||s[h].disabled||(i=s[h])}i!==null&&(i.selected=!0)}}function hg(s,i,l){if(i!=null&&(i=""+$n(i),i!==s.value&&(s.value=i),l==null)){s.defaultValue!==i&&(s.defaultValue=i);return}s.defaultValue=l!=null?""+$n(l):""}function mg(s,i,l,d){if(i==null){if(d!=null){if(l!=null)throw Error(a(92));if(be(d)){if(1<d.length)throw Error(a(93));d=d[0]}l=d}l==null&&(l=""),i=l}l=$n(i),s.defaultValue=l,d=s.textContent,d===l&&d!==""&&d!==null&&(s.value=d),wd(s)}function Ha(s,i){if(i){var l=s.firstChild;if(l&&l===s.lastChild&&l.nodeType===3){l.nodeValue=i;return}}s.textContent=i}var s1=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function pg(s,i,l){var d=i.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?d?s.setProperty(i,""):i==="float"?s.cssFloat="":s[i]="":d?s.setProperty(i,l):typeof l!="number"||l===0||s1.has(i)?i==="float"?s.cssFloat=l:s[i]=(""+l).trim():s[i]=l+"px"}function gg(s,i,l){if(i!=null&&typeof i!="object")throw Error(a(62));if(s=s.style,l!=null){for(var d in l)!l.hasOwnProperty(d)||i!=null&&i.hasOwnProperty(d)||(d.indexOf("--")===0?s.setProperty(d,""):d==="float"?s.cssFloat="":s[d]="");for(var h in i)d=i[h],i.hasOwnProperty(h)&&l[h]!==d&&pg(s,h,d)}else for(var g in i)i.hasOwnProperty(g)&&pg(s,g,i[g])}function kd(s){if(s.indexOf("-")===-1)return!1;switch(s){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 i1=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),a1=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Ol(s){return a1.test(""+s)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":s}function _s(){}var zd=null;function _d(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var Ga=null,Fa=null;function yg(s){var i=Ws(s);if(i&&(s=i.stateNode)){var l=s[sn]||null;e:switch(s=i.stateNode,i.type){case"input":if(Nd(s,l.value,l.defaultValue,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name),i=l.name,l.type==="radio"&&i!=null){for(l=s;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll('input[name="'+Pn(""+i)+'"][type="radio"]'),i=0;i<l.length;i++){var d=l[i];if(d!==s&&d.form===s.form){var h=d[sn]||null;if(!h)throw Error(a(90));Nd(d,h.value,h.defaultValue,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name)}}for(i=0;i<l.length;i++)d=l[i],d.form===s.form&&dg(d)}break e;case"textarea":hg(s,l.value,l.defaultValue);break e;case"select":i=l.value,i!=null&&Ka(s,!!l.multiple,i,!1)}}}var Ed=!1;function vg(s,i,l){if(Ed)return s(i,l);Ed=!0;try{var d=s(i);return d}finally{if(Ed=!1,(Ga!==null||Fa!==null)&&(xc(),Ga&&(i=Ga,s=Fa,Fa=Ga=null,yg(i),s)))for(i=0;i<s.length;i++)yg(s[i])}}function eo(s,i){var l=s.stateNode;if(l===null)return null;var d=l[sn]||null;if(d===null)return null;l=d[i];e:switch(i){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(d=!d.disabled)||(s=s.type,d=!(s==="button"||s==="input"||s==="select"||s==="textarea")),s=!d;break e;default:s=!1}if(s)return null;if(l&&typeof l!="function")throw Error(a(231,i,typeof l));return l}var Es=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ad=!1;if(Es)try{var to={};Object.defineProperty(to,"passive",{get:function(){Ad=!0}}),window.addEventListener("test",to,to),window.removeEventListener("test",to,to)}catch{Ad=!1}var ei=null,Td=null,Ll=null;function bg(){if(Ll)return Ll;var s,i=Td,l=i.length,d,h="value"in ei?ei.value:ei.textContent,g=h.length;for(s=0;s<l&&i[s]===h[s];s++);var j=l-s;for(d=1;d<=j&&i[l-d]===h[g-d];d++);return Ll=h.slice(s,1<d?1-d:void 0)}function Dl(s){var i=s.keyCode;return"charCode"in s?(s=s.charCode,s===0&&i===13&&(s=13)):s=i,s===10&&(s=13),32<=s||s===13?s:0}function Ml(){return!0}function xg(){return!1}function vn(s){function i(l,d,h,g,j){this._reactName=l,this._targetInst=h,this.type=d,this.nativeEvent=g,this.target=j,this.currentTarget=null;for(var _ in s)s.hasOwnProperty(_)&&(l=s[_],this[_]=l?l(g):g[_]);return this.isDefaultPrevented=(g.defaultPrevented!=null?g.defaultPrevented:g.returnValue===!1)?Ml:xg,this.isPropagationStopped=xg,this}return y(i.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=Ml)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=Ml)},persist:function(){},isPersistent:Ml}),i}var Vi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},$l=vn(Vi),no=y({},Vi,{view:0,detail:0}),r1=vn(no),Rd,Od,so,Pl=y({},no,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Dd,button:0,buttons:0,relatedTarget:function(s){return s.relatedTarget===void 0?s.fromElement===s.srcElement?s.toElement:s.fromElement:s.relatedTarget},movementX:function(s){return"movementX"in s?s.movementX:(s!==so&&(so&&s.type==="mousemove"?(Rd=s.screenX-so.screenX,Od=s.screenY-so.screenY):Od=Rd=0,so=s),Rd)},movementY:function(s){return"movementY"in s?s.movementY:Od}}),Sg=vn(Pl),o1=y({},Pl,{dataTransfer:0}),l1=vn(o1),c1=y({},no,{relatedTarget:0}),Ld=vn(c1),u1=y({},Vi,{animationName:0,elapsedTime:0,pseudoElement:0}),d1=vn(u1),f1=y({},Vi,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),h1=vn(f1),m1=y({},Vi,{data:0}),jg=vn(m1),p1={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},g1={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},y1={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function v1(s){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(s):(s=y1[s])?!!i[s]:!1}function Dd(){return v1}var b1=y({},no,{key:function(s){if(s.key){var i=p1[s.key]||s.key;if(i!=="Unidentified")return i}return s.type==="keypress"?(s=Dl(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?g1[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Dd,charCode:function(s){return s.type==="keypress"?Dl(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?Dl(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),x1=vn(b1),S1=y({},Pl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),wg=vn(S1),j1=y({},no,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Dd}),w1=vn(j1),N1=y({},Vi,{propertyName:0,elapsedTime:0,pseudoElement:0}),C1=vn(N1),k1=y({},Pl,{deltaX:function(s){return"deltaX"in s?s.deltaX:"wheelDeltaX"in s?-s.wheelDeltaX:0},deltaY:function(s){return"deltaY"in s?s.deltaY:"wheelDeltaY"in s?-s.wheelDeltaY:"wheelDelta"in s?-s.wheelDelta:0},deltaZ:0,deltaMode:0}),z1=vn(k1),_1=y({},Vi,{newState:0,oldState:0}),E1=vn(_1),A1=[9,13,27,32],Md=Es&&"CompositionEvent"in window,io=null;Es&&"documentMode"in document&&(io=document.documentMode);var T1=Es&&"TextEvent"in window&&!io,Ng=Es&&(!Md||io&&8<io&&11>=io),Cg=" ",kg=!1;function zg(s,i){switch(s){case"keyup":return A1.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function _g(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var Za=!1;function R1(s,i){switch(s){case"compositionend":return _g(i);case"keypress":return i.which!==32?null:(kg=!0,Cg);case"textInput":return s=i.data,s===Cg&&kg?null:s;default:return null}}function O1(s,i){if(Za)return s==="compositionend"||!Md&&zg(s,i)?(s=bg(),Ll=Td=ei=null,Za=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(i.ctrlKey||i.altKey||i.metaKey)||i.ctrlKey&&i.altKey){if(i.char&&1<i.char.length)return i.char;if(i.which)return String.fromCharCode(i.which)}return null;case"compositionend":return Ng&&i.locale!=="ko"?null:i.data;default:return null}}var L1={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Eg(s){var i=s&&s.nodeName&&s.nodeName.toLowerCase();return i==="input"?!!L1[s.type]:i==="textarea"}function Ag(s,i,l,d){Ga?Fa?Fa.push(d):Fa=[d]:Ga=d,i=zc(i,"onChange"),0<i.length&&(l=new $l("onChange","change",null,l,d),s.push({event:l,listeners:i}))}var ao=null,ro=null;function D1(s){fv(s,0)}function Ul(s){var i=Pe(s);if(dg(i))return s}function Tg(s,i){if(s==="change")return i}var Rg=!1;if(Es){var $d;if(Es){var Pd="oninput"in document;if(!Pd){var Og=document.createElement("div");Og.setAttribute("oninput","return;"),Pd=typeof Og.oninput=="function"}$d=Pd}else $d=!1;Rg=$d&&(!document.documentMode||9<document.documentMode)}function Lg(){ao&&(ao.detachEvent("onpropertychange",Dg),ro=ao=null)}function Dg(s){if(s.propertyName==="value"&&Ul(ro)){var i=[];Ag(i,ro,s,_d(s)),vg(D1,i)}}function M1(s,i,l){s==="focusin"?(Lg(),ao=i,ro=l,ao.attachEvent("onpropertychange",Dg)):s==="focusout"&&Lg()}function $1(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return Ul(ro)}function P1(s,i){if(s==="click")return Ul(i)}function U1(s,i){if(s==="input"||s==="change")return Ul(i)}function I1(s,i){return s===i&&(s!==0||1/s===1/i)||s!==s&&i!==i}var En=typeof Object.is=="function"?Object.is:I1;function oo(s,i){if(En(s,i))return!0;if(typeof s!="object"||s===null||typeof i!="object"||i===null)return!1;var l=Object.keys(s),d=Object.keys(i);if(l.length!==d.length)return!1;for(d=0;d<l.length;d++){var h=l[d];if(!At.call(i,h)||!En(s[h],i[h]))return!1}return!0}function Mg(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function $g(s,i){var l=Mg(s);s=0;for(var d;l;){if(l.nodeType===3){if(d=s+l.textContent.length,s<=i&&d>=i)return{node:l,offset:i-s};s=d}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=Mg(l)}}function Pg(s,i){return s&&i?s===i?!0:s&&s.nodeType===3?!1:i&&i.nodeType===3?Pg(s,i.parentNode):"contains"in s?s.contains(i):s.compareDocumentPosition?!!(s.compareDocumentPosition(i)&16):!1:!1}function Ug(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var i=Rl(s.document);i instanceof s.HTMLIFrameElement;){try{var l=typeof i.contentWindow.location.href=="string"}catch{l=!1}if(l)s=i.contentWindow;else break;i=Rl(s.document)}return i}function Ud(s){var i=s&&s.nodeName&&s.nodeName.toLowerCase();return i&&(i==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||i==="textarea"||s.contentEditable==="true")}var B1=Es&&"documentMode"in document&&11>=document.documentMode,Va=null,Id=null,lo=null,Bd=!1;function Ig(s,i,l){var d=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;Bd||Va==null||Va!==Rl(d)||(d=Va,"selectionStart"in d&&Ud(d)?d={start:d.selectionStart,end:d.selectionEnd}:(d=(d.ownerDocument&&d.ownerDocument.defaultView||window).getSelection(),d={anchorNode:d.anchorNode,anchorOffset:d.anchorOffset,focusNode:d.focusNode,focusOffset:d.focusOffset}),lo&&oo(lo,d)||(lo=d,d=zc(Id,"onSelect"),0<d.length&&(i=new $l("onSelect","select",null,i,l),s.push({event:i,listeners:d}),i.target=Va)))}function Qi(s,i){var l={};return l[s.toLowerCase()]=i.toLowerCase(),l["Webkit"+s]="webkit"+i,l["Moz"+s]="moz"+i,l}var Qa={animationend:Qi("Animation","AnimationEnd"),animationiteration:Qi("Animation","AnimationIteration"),animationstart:Qi("Animation","AnimationStart"),transitionrun:Qi("Transition","TransitionRun"),transitionstart:Qi("Transition","TransitionStart"),transitioncancel:Qi("Transition","TransitionCancel"),transitionend:Qi("Transition","TransitionEnd")},qd={},Bg={};Es&&(Bg=document.createElement("div").style,"AnimationEvent"in window||(delete Qa.animationend.animation,delete Qa.animationiteration.animation,delete Qa.animationstart.animation),"TransitionEvent"in window||delete Qa.transitionend.transition);function Yi(s){if(qd[s])return qd[s];if(!Qa[s])return s;var i=Qa[s],l;for(l in i)if(i.hasOwnProperty(l)&&l in Bg)return qd[s]=i[l];return s}var qg=Yi("animationend"),Kg=Yi("animationiteration"),Hg=Yi("animationstart"),q1=Yi("transitionrun"),K1=Yi("transitionstart"),H1=Yi("transitioncancel"),Gg=Yi("transitionend"),Fg=new Map,Kd="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Kd.push("scrollEnd");function is(s,i){Fg.set(s,i),ys(i,[s])}var Il=typeof reportError=="function"?reportError:function(s){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var i=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof s=="object"&&s!==null&&typeof s.message=="string"?String(s.message):String(s),error:s});if(!window.dispatchEvent(i))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",s);return}console.error(s)},Un=[],Ya=0,Hd=0;function Bl(){for(var s=Ya,i=Hd=Ya=0;i<s;){var l=Un[i];Un[i++]=null;var d=Un[i];Un[i++]=null;var h=Un[i];Un[i++]=null;var g=Un[i];if(Un[i++]=null,d!==null&&h!==null){var j=d.pending;j===null?h.next=h:(h.next=j.next,j.next=h),d.pending=h}g!==0&&Zg(l,h,g)}}function ql(s,i,l,d){Un[Ya++]=s,Un[Ya++]=i,Un[Ya++]=l,Un[Ya++]=d,Hd|=d,s.lanes|=d,s=s.alternate,s!==null&&(s.lanes|=d)}function Gd(s,i,l,d){return ql(s,i,l,d),Kl(s)}function Ji(s,i){return ql(s,null,null,i),Kl(s)}function Zg(s,i,l){s.lanes|=l;var d=s.alternate;d!==null&&(d.lanes|=l);for(var h=!1,g=s.return;g!==null;)g.childLanes|=l,d=g.alternate,d!==null&&(d.childLanes|=l),g.tag===22&&(s=g.stateNode,s===null||s._visibility&1||(h=!0)),s=g,g=g.return;return s.tag===3?(g=s.stateNode,h&&i!==null&&(h=31-ue(l),s=g.hiddenUpdates,d=s[h],d===null?s[h]=[i]:d.push(i),i.lane=l|536870912),g):null}function Kl(s){if(50<To)throw To=0,th=null,Error(a(185));for(var i=s.return;i!==null;)s=i,i=s.return;return s.tag===3?s.stateNode:null}var Ja={};function G1(s,i,l,d){this.tag=s,this.key=l,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=i,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=d,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function An(s,i,l,d){return new G1(s,i,l,d)}function Fd(s){return s=s.prototype,!(!s||!s.isReactComponent)}function As(s,i){var l=s.alternate;return l===null?(l=An(s.tag,i,s.key,s.mode),l.elementType=s.elementType,l.type=s.type,l.stateNode=s.stateNode,l.alternate=s,s.alternate=l):(l.pendingProps=i,l.type=s.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=s.flags&65011712,l.childLanes=s.childLanes,l.lanes=s.lanes,l.child=s.child,l.memoizedProps=s.memoizedProps,l.memoizedState=s.memoizedState,l.updateQueue=s.updateQueue,i=s.dependencies,l.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext},l.sibling=s.sibling,l.index=s.index,l.ref=s.ref,l.refCleanup=s.refCleanup,l}function Vg(s,i){s.flags&=65011714;var l=s.alternate;return l===null?(s.childLanes=0,s.lanes=i,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=l.childLanes,s.lanes=l.lanes,s.child=l.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=l.memoizedProps,s.memoizedState=l.memoizedState,s.updateQueue=l.updateQueue,s.type=l.type,i=l.dependencies,s.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),s}function Hl(s,i,l,d,h,g){var j=0;if(d=s,typeof s=="function")Fd(s)&&(j=1);else if(typeof s=="string")j=YC(s,l,V.current)?26:s==="html"||s==="head"||s==="body"?27:5;else e:switch(s){case K:return s=An(31,l,i,h),s.elementType=K,s.lanes=g,s;case S:return Xi(l.children,h,g,i);case C:j=8,h|=24;break;case k:return s=An(12,l,i,h|2),s.elementType=k,s.lanes=g,s;case $:return s=An(13,l,i,h),s.elementType=$,s.lanes=g,s;case P:return s=An(19,l,i,h),s.elementType=P,s.lanes=g,s;default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case A:j=10;break e;case T:j=9;break e;case z:j=11;break e;case E:j=14;break e;case O:j=16,d=null;break e}j=29,l=Error(a(130,s===null?"null":typeof s,"")),d=null}return i=An(j,l,i,h),i.elementType=s,i.type=d,i.lanes=g,i}function Xi(s,i,l,d){return s=An(7,s,d,i),s.lanes=l,s}function Zd(s,i,l){return s=An(6,s,null,i),s.lanes=l,s}function Qg(s){var i=An(18,null,null,0);return i.stateNode=s,i}function Vd(s,i,l){return i=An(4,s.children!==null?s.children:[],s.key,i),i.lanes=l,i.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},i}var Yg=new WeakMap;function In(s,i){if(typeof s=="object"&&s!==null){var l=Yg.get(s);return l!==void 0?l:(i={value:s,source:i,stack:nn(i)},Yg.set(s,i),i)}return{value:s,source:i,stack:nn(i)}}var Xa=[],Wa=0,Gl=null,co=0,Bn=[],qn=0,ti=null,vs=1,bs="";function Ts(s,i){Xa[Wa++]=co,Xa[Wa++]=Gl,Gl=s,co=i}function Jg(s,i,l){Bn[qn++]=vs,Bn[qn++]=bs,Bn[qn++]=ti,ti=s;var d=vs;s=bs;var h=32-ue(d)-1;d&=~(1<<h),l+=1;var g=32-ue(i)+h;if(30<g){var j=h-h%5;g=(d&(1<<j)-1).toString(32),d>>=j,h-=j,vs=1<<32-ue(i)+h|l<<h|d,bs=g+s}else vs=1<<g|l<<h|d,bs=s}function Qd(s){s.return!==null&&(Ts(s,1),Jg(s,1,0))}function Yd(s){for(;s===Gl;)Gl=Xa[--Wa],Xa[Wa]=null,co=Xa[--Wa],Xa[Wa]=null;for(;s===ti;)ti=Bn[--qn],Bn[qn]=null,bs=Bn[--qn],Bn[qn]=null,vs=Bn[--qn],Bn[qn]=null}function Xg(s,i){Bn[qn++]=vs,Bn[qn++]=bs,Bn[qn++]=ti,vs=i.id,bs=i.overflow,ti=s}var Jt=null,yt=null,Qe=!1,ni=null,Kn=!1,Jd=Error(a(519));function si(s){var i=Error(a(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw uo(In(i,s)),Jd}function Wg(s){var i=s.stateNode,l=s.type,d=s.memoizedProps;switch(i[it]=s,i[sn]=d,l){case"dialog":qe("cancel",i),qe("close",i);break;case"iframe":case"object":case"embed":qe("load",i);break;case"video":case"audio":for(l=0;l<Oo.length;l++)qe(Oo[l],i);break;case"source":qe("error",i);break;case"img":case"image":case"link":qe("error",i),qe("load",i);break;case"details":qe("toggle",i);break;case"input":qe("invalid",i),fg(i,d.value,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name,!0);break;case"select":qe("invalid",i);break;case"textarea":qe("invalid",i),mg(i,d.value,d.defaultValue,d.children)}l=d.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||i.textContent===""+l||d.suppressHydrationWarning===!0||gv(i.textContent,l)?(d.popover!=null&&(qe("beforetoggle",i),qe("toggle",i)),d.onScroll!=null&&qe("scroll",i),d.onScrollEnd!=null&&qe("scrollend",i),d.onClick!=null&&(i.onclick=_s),i=!0):i=!1,i||si(s,!0)}function ey(s){for(Jt=s.return;Jt;)switch(Jt.tag){case 5:case 31:case 13:Kn=!1;return;case 27:case 3:Kn=!0;return;default:Jt=Jt.return}}function er(s){if(s!==Jt)return!1;if(!Qe)return ey(s),Qe=!0,!1;var i=s.tag,l;if((l=i!==3&&i!==27)&&((l=i===5)&&(l=s.type,l=!(l!=="form"&&l!=="button")||gh(s.type,s.memoizedProps)),l=!l),l&&yt&&si(s),ey(s),i===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(a(317));yt=Cv(s)}else if(i===31){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(a(317));yt=Cv(s)}else i===27?(i=yt,yi(s.type)?(s=Sh,Sh=null,yt=s):yt=i):yt=Jt?Gn(s.stateNode.nextSibling):null;return!0}function Wi(){yt=Jt=null,Qe=!1}function Xd(){var s=ni;return s!==null&&(jn===null?jn=s:jn.push.apply(jn,s),ni=null),s}function uo(s){ni===null?ni=[s]:ni.push(s)}var Wd=R(null),ea=null,Rs=null;function ii(s,i,l){J(Wd,i._currentValue),i._currentValue=l}function Os(s){s._currentValue=Wd.current,M(Wd)}function ef(s,i,l){for(;s!==null;){var d=s.alternate;if((s.childLanes&i)!==i?(s.childLanes|=i,d!==null&&(d.childLanes|=i)):d!==null&&(d.childLanes&i)!==i&&(d.childLanes|=i),s===l)break;s=s.return}}function tf(s,i,l,d){var h=s.child;for(h!==null&&(h.return=s);h!==null;){var g=h.dependencies;if(g!==null){var j=h.child;g=g.firstContext;e:for(;g!==null;){var _=g;g=h;for(var D=0;D<i.length;D++)if(_.context===i[D]){g.lanes|=l,_=g.alternate,_!==null&&(_.lanes|=l),ef(g.return,l,s),d||(j=null);break e}g=_.next}}else if(h.tag===18){if(j=h.return,j===null)throw Error(a(341));j.lanes|=l,g=j.alternate,g!==null&&(g.lanes|=l),ef(j,l,s),j=null}else j=h.child;if(j!==null)j.return=h;else for(j=h;j!==null;){if(j===s){j=null;break}if(h=j.sibling,h!==null){h.return=j.return,j=h;break}j=j.return}h=j}}function tr(s,i,l,d){s=null;for(var h=i,g=!1;h!==null;){if(!g){if((h.flags&524288)!==0)g=!0;else if((h.flags&262144)!==0)break}if(h.tag===10){var j=h.alternate;if(j===null)throw Error(a(387));if(j=j.memoizedProps,j!==null){var _=h.type;En(h.pendingProps.value,j.value)||(s!==null?s.push(_):s=[_])}}else if(h===ge.current){if(j=h.alternate,j===null)throw Error(a(387));j.memoizedState.memoizedState!==h.memoizedState.memoizedState&&(s!==null?s.push(Po):s=[Po])}h=h.return}s!==null&&tf(i,s,l,d),i.flags|=262144}function Fl(s){for(s=s.firstContext;s!==null;){if(!En(s.context._currentValue,s.memoizedValue))return!0;s=s.next}return!1}function ta(s){ea=s,Rs=null,s=s.dependencies,s!==null&&(s.firstContext=null)}function Xt(s){return ty(ea,s)}function Zl(s,i){return ea===null&&ta(s),ty(s,i)}function ty(s,i){var l=i._currentValue;if(i={context:i,memoizedValue:l,next:null},Rs===null){if(s===null)throw Error(a(308));Rs=i,s.dependencies={lanes:0,firstContext:i},s.flags|=524288}else Rs=Rs.next=i;return l}var F1=typeof AbortController<"u"?AbortController:function(){var s=[],i=this.signal={aborted:!1,addEventListener:function(l,d){s.push(d)}};this.abort=function(){i.aborted=!0,s.forEach(function(l){return l()})}},Z1=e.unstable_scheduleCallback,V1=e.unstable_NormalPriority,It={$$typeof:A,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function nf(){return{controller:new F1,data:new Map,refCount:0}}function fo(s){s.refCount--,s.refCount===0&&Z1(V1,function(){s.controller.abort()})}var ho=null,sf=0,nr=0,sr=null;function Q1(s,i){if(ho===null){var l=ho=[];sf=0,nr=oh(),sr={status:"pending",value:void 0,then:function(d){l.push(d)}}}return sf++,i.then(ny,ny),i}function ny(){if(--sf===0&&ho!==null){sr!==null&&(sr.status="fulfilled");var s=ho;ho=null,nr=0,sr=null;for(var i=0;i<s.length;i++)(0,s[i])()}}function Y1(s,i){var l=[],d={status:"pending",value:null,reason:null,then:function(h){l.push(h)}};return s.then(function(){d.status="fulfilled",d.value=i;for(var h=0;h<l.length;h++)(0,l[h])(i)},function(h){for(d.status="rejected",d.reason=h,h=0;h<l.length;h++)(0,l[h])(void 0)}),d}var sy=H.S;H.S=function(s,i){I0=Ve(),typeof i=="object"&&i!==null&&typeof i.then=="function"&&Q1(s,i),sy!==null&&sy(s,i)};var na=R(null);function af(){var s=na.current;return s!==null?s:pt.pooledCache}function Vl(s,i){i===null?J(na,na.current):J(na,i.pool)}function iy(){var s=af();return s===null?null:{parent:It._currentValue,pool:s}}var ir=Error(a(460)),rf=Error(a(474)),Ql=Error(a(542)),Yl={then:function(){}};function ay(s){return s=s.status,s==="fulfilled"||s==="rejected"}function ry(s,i,l){switch(l=s[l],l===void 0?s.push(i):l!==i&&(i.then(_s,_s),i=l),i.status){case"fulfilled":return i.value;case"rejected":throw s=i.reason,ly(s),s;default:if(typeof i.status=="string")i.then(_s,_s);else{if(s=pt,s!==null&&100<s.shellSuspendCounter)throw Error(a(482));s=i,s.status="pending",s.then(function(d){if(i.status==="pending"){var h=i;h.status="fulfilled",h.value=d}},function(d){if(i.status==="pending"){var h=i;h.status="rejected",h.reason=d}})}switch(i.status){case"fulfilled":return i.value;case"rejected":throw s=i.reason,ly(s),s}throw ia=i,ir}}function sa(s){try{var i=s._init;return i(s._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(ia=l,ir):l}}var ia=null;function oy(){if(ia===null)throw Error(a(459));var s=ia;return ia=null,s}function ly(s){if(s===ir||s===Ql)throw Error(a(483))}var ar=null,mo=0;function Jl(s){var i=mo;return mo+=1,ar===null&&(ar=[]),ry(ar,s,i)}function po(s,i){i=i.props.ref,s.ref=i!==void 0?i:null}function Xl(s,i){throw i.$$typeof===b?Error(a(525)):(s=Object.prototype.toString.call(i),Error(a(31,s==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":s)))}function cy(s){function i(q,I){if(s){var G=q.deletions;G===null?(q.deletions=[I],q.flags|=16):G.push(I)}}function l(q,I){if(!s)return null;for(;I!==null;)i(q,I),I=I.sibling;return null}function d(q){for(var I=new Map;q!==null;)q.key!==null?I.set(q.key,q):I.set(q.index,q),q=q.sibling;return I}function h(q,I){return q=As(q,I),q.index=0,q.sibling=null,q}function g(q,I,G){return q.index=G,s?(G=q.alternate,G!==null?(G=G.index,G<I?(q.flags|=67108866,I):G):(q.flags|=67108866,I)):(q.flags|=1048576,I)}function j(q){return s&&q.alternate===null&&(q.flags|=67108866),q}function _(q,I,G,te){return I===null||I.tag!==6?(I=Zd(G,q.mode,te),I.return=q,I):(I=h(I,G),I.return=q,I)}function D(q,I,G,te){var ze=G.type;return ze===S?W(q,I,G.props.children,te,G.key):I!==null&&(I.elementType===ze||typeof ze=="object"&&ze!==null&&ze.$$typeof===O&&sa(ze)===I.type)?(I=h(I,G.props),po(I,G),I.return=q,I):(I=Hl(G.type,G.key,G.props,null,q.mode,te),po(I,G),I.return=q,I)}function F(q,I,G,te){return I===null||I.tag!==4||I.stateNode.containerInfo!==G.containerInfo||I.stateNode.implementation!==G.implementation?(I=Vd(G,q.mode,te),I.return=q,I):(I=h(I,G.children||[]),I.return=q,I)}function W(q,I,G,te,ze){return I===null||I.tag!==7?(I=Xi(G,q.mode,te,ze),I.return=q,I):(I=h(I,G),I.return=q,I)}function ie(q,I,G){if(typeof I=="string"&&I!==""||typeof I=="number"||typeof I=="bigint")return I=Zd(""+I,q.mode,G),I.return=q,I;if(typeof I=="object"&&I!==null){switch(I.$$typeof){case x:return G=Hl(I.type,I.key,I.props,null,q.mode,G),po(G,I),G.return=q,G;case N:return I=Vd(I,q.mode,G),I.return=q,I;case O:return I=sa(I),ie(q,I,G)}if(be(I)||se(I))return I=Xi(I,q.mode,G,null),I.return=q,I;if(typeof I.then=="function")return ie(q,Jl(I),G);if(I.$$typeof===A)return ie(q,Zl(q,I),G);Xl(q,I)}return null}function Z(q,I,G,te){var ze=I!==null?I.key:null;if(typeof G=="string"&&G!==""||typeof G=="number"||typeof G=="bigint")return ze!==null?null:_(q,I,""+G,te);if(typeof G=="object"&&G!==null){switch(G.$$typeof){case x:return G.key===ze?D(q,I,G,te):null;case N:return G.key===ze?F(q,I,G,te):null;case O:return G=sa(G),Z(q,I,G,te)}if(be(G)||se(G))return ze!==null?null:W(q,I,G,te,null);if(typeof G.then=="function")return Z(q,I,Jl(G),te);if(G.$$typeof===A)return Z(q,I,Zl(q,G),te);Xl(q,G)}return null}function Y(q,I,G,te,ze){if(typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint")return q=q.get(G)||null,_(I,q,""+te,ze);if(typeof te=="object"&&te!==null){switch(te.$$typeof){case x:return q=q.get(te.key===null?G:te.key)||null,D(I,q,te,ze);case N:return q=q.get(te.key===null?G:te.key)||null,F(I,q,te,ze);case O:return te=sa(te),Y(q,I,G,te,ze)}if(be(te)||se(te))return q=q.get(G)||null,W(I,q,te,ze,null);if(typeof te.then=="function")return Y(q,I,G,Jl(te),ze);if(te.$$typeof===A)return Y(q,I,G,Zl(I,te),ze);Xl(I,te)}return null}function Se(q,I,G,te){for(var ze=null,et=null,Ce=I,De=I=0,Ge=null;Ce!==null&&De<G.length;De++){Ce.index>De?(Ge=Ce,Ce=null):Ge=Ce.sibling;var tt=Z(q,Ce,G[De],te);if(tt===null){Ce===null&&(Ce=Ge);break}s&&Ce&&tt.alternate===null&&i(q,Ce),I=g(tt,I,De),et===null?ze=tt:et.sibling=tt,et=tt,Ce=Ge}if(De===G.length)return l(q,Ce),Qe&&Ts(q,De),ze;if(Ce===null){for(;De<G.length;De++)Ce=ie(q,G[De],te),Ce!==null&&(I=g(Ce,I,De),et===null?ze=Ce:et.sibling=Ce,et=Ce);return Qe&&Ts(q,De),ze}for(Ce=d(Ce);De<G.length;De++)Ge=Y(Ce,q,De,G[De],te),Ge!==null&&(s&&Ge.alternate!==null&&Ce.delete(Ge.key===null?De:Ge.key),I=g(Ge,I,De),et===null?ze=Ge:et.sibling=Ge,et=Ge);return s&&Ce.forEach(function(ji){return i(q,ji)}),Qe&&Ts(q,De),ze}function Ae(q,I,G,te){if(G==null)throw Error(a(151));for(var ze=null,et=null,Ce=I,De=I=0,Ge=null,tt=G.next();Ce!==null&&!tt.done;De++,tt=G.next()){Ce.index>De?(Ge=Ce,Ce=null):Ge=Ce.sibling;var ji=Z(q,Ce,tt.value,te);if(ji===null){Ce===null&&(Ce=Ge);break}s&&Ce&&ji.alternate===null&&i(q,Ce),I=g(ji,I,De),et===null?ze=ji:et.sibling=ji,et=ji,Ce=Ge}if(tt.done)return l(q,Ce),Qe&&Ts(q,De),ze;if(Ce===null){for(;!tt.done;De++,tt=G.next())tt=ie(q,tt.value,te),tt!==null&&(I=g(tt,I,De),et===null?ze=tt:et.sibling=tt,et=tt);return Qe&&Ts(q,De),ze}for(Ce=d(Ce);!tt.done;De++,tt=G.next())tt=Y(Ce,q,De,tt.value,te),tt!==null&&(s&&tt.alternate!==null&&Ce.delete(tt.key===null?De:tt.key),I=g(tt,I,De),et===null?ze=tt:et.sibling=tt,et=tt);return s&&Ce.forEach(function(ok){return i(q,ok)}),Qe&&Ts(q,De),ze}function ht(q,I,G,te){if(typeof G=="object"&&G!==null&&G.type===S&&G.key===null&&(G=G.props.children),typeof G=="object"&&G!==null){switch(G.$$typeof){case x:e:{for(var ze=G.key;I!==null;){if(I.key===ze){if(ze=G.type,ze===S){if(I.tag===7){l(q,I.sibling),te=h(I,G.props.children),te.return=q,q=te;break e}}else if(I.elementType===ze||typeof ze=="object"&&ze!==null&&ze.$$typeof===O&&sa(ze)===I.type){l(q,I.sibling),te=h(I,G.props),po(te,G),te.return=q,q=te;break e}l(q,I);break}else i(q,I);I=I.sibling}G.type===S?(te=Xi(G.props.children,q.mode,te,G.key),te.return=q,q=te):(te=Hl(G.type,G.key,G.props,null,q.mode,te),po(te,G),te.return=q,q=te)}return j(q);case N:e:{for(ze=G.key;I!==null;){if(I.key===ze)if(I.tag===4&&I.stateNode.containerInfo===G.containerInfo&&I.stateNode.implementation===G.implementation){l(q,I.sibling),te=h(I,G.children||[]),te.return=q,q=te;break e}else{l(q,I);break}else i(q,I);I=I.sibling}te=Vd(G,q.mode,te),te.return=q,q=te}return j(q);case O:return G=sa(G),ht(q,I,G,te)}if(be(G))return Se(q,I,G,te);if(se(G)){if(ze=se(G),typeof ze!="function")throw Error(a(150));return G=ze.call(G),Ae(q,I,G,te)}if(typeof G.then=="function")return ht(q,I,Jl(G),te);if(G.$$typeof===A)return ht(q,I,Zl(q,G),te);Xl(q,G)}return typeof G=="string"&&G!==""||typeof G=="number"||typeof G=="bigint"?(G=""+G,I!==null&&I.tag===6?(l(q,I.sibling),te=h(I,G),te.return=q,q=te):(l(q,I),te=Zd(G,q.mode,te),te.return=q,q=te),j(q)):l(q,I)}return function(q,I,G,te){try{mo=0;var ze=ht(q,I,G,te);return ar=null,ze}catch(Ce){if(Ce===ir||Ce===Ql)throw Ce;var et=An(29,Ce,null,q.mode);return et.lanes=te,et.return=q,et}}}var aa=cy(!0),uy=cy(!1),ai=!1;function of(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function lf(s,i){s=s.updateQueue,i.updateQueue===s&&(i.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,callbacks:null})}function ri(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function oi(s,i,l){var d=s.updateQueue;if(d===null)return null;if(d=d.shared,(nt&2)!==0){var h=d.pending;return h===null?i.next=i:(i.next=h.next,h.next=i),d.pending=i,i=Kl(s),Zg(s,null,l),i}return ql(s,d,i,l),Kl(s)}function go(s,i,l){if(i=i.updateQueue,i!==null&&(i=i.shared,(l&4194048)!==0)){var d=i.lanes;d&=s.pendingLanes,l|=d,i.lanes=l,fe(s,l)}}function cf(s,i){var l=s.updateQueue,d=s.alternate;if(d!==null&&(d=d.updateQueue,l===d)){var h=null,g=null;if(l=l.firstBaseUpdate,l!==null){do{var j={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};g===null?h=g=j:g=g.next=j,l=l.next}while(l!==null);g===null?h=g=i:g=g.next=i}else h=g=i;l={baseState:d.baseState,firstBaseUpdate:h,lastBaseUpdate:g,shared:d.shared,callbacks:d.callbacks},s.updateQueue=l;return}s=l.lastBaseUpdate,s===null?l.firstBaseUpdate=i:s.next=i,l.lastBaseUpdate=i}var uf=!1;function yo(){if(uf){var s=sr;if(s!==null)throw s}}function vo(s,i,l,d){uf=!1;var h=s.updateQueue;ai=!1;var g=h.firstBaseUpdate,j=h.lastBaseUpdate,_=h.shared.pending;if(_!==null){h.shared.pending=null;var D=_,F=D.next;D.next=null,j===null?g=F:j.next=F,j=D;var W=s.alternate;W!==null&&(W=W.updateQueue,_=W.lastBaseUpdate,_!==j&&(_===null?W.firstBaseUpdate=F:_.next=F,W.lastBaseUpdate=D))}if(g!==null){var ie=h.baseState;j=0,W=F=D=null,_=g;do{var Z=_.lane&-536870913,Y=Z!==_.lane;if(Y?(He&Z)===Z:(d&Z)===Z){Z!==0&&Z===nr&&(uf=!0),W!==null&&(W=W.next={lane:0,tag:_.tag,payload:_.payload,callback:null,next:null});e:{var Se=s,Ae=_;Z=i;var ht=l;switch(Ae.tag){case 1:if(Se=Ae.payload,typeof Se=="function"){ie=Se.call(ht,ie,Z);break e}ie=Se;break e;case 3:Se.flags=Se.flags&-65537|128;case 0:if(Se=Ae.payload,Z=typeof Se=="function"?Se.call(ht,ie,Z):Se,Z==null)break e;ie=y({},ie,Z);break e;case 2:ai=!0}}Z=_.callback,Z!==null&&(s.flags|=64,Y&&(s.flags|=8192),Y=h.callbacks,Y===null?h.callbacks=[Z]:Y.push(Z))}else Y={lane:Z,tag:_.tag,payload:_.payload,callback:_.callback,next:null},W===null?(F=W=Y,D=ie):W=W.next=Y,j|=Z;if(_=_.next,_===null){if(_=h.shared.pending,_===null)break;Y=_,_=Y.next,Y.next=null,h.lastBaseUpdate=Y,h.shared.pending=null}}while(!0);W===null&&(D=ie),h.baseState=D,h.firstBaseUpdate=F,h.lastBaseUpdate=W,g===null&&(h.shared.lanes=0),fi|=j,s.lanes=j,s.memoizedState=ie}}function dy(s,i){if(typeof s!="function")throw Error(a(191,s));s.call(i)}function fy(s,i){var l=s.callbacks;if(l!==null)for(s.callbacks=null,s=0;s<l.length;s++)dy(l[s],i)}var rr=R(null),Wl=R(0);function hy(s,i){s=qs,J(Wl,s),J(rr,i),qs=s|i.baseLanes}function df(){J(Wl,qs),J(rr,rr.current)}function ff(){qs=Wl.current,M(rr),M(Wl)}var Tn=R(null),Hn=null;function li(s){var i=s.alternate;J(Lt,Lt.current&1),J(Tn,s),Hn===null&&(i===null||rr.current!==null||i.memoizedState!==null)&&(Hn=s)}function hf(s){J(Lt,Lt.current),J(Tn,s),Hn===null&&(Hn=s)}function my(s){s.tag===22?(J(Lt,Lt.current),J(Tn,s),Hn===null&&(Hn=s)):ci()}function ci(){J(Lt,Lt.current),J(Tn,Tn.current)}function Rn(s){M(Tn),Hn===s&&(Hn=null),M(Lt)}var Lt=R(0);function ec(s){for(var i=s;i!==null;){if(i.tag===13){var l=i.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||bh(l)||xh(l)))return i}else if(i.tag===19&&(i.memoizedProps.revealOrder==="forwards"||i.memoizedProps.revealOrder==="backwards"||i.memoizedProps.revealOrder==="unstable_legacy-backwards"||i.memoizedProps.revealOrder==="together")){if((i.flags&128)!==0)return i}else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===s)break;for(;i.sibling===null;){if(i.return===null||i.return===s)return null;i=i.return}i.sibling.return=i.return,i=i.sibling}return null}var Ls=0,Oe=null,dt=null,Bt=null,tc=!1,or=!1,ra=!1,nc=0,bo=0,lr=null,J1=0;function Tt(){throw Error(a(321))}function mf(s,i){if(i===null)return!1;for(var l=0;l<i.length&&l<s.length;l++)if(!En(s[l],i[l]))return!1;return!0}function pf(s,i,l,d,h,g){return Ls=g,Oe=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,H.H=s===null||s.memoizedState===null?Jy:Af,ra=!1,g=l(d,h),ra=!1,or&&(g=gy(i,l,d,h)),py(s),g}function py(s){H.H=jo;var i=dt!==null&&dt.next!==null;if(Ls=0,Bt=dt=Oe=null,tc=!1,bo=0,lr=null,i)throw Error(a(300));s===null||qt||(s=s.dependencies,s!==null&&Fl(s)&&(qt=!0))}function gy(s,i,l,d){Oe=s;var h=0;do{if(or&&(lr=null),bo=0,or=!1,25<=h)throw Error(a(301));if(h+=1,Bt=dt=null,s.updateQueue!=null){var g=s.updateQueue;g.lastEffect=null,g.events=null,g.stores=null,g.memoCache!=null&&(g.memoCache.index=0)}H.H=Xy,g=i(l,d)}while(or);return g}function X1(){var s=H.H,i=s.useState()[0];return i=typeof i.then=="function"?xo(i):i,s=s.useState()[0],(dt!==null?dt.memoizedState:null)!==s&&(Oe.flags|=1024),i}function gf(){var s=nc!==0;return nc=0,s}function yf(s,i,l){i.updateQueue=s.updateQueue,i.flags&=-2053,s.lanes&=~l}function vf(s){if(tc){for(s=s.memoizedState;s!==null;){var i=s.queue;i!==null&&(i.pending=null),s=s.next}tc=!1}Ls=0,Bt=dt=Oe=null,or=!1,bo=nc=0,lr=null}function un(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Bt===null?Oe.memoizedState=Bt=s:Bt=Bt.next=s,Bt}function Dt(){if(dt===null){var s=Oe.alternate;s=s!==null?s.memoizedState:null}else s=dt.next;var i=Bt===null?Oe.memoizedState:Bt.next;if(i!==null)Bt=i,dt=s;else{if(s===null)throw Oe.alternate===null?Error(a(467)):Error(a(310));dt=s,s={memoizedState:dt.memoizedState,baseState:dt.baseState,baseQueue:dt.baseQueue,queue:dt.queue,next:null},Bt===null?Oe.memoizedState=Bt=s:Bt=Bt.next=s}return Bt}function sc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function xo(s){var i=bo;return bo+=1,lr===null&&(lr=[]),s=ry(lr,s,i),i=Oe,(Bt===null?i.memoizedState:Bt.next)===null&&(i=i.alternate,H.H=i===null||i.memoizedState===null?Jy:Af),s}function ic(s){if(s!==null&&typeof s=="object"){if(typeof s.then=="function")return xo(s);if(s.$$typeof===A)return Xt(s)}throw Error(a(438,String(s)))}function bf(s){var i=null,l=Oe.updateQueue;if(l!==null&&(i=l.memoCache),i==null){var d=Oe.alternate;d!==null&&(d=d.updateQueue,d!==null&&(d=d.memoCache,d!=null&&(i={data:d.data.map(function(h){return h.slice()}),index:0})))}if(i==null&&(i={data:[],index:0}),l===null&&(l=sc(),Oe.updateQueue=l),l.memoCache=i,l=i.data[i.index],l===void 0)for(l=i.data[i.index]=Array(s),d=0;d<s;d++)l[d]=ee;return i.index++,l}function Ds(s,i){return typeof i=="function"?i(s):i}function ac(s){var i=Dt();return xf(i,dt,s)}function xf(s,i,l){var d=s.queue;if(d===null)throw Error(a(311));d.lastRenderedReducer=l;var h=s.baseQueue,g=d.pending;if(g!==null){if(h!==null){var j=h.next;h.next=g.next,g.next=j}i.baseQueue=h=g,d.pending=null}if(g=s.baseState,h===null)s.memoizedState=g;else{i=h.next;var _=j=null,D=null,F=i,W=!1;do{var ie=F.lane&-536870913;if(ie!==F.lane?(He&ie)===ie:(Ls&ie)===ie){var Z=F.revertLane;if(Z===0)D!==null&&(D=D.next={lane:0,revertLane:0,gesture:null,action:F.action,hasEagerState:F.hasEagerState,eagerState:F.eagerState,next:null}),ie===nr&&(W=!0);else if((Ls&Z)===Z){F=F.next,Z===nr&&(W=!0);continue}else ie={lane:0,revertLane:F.revertLane,gesture:null,action:F.action,hasEagerState:F.hasEagerState,eagerState:F.eagerState,next:null},D===null?(_=D=ie,j=g):D=D.next=ie,Oe.lanes|=Z,fi|=Z;ie=F.action,ra&&l(g,ie),g=F.hasEagerState?F.eagerState:l(g,ie)}else Z={lane:ie,revertLane:F.revertLane,gesture:F.gesture,action:F.action,hasEagerState:F.hasEagerState,eagerState:F.eagerState,next:null},D===null?(_=D=Z,j=g):D=D.next=Z,Oe.lanes|=ie,fi|=ie;F=F.next}while(F!==null&&F!==i);if(D===null?j=g:D.next=_,!En(g,s.memoizedState)&&(qt=!0,W&&(l=sr,l!==null)))throw l;s.memoizedState=g,s.baseState=j,s.baseQueue=D,d.lastRenderedState=g}return h===null&&(d.lanes=0),[s.memoizedState,d.dispatch]}function Sf(s){var i=Dt(),l=i.queue;if(l===null)throw Error(a(311));l.lastRenderedReducer=s;var d=l.dispatch,h=l.pending,g=i.memoizedState;if(h!==null){l.pending=null;var j=h=h.next;do g=s(g,j.action),j=j.next;while(j!==h);En(g,i.memoizedState)||(qt=!0),i.memoizedState=g,i.baseQueue===null&&(i.baseState=g),l.lastRenderedState=g}return[g,d]}function yy(s,i,l){var d=Oe,h=Dt(),g=Qe;if(g){if(l===void 0)throw Error(a(407));l=l()}else l=i();var j=!En((dt||h).memoizedState,l);if(j&&(h.memoizedState=l,qt=!0),h=h.queue,Nf(xy.bind(null,d,h,s),[s]),h.getSnapshot!==i||j||Bt!==null&&Bt.memoizedState.tag&1){if(d.flags|=2048,cr(9,{destroy:void 0},by.bind(null,d,h,l,i),null),pt===null)throw Error(a(349));g||(Ls&127)!==0||vy(d,i,l)}return l}function vy(s,i,l){s.flags|=16384,s={getSnapshot:i,value:l},i=Oe.updateQueue,i===null?(i=sc(),Oe.updateQueue=i,i.stores=[s]):(l=i.stores,l===null?i.stores=[s]:l.push(s))}function by(s,i,l,d){i.value=l,i.getSnapshot=d,Sy(i)&&jy(s)}function xy(s,i,l){return l(function(){Sy(i)&&jy(s)})}function Sy(s){var i=s.getSnapshot;s=s.value;try{var l=i();return!En(s,l)}catch{return!0}}function jy(s){var i=Ji(s,2);i!==null&&wn(i,s,2)}function jf(s){var i=un();if(typeof s=="function"){var l=s;if(s=l(),ra){yn(!0);try{l()}finally{yn(!1)}}}return i.memoizedState=i.baseState=s,i.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ds,lastRenderedState:s},i}function wy(s,i,l,d){return s.baseState=l,xf(s,dt,typeof d=="function"?d:Ds)}function W1(s,i,l,d,h){if(lc(s))throw Error(a(485));if(s=i.action,s!==null){var g={payload:h,action:s,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(j){g.listeners.push(j)}};H.T!==null?l(!0):g.isTransition=!1,d(g),l=i.pending,l===null?(g.next=i.pending=g,Ny(i,g)):(g.next=l.next,i.pending=l.next=g)}}function Ny(s,i){var l=i.action,d=i.payload,h=s.state;if(i.isTransition){var g=H.T,j={};H.T=j;try{var _=l(h,d),D=H.S;D!==null&&D(j,_),Cy(s,i,_)}catch(F){wf(s,i,F)}finally{g!==null&&j.types!==null&&(g.types=j.types),H.T=g}}else try{g=l(h,d),Cy(s,i,g)}catch(F){wf(s,i,F)}}function Cy(s,i,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(d){ky(s,i,d)},function(d){return wf(s,i,d)}):ky(s,i,l)}function ky(s,i,l){i.status="fulfilled",i.value=l,zy(i),s.state=l,i=s.pending,i!==null&&(l=i.next,l===i?s.pending=null:(l=l.next,i.next=l,Ny(s,l)))}function wf(s,i,l){var d=s.pending;if(s.pending=null,d!==null){d=d.next;do i.status="rejected",i.reason=l,zy(i),i=i.next;while(i!==d)}s.action=null}function zy(s){s=s.listeners;for(var i=0;i<s.length;i++)(0,s[i])()}function _y(s,i){return i}function Ey(s,i){if(Qe){var l=pt.formState;if(l!==null){e:{var d=Oe;if(Qe){if(yt){t:{for(var h=yt,g=Kn;h.nodeType!==8;){if(!g){h=null;break t}if(h=Gn(h.nextSibling),h===null){h=null;break t}}g=h.data,h=g==="F!"||g==="F"?h:null}if(h){yt=Gn(h.nextSibling),d=h.data==="F!";break e}}si(d)}d=!1}d&&(i=l[0])}}return l=un(),l.memoizedState=l.baseState=i,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:_y,lastRenderedState:i},l.queue=d,l=Vy.bind(null,Oe,d),d.dispatch=l,d=jf(!1),g=Ef.bind(null,Oe,!1,d.queue),d=un(),h={state:i,dispatch:null,action:s,pending:null},d.queue=h,l=W1.bind(null,Oe,h,g,l),h.dispatch=l,d.memoizedState=s,[i,l,!1]}function Ay(s){var i=Dt();return Ty(i,dt,s)}function Ty(s,i,l){if(i=xf(s,i,_y)[0],s=ac(Ds)[0],typeof i=="object"&&i!==null&&typeof i.then=="function")try{var d=xo(i)}catch(j){throw j===ir?Ql:j}else d=i;i=Dt();var h=i.queue,g=h.dispatch;return l!==i.memoizedState&&(Oe.flags|=2048,cr(9,{destroy:void 0},eC.bind(null,h,l),null)),[d,g,s]}function eC(s,i){s.action=i}function Ry(s){var i=Dt(),l=dt;if(l!==null)return Ty(i,l,s);Dt(),i=i.memoizedState,l=Dt();var d=l.queue.dispatch;return l.memoizedState=s,[i,d,!1]}function cr(s,i,l,d){return s={tag:s,create:l,deps:d,inst:i,next:null},i=Oe.updateQueue,i===null&&(i=sc(),Oe.updateQueue=i),l=i.lastEffect,l===null?i.lastEffect=s.next=s:(d=l.next,l.next=s,s.next=d,i.lastEffect=s),s}function Oy(){return Dt().memoizedState}function rc(s,i,l,d){var h=un();Oe.flags|=s,h.memoizedState=cr(1|i,{destroy:void 0},l,d===void 0?null:d)}function oc(s,i,l,d){var h=Dt();d=d===void 0?null:d;var g=h.memoizedState.inst;dt!==null&&d!==null&&mf(d,dt.memoizedState.deps)?h.memoizedState=cr(i,g,l,d):(Oe.flags|=s,h.memoizedState=cr(1|i,g,l,d))}function Ly(s,i){rc(8390656,8,s,i)}function Nf(s,i){oc(2048,8,s,i)}function tC(s){Oe.flags|=4;var i=Oe.updateQueue;if(i===null)i=sc(),Oe.updateQueue=i,i.events=[s];else{var l=i.events;l===null?i.events=[s]:l.push(s)}}function Dy(s){var i=Dt().memoizedState;return tC({ref:i,nextImpl:s}),function(){if((nt&2)!==0)throw Error(a(440));return i.impl.apply(void 0,arguments)}}function My(s,i){return oc(4,2,s,i)}function $y(s,i){return oc(4,4,s,i)}function Py(s,i){if(typeof i=="function"){s=s();var l=i(s);return function(){typeof l=="function"?l():i(null)}}if(i!=null)return s=s(),i.current=s,function(){i.current=null}}function Uy(s,i,l){l=l!=null?l.concat([s]):null,oc(4,4,Py.bind(null,i,s),l)}function Cf(){}function Iy(s,i){var l=Dt();i=i===void 0?null:i;var d=l.memoizedState;return i!==null&&mf(i,d[1])?d[0]:(l.memoizedState=[s,i],s)}function By(s,i){var l=Dt();i=i===void 0?null:i;var d=l.memoizedState;if(i!==null&&mf(i,d[1]))return d[0];if(d=s(),ra){yn(!0);try{s()}finally{yn(!1)}}return l.memoizedState=[d,i],d}function kf(s,i,l){return l===void 0||(Ls&1073741824)!==0&&(He&261930)===0?s.memoizedState=i:(s.memoizedState=l,s=q0(),Oe.lanes|=s,fi|=s,l)}function qy(s,i,l,d){return En(l,i)?l:rr.current!==null?(s=kf(s,l,d),En(s,i)||(qt=!0),s):(Ls&42)===0||(Ls&1073741824)!==0&&(He&261930)===0?(qt=!0,s.memoizedState=l):(s=q0(),Oe.lanes|=s,fi|=s,i)}function Ky(s,i,l,d,h){var g=ae.p;ae.p=g!==0&&8>g?g:8;var j=H.T,_={};H.T=_,Ef(s,!1,i,l);try{var D=h(),F=H.S;if(F!==null&&F(_,D),D!==null&&typeof D=="object"&&typeof D.then=="function"){var W=Y1(D,d);So(s,i,W,Dn(s))}else So(s,i,d,Dn(s))}catch(ie){So(s,i,{then:function(){},status:"rejected",reason:ie},Dn())}finally{ae.p=g,j!==null&&_.types!==null&&(j.types=_.types),H.T=j}}function nC(){}function zf(s,i,l,d){if(s.tag!==5)throw Error(a(476));var h=Hy(s).queue;Ky(s,h,i,pe,l===null?nC:function(){return Gy(s),l(d)})}function Hy(s){var i=s.memoizedState;if(i!==null)return i;i={memoizedState:pe,baseState:pe,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ds,lastRenderedState:pe},next:null};var l={};return i.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ds,lastRenderedState:l},next:null},s.memoizedState=i,s=s.alternate,s!==null&&(s.memoizedState=i),i}function Gy(s){var i=Hy(s);i.next===null&&(i=s.alternate.memoizedState),So(s,i.next.queue,{},Dn())}function _f(){return Xt(Po)}function Fy(){return Dt().memoizedState}function Zy(){return Dt().memoizedState}function sC(s){for(var i=s.return;i!==null;){switch(i.tag){case 24:case 3:var l=Dn();s=ri(l);var d=oi(i,s,l);d!==null&&(wn(d,i,l),go(d,i,l)),i={cache:nf()},s.payload=i;return}i=i.return}}function iC(s,i,l){var d=Dn();l={lane:d,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},lc(s)?Qy(i,l):(l=Gd(s,i,l,d),l!==null&&(wn(l,s,d),Yy(l,i,d)))}function Vy(s,i,l){var d=Dn();So(s,i,l,d)}function So(s,i,l,d){var h={lane:d,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(lc(s))Qy(i,h);else{var g=s.alternate;if(s.lanes===0&&(g===null||g.lanes===0)&&(g=i.lastRenderedReducer,g!==null))try{var j=i.lastRenderedState,_=g(j,l);if(h.hasEagerState=!0,h.eagerState=_,En(_,j))return ql(s,i,h,0),pt===null&&Bl(),!1}catch{}if(l=Gd(s,i,h,d),l!==null)return wn(l,s,d),Yy(l,i,d),!0}return!1}function Ef(s,i,l,d){if(d={lane:2,revertLane:oh(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},lc(s)){if(i)throw Error(a(479))}else i=Gd(s,l,d,2),i!==null&&wn(i,s,2)}function lc(s){var i=s.alternate;return s===Oe||i!==null&&i===Oe}function Qy(s,i){or=tc=!0;var l=s.pending;l===null?i.next=i:(i.next=l.next,l.next=i),s.pending=i}function Yy(s,i,l){if((l&4194048)!==0){var d=i.lanes;d&=s.pendingLanes,l|=d,i.lanes=l,fe(s,l)}}var jo={readContext:Xt,use:ic,useCallback:Tt,useContext:Tt,useEffect:Tt,useImperativeHandle:Tt,useLayoutEffect:Tt,useInsertionEffect:Tt,useMemo:Tt,useReducer:Tt,useRef:Tt,useState:Tt,useDebugValue:Tt,useDeferredValue:Tt,useTransition:Tt,useSyncExternalStore:Tt,useId:Tt,useHostTransitionStatus:Tt,useFormState:Tt,useActionState:Tt,useOptimistic:Tt,useMemoCache:Tt,useCacheRefresh:Tt};jo.useEffectEvent=Tt;var Jy={readContext:Xt,use:ic,useCallback:function(s,i){return un().memoizedState=[s,i===void 0?null:i],s},useContext:Xt,useEffect:Ly,useImperativeHandle:function(s,i,l){l=l!=null?l.concat([s]):null,rc(4194308,4,Py.bind(null,i,s),l)},useLayoutEffect:function(s,i){return rc(4194308,4,s,i)},useInsertionEffect:function(s,i){rc(4,2,s,i)},useMemo:function(s,i){var l=un();i=i===void 0?null:i;var d=s();if(ra){yn(!0);try{s()}finally{yn(!1)}}return l.memoizedState=[d,i],d},useReducer:function(s,i,l){var d=un();if(l!==void 0){var h=l(i);if(ra){yn(!0);try{l(i)}finally{yn(!1)}}}else h=i;return d.memoizedState=d.baseState=h,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:h},d.queue=s,s=s.dispatch=iC.bind(null,Oe,s),[d.memoizedState,s]},useRef:function(s){var i=un();return s={current:s},i.memoizedState=s},useState:function(s){s=jf(s);var i=s.queue,l=Vy.bind(null,Oe,i);return i.dispatch=l,[s.memoizedState,l]},useDebugValue:Cf,useDeferredValue:function(s,i){var l=un();return kf(l,s,i)},useTransition:function(){var s=jf(!1);return s=Ky.bind(null,Oe,s.queue,!0,!1),un().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,i,l){var d=Oe,h=un();if(Qe){if(l===void 0)throw Error(a(407));l=l()}else{if(l=i(),pt===null)throw Error(a(349));(He&127)!==0||vy(d,i,l)}h.memoizedState=l;var g={value:l,getSnapshot:i};return h.queue=g,Ly(xy.bind(null,d,g,s),[s]),d.flags|=2048,cr(9,{destroy:void 0},by.bind(null,d,g,l,i),null),l},useId:function(){var s=un(),i=pt.identifierPrefix;if(Qe){var l=bs,d=vs;l=(d&~(1<<32-ue(d)-1)).toString(32)+l,i="_"+i+"R_"+l,l=nc++,0<l&&(i+="H"+l.toString(32)),i+="_"}else l=J1++,i="_"+i+"r_"+l.toString(32)+"_";return s.memoizedState=i},useHostTransitionStatus:_f,useFormState:Ey,useActionState:Ey,useOptimistic:function(s){var i=un();i.memoizedState=i.baseState=s;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return i.queue=l,i=Ef.bind(null,Oe,!0,l),l.dispatch=i,[s,i]},useMemoCache:bf,useCacheRefresh:function(){return un().memoizedState=sC.bind(null,Oe)},useEffectEvent:function(s){var i=un(),l={impl:s};return i.memoizedState=l,function(){if((nt&2)!==0)throw Error(a(440));return l.impl.apply(void 0,arguments)}}},Af={readContext:Xt,use:ic,useCallback:Iy,useContext:Xt,useEffect:Nf,useImperativeHandle:Uy,useInsertionEffect:My,useLayoutEffect:$y,useMemo:By,useReducer:ac,useRef:Oy,useState:function(){return ac(Ds)},useDebugValue:Cf,useDeferredValue:function(s,i){var l=Dt();return qy(l,dt.memoizedState,s,i)},useTransition:function(){var s=ac(Ds)[0],i=Dt().memoizedState;return[typeof s=="boolean"?s:xo(s),i]},useSyncExternalStore:yy,useId:Fy,useHostTransitionStatus:_f,useFormState:Ay,useActionState:Ay,useOptimistic:function(s,i){var l=Dt();return wy(l,dt,s,i)},useMemoCache:bf,useCacheRefresh:Zy};Af.useEffectEvent=Dy;var Xy={readContext:Xt,use:ic,useCallback:Iy,useContext:Xt,useEffect:Nf,useImperativeHandle:Uy,useInsertionEffect:My,useLayoutEffect:$y,useMemo:By,useReducer:Sf,useRef:Oy,useState:function(){return Sf(Ds)},useDebugValue:Cf,useDeferredValue:function(s,i){var l=Dt();return dt===null?kf(l,s,i):qy(l,dt.memoizedState,s,i)},useTransition:function(){var s=Sf(Ds)[0],i=Dt().memoizedState;return[typeof s=="boolean"?s:xo(s),i]},useSyncExternalStore:yy,useId:Fy,useHostTransitionStatus:_f,useFormState:Ry,useActionState:Ry,useOptimistic:function(s,i){var l=Dt();return dt!==null?wy(l,dt,s,i):(l.baseState=s,[s,l.queue.dispatch])},useMemoCache:bf,useCacheRefresh:Zy};Xy.useEffectEvent=Dy;function Tf(s,i,l,d){i=s.memoizedState,l=l(d,i),l=l==null?i:y({},i,l),s.memoizedState=l,s.lanes===0&&(s.updateQueue.baseState=l)}var Rf={enqueueSetState:function(s,i,l){s=s._reactInternals;var d=Dn(),h=ri(d);h.payload=i,l!=null&&(h.callback=l),i=oi(s,h,d),i!==null&&(wn(i,s,d),go(i,s,d))},enqueueReplaceState:function(s,i,l){s=s._reactInternals;var d=Dn(),h=ri(d);h.tag=1,h.payload=i,l!=null&&(h.callback=l),i=oi(s,h,d),i!==null&&(wn(i,s,d),go(i,s,d))},enqueueForceUpdate:function(s,i){s=s._reactInternals;var l=Dn(),d=ri(l);d.tag=2,i!=null&&(d.callback=i),i=oi(s,d,l),i!==null&&(wn(i,s,l),go(i,s,l))}};function Wy(s,i,l,d,h,g,j){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(d,g,j):i.prototype&&i.prototype.isPureReactComponent?!oo(l,d)||!oo(h,g):!0}function e0(s,i,l,d){s=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(l,d),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(l,d),i.state!==s&&Rf.enqueueReplaceState(i,i.state,null)}function oa(s,i){var l=i;if("ref"in i){l={};for(var d in i)d!=="ref"&&(l[d]=i[d])}if(s=s.defaultProps){l===i&&(l=y({},l));for(var h in s)l[h]===void 0&&(l[h]=s[h])}return l}function t0(s){Il(s)}function n0(s){console.error(s)}function s0(s){Il(s)}function cc(s,i){try{var l=s.onUncaughtError;l(i.value,{componentStack:i.stack})}catch(d){setTimeout(function(){throw d})}}function i0(s,i,l){try{var d=s.onCaughtError;d(l.value,{componentStack:l.stack,errorBoundary:i.tag===1?i.stateNode:null})}catch(h){setTimeout(function(){throw h})}}function Of(s,i,l){return l=ri(l),l.tag=3,l.payload={element:null},l.callback=function(){cc(s,i)},l}function a0(s){return s=ri(s),s.tag=3,s}function r0(s,i,l,d){var h=l.type.getDerivedStateFromError;if(typeof h=="function"){var g=d.value;s.payload=function(){return h(g)},s.callback=function(){i0(i,l,d)}}var j=l.stateNode;j!==null&&typeof j.componentDidCatch=="function"&&(s.callback=function(){i0(i,l,d),typeof h!="function"&&(hi===null?hi=new Set([this]):hi.add(this));var _=d.stack;this.componentDidCatch(d.value,{componentStack:_!==null?_:""})})}function aC(s,i,l,d,h){if(l.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(i=l.alternate,i!==null&&tr(i,l,h,!0),l=Tn.current,l!==null){switch(l.tag){case 31:case 13:return Hn===null?Sc():l.alternate===null&&Rt===0&&(Rt=3),l.flags&=-257,l.flags|=65536,l.lanes=h,d===Yl?l.flags|=16384:(i=l.updateQueue,i===null?l.updateQueue=new Set([d]):i.add(d),ih(s,d,h)),!1;case 22:return l.flags|=65536,d===Yl?l.flags|=16384:(i=l.updateQueue,i===null?(i={transitions:null,markerInstances:null,retryQueue:new Set([d])},l.updateQueue=i):(l=i.retryQueue,l===null?i.retryQueue=new Set([d]):l.add(d)),ih(s,d,h)),!1}throw Error(a(435,l.tag))}return ih(s,d,h),Sc(),!1}if(Qe)return i=Tn.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=h,d!==Jd&&(s=Error(a(422),{cause:d}),uo(In(s,l)))):(d!==Jd&&(i=Error(a(423),{cause:d}),uo(In(i,l))),s=s.current.alternate,s.flags|=65536,h&=-h,s.lanes|=h,d=In(d,l),h=Of(s.stateNode,d,h),cf(s,h),Rt!==4&&(Rt=2)),!1;var g=Error(a(520),{cause:d});if(g=In(g,l),Ao===null?Ao=[g]:Ao.push(g),Rt!==4&&(Rt=2),i===null)return!0;d=In(d,l),l=i;do{switch(l.tag){case 3:return l.flags|=65536,s=h&-h,l.lanes|=s,s=Of(l.stateNode,d,s),cf(l,s),!1;case 1:if(i=l.type,g=l.stateNode,(l.flags&128)===0&&(typeof i.getDerivedStateFromError=="function"||g!==null&&typeof g.componentDidCatch=="function"&&(hi===null||!hi.has(g))))return l.flags|=65536,h&=-h,l.lanes|=h,h=a0(h),r0(h,s,l,d),cf(l,h),!1}l=l.return}while(l!==null);return!1}var Lf=Error(a(461)),qt=!1;function Wt(s,i,l,d){i.child=s===null?uy(i,null,l,d):aa(i,s.child,l,d)}function o0(s,i,l,d,h){l=l.render;var g=i.ref;if("ref"in d){var j={};for(var _ in d)_!=="ref"&&(j[_]=d[_])}else j=d;return ta(i),d=pf(s,i,l,j,g,h),_=gf(),s!==null&&!qt?(yf(s,i,h),Ms(s,i,h)):(Qe&&_&&Qd(i),i.flags|=1,Wt(s,i,d,h),i.child)}function l0(s,i,l,d,h){if(s===null){var g=l.type;return typeof g=="function"&&!Fd(g)&&g.defaultProps===void 0&&l.compare===null?(i.tag=15,i.type=g,c0(s,i,g,d,h)):(s=Hl(l.type,null,d,i,i.mode,h),s.ref=i.ref,s.return=i,i.child=s)}if(g=s.child,!qf(s,h)){var j=g.memoizedProps;if(l=l.compare,l=l!==null?l:oo,l(j,d)&&s.ref===i.ref)return Ms(s,i,h)}return i.flags|=1,s=As(g,d),s.ref=i.ref,s.return=i,i.child=s}function c0(s,i,l,d,h){if(s!==null){var g=s.memoizedProps;if(oo(g,d)&&s.ref===i.ref)if(qt=!1,i.pendingProps=d=g,qf(s,h))(s.flags&131072)!==0&&(qt=!0);else return i.lanes=s.lanes,Ms(s,i,h)}return Df(s,i,l,d,h)}function u0(s,i,l,d){var h=d.children,g=s!==null?s.memoizedState:null;if(s===null&&i.stateNode===null&&(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),d.mode==="hidden"){if((i.flags&128)!==0){if(g=g!==null?g.baseLanes|l:l,s!==null){for(d=i.child=s.child,h=0;d!==null;)h=h|d.lanes|d.childLanes,d=d.sibling;d=h&~g}else d=0,i.child=null;return d0(s,i,g,l,d)}if((l&536870912)!==0)i.memoizedState={baseLanes:0,cachePool:null},s!==null&&Vl(i,g!==null?g.cachePool:null),g!==null?hy(i,g):df(),my(i);else return d=i.lanes=536870912,d0(s,i,g!==null?g.baseLanes|l:l,l,d)}else g!==null?(Vl(i,g.cachePool),hy(i,g),ci(),i.memoizedState=null):(s!==null&&Vl(i,null),df(),ci());return Wt(s,i,h,l),i.child}function wo(s,i){return s!==null&&s.tag===22||i.stateNode!==null||(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.sibling}function d0(s,i,l,d,h){var g=af();return g=g===null?null:{parent:It._currentValue,pool:g},i.memoizedState={baseLanes:l,cachePool:g},s!==null&&Vl(i,null),df(),my(i),s!==null&&tr(s,i,d,!0),i.childLanes=h,null}function uc(s,i){return i=fc({mode:i.mode,children:i.children},s.mode),i.ref=s.ref,s.child=i,i.return=s,i}function f0(s,i,l){return aa(i,s.child,null,l),s=uc(i,i.pendingProps),s.flags|=2,Rn(i),i.memoizedState=null,s}function rC(s,i,l){var d=i.pendingProps,h=(i.flags&128)!==0;if(i.flags&=-129,s===null){if(Qe){if(d.mode==="hidden")return s=uc(i,d),i.lanes=536870912,wo(null,s);if(hf(i),(s=yt)?(s=Nv(s,Kn),s=s!==null&&s.data==="&"?s:null,s!==null&&(i.memoizedState={dehydrated:s,treeContext:ti!==null?{id:vs,overflow:bs}:null,retryLane:536870912,hydrationErrors:null},l=Qg(s),l.return=i,i.child=l,Jt=i,yt=null)):s=null,s===null)throw si(i);return i.lanes=536870912,null}return uc(i,d)}var g=s.memoizedState;if(g!==null){var j=g.dehydrated;if(hf(i),h)if(i.flags&256)i.flags&=-257,i=f0(s,i,l);else if(i.memoizedState!==null)i.child=s.child,i.flags|=128,i=null;else throw Error(a(558));else if(qt||tr(s,i,l,!1),h=(l&s.childLanes)!==0,qt||h){if(d=pt,d!==null&&(j=bt(d,l),j!==0&&j!==g.retryLane))throw g.retryLane=j,Ji(s,j),wn(d,s,j),Lf;Sc(),i=f0(s,i,l)}else s=g.treeContext,yt=Gn(j.nextSibling),Jt=i,Qe=!0,ni=null,Kn=!1,s!==null&&Xg(i,s),i=uc(i,d),i.flags|=4096;return i}return s=As(s.child,{mode:d.mode,children:d.children}),s.ref=i.ref,i.child=s,s.return=i,s}function dc(s,i){var l=i.ref;if(l===null)s!==null&&s.ref!==null&&(i.flags|=4194816);else{if(typeof l!="function"&&typeof l!="object")throw Error(a(284));(s===null||s.ref!==l)&&(i.flags|=4194816)}}function Df(s,i,l,d,h){return ta(i),l=pf(s,i,l,d,void 0,h),d=gf(),s!==null&&!qt?(yf(s,i,h),Ms(s,i,h)):(Qe&&d&&Qd(i),i.flags|=1,Wt(s,i,l,h),i.child)}function h0(s,i,l,d,h,g){return ta(i),i.updateQueue=null,l=gy(i,d,l,h),py(s),d=gf(),s!==null&&!qt?(yf(s,i,g),Ms(s,i,g)):(Qe&&d&&Qd(i),i.flags|=1,Wt(s,i,l,g),i.child)}function m0(s,i,l,d,h){if(ta(i),i.stateNode===null){var g=Ja,j=l.contextType;typeof j=="object"&&j!==null&&(g=Xt(j)),g=new l(d,g),i.memoizedState=g.state!==null&&g.state!==void 0?g.state:null,g.updater=Rf,i.stateNode=g,g._reactInternals=i,g=i.stateNode,g.props=d,g.state=i.memoizedState,g.refs={},of(i),j=l.contextType,g.context=typeof j=="object"&&j!==null?Xt(j):Ja,g.state=i.memoizedState,j=l.getDerivedStateFromProps,typeof j=="function"&&(Tf(i,l,j,d),g.state=i.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof g.getSnapshotBeforeUpdate=="function"||typeof g.UNSAFE_componentWillMount!="function"&&typeof g.componentWillMount!="function"||(j=g.state,typeof g.componentWillMount=="function"&&g.componentWillMount(),typeof g.UNSAFE_componentWillMount=="function"&&g.UNSAFE_componentWillMount(),j!==g.state&&Rf.enqueueReplaceState(g,g.state,null),vo(i,d,g,h),yo(),g.state=i.memoizedState),typeof g.componentDidMount=="function"&&(i.flags|=4194308),d=!0}else if(s===null){g=i.stateNode;var _=i.memoizedProps,D=oa(l,_);g.props=D;var F=g.context,W=l.contextType;j=Ja,typeof W=="object"&&W!==null&&(j=Xt(W));var ie=l.getDerivedStateFromProps;W=typeof ie=="function"||typeof g.getSnapshotBeforeUpdate=="function",_=i.pendingProps!==_,W||typeof g.UNSAFE_componentWillReceiveProps!="function"&&typeof g.componentWillReceiveProps!="function"||(_||F!==j)&&e0(i,g,d,j),ai=!1;var Z=i.memoizedState;g.state=Z,vo(i,d,g,h),yo(),F=i.memoizedState,_||Z!==F||ai?(typeof ie=="function"&&(Tf(i,l,ie,d),F=i.memoizedState),(D=ai||Wy(i,l,D,d,Z,F,j))?(W||typeof g.UNSAFE_componentWillMount!="function"&&typeof g.componentWillMount!="function"||(typeof g.componentWillMount=="function"&&g.componentWillMount(),typeof g.UNSAFE_componentWillMount=="function"&&g.UNSAFE_componentWillMount()),typeof g.componentDidMount=="function"&&(i.flags|=4194308)):(typeof g.componentDidMount=="function"&&(i.flags|=4194308),i.memoizedProps=d,i.memoizedState=F),g.props=d,g.state=F,g.context=j,d=D):(typeof g.componentDidMount=="function"&&(i.flags|=4194308),d=!1)}else{g=i.stateNode,lf(s,i),j=i.memoizedProps,W=oa(l,j),g.props=W,ie=i.pendingProps,Z=g.context,F=l.contextType,D=Ja,typeof F=="object"&&F!==null&&(D=Xt(F)),_=l.getDerivedStateFromProps,(F=typeof _=="function"||typeof g.getSnapshotBeforeUpdate=="function")||typeof g.UNSAFE_componentWillReceiveProps!="function"&&typeof g.componentWillReceiveProps!="function"||(j!==ie||Z!==D)&&e0(i,g,d,D),ai=!1,Z=i.memoizedState,g.state=Z,vo(i,d,g,h),yo();var Y=i.memoizedState;j!==ie||Z!==Y||ai||s!==null&&s.dependencies!==null&&Fl(s.dependencies)?(typeof _=="function"&&(Tf(i,l,_,d),Y=i.memoizedState),(W=ai||Wy(i,l,W,d,Z,Y,D)||s!==null&&s.dependencies!==null&&Fl(s.dependencies))?(F||typeof g.UNSAFE_componentWillUpdate!="function"&&typeof g.componentWillUpdate!="function"||(typeof g.componentWillUpdate=="function"&&g.componentWillUpdate(d,Y,D),typeof g.UNSAFE_componentWillUpdate=="function"&&g.UNSAFE_componentWillUpdate(d,Y,D)),typeof g.componentDidUpdate=="function"&&(i.flags|=4),typeof g.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof g.componentDidUpdate!="function"||j===s.memoizedProps&&Z===s.memoizedState||(i.flags|=4),typeof g.getSnapshotBeforeUpdate!="function"||j===s.memoizedProps&&Z===s.memoizedState||(i.flags|=1024),i.memoizedProps=d,i.memoizedState=Y),g.props=d,g.state=Y,g.context=D,d=W):(typeof g.componentDidUpdate!="function"||j===s.memoizedProps&&Z===s.memoizedState||(i.flags|=4),typeof g.getSnapshotBeforeUpdate!="function"||j===s.memoizedProps&&Z===s.memoizedState||(i.flags|=1024),d=!1)}return g=d,dc(s,i),d=(i.flags&128)!==0,g||d?(g=i.stateNode,l=d&&typeof l.getDerivedStateFromError!="function"?null:g.render(),i.flags|=1,s!==null&&d?(i.child=aa(i,s.child,null,h),i.child=aa(i,null,l,h)):Wt(s,i,l,h),i.memoizedState=g.state,s=i.child):s=Ms(s,i,h),s}function p0(s,i,l,d){return Wi(),i.flags|=256,Wt(s,i,l,d),i.child}var Mf={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function $f(s){return{baseLanes:s,cachePool:iy()}}function Pf(s,i,l){return s=s!==null?s.childLanes&~l:0,i&&(s|=Ln),s}function g0(s,i,l){var d=i.pendingProps,h=!1,g=(i.flags&128)!==0,j;if((j=g)||(j=s!==null&&s.memoizedState===null?!1:(Lt.current&2)!==0),j&&(h=!0,i.flags&=-129),j=(i.flags&32)!==0,i.flags&=-33,s===null){if(Qe){if(h?li(i):ci(),(s=yt)?(s=Nv(s,Kn),s=s!==null&&s.data!=="&"?s:null,s!==null&&(i.memoizedState={dehydrated:s,treeContext:ti!==null?{id:vs,overflow:bs}:null,retryLane:536870912,hydrationErrors:null},l=Qg(s),l.return=i,i.child=l,Jt=i,yt=null)):s=null,s===null)throw si(i);return xh(s)?i.lanes=32:i.lanes=536870912,null}var _=d.children;return d=d.fallback,h?(ci(),h=i.mode,_=fc({mode:"hidden",children:_},h),d=Xi(d,h,l,null),_.return=i,d.return=i,_.sibling=d,i.child=_,d=i.child,d.memoizedState=$f(l),d.childLanes=Pf(s,j,l),i.memoizedState=Mf,wo(null,d)):(li(i),Uf(i,_))}var D=s.memoizedState;if(D!==null&&(_=D.dehydrated,_!==null)){if(g)i.flags&256?(li(i),i.flags&=-257,i=If(s,i,l)):i.memoizedState!==null?(ci(),i.child=s.child,i.flags|=128,i=null):(ci(),_=d.fallback,h=i.mode,d=fc({mode:"visible",children:d.children},h),_=Xi(_,h,l,null),_.flags|=2,d.return=i,_.return=i,d.sibling=_,i.child=d,aa(i,s.child,null,l),d=i.child,d.memoizedState=$f(l),d.childLanes=Pf(s,j,l),i.memoizedState=Mf,i=wo(null,d));else if(li(i),xh(_)){if(j=_.nextSibling&&_.nextSibling.dataset,j)var F=j.dgst;j=F,d=Error(a(419)),d.stack="",d.digest=j,uo({value:d,source:null,stack:null}),i=If(s,i,l)}else if(qt||tr(s,i,l,!1),j=(l&s.childLanes)!==0,qt||j){if(j=pt,j!==null&&(d=bt(j,l),d!==0&&d!==D.retryLane))throw D.retryLane=d,Ji(s,d),wn(j,s,d),Lf;bh(_)||Sc(),i=If(s,i,l)}else bh(_)?(i.flags|=192,i.child=s.child,i=null):(s=D.treeContext,yt=Gn(_.nextSibling),Jt=i,Qe=!0,ni=null,Kn=!1,s!==null&&Xg(i,s),i=Uf(i,d.children),i.flags|=4096);return i}return h?(ci(),_=d.fallback,h=i.mode,D=s.child,F=D.sibling,d=As(D,{mode:"hidden",children:d.children}),d.subtreeFlags=D.subtreeFlags&65011712,F!==null?_=As(F,_):(_=Xi(_,h,l,null),_.flags|=2),_.return=i,d.return=i,d.sibling=_,i.child=d,wo(null,d),d=i.child,_=s.child.memoizedState,_===null?_=$f(l):(h=_.cachePool,h!==null?(D=It._currentValue,h=h.parent!==D?{parent:D,pool:D}:h):h=iy(),_={baseLanes:_.baseLanes|l,cachePool:h}),d.memoizedState=_,d.childLanes=Pf(s,j,l),i.memoizedState=Mf,wo(s.child,d)):(li(i),l=s.child,s=l.sibling,l=As(l,{mode:"visible",children:d.children}),l.return=i,l.sibling=null,s!==null&&(j=i.deletions,j===null?(i.deletions=[s],i.flags|=16):j.push(s)),i.child=l,i.memoizedState=null,l)}function Uf(s,i){return i=fc({mode:"visible",children:i},s.mode),i.return=s,s.child=i}function fc(s,i){return s=An(22,s,null,i),s.lanes=0,s}function If(s,i,l){return aa(i,s.child,null,l),s=Uf(i,i.pendingProps.children),s.flags|=2,i.memoizedState=null,s}function y0(s,i,l){s.lanes|=i;var d=s.alternate;d!==null&&(d.lanes|=i),ef(s.return,i,l)}function Bf(s,i,l,d,h,g){var j=s.memoizedState;j===null?s.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:d,tail:l,tailMode:h,treeForkCount:g}:(j.isBackwards=i,j.rendering=null,j.renderingStartTime=0,j.last=d,j.tail=l,j.tailMode=h,j.treeForkCount=g)}function v0(s,i,l){var d=i.pendingProps,h=d.revealOrder,g=d.tail;d=d.children;var j=Lt.current,_=(j&2)!==0;if(_?(j=j&1|2,i.flags|=128):j&=1,J(Lt,j),Wt(s,i,d,l),d=Qe?co:0,!_&&s!==null&&(s.flags&128)!==0)e:for(s=i.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&y0(s,l,i);else if(s.tag===19)y0(s,l,i);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===i)break e;for(;s.sibling===null;){if(s.return===null||s.return===i)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}switch(h){case"forwards":for(l=i.child,h=null;l!==null;)s=l.alternate,s!==null&&ec(s)===null&&(h=l),l=l.sibling;l=h,l===null?(h=i.child,i.child=null):(h=l.sibling,l.sibling=null),Bf(i,!1,h,l,g,d);break;case"backwards":case"unstable_legacy-backwards":for(l=null,h=i.child,i.child=null;h!==null;){if(s=h.alternate,s!==null&&ec(s)===null){i.child=h;break}s=h.sibling,h.sibling=l,l=h,h=s}Bf(i,!0,l,null,g,d);break;case"together":Bf(i,!1,null,null,void 0,d);break;default:i.memoizedState=null}return i.child}function Ms(s,i,l){if(s!==null&&(i.dependencies=s.dependencies),fi|=i.lanes,(l&i.childLanes)===0)if(s!==null){if(tr(s,i,l,!1),(l&i.childLanes)===0)return null}else return null;if(s!==null&&i.child!==s.child)throw Error(a(153));if(i.child!==null){for(s=i.child,l=As(s,s.pendingProps),i.child=l,l.return=i;s.sibling!==null;)s=s.sibling,l=l.sibling=As(s,s.pendingProps),l.return=i;l.sibling=null}return i.child}function qf(s,i){return(s.lanes&i)!==0?!0:(s=s.dependencies,!!(s!==null&&Fl(s)))}function oC(s,i,l){switch(i.tag){case 3:Ne(i,i.stateNode.containerInfo),ii(i,It,s.memoizedState.cache),Wi();break;case 27:case 5:Me(i);break;case 4:Ne(i,i.stateNode.containerInfo);break;case 10:ii(i,i.type,i.memoizedProps.value);break;case 31:if(i.memoizedState!==null)return i.flags|=128,hf(i),null;break;case 13:var d=i.memoizedState;if(d!==null)return d.dehydrated!==null?(li(i),i.flags|=128,null):(l&i.child.childLanes)!==0?g0(s,i,l):(li(i),s=Ms(s,i,l),s!==null?s.sibling:null);li(i);break;case 19:var h=(s.flags&128)!==0;if(d=(l&i.childLanes)!==0,d||(tr(s,i,l,!1),d=(l&i.childLanes)!==0),h){if(d)return v0(s,i,l);i.flags|=128}if(h=i.memoizedState,h!==null&&(h.rendering=null,h.tail=null,h.lastEffect=null),J(Lt,Lt.current),d)break;return null;case 22:return i.lanes=0,u0(s,i,l,i.pendingProps);case 24:ii(i,It,s.memoizedState.cache)}return Ms(s,i,l)}function b0(s,i,l){if(s!==null)if(s.memoizedProps!==i.pendingProps)qt=!0;else{if(!qf(s,l)&&(i.flags&128)===0)return qt=!1,oC(s,i,l);qt=(s.flags&131072)!==0}else qt=!1,Qe&&(i.flags&1048576)!==0&&Jg(i,co,i.index);switch(i.lanes=0,i.tag){case 16:e:{var d=i.pendingProps;if(s=sa(i.elementType),i.type=s,typeof s=="function")Fd(s)?(d=oa(s,d),i.tag=1,i=m0(null,i,s,d,l)):(i.tag=0,i=Df(null,i,s,d,l));else{if(s!=null){var h=s.$$typeof;if(h===z){i.tag=11,i=o0(null,i,s,d,l);break e}else if(h===E){i.tag=14,i=l0(null,i,s,d,l);break e}}throw i=Ee(s)||s,Error(a(306,i,""))}}return i;case 0:return Df(s,i,i.type,i.pendingProps,l);case 1:return d=i.type,h=oa(d,i.pendingProps),m0(s,i,d,h,l);case 3:e:{if(Ne(i,i.stateNode.containerInfo),s===null)throw Error(a(387));d=i.pendingProps;var g=i.memoizedState;h=g.element,lf(s,i),vo(i,d,null,l);var j=i.memoizedState;if(d=j.cache,ii(i,It,d),d!==g.cache&&tf(i,[It],l,!0),yo(),d=j.element,g.isDehydrated)if(g={element:d,isDehydrated:!1,cache:j.cache},i.updateQueue.baseState=g,i.memoizedState=g,i.flags&256){i=p0(s,i,d,l);break e}else if(d!==h){h=In(Error(a(424)),i),uo(h),i=p0(s,i,d,l);break e}else for(s=i.stateNode.containerInfo,s.nodeType===9?s=s.body:s=s.nodeName==="HTML"?s.ownerDocument.body:s,yt=Gn(s.firstChild),Jt=i,Qe=!0,ni=null,Kn=!0,l=uy(i,null,d,l),i.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling;else{if(Wi(),d===h){i=Ms(s,i,l);break e}Wt(s,i,d,l)}i=i.child}return i;case 26:return dc(s,i),s===null?(l=Av(i.type,null,i.pendingProps,null))?i.memoizedState=l:Qe||(l=i.type,s=i.pendingProps,d=_c(me.current).createElement(l),d[it]=i,d[sn]=s,en(d,l,s),at(d),i.stateNode=d):i.memoizedState=Av(i.type,s.memoizedProps,i.pendingProps,s.memoizedState),null;case 27:return Me(i),s===null&&Qe&&(d=i.stateNode=zv(i.type,i.pendingProps,me.current),Jt=i,Kn=!0,h=yt,yi(i.type)?(Sh=h,yt=Gn(d.firstChild)):yt=h),Wt(s,i,i.pendingProps.children,l),dc(s,i),s===null&&(i.flags|=4194304),i.child;case 5:return s===null&&Qe&&((h=d=yt)&&(d=$C(d,i.type,i.pendingProps,Kn),d!==null?(i.stateNode=d,Jt=i,yt=Gn(d.firstChild),Kn=!1,h=!0):h=!1),h||si(i)),Me(i),h=i.type,g=i.pendingProps,j=s!==null?s.memoizedProps:null,d=g.children,gh(h,g)?d=null:j!==null&&gh(h,j)&&(i.flags|=32),i.memoizedState!==null&&(h=pf(s,i,X1,null,null,l),Po._currentValue=h),dc(s,i),Wt(s,i,d,l),i.child;case 6:return s===null&&Qe&&((s=l=yt)&&(l=PC(l,i.pendingProps,Kn),l!==null?(i.stateNode=l,Jt=i,yt=null,s=!0):s=!1),s||si(i)),null;case 13:return g0(s,i,l);case 4:return Ne(i,i.stateNode.containerInfo),d=i.pendingProps,s===null?i.child=aa(i,null,d,l):Wt(s,i,d,l),i.child;case 11:return o0(s,i,i.type,i.pendingProps,l);case 7:return Wt(s,i,i.pendingProps,l),i.child;case 8:return Wt(s,i,i.pendingProps.children,l),i.child;case 12:return Wt(s,i,i.pendingProps.children,l),i.child;case 10:return d=i.pendingProps,ii(i,i.type,d.value),Wt(s,i,d.children,l),i.child;case 9:return h=i.type._context,d=i.pendingProps.children,ta(i),h=Xt(h),d=d(h),i.flags|=1,Wt(s,i,d,l),i.child;case 14:return l0(s,i,i.type,i.pendingProps,l);case 15:return c0(s,i,i.type,i.pendingProps,l);case 19:return v0(s,i,l);case 31:return rC(s,i,l);case 22:return u0(s,i,l,i.pendingProps);case 24:return ta(i),d=Xt(It),s===null?(h=af(),h===null&&(h=pt,g=nf(),h.pooledCache=g,g.refCount++,g!==null&&(h.pooledCacheLanes|=l),h=g),i.memoizedState={parent:d,cache:h},of(i),ii(i,It,h)):((s.lanes&l)!==0&&(lf(s,i),vo(i,null,null,l),yo()),h=s.memoizedState,g=i.memoizedState,h.parent!==d?(h={parent:d,cache:d},i.memoizedState=h,i.lanes===0&&(i.memoizedState=i.updateQueue.baseState=h),ii(i,It,d)):(d=g.cache,ii(i,It,d),d!==h.cache&&tf(i,[It],l,!0))),Wt(s,i,i.pendingProps.children,l),i.child;case 29:throw i.pendingProps}throw Error(a(156,i.tag))}function $s(s){s.flags|=4}function Kf(s,i,l,d,h){if((i=(s.mode&32)!==0)&&(i=!1),i){if(s.flags|=16777216,(h&335544128)===h)if(s.stateNode.complete)s.flags|=8192;else if(F0())s.flags|=8192;else throw ia=Yl,rf}else s.flags&=-16777217}function x0(s,i){if(i.type!=="stylesheet"||(i.state.loading&4)!==0)s.flags&=-16777217;else if(s.flags|=16777216,!Dv(i))if(F0())s.flags|=8192;else throw ia=Yl,rf}function hc(s,i){i!==null&&(s.flags|=4),s.flags&16384&&(i=s.tag!==22?kl():536870912,s.lanes|=i,hr|=i)}function No(s,i){if(!Qe)switch(s.tailMode){case"hidden":i=s.tail;for(var l=null;i!==null;)i.alternate!==null&&(l=i),i=i.sibling;l===null?s.tail=null:l.sibling=null;break;case"collapsed":l=s.tail;for(var d=null;l!==null;)l.alternate!==null&&(d=l),l=l.sibling;d===null?i||s.tail===null?s.tail=null:s.tail.sibling=null:d.sibling=null}}function vt(s){var i=s.alternate!==null&&s.alternate.child===s.child,l=0,d=0;if(i)for(var h=s.child;h!==null;)l|=h.lanes|h.childLanes,d|=h.subtreeFlags&65011712,d|=h.flags&65011712,h.return=s,h=h.sibling;else for(h=s.child;h!==null;)l|=h.lanes|h.childLanes,d|=h.subtreeFlags,d|=h.flags,h.return=s,h=h.sibling;return s.subtreeFlags|=d,s.childLanes=l,i}function lC(s,i,l){var d=i.pendingProps;switch(Yd(i),i.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return vt(i),null;case 1:return vt(i),null;case 3:return l=i.stateNode,d=null,s!==null&&(d=s.memoizedState.cache),i.memoizedState.cache!==d&&(i.flags|=2048),Os(It),he(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(s===null||s.child===null)&&(er(i)?$s(i):s===null||s.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,Xd())),vt(i),null;case 26:var h=i.type,g=i.memoizedState;return s===null?($s(i),g!==null?(vt(i),x0(i,g)):(vt(i),Kf(i,h,null,d,l))):g?g!==s.memoizedState?($s(i),vt(i),x0(i,g)):(vt(i),i.flags&=-16777217):(s=s.memoizedProps,s!==d&&$s(i),vt(i),Kf(i,h,s,d,l)),null;case 27:if(Je(i),l=me.current,h=i.type,s!==null&&i.stateNode!=null)s.memoizedProps!==d&&$s(i);else{if(!d){if(i.stateNode===null)throw Error(a(166));return vt(i),null}s=V.current,er(i)?Wg(i):(s=zv(h,d,l),i.stateNode=s,$s(i))}return vt(i),null;case 5:if(Je(i),h=i.type,s!==null&&i.stateNode!=null)s.memoizedProps!==d&&$s(i);else{if(!d){if(i.stateNode===null)throw Error(a(166));return vt(i),null}if(g=V.current,er(i))Wg(i);else{var j=_c(me.current);switch(g){case 1:g=j.createElementNS("http://www.w3.org/2000/svg",h);break;case 2:g=j.createElementNS("http://www.w3.org/1998/Math/MathML",h);break;default:switch(h){case"svg":g=j.createElementNS("http://www.w3.org/2000/svg",h);break;case"math":g=j.createElementNS("http://www.w3.org/1998/Math/MathML",h);break;case"script":g=j.createElement("div"),g.innerHTML="<script><\/script>",g=g.removeChild(g.firstChild);break;case"select":g=typeof d.is=="string"?j.createElement("select",{is:d.is}):j.createElement("select"),d.multiple?g.multiple=!0:d.size&&(g.size=d.size);break;default:g=typeof d.is=="string"?j.createElement(h,{is:d.is}):j.createElement(h)}}g[it]=i,g[sn]=d;e:for(j=i.child;j!==null;){if(j.tag===5||j.tag===6)g.appendChild(j.stateNode);else if(j.tag!==4&&j.tag!==27&&j.child!==null){j.child.return=j,j=j.child;continue}if(j===i)break e;for(;j.sibling===null;){if(j.return===null||j.return===i)break e;j=j.return}j.sibling.return=j.return,j=j.sibling}i.stateNode=g;e:switch(en(g,h,d),h){case"button":case"input":case"select":case"textarea":d=!!d.autoFocus;break e;case"img":d=!0;break e;default:d=!1}d&&$s(i)}}return vt(i),Kf(i,i.type,s===null?null:s.memoizedProps,i.pendingProps,l),null;case 6:if(s&&i.stateNode!=null)s.memoizedProps!==d&&$s(i);else{if(typeof d!="string"&&i.stateNode===null)throw Error(a(166));if(s=me.current,er(i)){if(s=i.stateNode,l=i.memoizedProps,d=null,h=Jt,h!==null)switch(h.tag){case 27:case 5:d=h.memoizedProps}s[it]=i,s=!!(s.nodeValue===l||d!==null&&d.suppressHydrationWarning===!0||gv(s.nodeValue,l)),s||si(i,!0)}else s=_c(s).createTextNode(d),s[it]=i,i.stateNode=s}return vt(i),null;case 31:if(l=i.memoizedState,s===null||s.memoizedState!==null){if(d=er(i),l!==null){if(s===null){if(!d)throw Error(a(318));if(s=i.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(a(557));s[it]=i}else Wi(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;vt(i),s=!1}else l=Xd(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=l),s=!0;if(!s)return i.flags&256?(Rn(i),i):(Rn(i),null);if((i.flags&128)!==0)throw Error(a(558))}return vt(i),null;case 13:if(d=i.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(h=er(i),d!==null&&d.dehydrated!==null){if(s===null){if(!h)throw Error(a(318));if(h=i.memoizedState,h=h!==null?h.dehydrated:null,!h)throw Error(a(317));h[it]=i}else Wi(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;vt(i),h=!1}else h=Xd(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=h),h=!0;if(!h)return i.flags&256?(Rn(i),i):(Rn(i),null)}return Rn(i),(i.flags&128)!==0?(i.lanes=l,i):(l=d!==null,s=s!==null&&s.memoizedState!==null,l&&(d=i.child,h=null,d.alternate!==null&&d.alternate.memoizedState!==null&&d.alternate.memoizedState.cachePool!==null&&(h=d.alternate.memoizedState.cachePool.pool),g=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(g=d.memoizedState.cachePool.pool),g!==h&&(d.flags|=2048)),l!==s&&l&&(i.child.flags|=8192),hc(i,i.updateQueue),vt(i),null);case 4:return he(),s===null&&dh(i.stateNode.containerInfo),vt(i),null;case 10:return Os(i.type),vt(i),null;case 19:if(M(Lt),d=i.memoizedState,d===null)return vt(i),null;if(h=(i.flags&128)!==0,g=d.rendering,g===null)if(h)No(d,!1);else{if(Rt!==0||s!==null&&(s.flags&128)!==0)for(s=i.child;s!==null;){if(g=ec(s),g!==null){for(i.flags|=128,No(d,!1),s=g.updateQueue,i.updateQueue=s,hc(i,s),i.subtreeFlags=0,s=l,l=i.child;l!==null;)Vg(l,s),l=l.sibling;return J(Lt,Lt.current&1|2),Qe&&Ts(i,d.treeForkCount),i.child}s=s.sibling}d.tail!==null&&Ve()>vc&&(i.flags|=128,h=!0,No(d,!1),i.lanes=4194304)}else{if(!h)if(s=ec(g),s!==null){if(i.flags|=128,h=!0,s=s.updateQueue,i.updateQueue=s,hc(i,s),No(d,!0),d.tail===null&&d.tailMode==="hidden"&&!g.alternate&&!Qe)return vt(i),null}else 2*Ve()-d.renderingStartTime>vc&&l!==536870912&&(i.flags|=128,h=!0,No(d,!1),i.lanes=4194304);d.isBackwards?(g.sibling=i.child,i.child=g):(s=d.last,s!==null?s.sibling=g:i.child=g,d.last=g)}return d.tail!==null?(s=d.tail,d.rendering=s,d.tail=s.sibling,d.renderingStartTime=Ve(),s.sibling=null,l=Lt.current,J(Lt,h?l&1|2:l&1),Qe&&Ts(i,d.treeForkCount),s):(vt(i),null);case 22:case 23:return Rn(i),ff(),d=i.memoizedState!==null,s!==null?s.memoizedState!==null!==d&&(i.flags|=8192):d&&(i.flags|=8192),d?(l&536870912)!==0&&(i.flags&128)===0&&(vt(i),i.subtreeFlags&6&&(i.flags|=8192)):vt(i),l=i.updateQueue,l!==null&&hc(i,l.retryQueue),l=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(l=s.memoizedState.cachePool.pool),d=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(d=i.memoizedState.cachePool.pool),d!==l&&(i.flags|=2048),s!==null&&M(na),null;case 24:return l=null,s!==null&&(l=s.memoizedState.cache),i.memoizedState.cache!==l&&(i.flags|=2048),Os(It),vt(i),null;case 25:return null;case 30:return null}throw Error(a(156,i.tag))}function cC(s,i){switch(Yd(i),i.tag){case 1:return s=i.flags,s&65536?(i.flags=s&-65537|128,i):null;case 3:return Os(It),he(),s=i.flags,(s&65536)!==0&&(s&128)===0?(i.flags=s&-65537|128,i):null;case 26:case 27:case 5:return Je(i),null;case 31:if(i.memoizedState!==null){if(Rn(i),i.alternate===null)throw Error(a(340));Wi()}return s=i.flags,s&65536?(i.flags=s&-65537|128,i):null;case 13:if(Rn(i),s=i.memoizedState,s!==null&&s.dehydrated!==null){if(i.alternate===null)throw Error(a(340));Wi()}return s=i.flags,s&65536?(i.flags=s&-65537|128,i):null;case 19:return M(Lt),null;case 4:return he(),null;case 10:return Os(i.type),null;case 22:case 23:return Rn(i),ff(),s!==null&&M(na),s=i.flags,s&65536?(i.flags=s&-65537|128,i):null;case 24:return Os(It),null;case 25:return null;default:return null}}function S0(s,i){switch(Yd(i),i.tag){case 3:Os(It),he();break;case 26:case 27:case 5:Je(i);break;case 4:he();break;case 31:i.memoizedState!==null&&Rn(i);break;case 13:Rn(i);break;case 19:M(Lt);break;case 10:Os(i.type);break;case 22:case 23:Rn(i),ff(),s!==null&&M(na);break;case 24:Os(It)}}function Co(s,i){try{var l=i.updateQueue,d=l!==null?l.lastEffect:null;if(d!==null){var h=d.next;l=h;do{if((l.tag&s)===s){d=void 0;var g=l.create,j=l.inst;d=g(),j.destroy=d}l=l.next}while(l!==h)}}catch(_){ot(i,i.return,_)}}function ui(s,i,l){try{var d=i.updateQueue,h=d!==null?d.lastEffect:null;if(h!==null){var g=h.next;d=g;do{if((d.tag&s)===s){var j=d.inst,_=j.destroy;if(_!==void 0){j.destroy=void 0,h=i;var D=l,F=_;try{F()}catch(W){ot(h,D,W)}}}d=d.next}while(d!==g)}}catch(W){ot(i,i.return,W)}}function j0(s){var i=s.updateQueue;if(i!==null){var l=s.stateNode;try{fy(i,l)}catch(d){ot(s,s.return,d)}}}function w0(s,i,l){l.props=oa(s.type,s.memoizedProps),l.state=s.memoizedState;try{l.componentWillUnmount()}catch(d){ot(s,i,d)}}function ko(s,i){try{var l=s.ref;if(l!==null){switch(s.tag){case 26:case 27:case 5:var d=s.stateNode;break;case 30:d=s.stateNode;break;default:d=s.stateNode}typeof l=="function"?s.refCleanup=l(d):l.current=d}}catch(h){ot(s,i,h)}}function xs(s,i){var l=s.ref,d=s.refCleanup;if(l!==null)if(typeof d=="function")try{d()}catch(h){ot(s,i,h)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(h){ot(s,i,h)}else l.current=null}function N0(s){var i=s.type,l=s.memoizedProps,d=s.stateNode;try{e:switch(i){case"button":case"input":case"select":case"textarea":l.autoFocus&&d.focus();break e;case"img":l.src?d.src=l.src:l.srcSet&&(d.srcset=l.srcSet)}}catch(h){ot(s,s.return,h)}}function Hf(s,i,l){try{var d=s.stateNode;TC(d,s.type,l,i),d[sn]=i}catch(h){ot(s,s.return,h)}}function C0(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&yi(s.type)||s.tag===4}function Gf(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||C0(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.tag===27&&yi(s.type)||s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function Ff(s,i,l){var d=s.tag;if(d===5||d===6)s=s.stateNode,i?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(s,i):(i=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,i.appendChild(s),l=l._reactRootContainer,l!=null||i.onclick!==null||(i.onclick=_s));else if(d!==4&&(d===27&&yi(s.type)&&(l=s.stateNode,i=null),s=s.child,s!==null))for(Ff(s,i,l),s=s.sibling;s!==null;)Ff(s,i,l),s=s.sibling}function mc(s,i,l){var d=s.tag;if(d===5||d===6)s=s.stateNode,i?l.insertBefore(s,i):l.appendChild(s);else if(d!==4&&(d===27&&yi(s.type)&&(l=s.stateNode),s=s.child,s!==null))for(mc(s,i,l),s=s.sibling;s!==null;)mc(s,i,l),s=s.sibling}function k0(s){var i=s.stateNode,l=s.memoizedProps;try{for(var d=s.type,h=i.attributes;h.length;)i.removeAttributeNode(h[0]);en(i,d,l),i[it]=s,i[sn]=l}catch(g){ot(s,s.return,g)}}var Ps=!1,Kt=!1,Zf=!1,z0=typeof WeakSet=="function"?WeakSet:Set,Yt=null;function uC(s,i){if(s=s.containerInfo,mh=Dc,s=Ug(s),Ud(s)){if("selectionStart"in s)var l={start:s.selectionStart,end:s.selectionEnd};else e:{l=(l=s.ownerDocument)&&l.defaultView||window;var d=l.getSelection&&l.getSelection();if(d&&d.rangeCount!==0){l=d.anchorNode;var h=d.anchorOffset,g=d.focusNode;d=d.focusOffset;try{l.nodeType,g.nodeType}catch{l=null;break e}var j=0,_=-1,D=-1,F=0,W=0,ie=s,Z=null;t:for(;;){for(var Y;ie!==l||h!==0&&ie.nodeType!==3||(_=j+h),ie!==g||d!==0&&ie.nodeType!==3||(D=j+d),ie.nodeType===3&&(j+=ie.nodeValue.length),(Y=ie.firstChild)!==null;)Z=ie,ie=Y;for(;;){if(ie===s)break t;if(Z===l&&++F===h&&(_=j),Z===g&&++W===d&&(D=j),(Y=ie.nextSibling)!==null)break;ie=Z,Z=ie.parentNode}ie=Y}l=_===-1||D===-1?null:{start:_,end:D}}else l=null}l=l||{start:0,end:0}}else l=null;for(ph={focusedElem:s,selectionRange:l},Dc=!1,Yt=i;Yt!==null;)if(i=Yt,s=i.child,(i.subtreeFlags&1028)!==0&&s!==null)s.return=i,Yt=s;else for(;Yt!==null;){switch(i=Yt,g=i.alternate,s=i.flags,i.tag){case 0:if((s&4)!==0&&(s=i.updateQueue,s=s!==null?s.events:null,s!==null))for(l=0;l<s.length;l++)h=s[l],h.ref.impl=h.nextImpl;break;case 11:case 15:break;case 1:if((s&1024)!==0&&g!==null){s=void 0,l=i,h=g.memoizedProps,g=g.memoizedState,d=l.stateNode;try{var Se=oa(l.type,h);s=d.getSnapshotBeforeUpdate(Se,g),d.__reactInternalSnapshotBeforeUpdate=s}catch(Ae){ot(l,l.return,Ae)}}break;case 3:if((s&1024)!==0){if(s=i.stateNode.containerInfo,l=s.nodeType,l===9)vh(s);else if(l===1)switch(s.nodeName){case"HEAD":case"HTML":case"BODY":vh(s);break;default:s.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((s&1024)!==0)throw Error(a(163))}if(s=i.sibling,s!==null){s.return=i.return,Yt=s;break}Yt=i.return}}function _0(s,i,l){var d=l.flags;switch(l.tag){case 0:case 11:case 15:Is(s,l),d&4&&Co(5,l);break;case 1:if(Is(s,l),d&4)if(s=l.stateNode,i===null)try{s.componentDidMount()}catch(j){ot(l,l.return,j)}else{var h=oa(l.type,i.memoizedProps);i=i.memoizedState;try{s.componentDidUpdate(h,i,s.__reactInternalSnapshotBeforeUpdate)}catch(j){ot(l,l.return,j)}}d&64&&j0(l),d&512&&ko(l,l.return);break;case 3:if(Is(s,l),d&64&&(s=l.updateQueue,s!==null)){if(i=null,l.child!==null)switch(l.child.tag){case 27:case 5:i=l.child.stateNode;break;case 1:i=l.child.stateNode}try{fy(s,i)}catch(j){ot(l,l.return,j)}}break;case 27:i===null&&d&4&&k0(l);case 26:case 5:Is(s,l),i===null&&d&4&&N0(l),d&512&&ko(l,l.return);break;case 12:Is(s,l);break;case 31:Is(s,l),d&4&&T0(s,l);break;case 13:Is(s,l),d&4&&R0(s,l),d&64&&(s=l.memoizedState,s!==null&&(s=s.dehydrated,s!==null&&(l=bC.bind(null,l),UC(s,l))));break;case 22:if(d=l.memoizedState!==null||Ps,!d){i=i!==null&&i.memoizedState!==null||Kt,h=Ps;var g=Kt;Ps=d,(Kt=i)&&!g?Bs(s,l,(l.subtreeFlags&8772)!==0):Is(s,l),Ps=h,Kt=g}break;case 30:break;default:Is(s,l)}}function E0(s){var i=s.alternate;i!==null&&(s.alternate=null,E0(i)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(i=s.stateNode,i!==null&&Js(i)),s.stateNode=null,s.return=null,s.dependencies=null,s.memoizedProps=null,s.memoizedState=null,s.pendingProps=null,s.stateNode=null,s.updateQueue=null}var xt=null,bn=!1;function Us(s,i,l){for(l=l.child;l!==null;)A0(s,i,l),l=l.sibling}function A0(s,i,l){if(mt&&typeof mt.onCommitFiberUnmount=="function")try{mt.onCommitFiberUnmount(ns,l)}catch{}switch(l.tag){case 26:Kt||xs(l,i),Us(s,i,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:Kt||xs(l,i);var d=xt,h=bn;yi(l.type)&&(xt=l.stateNode,bn=!1),Us(s,i,l),Do(l.stateNode),xt=d,bn=h;break;case 5:Kt||xs(l,i);case 6:if(d=xt,h=bn,xt=null,Us(s,i,l),xt=d,bn=h,xt!==null)if(bn)try{(xt.nodeType===9?xt.body:xt.nodeName==="HTML"?xt.ownerDocument.body:xt).removeChild(l.stateNode)}catch(g){ot(l,i,g)}else try{xt.removeChild(l.stateNode)}catch(g){ot(l,i,g)}break;case 18:xt!==null&&(bn?(s=xt,jv(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,l.stateNode),Sr(s)):jv(xt,l.stateNode));break;case 4:d=xt,h=bn,xt=l.stateNode.containerInfo,bn=!0,Us(s,i,l),xt=d,bn=h;break;case 0:case 11:case 14:case 15:ui(2,l,i),Kt||ui(4,l,i),Us(s,i,l);break;case 1:Kt||(xs(l,i),d=l.stateNode,typeof d.componentWillUnmount=="function"&&w0(l,i,d)),Us(s,i,l);break;case 21:Us(s,i,l);break;case 22:Kt=(d=Kt)||l.memoizedState!==null,Us(s,i,l),Kt=d;break;default:Us(s,i,l)}}function T0(s,i){if(i.memoizedState===null&&(s=i.alternate,s!==null&&(s=s.memoizedState,s!==null))){s=s.dehydrated;try{Sr(s)}catch(l){ot(i,i.return,l)}}}function R0(s,i){if(i.memoizedState===null&&(s=i.alternate,s!==null&&(s=s.memoizedState,s!==null&&(s=s.dehydrated,s!==null))))try{Sr(s)}catch(l){ot(i,i.return,l)}}function dC(s){switch(s.tag){case 31:case 13:case 19:var i=s.stateNode;return i===null&&(i=s.stateNode=new z0),i;case 22:return s=s.stateNode,i=s._retryCache,i===null&&(i=s._retryCache=new z0),i;default:throw Error(a(435,s.tag))}}function pc(s,i){var l=dC(s);i.forEach(function(d){if(!l.has(d)){l.add(d);var h=xC.bind(null,s,d);d.then(h,h)}})}function xn(s,i){var l=i.deletions;if(l!==null)for(var d=0;d<l.length;d++){var h=l[d],g=s,j=i,_=j;e:for(;_!==null;){switch(_.tag){case 27:if(yi(_.type)){xt=_.stateNode,bn=!1;break e}break;case 5:xt=_.stateNode,bn=!1;break e;case 3:case 4:xt=_.stateNode.containerInfo,bn=!0;break e}_=_.return}if(xt===null)throw Error(a(160));A0(g,j,h),xt=null,bn=!1,g=h.alternate,g!==null&&(g.return=null),h.return=null}if(i.subtreeFlags&13886)for(i=i.child;i!==null;)O0(i,s),i=i.sibling}var as=null;function O0(s,i){var l=s.alternate,d=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:xn(i,s),Sn(s),d&4&&(ui(3,s,s.return),Co(3,s),ui(5,s,s.return));break;case 1:xn(i,s),Sn(s),d&512&&(Kt||l===null||xs(l,l.return)),d&64&&Ps&&(s=s.updateQueue,s!==null&&(d=s.callbacks,d!==null&&(l=s.shared.hiddenCallbacks,s.shared.hiddenCallbacks=l===null?d:l.concat(d))));break;case 26:var h=as;if(xn(i,s),Sn(s),d&512&&(Kt||l===null||xs(l,l.return)),d&4){var g=l!==null?l.memoizedState:null;if(d=s.memoizedState,l===null)if(d===null)if(s.stateNode===null){e:{d=s.type,l=s.memoizedProps,h=h.ownerDocument||h;t:switch(d){case"title":g=h.getElementsByTagName("title")[0],(!g||g[gs]||g[it]||g.namespaceURI==="http://www.w3.org/2000/svg"||g.hasAttribute("itemprop"))&&(g=h.createElement(d),h.head.insertBefore(g,h.querySelector("head > title"))),en(g,d,l),g[it]=s,at(g),d=g;break e;case"link":var j=Ov("link","href",h).get(d+(l.href||""));if(j){for(var _=0;_<j.length;_++)if(g=j[_],g.getAttribute("href")===(l.href==null||l.href===""?null:l.href)&&g.getAttribute("rel")===(l.rel==null?null:l.rel)&&g.getAttribute("title")===(l.title==null?null:l.title)&&g.getAttribute("crossorigin")===(l.crossOrigin==null?null:l.crossOrigin)){j.splice(_,1);break t}}g=h.createElement(d),en(g,d,l),h.head.appendChild(g);break;case"meta":if(j=Ov("meta","content",h).get(d+(l.content||""))){for(_=0;_<j.length;_++)if(g=j[_],g.getAttribute("content")===(l.content==null?null:""+l.content)&&g.getAttribute("name")===(l.name==null?null:l.name)&&g.getAttribute("property")===(l.property==null?null:l.property)&&g.getAttribute("http-equiv")===(l.httpEquiv==null?null:l.httpEquiv)&&g.getAttribute("charset")===(l.charSet==null?null:l.charSet)){j.splice(_,1);break t}}g=h.createElement(d),en(g,d,l),h.head.appendChild(g);break;default:throw Error(a(468,d))}g[it]=s,at(g),d=g}s.stateNode=d}else Lv(h,s.type,s.stateNode);else s.stateNode=Rv(h,d,s.memoizedProps);else g!==d?(g===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):g.count--,d===null?Lv(h,s.type,s.stateNode):Rv(h,d,s.memoizedProps)):d===null&&s.stateNode!==null&&Hf(s,s.memoizedProps,l.memoizedProps)}break;case 27:xn(i,s),Sn(s),d&512&&(Kt||l===null||xs(l,l.return)),l!==null&&d&4&&Hf(s,s.memoizedProps,l.memoizedProps);break;case 5:if(xn(i,s),Sn(s),d&512&&(Kt||l===null||xs(l,l.return)),s.flags&32){h=s.stateNode;try{Ha(h,"")}catch(Se){ot(s,s.return,Se)}}d&4&&s.stateNode!=null&&(h=s.memoizedProps,Hf(s,h,l!==null?l.memoizedProps:h)),d&1024&&(Zf=!0);break;case 6:if(xn(i,s),Sn(s),d&4){if(s.stateNode===null)throw Error(a(162));d=s.memoizedProps,l=s.stateNode;try{l.nodeValue=d}catch(Se){ot(s,s.return,Se)}}break;case 3:if(Tc=null,h=as,as=Ec(i.containerInfo),xn(i,s),as=h,Sn(s),d&4&&l!==null&&l.memoizedState.isDehydrated)try{Sr(i.containerInfo)}catch(Se){ot(s,s.return,Se)}Zf&&(Zf=!1,L0(s));break;case 4:d=as,as=Ec(s.stateNode.containerInfo),xn(i,s),Sn(s),as=d;break;case 12:xn(i,s),Sn(s);break;case 31:xn(i,s),Sn(s),d&4&&(d=s.updateQueue,d!==null&&(s.updateQueue=null,pc(s,d)));break;case 13:xn(i,s),Sn(s),s.child.flags&8192&&s.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(yc=Ve()),d&4&&(d=s.updateQueue,d!==null&&(s.updateQueue=null,pc(s,d)));break;case 22:h=s.memoizedState!==null;var D=l!==null&&l.memoizedState!==null,F=Ps,W=Kt;if(Ps=F||h,Kt=W||D,xn(i,s),Kt=W,Ps=F,Sn(s),d&8192)e:for(i=s.stateNode,i._visibility=h?i._visibility&-2:i._visibility|1,h&&(l===null||D||Ps||Kt||la(s)),l=null,i=s;;){if(i.tag===5||i.tag===26){if(l===null){D=l=i;try{if(g=D.stateNode,h)j=g.style,typeof j.setProperty=="function"?j.setProperty("display","none","important"):j.display="none";else{_=D.stateNode;var ie=D.memoizedProps.style,Z=ie!=null&&ie.hasOwnProperty("display")?ie.display:null;_.style.display=Z==null||typeof Z=="boolean"?"":(""+Z).trim()}}catch(Se){ot(D,D.return,Se)}}}else if(i.tag===6){if(l===null){D=i;try{D.stateNode.nodeValue=h?"":D.memoizedProps}catch(Se){ot(D,D.return,Se)}}}else if(i.tag===18){if(l===null){D=i;try{var Y=D.stateNode;h?wv(Y,!0):wv(D.stateNode,!1)}catch(Se){ot(D,D.return,Se)}}}else if((i.tag!==22&&i.tag!==23||i.memoizedState===null||i===s)&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===s)break e;for(;i.sibling===null;){if(i.return===null||i.return===s)break e;l===i&&(l=null),i=i.return}l===i&&(l=null),i.sibling.return=i.return,i=i.sibling}d&4&&(d=s.updateQueue,d!==null&&(l=d.retryQueue,l!==null&&(d.retryQueue=null,pc(s,l))));break;case 19:xn(i,s),Sn(s),d&4&&(d=s.updateQueue,d!==null&&(s.updateQueue=null,pc(s,d)));break;case 30:break;case 21:break;default:xn(i,s),Sn(s)}}function Sn(s){var i=s.flags;if(i&2){try{for(var l,d=s.return;d!==null;){if(C0(d)){l=d;break}d=d.return}if(l==null)throw Error(a(160));switch(l.tag){case 27:var h=l.stateNode,g=Gf(s);mc(s,g,h);break;case 5:var j=l.stateNode;l.flags&32&&(Ha(j,""),l.flags&=-33);var _=Gf(s);mc(s,_,j);break;case 3:case 4:var D=l.stateNode.containerInfo,F=Gf(s);Ff(s,F,D);break;default:throw Error(a(161))}}catch(W){ot(s,s.return,W)}s.flags&=-3}i&4096&&(s.flags&=-4097)}function L0(s){if(s.subtreeFlags&1024)for(s=s.child;s!==null;){var i=s;L0(i),i.tag===5&&i.flags&1024&&i.stateNode.reset(),s=s.sibling}}function Is(s,i){if(i.subtreeFlags&8772)for(i=i.child;i!==null;)_0(s,i.alternate,i),i=i.sibling}function la(s){for(s=s.child;s!==null;){var i=s;switch(i.tag){case 0:case 11:case 14:case 15:ui(4,i,i.return),la(i);break;case 1:xs(i,i.return);var l=i.stateNode;typeof l.componentWillUnmount=="function"&&w0(i,i.return,l),la(i);break;case 27:Do(i.stateNode);case 26:case 5:xs(i,i.return),la(i);break;case 22:i.memoizedState===null&&la(i);break;case 30:la(i);break;default:la(i)}s=s.sibling}}function Bs(s,i,l){for(l=l&&(i.subtreeFlags&8772)!==0,i=i.child;i!==null;){var d=i.alternate,h=s,g=i,j=g.flags;switch(g.tag){case 0:case 11:case 15:Bs(h,g,l),Co(4,g);break;case 1:if(Bs(h,g,l),d=g,h=d.stateNode,typeof h.componentDidMount=="function")try{h.componentDidMount()}catch(F){ot(d,d.return,F)}if(d=g,h=d.updateQueue,h!==null){var _=d.stateNode;try{var D=h.shared.hiddenCallbacks;if(D!==null)for(h.shared.hiddenCallbacks=null,h=0;h<D.length;h++)dy(D[h],_)}catch(F){ot(d,d.return,F)}}l&&j&64&&j0(g),ko(g,g.return);break;case 27:k0(g);case 26:case 5:Bs(h,g,l),l&&d===null&&j&4&&N0(g),ko(g,g.return);break;case 12:Bs(h,g,l);break;case 31:Bs(h,g,l),l&&j&4&&T0(h,g);break;case 13:Bs(h,g,l),l&&j&4&&R0(h,g);break;case 22:g.memoizedState===null&&Bs(h,g,l),ko(g,g.return);break;case 30:break;default:Bs(h,g,l)}i=i.sibling}}function Vf(s,i){var l=null;s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(l=s.memoizedState.cachePool.pool),s=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(s=i.memoizedState.cachePool.pool),s!==l&&(s!=null&&s.refCount++,l!=null&&fo(l))}function Qf(s,i){s=null,i.alternate!==null&&(s=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==s&&(i.refCount++,s!=null&&fo(s))}function rs(s,i,l,d){if(i.subtreeFlags&10256)for(i=i.child;i!==null;)D0(s,i,l,d),i=i.sibling}function D0(s,i,l,d){var h=i.flags;switch(i.tag){case 0:case 11:case 15:rs(s,i,l,d),h&2048&&Co(9,i);break;case 1:rs(s,i,l,d);break;case 3:rs(s,i,l,d),h&2048&&(s=null,i.alternate!==null&&(s=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==s&&(i.refCount++,s!=null&&fo(s)));break;case 12:if(h&2048){rs(s,i,l,d),s=i.stateNode;try{var g=i.memoizedProps,j=g.id,_=g.onPostCommit;typeof _=="function"&&_(j,i.alternate===null?"mount":"update",s.passiveEffectDuration,-0)}catch(D){ot(i,i.return,D)}}else rs(s,i,l,d);break;case 31:rs(s,i,l,d);break;case 13:rs(s,i,l,d);break;case 23:break;case 22:g=i.stateNode,j=i.alternate,i.memoizedState!==null?g._visibility&2?rs(s,i,l,d):zo(s,i):g._visibility&2?rs(s,i,l,d):(g._visibility|=2,ur(s,i,l,d,(i.subtreeFlags&10256)!==0||!1)),h&2048&&Vf(j,i);break;case 24:rs(s,i,l,d),h&2048&&Qf(i.alternate,i);break;default:rs(s,i,l,d)}}function ur(s,i,l,d,h){for(h=h&&((i.subtreeFlags&10256)!==0||!1),i=i.child;i!==null;){var g=s,j=i,_=l,D=d,F=j.flags;switch(j.tag){case 0:case 11:case 15:ur(g,j,_,D,h),Co(8,j);break;case 23:break;case 22:var W=j.stateNode;j.memoizedState!==null?W._visibility&2?ur(g,j,_,D,h):zo(g,j):(W._visibility|=2,ur(g,j,_,D,h)),h&&F&2048&&Vf(j.alternate,j);break;case 24:ur(g,j,_,D,h),h&&F&2048&&Qf(j.alternate,j);break;default:ur(g,j,_,D,h)}i=i.sibling}}function zo(s,i){if(i.subtreeFlags&10256)for(i=i.child;i!==null;){var l=s,d=i,h=d.flags;switch(d.tag){case 22:zo(l,d),h&2048&&Vf(d.alternate,d);break;case 24:zo(l,d),h&2048&&Qf(d.alternate,d);break;default:zo(l,d)}i=i.sibling}}var _o=8192;function dr(s,i,l){if(s.subtreeFlags&_o)for(s=s.child;s!==null;)M0(s,i,l),s=s.sibling}function M0(s,i,l){switch(s.tag){case 26:dr(s,i,l),s.flags&_o&&s.memoizedState!==null&&JC(l,as,s.memoizedState,s.memoizedProps);break;case 5:dr(s,i,l);break;case 3:case 4:var d=as;as=Ec(s.stateNode.containerInfo),dr(s,i,l),as=d;break;case 22:s.memoizedState===null&&(d=s.alternate,d!==null&&d.memoizedState!==null?(d=_o,_o=16777216,dr(s,i,l),_o=d):dr(s,i,l));break;default:dr(s,i,l)}}function $0(s){var i=s.alternate;if(i!==null&&(s=i.child,s!==null)){i.child=null;do i=s.sibling,s.sibling=null,s=i;while(s!==null)}}function Eo(s){var i=s.deletions;if((s.flags&16)!==0){if(i!==null)for(var l=0;l<i.length;l++){var d=i[l];Yt=d,U0(d,s)}$0(s)}if(s.subtreeFlags&10256)for(s=s.child;s!==null;)P0(s),s=s.sibling}function P0(s){switch(s.tag){case 0:case 11:case 15:Eo(s),s.flags&2048&&ui(9,s,s.return);break;case 3:Eo(s);break;case 12:Eo(s);break;case 22:var i=s.stateNode;s.memoizedState!==null&&i._visibility&2&&(s.return===null||s.return.tag!==13)?(i._visibility&=-3,gc(s)):Eo(s);break;default:Eo(s)}}function gc(s){var i=s.deletions;if((s.flags&16)!==0){if(i!==null)for(var l=0;l<i.length;l++){var d=i[l];Yt=d,U0(d,s)}$0(s)}for(s=s.child;s!==null;){switch(i=s,i.tag){case 0:case 11:case 15:ui(8,i,i.return),gc(i);break;case 22:l=i.stateNode,l._visibility&2&&(l._visibility&=-3,gc(i));break;default:gc(i)}s=s.sibling}}function U0(s,i){for(;Yt!==null;){var l=Yt;switch(l.tag){case 0:case 11:case 15:ui(8,l,i);break;case 23:case 22:if(l.memoizedState!==null&&l.memoizedState.cachePool!==null){var d=l.memoizedState.cachePool.pool;d!=null&&d.refCount++}break;case 24:fo(l.memoizedState.cache)}if(d=l.child,d!==null)d.return=l,Yt=d;else e:for(l=s;Yt!==null;){d=Yt;var h=d.sibling,g=d.return;if(E0(d),d===l){Yt=null;break e}if(h!==null){h.return=g,Yt=h;break e}Yt=g}}}var fC={getCacheForType:function(s){var i=Xt(It),l=i.data.get(s);return l===void 0&&(l=s(),i.data.set(s,l)),l},cacheSignal:function(){return Xt(It).controller.signal}},hC=typeof WeakMap=="function"?WeakMap:Map,nt=0,pt=null,Be=null,He=0,rt=0,On=null,di=!1,fr=!1,Yf=!1,qs=0,Rt=0,fi=0,ca=0,Jf=0,Ln=0,hr=0,Ao=null,jn=null,Xf=!1,yc=0,I0=0,vc=1/0,bc=null,hi=null,Ft=0,mi=null,mr=null,Ks=0,Wf=0,eh=null,B0=null,To=0,th=null;function Dn(){return(nt&2)!==0&&He!==0?He&-He:H.T!==null?oh():Ia()}function q0(){if(Ln===0)if((He&536870912)===0||Qe){var s=Pa;Pa<<=1,(Pa&3932160)===0&&(Pa=262144),Ln=s}else Ln=536870912;return s=Tn.current,s!==null&&(s.flags|=32),Ln}function wn(s,i,l){(s===pt&&(rt===2||rt===9)||s.cancelPendingCommit!==null)&&(pr(s,0),pi(s,He,Ln,!1)),Fi(s,l),((nt&2)===0||s!==pt)&&(s===pt&&((nt&2)===0&&(ca|=l),Rt===4&&pi(s,He,Ln,!1)),Ss(s))}function K0(s,i,l){if((nt&6)!==0)throw Error(a(327));var d=!l&&(i&127)===0&&(i&s.expiredLanes)===0||Ys(s,i),h=d?gC(s,i):sh(s,i,!0),g=d;do{if(h===0){fr&&!d&&pi(s,i,0,!1);break}else{if(l=s.current.alternate,g&&!mC(l)){h=sh(s,i,!1),g=!1;continue}if(h===2){if(g=i,s.errorRecoveryDisabledLanes&g)var j=0;else j=s.pendingLanes&-536870913,j=j!==0?j:j&536870912?536870912:0;if(j!==0){i=j;e:{var _=s;h=Ao;var D=_.current.memoizedState.isDehydrated;if(D&&(pr(_,j).flags|=256),j=sh(_,j,!1),j!==2){if(Yf&&!D){_.errorRecoveryDisabledLanes|=g,ca|=g,h=4;break e}g=jn,jn=h,g!==null&&(jn===null?jn=g:jn.push.apply(jn,g))}h=j}if(g=!1,h!==2)continue}}if(h===1){pr(s,0),pi(s,i,0,!0);break}e:{switch(d=s,g=h,g){case 0:case 1:throw Error(a(345));case 4:if((i&4194048)!==i)break;case 6:pi(d,i,Ln,!di);break e;case 2:jn=null;break;case 3:case 5:break;default:throw Error(a(329))}if((i&62914560)===i&&(h=yc+300-Ve(),10<h)){if(pi(d,i,Ln,!di),Ua(d,0,!0)!==0)break e;Ks=i,d.timeoutHandle=xv(H0.bind(null,d,l,jn,bc,Xf,i,Ln,ca,hr,di,g,"Throttled",-0,0),h);break e}H0(d,l,jn,bc,Xf,i,Ln,ca,hr,di,g,null,-0,0)}}break}while(!0);Ss(s)}function H0(s,i,l,d,h,g,j,_,D,F,W,ie,Z,Y){if(s.timeoutHandle=-1,ie=i.subtreeFlags,ie&8192||(ie&16785408)===16785408){ie={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:_s},M0(i,g,ie);var Se=(g&62914560)===g?yc-Ve():(g&4194048)===g?I0-Ve():0;if(Se=XC(ie,Se),Se!==null){Ks=g,s.cancelPendingCommit=Se(X0.bind(null,s,i,g,l,d,h,j,_,D,W,ie,null,Z,Y)),pi(s,g,j,!F);return}}X0(s,i,g,l,d,h,j,_,D)}function mC(s){for(var i=s;;){var l=i.tag;if((l===0||l===11||l===15)&&i.flags&16384&&(l=i.updateQueue,l!==null&&(l=l.stores,l!==null)))for(var d=0;d<l.length;d++){var h=l[d],g=h.getSnapshot;h=h.value;try{if(!En(g(),h))return!1}catch{return!1}}if(l=i.child,i.subtreeFlags&16384&&l!==null)l.return=i,i=l;else{if(i===s)break;for(;i.sibling===null;){if(i.return===null||i.return===s)return!0;i=i.return}i.sibling.return=i.return,i=i.sibling}}return!0}function pi(s,i,l,d){i&=~Jf,i&=~ca,s.suspendedLanes|=i,s.pingedLanes&=~i,d&&(s.warmLanes|=i),d=s.expirationTimes;for(var h=i;0<h;){var g=31-ue(h),j=1<<g;d[g]=-1,h&=~j}l!==0&&B(s,l,i)}function xc(){return(nt&6)===0?(Ro(0),!1):!0}function nh(){if(Be!==null){if(rt===0)var s=Be.return;else s=Be,Rs=ea=null,vf(s),ar=null,mo=0,s=Be;for(;s!==null;)S0(s.alternate,s),s=s.return;Be=null}}function pr(s,i){var l=s.timeoutHandle;l!==-1&&(s.timeoutHandle=-1,LC(l)),l=s.cancelPendingCommit,l!==null&&(s.cancelPendingCommit=null,l()),Ks=0,nh(),pt=s,Be=l=As(s.current,null),He=i,rt=0,On=null,di=!1,fr=Ys(s,i),Yf=!1,hr=Ln=Jf=ca=fi=Rt=0,jn=Ao=null,Xf=!1,(i&8)!==0&&(i|=i&32);var d=s.entangledLanes;if(d!==0)for(s=s.entanglements,d&=i;0<d;){var h=31-ue(d),g=1<<h;i|=s[h],d&=~g}return qs=i,Bl(),l}function G0(s,i){Oe=null,H.H=jo,i===ir||i===Ql?(i=oy(),rt=3):i===rf?(i=oy(),rt=4):rt=i===Lf?8:i!==null&&typeof i=="object"&&typeof i.then=="function"?6:1,On=i,Be===null&&(Rt=1,cc(s,In(i,s.current)))}function F0(){var s=Tn.current;return s===null?!0:(He&4194048)===He?Hn===null:(He&62914560)===He||(He&536870912)!==0?s===Hn:!1}function Z0(){var s=H.H;return H.H=jo,s===null?jo:s}function V0(){var s=H.A;return H.A=fC,s}function Sc(){Rt=4,di||(He&4194048)!==He&&Tn.current!==null||(fr=!0),(fi&134217727)===0&&(ca&134217727)===0||pt===null||pi(pt,He,Ln,!1)}function sh(s,i,l){var d=nt;nt|=2;var h=Z0(),g=V0();(pt!==s||He!==i)&&(bc=null,pr(s,i)),i=!1;var j=Rt;e:do try{if(rt!==0&&Be!==null){var _=Be,D=On;switch(rt){case 8:nh(),j=6;break e;case 3:case 2:case 9:case 6:Tn.current===null&&(i=!0);var F=rt;if(rt=0,On=null,gr(s,_,D,F),l&&fr){j=0;break e}break;default:F=rt,rt=0,On=null,gr(s,_,D,F)}}pC(),j=Rt;break}catch(W){G0(s,W)}while(!0);return i&&s.shellSuspendCounter++,Rs=ea=null,nt=d,H.H=h,H.A=g,Be===null&&(pt=null,He=0,Bl()),j}function pC(){for(;Be!==null;)Q0(Be)}function gC(s,i){var l=nt;nt|=2;var d=Z0(),h=V0();pt!==s||He!==i?(bc=null,vc=Ve()+500,pr(s,i)):fr=Ys(s,i);e:do try{if(rt!==0&&Be!==null){i=Be;var g=On;t:switch(rt){case 1:rt=0,On=null,gr(s,i,g,1);break;case 2:case 9:if(ay(g)){rt=0,On=null,Y0(i);break}i=function(){rt!==2&&rt!==9||pt!==s||(rt=7),Ss(s)},g.then(i,i);break e;case 3:rt=7;break e;case 4:rt=5;break e;case 7:ay(g)?(rt=0,On=null,Y0(i)):(rt=0,On=null,gr(s,i,g,7));break;case 5:var j=null;switch(Be.tag){case 26:j=Be.memoizedState;case 5:case 27:var _=Be;if(j?Dv(j):_.stateNode.complete){rt=0,On=null;var D=_.sibling;if(D!==null)Be=D;else{var F=_.return;F!==null?(Be=F,jc(F)):Be=null}break t}}rt=0,On=null,gr(s,i,g,5);break;case 6:rt=0,On=null,gr(s,i,g,6);break;case 8:nh(),Rt=6;break e;default:throw Error(a(462))}}yC();break}catch(W){G0(s,W)}while(!0);return Rs=ea=null,H.H=d,H.A=h,nt=l,Be!==null?0:(pt=null,He=0,Bl(),Rt)}function yC(){for(;Be!==null&&!ut();)Q0(Be)}function Q0(s){var i=b0(s.alternate,s,qs);s.memoizedProps=s.pendingProps,i===null?jc(s):Be=i}function Y0(s){var i=s,l=i.alternate;switch(i.tag){case 15:case 0:i=h0(l,i,i.pendingProps,i.type,void 0,He);break;case 11:i=h0(l,i,i.pendingProps,i.type.render,i.ref,He);break;case 5:vf(i);default:S0(l,i),i=Be=Vg(i,qs),i=b0(l,i,qs)}s.memoizedProps=s.pendingProps,i===null?jc(s):Be=i}function gr(s,i,l,d){Rs=ea=null,vf(i),ar=null,mo=0;var h=i.return;try{if(aC(s,h,i,l,He)){Rt=1,cc(s,In(l,s.current)),Be=null;return}}catch(g){if(h!==null)throw Be=h,g;Rt=1,cc(s,In(l,s.current)),Be=null;return}i.flags&32768?(Qe||d===1?s=!0:fr||(He&536870912)!==0?s=!1:(di=s=!0,(d===2||d===9||d===3||d===6)&&(d=Tn.current,d!==null&&d.tag===13&&(d.flags|=16384))),J0(i,s)):jc(i)}function jc(s){var i=s;do{if((i.flags&32768)!==0){J0(i,di);return}s=i.return;var l=lC(i.alternate,i,qs);if(l!==null){Be=l;return}if(i=i.sibling,i!==null){Be=i;return}Be=i=s}while(i!==null);Rt===0&&(Rt=5)}function J0(s,i){do{var l=cC(s.alternate,s);if(l!==null){l.flags&=32767,Be=l;return}if(l=s.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!i&&(s=s.sibling,s!==null)){Be=s;return}Be=s=l}while(s!==null);Rt=6,Be=null}function X0(s,i,l,d,h,g,j,_,D){s.cancelPendingCommit=null;do wc();while(Ft!==0);if((nt&6)!==0)throw Error(a(327));if(i!==null){if(i===s.current)throw Error(a(177));if(g=i.lanes|i.childLanes,g|=Hd,zl(s,l,g,j,_,D),s===pt&&(Be=pt=null,He=0),mr=i,mi=s,Ks=l,Wf=g,eh=h,B0=d,(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?(s.callbackNode=null,s.callbackPriority=0,SC(Ke,function(){return sv(),null})):(s.callbackNode=null,s.callbackPriority=0),d=(i.flags&13878)!==0,(i.subtreeFlags&13878)!==0||d){d=H.T,H.T=null,h=ae.p,ae.p=2,j=nt,nt|=4;try{uC(s,i,l)}finally{nt=j,ae.p=h,H.T=d}}Ft=1,W0(),ev(),tv()}}function W0(){if(Ft===1){Ft=0;var s=mi,i=mr,l=(i.flags&13878)!==0;if((i.subtreeFlags&13878)!==0||l){l=H.T,H.T=null;var d=ae.p;ae.p=2;var h=nt;nt|=4;try{O0(i,s);var g=ph,j=Ug(s.containerInfo),_=g.focusedElem,D=g.selectionRange;if(j!==_&&_&&_.ownerDocument&&Pg(_.ownerDocument.documentElement,_)){if(D!==null&&Ud(_)){var F=D.start,W=D.end;if(W===void 0&&(W=F),"selectionStart"in _)_.selectionStart=F,_.selectionEnd=Math.min(W,_.value.length);else{var ie=_.ownerDocument||document,Z=ie&&ie.defaultView||window;if(Z.getSelection){var Y=Z.getSelection(),Se=_.textContent.length,Ae=Math.min(D.start,Se),ht=D.end===void 0?Ae:Math.min(D.end,Se);!Y.extend&&Ae>ht&&(j=ht,ht=Ae,Ae=j);var q=$g(_,Ae),I=$g(_,ht);if(q&&I&&(Y.rangeCount!==1||Y.anchorNode!==q.node||Y.anchorOffset!==q.offset||Y.focusNode!==I.node||Y.focusOffset!==I.offset)){var G=ie.createRange();G.setStart(q.node,q.offset),Y.removeAllRanges(),Ae>ht?(Y.addRange(G),Y.extend(I.node,I.offset)):(G.setEnd(I.node,I.offset),Y.addRange(G))}}}}for(ie=[],Y=_;Y=Y.parentNode;)Y.nodeType===1&&ie.push({element:Y,left:Y.scrollLeft,top:Y.scrollTop});for(typeof _.focus=="function"&&_.focus(),_=0;_<ie.length;_++){var te=ie[_];te.element.scrollLeft=te.left,te.element.scrollTop=te.top}}Dc=!!mh,ph=mh=null}finally{nt=h,ae.p=d,H.T=l}}s.current=i,Ft=2}}function ev(){if(Ft===2){Ft=0;var s=mi,i=mr,l=(i.flags&8772)!==0;if((i.subtreeFlags&8772)!==0||l){l=H.T,H.T=null;var d=ae.p;ae.p=2;var h=nt;nt|=4;try{_0(s,i.alternate,i)}finally{nt=h,ae.p=d,H.T=l}}Ft=3}}function tv(){if(Ft===4||Ft===3){Ft=0,Qt();var s=mi,i=mr,l=Ks,d=B0;(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?Ft=5:(Ft=0,mr=mi=null,nv(s,s.pendingLanes));var h=s.pendingLanes;if(h===0&&(hi=null),ln(l),i=i.stateNode,mt&&typeof mt.onCommitFiberRoot=="function")try{mt.onCommitFiberRoot(ns,i,void 0,(i.current.flags&128)===128)}catch{}if(d!==null){i=H.T,h=ae.p,ae.p=2,H.T=null;try{for(var g=s.onRecoverableError,j=0;j<d.length;j++){var _=d[j];g(_.value,{componentStack:_.stack})}}finally{H.T=i,ae.p=h}}(Ks&3)!==0&&wc(),Ss(s),h=s.pendingLanes,(l&261930)!==0&&(h&42)!==0?s===th?To++:(To=0,th=s):To=0,Ro(0)}}function nv(s,i){(s.pooledCacheLanes&=i)===0&&(i=s.pooledCache,i!=null&&(s.pooledCache=null,fo(i)))}function wc(){return W0(),ev(),tv(),sv()}function sv(){if(Ft!==5)return!1;var s=mi,i=Wf;Wf=0;var l=ln(Ks),d=H.T,h=ae.p;try{ae.p=32>l?32:l,H.T=null,l=eh,eh=null;var g=mi,j=Ks;if(Ft=0,mr=mi=null,Ks=0,(nt&6)!==0)throw Error(a(331));var _=nt;if(nt|=4,P0(g.current),D0(g,g.current,j,l),nt=_,Ro(0,!1),mt&&typeof mt.onPostCommitFiberRoot=="function")try{mt.onPostCommitFiberRoot(ns,g)}catch{}return!0}finally{ae.p=h,H.T=d,nv(s,i)}}function iv(s,i,l){i=In(l,i),i=Of(s.stateNode,i,2),s=oi(s,i,2),s!==null&&(Fi(s,2),Ss(s))}function ot(s,i,l){if(s.tag===3)iv(s,s,l);else for(;i!==null;){if(i.tag===3){iv(i,s,l);break}else if(i.tag===1){var d=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(hi===null||!hi.has(d))){s=In(l,s),l=a0(2),d=oi(i,l,2),d!==null&&(r0(l,d,i,s),Fi(d,2),Ss(d));break}}i=i.return}}function ih(s,i,l){var d=s.pingCache;if(d===null){d=s.pingCache=new hC;var h=new Set;d.set(i,h)}else h=d.get(i),h===void 0&&(h=new Set,d.set(i,h));h.has(l)||(Yf=!0,h.add(l),s=vC.bind(null,s,i,l),i.then(s,s))}function vC(s,i,l){var d=s.pingCache;d!==null&&d.delete(i),s.pingedLanes|=s.suspendedLanes&l,s.warmLanes&=~l,pt===s&&(He&l)===l&&(Rt===4||Rt===3&&(He&62914560)===He&&300>Ve()-yc?(nt&2)===0&&pr(s,0):Jf|=l,hr===He&&(hr=0)),Ss(s)}function av(s,i){i===0&&(i=kl()),s=Ji(s,i),s!==null&&(Fi(s,i),Ss(s))}function bC(s){var i=s.memoizedState,l=0;i!==null&&(l=i.retryLane),av(s,l)}function xC(s,i){var l=0;switch(s.tag){case 31:case 13:var d=s.stateNode,h=s.memoizedState;h!==null&&(l=h.retryLane);break;case 19:d=s.stateNode;break;case 22:d=s.stateNode._retryCache;break;default:throw Error(a(314))}d!==null&&d.delete(i),av(s,l)}function SC(s,i){return re(s,i)}var Nc=null,yr=null,ah=!1,Cc=!1,rh=!1,gi=0;function Ss(s){s!==yr&&s.next===null&&(yr===null?Nc=yr=s:yr=yr.next=s),Cc=!0,ah||(ah=!0,wC())}function Ro(s,i){if(!rh&&Cc){rh=!0;do for(var l=!1,d=Nc;d!==null;){if(s!==0){var h=d.pendingLanes;if(h===0)var g=0;else{var j=d.suspendedLanes,_=d.pingedLanes;g=(1<<31-ue(42|s)+1)-1,g&=h&~(j&~_),g=g&201326741?g&201326741|1:g?g|2:0}g!==0&&(l=!0,cv(d,g))}else g=He,g=Ua(d,d===pt?g:0,d.cancelPendingCommit!==null||d.timeoutHandle!==-1),(g&3)===0||Ys(d,g)||(l=!0,cv(d,g));d=d.next}while(l);rh=!1}}function jC(){rv()}function rv(){Cc=ah=!1;var s=0;gi!==0&&OC()&&(s=gi);for(var i=Ve(),l=null,d=Nc;d!==null;){var h=d.next,g=ov(d,i);g===0?(d.next=null,l===null?Nc=h:l.next=h,h===null&&(yr=l)):(l=d,(s!==0||(g&3)!==0)&&(Cc=!0)),d=h}Ft!==0&&Ft!==5||Ro(s),gi!==0&&(gi=0)}function ov(s,i){for(var l=s.suspendedLanes,d=s.pingedLanes,h=s.expirationTimes,g=s.pendingLanes&-62914561;0<g;){var j=31-ue(g),_=1<<j,D=h[j];D===-1?((_&l)===0||(_&d)!==0)&&(h[j]=jd(_,i)):D<=i&&(s.expiredLanes|=_),g&=~_}if(i=pt,l=He,l=Ua(s,s===i?l:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),d=s.callbackNode,l===0||s===i&&(rt===2||rt===9)||s.cancelPendingCommit!==null)return d!==null&&d!==null&&Ze(d),s.callbackNode=null,s.callbackPriority=0;if((l&3)===0||Ys(s,l)){if(i=l&-l,i===s.callbackPriority)return i;switch(d!==null&&Ze(d),ln(l)){case 2:case 8:l=Ct;break;case 32:l=Ke;break;case 268435456:l=gn;break;default:l=Ke}return d=lv.bind(null,s),l=re(l,d),s.callbackPriority=i,s.callbackNode=l,i}return d!==null&&d!==null&&Ze(d),s.callbackPriority=2,s.callbackNode=null,2}function lv(s,i){if(Ft!==0&&Ft!==5)return s.callbackNode=null,s.callbackPriority=0,null;var l=s.callbackNode;if(wc()&&s.callbackNode!==l)return null;var d=He;return d=Ua(s,s===pt?d:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),d===0?null:(K0(s,d,i),ov(s,Ve()),s.callbackNode!=null&&s.callbackNode===l?lv.bind(null,s):null)}function cv(s,i){if(wc())return null;K0(s,i,!0)}function wC(){DC(function(){(nt&6)!==0?re(Xe,jC):rv()})}function oh(){if(gi===0){var s=nr;s===0&&(s=Gi,Gi<<=1,(Gi&261888)===0&&(Gi=256)),gi=s}return gi}function uv(s){return s==null||typeof s=="symbol"||typeof s=="boolean"?null:typeof s=="function"?s:Ol(""+s)}function dv(s,i){var l=i.ownerDocument.createElement("input");return l.name=i.name,l.value=i.value,s.id&&l.setAttribute("form",s.id),i.parentNode.insertBefore(l,i),s=new FormData(s),l.parentNode.removeChild(l),s}function NC(s,i,l,d,h){if(i==="submit"&&l&&l.stateNode===h){var g=uv((h[sn]||null).action),j=d.submitter;j&&(i=(i=j[sn]||null)?uv(i.formAction):j.getAttribute("formAction"),i!==null&&(g=i,j=null));var _=new $l("action","action",null,d,h);s.push({event:_,listeners:[{instance:null,listener:function(){if(d.defaultPrevented){if(gi!==0){var D=j?dv(h,j):new FormData(h);zf(l,{pending:!0,data:D,method:h.method,action:g},null,D)}}else typeof g=="function"&&(_.preventDefault(),D=j?dv(h,j):new FormData(h),zf(l,{pending:!0,data:D,method:h.method,action:g},g,D))},currentTarget:h}]})}}for(var lh=0;lh<Kd.length;lh++){var ch=Kd[lh],CC=ch.toLowerCase(),kC=ch[0].toUpperCase()+ch.slice(1);is(CC,"on"+kC)}is(qg,"onAnimationEnd"),is(Kg,"onAnimationIteration"),is(Hg,"onAnimationStart"),is("dblclick","onDoubleClick"),is("focusin","onFocus"),is("focusout","onBlur"),is(q1,"onTransitionRun"),is(K1,"onTransitionStart"),is(H1,"onTransitionCancel"),is(Gg,"onTransitionEnd"),qa("onMouseEnter",["mouseout","mouseover"]),qa("onMouseLeave",["mouseout","mouseover"]),qa("onPointerEnter",["pointerout","pointerover"]),qa("onPointerLeave",["pointerout","pointerover"]),ys("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ys("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ys("onBeforeInput",["compositionend","keypress","textInput","paste"]),ys("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ys("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ys("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Oo="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),zC=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Oo));function fv(s,i){i=(i&4)!==0;for(var l=0;l<s.length;l++){var d=s[l],h=d.event;d=d.listeners;e:{var g=void 0;if(i)for(var j=d.length-1;0<=j;j--){var _=d[j],D=_.instance,F=_.currentTarget;if(_=_.listener,D!==g&&h.isPropagationStopped())break e;g=_,h.currentTarget=F;try{g(h)}catch(W){Il(W)}h.currentTarget=null,g=D}else for(j=0;j<d.length;j++){if(_=d[j],D=_.instance,F=_.currentTarget,_=_.listener,D!==g&&h.isPropagationStopped())break e;g=_,h.currentTarget=F;try{g(h)}catch(W){Il(W)}h.currentTarget=null,g=D}}}}function qe(s,i){var l=i[ks];l===void 0&&(l=i[ks]=new Set);var d=s+"__bubble";l.has(d)||(hv(i,s,2,!1),l.add(d))}function uh(s,i,l){var d=0;i&&(d|=4),hv(l,s,d,i)}var kc="_reactListening"+Math.random().toString(36).slice(2);function dh(s){if(!s[kc]){s[kc]=!0,ss.forEach(function(l){l!=="selectionchange"&&(zC.has(l)||uh(l,!1,s),uh(l,!0,s))});var i=s.nodeType===9?s:s.ownerDocument;i===null||i[kc]||(i[kc]=!0,uh("selectionchange",!1,i))}}function hv(s,i,l,d){switch(qv(i)){case 2:var h=tk;break;case 8:h=nk;break;default:h=kh}l=h.bind(null,i,l,s),h=void 0,!Ad||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(h=!0),d?h!==void 0?s.addEventListener(i,l,{capture:!0,passive:h}):s.addEventListener(i,l,!0):h!==void 0?s.addEventListener(i,l,{passive:h}):s.addEventListener(i,l,!1)}function fh(s,i,l,d,h){var g=d;if((i&1)===0&&(i&2)===0&&d!==null)e:for(;;){if(d===null)return;var j=d.tag;if(j===3||j===4){var _=d.stateNode.containerInfo;if(_===h)break;if(j===4)for(j=d.return;j!==null;){var D=j.tag;if((D===3||D===4)&&j.stateNode.containerInfo===h)return;j=j.return}for(;_!==null;){if(j=Xs(_),j===null)return;if(D=j.tag,D===5||D===6||D===26||D===27){d=g=j;continue e}_=_.parentNode}}d=d.return}vg(function(){var F=g,W=_d(l),ie=[];e:{var Z=Fg.get(s);if(Z!==void 0){var Y=$l,Se=s;switch(s){case"keypress":if(Dl(l)===0)break e;case"keydown":case"keyup":Y=x1;break;case"focusin":Se="focus",Y=Ld;break;case"focusout":Se="blur",Y=Ld;break;case"beforeblur":case"afterblur":Y=Ld;break;case"click":if(l.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Y=Sg;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Y=l1;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Y=w1;break;case qg:case Kg:case Hg:Y=d1;break;case Gg:Y=C1;break;case"scroll":case"scrollend":Y=r1;break;case"wheel":Y=z1;break;case"copy":case"cut":case"paste":Y=h1;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Y=wg;break;case"toggle":case"beforetoggle":Y=E1}var Ae=(i&4)!==0,ht=!Ae&&(s==="scroll"||s==="scrollend"),q=Ae?Z!==null?Z+"Capture":null:Z;Ae=[];for(var I=F,G;I!==null;){var te=I;if(G=te.stateNode,te=te.tag,te!==5&&te!==26&&te!==27||G===null||q===null||(te=eo(I,q),te!=null&&Ae.push(Lo(I,te,G))),ht)break;I=I.return}0<Ae.length&&(Z=new Y(Z,Se,null,l,W),ie.push({event:Z,listeners:Ae}))}}if((i&7)===0){e:{if(Z=s==="mouseover"||s==="pointerover",Y=s==="mouseout"||s==="pointerout",Z&&l!==zd&&(Se=l.relatedTarget||l.fromElement)&&(Xs(Se)||Se[_n]))break e;if((Y||Z)&&(Z=W.window===W?W:(Z=W.ownerDocument)?Z.defaultView||Z.parentWindow:window,Y?(Se=l.relatedTarget||l.toElement,Y=F,Se=Se?Xs(Se):null,Se!==null&&(ht=c(Se),Ae=Se.tag,Se!==ht||Ae!==5&&Ae!==27&&Ae!==6)&&(Se=null)):(Y=null,Se=F),Y!==Se)){if(Ae=Sg,te="onMouseLeave",q="onMouseEnter",I="mouse",(s==="pointerout"||s==="pointerover")&&(Ae=wg,te="onPointerLeave",q="onPointerEnter",I="pointer"),ht=Y==null?Z:Pe(Y),G=Se==null?Z:Pe(Se),Z=new Ae(te,I+"leave",Y,l,W),Z.target=ht,Z.relatedTarget=G,te=null,Xs(W)===F&&(Ae=new Ae(q,I+"enter",Se,l,W),Ae.target=G,Ae.relatedTarget=ht,te=Ae),ht=te,Y&&Se)t:{for(Ae=_C,q=Y,I=Se,G=0,te=q;te;te=Ae(te))G++;te=0;for(var ze=I;ze;ze=Ae(ze))te++;for(;0<G-te;)q=Ae(q),G--;for(;0<te-G;)I=Ae(I),te--;for(;G--;){if(q===I||I!==null&&q===I.alternate){Ae=q;break t}q=Ae(q),I=Ae(I)}Ae=null}else Ae=null;Y!==null&&mv(ie,Z,Y,Ae,!1),Se!==null&&ht!==null&&mv(ie,ht,Se,Ae,!0)}}e:{if(Z=F?Pe(F):window,Y=Z.nodeName&&Z.nodeName.toLowerCase(),Y==="select"||Y==="input"&&Z.type==="file")var et=Tg;else if(Eg(Z))if(Rg)et=U1;else{et=$1;var Ce=M1}else Y=Z.nodeName,!Y||Y.toLowerCase()!=="input"||Z.type!=="checkbox"&&Z.type!=="radio"?F&&kd(F.elementType)&&(et=Tg):et=P1;if(et&&(et=et(s,F))){Ag(ie,et,l,W);break e}Ce&&Ce(s,Z,F),s==="focusout"&&F&&Z.type==="number"&&F.memoizedProps.value!=null&&Cd(Z,"number",Z.value)}switch(Ce=F?Pe(F):window,s){case"focusin":(Eg(Ce)||Ce.contentEditable==="true")&&(Va=Ce,Id=F,lo=null);break;case"focusout":lo=Id=Va=null;break;case"mousedown":Bd=!0;break;case"contextmenu":case"mouseup":case"dragend":Bd=!1,Ig(ie,l,W);break;case"selectionchange":if(B1)break;case"keydown":case"keyup":Ig(ie,l,W)}var De;if(Md)e:{switch(s){case"compositionstart":var Ge="onCompositionStart";break e;case"compositionend":Ge="onCompositionEnd";break e;case"compositionupdate":Ge="onCompositionUpdate";break e}Ge=void 0}else Za?zg(s,l)&&(Ge="onCompositionEnd"):s==="keydown"&&l.keyCode===229&&(Ge="onCompositionStart");Ge&&(Ng&&l.locale!=="ko"&&(Za||Ge!=="onCompositionStart"?Ge==="onCompositionEnd"&&Za&&(De=bg()):(ei=W,Td="value"in ei?ei.value:ei.textContent,Za=!0)),Ce=zc(F,Ge),0<Ce.length&&(Ge=new jg(Ge,s,null,l,W),ie.push({event:Ge,listeners:Ce}),De?Ge.data=De:(De=_g(l),De!==null&&(Ge.data=De)))),(De=T1?R1(s,l):O1(s,l))&&(Ge=zc(F,"onBeforeInput"),0<Ge.length&&(Ce=new jg("onBeforeInput","beforeinput",null,l,W),ie.push({event:Ce,listeners:Ge}),Ce.data=De)),NC(ie,s,F,l,W)}fv(ie,i)})}function Lo(s,i,l){return{instance:s,listener:i,currentTarget:l}}function zc(s,i){for(var l=i+"Capture",d=[];s!==null;){var h=s,g=h.stateNode;if(h=h.tag,h!==5&&h!==26&&h!==27||g===null||(h=eo(s,l),h!=null&&d.unshift(Lo(s,h,g)),h=eo(s,i),h!=null&&d.push(Lo(s,h,g))),s.tag===3)return d;s=s.return}return[]}function _C(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5&&s.tag!==27);return s||null}function mv(s,i,l,d,h){for(var g=i._reactName,j=[];l!==null&&l!==d;){var _=l,D=_.alternate,F=_.stateNode;if(_=_.tag,D!==null&&D===d)break;_!==5&&_!==26&&_!==27||F===null||(D=F,h?(F=eo(l,g),F!=null&&j.unshift(Lo(l,F,D))):h||(F=eo(l,g),F!=null&&j.push(Lo(l,F,D)))),l=l.return}j.length!==0&&s.push({event:i,listeners:j})}var EC=/\r\n?/g,AC=/\u0000|\uFFFD/g;function pv(s){return(typeof s=="string"?s:""+s).replace(EC,`
9
- `).replace(AC,"")}function gv(s,i){return i=pv(i),pv(s)===i}function ft(s,i,l,d,h,g){switch(l){case"children":typeof d=="string"?i==="body"||i==="textarea"&&d===""||Ha(s,d):(typeof d=="number"||typeof d=="bigint")&&i!=="body"&&Ha(s,""+d);break;case"className":Tl(s,"class",d);break;case"tabIndex":Tl(s,"tabindex",d);break;case"dir":case"role":case"viewBox":case"width":case"height":Tl(s,l,d);break;case"style":gg(s,d,g);break;case"data":if(i!=="object"){Tl(s,"data",d);break}case"src":case"href":if(d===""&&(i!=="a"||l!=="href")){s.removeAttribute(l);break}if(d==null||typeof d=="function"||typeof d=="symbol"||typeof d=="boolean"){s.removeAttribute(l);break}d=Ol(""+d),s.setAttribute(l,d);break;case"action":case"formAction":if(typeof d=="function"){s.setAttribute(l,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof g=="function"&&(l==="formAction"?(i!=="input"&&ft(s,i,"name",h.name,h,null),ft(s,i,"formEncType",h.formEncType,h,null),ft(s,i,"formMethod",h.formMethod,h,null),ft(s,i,"formTarget",h.formTarget,h,null)):(ft(s,i,"encType",h.encType,h,null),ft(s,i,"method",h.method,h,null),ft(s,i,"target",h.target,h,null)));if(d==null||typeof d=="symbol"||typeof d=="boolean"){s.removeAttribute(l);break}d=Ol(""+d),s.setAttribute(l,d);break;case"onClick":d!=null&&(s.onclick=_s);break;case"onScroll":d!=null&&qe("scroll",s);break;case"onScrollEnd":d!=null&&qe("scrollend",s);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(a(61));if(l=d.__html,l!=null){if(h.children!=null)throw Error(a(60));s.innerHTML=l}}break;case"multiple":s.multiple=d&&typeof d!="function"&&typeof d!="symbol";break;case"muted":s.muted=d&&typeof d!="function"&&typeof d!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(d==null||typeof d=="function"||typeof d=="boolean"||typeof d=="symbol"){s.removeAttribute("xlink:href");break}l=Ol(""+d),s.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":d!=null&&typeof d!="function"&&typeof d!="symbol"?s.setAttribute(l,""+d):s.removeAttribute(l);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":d&&typeof d!="function"&&typeof d!="symbol"?s.setAttribute(l,""):s.removeAttribute(l);break;case"capture":case"download":d===!0?s.setAttribute(l,""):d!==!1&&d!=null&&typeof d!="function"&&typeof d!="symbol"?s.setAttribute(l,d):s.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":d!=null&&typeof d!="function"&&typeof d!="symbol"&&!isNaN(d)&&1<=d?s.setAttribute(l,d):s.removeAttribute(l);break;case"rowSpan":case"start":d==null||typeof d=="function"||typeof d=="symbol"||isNaN(d)?s.removeAttribute(l):s.setAttribute(l,d);break;case"popover":qe("beforetoggle",s),qe("toggle",s),Al(s,"popover",d);break;case"xlinkActuate":zs(s,"http://www.w3.org/1999/xlink","xlink:actuate",d);break;case"xlinkArcrole":zs(s,"http://www.w3.org/1999/xlink","xlink:arcrole",d);break;case"xlinkRole":zs(s,"http://www.w3.org/1999/xlink","xlink:role",d);break;case"xlinkShow":zs(s,"http://www.w3.org/1999/xlink","xlink:show",d);break;case"xlinkTitle":zs(s,"http://www.w3.org/1999/xlink","xlink:title",d);break;case"xlinkType":zs(s,"http://www.w3.org/1999/xlink","xlink:type",d);break;case"xmlBase":zs(s,"http://www.w3.org/XML/1998/namespace","xml:base",d);break;case"xmlLang":zs(s,"http://www.w3.org/XML/1998/namespace","xml:lang",d);break;case"xmlSpace":zs(s,"http://www.w3.org/XML/1998/namespace","xml:space",d);break;case"is":Al(s,"is",d);break;case"innerText":case"textContent":break;default:(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(l=i1.get(l)||l,Al(s,l,d))}}function hh(s,i,l,d,h,g){switch(l){case"style":gg(s,d,g);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(a(61));if(l=d.__html,l!=null){if(h.children!=null)throw Error(a(60));s.innerHTML=l}}break;case"children":typeof d=="string"?Ha(s,d):(typeof d=="number"||typeof d=="bigint")&&Ha(s,""+d);break;case"onScroll":d!=null&&qe("scroll",s);break;case"onScrollEnd":d!=null&&qe("scrollend",s);break;case"onClick":d!=null&&(s.onclick=_s);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Zi.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(h=l.endsWith("Capture"),i=l.slice(2,h?l.length-7:void 0),g=s[sn]||null,g=g!=null?g[l]:null,typeof g=="function"&&s.removeEventListener(i,g,h),typeof d=="function")){typeof g!="function"&&g!==null&&(l in s?s[l]=null:s.hasAttribute(l)&&s.removeAttribute(l)),s.addEventListener(i,d,h);break e}l in s?s[l]=d:d===!0?s.setAttribute(l,""):Al(s,l,d)}}}function en(s,i,l){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":qe("error",s),qe("load",s);var d=!1,h=!1,g;for(g in l)if(l.hasOwnProperty(g)){var j=l[g];if(j!=null)switch(g){case"src":d=!0;break;case"srcSet":h=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(a(137,i));default:ft(s,i,g,j,l,null)}}h&&ft(s,i,"srcSet",l.srcSet,l,null),d&&ft(s,i,"src",l.src,l,null);return;case"input":qe("invalid",s);var _=g=j=h=null,D=null,F=null;for(d in l)if(l.hasOwnProperty(d)){var W=l[d];if(W!=null)switch(d){case"name":h=W;break;case"type":j=W;break;case"checked":D=W;break;case"defaultChecked":F=W;break;case"value":g=W;break;case"defaultValue":_=W;break;case"children":case"dangerouslySetInnerHTML":if(W!=null)throw Error(a(137,i));break;default:ft(s,i,d,W,l,null)}}fg(s,g,_,D,F,j,h,!1);return;case"select":qe("invalid",s),d=j=g=null;for(h in l)if(l.hasOwnProperty(h)&&(_=l[h],_!=null))switch(h){case"value":g=_;break;case"defaultValue":j=_;break;case"multiple":d=_;default:ft(s,i,h,_,l,null)}i=g,l=j,s.multiple=!!d,i!=null?Ka(s,!!d,i,!1):l!=null&&Ka(s,!!d,l,!0);return;case"textarea":qe("invalid",s),g=h=d=null;for(j in l)if(l.hasOwnProperty(j)&&(_=l[j],_!=null))switch(j){case"value":d=_;break;case"defaultValue":h=_;break;case"children":g=_;break;case"dangerouslySetInnerHTML":if(_!=null)throw Error(a(91));break;default:ft(s,i,j,_,l,null)}mg(s,d,h,g);return;case"option":for(D in l)l.hasOwnProperty(D)&&(d=l[D],d!=null)&&(D==="selected"?s.selected=d&&typeof d!="function"&&typeof d!="symbol":ft(s,i,D,d,l,null));return;case"dialog":qe("beforetoggle",s),qe("toggle",s),qe("cancel",s),qe("close",s);break;case"iframe":case"object":qe("load",s);break;case"video":case"audio":for(d=0;d<Oo.length;d++)qe(Oo[d],s);break;case"image":qe("error",s),qe("load",s);break;case"details":qe("toggle",s);break;case"embed":case"source":case"link":qe("error",s),qe("load",s);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(F in l)if(l.hasOwnProperty(F)&&(d=l[F],d!=null))switch(F){case"children":case"dangerouslySetInnerHTML":throw Error(a(137,i));default:ft(s,i,F,d,l,null)}return;default:if(kd(i)){for(W in l)l.hasOwnProperty(W)&&(d=l[W],d!==void 0&&hh(s,i,W,d,l,void 0));return}}for(_ in l)l.hasOwnProperty(_)&&(d=l[_],d!=null&&ft(s,i,_,d,l,null))}function TC(s,i,l,d){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var h=null,g=null,j=null,_=null,D=null,F=null,W=null;for(Y in l){var ie=l[Y];if(l.hasOwnProperty(Y)&&ie!=null)switch(Y){case"checked":break;case"value":break;case"defaultValue":D=ie;default:d.hasOwnProperty(Y)||ft(s,i,Y,null,d,ie)}}for(var Z in d){var Y=d[Z];if(ie=l[Z],d.hasOwnProperty(Z)&&(Y!=null||ie!=null))switch(Z){case"type":g=Y;break;case"name":h=Y;break;case"checked":F=Y;break;case"defaultChecked":W=Y;break;case"value":j=Y;break;case"defaultValue":_=Y;break;case"children":case"dangerouslySetInnerHTML":if(Y!=null)throw Error(a(137,i));break;default:Y!==ie&&ft(s,i,Z,Y,d,ie)}}Nd(s,j,_,D,F,W,g,h);return;case"select":Y=j=_=Z=null;for(g in l)if(D=l[g],l.hasOwnProperty(g)&&D!=null)switch(g){case"value":break;case"multiple":Y=D;default:d.hasOwnProperty(g)||ft(s,i,g,null,d,D)}for(h in d)if(g=d[h],D=l[h],d.hasOwnProperty(h)&&(g!=null||D!=null))switch(h){case"value":Z=g;break;case"defaultValue":_=g;break;case"multiple":j=g;default:g!==D&&ft(s,i,h,g,d,D)}i=_,l=j,d=Y,Z!=null?Ka(s,!!l,Z,!1):!!d!=!!l&&(i!=null?Ka(s,!!l,i,!0):Ka(s,!!l,l?[]:"",!1));return;case"textarea":Y=Z=null;for(_ in l)if(h=l[_],l.hasOwnProperty(_)&&h!=null&&!d.hasOwnProperty(_))switch(_){case"value":break;case"children":break;default:ft(s,i,_,null,d,h)}for(j in d)if(h=d[j],g=l[j],d.hasOwnProperty(j)&&(h!=null||g!=null))switch(j){case"value":Z=h;break;case"defaultValue":Y=h;break;case"children":break;case"dangerouslySetInnerHTML":if(h!=null)throw Error(a(91));break;default:h!==g&&ft(s,i,j,h,d,g)}hg(s,Z,Y);return;case"option":for(var Se in l)Z=l[Se],l.hasOwnProperty(Se)&&Z!=null&&!d.hasOwnProperty(Se)&&(Se==="selected"?s.selected=!1:ft(s,i,Se,null,d,Z));for(D in d)Z=d[D],Y=l[D],d.hasOwnProperty(D)&&Z!==Y&&(Z!=null||Y!=null)&&(D==="selected"?s.selected=Z&&typeof Z!="function"&&typeof Z!="symbol":ft(s,i,D,Z,d,Y));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ae in l)Z=l[Ae],l.hasOwnProperty(Ae)&&Z!=null&&!d.hasOwnProperty(Ae)&&ft(s,i,Ae,null,d,Z);for(F in d)if(Z=d[F],Y=l[F],d.hasOwnProperty(F)&&Z!==Y&&(Z!=null||Y!=null))switch(F){case"children":case"dangerouslySetInnerHTML":if(Z!=null)throw Error(a(137,i));break;default:ft(s,i,F,Z,d,Y)}return;default:if(kd(i)){for(var ht in l)Z=l[ht],l.hasOwnProperty(ht)&&Z!==void 0&&!d.hasOwnProperty(ht)&&hh(s,i,ht,void 0,d,Z);for(W in d)Z=d[W],Y=l[W],!d.hasOwnProperty(W)||Z===Y||Z===void 0&&Y===void 0||hh(s,i,W,Z,d,Y);return}}for(var q in l)Z=l[q],l.hasOwnProperty(q)&&Z!=null&&!d.hasOwnProperty(q)&&ft(s,i,q,null,d,Z);for(ie in d)Z=d[ie],Y=l[ie],!d.hasOwnProperty(ie)||Z===Y||Z==null&&Y==null||ft(s,i,ie,Z,d,Y)}function yv(s){switch(s){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function RC(){if(typeof performance.getEntriesByType=="function"){for(var s=0,i=0,l=performance.getEntriesByType("resource"),d=0;d<l.length;d++){var h=l[d],g=h.transferSize,j=h.initiatorType,_=h.duration;if(g&&_&&yv(j)){for(j=0,_=h.responseEnd,d+=1;d<l.length;d++){var D=l[d],F=D.startTime;if(F>_)break;var W=D.transferSize,ie=D.initiatorType;W&&yv(ie)&&(D=D.responseEnd,j+=W*(D<_?1:(_-F)/(D-F)))}if(--d,i+=8*(g+j)/(h.duration/1e3),s++,10<s)break}}if(0<s)return i/s/1e6}return navigator.connection&&(s=navigator.connection.downlink,typeof s=="number")?s:5}var mh=null,ph=null;function _c(s){return s.nodeType===9?s:s.ownerDocument}function vv(s){switch(s){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function bv(s,i){if(s===0)switch(i){case"svg":return 1;case"math":return 2;default:return 0}return s===1&&i==="foreignObject"?0:s}function gh(s,i){return s==="textarea"||s==="noscript"||typeof i.children=="string"||typeof i.children=="number"||typeof i.children=="bigint"||typeof i.dangerouslySetInnerHTML=="object"&&i.dangerouslySetInnerHTML!==null&&i.dangerouslySetInnerHTML.__html!=null}var yh=null;function OC(){var s=window.event;return s&&s.type==="popstate"?s===yh?!1:(yh=s,!0):(yh=null,!1)}var xv=typeof setTimeout=="function"?setTimeout:void 0,LC=typeof clearTimeout=="function"?clearTimeout:void 0,Sv=typeof Promise=="function"?Promise:void 0,DC=typeof queueMicrotask=="function"?queueMicrotask:typeof Sv<"u"?function(s){return Sv.resolve(null).then(s).catch(MC)}:xv;function MC(s){setTimeout(function(){throw s})}function yi(s){return s==="head"}function jv(s,i){var l=i,d=0;do{var h=l.nextSibling;if(s.removeChild(l),h&&h.nodeType===8)if(l=h.data,l==="/$"||l==="/&"){if(d===0){s.removeChild(h),Sr(i);return}d--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")d++;else if(l==="html")Do(s.ownerDocument.documentElement);else if(l==="head"){l=s.ownerDocument.head,Do(l);for(var g=l.firstChild;g;){var j=g.nextSibling,_=g.nodeName;g[gs]||_==="SCRIPT"||_==="STYLE"||_==="LINK"&&g.rel.toLowerCase()==="stylesheet"||l.removeChild(g),g=j}}else l==="body"&&Do(s.ownerDocument.body);l=h}while(l);Sr(i)}function wv(s,i){var l=s;s=0;do{var d=l.nextSibling;if(l.nodeType===1?i?(l._stashedDisplay=l.style.display,l.style.display="none"):(l.style.display=l._stashedDisplay||"",l.getAttribute("style")===""&&l.removeAttribute("style")):l.nodeType===3&&(i?(l._stashedText=l.nodeValue,l.nodeValue=""):l.nodeValue=l._stashedText||""),d&&d.nodeType===8)if(l=d.data,l==="/$"){if(s===0)break;s--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||s++;l=d}while(l)}function vh(s){var i=s.firstChild;for(i&&i.nodeType===10&&(i=i.nextSibling);i;){var l=i;switch(i=i.nextSibling,l.nodeName){case"HTML":case"HEAD":case"BODY":vh(l),Js(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}s.removeChild(l)}}function $C(s,i,l,d){for(;s.nodeType===1;){var h=l;if(s.nodeName.toLowerCase()!==i.toLowerCase()){if(!d&&(s.nodeName!=="INPUT"||s.type!=="hidden"))break}else if(d){if(!s[gs])switch(i){case"meta":if(!s.hasAttribute("itemprop"))break;return s;case"link":if(g=s.getAttribute("rel"),g==="stylesheet"&&s.hasAttribute("data-precedence"))break;if(g!==h.rel||s.getAttribute("href")!==(h.href==null||h.href===""?null:h.href)||s.getAttribute("crossorigin")!==(h.crossOrigin==null?null:h.crossOrigin)||s.getAttribute("title")!==(h.title==null?null:h.title))break;return s;case"style":if(s.hasAttribute("data-precedence"))break;return s;case"script":if(g=s.getAttribute("src"),(g!==(h.src==null?null:h.src)||s.getAttribute("type")!==(h.type==null?null:h.type)||s.getAttribute("crossorigin")!==(h.crossOrigin==null?null:h.crossOrigin))&&g&&s.hasAttribute("async")&&!s.hasAttribute("itemprop"))break;return s;default:return s}}else if(i==="input"&&s.type==="hidden"){var g=h.name==null?null:""+h.name;if(h.type==="hidden"&&s.getAttribute("name")===g)return s}else return s;if(s=Gn(s.nextSibling),s===null)break}return null}function PC(s,i,l){if(i==="")return null;for(;s.nodeType!==3;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!l||(s=Gn(s.nextSibling),s===null))return null;return s}function Nv(s,i){for(;s.nodeType!==8;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!i||(s=Gn(s.nextSibling),s===null))return null;return s}function bh(s){return s.data==="$?"||s.data==="$~"}function xh(s){return s.data==="$!"||s.data==="$?"&&s.ownerDocument.readyState!=="loading"}function UC(s,i){var l=s.ownerDocument;if(s.data==="$~")s._reactRetry=i;else if(s.data!=="$?"||l.readyState!=="loading")i();else{var d=function(){i(),l.removeEventListener("DOMContentLoaded",d)};l.addEventListener("DOMContentLoaded",d),s._reactRetry=d}}function Gn(s){for(;s!=null;s=s.nextSibling){var i=s.nodeType;if(i===1||i===3)break;if(i===8){if(i=s.data,i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"||i==="F!"||i==="F")break;if(i==="/$"||i==="/&")return null}}return s}var Sh=null;function Cv(s){s=s.nextSibling;for(var i=0;s;){if(s.nodeType===8){var l=s.data;if(l==="/$"||l==="/&"){if(i===0)return Gn(s.nextSibling);i--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||i++}s=s.nextSibling}return null}function kv(s){s=s.previousSibling;for(var i=0;s;){if(s.nodeType===8){var l=s.data;if(l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"){if(i===0)return s;i--}else l!=="/$"&&l!=="/&"||i++}s=s.previousSibling}return null}function zv(s,i,l){switch(i=_c(l),s){case"html":if(s=i.documentElement,!s)throw Error(a(452));return s;case"head":if(s=i.head,!s)throw Error(a(453));return s;case"body":if(s=i.body,!s)throw Error(a(454));return s;default:throw Error(a(451))}}function Do(s){for(var i=s.attributes;i.length;)s.removeAttributeNode(i[0]);Js(s)}var Fn=new Map,_v=new Set;function Ec(s){return typeof s.getRootNode=="function"?s.getRootNode():s.nodeType===9?s:s.ownerDocument}var Hs=ae.d;ae.d={f:IC,r:BC,D:qC,C:KC,L:HC,m:GC,X:ZC,S:FC,M:VC};function IC(){var s=Hs.f(),i=xc();return s||i}function BC(s){var i=Ws(s);i!==null&&i.tag===5&&i.type==="form"?Gy(i):Hs.r(s)}var vr=typeof document>"u"?null:document;function Ev(s,i,l){var d=vr;if(d&&typeof i=="string"&&i){var h=Pn(i);h='link[rel="'+s+'"][href="'+h+'"]',typeof l=="string"&&(h+='[crossorigin="'+l+'"]'),_v.has(h)||(_v.add(h),s={rel:s,crossOrigin:l,href:i},d.querySelector(h)===null&&(i=d.createElement("link"),en(i,"link",s),at(i),d.head.appendChild(i)))}}function qC(s){Hs.D(s),Ev("dns-prefetch",s,null)}function KC(s,i){Hs.C(s,i),Ev("preconnect",s,i)}function HC(s,i,l){Hs.L(s,i,l);var d=vr;if(d&&s&&i){var h='link[rel="preload"][as="'+Pn(i)+'"]';i==="image"&&l&&l.imageSrcSet?(h+='[imagesrcset="'+Pn(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(h+='[imagesizes="'+Pn(l.imageSizes)+'"]')):h+='[href="'+Pn(s)+'"]';var g=h;switch(i){case"style":g=br(s);break;case"script":g=xr(s)}Fn.has(g)||(s=y({rel:"preload",href:i==="image"&&l&&l.imageSrcSet?void 0:s,as:i},l),Fn.set(g,s),d.querySelector(h)!==null||i==="style"&&d.querySelector(Mo(g))||i==="script"&&d.querySelector($o(g))||(i=d.createElement("link"),en(i,"link",s),at(i),d.head.appendChild(i)))}}function GC(s,i){Hs.m(s,i);var l=vr;if(l&&s){var d=i&&typeof i.as=="string"?i.as:"script",h='link[rel="modulepreload"][as="'+Pn(d)+'"][href="'+Pn(s)+'"]',g=h;switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":g=xr(s)}if(!Fn.has(g)&&(s=y({rel:"modulepreload",href:s},i),Fn.set(g,s),l.querySelector(h)===null)){switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector($o(g)))return}d=l.createElement("link"),en(d,"link",s),at(d),l.head.appendChild(d)}}}function FC(s,i,l){Hs.S(s,i,l);var d=vr;if(d&&s){var h=We(d).hoistableStyles,g=br(s);i=i||"default";var j=h.get(g);if(!j){var _={loading:0,preload:null};if(j=d.querySelector(Mo(g)))_.loading=5;else{s=y({rel:"stylesheet",href:s,"data-precedence":i},l),(l=Fn.get(g))&&jh(s,l);var D=j=d.createElement("link");at(D),en(D,"link",s),D._p=new Promise(function(F,W){D.onload=F,D.onerror=W}),D.addEventListener("load",function(){_.loading|=1}),D.addEventListener("error",function(){_.loading|=2}),_.loading|=4,Ac(j,i,d)}j={type:"stylesheet",instance:j,count:1,state:_},h.set(g,j)}}}function ZC(s,i){Hs.X(s,i);var l=vr;if(l&&s){var d=We(l).hoistableScripts,h=xr(s),g=d.get(h);g||(g=l.querySelector($o(h)),g||(s=y({src:s,async:!0},i),(i=Fn.get(h))&&wh(s,i),g=l.createElement("script"),at(g),en(g,"link",s),l.head.appendChild(g)),g={type:"script",instance:g,count:1,state:null},d.set(h,g))}}function VC(s,i){Hs.M(s,i);var l=vr;if(l&&s){var d=We(l).hoistableScripts,h=xr(s),g=d.get(h);g||(g=l.querySelector($o(h)),g||(s=y({src:s,async:!0,type:"module"},i),(i=Fn.get(h))&&wh(s,i),g=l.createElement("script"),at(g),en(g,"link",s),l.head.appendChild(g)),g={type:"script",instance:g,count:1,state:null},d.set(h,g))}}function Av(s,i,l,d){var h=(h=me.current)?Ec(h):null;if(!h)throw Error(a(446));switch(s){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(i=br(l.href),l=We(h).hoistableStyles,d=l.get(i),d||(d={type:"style",instance:null,count:0,state:null},l.set(i,d)),d):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){s=br(l.href);var g=We(h).hoistableStyles,j=g.get(s);if(j||(h=h.ownerDocument||h,j={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},g.set(s,j),(g=h.querySelector(Mo(s)))&&!g._p&&(j.instance=g,j.state.loading=5),Fn.has(s)||(l={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},Fn.set(s,l),g||QC(h,s,l,j.state))),i&&d===null)throw Error(a(528,""));return j}if(i&&d!==null)throw Error(a(529,""));return null;case"script":return i=l.async,l=l.src,typeof l=="string"&&i&&typeof i!="function"&&typeof i!="symbol"?(i=xr(l),l=We(h).hoistableScripts,d=l.get(i),d||(d={type:"script",instance:null,count:0,state:null},l.set(i,d)),d):{type:"void",instance:null,count:0,state:null};default:throw Error(a(444,s))}}function br(s){return'href="'+Pn(s)+'"'}function Mo(s){return'link[rel="stylesheet"]['+s+"]"}function Tv(s){return y({},s,{"data-precedence":s.precedence,precedence:null})}function QC(s,i,l,d){s.querySelector('link[rel="preload"][as="style"]['+i+"]")?d.loading=1:(i=s.createElement("link"),d.preload=i,i.addEventListener("load",function(){return d.loading|=1}),i.addEventListener("error",function(){return d.loading|=2}),en(i,"link",l),at(i),s.head.appendChild(i))}function xr(s){return'[src="'+Pn(s)+'"]'}function $o(s){return"script[async]"+s}function Rv(s,i,l){if(i.count++,i.instance===null)switch(i.type){case"style":var d=s.querySelector('style[data-href~="'+Pn(l.href)+'"]');if(d)return i.instance=d,at(d),d;var h=y({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return d=(s.ownerDocument||s).createElement("style"),at(d),en(d,"style",h),Ac(d,l.precedence,s),i.instance=d;case"stylesheet":h=br(l.href);var g=s.querySelector(Mo(h));if(g)return i.state.loading|=4,i.instance=g,at(g),g;d=Tv(l),(h=Fn.get(h))&&jh(d,h),g=(s.ownerDocument||s).createElement("link"),at(g);var j=g;return j._p=new Promise(function(_,D){j.onload=_,j.onerror=D}),en(g,"link",d),i.state.loading|=4,Ac(g,l.precedence,s),i.instance=g;case"script":return g=xr(l.src),(h=s.querySelector($o(g)))?(i.instance=h,at(h),h):(d=l,(h=Fn.get(g))&&(d=y({},l),wh(d,h)),s=s.ownerDocument||s,h=s.createElement("script"),at(h),en(h,"link",d),s.head.appendChild(h),i.instance=h);case"void":return null;default:throw Error(a(443,i.type))}else i.type==="stylesheet"&&(i.state.loading&4)===0&&(d=i.instance,i.state.loading|=4,Ac(d,l.precedence,s));return i.instance}function Ac(s,i,l){for(var d=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),h=d.length?d[d.length-1]:null,g=h,j=0;j<d.length;j++){var _=d[j];if(_.dataset.precedence===i)g=_;else if(g!==h)break}g?g.parentNode.insertBefore(s,g.nextSibling):(i=l.nodeType===9?l.head:l,i.insertBefore(s,i.firstChild))}function jh(s,i){s.crossOrigin==null&&(s.crossOrigin=i.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=i.referrerPolicy),s.title==null&&(s.title=i.title)}function wh(s,i){s.crossOrigin==null&&(s.crossOrigin=i.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=i.referrerPolicy),s.integrity==null&&(s.integrity=i.integrity)}var Tc=null;function Ov(s,i,l){if(Tc===null){var d=new Map,h=Tc=new Map;h.set(l,d)}else h=Tc,d=h.get(l),d||(d=new Map,h.set(l,d));if(d.has(s))return d;for(d.set(s,null),l=l.getElementsByTagName(s),h=0;h<l.length;h++){var g=l[h];if(!(g[gs]||g[it]||s==="link"&&g.getAttribute("rel")==="stylesheet")&&g.namespaceURI!=="http://www.w3.org/2000/svg"){var j=g.getAttribute(i)||"";j=s+j;var _=d.get(j);_?_.push(g):d.set(j,[g])}}return d}function Lv(s,i,l){s=s.ownerDocument||s,s.head.insertBefore(l,i==="title"?s.querySelector("head > title"):null)}function YC(s,i,l){if(l===1||i.itemProp!=null)return!1;switch(s){case"meta":case"title":return!0;case"style":if(typeof i.precedence!="string"||typeof i.href!="string"||i.href==="")break;return!0;case"link":if(typeof i.rel!="string"||typeof i.href!="string"||i.href===""||i.onLoad||i.onError)break;return i.rel==="stylesheet"?(s=i.disabled,typeof i.precedence=="string"&&s==null):!0;case"script":if(i.async&&typeof i.async!="function"&&typeof i.async!="symbol"&&!i.onLoad&&!i.onError&&i.src&&typeof i.src=="string")return!0}return!1}function Dv(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function JC(s,i,l,d){if(l.type==="stylesheet"&&(typeof d.media!="string"||matchMedia(d.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var h=br(d.href),g=i.querySelector(Mo(h));if(g){i=g._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(s.count++,s=Rc.bind(s),i.then(s,s)),l.state.loading|=4,l.instance=g,at(g);return}g=i.ownerDocument||i,d=Tv(d),(h=Fn.get(h))&&jh(d,h),g=g.createElement("link"),at(g);var j=g;j._p=new Promise(function(_,D){j.onload=_,j.onerror=D}),en(g,"link",d),l.instance=g}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(l,i),(i=l.state.preload)&&(l.state.loading&3)===0&&(s.count++,l=Rc.bind(s),i.addEventListener("load",l),i.addEventListener("error",l))}}var Nh=0;function XC(s,i){return s.stylesheets&&s.count===0&&Lc(s,s.stylesheets),0<s.count||0<s.imgCount?function(l){var d=setTimeout(function(){if(s.stylesheets&&Lc(s,s.stylesheets),s.unsuspend){var g=s.unsuspend;s.unsuspend=null,g()}},6e4+i);0<s.imgBytes&&Nh===0&&(Nh=62500*RC());var h=setTimeout(function(){if(s.waitingForImages=!1,s.count===0&&(s.stylesheets&&Lc(s,s.stylesheets),s.unsuspend)){var g=s.unsuspend;s.unsuspend=null,g()}},(s.imgBytes>Nh?50:800)+i);return s.unsuspend=l,function(){s.unsuspend=null,clearTimeout(d),clearTimeout(h)}}:null}function Rc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Lc(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var Oc=null;function Lc(s,i){s.stylesheets=null,s.unsuspend!==null&&(s.count++,Oc=new Map,i.forEach(WC,s),Oc=null,Rc.call(s))}function WC(s,i){if(!(i.state.loading&4)){var l=Oc.get(s);if(l)var d=l.get(null);else{l=new Map,Oc.set(s,l);for(var h=s.querySelectorAll("link[data-precedence],style[data-precedence]"),g=0;g<h.length;g++){var j=h[g];(j.nodeName==="LINK"||j.getAttribute("media")!=="not all")&&(l.set(j.dataset.precedence,j),d=j)}d&&l.set(null,d)}h=i.instance,j=h.getAttribute("data-precedence"),g=l.get(j)||d,g===d&&l.set(null,h),l.set(j,h),this.count++,d=Rc.bind(this),h.addEventListener("load",d),h.addEventListener("error",d),g?g.parentNode.insertBefore(h,g.nextSibling):(s=s.nodeType===9?s.head:s,s.insertBefore(h,s.firstChild)),i.state.loading|=4}}var Po={$$typeof:A,Provider:null,Consumer:null,_currentValue:pe,_currentValue2:pe,_threadCount:0};function ek(s,i,l,d,h,g,j,_,D){this.tag=1,this.containerInfo=s,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Wr(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Wr(0),this.hiddenUpdates=Wr(null),this.identifierPrefix=d,this.onUncaughtError=h,this.onCaughtError=g,this.onRecoverableError=j,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=D,this.incompleteTransitions=new Map}function Mv(s,i,l,d,h,g,j,_,D,F,W,ie){return s=new ek(s,i,l,j,D,F,W,ie,_),i=1,g===!0&&(i|=24),g=An(3,null,null,i),s.current=g,g.stateNode=s,i=nf(),i.refCount++,s.pooledCache=i,i.refCount++,g.memoizedState={element:d,isDehydrated:l,cache:i},of(g),s}function $v(s){return s?(s=Ja,s):Ja}function Pv(s,i,l,d,h,g){h=$v(h),d.context===null?d.context=h:d.pendingContext=h,d=ri(i),d.payload={element:l},g=g===void 0?null:g,g!==null&&(d.callback=g),l=oi(s,d,i),l!==null&&(wn(l,s,i),go(l,s,i))}function Uv(s,i){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var l=s.retryLane;s.retryLane=l!==0&&l<i?l:i}}function Ch(s,i){Uv(s,i),(s=s.alternate)&&Uv(s,i)}function Iv(s){if(s.tag===13||s.tag===31){var i=Ji(s,67108864);i!==null&&wn(i,s,67108864),Ch(s,67108864)}}function Bv(s){if(s.tag===13||s.tag===31){var i=Dn();i=Gt(i);var l=Ji(s,i);l!==null&&wn(l,s,i),Ch(s,i)}}var Dc=!0;function tk(s,i,l,d){var h=H.T;H.T=null;var g=ae.p;try{ae.p=2,kh(s,i,l,d)}finally{ae.p=g,H.T=h}}function nk(s,i,l,d){var h=H.T;H.T=null;var g=ae.p;try{ae.p=8,kh(s,i,l,d)}finally{ae.p=g,H.T=h}}function kh(s,i,l,d){if(Dc){var h=zh(d);if(h===null)fh(s,i,d,Mc,l),Kv(s,d);else if(ik(h,s,i,l,d))d.stopPropagation();else if(Kv(s,d),i&4&&-1<sk.indexOf(s)){for(;h!==null;){var g=Ws(h);if(g!==null)switch(g.tag){case 3:if(g=g.stateNode,g.current.memoizedState.isDehydrated){var j=ms(g.pendingLanes);if(j!==0){var _=g;for(_.pendingLanes|=2,_.entangledLanes|=2;j;){var D=1<<31-ue(j);_.entanglements[1]|=D,j&=~D}Ss(g),(nt&6)===0&&(vc=Ve()+500,Ro(0))}}break;case 31:case 13:_=Ji(g,2),_!==null&&wn(_,g,2),xc(),Ch(g,2)}if(g=zh(d),g===null&&fh(s,i,d,Mc,l),g===h)break;h=g}h!==null&&d.stopPropagation()}else fh(s,i,d,null,l)}}function zh(s){return s=_d(s),_h(s)}var Mc=null;function _h(s){if(Mc=null,s=Xs(s),s!==null){var i=c(s);if(i===null)s=null;else{var l=i.tag;if(l===13){if(s=u(i),s!==null)return s;s=null}else if(l===31){if(s=f(i),s!==null)return s;s=null}else if(l===3){if(i.stateNode.current.memoizedState.isDehydrated)return i.tag===3?i.stateNode.containerInfo:null;s=null}else i!==s&&(s=null)}}return Mc=s,null}function qv(s){switch(s){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch($e()){case Xe:return 2;case Ct:return 8;case Ke:case Ma:return 32;case gn:return 268435456;default:return 32}default:return 32}}var Eh=!1,vi=null,bi=null,xi=null,Uo=new Map,Io=new Map,Si=[],sk="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Kv(s,i){switch(s){case"focusin":case"focusout":vi=null;break;case"dragenter":case"dragleave":bi=null;break;case"mouseover":case"mouseout":xi=null;break;case"pointerover":case"pointerout":Uo.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":Io.delete(i.pointerId)}}function Bo(s,i,l,d,h,g){return s===null||s.nativeEvent!==g?(s={blockedOn:i,domEventName:l,eventSystemFlags:d,nativeEvent:g,targetContainers:[h]},i!==null&&(i=Ws(i),i!==null&&Iv(i)),s):(s.eventSystemFlags|=d,i=s.targetContainers,h!==null&&i.indexOf(h)===-1&&i.push(h),s)}function ik(s,i,l,d,h){switch(i){case"focusin":return vi=Bo(vi,s,i,l,d,h),!0;case"dragenter":return bi=Bo(bi,s,i,l,d,h),!0;case"mouseover":return xi=Bo(xi,s,i,l,d,h),!0;case"pointerover":var g=h.pointerId;return Uo.set(g,Bo(Uo.get(g)||null,s,i,l,d,h)),!0;case"gotpointercapture":return g=h.pointerId,Io.set(g,Bo(Io.get(g)||null,s,i,l,d,h)),!0}return!1}function Hv(s){var i=Xs(s.target);if(i!==null){var l=c(i);if(l!==null){if(i=l.tag,i===13){if(i=u(l),i!==null){s.blockedOn=i,ps(s.priority,function(){Bv(l)});return}}else if(i===31){if(i=f(l),i!==null){s.blockedOn=i,ps(s.priority,function(){Bv(l)});return}}else if(i===3&&l.stateNode.current.memoizedState.isDehydrated){s.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}s.blockedOn=null}function $c(s){if(s.blockedOn!==null)return!1;for(var i=s.targetContainers;0<i.length;){var l=zh(s.nativeEvent);if(l===null){l=s.nativeEvent;var d=new l.constructor(l.type,l);zd=d,l.target.dispatchEvent(d),zd=null}else return i=Ws(l),i!==null&&Iv(i),s.blockedOn=l,!1;i.shift()}return!0}function Gv(s,i,l){$c(s)&&l.delete(i)}function ak(){Eh=!1,vi!==null&&$c(vi)&&(vi=null),bi!==null&&$c(bi)&&(bi=null),xi!==null&&$c(xi)&&(xi=null),Uo.forEach(Gv),Io.forEach(Gv)}function Pc(s,i){s.blockedOn===i&&(s.blockedOn=null,Eh||(Eh=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,ak)))}var Uc=null;function Fv(s){Uc!==s&&(Uc=s,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Uc===s&&(Uc=null);for(var i=0;i<s.length;i+=3){var l=s[i],d=s[i+1],h=s[i+2];if(typeof d!="function"){if(_h(d||l)===null)continue;break}var g=Ws(l);g!==null&&(s.splice(i,3),i-=3,zf(g,{pending:!0,data:h,method:l.method,action:d},d,h))}}))}function Sr(s){function i(D){return Pc(D,s)}vi!==null&&Pc(vi,s),bi!==null&&Pc(bi,s),xi!==null&&Pc(xi,s),Uo.forEach(i),Io.forEach(i);for(var l=0;l<Si.length;l++){var d=Si[l];d.blockedOn===s&&(d.blockedOn=null)}for(;0<Si.length&&(l=Si[0],l.blockedOn===null);)Hv(l),l.blockedOn===null&&Si.shift();if(l=(s.ownerDocument||s).$$reactFormReplay,l!=null)for(d=0;d<l.length;d+=3){var h=l[d],g=l[d+1],j=h[sn]||null;if(typeof g=="function")j||Fv(l);else if(j){var _=null;if(g&&g.hasAttribute("formAction")){if(h=g,j=g[sn]||null)_=j.formAction;else if(_h(h)!==null)continue}else _=j.action;typeof _=="function"?l[d+1]=_:(l.splice(d,3),d-=3),Fv(l)}}}function Zv(){function s(g){g.canIntercept&&g.info==="react-transition"&&g.intercept({handler:function(){return new Promise(function(j){return h=j})},focusReset:"manual",scroll:"manual"})}function i(){h!==null&&(h(),h=null),d||setTimeout(l,20)}function l(){if(!d&&!navigation.transition){var g=navigation.currentEntry;g&&g.url!=null&&navigation.navigate(g.url,{state:g.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var d=!1,h=null;return navigation.addEventListener("navigate",s),navigation.addEventListener("navigatesuccess",i),navigation.addEventListener("navigateerror",i),setTimeout(l,100),function(){d=!0,navigation.removeEventListener("navigate",s),navigation.removeEventListener("navigatesuccess",i),navigation.removeEventListener("navigateerror",i),h!==null&&(h(),h=null)}}}function Ah(s){this._internalRoot=s}Ic.prototype.render=Ah.prototype.render=function(s){var i=this._internalRoot;if(i===null)throw Error(a(409));var l=i.current,d=Dn();Pv(l,d,s,i,null,null)},Ic.prototype.unmount=Ah.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var i=s.containerInfo;Pv(s.current,2,null,s,null,null),xc(),i[_n]=null}};function Ic(s){this._internalRoot=s}Ic.prototype.unstable_scheduleHydration=function(s){if(s){var i=Ia();s={blockedOn:null,target:s,priority:i};for(var l=0;l<Si.length&&i!==0&&i<Si[l].priority;l++);Si.splice(l,0,s),l===0&&Hv(s)}};var Vv=t.version;if(Vv!=="19.2.4")throw Error(a(527,Vv,"19.2.4"));ae.findDOMNode=function(s){var i=s._reactInternals;if(i===void 0)throw typeof s.render=="function"?Error(a(188)):(s=Object.keys(s).join(","),Error(a(268,s)));return s=p(i),s=s!==null?v(s):null,s=s===null?null:s.stateNode,s};var rk={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:H,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Bc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Bc.isDisabled&&Bc.supportsFiber)try{ns=Bc.inject(rk),mt=Bc}catch{}}return Ko.createRoot=function(s,i){if(!o(s))throw Error(a(299));var l=!1,d="",h=t0,g=n0,j=s0;return i!=null&&(i.unstable_strictMode===!0&&(l=!0),i.identifierPrefix!==void 0&&(d=i.identifierPrefix),i.onUncaughtError!==void 0&&(h=i.onUncaughtError),i.onCaughtError!==void 0&&(g=i.onCaughtError),i.onRecoverableError!==void 0&&(j=i.onRecoverableError)),i=Mv(s,1,!1,null,null,l,d,null,h,g,j,Zv),s[_n]=i.current,dh(s),new Ah(i)},Ko.hydrateRoot=function(s,i,l){if(!o(s))throw Error(a(299));var d=!1,h="",g=t0,j=n0,_=s0,D=null;return l!=null&&(l.unstable_strictMode===!0&&(d=!0),l.identifierPrefix!==void 0&&(h=l.identifierPrefix),l.onUncaughtError!==void 0&&(g=l.onUncaughtError),l.onCaughtError!==void 0&&(j=l.onCaughtError),l.onRecoverableError!==void 0&&(_=l.onRecoverableError),l.formState!==void 0&&(D=l.formState)),i=Mv(s,1,!0,i,l??null,d,h,D,g,j,_,Zv),i.context=$v(null),l=i.current,d=Dn(),d=Gt(d),h=ri(d),h.callback=null,oi(l,h,d),l=d,i.current.lanes=l,Fi(i,l),Ss(i),s[_n]=i.current,dh(s),new Ic(i)},Ko.version="19.2.4",Ko}var ib;function gk(){if(ib)return Oh.exports;ib=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Oh.exports=pk(),Oh.exports}var yk=gk(),Aa=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},vk={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},bk=class{#t=vk;#e=!1;setTimeoutProvider(e){this.#t=e}setTimeout(e,t){return this.#t.setTimeout(e,t)}clearTimeout(e){this.#t.clearTimeout(e)}setInterval(e,t){return this.#t.setInterval(e,t)}clearInterval(e){this.#t.clearInterval(e)}},ma=new bk;function xk(e){setTimeout(e,0)}var Ca=typeof window>"u"||"Deno"in globalThis;function rn(){}function Sk(e,t){return typeof e=="function"?e(t):e}function vm(e){return typeof e=="number"&&e>=0&&e!==1/0}function xS(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Ti(e,t){return typeof e=="function"?e(t):e}function Zn(e,t){return typeof e=="function"?e(t):e}function ab(e,t){const{type:n="all",exact:a,fetchStatus:o,predicate:c,queryKey:u,stale:f}=e;if(u){if(a){if(t.queryHash!==ip(u,t.options))return!1}else if(!sl(t.queryKey,u))return!1}if(n!=="all"){const m=t.isActive();if(n==="active"&&!m||n==="inactive"&&m)return!1}return!(typeof f=="boolean"&&t.isStale()!==f||o&&o!==t.state.fetchStatus||c&&!c(t))}function rb(e,t){const{exact:n,status:a,predicate:o,mutationKey:c}=e;if(c){if(!t.options.mutationKey)return!1;if(n){if(ka(t.options.mutationKey)!==ka(c))return!1}else if(!sl(t.options.mutationKey,c))return!1}return!(a&&t.state.status!==a||o&&!o(t))}function ip(e,t){return(t?.queryKeyHashFn||ka)(e)}function ka(e){return JSON.stringify(e,(t,n)=>bm(n)?Object.keys(n).sort().reduce((a,o)=>(a[o]=n[o],a),{}):n)}function sl(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>sl(e[n],t[n])):!1}var jk=Object.prototype.hasOwnProperty;function ap(e,t,n=0){if(e===t)return e;if(n>500)return t;const a=ob(e)&&ob(t);if(!a&&!(bm(e)&&bm(t)))return t;const c=(a?e:Object.keys(e)).length,u=a?t:Object.keys(t),f=u.length,m=a?new Array(f):{};let p=0;for(let v=0;v<f;v++){const y=a?v:u[v],b=e[y],x=t[y];if(b===x){m[y]=b,(a?v<c:jk.call(e,y))&&p++;continue}if(b===null||x===null||typeof b!="object"||typeof x!="object"){m[y]=x;continue}const N=ap(b,x,n+1);m[y]=N,N===b&&p++}return c===f&&p===c?e:m}function il(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function ob(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function bm(e){if(!lb(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!lb(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function lb(e){return Object.prototype.toString.call(e)==="[object Object]"}function wk(e){return new Promise(t=>{ma.setTimeout(t,e)})}function xm(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?ap(e,t):t}function Nk(e,t,n=0){const a=[...e,t];return n&&a.length>n?a.slice(1):a}function Ck(e,t,n=0){const a=[t,...e];return n&&a.length>n?a.slice(0,-1):a}var rp=Symbol();function SS(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===rp?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function op(e,t){return typeof e=="function"?e(...t):!!e}function kk(e,t,n){let a=!1,o;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(o??=t(),a||(a=!0,o.aborted?n():o.addEventListener("abort",n,{once:!0})),o)}),e}var zk=class extends Aa{#t;#e;#n;constructor(){super(),this.#n=e=>{if(!Ca&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#e||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(e){this.#n=e,this.#e?.(),this.#e=e(t=>{typeof t=="boolean"?this.setFocused(t):this.onFocus()})}setFocused(e){this.#t!==e&&(this.#t=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#t=="boolean"?this.#t:globalThis.document?.visibilityState!=="hidden"}},lp=new zk;function Sm(){let e,t;const n=new Promise((o,c)=>{e=o,t=c});n.status="pending",n.catch(()=>{});function a(o){Object.assign(n,o),delete n.resolve,delete n.reject}return n.resolve=o=>{a({status:"fulfilled",value:o}),e(o)},n.reject=o=>{a({status:"rejected",reason:o}),t(o)},n}var _k=xk;function Ek(){let e=[],t=0,n=f=>{f()},a=f=>{f()},o=_k;const c=f=>{t?e.push(f):o(()=>{n(f)})},u=()=>{const f=e;e=[],f.length&&o(()=>{a(()=>{f.forEach(m=>{n(m)})})})};return{batch:f=>{let m;t++;try{m=f()}finally{t--,t||u()}return m},batchCalls:f=>(...m)=>{c(()=>{f(...m)})},schedule:c,setNotifyFunction:f=>{n=f},setBatchNotifyFunction:f=>{a=f},setScheduler:f=>{o=f}}}var Ot=Ek(),Ak=class extends Aa{#t=!0;#e;#n;constructor(){super(),this.#n=e=>{if(!Ca&&window.addEventListener){const t=()=>e(!0),n=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",n)}}}}onSubscribe(){this.#e||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(e){this.#n=e,this.#e?.(),this.#e=e(this.setOnline.bind(this))}setOnline(e){this.#t!==e&&(this.#t=e,this.listeners.forEach(n=>{n(e)}))}isOnline(){return this.#t}},xu=new Ak;function Tk(e){return Math.min(1e3*2**e,3e4)}function jS(e){return(e??"online")==="online"?xu.isOnline():!0}var jm=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function wS(e){let t=!1,n=0,a;const o=Sm(),c=()=>o.status!=="pending",u=S=>{if(!c()){const C=new jm(S);b(C),e.onCancel?.(C)}},f=()=>{t=!0},m=()=>{t=!1},p=()=>lp.isFocused()&&(e.networkMode==="always"||xu.isOnline())&&e.canRun(),v=()=>jS(e.networkMode)&&e.canRun(),y=S=>{c()||(a?.(),o.resolve(S))},b=S=>{c()||(a?.(),o.reject(S))},x=()=>new Promise(S=>{a=C=>{(c()||p())&&S(C)},e.onPause?.()}).then(()=>{a=void 0,c()||e.onContinue?.()}),N=()=>{if(c())return;let S;const C=n===0?e.initialPromise:void 0;try{S=C??e.fn()}catch(k){S=Promise.reject(k)}Promise.resolve(S).then(y).catch(k=>{if(c())return;const T=e.retry??(Ca?0:3),A=e.retryDelay??Tk,z=typeof A=="function"?A(n,k):A,$=T===!0||typeof T=="number"&&n<T||typeof T=="function"&&T(n,k);if(t||!$){b(k);return}n++,e.onFail?.(n,k),wk(z).then(()=>p()?void 0:x()).then(()=>{t?b(k):N()})})};return{promise:o,status:()=>o.status,cancel:u,continue:()=>(a?.(),o),cancelRetry:f,continueRetry:m,canStart:v,start:()=>(v()?N():x().then(N),o)}}var NS=class{#t;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),vm(this.gcTime)&&(this.#t=ma.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Ca?1/0:300*1e3))}clearGcTimeout(){this.#t&&(ma.clearTimeout(this.#t),this.#t=void 0)}},Rk=class extends NS{#t;#e;#n;#i;#s;#a;#o;constructor(e){super(),this.#o=!1,this.#a=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#n=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=ub(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#s?.promise}setOptions(e){if(this.options={...this.#a,...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const t=ub(this.options);t.data!==void 0&&(this.setState(cb(t.data,t.dataUpdatedAt)),this.#t=t)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#n.remove(this)}setData(e,t){const n=xm(this.state.data,e,this.options);return this.#r({data:n,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e,t){this.#r({type:"setState",state:e,setStateOptions:t})}cancel(e){const t=this.#s?.promise;return this.#s?.cancel(e),t?t.then(rn).catch(rn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#t)}isActive(){return this.observers.some(e=>Zn(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===rp||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>Ti(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!xS(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(t=>t.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#s?.continue()}onOnline(){this.observers.find(t=>t.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#s?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#s&&(this.#o?this.#s.cancel({revert:!0}):this.#s.cancelRetry()),this.scheduleGc()),this.#n.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#r({type:"invalidate"})}async fetch(e,t){if(this.state.fetchStatus!=="idle"&&this.#s?.status()!=="rejected"){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#s)return this.#s.continueRetry(),this.#s.promise}if(e&&this.setOptions(e),!this.options.queryFn){const f=this.observers.find(m=>m.options.queryFn);f&&this.setOptions(f.options)}const n=new AbortController,a=f=>{Object.defineProperty(f,"signal",{enumerable:!0,get:()=>(this.#o=!0,n.signal)})},o=()=>{const f=SS(this.options,t),p=(()=>{const v={client:this.#i,queryKey:this.queryKey,meta:this.meta};return a(v),v})();return this.#o=!1,this.options.persister?this.options.persister(f,p,this):f(p)},u=(()=>{const f={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:o};return a(f),f})();this.options.behavior?.onFetch(u,this),this.#e=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==u.fetchOptions?.meta)&&this.#r({type:"fetch",meta:u.fetchOptions?.meta}),this.#s=wS({initialPromise:t?.initialPromise,fn:u.fetchFn,onCancel:f=>{f instanceof jm&&f.revert&&this.setState({...this.#e,fetchStatus:"idle"}),n.abort()},onFail:(f,m)=>{this.#r({type:"failed",failureCount:f,error:m})},onPause:()=>{this.#r({type:"pause"})},onContinue:()=>{this.#r({type:"continue"})},retry:u.options.retry,retryDelay:u.options.retryDelay,networkMode:u.options.networkMode,canRun:()=>!0});try{const f=await this.#s.start();if(f===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(f),this.#n.config.onSuccess?.(f,this),this.#n.config.onSettled?.(f,this.state.error,this),f}catch(f){if(f instanceof jm){if(f.silent)return this.#s.promise;if(f.revert){if(this.state.data===void 0)throw f;return this.state.data}}throw this.#r({type:"error",error:f}),this.#n.config.onError?.(f,this),this.#n.config.onSettled?.(this.state.data,f,this),f}finally{this.scheduleGc()}}#r(e){const t=n=>{switch(e.type){case"failed":return{...n,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...CS(n.data,this.options),fetchMeta:e.meta??null};case"success":const a={...n,...cb(e.data,e.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#e=e.manual?a:void 0,a;case"error":const o=e.error;return{...n,error:o,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...e.state}}};this.state=t(this.state),Ot.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),this.#n.notify({query:this,type:"updated",action:e})})}};function CS(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:jS(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function cb(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function ub(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,a=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?a??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var cp=class extends Aa{constructor(e,t){super(),this.options=t,this.#t=e,this.#r=null,this.#o=Sm(),this.bindMethods(),this.setOptions(t)}#t;#e=void 0;#n=void 0;#i=void 0;#s;#a;#o;#r;#m;#d;#f;#c;#u;#l;#h=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#e.addObserver(this),db(this.#e,this.options)?this.#p():this.updateResult(),this.#b())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return wm(this.#e,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return wm(this.#e,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#x(),this.#S(),this.#e.removeObserver(this)}setOptions(e){const t=this.options,n=this.#e;if(this.options=this.#t.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Zn(this.options.enabled,this.#e)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#j(),this.#e.setOptions(this.options),t._defaulted&&!il(this.options,t)&&this.#t.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#e,observer:this});const a=this.hasListeners();a&&fb(this.#e,n,this.options,t)&&this.#p(),this.updateResult(),a&&(this.#e!==n||Zn(this.options.enabled,this.#e)!==Zn(t.enabled,this.#e)||Ti(this.options.staleTime,this.#e)!==Ti(t.staleTime,this.#e))&&this.#g();const o=this.#y();a&&(this.#e!==n||Zn(this.options.enabled,this.#e)!==Zn(t.enabled,this.#e)||o!==this.#l)&&this.#v(o)}getOptimisticResult(e){const t=this.#t.getQueryCache().build(this.#t,e),n=this.createResult(t,e);return Lk(this,n)&&(this.#i=n,this.#a=this.options,this.#s=this.#e.state),n}getCurrentResult(){return this.#i}trackResult(e,t){return new Proxy(e,{get:(n,a)=>(this.trackProp(a),t?.(a),a==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#o.status==="pending"&&this.#o.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(n,a))})}trackProp(e){this.#h.add(e)}getCurrentQuery(){return this.#e}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#t.defaultQueryOptions(e),n=this.#t.getQueryCache().build(this.#t,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#p({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#i))}#p(e){this.#j();let t=this.#e.fetch(this.options,e);return e?.throwOnError||(t=t.catch(rn)),t}#g(){this.#x();const e=Ti(this.options.staleTime,this.#e);if(Ca||this.#i.isStale||!vm(e))return;const n=xS(this.#i.dataUpdatedAt,e)+1;this.#c=ma.setTimeout(()=>{this.#i.isStale||this.updateResult()},n)}#y(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#e):this.options.refetchInterval)??!1}#v(e){this.#S(),this.#l=e,!(Ca||Zn(this.options.enabled,this.#e)===!1||!vm(this.#l)||this.#l===0)&&(this.#u=ma.setInterval(()=>{(this.options.refetchIntervalInBackground||lp.isFocused())&&this.#p()},this.#l))}#b(){this.#g(),this.#v(this.#y())}#x(){this.#c&&(ma.clearTimeout(this.#c),this.#c=void 0)}#S(){this.#u&&(ma.clearInterval(this.#u),this.#u=void 0)}createResult(e,t){const n=this.#e,a=this.options,o=this.#i,c=this.#s,u=this.#a,m=e!==n?e.state:this.#n,{state:p}=e;let v={...p},y=!1,b;if(t._optimisticResults){const O=this.hasListeners(),K=!O&&db(e,t),ee=O&&fb(e,n,t,a);(K||ee)&&(v={...v,...CS(p.data,e.options)}),t._optimisticResults==="isRestoring"&&(v.fetchStatus="idle")}let{error:x,errorUpdatedAt:N,status:S}=v;b=v.data;let C=!1;if(t.placeholderData!==void 0&&b===void 0&&S==="pending"){let O;o?.isPlaceholderData&&t.placeholderData===u?.placeholderData?(O=o.data,C=!0):O=typeof t.placeholderData=="function"?t.placeholderData(this.#f?.state.data,this.#f):t.placeholderData,O!==void 0&&(S="success",b=xm(o?.data,O,t),y=!0)}if(t.select&&b!==void 0&&!C)if(o&&b===c?.data&&t.select===this.#m)b=this.#d;else try{this.#m=t.select,b=t.select(b),b=xm(o?.data,b,t),this.#d=b,this.#r=null}catch(O){this.#r=O}this.#r&&(x=this.#r,b=this.#d,N=Date.now(),S="error");const k=v.fetchStatus==="fetching",T=S==="pending",A=S==="error",z=T&&k,$=b!==void 0,E={status:S,fetchStatus:v.fetchStatus,isPending:T,isSuccess:S==="success",isError:A,isInitialLoading:z,isLoading:z,data:b,dataUpdatedAt:v.dataUpdatedAt,error:x,errorUpdatedAt:N,failureCount:v.fetchFailureCount,failureReason:v.fetchFailureReason,errorUpdateCount:v.errorUpdateCount,isFetched:v.dataUpdateCount>0||v.errorUpdateCount>0,isFetchedAfterMount:v.dataUpdateCount>m.dataUpdateCount||v.errorUpdateCount>m.errorUpdateCount,isFetching:k,isRefetching:k&&!T,isLoadingError:A&&!$,isPaused:v.fetchStatus==="paused",isPlaceholderData:y,isRefetchError:A&&$,isStale:up(e,t),refetch:this.refetch,promise:this.#o,isEnabled:Zn(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const O=E.data!==void 0,K=E.status==="error"&&!O,ee=de=>{K?de.reject(E.error):O&&de.resolve(E.data)},X=()=>{const de=this.#o=E.promise=Sm();ee(de)},se=this.#o;switch(se.status){case"pending":e.queryHash===n.queryHash&&ee(se);break;case"fulfilled":(K||E.data!==se.value)&&X();break;case"rejected":(!K||E.error!==se.reason)&&X();break}}return E}updateResult(){const e=this.#i,t=this.createResult(this.#e,this.options);if(this.#s=this.#e.state,this.#a=this.options,this.#s.data!==void 0&&(this.#f=this.#e),il(t,e))return;this.#i=t;const n=()=>{if(!e)return!0;const{notifyOnChangeProps:a}=this.options,o=typeof a=="function"?a():a;if(o==="all"||!o&&!this.#h.size)return!0;const c=new Set(o??this.#h);return this.options.throwOnError&&c.add("error"),Object.keys(this.#i).some(u=>{const f=u;return this.#i[f]!==e[f]&&c.has(f)})};this.#w({listeners:n()})}#j(){const e=this.#t.getQueryCache().build(this.#t,this.options);if(e===this.#e)return;const t=this.#e;this.#e=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#b()}#w(e){Ot.batch(()=>{e.listeners&&this.listeners.forEach(t=>{t(this.#i)}),this.#t.getQueryCache().notify({query:this.#e,type:"observerResultsUpdated"})})}};function Ok(e,t){return Zn(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function db(e,t){return Ok(e,t)||e.state.data!==void 0&&wm(e,t,t.refetchOnMount)}function wm(e,t,n){if(Zn(t.enabled,e)!==!1&&Ti(t.staleTime,e)!=="static"){const a=typeof n=="function"?n(e):n;return a==="always"||a!==!1&&up(e,t)}return!1}function fb(e,t,n,a){return(e!==t||Zn(a.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&up(e,n)}function up(e,t){return Zn(t.enabled,e)!==!1&&e.isStaleByTime(Ti(t.staleTime,e))}function Lk(e,t){return!il(e.getCurrentResult(),t)}function hb(e){return{onFetch:(t,n)=>{const a=t.options,o=t.fetchOptions?.meta?.fetchMore?.direction,c=t.state.data?.pages||[],u=t.state.data?.pageParams||[];let f={pages:[],pageParams:[]},m=0;const p=async()=>{let v=!1;const y=N=>{kk(N,()=>t.signal,()=>v=!0)},b=SS(t.options,t.fetchOptions),x=async(N,S,C)=>{if(v)return Promise.reject();if(S==null&&N.pages.length)return Promise.resolve(N);const T=(()=>{const P={client:t.client,queryKey:t.queryKey,pageParam:S,direction:C?"backward":"forward",meta:t.options.meta};return y(P),P})(),A=await b(T),{maxPages:z}=t.options,$=C?Ck:Nk;return{pages:$(N.pages,A,z),pageParams:$(N.pageParams,S,z)}};if(o&&c.length){const N=o==="backward",S=N?Dk:mb,C={pages:c,pageParams:u},k=S(a,C);f=await x(C,k,N)}else{const N=e??c.length;do{const S=m===0?u[0]??a.initialPageParam:mb(a,f);if(m>0&&S==null)break;f=await x(f,S),m++}while(m<N)}return f};t.options.persister?t.fetchFn=()=>t.options.persister?.(p,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=p}}}function mb(e,{pages:t,pageParams:n}){const a=t.length-1;return t.length>0?e.getNextPageParam(t[a],t,n[a],n):void 0}function Dk(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var Mk=class extends NS{#t;#e;#n;#i;constructor(e){super(),this.#t=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#e=[],this.state=e.state||kS(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#e.includes(e)||(this.#e.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#e=this.#e.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#e.length||(this.state.status==="pending"?this.scheduleGc():this.#n.remove(this))}continue(){return this.#i?.continue()??this.execute(this.state.variables)}async execute(e){const t=()=>{this.#s({type:"continue"})},n={client:this.#t,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#i=wS({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(new Error("No mutationFn found")),onFail:(c,u)=>{this.#s({type:"failed",failureCount:c,error:u})},onPause:()=>{this.#s({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});const a=this.state.status==="pending",o=!this.#i.canStart();try{if(a)t();else{this.#s({type:"pending",variables:e,isPaused:o}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);const u=await this.options.onMutate?.(e,n);u!==this.state.context&&this.#s({type:"pending",context:u,variables:e,isPaused:o})}const c=await this.#i.start();return await this.#n.config.onSuccess?.(c,e,this.state.context,this,n),await this.options.onSuccess?.(c,e,this.state.context,n),await this.#n.config.onSettled?.(c,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(c,null,e,this.state.context,n),this.#s({type:"success",data:c}),c}catch(c){try{await this.#n.config.onError?.(c,e,this.state.context,this,n)}catch(u){Promise.reject(u)}try{await this.options.onError?.(c,e,this.state.context,n)}catch(u){Promise.reject(u)}try{await this.#n.config.onSettled?.(void 0,c,this.state.variables,this.state.context,this,n)}catch(u){Promise.reject(u)}try{await this.options.onSettled?.(void 0,c,e,this.state.context,n)}catch(u){Promise.reject(u)}throw this.#s({type:"error",error:c}),c}finally{this.#n.runNext(this)}}#s(e){const t=n=>{switch(e.type){case"failed":return{...n,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...n,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:e.error,failureCount:n.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=t(this.state),Ot.batch(()=>{this.#e.forEach(n=>{n.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:"updated",action:e})})}};function kS(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var zS=class extends Aa{constructor(e={}){super(),this.config=e,this.#t=new Set,this.#e=new Map,this.#n=0}#t;#e;#n;build(e,t,n){const a=new Mk({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(a),a}add(e){this.#t.add(e);const t=qc(e);if(typeof t=="string"){const n=this.#e.get(t);n?n.push(e):this.#e.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#t.delete(e)){const t=qc(e);if(typeof t=="string"){const n=this.#e.get(t);if(n)if(n.length>1){const a=n.indexOf(e);a!==-1&&n.splice(a,1)}else n[0]===e&&this.#e.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=qc(e);if(typeof t=="string"){const a=this.#e.get(t)?.find(o=>o.state.status==="pending");return!a||a===e}else return!0}runNext(e){const t=qc(e);return typeof t=="string"?this.#e.get(t)?.find(a=>a!==e&&a.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){Ot.batch(()=>{this.#t.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#t.clear(),this.#e.clear()})}getAll(){return Array.from(this.#t)}find(e){const t={exact:!0,...e};return this.getAll().find(n=>rb(t,n))}findAll(e={}){return this.getAll().filter(t=>rb(e,t))}notify(e){Ot.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return Ot.batch(()=>Promise.all(e.map(t=>t.continue().catch(rn))))}};function qc(e){return e.options.scope?.id}var $k=class extends Aa{#t;#e=void 0;#n;#i;constructor(t,n){super(),this.#t=t,this.setOptions(n),this.bindMethods(),this.#s()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){const n=this.options;this.options=this.#t.defaultMutationOptions(t),il(this.options,n)||this.#t.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#n,observer:this}),n?.mutationKey&&this.options.mutationKey&&ka(n.mutationKey)!==ka(this.options.mutationKey)?this.reset():this.#n?.state.status==="pending"&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(t){this.#s(),this.#a(t)}getCurrentResult(){return this.#e}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#s(),this.#a()}mutate(t,n){return this.#i=n,this.#n?.removeObserver(this),this.#n=this.#t.getMutationCache().build(this.#t,this.options),this.#n.addObserver(this),this.#n.execute(t)}#s(){const t=this.#n?.state??kS();this.#e={...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset}}#a(t){Ot.batch(()=>{if(this.#i&&this.hasListeners()){const n=this.#e.variables,a=this.#e.context,o={client:this.#t,meta:this.options.meta,mutationKey:this.options.mutationKey};if(t?.type==="success"){try{this.#i.onSuccess?.(t.data,n,a,o)}catch(c){Promise.reject(c)}try{this.#i.onSettled?.(t.data,null,n,a,o)}catch(c){Promise.reject(c)}}else if(t?.type==="error"){try{this.#i.onError?.(t.error,n,a,o)}catch(c){Promise.reject(c)}try{this.#i.onSettled?.(void 0,t.error,n,a,o)}catch(c){Promise.reject(c)}}}this.listeners.forEach(n=>{n(this.#e)})})}};function pb(e,t){const n=new Set(t);return e.filter(a=>!n.has(a))}function Pk(e,t,n){const a=e.slice(0);return a[t]=n,a}var Uk=class extends Aa{#t;#e;#n;#i;#s;#a;#o;#r;#m;#d=[];constructor(e,t,n){super(),this.#t=e,this.#i=n,this.#n=[],this.#s=[],this.#e=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#s.forEach(e=>{e.subscribe(t=>{this.#l(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#s.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#i=t,Ot.batch(()=>{const n=this.#s,a=this.#u(this.#n);a.forEach(v=>v.observer.setOptions(v.defaultedQueryOptions));const o=a.map(v=>v.observer),c=o.map(v=>v.getCurrentResult()),u=n.length!==o.length,f=o.some((v,y)=>v!==n[y]),m=u||f,p=m?!0:c.some((v,y)=>{const b=this.#e[y];return!b||!il(v,b)});!m&&!p||(m&&(this.#d=a,this.#s=o),this.#e=c,this.hasListeners()&&(m&&(pb(n,o).forEach(v=>{v.destroy()}),pb(o,n).forEach(v=>{v.subscribe(y=>{this.#l(v,y)})})),this.#h()))})}getCurrentResult(){return this.#e}getQueries(){return this.#s.map(e=>e.getCurrentQuery())}getObservers(){return this.#s}getOptimisticResult(e,t){const n=this.#u(e),a=n.map(c=>c.observer.getOptimisticResult(c.defaultedQueryOptions)),o=n.map(c=>c.defaultedQueryOptions.queryHash);return[a,c=>this.#c(c??a,t,o),()=>this.#f(a,n)]}#f(e,t){return t.map((n,a)=>{const o=e[a];return n.defaultedQueryOptions.notifyOnChangeProps?o:n.observer.trackResult(o,c=>{t.forEach(u=>{u.observer.trackProp(c)})})})}#c(e,t,n){if(t){const a=this.#m,o=n!==void 0&&a!==void 0&&(a.length!==n.length||n.some((c,u)=>c!==a[u]));return(!this.#a||this.#e!==this.#r||o||t!==this.#o)&&(this.#o=t,this.#r=this.#e,n!==void 0&&(this.#m=n),this.#a=ap(this.#a,t(e))),this.#a}return e}#u(e){const t=new Map;this.#s.forEach(a=>{const o=a.options.queryHash;if(!o)return;const c=t.get(o);c?c.push(a):t.set(o,[a])});const n=[];return e.forEach(a=>{const o=this.#t.defaultQueryOptions(a),u=t.get(o.queryHash)?.shift()??new cp(this.#t,o);n.push({defaultedQueryOptions:o,observer:u})}),n}#l(e,t){const n=this.#s.indexOf(e);n!==-1&&(this.#e=Pk(this.#e,n,t),this.#h())}#h(){if(this.hasListeners()){const e=this.#a,t=this.#f(this.#e,this.#d),n=this.#c(t,this.#i?.combine);e!==n&&Ot.batch(()=>{this.listeners.forEach(a=>{a(this.#e)})})}}},Ik=class extends Aa{constructor(e={}){super(),this.config=e,this.#t=new Map}#t;build(e,t,n){const a=t.queryKey,o=t.queryHash??ip(a,t);let c=this.get(o);return c||(c=new Rk({client:e,queryKey:a,queryHash:o,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(a)}),this.add(c)),c}add(e){this.#t.has(e.queryHash)||(this.#t.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=this.#t.get(e.queryHash);t&&(e.destroy(),t===e&&this.#t.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){Ot.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#t.get(e)}getAll(){return[...this.#t.values()]}find(e){const t={exact:!0,...e};return this.getAll().find(n=>ab(t,n))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(n=>ab(e,n)):t}notify(e){Ot.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Ot.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Ot.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Bk=class{#t;#e;#n;#i;#s;#a;#o;#r;constructor(e={}){this.#t=e.queryCache||new Ik,this.#e=e.mutationCache||new zS,this.#n=e.defaultOptions||{},this.#i=new Map,this.#s=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=lp.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#t.onFocus())}),this.#r=xu.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#t.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#r?.(),this.#r=void 0)}isFetching(e){return this.#t.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#e.findAll({...e,status:"pending"}).length}getQueryData(e){const t=this.defaultQueryOptions({queryKey:e});return this.#t.get(t.queryHash)?.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=this.#t.build(this,t),a=n.state.data;return a===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Ti(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(a))}getQueriesData(e){return this.#t.findAll(e).map(({queryKey:t,state:n})=>{const a=n.data;return[t,a]})}setQueryData(e,t,n){const a=this.defaultQueryOptions({queryKey:e}),c=this.#t.get(a.queryHash)?.state.data,u=Sk(t,c);if(u!==void 0)return this.#t.build(this,a).setData(u,{...n,manual:!0})}setQueriesData(e,t,n){return Ot.batch(()=>this.#t.findAll(e).map(({queryKey:a})=>[a,this.setQueryData(a,t,n)]))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#t.get(t.queryHash)?.state}removeQueries(e){const t=this.#t;Ot.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=this.#t;return Ot.batch(()=>(n.findAll(e).forEach(a=>{a.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},a=Ot.batch(()=>this.#t.findAll(e).map(o=>o.cancel(n)));return Promise.all(a).then(rn).catch(rn)}invalidateQueries(e,t={}){return Ot.batch(()=>(this.#t.findAll(e).forEach(n=>{n.invalidate()}),e?.refetchType==="none"?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},a=Ot.batch(()=>this.#t.findAll(e).filter(o=>!o.isDisabled()&&!o.isStatic()).map(o=>{let c=o.fetch(void 0,n);return n.throwOnError||(c=c.catch(rn)),o.state.fetchStatus==="paused"?Promise.resolve():c}));return Promise.all(a).then(rn)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=this.#t.build(this,t);return n.isStaleByTime(Ti(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(rn).catch(rn)}fetchInfiniteQuery(e){return e.behavior=hb(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(rn).catch(rn)}ensureInfiniteQueryData(e){return e.behavior=hb(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return xu.isOnline()?this.#e.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#t}getMutationCache(){return this.#e}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#i.set(ka(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#i.values()],n={};return t.forEach(a=>{sl(e,a.queryKey)&&Object.assign(n,a.defaultOptions)}),n}setMutationDefaults(e,t){this.#s.set(ka(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#s.values()],n={};return t.forEach(a=>{sl(e,a.mutationKey)&&Object.assign(n,a.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=ip(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===rp&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#t.clear(),this.#e.clear()}},_S=w.createContext(void 0),Ui=e=>{const t=w.useContext(_S);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},qk=({client:e,children:t})=>(w.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),r.jsx(_S.Provider,{value:e,children:t})),ES=w.createContext(!1),AS=()=>w.useContext(ES);ES.Provider;function Kk(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Hk=w.createContext(Kk()),TS=()=>w.useContext(Hk),RS=(e,t,n)=>{const a=n?.state.error&&typeof e.throwOnError=="function"?op(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||a)&&(t.isReset()||(e.retryOnMount=!1))},OS=e=>{w.useEffect(()=>{e.clearReset()},[e])},LS=({result:e,errorResetBoundary:t,throwOnError:n,query:a,suspense:o})=>e.isError&&!t.isReset()&&!e.isFetching&&a&&(o&&e.data===void 0||op(n,[e.error,a])),DS=e=>{if(e.suspense){const n=o=>o==="static"?o:Math.max(o??1e3,1e3),a=e.staleTime;e.staleTime=typeof a=="function"?(...o)=>n(a(...o)):n(a),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},Gk=(e,t)=>e.isLoading&&e.isFetching&&!t,Nm=(e,t)=>e?.suspense&&t.isPending,Cm=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Fk({queries:e,...t},n){const a=Ui(),o=AS(),c=TS(),u=w.useMemo(()=>e.map(S=>{const C=a.defaultQueryOptions(S);return C._optimisticResults=o?"isRestoring":"optimistic",C}),[e,a,o]);u.forEach(S=>{DS(S);const C=a.getQueryCache().get(S.queryHash);RS(S,c,C)}),OS(c);const[f]=w.useState(()=>new Uk(a,u,t)),[m,p,v]=f.getOptimisticResult(u,t.combine),y=!o&&t.subscribed!==!1;w.useSyncExternalStore(w.useCallback(S=>y?f.subscribe(Ot.batchCalls(S)):rn,[f,y]),()=>f.getCurrentResult(),()=>f.getCurrentResult()),w.useEffect(()=>{f.setQueries(u,t)},[u,t,f]);const x=m.some((S,C)=>Nm(u[C],S))?m.flatMap((S,C)=>{const k=u[C];if(k&&Nm(k,S)){const T=new cp(a,k);return Cm(k,T,c)}return[]}):[];if(x.length>0)throw Promise.all(x);const N=m.find((S,C)=>{const k=u[C];return k&&LS({result:S,errorResetBoundary:c,throwOnError:k.throwOnError,query:a.getQueryCache().get(k.queryHash),suspense:k.suspense})});if(N?.error)throw N.error;return p(v())}function Zk(e,t,n){const a=AS(),o=TS(),c=Ui(),u=c.defaultQueryOptions(e);c.getDefaultOptions().queries?._experimental_beforeQuery?.(u);const f=c.getQueryCache().get(u.queryHash);u._optimisticResults=a?"isRestoring":"optimistic",DS(u),RS(u,o,f),OS(o);const m=!c.getQueryCache().get(u.queryHash),[p]=w.useState(()=>new t(c,u)),v=p.getOptimisticResult(u),y=!a&&e.subscribed!==!1;if(w.useSyncExternalStore(w.useCallback(b=>{const x=y?p.subscribe(Ot.batchCalls(b)):rn;return p.updateResult(),x},[p,y]),()=>p.getCurrentResult(),()=>p.getCurrentResult()),w.useEffect(()=>{p.setOptions(u)},[u,p]),Nm(u,v))throw Cm(u,p,o);if(LS({result:v,errorResetBoundary:o,throwOnError:u.throwOnError,query:f,suspense:u.suspense}))throw v.error;return c.getDefaultOptions().queries?._experimental_afterQuery?.(u,v),u.experimental_prefetchInRender&&!Ca&&Gk(v,a)&&(m?Cm(u,p,o):f?.promise)?.catch(rn).finally(()=>{p.updateResult()}),u.notifyOnChangeProps?v:p.trackResult(v)}function xa(e,t){return Zk(e,cp)}function gl(e,t){const n=Ui(),[a]=w.useState(()=>new $k(n,e));w.useEffect(()=>{a.setOptions(e)},[a,e]);const o=w.useSyncExternalStore(w.useCallback(u=>a.subscribe(Ot.batchCalls(u)),[a]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),c=w.useCallback((u,f)=>{a.mutate(u,f).catch(rn)},[a]);if(o.error&&op(a.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:c,mutateAsync:o.mutate}}var Kc=typeof window<"u"?w.useLayoutEffect:w.useEffect;function $h(e){const t=w.useRef({value:e,prev:null}),n=t.current.value;return e!==n&&(t.current={value:e,prev:n}),t.current.prev}function Vk(e,t,n={},a={}){w.useEffect(()=>{if(!e.current||a.disabled||typeof IntersectionObserver!="function")return;const o=new IntersectionObserver(([c])=>{t(c)},n);return o.observe(e.current),()=>{o.disconnect()}},[t,n,a.disabled,e])}function Qk(e){const t=w.useRef(null);return w.useImperativeHandle(e,()=>t.current,[]),t}var Yk=!1;function al(e){return e[e.length-1]}function Jk(e){return typeof e=="function"}function Ei(e,t){return Jk(e)?e(t):e}var Xk=Object.prototype.hasOwnProperty,gb=Object.prototype.propertyIsEnumerable,Wk=()=>Object.create(null),ua=(e,t)=>pa(e,t,Wk);function pa(e,t,n=()=>({}),a=0){if(e===t)return e;if(a>500)return t;const o=t,c=bb(e)&&bb(o);if(!c&&!(Su(e)&&Su(o)))return o;const u=c?e:yb(e);if(!u)return o;const f=c?o:yb(o);if(!f)return o;const m=u.length,p=f.length,v=c?new Array(p):n();let y=0;for(let b=0;b<p;b++){const x=c?b:f[b],N=e[x],S=o[x];if(N===S){v[x]=N,(c?b<m:Xk.call(e,x))&&y++;continue}if(N===null||S===null||typeof N!="object"||typeof S!="object"){v[x]=S;continue}const C=pa(N,S,n,a+1);v[x]=C,C===N&&y++}return m===p&&y===m?e:v}function yb(e){const t=Object.getOwnPropertyNames(e);for(const o of t)if(!gb.call(e,o))return!1;const n=Object.getOwnPropertySymbols(e);if(n.length===0)return t;const a=t;for(const o of n){if(!gb.call(e,o))return!1;a.push(o)}return a}function Su(e){if(!vb(e))return!1;const t=e.constructor;if(typeof t>"u")return!0;const n=t.prototype;return!(!vb(n)||!n.hasOwnProperty("isPrototypeOf"))}function vb(e){return Object.prototype.toString.call(e)==="[object Object]"}function bb(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Sa(e,t,n){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let a=0,o=e.length;a<o;a++)if(!Sa(e[a],t[a],n))return!1;return!0}if(Su(e)&&Su(t)){const a=n?.ignoreUndefined??!0;if(n?.partial){for(const u in t)if((!a||t[u]!==void 0)&&!Sa(e[u],t[u],n))return!1;return!0}let o=0;if(!a)o=Object.keys(e).length;else for(const u in e)e[u]!==void 0&&o++;let c=0;for(const u in t)if((!a||t[u]!==void 0)&&(c++,c>o||!Sa(e[u],t[u],n)))return!1;return o===c}return!1}function Pr(e){let t,n;const a=new Promise((o,c)=>{t=o,n=c});return a.status="pending",a.resolve=o=>{a.status="resolved",a.value=o,t(o),e?.(o)},a.reject=o=>{a.status="rejected",n(o)},a}function rl(e){return!!(e&&typeof e=="object"&&typeof e.then=="function")}function ez(e){return e.replace(/[\x00-\x1f\x7f]/g,"")}function xb(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,n=>{try{return decodeURI(n)}catch{return n}})}return ez(t)}var tz=["http:","https:","mailto:","tel:"];function ju(e,t){if(!e)return!1;try{const n=new URL(e);return!t.has(n.protocol)}catch{return!1}}function Ho(e){if(!e)return{path:e,handledProtocolRelativeURL:!1};if(!/[%\\\x00-\x1f\x7f]/.test(e)&&!e.startsWith("//"))return{path:e,handledProtocolRelativeURL:!1};const t=/%25|%5C/gi;let n=0,a="",o;for(;(o=t.exec(e))!==null;)a+=xb(e.slice(n,o.index))+o[0],n=t.lastIndex;a=a+xb(n?e.slice(n):e);let c=!1;return a.startsWith("//")&&(c=!0,a="/"+a.replace(/^\/+/,"")),{path:a,handledProtocolRelativeURL:c}}function nz(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function wu(e){const t=new Map;let n,a;const o=c=>{c.next&&(c.prev?(c.prev.next=c.next,c.next.prev=c.prev,c.next=void 0,a&&(a.next=c,c.prev=a)):(c.next.prev=void 0,n=c.next,c.next=void 0,a&&(c.prev=a,a.next=c)),a=c)};return{get(c){const u=t.get(c);if(u)return o(u),u.value},set(c,u){if(t.size>=e&&n){const m=n;t.delete(m.key),m.next&&(n=m.next,m.next.prev=void 0),m===a&&(a=void 0)}const f=t.get(c);if(f)f.value=u,o(f);else{const m={key:c,value:u,prev:a};a&&(a.next=m),a=m,n||(n=m),t.set(c,m)}},clear(){t.clear(),n=void 0,a=void 0}}}var sz="Invariant failed";function Mi(e,t){if(!e)throw new Error(sz)}var ga=4,MS=5;function iz(e){const t=e.indexOf("{");if(t===-1)return null;const n=e.indexOf("}",t);return n===-1||t+1>=e.length?null:[t,n]}function dp(e,t,n=new Uint16Array(6)){const a=e.indexOf("/",t),o=a===-1?e.length:a,c=e.substring(t,o);if(!c||!c.includes("$"))return n[0]=0,n[1]=t,n[2]=t,n[3]=o,n[4]=o,n[5]=o,n;if(c==="$"){const f=e.length;return n[0]=2,n[1]=t,n[2]=t,n[3]=f,n[4]=f,n[5]=f,n}if(c.charCodeAt(0)===36)return n[0]=1,n[1]=t,n[2]=t+1,n[3]=o,n[4]=o,n[5]=o,n;const u=iz(c);if(u){const[f,m]=u,p=c.charCodeAt(f+1);if(p===45){if(f+2<c.length&&c.charCodeAt(f+2)===36){const v=f+3,y=m;if(v<y)return n[0]=3,n[1]=t+f,n[2]=t+v,n[3]=t+y,n[4]=t+m+1,n[5]=o,n}}else if(p===36){const v=f+1,y=f+2;return y===m?(n[0]=2,n[1]=t+f,n[2]=t+v,n[3]=t+y,n[4]=t+m+1,n[5]=e.length,n):(n[0]=1,n[1]=t+f,n[2]=t+y,n[3]=t+m,n[4]=t+m+1,n[5]=o,n)}}return n[0]=0,n[1]=t,n[2]=t,n[3]=o,n[4]=o,n[5]=o,n}function qu(e,t,n,a,o,c,u){u?.(n);let f=a;{const m=n.fullPath??n.from,p=m.length,v=n.options?.caseSensitive??e,y=!!(n.options?.params?.parse&&n.options?.skipRouteOnParseError?.params);for(;f<p;){const x=dp(m,f,t);let N;const S=f,C=x[5];switch(f=C+1,c++,x[0]){case 0:{const k=m.substring(x[2],x[3]);if(v){const T=o.static?.get(k);if(T)N=T;else{o.static??=new Map;const A=ya(n.fullPath??n.from);A.parent=o,A.depth=c,N=A,o.static.set(k,A)}}else{const T=k.toLowerCase(),A=o.staticInsensitive?.get(T);if(A)N=A;else{o.staticInsensitive??=new Map;const z=ya(n.fullPath??n.from);z.parent=o,z.depth=c,N=z,o.staticInsensitive.set(T,z)}}break}case 1:{const k=m.substring(S,x[1]),T=m.substring(x[4],C),A=v&&!!(k||T),z=k?A?k:k.toLowerCase():void 0,$=T?A?T:T.toLowerCase():void 0,P=!y&&o.dynamic?.find(E=>!E.skipOnParamError&&E.caseSensitive===A&&E.prefix===z&&E.suffix===$);if(P)N=P;else{const E=Uh(1,n.fullPath??n.from,A,z,$);N=E,E.depth=c,E.parent=o,o.dynamic??=[],o.dynamic.push(E)}break}case 3:{const k=m.substring(S,x[1]),T=m.substring(x[4],C),A=v&&!!(k||T),z=k?A?k:k.toLowerCase():void 0,$=T?A?T:T.toLowerCase():void 0,P=!y&&o.optional?.find(E=>!E.skipOnParamError&&E.caseSensitive===A&&E.prefix===z&&E.suffix===$);if(P)N=P;else{const E=Uh(3,n.fullPath??n.from,A,z,$);N=E,E.parent=o,E.depth=c,o.optional??=[],o.optional.push(E)}break}case 2:{const k=m.substring(S,x[1]),T=m.substring(x[4],C),A=v&&!!(k||T),z=k?A?k:k.toLowerCase():void 0,$=T?A?T:T.toLowerCase():void 0,P=Uh(2,n.fullPath??n.from,A,z,$);N=P,P.parent=o,P.depth=c,o.wildcard??=[],o.wildcard.push(P)}}o=N}if(y&&n.children&&!n.isRoot&&n.id&&n.id.charCodeAt(n.id.lastIndexOf("/")+1)===95){const x=ya(n.fullPath??n.from);x.kind=MS,x.parent=o,c++,x.depth=c,o.pathless??=[],o.pathless.push(x),o=x}const b=(n.path||!n.children)&&!n.isRoot;if(b&&m.endsWith("/")){const x=ya(n.fullPath??n.from);x.kind=ga,x.parent=o,c++,x.depth=c,o.index=x,o=x}o.parse=n.options?.params?.parse??null,o.skipOnParamError=y,o.parsingPriority=n.options?.skipRouteOnParseError?.priority??0,b&&!o.route&&(o.route=n,o.fullPath=n.fullPath??n.from)}if(n.children)for(const m of n.children)qu(e,t,m,f,o,c,u)}function Ph(e,t){if(e.skipOnParamError&&!t.skipOnParamError)return-1;if(!e.skipOnParamError&&t.skipOnParamError)return 1;if(e.skipOnParamError&&t.skipOnParamError&&(e.parsingPriority||t.parsingPriority))return t.parsingPriority-e.parsingPriority;if(e.prefix&&t.prefix&&e.prefix!==t.prefix){if(e.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(e.prefix))return 1}if(e.suffix&&t.suffix&&e.suffix!==t.suffix){if(e.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(e.suffix))return 1}return e.prefix&&!t.prefix?-1:!e.prefix&&t.prefix?1:e.suffix&&!t.suffix?-1:!e.suffix&&t.suffix?1:e.caseSensitive&&!t.caseSensitive?-1:!e.caseSensitive&&t.caseSensitive?1:0}function zi(e){if(e.pathless)for(const t of e.pathless)zi(t);if(e.static)for(const t of e.static.values())zi(t);if(e.staticInsensitive)for(const t of e.staticInsensitive.values())zi(t);if(e.dynamic?.length){e.dynamic.sort(Ph);for(const t of e.dynamic)zi(t)}if(e.optional?.length){e.optional.sort(Ph);for(const t of e.optional)zi(t)}if(e.wildcard?.length){e.wildcard.sort(Ph);for(const t of e.wildcard)zi(t)}}function ya(e){return{kind:0,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,parse:null,skipOnParamError:!1,parsingPriority:0}}function Uh(e,t,n,a,o){return{kind:e,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,skipOnParamError:!1,parsingPriority:0,caseSensitive:n,prefix:a,suffix:o}}function az(e,t){const n=ya("/"),a=new Uint16Array(6);for(const o of e)qu(!1,a,o,1,n,0);zi(n),t.masksTree=n,t.flatCache=wu(1e3)}function rz(e,t){e||="/";const n=t.flatCache.get(e);if(n)return n;const a=fp(e,t.masksTree);return t.flatCache.set(e,a),a}function oz(e,t,n,a,o){e||="/",a||="/";const c=t?`case\0${e}`:e;let u=o.singleCache.get(c);return u||(u=ya("/"),qu(t,new Uint16Array(6),{from:e},1,u,0),o.singleCache.set(c,u)),fp(a,u,n)}function lz(e,t,n=!1){const a=n?e:`nofuzz\0${e}`,o=t.matchCache.get(a);if(o!==void 0)return o;e||="/";let c;try{c=fp(e,t.segmentTree,n)}catch(u){if(u instanceof URIError)c=null;else throw u}return c&&(c.branch=dz(c.route)),t.matchCache.set(a,c),c}function cz(e){return e==="/"?e:e.replace(/\/{1,}$/,"")}function uz(e,t=!1,n){const a=ya(e.fullPath),o=new Uint16Array(6),c={},u={};let f=0;return qu(t,o,e,1,a,0,m=>{if(n?.(m,f),Mi(!(m.id in c),`Duplicate routes found with id: ${String(m.id)}`),c[m.id]=m,f!==0&&m.path){const p=cz(m.fullPath);(!u[p]||m.fullPath.endsWith("/"))&&(u[p]=m)}f++}),zi(a),{processedTree:{segmentTree:a,singleCache:wu(1e3),matchCache:wu(1e3),flatCache:null,masksTree:null},routesById:c,routesByPath:u}}function fp(e,t,n=!1){const a=e.split("/"),o=hz(e,a,t,n);if(!o)return null;const[c]=$S(e,a,o);return{route:o.node.route,rawParams:c,parsedParams:o.parsedParams}}function $S(e,t,n){const a=fz(n.node);let o=null;const c=Object.create(null);let u=n.extract?.part??0,f=n.extract?.node??0,m=n.extract?.path??0,p=n.extract?.segment??0;for(;f<a.length;u++,f++,m++,p++){const v=a[f];if(v.kind===ga)break;if(v.kind===MS){p--,u--,m--;continue}const y=t[u],b=m;if(y&&(m+=y.length),v.kind===1){o??=n.node.fullPath.split("/");const x=o[p],N=v.prefix?.length??0;if(x.charCodeAt(N)===123){const S=v.suffix?.length??0,C=x.substring(N+2,x.length-S-1),k=y.substring(N,y.length-S);c[C]=decodeURIComponent(k)}else{const S=x.substring(1);c[S]=decodeURIComponent(y)}}else if(v.kind===3){if(n.skipped&1<<f){u--,m=b-1;continue}o??=n.node.fullPath.split("/");const x=o[p],N=v.prefix?.length??0,S=v.suffix?.length??0,C=x.substring(N+3,x.length-S-1),k=v.suffix||v.prefix?y.substring(N,y.length-S):y;k&&(c[C]=decodeURIComponent(k))}else if(v.kind===2){const x=v,N=e.substring(b+(x.prefix?.length??0),e.length-(x.suffix?.length??0)),S=decodeURIComponent(N);c["*"]=S,c._splat=S;break}}return n.rawParams&&Object.assign(c,n.rawParams),[c,{part:u,node:f,path:m,segment:p}]}function dz(e){const t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function fz(e){const t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function hz(e,t,n,a){if(e==="/"&&n.index)return{node:n.index,skipped:0};const o=!al(t),c=o&&e!=="/",u=t.length-(o?1:0),f=[{node:n,index:1,skipped:0,depth:1,statics:1,dynamics:0,optionals:0}];let m=null,p=null,v=null;for(;f.length;){const y=f.pop(),{node:b,index:x,skipped:N,depth:S,statics:C,dynamics:k,optionals:T}=y;let{extract:A,rawParams:z,parsedParams:$}=y;if(b.skipOnParamError){if(!Ih(e,t,y))continue;z=y.rawParams,A=y.extract,$=y.parsedParams}a&&b.route&&b.kind!==ga&&Go(p,y)&&(p=y);const P=x===u;if(P&&(b.route&&!c&&Go(v,y)&&(v=y),!b.optional&&!b.wildcard&&!b.index&&!b.pathless))continue;const E=P?void 0:t[x];let O;if(P&&b.index){const K={node:b.index,index:x,skipped:N,depth:S+1,statics:C,dynamics:k,optionals:T,extract:A,rawParams:z,parsedParams:$};let ee=!0;if(b.index.skipOnParamError&&(Ih(e,t,K)||(ee=!1)),ee){if(C===u&&!k&&!T&&!N)return K;Go(v,K)&&(v=K)}}if(b.wildcard&&Go(m,y))for(const K of b.wildcard){const{prefix:ee,suffix:X}=K;if(ee&&(P||!(K.caseSensitive?E:O??=E.toLowerCase()).startsWith(ee)))continue;if(X){if(P)continue;const de=t.slice(x).join("/").slice(-X.length);if((K.caseSensitive?de:de.toLowerCase())!==X)continue}const se={node:K,index:u,skipped:N,depth:S,statics:C,dynamics:k,optionals:T,extract:A,rawParams:z,parsedParams:$};if(!(K.skipOnParamError&&!Ih(e,t,se))){m=se;break}}if(b.optional){const K=N|1<<S,ee=S+1;for(let X=b.optional.length-1;X>=0;X--){const se=b.optional[X];f.push({node:se,index:x,skipped:K,depth:ee,statics:C,dynamics:k,optionals:T,extract:A,rawParams:z,parsedParams:$})}if(!P)for(let X=b.optional.length-1;X>=0;X--){const se=b.optional[X],{prefix:de,suffix:Ee}=se;if(de||Ee){const be=se.caseSensitive?E:O??=E.toLowerCase();if(de&&!be.startsWith(de)||Ee&&!be.endsWith(Ee))continue}f.push({node:se,index:x+1,skipped:N,depth:ee,statics:C,dynamics:k,optionals:T+1,extract:A,rawParams:z,parsedParams:$})}}if(!P&&b.dynamic&&E)for(let K=b.dynamic.length-1;K>=0;K--){const ee=b.dynamic[K],{prefix:X,suffix:se}=ee;if(X||se){const de=ee.caseSensitive?E:O??=E.toLowerCase();if(X&&!de.startsWith(X)||se&&!de.endsWith(se))continue}f.push({node:ee,index:x+1,skipped:N,depth:S+1,statics:C,dynamics:k+1,optionals:T,extract:A,rawParams:z,parsedParams:$})}if(!P&&b.staticInsensitive){const K=b.staticInsensitive.get(O??=E.toLowerCase());K&&f.push({node:K,index:x+1,skipped:N,depth:S+1,statics:C+1,dynamics:k,optionals:T,extract:A,rawParams:z,parsedParams:$})}if(!P&&b.static){const K=b.static.get(E);K&&f.push({node:K,index:x+1,skipped:N,depth:S+1,statics:C+1,dynamics:k,optionals:T,extract:A,rawParams:z,parsedParams:$})}if(b.pathless){const K=S+1;for(let ee=b.pathless.length-1;ee>=0;ee--){const X=b.pathless[ee];f.push({node:X,index:x,skipped:N,depth:K,statics:C,dynamics:k,optionals:T,extract:A,rawParams:z,parsedParams:$})}}}if(v&&m)return Go(m,v)?v:m;if(v)return v;if(m)return m;if(a&&p){let y=p.index;for(let x=0;x<p.index;x++)y+=t[x].length;const b=y===e.length?"/":e.slice(y);return p.rawParams??=Object.create(null),p.rawParams["**"]=decodeURIComponent(b),p}return null}function Ih(e,t,n){try{const[a,o]=$S(e,t,n);n.rawParams=a,n.extract=o;const c=n.node.parse(a);return n.parsedParams=Object.assign(Object.create(null),n.parsedParams,c),!0}catch{return null}}function Go(e,t){return e?t.statics>e.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&((t.node.kind===ga)>(e.node.kind===ga)||t.node.kind===ga==(e.node.kind===ga)&&t.depth>e.depth))):!0}function uu(e){return hp(e.filter(t=>t!==void 0).join("/"))}function hp(e){return e.replace(/\/{2,}/g,"/")}function PS(e){return e==="/"?e:e.replace(/^\/{1,}/,"")}function Ri(e){const t=e.length;return t>1&&e[t-1]==="/"?e.replace(/\/{1,}$/,""):e}function US(e){return Ri(PS(e))}function Nu(e,t){return e?.endsWith("/")&&e!=="/"&&e!==`${t}/`?e.slice(0,-1):e}function mz(e,t,n){return Nu(e,n)===Nu(t,n)}function pz({base:e,to:t,trailingSlash:n="never",cache:a}){const o=t.startsWith("/"),c=!o&&t===".";let u;if(a){u=o?t:c?e:e+"\0"+t;const y=a.get(u);if(y)return y}let f;if(c)f=e.split("/");else if(o)f=t.split("/");else{for(f=e.split("/");f.length>1&&al(f)==="";)f.pop();const y=t.split("/");for(let b=0,x=y.length;b<x;b++){const N=y[b];N===""?b?b===x-1&&f.push(N):f=[N]:N===".."?f.pop():N==="."||f.push(N)}}f.length>1&&(al(f)===""?n==="never"&&f.pop():n==="always"&&f.push(""));let m,p="";for(let y=0;y<f.length;y++){y>0&&(p+="/");const b=f[y];if(!b)continue;m=dp(b,0,m);const x=m[0];if(x===0){p+=b;continue}const N=m[5],S=b.substring(0,m[1]),C=b.substring(m[4],N),k=b.substring(m[2],m[3]);x===1?p+=S||C?`${S}{$${k}}${C}`:`$${k}`:x===2?p+=S||C?`${S}{$}${C}`:"$":p+=`${S}{-$${k}}${C}`}p=hp(p);const v=p||"/";return u&&a&&a.set(u,v),v}function gz(e){const t=new Map(e.map(o=>[encodeURIComponent(o),o])),n=Array.from(t.keys()).map(o=>o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),a=new RegExp(n,"g");return o=>o.replace(a,c=>t.get(c)??c)}function Bh(e,t,n){const a=t[e];return typeof a!="string"?a:e==="_splat"?/^[a-zA-Z0-9\-._~!/]*$/.test(a)?a:a.split("/").map(o=>jb(o,n)).join("/"):jb(a,n)}function Sb({path:e,params:t,decoder:n,...a}){let o=!1;const c=Object.create(null);if(!e||e==="/")return{interpolatedPath:"/",usedParams:c,isMissingParams:o};if(!e.includes("$"))return{interpolatedPath:e,usedParams:c,isMissingParams:o};const u=e.length;let f=0,m,p="";for(;f<u;){const v=f;m=dp(e,v,m);const y=m[5];if(f=y+1,v===y)continue;const b=m[0];if(b===0){p+="/"+e.substring(v,y);continue}if(b===2){const x=t._splat;c._splat=x,c["*"]=x;const N=e.substring(v,m[1]),S=e.substring(m[4],y);if(!x){o=!0,(N||S)&&(p+="/"+N+S);continue}const C=Bh("_splat",t,n);p+="/"+N+C+S;continue}if(b===1){const x=e.substring(m[2],m[3]);!o&&!(x in t)&&(o=!0),c[x]=t[x];const N=e.substring(v,m[1]),S=e.substring(m[4],y),C=Bh(x,t,n)??"undefined";p+="/"+N+C+S;continue}if(b===3){const x=e.substring(m[2],m[3]),N=t[x];if(N==null)continue;c[x]=N;const S=e.substring(v,m[1]),C=e.substring(m[4],y),k=Bh(x,t,n)??"";p+="/"+S+k+C;continue}}return e.endsWith("/")&&(p+="/"),{usedParams:c,interpolatedPath:p||"/",isMissingParams:o}}function jb(e,t){const n=encodeURIComponent(e);return t?.(n)??n}function mn(e){return!!e?.isNotFound}function yz(){try{if(typeof window<"u"&&typeof window.sessionStorage=="object")return window.sessionStorage}catch{}}var km="tsr-scroll-restoration-v1_3",vz=(e,t)=>{let n;return(...a)=>{n||(n=setTimeout(()=>{e(...a),n=null},t))}};function bz(){const e=yz();if(!e)return null;const t=e.getItem(km);let n=t?JSON.parse(t):{};return{state:n,set:a=>{n=Ei(a,n)||n;try{e.setItem(km,JSON.stringify(n))}catch{console.warn("[ts-router] Could not persist scroll restoration state to sessionStorage.")}}}}var Hc=bz(),xz=e=>e.state.__TSR_key||e.href;function Sz(e){const t=[];let n;for(;n=e.parentNode;)t.push(`${e.tagName}:nth-child(${Array.prototype.indexOf.call(n.children,e)+1})`),e=n;return`${t.reverse().join(" > ")}`.toLowerCase()}var Cu=!1;function jz({storageKey:e,key:t,behavior:n,shouldScrollRestoration:a,scrollToTopSelectors:o,location:c}){let u;try{u=JSON.parse(sessionStorage.getItem(e)||"{}")}catch(p){console.error(p);return}const f=t||window.history.state?.__TSR_key,m=u[f];Cu=!0;e:{if(a&&m&&Object.keys(m).length>0){for(const y in m){const b=m[y];if(y==="window")window.scrollTo({top:b.scrollY,left:b.scrollX,behavior:n});else if(y){const x=document.querySelector(y);x&&(x.scrollLeft=b.scrollX,x.scrollTop=b.scrollY)}}break e}const p=(c??window.location).hash.split("#",2)[1];if(p){const y=window.history.state?.__hashScrollIntoViewOptions??!0;if(y){const b=document.getElementById(p);b&&b.scrollIntoView(y)}break e}const v={top:0,left:0,behavior:n};if(window.scrollTo(v),o)for(const y of o){if(y==="window")continue;const b=typeof y=="function"?y():document.querySelector(y);b&&b.scrollTo(v)}}Cu=!1}function wz(e,t){if(!Hc||((e.options.scrollRestoration??!1)&&(e.isScrollRestoring=!0),e.isScrollRestorationSetup||!Hc))return;e.isScrollRestorationSetup=!0,Cu=!1;const n=e.options.getScrollRestorationKey||xz;window.history.scrollRestoration="manual";const a=o=>{if(Cu||!e.isScrollRestoring)return;let c="";if(o.target===document||o.target===window)c="window";else{const f=o.target.getAttribute("data-scroll-restoration-id");f?c=`[data-scroll-restoration-id="${f}"]`:c=Sz(o.target)}const u=n(e.state.location);Hc.set(f=>{const m=f[u]||={},p=m[c]||={};if(c==="window")p.scrollX=window.scrollX||0,p.scrollY=window.scrollY||0;else if(c){const v=document.querySelector(c);v&&(p.scrollX=v.scrollLeft||0,p.scrollY=v.scrollTop||0)}return f})};typeof document<"u"&&document.addEventListener("scroll",vz(a,100),!0),e.subscribe("onRendered",o=>{const c=n(o.toLocation);if(!e.resetNextScroll){e.resetNextScroll=!0;return}typeof e.options.scrollRestoration=="function"&&!e.options.scrollRestoration({location:e.latestLocation})||(jz({storageKey:km,key:c,behavior:e.options.scrollRestorationBehavior,shouldScrollRestoration:e.isScrollRestoring,scrollToTopSelectors:e.options.scrollToTopSelectors,location:e.history.location}),e.isScrollRestoring&&Hc.set(u=>(u[c]||={},u)))})}function Nz(e){if(typeof document<"u"&&document.querySelector){const t=e.state.location.state.__hashScrollIntoViewOptions??!0;if(t&&e.state.location.hash!==""){const n=document.getElementById(e.state.location.hash);n&&n.scrollIntoView(t)}}}function Cz(e,t=String){const n=new URLSearchParams;for(const a in e){const o=e[a];o!==void 0&&n.set(a,t(o))}return n.toString()}function qh(e){return e?e==="false"?!1:e==="true"?!0:+e*0===0&&+e+""===e?+e:e:""}function kz(e){const t=new URLSearchParams(e),n=Object.create(null);for(const[a,o]of t.entries()){const c=n[a];c==null?n[a]=qh(o):Array.isArray(c)?c.push(qh(o)):n[a]=[c,qh(o)]}return n}var zz=Ez(JSON.parse),_z=Az(JSON.stringify,JSON.parse);function Ez(e){return t=>{t[0]==="?"&&(t=t.substring(1));const n=kz(t);for(const a in n){const o=n[a];if(typeof o=="string")try{n[a]=e(o)}catch{}}return n}}function Az(e,t){const n=typeof t=="function";function a(o){if(typeof o=="object"&&o!==null)try{return e(o)}catch{}else if(n&&typeof o=="string")try{return t(o),e(o)}catch{}return o}return o=>{const c=Cz(o,a);return c?`?${c}`:""}}var ja="__root__";function mp(e){if(e.statusCode=e.statusCode||e.code||307,!e._builtLocation&&!e.reloadDocument&&typeof e.href=="string")try{new URL(e.href),e.reloadDocument=!0}catch{}const t=new Headers(e.headers);e.href&&t.get("Location")===null&&t.set("Location",e.href);const n=new Response(null,{status:e.statusCode,headers:t});if(n.options=e,e.throw)throw n;return n}function Nn(e){return e instanceof Response&&!!e.options}function Tz(e){return{input:({url:t})=>{for(const n of e)t=zm(n,t);return t},output:({url:t})=>{for(let n=e.length-1;n>=0;n--)t=IS(e[n],t);return t}}}function Rz(e){const t=US(e.basepath),n=`/${t}`,a=`${n}/`,o=e.caseSensitive?n:n.toLowerCase(),c=e.caseSensitive?a:a.toLowerCase();return{input:({url:u})=>{const f=e.caseSensitive?u.pathname:u.pathname.toLowerCase();return f===o?u.pathname="/":f.startsWith(c)&&(u.pathname=u.pathname.slice(n.length)),u},output:({url:u})=>(u.pathname=uu(["/",t,u.pathname]),u)}}function zm(e,t){const n=e?.input?.({url:t});if(n){if(typeof n=="string")return new URL(n);if(n instanceof URL)return n}return t}function IS(e,t){const n=e?.output?.({url:t});if(n){if(typeof n=="string")return new URL(n);if(n instanceof URL)return n}return t}var jt=(e=>(e[e.None=0]="None",e[e.Mutable=1]="Mutable",e[e.Watching=2]="Watching",e[e.RecursedCheck=4]="RecursedCheck",e[e.Recursed=8]="Recursed",e[e.Dirty=16]="Dirty",e[e.Pending=32]="Pending",e))(jt||{});function BS({update:e,notify:t,unwatched:n}){return{link:a,unlink:o,propagate:c,checkDirty:u,shallowPropagate:f};function a(p,v,y){const b=v.depsTail;if(b!==void 0&&b.dep===p)return;const x=b!==void 0?b.nextDep:v.deps;if(x!==void 0&&x.dep===p){x.version=y,v.depsTail=x;return}const N=p.subsTail;if(N!==void 0&&N.version===y&&N.sub===v)return;const S=v.depsTail=p.subsTail={version:y,dep:p,sub:v,prevDep:b,nextDep:x,prevSub:N,nextSub:void 0};x!==void 0&&(x.prevDep=S),b!==void 0?b.nextDep=S:v.deps=S,N!==void 0?N.nextSub=S:p.subs=S}function o(p,v=p.sub){const y=p.dep,b=p.prevDep,x=p.nextDep,N=p.nextSub,S=p.prevSub;return x!==void 0?x.prevDep=b:v.depsTail=b,b!==void 0?b.nextDep=x:v.deps=x,N!==void 0?N.prevSub=S:y.subsTail=S,S!==void 0?S.nextSub=N:(y.subs=N)===void 0&&n(y),x}function c(p){let v=p.nextSub,y;e:do{const b=p.sub;let x=b.flags;if(x&60?x&12?x&4?!(x&48)&&m(p,b)?(b.flags=x|40,x&=1):x=0:b.flags=x&-9|32:x=0:b.flags=x|32,x&2&&t(b),x&1){const N=b.subs;if(N!==void 0){const S=(p=N).nextSub;S!==void 0&&(y={value:v,prev:y},v=S);continue}}if((p=v)!==void 0){v=p.nextSub;continue}for(;y!==void 0;)if(p=y.value,y=y.prev,p!==void 0){v=p.nextSub;continue e}break}while(!0)}function u(p,v){let y,b=0,x=!1;e:do{const N=p.dep,S=N.flags;if(v.flags&16)x=!0;else if((S&17)===17){if(e(N)){const C=N.subs;C.nextSub!==void 0&&f(C),x=!0}}else if((S&33)===33){(p.nextSub!==void 0||p.prevSub!==void 0)&&(y={value:p,prev:y}),p=N.deps,v=N,++b;continue}if(!x){const C=p.nextDep;if(C!==void 0){p=C;continue}}for(;b--;){const C=v.subs,k=C.nextSub!==void 0;if(k?(p=y.value,y=y.prev):p=C,x){if(e(v)){k&&f(C),v=p.sub;continue}x=!1}else v.flags&=-33;v=p.sub;const T=p.nextDep;if(T!==void 0){p=T;continue e}}return x}while(!0)}function f(p){do{const v=p.sub,y=v.flags;(y&48)===32&&(v.flags=y|16,(y&6)===2&&t(v))}while((p=p.nextSub)!==void 0)}function m(p,v){let y=v.depsTail;for(;y!==void 0;){if(y===p)return!0;y=y.prevDep}return!1}}let pp=0,da=0,Wo=0;const Fs=[],{link:mP,unlink:qS,propagate:pP,checkDirty:Oz,shallowPropagate:gP}=BS({update(e){return e.depsTail!==void 0?$z(e):Pz(e)},notify(e){let t=Wo,n=t;do if(Fs[t++]=e,e.flags&=-3,e=e.subs?.sub,e===void 0||!(e.flags&2))break;while(!0);for(Wo=t;n<--t;){const a=Fs[n];Fs[n++]=Fs[t],Fs[t]=a}},unwatched(e){e.flags&1?e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=17,Ku(e)):Bz.call(e)}});function Lz(){return pp}function Dz(){++pp}function Mz(){--pp||Iz()}function $z(e){e.depsTail=void 0,e.flags=5;try{const t=e.value;return t!==(e.value=e.getter(t))}finally{e.flags&=-5,Ku(e)}}function Pz(e){return e.flags=1,e.currentValue!==(e.currentValue=e.pendingValue)}function Uz(e){const t=e.flags;if(t&16||t&32&&Oz(e.deps,e)){e.depsTail=void 0,e.flags=6;try{e.fn()}finally{e.flags&=-5,Ku(e)}}else e.flags=2}function Iz(){try{for(;da<Wo;){const e=Fs[da];Fs[da++]=void 0,Uz(e)}}finally{for(;da<Wo;){const e=Fs[da];Fs[da++]=void 0,e.flags|=10}da=0,Wo=0}}function Bz(){this.depsTail=void 0,this.flags=0,Ku(this);const e=this.subs;e!==void 0&&qS(e)}function Ku(e){const t=e.depsTail;let n=t!==void 0?t.nextDep:e.deps;for(;n!==void 0;)n=qS(n,e)}function gp(e,t,n){const a=typeof e=="object",o=a?e:void 0;return{next:(a?e.next:e)?.bind(o),error:(a?e.error:t)?.bind(o),complete:(a?e.complete:n)?.bind(o)}}const _m=[];let du=0;const{link:wb,unlink:qz,propagate:Kz,checkDirty:KS,shallowPropagate:Nb}=BS({update(e){return e._update()},notify(e){_m[Em++]=e,e.flags&=~jt.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=jt.Mutable|jt.Dirty,ku(e))}});let Gc=0,Em=0,js;function ku(e){const t=e.depsTail;let n=t!==void 0?t.nextDep:e.deps;for(;n!==void 0;)n=qz(n,e)}function HS(){if(!(Lz()>0)){for(;Gc<Em;){const e=_m[Gc];_m[Gc++]=void 0,e.notify()}Gc=0,Em=0}}function GS(e,t){const n=typeof e=="function",a=e,o={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:n?jt.None:jt.Mutable,get(){return js!==void 0&&wb(o,js,du),o._snapshot},subscribe(c){const u=gp(c),f={current:!1},m=Hz(()=>{o.get(),f.current?u.next?.(o._snapshot):f.current=!0});return{unsubscribe:()=>{m.stop()}}},_update(c){const u=js,f=Object.is;if(n)js=o,++du,o.depsTail=void 0;else if(c===void 0)return!1;n&&(o.flags=jt.Mutable|jt.RecursedCheck);try{const m=o._snapshot,p=typeof c=="function"?c(m):c===void 0&&n?a(m):c;return m===void 0||!f(m,p)?(o._snapshot=p,!0):!1}finally{js=u,n&&(o.flags&=~jt.RecursedCheck),ku(o)}}};return n?(o.flags=jt.Mutable|jt.Dirty,o.get=function(){const c=o.flags;if(c&jt.Dirty||c&jt.Pending&&KS(o.deps,o)){if(o._update()){const u=o.subs;u!==void 0&&Nb(u)}}else c&jt.Pending&&(o.flags=c&~jt.Pending);return js!==void 0&&wb(o,js,du),o._snapshot}):o.set=function(c){if(o._update(c)){const u=o.subs;u!==void 0&&(Kz(u),Nb(u),HS())}},o}function Hz(e){const t=()=>{const a=js;js=n,++du,n.depsTail=void 0,n.flags=jt.Watching|jt.RecursedCheck;try{return e()}finally{js=a,n.flags&=~jt.RecursedCheck,ku(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:jt.Watching|jt.RecursedCheck,notify(){const a=this.flags;a&jt.Dirty||a&jt.Pending&&KS(this.deps,this)?t():this.flags=jt.Watching},stop(){this.flags=jt.None,this.depsTail=void 0,ku(this)}};return t(),n}class Gz{constructor(t){this.atom=GS(t)}setState(t){this.atom.set(t)}get state(){return this.atom.get()}get(){return this.state}subscribe(t){return this.atom.subscribe(gp(t))}}class Fz{constructor(t){this.atom=GS(t)}get state(){return this.atom.get()}get(){return this.state}subscribe(t){return this.atom.subscribe(gp(t))}}function Zz(e){return typeof e=="function"?new Fz(e):new Gz(e)}function Vz(e){try{Dz(),e()}finally{Mz(),HS()}}function el(e){let t;return Vz(()=>{t=e()}),t}var Am=e=>{if(!e.rendered)return e.rendered=!0,e.onReady?.()},Hu=(e,t)=>!!(e.preload&&!e.router.state.matches.some(n=>n.id===t)),wa=(e,t,n=!0)=>{const a={...e.router.options.context??{}},o=n?t:t-1;for(let c=0;c<=o;c++){const u=e.matches[c];if(!u)continue;const f=e.router.getMatch(u.id);f&&Object.assign(a,f.__routeContext,f.__beforeLoadContext)}return a},Cb=(e,t)=>{if(!e.matches.length)return;const n=t.routeId,a=e.matches.findIndex(u=>u.routeId===e.router.routeTree.id),o=a>=0?a:0;let c=n?e.matches.findIndex(u=>u.routeId===n):e.firstBadMatchIndex??e.matches.length-1;c<0&&(c=o);for(let u=c;u>=0;u--){const f=e.matches[u];if(e.router.looseRoutesById[f.routeId].options.notFoundComponent)return u}return n?c:o},Ai=(e,t,n)=>{if(!(!Nn(n)&&!mn(n)))throw Nn(n)&&n.redirectHandled&&!n.options.reloadDocument||(t&&(t._nonReactive.beforeLoadPromise?.resolve(),t._nonReactive.loaderPromise?.resolve(),t._nonReactive.beforeLoadPromise=void 0,t._nonReactive.loaderPromise=void 0,t._nonReactive.error=n,e.updateMatch(t.id,a=>({...a,status:Nn(n)?"redirected":a.status==="pending"?"success":a.status,context:wa(e,t.index),isFetching:!1,error:n})),mn(n)&&!n.routeId&&(n.routeId=t.routeId),t._nonReactive.loadPromise?.resolve()),Nn(n)&&(e.rendered=!0,n.options._fromLocation=e.location,n.redirectHandled=!0,n=e.router.resolveRedirect(n))),n},FS=(e,t)=>{const n=e.router.getMatch(t);return!!(!n||n._nonReactive.dehydrated)},kb=(e,t,n)=>{const a=wa(e,n);e.updateMatch(t,o=>({...o,context:a}))},Fo=(e,t,n,a)=>{const{id:o,routeId:c}=e.matches[t],u=e.router.looseRoutesById[c];if(n instanceof Promise)throw n;n.routerCode=a,e.firstBadMatchIndex??=t,Ai(e,e.router.getMatch(o),n);try{u.options.onError?.(n)}catch(f){n=f,Ai(e,e.router.getMatch(o),n)}e.updateMatch(o,f=>(f._nonReactive.beforeLoadPromise?.resolve(),f._nonReactive.beforeLoadPromise=void 0,f._nonReactive.loadPromise?.resolve(),{...f,error:n,status:"error",isFetching:!1,updatedAt:Date.now(),abortController:new AbortController})),!e.preload&&!Nn(n)&&!mn(n)&&(e.serialError??=n)},ZS=(e,t,n,a)=>{if(a._nonReactive.pendingTimeout!==void 0)return;const o=n.options.pendingMs??e.router.options.defaultPendingMs;if(e.onReady&&!Hu(e,t)&&(n.options.loader||n.options.beforeLoad||QS(n))&&typeof o=="number"&&o!==1/0&&(n.options.pendingComponent??e.router.options?.defaultPendingComponent)){const c=setTimeout(()=>{Am(e)},o);a._nonReactive.pendingTimeout=c}},Qz=(e,t,n)=>{const a=e.router.getMatch(t);if(!a._nonReactive.beforeLoadPromise&&!a._nonReactive.loaderPromise)return;ZS(e,t,n,a);const o=()=>{const c=e.router.getMatch(t);c.preload&&(c.status==="redirected"||c.status==="notFound")&&Ai(e,c,c.error)};return a._nonReactive.beforeLoadPromise?a._nonReactive.beforeLoadPromise.then(o):o()},Yz=(e,t,n,a)=>{const o=e.router.getMatch(t);let c=o._nonReactive.loadPromise;o._nonReactive.loadPromise=Pr(()=>{c?.resolve(),c=void 0});const{paramsError:u,searchError:f}=o;u&&Fo(e,n,u,"PARSE_PARAMS"),f&&Fo(e,n,f,"VALIDATE_SEARCH"),ZS(e,t,a,o);const m=new AbortController;let p=!1;const v=()=>{p||(p=!0,e.updateMatch(t,z=>({...z,isFetching:"beforeLoad",fetchCount:z.fetchCount+1,abortController:m})))},y=()=>{o._nonReactive.beforeLoadPromise?.resolve(),o._nonReactive.beforeLoadPromise=void 0,e.updateMatch(t,z=>({...z,isFetching:!1}))};if(!a.options.beforeLoad){el(()=>{v(),y()});return}o._nonReactive.beforeLoadPromise=Pr();const b={...wa(e,n,!1),...o.__routeContext},{search:x,params:N,cause:S}=o,C=Hu(e,t),k={search:x,abortController:m,params:N,preload:C,context:b,location:e.location,navigate:z=>e.router.navigate({...z,_fromLocation:e.location}),buildLocation:e.router.buildLocation,cause:C?"preload":S,matches:e.matches,routeId:a.id,...e.router.options.additionalContext},T=z=>{if(z===void 0){el(()=>{v(),y()});return}(Nn(z)||mn(z))&&(v(),Fo(e,n,z,"BEFORE_LOAD")),el(()=>{v(),e.updateMatch(t,$=>({...$,__beforeLoadContext:z})),y()})};let A;try{if(A=a.options.beforeLoad(k),rl(A))return v(),A.catch(z=>{Fo(e,n,z,"BEFORE_LOAD")}).then(T)}catch(z){v(),Fo(e,n,z,"BEFORE_LOAD")}T(A)},Jz=(e,t)=>{const{id:n,routeId:a}=e.matches[t],o=e.router.looseRoutesById[a],c=()=>f(),u=()=>Yz(e,n,t,o),f=()=>{if(FS(e,n))return;const m=Qz(e,n,o);return rl(m)?m.then(u):u()};return c()},Xz=(e,t,n)=>{const a=e.router.getMatch(t);if(!a||!n.options.head&&!n.options.scripts&&!n.options.headers)return;const o={ssr:e.router.options.ssr,matches:e.matches,match:a,params:a.params,loaderData:a.loaderData};return Promise.all([n.options.head?.(o),n.options.scripts?.(o),n.options.headers?.(o)]).then(([c,u,f])=>({meta:c?.meta,links:c?.links,headScripts:c?.scripts,headers:f,scripts:u,styles:c?.styles}))},VS=(e,t,n,a,o)=>{const c=t[a-1],{params:u,loaderDeps:f,abortController:m,cause:p}=e.router.getMatch(n),v=wa(e,a),y=Hu(e,n);return{params:u,deps:f,preload:!!y,parentMatchPromise:c,abortController:m,context:v,location:e.location,navigate:b=>e.router.navigate({...b,_fromLocation:e.location}),cause:y?"preload":p,route:o,...e.router.options.additionalContext}},zb=async(e,t,n,a,o)=>{try{const c=e.router.getMatch(n);try{(!(Yk??e.router.isServer)||c.ssr===!0)&&ol(o);const u=o.options.loader,f=typeof u=="function"?u:u?.handler,m=f?.(VS(e,t,n,a,o)),p=!!f&&rl(m);if((p||o._lazyPromise||o._componentsPromise||o.options.head||o.options.scripts||o.options.headers||c._nonReactive.minPendingPromise)&&e.updateMatch(n,y=>({...y,isFetching:"loader"})),f){const y=p?await m:m;Ai(e,e.router.getMatch(n),y),y!==void 0&&e.updateMatch(n,b=>({...b,loaderData:y}))}o._lazyPromise&&await o._lazyPromise;const v=c._nonReactive.minPendingPromise;v&&await v,o._componentsPromise&&await o._componentsPromise,e.updateMatch(n,y=>({...y,error:void 0,context:wa(e,a),status:"success",isFetching:!1,updatedAt:Date.now()}))}catch(u){let f=u;if(f?.name==="AbortError"){if(c.abortController.signal.aborted){c._nonReactive.loaderPromise?.resolve(),c._nonReactive.loaderPromise=void 0;return}e.updateMatch(n,p=>({...p,status:p.status==="pending"?"success":p.status,isFetching:!1,context:wa(e,a)}));return}const m=c._nonReactive.minPendingPromise;m&&await m,mn(u)&&await o.options.notFoundComponent?.preload?.(),Ai(e,e.router.getMatch(n),u);try{o.options.onError?.(u)}catch(p){f=p,Ai(e,e.router.getMatch(n),p)}!Nn(f)&&!mn(f)&&await ol(o,["errorComponent"]),e.updateMatch(n,p=>({...p,error:f,context:wa(e,a),status:"error",isFetching:!1}))}}catch(c){const u=e.router.getMatch(n);u&&(u._nonReactive.loaderPromise=void 0),Ai(e,u,c)}},Wz=async(e,t,n)=>{async function a(x,N,S,C,k){const T=Date.now()-N.updatedAt,A=x?k.options.preloadStaleTime??e.router.options.defaultPreloadStaleTime??3e4:k.options.staleTime??e.router.options.defaultStaleTime??0,z=k.options.shouldReload,$=typeof z=="function"?z(VS(e,t,o,n,k)):z,{status:P,invalid:E}=C,O=T>A&&(!!e.forceStaleReload||C.cause==="enter"||S!==void 0&&S!==C.id);u=P==="success"&&(E||($??O)),x&&k.options.preload===!1||(u&&!e.sync&&v?(f=!0,(async()=>{try{await zb(e,t,o,n,k);const K=e.router.getMatch(o);K._nonReactive.loaderPromise?.resolve(),K._nonReactive.loadPromise?.resolve(),K._nonReactive.loaderPromise=void 0,K._nonReactive.loadPromise=void 0}catch(K){Nn(K)&&await e.router.navigate(K.options)}})()):P!=="success"||u?await zb(e,t,o,n,k):kb(e,o,n))}const{id:o,routeId:c}=e.matches[n];let u=!1,f=!1;const m=e.router.looseRoutesById[c],p=m.options.loader,v=((typeof p=="function"?void 0:p?.staleReloadMode)??e.router.options.defaultStaleReloadMode)!=="blocking";if(FS(e,o)){if(!e.router.getMatch(o))return e.matches[n];kb(e,o,n)}else{const x=e.router.getMatch(o),N=e.router.state.matches[n]?.routeId===c?e.router.state.matches[n].id:e.router.state.matches.find(C=>C.routeId===c)?.id,S=Hu(e,o);if(x._nonReactive.loaderPromise){if(x.status==="success"&&!e.sync&&!x.preload&&v)return x;await x._nonReactive.loaderPromise;const C=e.router.getMatch(o),k=C._nonReactive.error||C.error;k&&Ai(e,C,k),C.status==="pending"&&await a(S,x,N,C,m)}else{const C=S&&!e.router.state.matches.some(T=>T.id===o),k=e.router.getMatch(o);k._nonReactive.loaderPromise=Pr(),C!==k.preload&&e.updateMatch(o,T=>({...T,preload:C})),await a(S,x,N,k,m)}}const y=e.router.getMatch(o);f||(y._nonReactive.loaderPromise?.resolve(),y._nonReactive.loadPromise?.resolve(),y._nonReactive.loadPromise=void 0),clearTimeout(y._nonReactive.pendingTimeout),y._nonReactive.pendingTimeout=void 0,f||(y._nonReactive.loaderPromise=void 0),y._nonReactive.dehydrated=void 0;const b=f?y.isFetching:!1;return b!==y.isFetching||y.invalid!==!1?(e.updateMatch(o,x=>({...x,isFetching:b,invalid:!1})),e.router.getMatch(o)):y};async function _b(e){const t=e,n=[];t.router.state.matches.some(b=>b._forcePending)&&Am(t);let a;for(let b=0;b<t.matches.length;b++){try{const x=Jz(t,b);rl(x)&&await x}catch(x){if(Nn(x))throw x;if(mn(x))a=x;else if(!t.preload)throw x;break}if(t.serialError)break}const o=t.firstBadMatchIndex??t.matches.length,c=a&&!t.preload?Cb(t,a):void 0,u=a&&t.preload?0:c!==void 0?Math.min(c+1,o):o;let f,m;for(let b=0;b<u;b++)n.push(Wz(t,n,b));try{await Promise.all(n)}catch{const b=await Promise.allSettled(n);for(const x of b){if(x.status!=="rejected")continue;const N=x.reason;if(Nn(N))throw N;mn(N)?f??=N:m??=N}if(m!==void 0)throw m}const p=f??(a&&!t.preload?a:void 0);let v=t.serialError?t.firstBadMatchIndex??0:t.matches.length-1;if(!p&&a&&t.preload)return t.matches;if(p){const b=Cb(t,p);Mi(b!==void 0);const x=t.matches[b],N=t.router.looseRoutesById[x.routeId],S=t.router.options?.defaultNotFoundComponent;!N.options.notFoundComponent&&S&&(N.options.notFoundComponent=S),p.routeId=x.routeId;const C=x.routeId===t.router.routeTree.id;t.updateMatch(x.id,k=>({...k,...C?{status:"success",globalNotFound:!0,error:void 0}:{status:"notFound",error:p},isFetching:!1})),v=b,await ol(N,["notFoundComponent"])}else if(!t.preload){const b=t.matches[0];b.globalNotFound||t.router.getMatch(b.id)?.globalNotFound&&t.updateMatch(b.id,x=>({...x,globalNotFound:!1,error:void 0}))}if(t.serialError&&t.firstBadMatchIndex!==void 0){const b=t.router.looseRoutesById[t.matches[t.firstBadMatchIndex].routeId];await ol(b,["errorComponent"])}for(let b=0;b<=v;b++){const{id:x,routeId:N}=t.matches[b],S=t.router.looseRoutesById[N];try{const C=Xz(t,x,S);if(C){const k=await C;t.updateMatch(x,T=>({...T,...k}))}}catch(C){console.error(`Error executing head for route ${N}:`,C)}}const y=Am(t);if(rl(y)&&await y,p)throw p;if(t.serialError&&!t.preload&&!t.onReady)throw t.serialError;return t.matches}function Eb(e,t){const n=t.map(a=>e.options[a]?.preload?.()).filter(Boolean);if(n.length!==0)return Promise.all(n)}function ol(e,t=fu){!e._lazyLoaded&&e._lazyPromise===void 0&&(e.lazyFn?e._lazyPromise=e.lazyFn().then(a=>{const{id:o,...c}=a.options;Object.assign(e.options,c),e._lazyLoaded=!0,e._lazyPromise=void 0}):e._lazyLoaded=!0);const n=()=>e._componentsLoaded?void 0:t===fu?(()=>{if(e._componentsPromise===void 0){const a=Eb(e,fu);a?e._componentsPromise=a.then(()=>{e._componentsLoaded=!0,e._componentsPromise=void 0}):e._componentsLoaded=!0}return e._componentsPromise})():Eb(e,t);return e._lazyPromise?e._lazyPromise.then(n):n()}function QS(e){for(const t of fu)if(e.options[t]?.preload)return!0;return!1}var fu=["component","errorComponent","pendingComponent","notFoundComponent"],Oi="__TSR_index",Ab="popstate",Tb="beforeunload";function e_(e){let t=e.getLocation();const n=new Set,a=u=>{t=e.getLocation(),n.forEach(f=>f({location:t,action:u}))},o=u=>{e.notifyOnIndexChange??!0?a(u):t=e.getLocation()},c=async({task:u,navigateOpts:f,...m})=>{if(f?.ignoreBlocker??!1){u();return}const p=e.getBlockers?.()??[],v=m.type==="PUSH"||m.type==="REPLACE";if(typeof document<"u"&&p.length&&v)for(const y of p){const b=zu(m.path,m.state);if(await y.blockerFn({currentLocation:t,nextLocation:b,action:m.type})){e.onBlocked?.();return}}u()};return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:u=>(n.add(u),()=>{n.delete(u)}),push:(u,f,m)=>{const p=t.state[Oi];f=Rb(p+1,f),c({task:()=>{e.pushState(u,f),a({type:"PUSH"})},navigateOpts:m,type:"PUSH",path:u,state:f})},replace:(u,f,m)=>{const p=t.state[Oi];f=Rb(p,f),c({task:()=>{e.replaceState(u,f),a({type:"REPLACE"})},navigateOpts:m,type:"REPLACE",path:u,state:f})},go:(u,f)=>{c({task:()=>{e.go(u),o({type:"GO",index:u})},navigateOpts:f,type:"GO"})},back:u=>{c({task:()=>{e.back(u?.ignoreBlocker??!1),o({type:"BACK"})},navigateOpts:u,type:"BACK"})},forward:u=>{c({task:()=>{e.forward(u?.ignoreBlocker??!1),o({type:"FORWARD"})},navigateOpts:u,type:"FORWARD"})},canGoBack:()=>t.state[Oi]!==0,createHref:u=>e.createHref(u),block:u=>{if(!e.setBlockers)return()=>{};const f=e.getBlockers?.()??[];return e.setBlockers([...f,u]),()=>{const m=e.getBlockers?.()??[];e.setBlockers?.(m.filter(p=>p!==u))}},flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:a}}function Rb(e,t){t||(t={});const n=yp();return{...t,key:n,__TSR_key:n,[Oi]:e}}function t_(e){const t=typeof document<"u"?window:void 0,n=t.history.pushState,a=t.history.replaceState;let o=[];const c=()=>o,u=O=>o=O,f=(O=>O),m=(()=>zu(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){const O=yp();t.history.replaceState({[Oi]:0,key:O,__TSR_key:O},"")}let p=m(),v,y=!1,b=!1,x=!1,N=!1;const S=()=>p;let C,k;const T=()=>{C&&(E._ignoreSubscribers=!0,(C.isPush?t.history.pushState:t.history.replaceState)(C.state,"",C.href),E._ignoreSubscribers=!1,C=void 0,k=void 0,v=void 0)},A=(O,K,ee)=>{const X=f(K);k||(v=p),p=zu(K,ee),C={href:X,state:ee,isPush:C?.isPush||O==="push"},k||(k=Promise.resolve().then(()=>T()))},z=O=>{p=m(),E.notify({type:O})},$=async()=>{if(b){b=!1;return}const O=m(),K=O.state[Oi]-p.state[Oi],ee=K===1,X=K===-1,se=!ee&&!X||y;y=!1;const de=se?"GO":X?"BACK":"FORWARD",Ee=se?{type:"GO",index:K}:{type:X?"BACK":"FORWARD"};if(x)x=!1;else{const be=c();if(typeof document<"u"&&be.length){for(const H of be)if(await H.blockerFn({currentLocation:p,nextLocation:O,action:de})){b=!0,t.history.go(1),E.notify(Ee);return}}}p=m(),E.notify(Ee)},P=O=>{if(N){N=!1;return}let K=!1;const ee=c();if(typeof document<"u"&&ee.length)for(const X of ee){const se=X.enableBeforeUnload??!0;if(se===!0){K=!0;break}if(typeof se=="function"&&se()===!0){K=!0;break}}if(K)return O.preventDefault(),O.returnValue=""},E=e_({getLocation:S,getLength:()=>t.history.length,pushState:(O,K)=>A("push",O,K),replaceState:(O,K)=>A("replace",O,K),back:O=>(O&&(x=!0),N=!0,t.history.back()),forward:O=>{O&&(x=!0),N=!0,t.history.forward()},go:O=>{y=!0,t.history.go(O)},createHref:O=>f(O),flush:T,destroy:()=>{t.history.pushState=n,t.history.replaceState=a,t.removeEventListener(Tb,P,{capture:!0}),t.removeEventListener(Ab,$)},onBlocked:()=>{v&&p!==v&&(p=v)},getBlockers:c,setBlockers:u,notifyOnIndexChange:!1});return t.addEventListener(Tb,P,{capture:!0}),t.addEventListener(Ab,$),t.history.pushState=function(...O){const K=n.apply(t.history,O);return E._ignoreSubscribers||z("PUSH"),K},t.history.replaceState=function(...O){const K=a.apply(t.history,O);return E._ignoreSubscribers||z("REPLACE"),K},E}function n_(e){let t=e.replace(/[\x00-\x1f\x7f]/g,"");return t.startsWith("//")&&(t="/"+t.replace(/^\/+/,"")),t}function zu(e,t){const n=n_(e),a=n.indexOf("#"),o=n.indexOf("?"),c=yp();return{href:n,pathname:n.substring(0,a>0?o>0?Math.min(a,o):a:o>0?o:n.length),hash:a>-1?n.substring(a):"",search:o>-1?n.slice(o,a===-1?void 0:a):"",state:t||{[Oi]:0,key:c,__TSR_key:c}}}function yp(){return(Math.random()+1).toString(36).substring(7)}function Na(e){const t=e.resolvedLocation,n=e.location;return{fromLocation:t,toLocation:n,pathChanged:t?.pathname!==n.pathname,hrefChanged:t?.href!==n.href,hashChanged:t?.hash!==n.hash}}function s_(e){const t=e.filter(n=>n.status!=="redirected");return t.length===e.length?e:t}var i_=class{constructor(e){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this.resetNextScroll=!0,this.shouldViewTransition=void 0,this.isViewTransitionTypesSupported=void 0,this.subscribers=new Set,this.isScrollRestoring=!1,this.isScrollRestorationSetup=!1,this.startTransition=t=>t(),this.update=t=>{const n=this.options,a=this.basepath??n?.basepath??"/",o=this.basepath===void 0,c=n?.rewrite;if(this.options={...n,...t},this.isServer=this.options.isServer??typeof document>"u",this.protocolAllowlist=new Set(this.options.protocolAllowlist),this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=gz(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.history=t_()),this.origin=this.options.origin,this.origin||(window?.origin&&window.origin!=="null"?this.origin=window.origin:this.origin="http://localhost"),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let p;this.resolvePathCache=wu(1e3),p=this.buildRouteTree(),this.setRoutes(p)}!this.__store&&this.latestLocation&&(this.__store=Zz(r_(this.latestLocation)),wz(this));let u=!1;const f=this.options.basepath??"/",m=this.options.rewrite;if(o||a!==f||c!==m){this.basepath=f;const p=[],v=US(f);v&&v!=="/"&&p.push(Rz({basepath:f})),m&&p.push(m),this.rewrite=p.length===0?void 0:p.length===1?p[0]:Tz(p),this.history&&this.updateLatestLocation(),u=!0}u&&this.__store&&this.__store.setState(p=>({...p,location:this.latestLocation})),typeof window<"u"&&"CSS"in window&&typeof window.CSS?.supports=="function"&&(this.isViewTransitionTypesSupported=window.CSS.supports("selector(:active-view-transition-type(a)"))},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{const t=uz(this.routeTree,this.options.caseSensitive,(n,a)=>{n.init({originalIndex:a})});return this.options.routeMasks&&az(this.options.routeMasks,t.processedTree),t},this.subscribe=(t,n)=>{const a={eventType:t,fn:n};return this.subscribers.add(a),()=>{this.subscribers.delete(a)}},this.emit=t=>{this.subscribers.forEach(n=>{n.eventType===t.type&&n.fn(t)})},this.parseLocation=(t,n)=>{const a=({pathname:f,search:m,hash:p,href:v,state:y})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(f)){const C=this.options.parseSearch(m),k=this.options.stringifySearch(C);return{href:f+k+p,publicHref:v,pathname:Ho(f).path,external:!1,searchStr:k,search:ua(n?.search,C),hash:Ho(p.slice(1)).path,state:pa(n?.state,y)}}const b=new URL(v,this.origin),x=zm(this.rewrite,b),N=this.options.parseSearch(x.search),S=this.options.stringifySearch(N);return x.search=S,{href:x.href.replace(x.origin,""),publicHref:v,pathname:Ho(x.pathname).path,external:!!this.rewrite&&x.origin!==this.origin,searchStr:S,search:ua(n?.search,N),hash:Ho(x.hash.slice(1)).path,state:pa(n?.state,y)}},o=a(t),{__tempLocation:c,__tempKey:u}=o.state;if(c&&(!u||u===this.tempLocationKey)){const f=a(c);return f.state.key=o.state.key,f.state.__TSR_key=o.state.__TSR_key,delete f.state.__tempLocation,{...f,maskedLocation:o}}return o},this.resolvePathWithBase=(t,n)=>pz({base:t,to:hp(n),trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(t,n,a)=>typeof t=="string"?this.matchRoutesInternal({pathname:t,search:n},a):this.matchRoutesInternal(t,n),this.getMatchedRoutes=t=>o_({pathname:t,routesById:this.routesById,processedTree:this.processedTree}),this.cancelMatch=t=>{const n=this.getMatch(t);n&&(n.abortController.abort(),clearTimeout(n._nonReactive.pendingTimeout),n._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{const t=this.state.matches.filter(a=>a.status==="pending"),n=this.state.matches.filter(a=>a.isFetching==="loader");new Set([...this.state.pendingMatches??[],...t,...n]).forEach(a=>{this.cancelMatch(a.id)})},this.buildLocation=t=>{const n=(o={})=>{const c=o._fromLocation||this.pendingBuiltLocation||this.latestLocation,u=this.matchRoutesLightweight(c);o.from;const f=o.unsafeRelative==="path"?c.pathname:o.from??u.fullPath,m=this.resolvePathWithBase(f,"."),p=u.search,v=Object.assign(Object.create(null),u.params),y=o.to?this.resolvePathWithBase(m,`${o.to}`):this.resolvePathWithBase(m,"."),b=o.params===!1||o.params===null?Object.create(null):(o.params??!0)===!0?v:Object.assign(v,Ei(o.params,v)),x=this.getMatchedRoutes(y);let N=x.matchedRoutes;if((!x.foundRoute||x.foundRoute.path!=="/"&&x.routeParams["**"])&&this.options.notFoundRoute&&(N=[...N,this.options.notFoundRoute]),Object.keys(b).length>0)for(const K of N){const ee=K.options.params?.stringify??K.options.stringifyParams;if(ee)try{Object.assign(b,ee(b))}catch{}}const S=t.leaveParams?y:Ho(Sb({path:y,params:b,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path;let C=p;if(t._includeValidateSearch&&this.options.search?.strict){const K={};N.forEach(ee=>{if(ee.options.validateSearch)try{Object.assign(K,hu(ee.options.validateSearch,{...K,...C}))}catch{}}),C=K}C=l_({search:C,dest:o,destRoutes:N,_includeValidateSearch:t._includeValidateSearch}),C=ua(p,C);const k=this.options.stringifySearch(C),T=o.hash===!0?c.hash:o.hash?Ei(o.hash,c.hash):void 0,A=T?`#${T}`:"";let z=o.state===!0?c.state:o.state?Ei(o.state,c.state):{};z=pa(c.state,z);const $=`${S}${k}${A}`;let P,E,O=!1;if(this.rewrite){const K=new URL($,this.origin),ee=IS(this.rewrite,K);P=K.href.replace(K.origin,""),ee.origin!==this.origin?(E=ee.href,O=!0):E=ee.pathname+ee.search+ee.hash}else P=nz($),E=P;return{publicHref:E,href:P,pathname:S,search:C,searchStr:k,state:z,hash:T??"",external:O,unmaskOnReload:o.unmaskOnReload}},a=(o={},c)=>{const u=n(o);let f=c?n(c):void 0;if(!f){const m=Object.create(null);if(this.options.routeMasks){const p=rz(u.pathname,this.processedTree);if(p){Object.assign(m,p.rawParams);const{from:v,params:y,...b}=p.route,x=y===!1||y===null?Object.create(null):(y??!0)===!0?m:Object.assign(m,Ei(y,m));c={from:t.from,...b,params:x},f=n(c)}}}return f&&(u.maskedLocation=f),u};return t.mask?a(t,{from:t.from,...t.mask}):a(t)},this.commitLocation=async({viewTransition:t,ignoreBlocker:n,...a})=>{const o=()=>{const f=["key","__TSR_key","__TSR_index","__hashScrollIntoViewOptions"];f.forEach(p=>{a.state[p]=this.latestLocation.state[p]});const m=Sa(a.state,this.latestLocation.state);return f.forEach(p=>{delete a.state[p]}),m},c=Ri(this.latestLocation.href)===Ri(a.href);let u=this.commitLocationPromise;if(this.commitLocationPromise=Pr(()=>{u?.resolve(),u=void 0}),c&&o())this.load();else{let{maskedLocation:f,hashScrollIntoView:m,...p}=a;f&&(p={...f,state:{...f.state,__tempKey:void 0,__tempLocation:{...p,search:p.searchStr,state:{...p.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(p.unmaskOnReload??this.options.unmaskOnReload??!1)&&(p.state.__tempKey=this.tempLocationKey)),p.state.__hashScrollIntoViewOptions=m??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=t,this.history[a.replace?"replace":"push"](p.publicHref,p.state,{ignoreBlocker:n})}return this.resetNextScroll=a.resetScroll??!0,this.history.subscribers.size||this.load(),this.commitLocationPromise},this.buildAndCommitLocation=({replace:t,resetScroll:n,hashScrollIntoView:a,viewTransition:o,ignoreBlocker:c,href:u,...f}={})=>{if(u){const v=this.history.location.state.__TSR_index,y=zu(u,{__TSR_index:t?v:v+1}),b=new URL(y.pathname,this.origin);f.to=zm(this.rewrite,b).pathname,f.search=this.options.parseSearch(y.search),f.hash=y.hash.slice(1)}const m=this.buildLocation({...f,_includeValidateSearch:!0});this.pendingBuiltLocation=m;const p=this.commitLocation({...m,viewTransition:o,replace:t,resetScroll:n,hashScrollIntoView:a,ignoreBlocker:c});return Promise.resolve().then(()=>{this.pendingBuiltLocation===m&&(this.pendingBuiltLocation=void 0)}),p},this.navigate=async({to:t,reloadDocument:n,href:a,publicHref:o,...c})=>{let u=!1;if(a)try{new URL(`${a}`),u=!0}catch{}if(u&&!n&&(n=!0),n){if(t!==void 0||!a){const m=this.buildLocation({to:t,...c});a=a??m.publicHref,o=o??m.publicHref}const f=!u&&o?o:a;if(ju(f,this.protocolAllowlist))return Promise.resolve();if(!c.ignoreBlocker){const m=this.history.getBlockers?.()??[];for(const p of m)if(p?.blockerFn&&await p.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:"PUSH"}))return Promise.resolve()}return c.replace?window.location.replace(f):window.location.href=f,Promise.resolve()}return this.buildAndCommitLocation({...c,href:a,to:t,_isNavigate:!0})},this.beforeLoad=()=>{this.cancelMatches(),this.updateLatestLocation();const t=this.matchRoutes(this.latestLocation);this.__store.setState(n=>({...n,status:"pending",statusCode:200,isLoading:!0,location:this.latestLocation,pendingMatches:t,cachedMatches:n.cachedMatches.filter(a=>!t.some(o=>o.id===a.id))}))},this.load=async t=>{let n,a,o;const c=this.state.resolvedLocation??this.state.location;for(o=new Promise(f=>{this.startTransition(async()=>{try{this.beforeLoad();const m=this.latestLocation,p=this.state.resolvedLocation;this.state.redirect||this.emit({type:"onBeforeNavigate",...Na({resolvedLocation:p,location:m})}),this.emit({type:"onBeforeLoad",...Na({resolvedLocation:p,location:m})}),await _b({router:this,sync:t?.sync,forceStaleReload:c.href===m.href,matches:this.state.pendingMatches,location:m,updateMatch:this.updateMatch,onReady:async()=>{this.startTransition(()=>{this.startViewTransition(async()=>{let v=[],y=[],b=[],x=[];el(()=>{this.__store.setState(N=>{const S=N.matches,C=N.pendingMatches||N.matches;return v=S.filter(k=>!C.some(T=>T.id===k.id)),y=S.filter(k=>!C.some(T=>T.routeId===k.routeId)),b=C.filter(k=>!S.some(T=>T.routeId===k.routeId)),x=C.filter(k=>S.some(T=>T.routeId===k.routeId)),{...N,isLoading:!1,loadedAt:Date.now(),matches:C,pendingMatches:void 0,cachedMatches:[...N.cachedMatches,...v.filter(k=>k.status!=="error"&&k.status!=="notFound"&&k.status!=="redirected")]}}),this.clearExpiredCache()}),[[y,"onLeave"],[b,"onEnter"],[x,"onStay"]].forEach(([N,S])=>{N.forEach(C=>{this.looseRoutesById[C.routeId].options[S]?.(C)})})})})}})}catch(m){Nn(m)?(n=m,this.navigate({...n.options,replace:!0,ignoreBlocker:!0})):mn(m)&&(a=m),this.__store.setState(p=>({...p,statusCode:n?n.status:a?404:p.matches.some(v=>v.status==="error")?500:200,redirect:n}))}this.latestLoadPromise===o&&(this.commitLocationPromise?.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),f()})}),this.latestLoadPromise=o,await o;this.latestLoadPromise&&o!==this.latestLoadPromise;)await this.latestLoadPromise;let u;this.hasNotFoundMatch()?u=404:this.__store.state.matches.some(f=>f.status==="error")&&(u=500),u!==void 0&&this.__store.setState(f=>({...f,statusCode:u}))},this.startViewTransition=t=>{const n=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,n&&typeof document<"u"&&"startViewTransition"in document&&typeof document.startViewTransition=="function"){let a;if(typeof n=="object"&&this.isViewTransitionTypesSupported){const o=this.latestLocation,c=this.state.resolvedLocation,u=typeof n.types=="function"?n.types(Na({resolvedLocation:c,location:o})):n.types;if(u===!1){t();return}a={update:t,types:u}}else a=t;document.startViewTransition(a)}else t()},this.updateMatch=(t,n)=>{this.startTransition(()=>{const a=this.state.pendingMatches?.some(o=>o.id===t)?"pendingMatches":this.state.matches.some(o=>o.id===t)?"matches":this.state.cachedMatches.some(o=>o.id===t)?"cachedMatches":"";a&&(a==="cachedMatches"?this.__store.setState(o=>({...o,cachedMatches:s_(o.cachedMatches.map(c=>c.id===t?n(c):c))})):this.__store.setState(o=>({...o,[a]:o[a]?.map(c=>c.id===t?n(c):c)})))})},this.getMatch=t=>{const n=a=>a.id===t;return this.state.cachedMatches.find(n)??this.state.pendingMatches?.find(n)??this.state.matches.find(n)},this.invalidate=t=>{const n=a=>t?.filter?.(a)??!0?{...a,invalid:!0,...t?.forcePending||a.status==="error"||a.status==="notFound"?{status:"pending",error:void 0}:void 0}:a;return this.__store.setState(a=>({...a,matches:a.matches.map(n),cachedMatches:a.cachedMatches.map(n),pendingMatches:a.pendingMatches?.map(n)})),this.shouldViewTransition=!1,this.load({sync:t?.sync})},this.getParsedLocationHref=t=>t.publicHref||"/",this.resolveRedirect=t=>{const n=t.headers.get("Location");if(!t.options.href||t.options._builtLocation){const a=t.options._builtLocation??this.buildLocation(t.options),o=this.getParsedLocationHref(a);t.options.href=o,t.headers.set("Location",o)}else if(n)try{const a=new URL(n);if(this.origin&&a.origin===this.origin){const o=a.pathname+a.search+a.hash;t.options.href=o,t.headers.set("Location",o)}}catch{}if(t.options.href&&!t.options._builtLocation&&ju(t.options.href,this.protocolAllowlist))throw new Error("Redirect blocked: unsafe protocol");return t.headers.get("Location")||t.headers.set("Location",t.options.href),t},this.clearCache=t=>{const n=t?.filter;n!==void 0?this.__store.setState(a=>({...a,cachedMatches:a.cachedMatches.filter(o=>!n(o))})):this.__store.setState(a=>({...a,cachedMatches:[]}))},this.clearExpiredCache=()=>{const t=n=>{const a=this.looseRoutesById[n.routeId];if(!a.options.loader)return!0;const o=(n.preload?a.options.preloadGcTime??this.options.defaultPreloadGcTime:a.options.gcTime??this.options.defaultGcTime)??300*1e3;return n.status==="error"?!0:Date.now()-n.updatedAt>=o};this.clearCache({filter:t})},this.loadRouteChunk=ol,this.preloadRoute=async t=>{const n=t._builtLocation??this.buildLocation(t);let a=this.matchRoutes(n,{throwOnError:!0,preload:!0,dest:t});const o=new Set([...this.state.matches,...this.state.pendingMatches??[]].map(u=>u.id)),c=new Set([...o,...this.state.cachedMatches.map(u=>u.id)]);el(()=>{a.forEach(u=>{c.has(u.id)||this.__store.setState(f=>({...f,cachedMatches:[...f.cachedMatches,u]}))})});try{return a=await _b({router:this,matches:a,location:n,preload:!0,updateMatch:(u,f)=>{o.has(u)?a=a.map(m=>m.id===u?f(m):m):this.updateMatch(u,f)}}),a}catch(u){if(Nn(u))return u.options.reloadDocument?void 0:await this.preloadRoute({...u.options,_fromLocation:n});mn(u)||console.error(u);return}},this.matchRoute=(t,n)=>{const a={...t,to:t.to?this.resolvePathWithBase(t.from||"",t.to):void 0,params:t.params||{},leaveParams:!0},o=this.buildLocation(a);if(n?.pending&&this.state.status!=="pending")return!1;const c=(n?.pending===void 0?!this.state.isLoading:n.pending)?this.latestLocation:this.state.resolvedLocation||this.state.location,u=oz(o.pathname,n?.caseSensitive??!1,n?.fuzzy??!1,c.pathname,this.processedTree);return!u||t.params&&!Sa(u.rawParams,t.params,{partial:!0})?!1:n?.includeSearch??!0?Sa(c.search,o.search,{partial:!0})?u.rawParams:!1:u.rawParams},this.hasNotFoundMatch=()=>this.__store.state.matches.some(t=>t.status==="notFound"||t.globalNotFound),this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??"fuzzy",stringifySearch:e.stringifySearch??_z,parseSearch:e.parseSearch??zz,protocolAllowlist:e.protocolAllowlist??tz}),typeof document<"u"&&(self.__TSR_ROUTER__=this)}isShell(){return!!this.options.isShell}isPrerendering(){return!!this.options.isPrerendering}get state(){return this.__store.state}setRoutes({routesById:e,routesByPath:t,processedTree:n}){this.routesById=e,this.routesByPath=t,this.processedTree=n;const a=this.options.notFoundRoute;a&&(a.init({originalIndex:99999999999}),this.routesById[a.id]=a)}get looseRoutesById(){return this.routesById}getParentContext(e){return e?.id?e.context??this.options.context??void 0:this.options.context??void 0}matchRoutesInternal(e,t){const n=this.getMatchedRoutes(e.pathname),{foundRoute:a,routeParams:o,parsedParams:c}=n;let{matchedRoutes:u}=n,f=!1;(a?a.path!=="/"&&o["**"]:Ri(e.pathname))&&(this.options.notFoundRoute?u=[...u,this.options.notFoundRoute]:f=!0);const m=f?u_(this.options.notFoundMode,u):void 0,p=new Array(u.length),v=new Map(this.state.matches.map(y=>[y.routeId,y]));for(let y=0;y<u.length;y++){const b=u[y],x=p[y-1];let N,S,C;{const de=x?.search??e.search,Ee=x?._strictSearch??void 0;try{const be=hu(b.options.validateSearch,{...de})??void 0;N={...de,...be},S={...Ee,...be},C=void 0}catch(be){let H=be;if(be instanceof _u||(H=new _u(be.message,{cause:be})),t?.throwOnError)throw H;N=de,S={},C=H}}const k=b.options.loaderDeps?.({search:N})??"",T=k?JSON.stringify(k):"",{interpolatedPath:A,usedParams:z}=Sb({path:b.fullPath,params:o,decoder:this.pathParamsDecoder,server:this.isServer}),$=b.id+A+T,P=this.getMatch($),E=v.get(b.id),O=P?._strictParams??z;let K;if(!P)try{Ob(b,z,c,O)}catch(de){if(mn(de)||Nn(de)?K=de:K=new a_(de.message,{cause:de}),t?.throwOnError)throw K}Object.assign(o,O);const ee=E?"stay":"enter";let X;if(P)X={...P,cause:ee,params:E?.params??o,_strictParams:O,search:ua(E?E.search:P.search,N),_strictSearch:S};else{const de=b.options.loader||b.options.beforeLoad||b.lazyFn||QS(b)?"pending":"success";X={id:$,ssr:b.options.ssr,index:y,routeId:b.id,params:E?.params??o,_strictParams:O,pathname:A,updatedAt:Date.now(),search:E?ua(E.search,N):N,_strictSearch:S,searchError:void 0,status:de,isFetching:!1,error:void 0,paramsError:K,__routeContext:void 0,_nonReactive:{loadPromise:Pr()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:ee,loaderDeps:E?pa(E.loaderDeps,k):k,invalid:!1,preload:!1,links:void 0,scripts:void 0,headScripts:void 0,meta:void 0,staticData:b.options.staticData||{},fullPath:b.fullPath}}t?.preload||(X.globalNotFound=m===b.id),X.searchError=C;const se=this.getParentContext(x);X.context={...se,...X.__routeContext,...X.__beforeLoadContext},p[y]=X}for(let y=0;y<p.length;y++){const b=p[y],x=this.looseRoutesById[b.routeId],N=this.getMatch(b.id),S=v.get(b.routeId);if(b.params=S?ua(S.params,o):o,!N){const C=p[y-1],k=this.getParentContext(C);if(x.options.context){const T={deps:b.loaderDeps,params:b.params,context:k??{},location:e,navigate:A=>this.navigate({...A,_fromLocation:e}),buildLocation:this.buildLocation,cause:b.cause,abortController:b.abortController,preload:!!b.preload,matches:p,routeId:x.id};b.__routeContext=x.options.context(T)??void 0}b.context={...k,...b.__routeContext,...b.__beforeLoadContext}}}return p}matchRoutesLightweight(e){const{matchedRoutes:t,routeParams:n,parsedParams:a}=this.getMatchedRoutes(e.pathname),o=al(t),c={...e.search};for(const p of t)try{Object.assign(c,hu(p.options.validateSearch,c))}catch{}const u=al(this.state.matches),f=u&&u.routeId===o.id&&e.pathname===this.state.location.pathname;let m;if(f)m=u.params;else{const p=Object.assign(Object.create(null),n);for(const v of t)try{Ob(v,n,a??{},p)}catch{}m=p}return{matchedRoutes:t,fullPath:o.fullPath,search:c,params:m}}},_u=class extends Error{},a_=class extends Error{};function r_(e){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:"idle",resolvedLocation:void 0,location:e,matches:[],pendingMatches:[],cachedMatches:[],statusCode:200}}function hu(e,t){if(e==null)return{};if("~standard"in e){const n=e["~standard"].validate(t);if(n instanceof Promise)throw new _u("Async validation not supported");if(n.issues)throw new _u(JSON.stringify(n.issues,void 0,2),{cause:n});return n.value}return"parse"in e?e.parse(t):typeof e=="function"?e(t):{}}function o_({pathname:e,routesById:t,processedTree:n}){const a=Object.create(null),o=Ri(e);let c,u;const f=lz(o,n,!0);return f&&(c=f.route,Object.assign(a,f.rawParams),u=Object.assign(Object.create(null),f.parsedParams)),{matchedRoutes:f?.branch||[t.__root__],routeParams:a,foundRoute:c,parsedParams:u}}function l_({search:e,dest:t,destRoutes:n,_includeValidateSearch:a}){return c_(n)(e,t,a??!1)}function c_(e){const t={dest:null,_includeValidateSearch:!1,middlewares:[]};for(const o of e){if("search"in o.options)o.options.search?.middlewares&&t.middlewares.push(...o.options.search.middlewares);else if(o.options.preSearchFilters||o.options.postSearchFilters){const c=({search:u,next:f})=>{let m=u;"preSearchFilters"in o.options&&o.options.preSearchFilters&&(m=o.options.preSearchFilters.reduce((v,y)=>y(v),u));const p=f(m);return"postSearchFilters"in o.options&&o.options.postSearchFilters?o.options.postSearchFilters.reduce((v,y)=>y(v),p):p};t.middlewares.push(c)}if(o.options.validateSearch){const c=({search:u,next:f})=>{const m=f(u);if(!t._includeValidateSearch)return m;try{return{...m,...hu(o.options.validateSearch,m)??void 0}}catch{return m}};t.middlewares.push(c)}}const n=({search:o})=>{const c=t.dest;return c.search?c.search===!0?o:Ei(c.search,o):{}};t.middlewares.push(n);const a=(o,c,u)=>{if(o>=u.length)return c;const f=u[o];return f({search:c,next:p=>a(o+1,p,u)})};return function(c,u,f){return t.dest=u,t._includeValidateSearch=f,a(0,c,t.middlewares)}}function u_(e,t){if(e!=="root")for(let n=t.length-1;n>=0;n--){const a=t[n];if(a.children)return a.id}return ja}function Ob(e,t,n,a){const o=e.options.params?.parse??e.options.parseParams;if(o)if(e.options.skipRouteOnParseError)for(const c in t)c in n&&(a[c]=n[c]);else{const c=o(a);Object.assign(a,c)}}var d_="Error preloading route! ☝️",YS=class{get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(e){if(this.init=t=>{this.originalIndex=t.originalIndex;const n=this.options,a=!n?.path&&!n?.id;this.parentRoute=this.options.getParentRoute?.(),a?this._path=ja:this.parentRoute||Mi(!1);let o=a?ja:n?.path;o&&o!=="/"&&(o=PS(o));const c=n?.id||o;let u=a?ja:uu([this.parentRoute.id==="__root__"?"":this.parentRoute.id,c]);o==="__root__"&&(o="/"),u!=="__root__"&&(u=uu(["/",u]));const f=u==="__root__"?"/":uu([this.parentRoute.fullPath,o]);this._path=o,this._id=u,this._fullPath=f,this._to=Ri(f)},this.addChildren=t=>this._addFileChildren(t),this._addFileChildren=t=>(Array.isArray(t)&&(this.children=t),typeof t=="object"&&t!==null&&(this.children=Object.values(t)),this),this._addFileTypes=()=>this,this.updateLoader=t=>(Object.assign(this.options,t),this),this.update=t=>(Object.assign(this.options,t),this),this.lazy=t=>(this.lazyFn=t,this),this.redirect=t=>mp({from:this.fullPath,...t}),this.options=e||{},this.isRoot=!e?.getParentRoute,e?.id&&e?.path)throw new Error("Route cannot have both an 'id' and a 'path' option.")}},f_=class extends YS{constructor(e){super(e)}};function vp(e){const t=e.errorComponent??bp;return r.jsx(h_,{getResetKey:e.getResetKey,onCatch:e.onCatch,children:({error:n,reset:a})=>n?w.createElement(t,{error:n,reset:a}):e.children})}var h_=class extends w.Component{constructor(...e){super(...e),this.state={error:null}}static getDerivedStateFromProps(e){return{resetKey:e.getResetKey()}}static getDerivedStateFromError(e){return{error:e}}reset(){this.setState({error:null})}componentDidUpdate(e,t){t.error&&t.resetKey!==this.state.resetKey&&this.reset()}componentDidCatch(e,t){this.props.onCatch&&this.props.onCatch(e,t)}render(){return this.props.children({error:this.state.resetKey!==this.props.getResetKey()?null:this.state.error,reset:()=>{this.reset()}})}};function bp({error:e}){const[t,n]=w.useState(!1);return r.jsxs("div",{style:{padding:".5rem",maxWidth:"100%"},children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem"},children:[r.jsx("strong",{style:{fontSize:"1rem"},children:"Something went wrong!"}),r.jsx("button",{style:{appearance:"none",fontSize:".6em",border:"1px solid currentColor",padding:".1rem .2rem",fontWeight:"bold",borderRadius:".25rem"},onClick:()=>n(a=>!a),children:t?"Hide Error":"Show Error"})]}),r.jsx("div",{style:{height:".25rem"}}),t?r.jsx("div",{children:r.jsx("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".3rem",color:"red",overflow:"auto"},children:e.message?r.jsx("code",{children:e.message}):null})}):null]})}function m_({children:e,fallback:t=null}){return JS()?r.jsx(us.Fragment,{children:e}):r.jsx(us.Fragment,{children:t})}function JS(){return us.useSyncExternalStore(p_,()=>!0,()=>!1)}function p_(){return()=>{}}var XS=w.createContext(null);function Xn(e){const t=w.useContext(XS);return e?.warn,t}var Kh={exports:{}},Hh={},Gh={exports:{}},Fh={};var Lb;function g_(){if(Lb)return Fh;Lb=1;var e=pl();function t(y,b){return y===b&&(y!==0||1/y===1/b)||y!==y&&b!==b}var n=typeof Object.is=="function"?Object.is:t,a=e.useState,o=e.useEffect,c=e.useLayoutEffect,u=e.useDebugValue;function f(y,b){var x=b(),N=a({inst:{value:x,getSnapshot:b}}),S=N[0].inst,C=N[1];return c(function(){S.value=x,S.getSnapshot=b,m(S)&&C({inst:S})},[y,x,b]),o(function(){return m(S)&&C({inst:S}),y(function(){m(S)&&C({inst:S})})},[y]),u(x),x}function m(y){var b=y.getSnapshot;y=y.value;try{var x=b();return!n(y,x)}catch{return!0}}function p(y,b){return b()}var v=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?p:f;return Fh.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:v,Fh}var Db;function y_(){return Db||(Db=1,Gh.exports=g_()),Gh.exports}var Mb;function v_(){if(Mb)return Hh;Mb=1;var e=pl(),t=y_();function n(p,v){return p===v&&(p!==0||1/p===1/v)||p!==p&&v!==v}var a=typeof Object.is=="function"?Object.is:n,o=t.useSyncExternalStore,c=e.useRef,u=e.useEffect,f=e.useMemo,m=e.useDebugValue;return Hh.useSyncExternalStoreWithSelector=function(p,v,y,b,x){var N=c(null);if(N.current===null){var S={hasValue:!1,value:null};N.current=S}else S=N.current;N=f(function(){function k(P){if(!T){if(T=!0,A=P,P=b(P),x!==void 0&&S.hasValue){var E=S.value;if(x(E,P))return z=E}return z=P}if(E=z,a(A,P))return E;var O=b(P);return x!==void 0&&x(E,O)?(A=P,E):(A=P,z=O)}var T=!1,A,z,$=y===void 0?null:y;return[function(){return k(v())},$===null?void 0:function(){return k($())}]},[v,y,b,x]);var C=o(p,N[0],N[1]);return u(function(){S.hasValue=!0,S.value=C},[C]),m(C),C},Hh}var $b;function b_(){return $b||($b=1,Kh.exports=v_()),Kh.exports}var x_=b_();function S_(e,t){return e===t}function j_(e,t,n=S_){const a=w.useCallback(u=>{if(!e)return()=>{};const{unsubscribe:f}=e.subscribe(u);return f},[e]),o=w.useCallback(()=>e?.get(),[e]);return x_.useSyncExternalStoreWithSelector(a,o,o,t,n)}function Cn(e){const t=Xn({warn:e?.router===void 0}),n=e?.router||t,a=w.useRef(void 0);return j_(n.__store,o=>{if(e?.select){if(e.structuralSharing??n.options.defaultStructuralSharing){const c=pa(a.current,e.select(o));return a.current=c,c}return e.select(o)}return o})}var Gu=w.createContext(void 0),w_=w.createContext(void 0);function Ii(e){const t=w.useContext(e.from?w_:Gu);return Cn({select:n=>{const a=n.matches.find(o=>e.from?e.from===o.routeId:o.id===t);if(Mi(!((e.shouldThrow??!0)&&!a),`Could not find ${e.from?`an active match from "${e.from}"`:"a nearest match!"}`),a!==void 0)return e.select?e.select(a):a},structuralSharing:e.structuralSharing})}function xp(e){return Ii({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function Sp(e){const{select:t,...n}=e;return Ii({...n,select:a=>t?t(a.loaderDeps):a.loaderDeps})}function Fu(e){return Ii({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{const n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function Zu(e){return Ii({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function Bi(e){const t=Xn();return w.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function jp(e){return Ii({...e,select:t=>e.select?e.select(t.context):t.context})}var wp=bS();const N_=vS(wp);function C_(e,t){const n=Xn(),a=Qk(t),{activeProps:o,inactiveProps:c,activeOptions:u,to:f,preload:m,preloadDelay:p,hashScrollIntoView:v,replace:y,startTransition:b,resetScroll:x,viewTransition:N,children:S,target:C,disabled:k,style:T,className:A,onClick:z,onBlur:$,onFocus:P,onMouseEnter:E,onMouseLeave:O,onTouchStart:K,ignoreBlocker:ee,params:X,search:se,hash:de,state:Ee,mask:be,reloadDocument:H,unsafeRelative:ae,from:pe,_fromLocation:ce,...U}=e,R=JS(),M=Cn({select:$e=>{const Xe=$e.matches[$e.matches.length-1];return{search:Xe?.search,hash:$e.location.hash,path:Xe?.pathname}},structuralSharing:!0}),J=e.from,V=w.useMemo(()=>({...e,from:J}),[n,M,J,e._fromLocation,e.hash,e.to,e.search,e.params,e.state,e.mask,e.unsafeRelative]),Q=w.useMemo(()=>n.buildLocation({...V}),[n,V]),me=Q.maskedLocation?Q.maskedLocation.publicHref:Q.publicHref,ge=Q.maskedLocation?Q.maskedLocation.external:Q.external,Ne=w.useMemo(()=>T_(me,ge,n.history,k),[k,ge,me,n.history]),he=w.useMemo(()=>{if(Ne?.external)return ju(Ne.href,n.protocolAllowlist)?void 0:Ne.href;if(!R_(f)&&!(typeof f!="string"||f.indexOf(":")===-1))try{return new URL(f),ju(f,n.protocolAllowlist)?void 0:f}catch{}},[f,Ne,n.protocolAllowlist]),Me=Cn({select:$e=>{if(he)return!1;if(u?.exact){if(!mz($e.location.pathname,Q.pathname,n.basepath))return!1}else{const Xe=Nu($e.location.pathname,n.basepath),Ct=Nu(Q.pathname,n.basepath);if(!(Xe.startsWith(Ct)&&(Xe.length===Ct.length||Xe[Ct.length]==="/")))return!1}return(u?.includeSearch??!0)&&!Sa($e.location.search,Q.search,{partial:!u?.exact,ignoreUndefined:!u?.explicitUndefined})?!1:u?.includeHash?R&&$e.location.hash===Q.hash:!0}}),Je=Me?Ei(o,{})??k_:Zh,le=Me?Zh:Ei(c,{})??Zh,Ie=[A,Je.className,le.className].filter(Boolean).join(" "),Ye=(T||Je.style||le.style)&&{...T,...Je.style,...le.style},[Vt,Ut]=w.useState(!1),Mn=w.useRef(!1),nn=e.reloadDocument||he?!1:m??n.options.defaultPreload,At=p??n.options.defaultPreloadDelay??0,re=w.useCallback(()=>{n.preloadRoute({...V,_builtLocation:Q}).catch($e=>{console.warn($e),console.warn(d_)})},[n,V,Q]);Vk(a,w.useCallback($e=>{$e?.isIntersecting&&re()},[re]),A_,{disabled:!!k||nn!=="viewport"}),w.useEffect(()=>{Mn.current||!k&&nn==="render"&&(re(),Mn.current=!0)},[k,re,nn]);const Ze=$e=>{const Xe=$e.currentTarget.getAttribute("target"),Ct=C!==void 0?C:Xe;if(!k&&!O_($e)&&!$e.defaultPrevented&&(!Ct||Ct==="_self")&&$e.button===0){$e.preventDefault(),wp.flushSync(()=>{Ut(!0)});const Ke=n.subscribe("onResolved",()=>{Ke(),Ut(!1)});n.navigate({...V,replace:y,resetScroll:x,hashScrollIntoView:v,startTransition:b,viewTransition:N,ignoreBlocker:ee})}};if(he)return{...U,ref:a,href:he,...S&&{children:S},...C&&{target:C},...k&&{disabled:k},...T&&{style:T},...A&&{className:A},...z&&{onClick:z},...$&&{onBlur:$},...P&&{onFocus:P},...E&&{onMouseEnter:E},...O&&{onMouseLeave:O},...K&&{onTouchStart:K}};const ut=$e=>{if(k||nn!=="intent")return;if(!At){re();return}const Xe=$e.currentTarget;if(Zo.has(Xe))return;const Ct=setTimeout(()=>{Zo.delete(Xe),re()},At);Zo.set(Xe,Ct)},Qt=$e=>{k||nn!=="intent"||re()},Ve=$e=>{if(k||!nn||!At)return;const Xe=$e.currentTarget,Ct=Zo.get(Xe);Ct&&(clearTimeout(Ct),Zo.delete(Xe))};return{...U,...Je,...le,href:Ne?.href,ref:a,onClick:jr([z,Ze]),onBlur:jr([$,Ve]),onFocus:jr([P,ut]),onMouseEnter:jr([E,ut]),onMouseLeave:jr([O,Ve]),onTouchStart:jr([K,Qt]),disabled:!!k,target:C,...Ye&&{style:Ye},...Ie&&{className:Ie},...k&&z_,...Me&&__,...R&&Vt&&E_}}var Zh={},k_={className:"active"},z_={role:"link","aria-disabled":!0},__={"data-status":"active","aria-current":"page"},E_={"data-transitioning":"transitioning"},Zo=new WeakMap,A_={rootMargin:"100px"},jr=e=>t=>{for(const n of e)if(n){if(t.defaultPrevented)return;n(t)}};function T_(e,t,n,a){if(!a)return t?{href:e,external:!0}:{href:n.createHref(e)||"/",external:!1}}function R_(e){if(typeof e!="string")return!1;const t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var St=w.forwardRef((e,t)=>{const{_asChild:n,...a}=e,{type:o,...c}=C_(a,t),u=typeof a.children=="function"?a.children({isActive:c["data-status"]==="active"}):a.children;if(!n){const{disabled:f,...m}=c;return w.createElement("a",m,u)}return w.createElement(n,c,u)});function O_(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}var L_=class extends YS{constructor(e){super(e),this.useMatch=t=>Ii({select:t?.select,from:this.id,structuralSharing:t?.structuralSharing}),this.useRouteContext=t=>jp({...t,from:this.id}),this.useSearch=t=>Zu({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useParams=t=>Fu({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useLoaderDeps=t=>Sp({...t,from:this.id}),this.useLoaderData=t=>xp({...t,from:this.id}),this.useNavigate=()=>Bi({from:this.fullPath}),this.Link=us.forwardRef((t,n)=>r.jsx(St,{ref:n,from:this.fullPath,...t})),this.$$typeof=Symbol.for("react.memo")}};function Wn(e){return new L_(e)}function D_(){return e=>$_(e)}var M_=class extends f_{constructor(e){super(e),this.useMatch=t=>Ii({select:t?.select,from:this.id,structuralSharing:t?.structuralSharing}),this.useRouteContext=t=>jp({...t,from:this.id}),this.useSearch=t=>Zu({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useParams=t=>Fu({select:t?.select,structuralSharing:t?.structuralSharing,from:this.id}),this.useLoaderDeps=t=>Sp({...t,from:this.id}),this.useLoaderData=t=>xp({...t,from:this.id}),this.useNavigate=()=>Bi({from:this.fullPath}),this.Link=us.forwardRef((t,n)=>r.jsx(St,{ref:n,from:this.fullPath,...t})),this.$$typeof=Symbol.for("react.memo")}};function $_(e){return new M_(e)}function Pb(e){return typeof e=="object"?new Ub(e,{silent:!0}).createRoute(e):new Ub(e,{silent:!0}).createRoute}var Ub=class{constructor(e,t){this.path=e,this.createRoute=n=>{const a=Wn(n);return a.isRoot=!1,a},this.silent=t?.silent}},Ib=class{constructor(e){this.useMatch=t=>Ii({select:t?.select,from:this.options.id,structuralSharing:t?.structuralSharing}),this.useRouteContext=t=>jp({...t,from:this.options.id}),this.useSearch=t=>Zu({select:t?.select,structuralSharing:t?.structuralSharing,from:this.options.id}),this.useParams=t=>Fu({select:t?.select,structuralSharing:t?.structuralSharing,from:this.options.id}),this.useLoaderDeps=t=>Sp({...t,from:this.options.id}),this.useLoaderData=t=>xp({...t,from:this.options.id}),this.useNavigate=()=>Bi({from:Xn().routesById[this.options.id].fullPath}),this.options=e,this.$$typeof=Symbol.for("react.memo")}};function Bb(e){return typeof e=="object"?new Ib(e):t=>new Ib({id:e,...t})}function P_(e){const t=Cn({select:n=>`not-found-${n.location.pathname}-${n.status}`});return r.jsx(vp,{getResetKey:()=>t,onCatch:(n,a)=>{if(mn(n))e.onCatch?.(n,a);else throw n},errorComponent:({error:n})=>{if(mn(n))return e.fallback?.(n);throw n},children:e.children})}function U_(){return r.jsx("p",{children:"Not Found"})}function _r(e){return r.jsx(r.Fragment,{children:e.children})}function WS(e,t,n){return t.options.notFoundComponent?r.jsx(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?r.jsx(e.options.defaultNotFoundComponent,{...n}):r.jsx(U_,{})}function I_(){return Xn().isScrollRestoring,null}var ej=w.memo(function({matchId:t}){const n=Xn(),a=Cn({select:N=>{const S=N.matches.findIndex(k=>k.id===t),C=N.matches[S];return Mi(C),{routeId:C.routeId,ssr:C.ssr,_displayPending:C._displayPending,resetKey:N.loadedAt,parentRouteId:N.matches[S-1]?.routeId}},structuralSharing:!0}),o=n.routesById[a.routeId],c=o.options.pendingComponent??n.options.defaultPendingComponent,u=c?r.jsx(c,{}):null,f=o.options.errorComponent??n.options.defaultErrorComponent,m=o.options.onCatch??n.options.defaultOnCatch,p=o.isRoot?o.options.notFoundComponent??n.options.notFoundRoute?.options.component:o.options.notFoundComponent,v=a.ssr===!1||a.ssr==="data-only",y=(!o.isRoot||o.options.wrapInSuspense||v)&&(o.options.wrapInSuspense??c??(o.options.errorComponent?.preload||v))?w.Suspense:_r,b=f?vp:_r,x=p?P_:_r;return r.jsxs(o.isRoot?o.options.shellComponent??_r:_r,{children:[r.jsx(Gu.Provider,{value:t,children:r.jsx(y,{fallback:u,children:r.jsx(b,{getResetKey:()=>a.resetKey,errorComponent:f||bp,onCatch:(N,S)=>{if(mn(N))throw N;m?.(N,S)},children:r.jsx(x,{fallback:N=>{if(!p||N.routeId&&N.routeId!==a.routeId||!N.routeId&&!o.isRoot)throw N;return w.createElement(p,N)},children:v||a._displayPending?r.jsx(m_,{fallback:u,children:r.jsx(qb,{matchId:t})}):r.jsx(qb,{matchId:t})})})})}),a.parentRouteId===ja&&n.options.scrollRestoration?r.jsxs(r.Fragment,{children:[r.jsx(B_,{}),r.jsx(I_,{})]}):null]})});function B_(){const e=Xn(),t=w.useRef(void 0);return r.jsx("script",{suppressHydrationWarning:!0,ref:n=>{n&&(t.current===void 0||t.current.href!==e.latestLocation.href)&&(e.emit({type:"onRendered",...Na(e.state)}),t.current=e.latestLocation)}},e.latestLocation.state.__TSR_key)}var qb=w.memo(function({matchId:t}){const n=Xn(),{match:a,key:o,routeId:c}=Cn({select:m=>{const p=m.matches.find(b=>b.id===t),v=p.routeId,y=(n.routesById[v].options.remountDeps??n.options.defaultRemountDeps)?.({routeId:v,loaderDeps:p.loaderDeps,params:p._strictParams,search:p._strictSearch});return{key:y?JSON.stringify(y):void 0,routeId:v,match:{id:p.id,status:p.status,error:p.error,_forcePending:p._forcePending,_displayPending:p._displayPending}}},structuralSharing:!0}),u=n.routesById[c],f=w.useMemo(()=>{const m=u.options.component??n.options.defaultComponent;return m?r.jsx(m,{},o):r.jsx(Np,{})},[o,u.options.component,n.options.defaultComponent]);if(a._displayPending)throw n.getMatch(a.id)?._nonReactive.displayPendingPromise;if(a._forcePending)throw n.getMatch(a.id)?._nonReactive.minPendingPromise;if(a.status==="pending"){const m=u.options.pendingMinMs??n.options.defaultPendingMinMs;if(m){const p=n.getMatch(a.id);if(p&&!p._nonReactive.minPendingPromise){const v=Pr();p._nonReactive.minPendingPromise=v,setTimeout(()=>{v.resolve(),p._nonReactive.minPendingPromise=void 0},m)}}throw n.getMatch(a.id)?._nonReactive.loadPromise}if(a.status==="notFound")return Mi(mn(a.error)),WS(n,u,a.error);if(a.status==="redirected")throw Mi(Nn(a.error)),n.getMatch(a.id)?._nonReactive.loadPromise;if(a.status==="error")throw a.error;return f}),Np=w.memo(function(){const t=Xn(),n=w.useContext(Gu),a=Cn({select:p=>p.matches.find(v=>v.id===n)?.routeId}),o=t.routesById[a],c=Cn({select:p=>{const v=p.matches.find(y=>y.id===n);return Mi(v),v.globalNotFound}}),u=Cn({select:p=>{const v=p.matches;return v[v.findIndex(y=>y.id===n)+1]?.id}}),f=t.options.defaultPendingComponent?r.jsx(t.options.defaultPendingComponent,{}):null;if(c)return WS(t,o,void 0);if(!u)return null;const m=r.jsx(ej,{matchId:u});return a===ja?r.jsx(w.Suspense,{fallback:f,children:m}):m});function q_(){const e=Xn(),t=w.useRef({router:e,mounted:!1}),[n,a]=w.useState(!1),{hasPendingMatches:o,isLoading:c}=Cn({select:y=>({isLoading:y.isLoading,hasPendingMatches:y.matches.some(b=>b.status==="pending")}),structuralSharing:!0}),u=$h(c),f=c||n||o,m=$h(f),p=c||o,v=$h(p);return e.startTransition=y=>{a(!0),w.startTransition(()=>{y(),a(!1)})},w.useEffect(()=>{const y=e.history.subscribe(e.load),b=e.buildLocation({to:e.latestLocation.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});return Ri(e.latestLocation.publicHref)!==Ri(b.publicHref)&&e.commitLocation({...b,replace:!0}),()=>{y()}},[e,e.history]),Kc(()=>{if(typeof window<"u"&&e.ssr||t.current.router===e&&t.current.mounted)return;t.current={router:e,mounted:!0},(async()=>{try{await e.load()}catch(b){console.error(b)}})()},[e]),Kc(()=>{u&&!c&&e.emit({type:"onLoad",...Na(e.state)})},[u,e,c]),Kc(()=>{v&&!p&&e.emit({type:"onBeforeRouteMount",...Na(e.state)})},[p,v,e]),Kc(()=>{if(m&&!f){const y=Na(e.state);e.emit({type:"onResolved",...y}),e.__store.setState(b=>({...b,status:"idle",resolvedLocation:b.location})),y.hrefChanged&&Nz(e)}},[f,m,e]),null}function K_(){const e=Xn(),t=e.routesById[ja].options.pendingComponent??e.options.defaultPendingComponent,n=t?r.jsx(t,{}):null,a=r.jsxs(typeof document<"u"&&e.ssr?_r:w.Suspense,{fallback:n,children:[r.jsx(q_,{}),r.jsx(H_,{})]});return e.options.InnerWrap?r.jsx(e.options.InnerWrap,{children:a}):a}function H_(){const e=Xn(),t=Cn({select:o=>o.matches[0]?.id}),n=Cn({select:o=>o.loadedAt}),a=t?r.jsx(ej,{matchId:t}):null;return r.jsx(Gu.Provider,{value:t,children:e.options.disableGlobalCatchBoundary?a:r.jsx(vp,{getResetKey:()=>n,errorComponent:bp,onCatch:void 0,children:a})})}var G_=e=>new F_(e),F_=class extends i_{constructor(e){super(e)}};typeof globalThis<"u"?(globalThis.createFileRoute=Pb,globalThis.createLazyFileRoute=Bb):typeof window<"u"&&(window.createFileRoute=Pb,window.createLazyFileRoute=Bb);function Z_({router:e,children:t,...n}){Object.keys(n).length>0&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});const a=r.jsx(XS.Provider,{value:e,children:t});return e.options.Wrap?r.jsx(e.options.Wrap,{children:a}):a}function V_({router:e,...t}){return r.jsx(Z_,{router:e,...t,children:r.jsx(K_,{})})}function Q_(e){return Cn({select:t=>t.location})}class Eu extends Error{code;statusCode;constructor(t,n,a){super(t),this.name="ApiError",this.code=a??"UNKNOWN",this.statusCode=n}}function Y_(){return typeof window<"u"&&window.__CANONRY_CONFIG__?.basePath?window.__CANONRY_CONFIG__.basePath.replace(/\/$/,"")+"/api/v1":"/api/v1"}const J_=Y_();function X_(){return""}function Kb(){return!!X_()}async function ye(e,t){const n=await fetch(`${J_}${e}`,{...t,credentials:t?.credentials??"same-origin",headers:{"Content-Type":"application/json",...t?.headers}});if(!n.ok){const a=await n.text();let o=`API ${n.status}: ${n.statusText}`,c;if(a)try{const u=JSON.parse(a);typeof u.error=="string"?o=u.error:u.error?.message?(o=u.error.message,c=u.error.code):u.message&&(o=u.message)}catch{o=a}throw new Eu(o,n.status,c)}if(n.status!==204)return n.json()}function tj(){return ye("/projects")}function nj(e){return ye(`/projects/${encodeURIComponent(e)}`)}function sj(){return ye("/runs")}function Ur(e){return ye(`/runs/${encodeURIComponent(e)}`)}function W_(e){return ye(`/projects/${encodeURIComponent(e)}/keywords`)}function ij(e){return ye(`/projects/${encodeURIComponent(e)}/competitors`)}function aj(e,t){const n=new URLSearchParams;t!==void 0&&n.set("location",t);const a=n.toString();return ye(`/projects/${encodeURIComponent(e)}/timeline${a?`?${a}`:""}`)}function Vu(e,t){return ye(`/projects/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)})}function e2(e,t){return ye(`/projects/${encodeURIComponent(e)}/keywords`,{method:"PUT",body:JSON.stringify({keywords:t})})}function t2(e,t){return ye(`/projects/${encodeURIComponent(e)}/keywords`,{method:"POST",body:JSON.stringify({keywords:t})})}function rj(e,t){return ye(`/projects/${encodeURIComponent(e)}/competitors`,{method:"PUT",body:JSON.stringify({competitors:t})})}async function Hb(e,t){const n=await nj(e);return Vu(e,{displayName:n.displayName,canonicalDomain:n.canonicalDomain,ownedDomains:t,country:n.country,language:n.language,tags:n.tags,labels:n.labels,providers:n.providers,locations:n.locations,defaultLocation:n.defaultLocation})}async function n2(e,t){const n=await nj(e);return Vu(e,{displayName:t.displayName??n.displayName,canonicalDomain:t.canonicalDomain??n.canonicalDomain,ownedDomains:t.ownedDomains??n.ownedDomains,country:t.country??n.country,language:t.language??n.language,tags:n.tags,labels:n.labels,providers:n.providers,locations:t.locations??n.locations,defaultLocation:t.defaultLocation!==void 0?t.defaultLocation:n.defaultLocation})}function s2(e,t){const n={};return t?.location&&(n.location=t.location),t?.allLocations&&(n.allLocations=!0),t?.noLocation&&(n.noLocation=!0),ye(`/projects/${encodeURIComponent(e)}/runs`,{method:"POST",body:JSON.stringify(n)})}function i2(e,t){return ye(`/projects/${encodeURIComponent(e)}/locations`,{method:"POST",body:JSON.stringify(t)})}async function a2(e,t){await ye(`/projects/${encodeURIComponent(e)}/locations/${encodeURIComponent(t)}`,{method:"DELETE"})}function r2(e,t){return ye(`/projects/${encodeURIComponent(e)}/locations/default`,{method:"PUT",body:JSON.stringify({label:t})})}async function o2(e){await ye(`/projects/${encodeURIComponent(e)}`,{method:"DELETE",body:"{}"})}function l2(e){return ye(`/projects/${encodeURIComponent(e)}/export`)}function Cp(){return ye("/settings")}function c2(){return ye("/session")}function u2(e){return ye("/session/setup",{method:"POST",body:JSON.stringify({password:e})})}function d2(e){return ye("/session",{method:"POST",body:JSON.stringify({password:e})})}function f2(e,t){return ye(`/settings/providers/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)})}function h2(e){return ye("/settings/google",{method:"PUT",body:JSON.stringify(e)})}async function m2(e){try{return await ye(`/projects/${encodeURIComponent(e)}/schedule`)}catch(t){if(t instanceof Error&&t.message.includes("404"))return null;throw t}}function Gb(e,t){return ye(`/projects/${encodeURIComponent(e)}/schedule`,{method:"PUT",body:JSON.stringify(t)})}async function p2(e){await ye(`/projects/${encodeURIComponent(e)}/schedule`,{method:"DELETE",body:"{}"})}function g2(e){return ye(`/projects/${encodeURIComponent(e)}/notifications`)}function y2(e,t){return ye(`/projects/${encodeURIComponent(e)}/notifications`,{method:"POST",body:JSON.stringify(t)})}async function v2(e,t){await ye(`/projects/${encodeURIComponent(e)}/notifications/${encodeURIComponent(t)}`,{method:"DELETE",body:"{}"})}function b2(e,t){return ye(`/projects/${encodeURIComponent(e)}/notifications/${encodeURIComponent(t)}/test`,{method:"POST",body:"{}"})}function x2(e,t,n){return ye(`/projects/${encodeURIComponent(e)}/keywords/generate`,{method:"POST",body:JSON.stringify({provider:t,count:n})})}function S2(e){return ye("/apply",{method:"POST",body:JSON.stringify(e)})}function j2(e){return ye("/runs",{method:"POST",body:JSON.stringify(e??{})})}function oj(e){return ye(`/projects/${encodeURIComponent(e)}/google/connections`)}function w2(e,t){return ye(`/projects/${encodeURIComponent(e)}/google/connect`,{method:"POST",body:JSON.stringify({type:t})})}function N2(e,t){return ye(`/projects/${encodeURIComponent(e)}/google/connections/${encodeURIComponent(t)}`,{method:"DELETE",body:"{}"})}function C2(e){return ye(`/projects/${encodeURIComponent(e)}/google/properties`)}function k2(e,t,n){return ye(`/projects/${encodeURIComponent(e)}/google/connections/${encodeURIComponent(t)}/property`,{method:"PUT",body:JSON.stringify({propertyId:n})})}function z2(e,t,n){return ye(`/projects/${encodeURIComponent(e)}/google/connections/${encodeURIComponent(t)}/sitemap`,{method:"PUT",body:JSON.stringify({sitemapUrl:n})})}function lj(e,t){return ye(`/projects/${encodeURIComponent(e)}/google/gsc/sync`,{method:"POST",body:JSON.stringify(t??{})})}function _2(e,t){const n=new URLSearchParams;t?.startDate&&n.set("startDate",t.startDate),t?.endDate&&n.set("endDate",t.endDate),t?.query&&n.set("query",t.query),t?.page&&n.set("page",t.page),t?.limit!==void 0&&n.set("limit",String(t.limit));const a=n.toString()?`?${n.toString()}`:"";return ye(`/projects/${encodeURIComponent(e)}/google/gsc/performance${a}`)}function E2(e,t){return ye(`/projects/${encodeURIComponent(e)}/google/gsc/inspect`,{method:"POST",body:JSON.stringify({url:t})})}function A2(e,t){const n=new URLSearchParams;t?.url&&n.set("url",t.url),n.set("limit",String(t.limit));const a=n.toString()?`?${n.toString()}`:"";return ye(`/projects/${encodeURIComponent(e)}/google/gsc/inspections${a}`)}function T2(e){return ye(`/projects/${encodeURIComponent(e)}/google/gsc/deindexed`)}function kp(e){return ye(`/projects/${encodeURIComponent(e)}/google/gsc/coverage`)}function R2(e,t){const n=new URLSearchParams,a=n.toString()?`?${n.toString()}`:"";return ye(`/projects/${encodeURIComponent(e)}/google/gsc/coverage/history${a}`)}function O2(e,t){return ye(`/projects/${encodeURIComponent(e)}/google/gsc/inspect-sitemap`,{method:"POST",body:JSON.stringify(t??{})})}function L2(e){return ye(`/projects/${encodeURIComponent(e)}/google/gsc/sitemaps`)}function D2(e){return ye(`/projects/${encodeURIComponent(e)}/google/gsc/discover-sitemaps`,{method:"POST",body:"{}"})}function Fb(){return ye("/cdp/status")}function M2(e,t){return ye("/settings/cdp",{method:"PUT",body:JSON.stringify({host:e,port:t})})}function Zb(e,t){return ye(`/projects/${encodeURIComponent(e)}/google/indexing/request`,{method:"POST",body:JSON.stringify(t)})}function cj(e){return ye(`/projects/${encodeURIComponent(e)}/bing/status`)}function $2(e,t){return ye(`/projects/${encodeURIComponent(e)}/bing/connect`,{method:"POST",body:JSON.stringify({apiKey:t})})}function P2(e){return ye(`/projects/${encodeURIComponent(e)}/bing/disconnect`,{method:"DELETE",body:"{}"})}function U2(e){return ye(`/projects/${encodeURIComponent(e)}/bing/sites`)}function I2(e,t){return ye(`/projects/${encodeURIComponent(e)}/bing/set-site`,{method:"POST",body:JSON.stringify({siteUrl:t})})}function zp(e){return ye(`/projects/${encodeURIComponent(e)}/bing/coverage`)}function uj(e,t){const n=new URLSearchParams,a=n.toString()?`?${n.toString()}`:"";return ye(`/projects/${encodeURIComponent(e)}/bing/inspections${a}`)}function dj(e,t){return ye(`/projects/${encodeURIComponent(e)}/bing/inspect-url`,{method:"POST",body:JSON.stringify({url:t})})}function Vb(e,t){return ye(`/projects/${encodeURIComponent(e)}/bing/request-indexing`,{method:"POST",body:JSON.stringify(t)})}function B2(e){return ye(`/projects/${encodeURIComponent(e)}/bing/performance`)}function q2(e){return ye("/settings/bing",{method:"PUT",body:JSON.stringify({apiKey:e})})}function K2(e,t){const n=t?`?window=${t}`:"";return ye(`/projects/${encodeURIComponent(e)}/analytics/metrics${n}`)}function H2(e,t){const n=t?`?window=${t}`:"";return ye(`/projects/${encodeURIComponent(e)}/analytics/gaps${n}`)}function G2(e,t){const n=t?`?window=${t}`:"";return ye(`/projects/${encodeURIComponent(e)}/analytics/sources${n}`)}function Qb(e){return ye(`/projects/${encodeURIComponent(e)}/ga/status`)}function Yb(e,t){return ye(`/projects/${encodeURIComponent(e)}/ga/traffic`)}function fj(e,t){return ye(`/projects/${encodeURIComponent(e)}/ga/sync`,{method:"POST",body:JSON.stringify({})})}function F2(e,t){return ye(`/projects/${encodeURIComponent(e)}/ga/connect`,{method:"POST",body:JSON.stringify(t)})}function Z2(e){return ye(`/projects/${encodeURIComponent(e)}/ga/disconnect`,{method:"DELETE",body:"{}"})}async function V2(e,t){try{const n=await fetch(e);if(!n.ok)return{label:t,state:"error",detail:`HTTP ${n.status}`};const a=await n.json(),o=typeof a.version=="string"?a.version:"unknown",c=typeof a.databaseUrlConfigured=="boolean"?a.databaseUrlConfigured:void 0,u=typeof a.lastHeartbeatAt=="string"?a.lastHeartbeatAt:void 0,f=[o,c===!1?"database not configured":"database configured",u?`heartbeat ${u}`:void 0].filter(Boolean).join(" · ");return{label:t,state:"ok",detail:f,version:o,databaseConfigured:c,lastHeartbeatAt:u}}catch(n){return{label:t,state:"error",detail:n instanceof Error?n.message:"unreachable"}}}const Q2=6e3,Y2=5,J2=180;let on=[],X2=0;const Tm=new Set,Rm=new Map,Om=new Map;function Au(){const e=[...on];for(const t of Tm)t(e)}function _p(e){const t=Rm.get(e);t&&(clearTimeout(t),Rm.delete(e));const n=Om.get(e);n&&(clearTimeout(n),Om.delete(e))}function hj(e){_p(e);const t=on.length;on=on.filter(n=>n.id!==e),on.length!==t&&Au()}function Jb(e){_p(e.id),Rm.set(e.id,setTimeout(()=>{Lm(e.id)},e.durationMs))}function W2(e,t,n){return typeof e=="string"?{title:e,tone:t,durationMs:n}:e}function Fe(e,t="negative",n=Q2){const a=W2(e,t,n),o={id:String(++X2),title:a.title,detail:a.detail,tone:a.tone??t,durationMs:a.durationMs??n,dedupeKey:a.dedupeKey,cta:a.cta,state:"open"};if(a.dedupeKey){const c=on.find(u=>u.dedupeKey===a.dedupeKey);if(c){if((a.dedupeMode??"drop")==="drop")return c.id;const u={...c,title:o.title,detail:o.detail,tone:o.tone,durationMs:o.durationMs,cta:o.cta,state:"open"};return on=on.map(f=>f.id===c.id?u:f),Au(),Jb(u),c.id}}return on.length>=Y2&&hj(on[0].id),on=[...on,o],Au(),Jb(o),o.id}function Lm(e){const t=on.find(n=>n.id===e);!t||t.state==="closing"||(_p(e),on=on.map(n=>n.id===e?{...n,state:"closing"}:n),Au(),Om.set(e,setTimeout(()=>{hj(e)},J2)))}function eE(e){return Tm.add(e),()=>{Tm.delete(e)}}function Xb(){return on}function tE(){return new Bk({defaultOptions:{queries:{staleTime:3e4,retry:1,refetchOnWindowFocus:!1}},mutationCache:new zS({onError:(e,t,n,a)=>{a.meta?.skipGlobalErrorToast||Fe({title:e instanceof Error?e.message:"An unexpected error occurred",tone:"negative"})}})})}const nE=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),sE=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,a)=>a?a.toUpperCase():n.toLowerCase()),Wb=e=>{const t=sE(e);return t.charAt(0).toUpperCase()+t.slice(1)},mj=(...e)=>e.filter((t,n,a)=>!!t&&t.trim()!==""&&a.indexOf(t)===n).join(" ").trim(),iE=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var aE={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const rE=w.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:a,className:o="",children:c,iconNode:u,...f},m)=>w.createElement("svg",{ref:m,...aE,width:t,height:t,stroke:e,strokeWidth:a?Number(n)*24/Number(t):n,className:mj("lucide",o),...!c&&!iE(f)&&{"aria-hidden":"true"},...f},[...u.map(([p,v])=>w.createElement(p,v)),...Array.isArray(c)?c:[c]]));const tn=(e,t)=>{const n=w.forwardRef(({className:a,...o},c)=>w.createElement(rE,{ref:c,iconNode:t,className:mj(`lucide-${nE(Wb(e))}`,`lucide-${e}`,a),...o}));return n.displayName=Wb(e),n};const oE=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Qu=tn("chevron-right",oE);const lE=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],cE=tn("download",lE);const uE=[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]],dE=tn("github",uE);const fE=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],hE=tn("globe",fE);const mE=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],pE=tn("layout-dashboard",mE);const gE=[["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 18h16",key:"19g7jn"}],["path",{d:"M4 6h16",key:"1o0s65"}]],yE=tn("menu",gE);const vE=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],bE=tn("play",vE);const xE=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],ex=tn("plus",xE);const SE=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],tx=tn("refresh-cw",SE);const jE=[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]],wE=tn("rocket",jE);const NE=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],CE=tn("rotate-ccw",NE);const kE=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],zE=tn("settings",kE);const _E=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],EE=tn("trash-2",_E);const AE=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],TE=tn("triangle-alert",AE);const RE=[["path",{d:"m19 5 3-3",key:"yk6iyv"}],["path",{d:"m2 22 3-3",key:"19mgm9"}],["path",{d:"M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z",key:"goz73y"}],["path",{d:"M7.5 13.5 10 11",key:"7xgeeb"}],["path",{d:"M10.5 16.5 13 14",key:"10btkg"}],["path",{d:"m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z",key:"1snsnr"}]],OE=tn("unplug",RE);const LE=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],DE=tn("upload",LE);const ME=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Yu=tn("x",ME);function $E(e){const t=e.match(/^(\[.*?\])\s*(.+)/);if(t){const n=t[1],a=t[2],o=a.indexOf("{");if(o>=0){const c=a.slice(0,o).trim(),u=a.slice(o);try{const f=JSON.parse(u);return`${n} ${c}
10
-
11
- ${JSON.stringify(f,null,2)}`}catch{}}return`${n}
12
- ${a}`}try{const n=JSON.parse(e);return JSON.stringify(n,null,2)}catch{return e}}function Ju(e){return e.split("-").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function cs(e){if(!e)return"—";try{return new Date(e).toLocaleString()}catch{return e}}function nx(e){return e===null?"Unknown":e?"Pass":"Fail"}function Dm(e){return e===0?"12:00 AM":e<12?`${e}:00 AM`:e===12?"12:00 PM":`${e-12}:00 PM`}function PE(e,t){return e==="twice-daily"?"twice-daily":e.startsWith("weekly@")?`${e}@${t}`:`daily@${t}`}function UE(e,t){if(!e)return{freq:"custom",hour:6,customCron:t};if(e==="twice-daily")return{freq:"twice-daily",hour:6,customCron:""};const n=e.match(/^daily(?:@(\d+))?$/);if(n)return{freq:"daily",hour:n[1]?parseInt(n[1]):6,customCron:""};const a=e.match(/^(weekly@(?:mon|tue|wed|thu|fri|sat|sun))(?:@(\d+))?$/);return a?{freq:a[1],hour:a[2]?parseInt(a[2]):6,customCron:""}:{freq:"custom",hour:6,customCron:t}}function Vh(e,t,n){const a=n==="UTC"?"UTC":n.split("/").pop()?.replace(/_/g," ")??n;if(!e)return`Custom: ${t} · ${a}`;if(e==="twice-daily")return`Twice a day (6am & 6pm) · ${a}`;const o=e.match(/^daily(?:@(\d+))?$/);if(o){const u=o[1]?parseInt(o[1]):6;return`Every day at ${Dm(u)} · ${a}`}const c=e.match(/^weekly@(mon|tue|wed|thu|fri|sat|sun)(?:@(\d+))?$/);if(c){const u={mon:"Monday",tue:"Tuesday",wed:"Wednesday",thu:"Thursday",fri:"Friday",sat:"Saturday",sun:"Sunday"},f=c[2]?parseInt(c[2]):6;return`Every ${u[c[1]]} at ${Dm(f)} · ${a}`}return`${e} · ${a}`}const pj="canonry.run-tracker",Mm=new Set;let sx=!1,IE=0,Xu={runs:{},batches:{}};function BE(){const e=za();for(const t of Mm)t(e)}function qE(e){if(!e)return{runs:{},batches:{}};try{const t=JSON.parse(e);return{runs:t.runs??{},batches:t.batches??{}}}catch{return{runs:{},batches:{}}}}function KE(){typeof window>"u"||window.sessionStorage.setItem(pj,JSON.stringify(Xu))}function gj(){sx||(sx=!0,!(typeof window>"u")&&(Xu=qE(window.sessionStorage.getItem(pj))))}function Wu(e){Xu=e,KE(),BE()}function za(){return gj(),Xu}function HE(e){return gj(),Mm.add(e),()=>{Mm.delete(e)}}function yj(e){const t=za();Wu({...t,runs:{...t.runs,[e.id]:{runId:e.id,projectId:e.projectId,projectLabel:e.projectLabel,kind:e.kind,sourceAction:e.sourceAction,lastAnnouncedStatus:e.lastAnnouncedStatus??"queued"}}})}function ix(e){const t=za();if(!t.runs[e])return;const{[e]:n,...a}=t.runs;Wu({...t,runs:a})}function GE(e){const t=za(),n=`batch_${Date.now()}_${++IE}`;return Wu({...t,batches:{...t.batches,[n]:{batchId:n,runIds:e.runIds,queuedCount:e.queuedCount,skippedCount:e.skippedCount}}}),n}function FE(e){const t=za();if(!t.batches[e])return;const{[e]:n,...a}=t.batches;Wu({...t,batches:a})}function ZE(e){return e==="completed"||e==="partial"||e==="failed"||e==="cancelled"}function VE(e,t){let n=0,a=0,o=0,c=0,u=0;for(const f of e){const m=t[f]?.status;m==="completed"?n+=1:m==="partial"?a+=1:m==="failed"?o+=1:m==="cancelled"?c+=1:u+=1}return{completed:n,partial:a,failed:o,cancelled:c,pending:u,finished:u===0}}function ax(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Ep(...e){return t=>{let n=!1;const a=e.map(o=>{const c=ax(o,t);return!n&&typeof c=="function"&&(n=!0),c});if(n)return()=>{for(let o=0;o<a.length;o++){const c=a[o];typeof c=="function"?c():ax(e[o],null)}}}}function Ta(...e){return w.useCallback(Ep(...e),e)}var QE=Symbol.for("react.lazy"),Tu=sp[" use ".trim().toString()];function YE(e){return typeof e=="object"&&e!==null&&"then"in e}function vj(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===QE&&"_payload"in e&&YE(e._payload)}function JE(e){const t=WE(e),n=w.forwardRef((a,o)=>{let{children:c,...u}=a;vj(c)&&typeof Tu=="function"&&(c=Tu(c._payload));const f=w.Children.toArray(c),m=f.find(tA);if(m){const p=m.props.children,v=f.map(y=>y===m?w.Children.count(p)>1?w.Children.only(null):w.isValidElement(p)?p.props.children:null:y);return r.jsx(t,{...u,ref:o,children:w.isValidElement(p)?w.cloneElement(p,void 0,v):null})}return r.jsx(t,{...u,ref:o,children:c})});return n.displayName=`${e}.Slot`,n}var XE=JE("Slot");function WE(e){const t=w.forwardRef((n,a)=>{let{children:o,...c}=n;if(vj(o)&&typeof Tu=="function"&&(o=Tu(o._payload)),w.isValidElement(o)){const u=sA(o),f=nA(c,o.props);return o.type!==w.Fragment&&(f.ref=a?Ep(a,u):u),w.cloneElement(o,f)}return w.Children.count(o)>1?w.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var eA=Symbol("radix.slottable");function tA(e){return w.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===eA}function nA(e,t){const n={...t};for(const a in t){const o=e[a],c=t[a];/^on[A-Z]/.test(a)?o&&c?n[a]=(...f)=>{const m=c(...f);return o(...f),m}:o&&(n[a]=o):a==="style"?n[a]={...o,...c}:a==="className"&&(n[a]=[o,c].filter(Boolean).join(" "))}return{...e,...n}}function sA(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function bj(e){var t,n,a="";if(typeof e=="string"||typeof e=="number")a+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=bj(e[t]))&&(a&&(a+=" "),a+=n)}else for(n in e)e[n]&&(a&&(a+=" "),a+=n);return a}function xj(){for(var e,t,n=0,a="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=bj(e))&&(a&&(a+=" "),a+=t);return a}const rx=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,ox=xj,Sj=(e,t)=>n=>{var a;if(t?.variants==null)return ox(e,n?.class,n?.className);const{variants:o,defaultVariants:c}=t,u=Object.keys(o).map(p=>{const v=n?.[p],y=c?.[p];if(v===null)return null;const b=rx(v)||rx(y);return o[p][b]}),f=n&&Object.entries(n).reduce((p,v)=>{let[y,b]=v;return b===void 0||(p[y]=b),p},{}),m=t==null||(a=t.compoundVariants)===null||a===void 0?void 0:a.reduce((p,v)=>{let{class:y,className:b,...x}=v;return Object.entries(x).every(N=>{let[S,C]=N;return Array.isArray(C)?C.includes({...c,...f}[S]):{...c,...f}[S]===C})?[...p,y,b]:p},[]);return ox(e,u,m,n?.class,n?.className)},iA=(e,t)=>{const n=new Array(e.length+t.length);for(let a=0;a<e.length;a++)n[a]=e[a];for(let a=0;a<t.length;a++)n[e.length+a]=t[a];return n},aA=(e,t)=>({classGroupId:e,validator:t}),jj=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Ru="-",lx=[],rA="arbitrary..",oA=e=>{const t=cA(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:a}=e;return{getClassGroupId:u=>{if(u.startsWith("[")&&u.endsWith("]"))return lA(u);const f=u.split(Ru),m=f[0]===""&&f.length>1?1:0;return wj(f,m,t)},getConflictingClassGroupIds:(u,f)=>{if(f){const m=a[u],p=n[u];return m?p?iA(p,m):m:p||lx}return n[u]||lx}}},wj=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const o=e[t],c=n.nextPart.get(o);if(c){const p=wj(e,t+1,c);if(p)return p}const u=n.validators;if(u===null)return;const f=t===0?e.join(Ru):e.slice(t).join(Ru),m=u.length;for(let p=0;p<m;p++){const v=u[p];if(v.validator(f))return v.classGroupId}},lA=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),a=t.slice(0,n);return a?rA+a:void 0})(),cA=e=>{const{theme:t,classGroups:n}=e;return uA(n,t)},uA=(e,t)=>{const n=jj();for(const a in e){const o=e[a];Ap(o,n,a,t)}return n},Ap=(e,t,n,a)=>{const o=e.length;for(let c=0;c<o;c++){const u=e[c];dA(u,t,n,a)}},dA=(e,t,n,a)=>{if(typeof e=="string"){fA(e,t,n);return}if(typeof e=="function"){hA(e,t,n,a);return}mA(e,t,n,a)},fA=(e,t,n)=>{const a=e===""?t:Nj(t,e);a.classGroupId=n},hA=(e,t,n,a)=>{if(pA(e)){Ap(e(a),t,n,a);return}t.validators===null&&(t.validators=[]),t.validators.push(aA(n,e))},mA=(e,t,n,a)=>{const o=Object.entries(e),c=o.length;for(let u=0;u<c;u++){const[f,m]=o[u];Ap(m,Nj(t,f),n,a)}},Nj=(e,t)=>{let n=e;const a=t.split(Ru),o=a.length;for(let c=0;c<o;c++){const u=a[c];let f=n.nextPart.get(u);f||(f=jj(),n.nextPart.set(u,f)),n=f}return n},pA=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,gA=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),a=Object.create(null);const o=(c,u)=>{n[c]=u,t++,t>e&&(t=0,a=n,n=Object.create(null))};return{get(c){let u=n[c];if(u!==void 0)return u;if((u=a[c])!==void 0)return o(c,u),u},set(c,u){c in n?n[c]=u:o(c,u)}}},$m="!",cx=":",yA=[],ux=(e,t,n,a,o)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:a,isExternal:o}),vA=e=>{const{prefix:t,experimentalParseClassName:n}=e;let a=o=>{const c=[];let u=0,f=0,m=0,p;const v=o.length;for(let S=0;S<v;S++){const C=o[S];if(u===0&&f===0){if(C===cx){c.push(o.slice(m,S)),m=S+1;continue}if(C==="/"){p=S;continue}}C==="["?u++:C==="]"?u--:C==="("?f++:C===")"&&f--}const y=c.length===0?o:o.slice(m);let b=y,x=!1;y.endsWith($m)?(b=y.slice(0,-1),x=!0):y.startsWith($m)&&(b=y.slice(1),x=!0);const N=p&&p>m?p-m:void 0;return ux(c,x,b,N)};if(t){const o=t+cx,c=a;a=u=>u.startsWith(o)?c(u.slice(o.length)):ux(yA,!1,u,void 0,!0)}if(n){const o=a;a=c=>n({className:c,parseClassName:o})}return a},bA=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,a)=>{t.set(n,1e6+a)}),n=>{const a=[];let o=[];for(let c=0;c<n.length;c++){const u=n[c],f=u[0]==="[",m=t.has(u);f||m?(o.length>0&&(o.sort(),a.push(...o),o=[]),a.push(u)):o.push(u)}return o.length>0&&(o.sort(),a.push(...o)),a}},xA=e=>({cache:gA(e.cacheSize),parseClassName:vA(e),sortModifiers:bA(e),...oA(e)}),SA=/\s+/,jA=(e,t)=>{const{parseClassName:n,getClassGroupId:a,getConflictingClassGroupIds:o,sortModifiers:c}=t,u=[],f=e.trim().split(SA);let m="";for(let p=f.length-1;p>=0;p-=1){const v=f[p],{isExternal:y,modifiers:b,hasImportantModifier:x,baseClassName:N,maybePostfixModifierPosition:S}=n(v);if(y){m=v+(m.length>0?" "+m:m);continue}let C=!!S,k=a(C?N.substring(0,S):N);if(!k){if(!C){m=v+(m.length>0?" "+m:m);continue}if(k=a(N),!k){m=v+(m.length>0?" "+m:m);continue}C=!1}const T=b.length===0?"":b.length===1?b[0]:c(b).join(":"),A=x?T+$m:T,z=A+k;if(u.indexOf(z)>-1)continue;u.push(z);const $=o(k,C);for(let P=0;P<$.length;++P){const E=$[P];u.push(A+E)}m=v+(m.length>0?" "+m:m)}return m},wA=(...e)=>{let t=0,n,a,o="";for(;t<e.length;)(n=e[t++])&&(a=Cj(n))&&(o&&(o+=" "),o+=a);return o},Cj=e=>{if(typeof e=="string")return e;let t,n="";for(let a=0;a<e.length;a++)e[a]&&(t=Cj(e[a]))&&(n&&(n+=" "),n+=t);return n},NA=(e,...t)=>{let n,a,o,c;const u=m=>{const p=t.reduce((v,y)=>y(v),e());return n=xA(p),a=n.cache.get,o=n.cache.set,c=f,f(m)},f=m=>{const p=a(m);if(p)return p;const v=jA(m,n);return o(m,v),v};return c=u,(...m)=>c(wA(...m))},CA=[],Zt=e=>{const t=n=>n[e]||CA;return t.isThemeGetter=!0,t},kj=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,zj=/^\((?:(\w[\w-]*):)?(.+)\)$/i,kA=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,zA=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,_A=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,EA=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,AA=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,TA=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,wi=e=>kA.test(e),Ue=e=>!!e&&!Number.isNaN(Number(e)),Ni=e=>!!e&&Number.isInteger(Number(e)),Qh=e=>e.endsWith("%")&&Ue(e.slice(0,-1)),Gs=e=>zA.test(e),_j=()=>!0,RA=e=>_A.test(e)&&!EA.test(e),Tp=()=>!1,OA=e=>AA.test(e),LA=e=>TA.test(e),DA=e=>!je(e)&&!we(e),MA=e=>qi(e,Tj,Tp),je=e=>kj.test(e),fa=e=>qi(e,Rj,RA),dx=e=>qi(e,HA,Ue),$A=e=>qi(e,Lj,_j),PA=e=>qi(e,Oj,Tp),fx=e=>qi(e,Ej,Tp),UA=e=>qi(e,Aj,LA),Fc=e=>qi(e,Dj,OA),we=e=>zj.test(e),Vo=e=>Ra(e,Rj),IA=e=>Ra(e,Oj),hx=e=>Ra(e,Ej),BA=e=>Ra(e,Tj),qA=e=>Ra(e,Aj),Zc=e=>Ra(e,Dj,!0),KA=e=>Ra(e,Lj,!0),qi=(e,t,n)=>{const a=kj.exec(e);return a?a[1]?t(a[1]):n(a[2]):!1},Ra=(e,t,n=!1)=>{const a=zj.exec(e);return a?a[1]?t(a[1]):n:!1},Ej=e=>e==="position"||e==="percentage",Aj=e=>e==="image"||e==="url",Tj=e=>e==="length"||e==="size"||e==="bg-size",Rj=e=>e==="length",HA=e=>e==="number",Oj=e=>e==="family-name",Lj=e=>e==="number"||e==="weight",Dj=e=>e==="shadow",GA=()=>{const e=Zt("color"),t=Zt("font"),n=Zt("text"),a=Zt("font-weight"),o=Zt("tracking"),c=Zt("leading"),u=Zt("breakpoint"),f=Zt("container"),m=Zt("spacing"),p=Zt("radius"),v=Zt("shadow"),y=Zt("inset-shadow"),b=Zt("text-shadow"),x=Zt("drop-shadow"),N=Zt("blur"),S=Zt("perspective"),C=Zt("aspect"),k=Zt("ease"),T=Zt("animate"),A=()=>["auto","avoid","all","avoid-page","page","left","right","column"],z=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],$=()=>[...z(),we,je],P=()=>["auto","hidden","clip","visible","scroll"],E=()=>["auto","contain","none"],O=()=>[we,je,m],K=()=>[wi,"full","auto",...O()],ee=()=>[Ni,"none","subgrid",we,je],X=()=>["auto",{span:["full",Ni,we,je]},Ni,we,je],se=()=>[Ni,"auto",we,je],de=()=>["auto","min","max","fr",we,je],Ee=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],be=()=>["start","end","center","stretch","center-safe","end-safe"],H=()=>["auto",...O()],ae=()=>[wi,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...O()],pe=()=>[wi,"screen","full","dvw","lvw","svw","min","max","fit",...O()],ce=()=>[wi,"screen","full","lh","dvh","lvh","svh","min","max","fit",...O()],U=()=>[e,we,je],R=()=>[...z(),hx,fx,{position:[we,je]}],M=()=>["no-repeat",{repeat:["","x","y","space","round"]}],J=()=>["auto","cover","contain",BA,MA,{size:[we,je]}],V=()=>[Qh,Vo,fa],Q=()=>["","none","full",p,we,je],me=()=>["",Ue,Vo,fa],ge=()=>["solid","dashed","dotted","double"],Ne=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],he=()=>[Ue,Qh,hx,fx],Me=()=>["","none",N,we,je],Je=()=>["none",Ue,we,je],le=()=>["none",Ue,we,je],Ie=()=>[Ue,we,je],Ye=()=>[wi,"full",...O()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Gs],breakpoint:[Gs],color:[_j],container:[Gs],"drop-shadow":[Gs],ease:["in","out","in-out"],font:[DA],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Gs],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Gs],shadow:[Gs],spacing:["px",Ue],text:[Gs],"text-shadow":[Gs],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",wi,je,we,C]}],container:["container"],columns:[{columns:[Ue,je,we,f]}],"break-after":[{"break-after":A()}],"break-before":[{"break-before":A()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:$()}],overflow:[{overflow:P()}],"overflow-x":[{"overflow-x":P()}],"overflow-y":[{"overflow-y":P()}],overscroll:[{overscroll:E()}],"overscroll-x":[{"overscroll-x":E()}],"overscroll-y":[{"overscroll-y":E()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:K()}],"inset-x":[{"inset-x":K()}],"inset-y":[{"inset-y":K()}],start:[{"inset-s":K(),start:K()}],end:[{"inset-e":K(),end:K()}],"inset-bs":[{"inset-bs":K()}],"inset-be":[{"inset-be":K()}],top:[{top:K()}],right:[{right:K()}],bottom:[{bottom:K()}],left:[{left:K()}],visibility:["visible","invisible","collapse"],z:[{z:[Ni,"auto",we,je]}],basis:[{basis:[wi,"full","auto",f,...O()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ue,wi,"auto","initial","none",je]}],grow:[{grow:["",Ue,we,je]}],shrink:[{shrink:["",Ue,we,je]}],order:[{order:[Ni,"first","last","none",we,je]}],"grid-cols":[{"grid-cols":ee()}],"col-start-end":[{col:X()}],"col-start":[{"col-start":se()}],"col-end":[{"col-end":se()}],"grid-rows":[{"grid-rows":ee()}],"row-start-end":[{row:X()}],"row-start":[{"row-start":se()}],"row-end":[{"row-end":se()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":de()}],"auto-rows":[{"auto-rows":de()}],gap:[{gap:O()}],"gap-x":[{"gap-x":O()}],"gap-y":[{"gap-y":O()}],"justify-content":[{justify:[...Ee(),"normal"]}],"justify-items":[{"justify-items":[...be(),"normal"]}],"justify-self":[{"justify-self":["auto",...be()]}],"align-content":[{content:["normal",...Ee()]}],"align-items":[{items:[...be(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...be(),{baseline:["","last"]}]}],"place-content":[{"place-content":Ee()}],"place-items":[{"place-items":[...be(),"baseline"]}],"place-self":[{"place-self":["auto",...be()]}],p:[{p:O()}],px:[{px:O()}],py:[{py:O()}],ps:[{ps:O()}],pe:[{pe:O()}],pbs:[{pbs:O()}],pbe:[{pbe:O()}],pt:[{pt:O()}],pr:[{pr:O()}],pb:[{pb:O()}],pl:[{pl:O()}],m:[{m:H()}],mx:[{mx:H()}],my:[{my:H()}],ms:[{ms:H()}],me:[{me:H()}],mbs:[{mbs:H()}],mbe:[{mbe:H()}],mt:[{mt:H()}],mr:[{mr:H()}],mb:[{mb:H()}],ml:[{ml:H()}],"space-x":[{"space-x":O()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":O()}],"space-y-reverse":["space-y-reverse"],size:[{size:ae()}],"inline-size":[{inline:["auto",...pe()]}],"min-inline-size":[{"min-inline":["auto",...pe()]}],"max-inline-size":[{"max-inline":["none",...pe()]}],"block-size":[{block:["auto",...ce()]}],"min-block-size":[{"min-block":["auto",...ce()]}],"max-block-size":[{"max-block":["none",...ce()]}],w:[{w:[f,"screen",...ae()]}],"min-w":[{"min-w":[f,"screen","none",...ae()]}],"max-w":[{"max-w":[f,"screen","none","prose",{screen:[u]},...ae()]}],h:[{h:["screen","lh",...ae()]}],"min-h":[{"min-h":["screen","lh","none",...ae()]}],"max-h":[{"max-h":["screen","lh",...ae()]}],"font-size":[{text:["base",n,Vo,fa]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[a,KA,$A]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Qh,je]}],"font-family":[{font:[IA,PA,t]}],"font-features":[{"font-features":[je]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[o,we,je]}],"line-clamp":[{"line-clamp":[Ue,"none",we,dx]}],leading:[{leading:[c,...O()]}],"list-image":[{"list-image":["none",we,je]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",we,je]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:U()}],"text-color":[{text:U()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ge(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ue,"from-font","auto",we,fa]}],"text-decoration-color":[{decoration:U()}],"underline-offset":[{"underline-offset":[Ue,"auto",we,je]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:O()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",we,je]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",we,je]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:R()}],"bg-repeat":[{bg:M()}],"bg-size":[{bg:J()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Ni,we,je],radial:["",we,je],conic:[Ni,we,je]},qA,UA]}],"bg-color":[{bg:U()}],"gradient-from-pos":[{from:V()}],"gradient-via-pos":[{via:V()}],"gradient-to-pos":[{to:V()}],"gradient-from":[{from:U()}],"gradient-via":[{via:U()}],"gradient-to":[{to:U()}],rounded:[{rounded:Q()}],"rounded-s":[{"rounded-s":Q()}],"rounded-e":[{"rounded-e":Q()}],"rounded-t":[{"rounded-t":Q()}],"rounded-r":[{"rounded-r":Q()}],"rounded-b":[{"rounded-b":Q()}],"rounded-l":[{"rounded-l":Q()}],"rounded-ss":[{"rounded-ss":Q()}],"rounded-se":[{"rounded-se":Q()}],"rounded-ee":[{"rounded-ee":Q()}],"rounded-es":[{"rounded-es":Q()}],"rounded-tl":[{"rounded-tl":Q()}],"rounded-tr":[{"rounded-tr":Q()}],"rounded-br":[{"rounded-br":Q()}],"rounded-bl":[{"rounded-bl":Q()}],"border-w":[{border:me()}],"border-w-x":[{"border-x":me()}],"border-w-y":[{"border-y":me()}],"border-w-s":[{"border-s":me()}],"border-w-e":[{"border-e":me()}],"border-w-bs":[{"border-bs":me()}],"border-w-be":[{"border-be":me()}],"border-w-t":[{"border-t":me()}],"border-w-r":[{"border-r":me()}],"border-w-b":[{"border-b":me()}],"border-w-l":[{"border-l":me()}],"divide-x":[{"divide-x":me()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":me()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ge(),"hidden","none"]}],"divide-style":[{divide:[...ge(),"hidden","none"]}],"border-color":[{border:U()}],"border-color-x":[{"border-x":U()}],"border-color-y":[{"border-y":U()}],"border-color-s":[{"border-s":U()}],"border-color-e":[{"border-e":U()}],"border-color-bs":[{"border-bs":U()}],"border-color-be":[{"border-be":U()}],"border-color-t":[{"border-t":U()}],"border-color-r":[{"border-r":U()}],"border-color-b":[{"border-b":U()}],"border-color-l":[{"border-l":U()}],"divide-color":[{divide:U()}],"outline-style":[{outline:[...ge(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ue,we,je]}],"outline-w":[{outline:["",Ue,Vo,fa]}],"outline-color":[{outline:U()}],shadow:[{shadow:["","none",v,Zc,Fc]}],"shadow-color":[{shadow:U()}],"inset-shadow":[{"inset-shadow":["none",y,Zc,Fc]}],"inset-shadow-color":[{"inset-shadow":U()}],"ring-w":[{ring:me()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:U()}],"ring-offset-w":[{"ring-offset":[Ue,fa]}],"ring-offset-color":[{"ring-offset":U()}],"inset-ring-w":[{"inset-ring":me()}],"inset-ring-color":[{"inset-ring":U()}],"text-shadow":[{"text-shadow":["none",b,Zc,Fc]}],"text-shadow-color":[{"text-shadow":U()}],opacity:[{opacity:[Ue,we,je]}],"mix-blend":[{"mix-blend":[...Ne(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Ne()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Ue]}],"mask-image-linear-from-pos":[{"mask-linear-from":he()}],"mask-image-linear-to-pos":[{"mask-linear-to":he()}],"mask-image-linear-from-color":[{"mask-linear-from":U()}],"mask-image-linear-to-color":[{"mask-linear-to":U()}],"mask-image-t-from-pos":[{"mask-t-from":he()}],"mask-image-t-to-pos":[{"mask-t-to":he()}],"mask-image-t-from-color":[{"mask-t-from":U()}],"mask-image-t-to-color":[{"mask-t-to":U()}],"mask-image-r-from-pos":[{"mask-r-from":he()}],"mask-image-r-to-pos":[{"mask-r-to":he()}],"mask-image-r-from-color":[{"mask-r-from":U()}],"mask-image-r-to-color":[{"mask-r-to":U()}],"mask-image-b-from-pos":[{"mask-b-from":he()}],"mask-image-b-to-pos":[{"mask-b-to":he()}],"mask-image-b-from-color":[{"mask-b-from":U()}],"mask-image-b-to-color":[{"mask-b-to":U()}],"mask-image-l-from-pos":[{"mask-l-from":he()}],"mask-image-l-to-pos":[{"mask-l-to":he()}],"mask-image-l-from-color":[{"mask-l-from":U()}],"mask-image-l-to-color":[{"mask-l-to":U()}],"mask-image-x-from-pos":[{"mask-x-from":he()}],"mask-image-x-to-pos":[{"mask-x-to":he()}],"mask-image-x-from-color":[{"mask-x-from":U()}],"mask-image-x-to-color":[{"mask-x-to":U()}],"mask-image-y-from-pos":[{"mask-y-from":he()}],"mask-image-y-to-pos":[{"mask-y-to":he()}],"mask-image-y-from-color":[{"mask-y-from":U()}],"mask-image-y-to-color":[{"mask-y-to":U()}],"mask-image-radial":[{"mask-radial":[we,je]}],"mask-image-radial-from-pos":[{"mask-radial-from":he()}],"mask-image-radial-to-pos":[{"mask-radial-to":he()}],"mask-image-radial-from-color":[{"mask-radial-from":U()}],"mask-image-radial-to-color":[{"mask-radial-to":U()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":z()}],"mask-image-conic-pos":[{"mask-conic":[Ue]}],"mask-image-conic-from-pos":[{"mask-conic-from":he()}],"mask-image-conic-to-pos":[{"mask-conic-to":he()}],"mask-image-conic-from-color":[{"mask-conic-from":U()}],"mask-image-conic-to-color":[{"mask-conic-to":U()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:R()}],"mask-repeat":[{mask:M()}],"mask-size":[{mask:J()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",we,je]}],filter:[{filter:["","none",we,je]}],blur:[{blur:Me()}],brightness:[{brightness:[Ue,we,je]}],contrast:[{contrast:[Ue,we,je]}],"drop-shadow":[{"drop-shadow":["","none",x,Zc,Fc]}],"drop-shadow-color":[{"drop-shadow":U()}],grayscale:[{grayscale:["",Ue,we,je]}],"hue-rotate":[{"hue-rotate":[Ue,we,je]}],invert:[{invert:["",Ue,we,je]}],saturate:[{saturate:[Ue,we,je]}],sepia:[{sepia:["",Ue,we,je]}],"backdrop-filter":[{"backdrop-filter":["","none",we,je]}],"backdrop-blur":[{"backdrop-blur":Me()}],"backdrop-brightness":[{"backdrop-brightness":[Ue,we,je]}],"backdrop-contrast":[{"backdrop-contrast":[Ue,we,je]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ue,we,je]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ue,we,je]}],"backdrop-invert":[{"backdrop-invert":["",Ue,we,je]}],"backdrop-opacity":[{"backdrop-opacity":[Ue,we,je]}],"backdrop-saturate":[{"backdrop-saturate":[Ue,we,je]}],"backdrop-sepia":[{"backdrop-sepia":["",Ue,we,je]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":O()}],"border-spacing-x":[{"border-spacing-x":O()}],"border-spacing-y":[{"border-spacing-y":O()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",we,je]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ue,"initial",we,je]}],ease:[{ease:["linear","initial",k,we,je]}],delay:[{delay:[Ue,we,je]}],animate:[{animate:["none",T,we,je]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[S,we,je]}],"perspective-origin":[{"perspective-origin":$()}],rotate:[{rotate:Je()}],"rotate-x":[{"rotate-x":Je()}],"rotate-y":[{"rotate-y":Je()}],"rotate-z":[{"rotate-z":Je()}],scale:[{scale:le()}],"scale-x":[{"scale-x":le()}],"scale-y":[{"scale-y":le()}],"scale-z":[{"scale-z":le()}],"scale-3d":["scale-3d"],skew:[{skew:Ie()}],"skew-x":[{"skew-x":Ie()}],"skew-y":[{"skew-y":Ie()}],transform:[{transform:[we,je,"","none","gpu","cpu"]}],"transform-origin":[{origin:$()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ye()}],"translate-x":[{"translate-x":Ye()}],"translate-y":[{"translate-y":Ye()}],"translate-z":[{"translate-z":Ye()}],"translate-none":["translate-none"],accent:[{accent:U()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:U()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",we,je]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":O()}],"scroll-mx":[{"scroll-mx":O()}],"scroll-my":[{"scroll-my":O()}],"scroll-ms":[{"scroll-ms":O()}],"scroll-me":[{"scroll-me":O()}],"scroll-mbs":[{"scroll-mbs":O()}],"scroll-mbe":[{"scroll-mbe":O()}],"scroll-mt":[{"scroll-mt":O()}],"scroll-mr":[{"scroll-mr":O()}],"scroll-mb":[{"scroll-mb":O()}],"scroll-ml":[{"scroll-ml":O()}],"scroll-p":[{"scroll-p":O()}],"scroll-px":[{"scroll-px":O()}],"scroll-py":[{"scroll-py":O()}],"scroll-ps":[{"scroll-ps":O()}],"scroll-pe":[{"scroll-pe":O()}],"scroll-pbs":[{"scroll-pbs":O()}],"scroll-pbe":[{"scroll-pbe":O()}],"scroll-pt":[{"scroll-pt":O()}],"scroll-pr":[{"scroll-pr":O()}],"scroll-pb":[{"scroll-pb":O()}],"scroll-pl":[{"scroll-pl":O()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",we,je]}],fill:[{fill:["none",...U()]}],"stroke-w":[{stroke:[Ue,Vo,fa,dx]}],stroke:[{stroke:["none",...U()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},FA=NA(GA);function es(...e){return FA(xj(e))}const ZA=Sj("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-zinc-400 focus-visible:ring-offset-2 focus-visible:ring-offset-black disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-zinc-50 text-black hover:bg-zinc-200",secondary:"border border-zinc-800 bg-zinc-950 text-zinc-100 hover:bg-zinc-900",ghost:"text-zinc-400 hover:bg-zinc-900 hover:text-zinc-50",outline:"border border-zinc-800 bg-transparent text-zinc-100 hover:bg-zinc-900",destructive:"bg-rose-600 text-white hover:bg-rose-700"},size:{default:"h-9 px-4",sm:"h-8 px-3 text-xs",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}}),oe=w.forwardRef(({className:e,variant:t,size:n,asChild:a=!1,...o},c)=>{const u=a?XE:"button";return r.jsx(u,{ref:c,className:es(ZA({variant:t,size:n,className:e})),...o})});oe.displayName="Button";const VA=Sj("inline-flex items-center rounded-md border px-2 py-0.5 text-[11px] font-medium tracking-wide",{variants:{variant:{neutral:"border-zinc-800 bg-zinc-950 text-zinc-300",success:"border-emerald-500/25 bg-emerald-500/10 text-emerald-300",warning:"border-amber-500/25 bg-amber-500/10 text-amber-300",destructive:"border-rose-500/25 bg-rose-500/10 text-rose-300"}},defaultVariants:{variant:"neutral"}});function Mj({className:e,variant:t,...n}){return r.jsx("div",{className:es(VA({variant:t}),e),...n})}function mx({compact:e=!1}){return r.jsxs(St,{to:"/",className:`brand-lockup ${e?"brand-lockup-compact":""}`,"aria-label":"Canonry home",children:[r.jsx("img",{className:"brand-icon",src:"./favicon.svg",alt:"","aria-hidden":"true"}),r.jsxs("span",{className:"brand-copy",children:[r.jsx("span",{className:"brand-mark",children:"Canonry"}),e?null:r.jsx("span",{className:"brand-subtitle",children:"AEO Monitor"})]})]})}function ll({provider:e}){const t={gemini:"border-blue-800/50 bg-blue-950/40 text-blue-300",openai:"border-green-800/50 bg-green-950/40 text-green-300",claude:"border-amber-800/50 bg-amber-950/40 text-amber-300",perplexity:"border-teal-800/50 bg-teal-950/40 text-teal-300",local:"border-purple-800/50 bg-purple-950/40 text-purple-300"};return r.jsx("span",{className:`inline-flex items-center rounded-full border px-2 py-0.5 text-[10px] font-medium uppercase tracking-wide ${t[e]??"border-zinc-700 bg-zinc-800 text-zinc-300"}`,children:e})}function Ou(e){return e.state==="ok"?"positive":e.state==="checking"?"neutral":"negative"}function $j(e){switch(e){case"completed":return"positive";case"partial":return"caution";case"failed":return"negative";case"cancelled":return"caution";case"queued":case"running":return"neutral";default:return"neutral"}}function QA(e){switch(e){case"cited":return"positive";case"emerging":return"caution";case"not-cited":return"caution";case"lost":return"negative";case"pending":return"neutral";default:return"neutral"}}function YA(e){return e==="High"?"negative":e==="Moderate"?"caution":"neutral"}function lt({tone:e,children:t}){const n=e==="positive"?"success":e==="caution"?"warning":e==="negative"?"destructive":"neutral";return r.jsx(Mj,{variant:n,children:t})}function ed({status:e}){return r.jsx(lt,{tone:$j(e),children:Ju(e)})}function Li(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e?.(o),n===!1||!o.defaultPrevented)return t?.(o)}}function JA(e,t){const n=w.createContext(t),a=c=>{const{children:u,...f}=c,m=w.useMemo(()=>f,Object.values(f));return r.jsx(n.Provider,{value:m,children:u})};a.displayName=e+"Provider";function o(c){const u=w.useContext(n);if(u)return u;if(t!==void 0)return t;throw new Error(`\`${c}\` must be used within \`${e}\``)}return[a,o]}function XA(e,t=[]){let n=[];function a(c,u){const f=w.createContext(u),m=n.length;n=[...n,u];const p=y=>{const{scope:b,children:x,...N}=y,S=b?.[e]?.[m]||f,C=w.useMemo(()=>N,Object.values(N));return r.jsx(S.Provider,{value:C,children:x})};p.displayName=c+"Provider";function v(y,b){const x=b?.[e]?.[m]||f,N=w.useContext(x);if(N)return N;if(u!==void 0)return u;throw new Error(`\`${y}\` must be used within \`${c}\``)}return[p,v]}const o=()=>{const c=n.map(u=>w.createContext(u));return function(f){const m=f?.[e]||c;return w.useMemo(()=>({[`__scope${e}`]:{...f,[e]:m}}),[f,m])}};return o.scopeName=e,[a,WA(o,...t)]}function WA(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const a=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(c){const u=a.reduce((f,{useScope:m,scopeName:p})=>{const y=m(c)[`__scope${p}`];return{...f,...y}},{});return w.useMemo(()=>({[`__scope${t.scopeName}`]:u}),[u])}};return n.scopeName=t.scopeName,n}var cl=globalThis?.document?w.useLayoutEffect:()=>{},eT=sp[" useId ".trim().toString()]||(()=>{}),tT=0;function Yh(e){const[t,n]=w.useState(eT());return cl(()=>{n(a=>a??String(tT++))},[e]),e||(t?`radix-${t}`:"")}var nT=sp[" useInsertionEffect ".trim().toString()]||cl;function sT({prop:e,defaultProp:t,onChange:n=()=>{},caller:a}){const[o,c,u]=iT({defaultProp:t,onChange:n}),f=e!==void 0,m=f?e:o;{const v=w.useRef(e!==void 0);w.useEffect(()=>{const y=v.current;y!==f&&console.warn(`${a} is changing from ${y?"controlled":"uncontrolled"} to ${f?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),v.current=f},[f,a])}const p=w.useCallback(v=>{if(f){const y=aT(v)?v(e):v;y!==e&&u.current?.(y)}else c(v)},[f,e,c,u]);return[m,p]}function iT({defaultProp:e,onChange:t}){const[n,a]=w.useState(e),o=w.useRef(n),c=w.useRef(t);return nT(()=>{c.current=t},[t]),w.useEffect(()=>{o.current!==n&&(c.current?.(n),o.current=n)},[n,o]),[n,a,c]}function aT(e){return typeof e=="function"}function Pj(e){const t=rT(e),n=w.forwardRef((a,o)=>{const{children:c,...u}=a,f=w.Children.toArray(c),m=f.find(lT);if(m){const p=m.props.children,v=f.map(y=>y===m?w.Children.count(p)>1?w.Children.only(null):w.isValidElement(p)?p.props.children:null:y);return r.jsx(t,{...u,ref:o,children:w.isValidElement(p)?w.cloneElement(p,void 0,v):null})}return r.jsx(t,{...u,ref:o,children:c})});return n.displayName=`${e}.Slot`,n}function rT(e){const t=w.forwardRef((n,a)=>{const{children:o,...c}=n;if(w.isValidElement(o)){const u=uT(o),f=cT(c,o.props);return o.type!==w.Fragment&&(f.ref=a?Ep(a,u):u),w.cloneElement(o,f)}return w.Children.count(o)>1?w.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var oT=Symbol("radix.slottable");function lT(e){return w.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===oT}function cT(e,t){const n={...t};for(const a in t){const o=e[a],c=t[a];/^on[A-Z]/.test(a)?o&&c?n[a]=(...f)=>{const m=c(...f);return o(...f),m}:o&&(n[a]=o):a==="style"?n[a]={...o,...c}:a==="className"&&(n[a]=[o,c].filter(Boolean).join(" "))}return{...e,...n}}function uT(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var dT=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Qs=dT.reduce((e,t)=>{const n=Pj(`Primitive.${t}`),a=w.forwardRef((o,c)=>{const{asChild:u,...f}=o,m=u?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),r.jsx(m,{...f,ref:c})});return a.displayName=`Primitive.${t}`,{...e,[t]:a}},{});function fT(e,t){e&&wp.flushSync(()=>e.dispatchEvent(t))}function ul(e){const t=w.useRef(e);return w.useEffect(()=>{t.current=e}),w.useMemo(()=>(...n)=>t.current?.(...n),[])}function hT(e,t=globalThis?.document){const n=ul(e);w.useEffect(()=>{const a=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",a,{capture:!0}),()=>t.removeEventListener("keydown",a,{capture:!0})},[n,t])}var mT="DismissableLayer",Pm="dismissableLayer.update",pT="dismissableLayer.pointerDownOutside",gT="dismissableLayer.focusOutside",px,Uj=w.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Ij=w.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:c,onInteractOutside:u,onDismiss:f,...m}=e,p=w.useContext(Uj),[v,y]=w.useState(null),b=v?.ownerDocument??globalThis?.document,[,x]=w.useState({}),N=Ta(t,E=>y(E)),S=Array.from(p.layers),[C]=[...p.layersWithOutsidePointerEventsDisabled].slice(-1),k=S.indexOf(C),T=v?S.indexOf(v):-1,A=p.layersWithOutsidePointerEventsDisabled.size>0,z=T>=k,$=bT(E=>{const O=E.target,K=[...p.branches].some(ee=>ee.contains(O));!z||K||(o?.(E),u?.(E),E.defaultPrevented||f?.())},b),P=xT(E=>{const O=E.target;[...p.branches].some(ee=>ee.contains(O))||(c?.(E),u?.(E),E.defaultPrevented||f?.())},b);return hT(E=>{T===p.layers.size-1&&(a?.(E),!E.defaultPrevented&&f&&(E.preventDefault(),f()))},b),w.useEffect(()=>{if(v)return n&&(p.layersWithOutsidePointerEventsDisabled.size===0&&(px=b.body.style.pointerEvents,b.body.style.pointerEvents="none"),p.layersWithOutsidePointerEventsDisabled.add(v)),p.layers.add(v),gx(),()=>{n&&p.layersWithOutsidePointerEventsDisabled.size===1&&(b.body.style.pointerEvents=px)}},[v,b,n,p]),w.useEffect(()=>()=>{v&&(p.layers.delete(v),p.layersWithOutsidePointerEventsDisabled.delete(v),gx())},[v,p]),w.useEffect(()=>{const E=()=>x({});return document.addEventListener(Pm,E),()=>document.removeEventListener(Pm,E)},[]),r.jsx(Qs.div,{...m,ref:N,style:{pointerEvents:A?z?"auto":"none":void 0,...e.style},onFocusCapture:Li(e.onFocusCapture,P.onFocusCapture),onBlurCapture:Li(e.onBlurCapture,P.onBlurCapture),onPointerDownCapture:Li(e.onPointerDownCapture,$.onPointerDownCapture)})});Ij.displayName=mT;var yT="DismissableLayerBranch",vT=w.forwardRef((e,t)=>{const n=w.useContext(Uj),a=w.useRef(null),o=Ta(t,a);return w.useEffect(()=>{const c=a.current;if(c)return n.branches.add(c),()=>{n.branches.delete(c)}},[n.branches]),r.jsx(Qs.div,{...e,ref:o})});vT.displayName=yT;function bT(e,t=globalThis?.document){const n=ul(e),a=w.useRef(!1),o=w.useRef(()=>{});return w.useEffect(()=>{const c=f=>{if(f.target&&!a.current){let m=function(){Bj(pT,n,p,{discrete:!0})};const p={originalEvent:f};f.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=m,t.addEventListener("click",o.current,{once:!0})):m()}else t.removeEventListener("click",o.current);a.current=!1},u=window.setTimeout(()=>{t.addEventListener("pointerdown",c)},0);return()=>{window.clearTimeout(u),t.removeEventListener("pointerdown",c),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>a.current=!0}}function xT(e,t=globalThis?.document){const n=ul(e),a=w.useRef(!1);return w.useEffect(()=>{const o=c=>{c.target&&!a.current&&Bj(gT,n,{originalEvent:c},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>a.current=!0,onBlurCapture:()=>a.current=!1}}function gx(){const e=new CustomEvent(Pm);document.dispatchEvent(e)}function Bj(e,t,n,{discrete:a}){const o=n.originalEvent.target,c=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),a?fT(o,c):o.dispatchEvent(c)}var Jh="focusScope.autoFocusOnMount",Xh="focusScope.autoFocusOnUnmount",yx={bubbles:!1,cancelable:!0},ST="FocusScope",qj=w.forwardRef((e,t)=>{const{loop:n=!1,trapped:a=!1,onMountAutoFocus:o,onUnmountAutoFocus:c,...u}=e,[f,m]=w.useState(null),p=ul(o),v=ul(c),y=w.useRef(null),b=Ta(t,S=>m(S)),x=w.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;w.useEffect(()=>{if(a){let S=function(A){if(x.paused||!f)return;const z=A.target;f.contains(z)?y.current=z:ki(y.current,{select:!0})},C=function(A){if(x.paused||!f)return;const z=A.relatedTarget;z!==null&&(f.contains(z)||ki(y.current,{select:!0}))},k=function(A){if(document.activeElement===document.body)for(const $ of A)$.removedNodes.length>0&&ki(f)};document.addEventListener("focusin",S),document.addEventListener("focusout",C);const T=new MutationObserver(k);return f&&T.observe(f,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",S),document.removeEventListener("focusout",C),T.disconnect()}}},[a,f,x.paused]),w.useEffect(()=>{if(f){bx.add(x);const S=document.activeElement;if(!f.contains(S)){const k=new CustomEvent(Jh,yx);f.addEventListener(Jh,p),f.dispatchEvent(k),k.defaultPrevented||(jT(zT(Kj(f)),{select:!0}),document.activeElement===S&&ki(f))}return()=>{f.removeEventListener(Jh,p),setTimeout(()=>{const k=new CustomEvent(Xh,yx);f.addEventListener(Xh,v),f.dispatchEvent(k),k.defaultPrevented||ki(S??document.body,{select:!0}),f.removeEventListener(Xh,v),bx.remove(x)},0)}}},[f,p,v,x]);const N=w.useCallback(S=>{if(!n&&!a||x.paused)return;const C=S.key==="Tab"&&!S.altKey&&!S.ctrlKey&&!S.metaKey,k=document.activeElement;if(C&&k){const T=S.currentTarget,[A,z]=wT(T);A&&z?!S.shiftKey&&k===z?(S.preventDefault(),n&&ki(A,{select:!0})):S.shiftKey&&k===A&&(S.preventDefault(),n&&ki(z,{select:!0})):k===T&&S.preventDefault()}},[n,a,x.paused]);return r.jsx(Qs.div,{tabIndex:-1,...u,ref:b,onKeyDown:N})});qj.displayName=ST;function jT(e,{select:t=!1}={}){const n=document.activeElement;for(const a of e)if(ki(a,{select:t}),document.activeElement!==n)return}function wT(e){const t=Kj(e),n=vx(t,e),a=vx(t.reverse(),e);return[n,a]}function Kj(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:a=>{const o=a.tagName==="INPUT"&&a.type==="hidden";return a.disabled||a.hidden||o?NodeFilter.FILTER_SKIP:a.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function vx(e,t){for(const n of e)if(!NT(n,{upTo:t}))return n}function NT(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function CT(e){return e instanceof HTMLInputElement&&"select"in e}function ki(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&CT(e)&&t&&e.select()}}var bx=kT();function kT(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=xx(e,t),e.unshift(t)},remove(t){e=xx(e,t),e[0]?.resume()}}}function xx(e,t){const n=[...e],a=n.indexOf(t);return a!==-1&&n.splice(a,1),n}function zT(e){return e.filter(t=>t.tagName!=="A")}var _T="Portal",Hj=w.forwardRef((e,t)=>{const{container:n,...a}=e,[o,c]=w.useState(!1);cl(()=>c(!0),[]);const u=n||o&&globalThis?.document?.body;return u?N_.createPortal(r.jsx(Qs.div,{...a,ref:t}),u):null});Hj.displayName=_T;function ET(e,t){return w.useReducer((n,a)=>t[n][a]??n,e)}var td=e=>{const{present:t,children:n}=e,a=AT(t),o=typeof n=="function"?n({present:a.isPresent}):w.Children.only(n),c=Ta(a.ref,TT(o));return typeof n=="function"||a.isPresent?w.cloneElement(o,{ref:c}):null};td.displayName="Presence";function AT(e){const[t,n]=w.useState(),a=w.useRef(null),o=w.useRef(e),c=w.useRef("none"),u=e?"mounted":"unmounted",[f,m]=ET(u,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return w.useEffect(()=>{const p=Vc(a.current);c.current=f==="mounted"?p:"none"},[f]),cl(()=>{const p=a.current,v=o.current;if(v!==e){const b=c.current,x=Vc(p);e?m("MOUNT"):x==="none"||p?.display==="none"?m("UNMOUNT"):m(v&&b!==x?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,m]),cl(()=>{if(t){let p;const v=t.ownerDocument.defaultView??window,y=x=>{const S=Vc(a.current).includes(CSS.escape(x.animationName));if(x.target===t&&S&&(m("ANIMATION_END"),!o.current)){const C=t.style.animationFillMode;t.style.animationFillMode="forwards",p=v.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=C)})}},b=x=>{x.target===t&&(c.current=Vc(a.current))};return t.addEventListener("animationstart",b),t.addEventListener("animationcancel",y),t.addEventListener("animationend",y),()=>{v.clearTimeout(p),t.removeEventListener("animationstart",b),t.removeEventListener("animationcancel",y),t.removeEventListener("animationend",y)}}else m("ANIMATION_END")},[t,m]),{isPresent:["mounted","unmountSuspended"].includes(f),ref:w.useCallback(p=>{a.current=p?getComputedStyle(p):null,n(p)},[])}}function Vc(e){return e?.animationName||"none"}function TT(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Wh=0;function RT(){w.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Sx()),document.body.insertAdjacentElement("beforeend",e[1]??Sx()),Wh++,()=>{Wh===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Wh--}},[])}function Sx(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var ws=function(){return ws=Object.assign||function(t){for(var n,a=1,o=arguments.length;a<o;a++){n=arguments[a];for(var c in n)Object.prototype.hasOwnProperty.call(n,c)&&(t[c]=n[c])}return t},ws.apply(this,arguments)};function Gj(e,t){var n={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(n[a]=e[a]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,a=Object.getOwnPropertySymbols(e);o<a.length;o++)t.indexOf(a[o])<0&&Object.prototype.propertyIsEnumerable.call(e,a[o])&&(n[a[o]]=e[a[o]]);return n}function OT(e,t,n){if(n||arguments.length===2)for(var a=0,o=t.length,c;a<o;a++)(c||!(a in t))&&(c||(c=Array.prototype.slice.call(t,0,a)),c[a]=t[a]);return e.concat(c||Array.prototype.slice.call(t))}var mu="right-scroll-bar-position",pu="width-before-scroll-bar",LT="with-scroll-bars-hidden",DT="--removed-body-scroll-bar-size";function em(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function MT(e,t){var n=w.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(a){var o=n.value;o!==a&&(n.value=a,n.callback(a,o))}}}})[0];return n.callback=t,n.facade}var $T=typeof window<"u"?w.useLayoutEffect:w.useEffect,jx=new WeakMap;function PT(e,t){var n=MT(null,function(a){return e.forEach(function(o){return em(o,a)})});return $T(function(){var a=jx.get(n);if(a){var o=new Set(a),c=new Set(e),u=n.current;o.forEach(function(f){c.has(f)||em(f,null)}),c.forEach(function(f){o.has(f)||em(f,u)})}jx.set(n,e)},[e]),n}function UT(e){return e}function IT(e,t){t===void 0&&(t=UT);var n=[],a=!1,o={read:function(){if(a)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(c){var u=t(c,a);return n.push(u),function(){n=n.filter(function(f){return f!==u})}},assignSyncMedium:function(c){for(a=!0;n.length;){var u=n;n=[],u.forEach(c)}n={push:function(f){return c(f)},filter:function(){return n}}},assignMedium:function(c){a=!0;var u=[];if(n.length){var f=n;n=[],f.forEach(c),u=n}var m=function(){var v=u;u=[],v.forEach(c)},p=function(){return Promise.resolve().then(m)};p(),n={push:function(v){u.push(v),p()},filter:function(v){return u=u.filter(v),n}}}};return o}function BT(e){e===void 0&&(e={});var t=IT(null);return t.options=ws({async:!0,ssr:!1},e),t}var Fj=function(e){var t=e.sideCar,n=Gj(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var a=t.read();if(!a)throw new Error("Sidecar medium not found");return w.createElement(a,ws({},n))};Fj.isSideCarExport=!0;function qT(e,t){return e.useMedium(t),Fj}var Zj=BT(),tm=function(){},nd=w.forwardRef(function(e,t){var n=w.useRef(null),a=w.useState({onScrollCapture:tm,onWheelCapture:tm,onTouchMoveCapture:tm}),o=a[0],c=a[1],u=e.forwardProps,f=e.children,m=e.className,p=e.removeScrollBar,v=e.enabled,y=e.shards,b=e.sideCar,x=e.noRelative,N=e.noIsolation,S=e.inert,C=e.allowPinchZoom,k=e.as,T=k===void 0?"div":k,A=e.gapMode,z=Gj(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),$=b,P=PT([n,t]),E=ws(ws({},z),o);return w.createElement(w.Fragment,null,v&&w.createElement($,{sideCar:Zj,removeScrollBar:p,shards:y,noRelative:x,noIsolation:N,inert:S,setCallbacks:c,allowPinchZoom:!!C,lockRef:n,gapMode:A}),u?w.cloneElement(w.Children.only(f),ws(ws({},E),{ref:P})):w.createElement(T,ws({},E,{className:m,ref:P}),f))});nd.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};nd.classNames={fullWidth:pu,zeroRight:mu};var KT=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function HT(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=KT();return t&&e.setAttribute("nonce",t),e}function GT(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function FT(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var ZT=function(){var e=0,t=null;return{add:function(n){e==0&&(t=HT())&&(GT(t,n),FT(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},VT=function(){var e=ZT();return function(t,n){w.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Vj=function(){var e=VT(),t=function(n){var a=n.styles,o=n.dynamic;return e(a,o),null};return t},QT={left:0,top:0,right:0,gap:0},nm=function(e){return parseInt(e||"",10)||0},YT=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],a=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[nm(n),nm(a),nm(o)]},JT=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return QT;var t=YT(e),n=document.documentElement.clientWidth,a=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,a-n+t[2]-t[0])}},XT=Vj(),Lr="data-scroll-locked",WT=function(e,t,n,a){var o=e.left,c=e.top,u=e.right,f=e.gap;return n===void 0&&(n="margin"),`
13
- .`.concat(LT,` {
14
- overflow: hidden `).concat(a,`;
15
- padding-right: `).concat(f,"px ").concat(a,`;
16
- }
17
- body[`).concat(Lr,`] {
18
- overflow: hidden `).concat(a,`;
19
- overscroll-behavior: contain;
20
- `).concat([t&&"position: relative ".concat(a,";"),n==="margin"&&`
21
- padding-left: `.concat(o,`px;
22
- padding-top: `).concat(c,`px;
23
- padding-right: `).concat(u,`px;
24
- margin-left:0;
25
- margin-top:0;
26
- margin-right: `).concat(f,"px ").concat(a,`;
27
- `),n==="padding"&&"padding-right: ".concat(f,"px ").concat(a,";")].filter(Boolean).join(""),`
28
- }
29
-
30
- .`).concat(mu,` {
31
- right: `).concat(f,"px ").concat(a,`;
32
- }
33
-
34
- .`).concat(pu,` {
35
- margin-right: `).concat(f,"px ").concat(a,`;
36
- }
37
-
38
- .`).concat(mu," .").concat(mu,` {
39
- right: 0 `).concat(a,`;
40
- }
41
-
42
- .`).concat(pu," .").concat(pu,` {
43
- margin-right: 0 `).concat(a,`;
44
- }
45
-
46
- body[`).concat(Lr,`] {
47
- `).concat(DT,": ").concat(f,`px;
48
- }
49
- `)},wx=function(){var e=parseInt(document.body.getAttribute(Lr)||"0",10);return isFinite(e)?e:0},eR=function(){w.useEffect(function(){return document.body.setAttribute(Lr,(wx()+1).toString()),function(){var e=wx()-1;e<=0?document.body.removeAttribute(Lr):document.body.setAttribute(Lr,e.toString())}},[])},tR=function(e){var t=e.noRelative,n=e.noImportant,a=e.gapMode,o=a===void 0?"margin":a;eR();var c=w.useMemo(function(){return JT(o)},[o]);return w.createElement(XT,{styles:WT(c,!t,o,n?"":"!important")})},Um=!1;if(typeof window<"u")try{var Qc=Object.defineProperty({},"passive",{get:function(){return Um=!0,!0}});window.addEventListener("test",Qc,Qc),window.removeEventListener("test",Qc,Qc)}catch{Um=!1}var wr=Um?{passive:!1}:!1,nR=function(e){return e.tagName==="TEXTAREA"},Qj=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!nR(e)&&n[t]==="visible")},sR=function(e){return Qj(e,"overflowY")},iR=function(e){return Qj(e,"overflowX")},Nx=function(e,t){var n=t.ownerDocument,a=t;do{typeof ShadowRoot<"u"&&a instanceof ShadowRoot&&(a=a.host);var o=Yj(e,a);if(o){var c=Jj(e,a),u=c[1],f=c[2];if(u>f)return!0}a=a.parentNode}while(a&&a!==n.body);return!1},aR=function(e){var t=e.scrollTop,n=e.scrollHeight,a=e.clientHeight;return[t,n,a]},rR=function(e){var t=e.scrollLeft,n=e.scrollWidth,a=e.clientWidth;return[t,n,a]},Yj=function(e,t){return e==="v"?sR(t):iR(t)},Jj=function(e,t){return e==="v"?aR(t):rR(t)},oR=function(e,t){return e==="h"&&t==="rtl"?-1:1},lR=function(e,t,n,a,o){var c=oR(e,window.getComputedStyle(t).direction),u=c*a,f=n.target,m=t.contains(f),p=!1,v=u>0,y=0,b=0;do{if(!f)break;var x=Jj(e,f),N=x[0],S=x[1],C=x[2],k=S-C-c*N;(N||k)&&Yj(e,f)&&(y+=k,b+=N);var T=f.parentNode;f=T&&T.nodeType===Node.DOCUMENT_FRAGMENT_NODE?T.host:T}while(!m&&f!==document.body||m&&(t.contains(f)||t===f));return(v&&Math.abs(y)<1||!v&&Math.abs(b)<1)&&(p=!0),p},Yc=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Cx=function(e){return[e.deltaX,e.deltaY]},kx=function(e){return e&&"current"in e?e.current:e},cR=function(e,t){return e[0]===t[0]&&e[1]===t[1]},uR=function(e){return`
50
- .block-interactivity-`.concat(e,` {pointer-events: none;}
51
- .allow-interactivity-`).concat(e,` {pointer-events: all;}
52
- `)},dR=0,Nr=[];function fR(e){var t=w.useRef([]),n=w.useRef([0,0]),a=w.useRef(),o=w.useState(dR++)[0],c=w.useState(Vj)[0],u=w.useRef(e);w.useEffect(function(){u.current=e},[e]),w.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var S=OT([e.lockRef.current],(e.shards||[]).map(kx),!0).filter(Boolean);return S.forEach(function(C){return C.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),S.forEach(function(C){return C.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var f=w.useCallback(function(S,C){if("touches"in S&&S.touches.length===2||S.type==="wheel"&&S.ctrlKey)return!u.current.allowPinchZoom;var k=Yc(S),T=n.current,A="deltaX"in S?S.deltaX:T[0]-k[0],z="deltaY"in S?S.deltaY:T[1]-k[1],$,P=S.target,E=Math.abs(A)>Math.abs(z)?"h":"v";if("touches"in S&&E==="h"&&P.type==="range")return!1;var O=window.getSelection(),K=O&&O.anchorNode,ee=K?K===P||K.contains(P):!1;if(ee)return!1;var X=Nx(E,P);if(!X)return!0;if(X?$=E:($=E==="v"?"h":"v",X=Nx(E,P)),!X)return!1;if(!a.current&&"changedTouches"in S&&(A||z)&&(a.current=$),!$)return!0;var se=a.current||$;return lR(se,C,S,se==="h"?A:z)},[]),m=w.useCallback(function(S){var C=S;if(!(!Nr.length||Nr[Nr.length-1]!==c)){var k="deltaY"in C?Cx(C):Yc(C),T=t.current.filter(function($){return $.name===C.type&&($.target===C.target||C.target===$.shadowParent)&&cR($.delta,k)})[0];if(T&&T.should){C.cancelable&&C.preventDefault();return}if(!T){var A=(u.current.shards||[]).map(kx).filter(Boolean).filter(function($){return $.contains(C.target)}),z=A.length>0?f(C,A[0]):!u.current.noIsolation;z&&C.cancelable&&C.preventDefault()}}},[]),p=w.useCallback(function(S,C,k,T){var A={name:S,delta:C,target:k,should:T,shadowParent:hR(k)};t.current.push(A),setTimeout(function(){t.current=t.current.filter(function(z){return z!==A})},1)},[]),v=w.useCallback(function(S){n.current=Yc(S),a.current=void 0},[]),y=w.useCallback(function(S){p(S.type,Cx(S),S.target,f(S,e.lockRef.current))},[]),b=w.useCallback(function(S){p(S.type,Yc(S),S.target,f(S,e.lockRef.current))},[]);w.useEffect(function(){return Nr.push(c),e.setCallbacks({onScrollCapture:y,onWheelCapture:y,onTouchMoveCapture:b}),document.addEventListener("wheel",m,wr),document.addEventListener("touchmove",m,wr),document.addEventListener("touchstart",v,wr),function(){Nr=Nr.filter(function(S){return S!==c}),document.removeEventListener("wheel",m,wr),document.removeEventListener("touchmove",m,wr),document.removeEventListener("touchstart",v,wr)}},[]);var x=e.removeScrollBar,N=e.inert;return w.createElement(w.Fragment,null,N?w.createElement(c,{styles:uR(o)}):null,x?w.createElement(tR,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function hR(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const mR=qT(Zj,fR);var Xj=w.forwardRef(function(e,t){return w.createElement(nd,ws({},e,{ref:t,sideCar:mR}))});Xj.classNames=nd.classNames;var pR=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Cr=new WeakMap,Jc=new WeakMap,Xc={},sm=0,Wj=function(e){return e&&(e.host||Wj(e.parentNode))},gR=function(e,t){return t.map(function(n){if(e.contains(n))return n;var a=Wj(n);return a&&e.contains(a)?a:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},yR=function(e,t,n,a){var o=gR(t,Array.isArray(e)?e:[e]);Xc[n]||(Xc[n]=new WeakMap);var c=Xc[n],u=[],f=new Set,m=new Set(o),p=function(y){!y||f.has(y)||(f.add(y),p(y.parentNode))};o.forEach(p);var v=function(y){!y||m.has(y)||Array.prototype.forEach.call(y.children,function(b){if(f.has(b))v(b);else try{var x=b.getAttribute(a),N=x!==null&&x!=="false",S=(Cr.get(b)||0)+1,C=(c.get(b)||0)+1;Cr.set(b,S),c.set(b,C),u.push(b),S===1&&N&&Jc.set(b,!0),C===1&&b.setAttribute(n,"true"),N||b.setAttribute(a,"true")}catch(k){console.error("aria-hidden: cannot operate on ",b,k)}})};return v(t),f.clear(),sm++,function(){u.forEach(function(y){var b=Cr.get(y)-1,x=c.get(y)-1;Cr.set(y,b),c.set(y,x),b||(Jc.has(y)||y.removeAttribute(a),Jc.delete(y)),x||y.removeAttribute(n)}),sm--,sm||(Cr=new WeakMap,Cr=new WeakMap,Jc=new WeakMap,Xc={})}},vR=function(e,t,n){n===void 0&&(n="data-aria-hidden");var a=Array.from(Array.isArray(e)?e:[e]),o=pR(e);return o?(a.push.apply(a,Array.from(o.querySelectorAll("[aria-live], script"))),yR(a,o,n,"aria-hidden")):function(){return null}},sd="Dialog",[ew]=XA(sd),[bR,fs]=ew(sd),tw=e=>{const{__scopeDialog:t,children:n,open:a,defaultOpen:o,onOpenChange:c,modal:u=!0}=e,f=w.useRef(null),m=w.useRef(null),[p,v]=sT({prop:a,defaultProp:o??!1,onChange:c,caller:sd});return r.jsx(bR,{scope:t,triggerRef:f,contentRef:m,contentId:Yh(),titleId:Yh(),descriptionId:Yh(),open:p,onOpenChange:v,onOpenToggle:w.useCallback(()=>v(y=>!y),[v]),modal:u,children:n})};tw.displayName=sd;var nw="DialogTrigger",xR=w.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,o=fs(nw,n),c=Ta(t,o.triggerRef);return r.jsx(Qs.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Lp(o.open),...a,ref:c,onClick:Li(e.onClick,o.onOpenToggle)})});xR.displayName=nw;var Rp="DialogPortal",[SR,sw]=ew(Rp,{forceMount:void 0}),iw=e=>{const{__scopeDialog:t,forceMount:n,children:a,container:o}=e,c=fs(Rp,t);return r.jsx(SR,{scope:t,forceMount:n,children:w.Children.map(a,u=>r.jsx(td,{present:n||c.open,children:r.jsx(Hj,{asChild:!0,container:o,children:u})}))})};iw.displayName=Rp;var Lu="DialogOverlay",aw=w.forwardRef((e,t)=>{const n=sw(Lu,e.__scopeDialog),{forceMount:a=n.forceMount,...o}=e,c=fs(Lu,e.__scopeDialog);return c.modal?r.jsx(td,{present:a||c.open,children:r.jsx(wR,{...o,ref:t})}):null});aw.displayName=Lu;var jR=Pj("DialogOverlay.RemoveScroll"),wR=w.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,o=fs(Lu,n);return r.jsx(Xj,{as:jR,allowPinchZoom:!0,shards:[o.contentRef],children:r.jsx(Qs.div,{"data-state":Lp(o.open),...a,ref:t,style:{pointerEvents:"auto",...a.style}})})}),_a="DialogContent",rw=w.forwardRef((e,t)=>{const n=sw(_a,e.__scopeDialog),{forceMount:a=n.forceMount,...o}=e,c=fs(_a,e.__scopeDialog);return r.jsx(td,{present:a||c.open,children:c.modal?r.jsx(NR,{...o,ref:t}):r.jsx(CR,{...o,ref:t})})});rw.displayName=_a;var NR=w.forwardRef((e,t)=>{const n=fs(_a,e.__scopeDialog),a=w.useRef(null),o=Ta(t,n.contentRef,a);return w.useEffect(()=>{const c=a.current;if(c)return vR(c)},[]),r.jsx(ow,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Li(e.onCloseAutoFocus,c=>{c.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:Li(e.onPointerDownOutside,c=>{const u=c.detail.originalEvent,f=u.button===0&&u.ctrlKey===!0;(u.button===2||f)&&c.preventDefault()}),onFocusOutside:Li(e.onFocusOutside,c=>c.preventDefault())})}),CR=w.forwardRef((e,t)=>{const n=fs(_a,e.__scopeDialog),a=w.useRef(!1),o=w.useRef(!1);return r.jsx(ow,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:c=>{e.onCloseAutoFocus?.(c),c.defaultPrevented||(a.current||n.triggerRef.current?.focus(),c.preventDefault()),a.current=!1,o.current=!1},onInteractOutside:c=>{e.onInteractOutside?.(c),c.defaultPrevented||(a.current=!0,c.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const u=c.target;n.triggerRef.current?.contains(u)&&c.preventDefault(),c.detail.originalEvent.type==="focusin"&&o.current&&c.preventDefault()}})}),ow=w.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:a,onOpenAutoFocus:o,onCloseAutoFocus:c,...u}=e,f=fs(_a,n),m=w.useRef(null),p=Ta(t,m);return RT(),r.jsxs(r.Fragment,{children:[r.jsx(qj,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:o,onUnmountAutoFocus:c,children:r.jsx(Ij,{role:"dialog",id:f.contentId,"aria-describedby":f.descriptionId,"aria-labelledby":f.titleId,"data-state":Lp(f.open),...u,ref:p,onDismiss:()=>f.onOpenChange(!1)})}),r.jsxs(r.Fragment,{children:[r.jsx(kR,{titleId:f.titleId}),r.jsx(_R,{contentRef:m,descriptionId:f.descriptionId})]})]})}),Op="DialogTitle",lw=w.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,o=fs(Op,n);return r.jsx(Qs.h2,{id:o.titleId,...a,ref:t})});lw.displayName=Op;var cw="DialogDescription",uw=w.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,o=fs(cw,n);return r.jsx(Qs.p,{id:o.descriptionId,...a,ref:t})});uw.displayName=cw;var dw="DialogClose",fw=w.forwardRef((e,t)=>{const{__scopeDialog:n,...a}=e,o=fs(dw,n);return r.jsx(Qs.button,{type:"button",...a,ref:t,onClick:Li(e.onClick,()=>o.onOpenChange(!1))})});fw.displayName=dw;function Lp(e){return e?"open":"closed"}var hw="DialogTitleWarning",[yP,mw]=JA(hw,{contentName:_a,titleName:Op,docsSlug:"dialog"}),kR=({titleId:e})=>{const t=mw(hw),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
53
-
54
- If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
55
-
56
- For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return w.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},zR="DialogDescriptionWarning",_R=({contentRef:e,descriptionId:t})=>{const a=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${mw(zR).contentName}}.`;return w.useEffect(()=>{const o=e.current?.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(a))},[a,e,t]),null},pw=tw,gw=iw,Dp=aw,Mp=rw,$p=lw,yw=uw,vw=fw;const ER=pw,AR=gw,bw=w.forwardRef(({className:e,...t},n)=>r.jsx(Dp,{ref:n,className:es("fixed inset-0 z-50 bg-black/70 backdrop-blur-sm",e),...t}));bw.displayName=Dp.displayName;const TR=400,RR=1200,OR=720,xw=w.forwardRef(({className:e,children:t,...n},a)=>{const[o,c]=w.useState(OR),u=w.useRef(!1),f=w.useRef(0),m=w.useRef(0),p=w.useCallback(b=>{u.current=!0,f.current=b.clientX,m.current=o,b.target.setPointerCapture(b.pointerId),b.preventDefault()},[o]),v=w.useCallback(b=>{if(!u.current)return;const x=f.current-b.clientX,N=Math.min(RR,Math.max(TR,m.current+x));c(N)},[]),y=w.useCallback(()=>{u.current=!1},[]);return r.jsxs(AR,{children:[r.jsx(bw,{}),r.jsxs(Mp,{ref:a,className:es("fixed z-50 flex flex-col bg-zinc-950 px-5 py-4 shadow-2xl overflow-hidden","max-md:inset-x-0 max-md:bottom-0 max-md:top-auto max-md:max-h-[88vh] max-md:rounded-t-2xl max-md:border-t","md:inset-y-0 md:right-0 md:h-full md:border-l","border-zinc-800",e),style:{width:`min(${o}px, 100vw)`},...n,children:[r.jsx("div",{className:"absolute inset-y-0 left-0 w-1.5 cursor-col-resize hover:bg-zinc-700/50 active:bg-zinc-600/50 transition-colors max-md:hidden",onPointerDown:p,onPointerMove:v,onPointerUp:y}),t,r.jsxs(vw,{className:"absolute right-4 top-4 inline-flex size-8 items-center justify-center rounded-md text-zinc-500 transition hover:bg-zinc-900 hover:text-zinc-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-zinc-400",children:[r.jsx(Yu,{className:"size-4"}),r.jsx("span",{className:"sr-only",children:"Close"})]})]})]})});xw.displayName=Mp.displayName;const LR=({className:e,...t})=>r.jsx("div",{className:es("flex flex-col gap-1.5 pr-10",e),...t}),Sw=w.forwardRef(({className:e,...t},n)=>r.jsx($p,{ref:n,className:es("text-lg font-medium text-zinc-50",e),...t}));Sw.displayName=$p.displayName;const jw=w.forwardRef(({className:e,...t},n)=>r.jsx(yw,{ref:n,className:es("text-sm text-zinc-500",e),...t}));jw.displayName=yw.displayName;function DR({title:e,subtitle:t,children:n,open:a,onClose:o}){return r.jsx(ER,{open:a,onOpenChange:c=>c?void 0:o(),children:r.jsxs(xw,{children:[r.jsxs(LR,{className:"drawer-head",children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:t}),r.jsx(Sw,{id:"drawer-title",children:e}),r.jsx(jw,{className:"sr-only",children:t})]}),r.jsx("div",{className:"drawer-body",children:n})]})})}function ne(e,t,n){function a(f,m){if(f._zod||Object.defineProperty(f,"_zod",{value:{def:m,constr:u,traits:new Set},enumerable:!1}),f._zod.traits.has(e))return;f._zod.traits.add(e),t(f,m);const p=u.prototype,v=Object.keys(p);for(let y=0;y<v.length;y++){const b=v[y];b in f||(f[b]=p[b].bind(f))}}const o=n?.Parent??Object;class c extends o{}Object.defineProperty(c,"name",{value:e});function u(f){var m;const p=n?.Parent?new c:this;a(p,f),(m=p._zod).deferred??(m.deferred=[]);for(const v of p._zod.deferred)v();return p}return Object.defineProperty(u,"init",{value:a}),Object.defineProperty(u,Symbol.hasInstance,{value:f=>n?.Parent&&f instanceof n.Parent?!0:f?._zod?.traits?.has(e)}),Object.defineProperty(u,"name",{value:e}),u}class Dr extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class ww extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const Nw={};function $i(e){return Nw}function Cw(e){const t=Object.values(e).filter(a=>typeof a=="number");return Object.entries(e).filter(([a,o])=>t.indexOf(+a)===-1).map(([a,o])=>o)}function Im(e,t){return typeof t=="bigint"?t.toString():t}function Pp(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Up(e){return e==null}function Ip(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function MR(e,t){const n=(e.toString().split(".")[1]||"").length,a=t.toString();let o=(a.split(".")[1]||"").length;if(o===0&&/\d?e-\d?/.test(a)){const m=a.match(/\d?e-(\d?)/);m?.[1]&&(o=Number.parseInt(m[1]))}const c=n>o?n:o,u=Number.parseInt(e.toFixed(c).replace(".","")),f=Number.parseInt(t.toFixed(c).replace(".",""));return u%f/10**c}const zx=Symbol("evaluating");function ct(e,t,n){let a;Object.defineProperty(e,t,{get(){if(a!==zx)return a===void 0&&(a=zx,a=n()),a},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function Oa(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Ki(...e){const t={};for(const n of e){const a=Object.getOwnPropertyDescriptors(n);Object.assign(t,a)}return Object.defineProperties({},t)}function _x(e){return JSON.stringify(e)}function $R(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const kw="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Du(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const PR=Pp(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function Ir(e){if(Du(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(Du(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function zw(e){return Ir(e)?{...e}:Array.isArray(e)?[...e]:e}const UR=new Set(["string","number","symbol"]);function Br(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Hi(e,t,n){const a=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(a._zod.parent=e),a}function ke(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function IR(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const BR={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function qR(e,t){const n=e._zod.def,a=n.checks;if(a&&a.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const c=Ki(e._zod.def,{get shape(){const u={};for(const f in t){if(!(f in n.shape))throw new Error(`Unrecognized key: "${f}"`);t[f]&&(u[f]=n.shape[f])}return Oa(this,"shape",u),u},checks:[]});return Hi(e,c)}function KR(e,t){const n=e._zod.def,a=n.checks;if(a&&a.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const c=Ki(e._zod.def,{get shape(){const u={...e._zod.def.shape};for(const f in t){if(!(f in n.shape))throw new Error(`Unrecognized key: "${f}"`);t[f]&&delete u[f]}return Oa(this,"shape",u),u},checks:[]});return Hi(e,c)}function HR(e,t){if(!Ir(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const c=e._zod.def.shape;for(const u in t)if(Object.getOwnPropertyDescriptor(c,u)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=Ki(e._zod.def,{get shape(){const c={...e._zod.def.shape,...t};return Oa(this,"shape",c),c}});return Hi(e,o)}function GR(e,t){if(!Ir(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=Ki(e._zod.def,{get shape(){const a={...e._zod.def.shape,...t};return Oa(this,"shape",a),a}});return Hi(e,n)}function FR(e,t){const n=Ki(e._zod.def,{get shape(){const a={...e._zod.def.shape,...t._zod.def.shape};return Oa(this,"shape",a),a},get catchall(){return t._zod.def.catchall},checks:[]});return Hi(e,n)}function ZR(e,t,n){const o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const u=Ki(t._zod.def,{get shape(){const f=t._zod.def.shape,m={...f};if(n)for(const p in n){if(!(p in f))throw new Error(`Unrecognized key: "${p}"`);n[p]&&(m[p]=e?new e({type:"optional",innerType:f[p]}):f[p])}else for(const p in f)m[p]=e?new e({type:"optional",innerType:f[p]}):f[p];return Oa(this,"shape",m),m},checks:[]});return Hi(t,u)}function VR(e,t,n){const a=Ki(t._zod.def,{get shape(){const o=t._zod.def.shape,c={...o};if(n)for(const u in n){if(!(u in c))throw new Error(`Unrecognized key: "${u}"`);n[u]&&(c[u]=new e({type:"nonoptional",innerType:o[u]}))}else for(const u in o)c[u]=new e({type:"nonoptional",innerType:o[u]});return Oa(this,"shape",c),c}});return Hi(t,a)}function Er(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Ar(e,t){return t.map(n=>{var a;return(a=n).path??(a.path=[]),n.path.unshift(e),n})}function Wc(e){return typeof e=="string"?e:e?.message}function Pi(e,t,n){const a={...e,path:e.path??[]};if(!e.message){const o=Wc(e.inst?._zod.def?.error?.(e))??Wc(t?.error?.(e))??Wc(n.customError?.(e))??Wc(n.localeError?.(e))??"Invalid input";a.message=o}return delete a.inst,delete a.continue,t?.reportInput||delete a.input,a}function Bp(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function dl(...e){const[t,n,a]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:a}:{...t}}const _w=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Im,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Ew=ne("$ZodError",_w),Aw=ne("$ZodError",_w,{Parent:Error});function QR(e,t=n=>n.message){const n={},a=[];for(const o of e.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):a.push(t(o));return{formErrors:a,fieldErrors:n}}function YR(e,t=n=>n.message){const n={_errors:[]},a=o=>{for(const c of o.issues)if(c.code==="invalid_union"&&c.errors.length)c.errors.map(u=>a({issues:u}));else if(c.code==="invalid_key")a({issues:c.issues});else if(c.code==="invalid_element")a({issues:c.issues});else if(c.path.length===0)n._errors.push(t(c));else{let u=n,f=0;for(;f<c.path.length;){const m=c.path[f];f===c.path.length-1?(u[m]=u[m]||{_errors:[]},u[m]._errors.push(t(c))):u[m]=u[m]||{_errors:[]},u=u[m],f++}}};return a(e),n}const qp=e=>(t,n,a,o)=>{const c=a?Object.assign(a,{async:!1}):{async:!1},u=t._zod.run({value:n,issues:[]},c);if(u instanceof Promise)throw new Dr;if(u.issues.length){const f=new(o?.Err??e)(u.issues.map(m=>Pi(m,c,$i())));throw kw(f,o?.callee),f}return u.value},Kp=e=>async(t,n,a,o)=>{const c=a?Object.assign(a,{async:!0}):{async:!0};let u=t._zod.run({value:n,issues:[]},c);if(u instanceof Promise&&(u=await u),u.issues.length){const f=new(o?.Err??e)(u.issues.map(m=>Pi(m,c,$i())));throw kw(f,o?.callee),f}return u.value},id=e=>(t,n,a)=>{const o=a?{...a,async:!1}:{async:!1},c=t._zod.run({value:n,issues:[]},o);if(c instanceof Promise)throw new Dr;return c.issues.length?{success:!1,error:new(e??Ew)(c.issues.map(u=>Pi(u,o,$i())))}:{success:!0,data:c.value}},JR=id(Aw),ad=e=>async(t,n,a)=>{const o=a?Object.assign(a,{async:!0}):{async:!0};let c=t._zod.run({value:n,issues:[]},o);return c instanceof Promise&&(c=await c),c.issues.length?{success:!1,error:new e(c.issues.map(u=>Pi(u,o,$i())))}:{success:!0,data:c.value}},XR=ad(Aw),WR=e=>(t,n,a)=>{const o=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return qp(e)(t,n,o)},eO=e=>(t,n,a)=>qp(e)(t,n,a),tO=e=>async(t,n,a)=>{const o=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return Kp(e)(t,n,o)},nO=e=>async(t,n,a)=>Kp(e)(t,n,a),sO=e=>(t,n,a)=>{const o=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return id(e)(t,n,o)},iO=e=>(t,n,a)=>id(e)(t,n,a),aO=e=>async(t,n,a)=>{const o=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return ad(e)(t,n,o)},rO=e=>async(t,n,a)=>ad(e)(t,n,a),oO=/^[cC][^\s-]{8,}$/,lO=/^[0-9a-z]+$/,cO=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,uO=/^[0-9a-vA-V]{20}$/,dO=/^[A-Za-z0-9]{27}$/,fO=/^[a-zA-Z0-9_-]{21}$/,hO=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,mO=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Ex=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,pO=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,gO="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function yO(){return new RegExp(gO,"u")}const vO=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,bO=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,xO=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,SO=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,jO=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Tw=/^[A-Za-z0-9_-]*$/,wO=/^\+[1-9]\d{6,14}$/,Rw="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",NO=new RegExp(`^${Rw}$`);function Ow(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function CO(e){return new RegExp(`^${Ow(e)}$`)}function kO(e){const t=Ow({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const a=`${t}(?:${n.join("|")})`;return new RegExp(`^${Rw}T(?:${a})$`)}const zO=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},_O=/^-?\d+$/,Lw=/^-?\d+(?:\.\d+)?$/,EO=/^(?:true|false)$/i,AO=/^[^A-Z]*$/,TO=/^[^a-z]*$/,kn=ne("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Dw={number:"number",bigint:"bigint",object:"date"},Mw=ne("$ZodCheckLessThan",(e,t)=>{kn.init(e,t);const n=Dw[typeof t.value];e._zod.onattach.push(a=>{const o=a._zod.bag,c=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<c&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=a=>{(t.inclusive?a.value<=t.value:a.value<t.value)||a.issues.push({origin:n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:a.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),$w=ne("$ZodCheckGreaterThan",(e,t)=>{kn.init(e,t);const n=Dw[typeof t.value];e._zod.onattach.push(a=>{const o=a._zod.bag,c=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>c&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=a=>{(t.inclusive?a.value>=t.value:a.value>t.value)||a.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:a.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),RO=ne("$ZodCheckMultipleOf",(e,t)=>{kn.init(e,t),e._zod.onattach.push(n=>{var a;(a=n._zod.bag).multipleOf??(a.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):MR(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),OO=ne("$ZodCheckNumberFormat",(e,t)=>{kn.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),a=n?"int":"number",[o,c]=BR[t.format];e._zod.onattach.push(u=>{const f=u._zod.bag;f.format=t.format,f.minimum=o,f.maximum=c,n&&(f.pattern=_O)}),e._zod.check=u=>{const f=u.value;if(n){if(!Number.isInteger(f)){u.issues.push({expected:a,format:t.format,code:"invalid_type",continue:!1,input:f,inst:e});return}if(!Number.isSafeInteger(f)){f>0?u.issues.push({input:f,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:a,inclusive:!0,continue:!t.abort}):u.issues.push({input:f,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:a,inclusive:!0,continue:!t.abort});return}}f<o&&u.issues.push({origin:"number",input:f,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),f>c&&u.issues.push({origin:"number",input:f,code:"too_big",maximum:c,inclusive:!0,inst:e,continue:!t.abort})}}),LO=ne("$ZodCheckMaxLength",(e,t)=>{var n;kn.init(e,t),(n=e._zod.def).when??(n.when=a=>{const o=a.value;return!Up(o)&&o.length!==void 0}),e._zod.onattach.push(a=>{const o=a._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(a._zod.bag.maximum=t.maximum)}),e._zod.check=a=>{const o=a.value;if(o.length<=t.maximum)return;const u=Bp(o);a.issues.push({origin:u,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),DO=ne("$ZodCheckMinLength",(e,t)=>{var n;kn.init(e,t),(n=e._zod.def).when??(n.when=a=>{const o=a.value;return!Up(o)&&o.length!==void 0}),e._zod.onattach.push(a=>{const o=a._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(a._zod.bag.minimum=t.minimum)}),e._zod.check=a=>{const o=a.value;if(o.length>=t.minimum)return;const u=Bp(o);a.issues.push({origin:u,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),MO=ne("$ZodCheckLengthEquals",(e,t)=>{var n;kn.init(e,t),(n=e._zod.def).when??(n.when=a=>{const o=a.value;return!Up(o)&&o.length!==void 0}),e._zod.onattach.push(a=>{const o=a._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=a=>{const o=a.value,c=o.length;if(c===t.length)return;const u=Bp(o),f=c>t.length;a.issues.push({origin:u,...f?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:a.value,inst:e,continue:!t.abort})}}),rd=ne("$ZodCheckStringFormat",(e,t)=>{var n,a;kn.init(e,t),e._zod.onattach.push(o=>{const c=o._zod.bag;c.format=t.format,t.pattern&&(c.patterns??(c.patterns=new Set),c.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(a=e._zod).check??(a.check=()=>{})}),$O=ne("$ZodCheckRegex",(e,t)=>{rd.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),PO=ne("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=AO),rd.init(e,t)}),UO=ne("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=TO),rd.init(e,t)}),IO=ne("$ZodCheckIncludes",(e,t)=>{kn.init(e,t);const n=Br(t.includes),a=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=a,e._zod.onattach.push(o=>{const c=o._zod.bag;c.patterns??(c.patterns=new Set),c.patterns.add(a)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),BO=ne("$ZodCheckStartsWith",(e,t)=>{kn.init(e,t);const n=new RegExp(`^${Br(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(a=>{const o=a._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=a=>{a.value.startsWith(t.prefix)||a.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:a.value,inst:e,continue:!t.abort})}}),qO=ne("$ZodCheckEndsWith",(e,t)=>{kn.init(e,t);const n=new RegExp(`.*${Br(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(a=>{const o=a._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=a=>{a.value.endsWith(t.suffix)||a.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:a.value,inst:e,continue:!t.abort})}}),KO=ne("$ZodCheckOverwrite",(e,t)=>{kn.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class HO{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const a=t.split(`
57
- `).filter(u=>u),o=Math.min(...a.map(u=>u.length-u.trimStart().length)),c=a.map(u=>u.slice(o)).map(u=>" ".repeat(this.indent*2)+u);for(const u of c)this.content.push(u)}compile(){const t=Function,n=this?.args,o=[...(this?.content??[""]).map(c=>` ${c}`)];return new t(...n,o.join(`
58
- `))}}const GO={major:4,minor:3,patch:6},zt=ne("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=GO;const a=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&a.unshift(e);for(const o of a)for(const c of o._zod.onattach)c(e);if(a.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const o=(u,f,m)=>{let p=Er(u),v;for(const y of f){if(y._zod.def.when){if(!y._zod.def.when(u))continue}else if(p)continue;const b=u.issues.length,x=y._zod.check(u);if(x instanceof Promise&&m?.async===!1)throw new Dr;if(v||x instanceof Promise)v=(v??Promise.resolve()).then(async()=>{await x,u.issues.length!==b&&(p||(p=Er(u,b)))});else{if(u.issues.length===b)continue;p||(p=Er(u,b))}}return v?v.then(()=>u):u},c=(u,f,m)=>{if(Er(u))return u.aborted=!0,u;const p=o(f,a,m);if(p instanceof Promise){if(m.async===!1)throw new Dr;return p.then(v=>e._zod.parse(v,m))}return e._zod.parse(p,m)};e._zod.run=(u,f)=>{if(f.skipChecks)return e._zod.parse(u,f);if(f.direction==="backward"){const p=e._zod.parse({value:u.value,issues:[]},{...f,skipChecks:!0});return p instanceof Promise?p.then(v=>c(v,u,f)):c(p,u,f)}const m=e._zod.parse(u,f);if(m instanceof Promise){if(f.async===!1)throw new Dr;return m.then(p=>o(p,a,f))}return o(m,a,f)}}ct(e,"~standard",()=>({validate:o=>{try{const c=JR(e,o);return c.success?{value:c.data}:{issues:c.error?.issues}}catch{return XR(e,o).then(u=>u.success?{value:u.data}:{issues:u.error?.issues})}},vendor:"zod",version:1}))}),Hp=ne("$ZodString",(e,t)=>{zt.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??zO(e._zod.bag),e._zod.parse=(n,a)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),Nt=ne("$ZodStringFormat",(e,t)=>{rd.init(e,t),Hp.init(e,t)}),FO=ne("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=mO),Nt.init(e,t)}),ZO=ne("$ZodUUID",(e,t)=>{if(t.version){const a={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(a===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Ex(a))}else t.pattern??(t.pattern=Ex());Nt.init(e,t)}),VO=ne("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=pO),Nt.init(e,t)}),QO=ne("$ZodURL",(e,t)=>{Nt.init(e,t),e._zod.check=n=>{try{const a=n.value.trim(),o=new URL(a);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=o.href:n.value=a;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),YO=ne("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=yO()),Nt.init(e,t)}),JO=ne("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=fO),Nt.init(e,t)}),XO=ne("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=oO),Nt.init(e,t)}),WO=ne("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=lO),Nt.init(e,t)}),eL=ne("$ZodULID",(e,t)=>{t.pattern??(t.pattern=cO),Nt.init(e,t)}),tL=ne("$ZodXID",(e,t)=>{t.pattern??(t.pattern=uO),Nt.init(e,t)}),nL=ne("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=dO),Nt.init(e,t)}),sL=ne("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=kO(t)),Nt.init(e,t)}),iL=ne("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=NO),Nt.init(e,t)}),aL=ne("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=CO(t)),Nt.init(e,t)}),rL=ne("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=hO),Nt.init(e,t)}),oL=ne("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=vO),Nt.init(e,t),e._zod.bag.format="ipv4"}),lL=ne("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=bO),Nt.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),cL=ne("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=xO),Nt.init(e,t)}),uL=ne("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=SO),Nt.init(e,t),e._zod.check=n=>{const a=n.value.split("/");try{if(a.length!==2)throw new Error;const[o,c]=a;if(!c)throw new Error;const u=Number(c);if(`${u}`!==c)throw new Error;if(u<0||u>128)throw new Error;new URL(`http://[${o}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function Pw(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const dL=ne("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=jO),Nt.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{Pw(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function fL(e){if(!Tw.test(e))return!1;const t=e.replace(/[-_]/g,a=>a==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return Pw(n)}const hL=ne("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Tw),Nt.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{fL(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),mL=ne("$ZodE164",(e,t)=>{t.pattern??(t.pattern=wO),Nt.init(e,t)});function pL(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[a]=n;if(!a)return!1;const o=JSON.parse(atob(a));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}const gL=ne("$ZodJWT",(e,t)=>{Nt.init(e,t),e._zod.check=n=>{pL(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Uw=ne("$ZodNumber",(e,t)=>{zt.init(e,t),e._zod.pattern=e._zod.bag.pattern??Lw,e._zod.parse=(n,a)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const o=n.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return n;const c=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...c?{received:c}:{}}),n}}),yL=ne("$ZodNumberFormat",(e,t)=>{OO.init(e,t),Uw.init(e,t)}),vL=ne("$ZodBoolean",(e,t)=>{zt.init(e,t),e._zod.pattern=EO,e._zod.parse=(n,a)=>{if(t.coerce)try{n.value=!!n.value}catch{}const o=n.value;return typeof o=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}}),bL=ne("$ZodUnknown",(e,t)=>{zt.init(e,t),e._zod.parse=n=>n}),xL=ne("$ZodNever",(e,t)=>{zt.init(e,t),e._zod.parse=(n,a)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function Ax(e,t,n){e.issues.length&&t.issues.push(...Ar(n,e.issues)),t.value[n]=e.value}const SL=ne("$ZodArray",(e,t)=>{zt.init(e,t),e._zod.parse=(n,a)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);const c=[];for(let u=0;u<o.length;u++){const f=o[u],m=t.element._zod.run({value:f,issues:[]},a);m instanceof Promise?c.push(m.then(p=>Ax(p,n,u))):Ax(m,n,u)}return c.length?Promise.all(c).then(()=>n):n}});function Mu(e,t,n,a,o){if(e.issues.length){if(o&&!(n in a))return;t.issues.push(...Ar(n,e.issues))}e.value===void 0?n in a&&(t.value[n]=void 0):t.value[n]=e.value}function Iw(e){const t=Object.keys(e.shape);for(const a of t)if(!e.shape?.[a]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${a}": expected a Zod schema`);const n=IR(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function Bw(e,t,n,a,o,c){const u=[],f=o.keySet,m=o.catchall._zod,p=m.def.type,v=m.optout==="optional";for(const y in t){if(f.has(y))continue;if(p==="never"){u.push(y);continue}const b=m.run({value:t[y],issues:[]},a);b instanceof Promise?e.push(b.then(x=>Mu(x,n,y,t,v))):Mu(b,n,y,t,v)}return u.length&&n.issues.push({code:"unrecognized_keys",keys:u,input:t,inst:c}),e.length?Promise.all(e).then(()=>n):n}const jL=ne("$ZodObject",(e,t)=>{if(zt.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const f=t.shape;Object.defineProperty(t,"shape",{get:()=>{const m={...f};return Object.defineProperty(t,"shape",{value:m}),m}})}const a=Pp(()=>Iw(t));ct(e._zod,"propValues",()=>{const f=t.shape,m={};for(const p in f){const v=f[p]._zod;if(v.values){m[p]??(m[p]=new Set);for(const y of v.values)m[p].add(y)}}return m});const o=Du,c=t.catchall;let u;e._zod.parse=(f,m)=>{u??(u=a.value);const p=f.value;if(!o(p))return f.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),f;f.value={};const v=[],y=u.shape;for(const b of u.keys){const x=y[b],N=x._zod.optout==="optional",S=x._zod.run({value:p[b],issues:[]},m);S instanceof Promise?v.push(S.then(C=>Mu(C,f,b,p,N))):Mu(S,f,b,p,N)}return c?Bw(v,p,f,m,a.value,e):v.length?Promise.all(v).then(()=>f):f}}),wL=ne("$ZodObjectJIT",(e,t)=>{jL.init(e,t);const n=e._zod.parse,a=Pp(()=>Iw(t)),o=b=>{const x=new HO(["shape","payload","ctx"]),N=a.value,S=A=>{const z=_x(A);return`shape[${z}]._zod.run({ value: input[${z}], issues: [] }, ctx)`};x.write("const input = payload.value;");const C=Object.create(null);let k=0;for(const A of N.keys)C[A]=`key_${k++}`;x.write("const newResult = {};");for(const A of N.keys){const z=C[A],$=_x(A),E=b[A]?._zod?.optout==="optional";x.write(`const ${z} = ${S(A)};`),E?x.write(`
59
- if (${z}.issues.length) {
60
- if (${$} in input) {
61
- payload.issues = payload.issues.concat(${z}.issues.map(iss => ({
62
- ...iss,
63
- path: iss.path ? [${$}, ...iss.path] : [${$}]
64
- })));
65
- }
66
- }
67
-
68
- if (${z}.value === undefined) {
69
- if (${$} in input) {
70
- newResult[${$}] = undefined;
71
- }
72
- } else {
73
- newResult[${$}] = ${z}.value;
74
- }
75
-
76
- `):x.write(`
77
- if (${z}.issues.length) {
78
- payload.issues = payload.issues.concat(${z}.issues.map(iss => ({
79
- ...iss,
80
- path: iss.path ? [${$}, ...iss.path] : [${$}]
81
- })));
82
- }
83
-
84
- if (${z}.value === undefined) {
85
- if (${$} in input) {
86
- newResult[${$}] = undefined;
87
- }
88
- } else {
89
- newResult[${$}] = ${z}.value;
90
- }
91
-
92
- `)}x.write("payload.value = newResult;"),x.write("return payload;");const T=x.compile();return(A,z)=>T(b,A,z)};let c;const u=Du,f=!Nw.jitless,p=f&&PR.value,v=t.catchall;let y;e._zod.parse=(b,x)=>{y??(y=a.value);const N=b.value;return u(N)?f&&p&&x?.async===!1&&x.jitless!==!0?(c||(c=o(t.shape)),b=c(b,x),v?Bw([],N,b,x,y,e):b):n(b,x):(b.issues.push({expected:"object",code:"invalid_type",input:N,inst:e}),b)}});function Tx(e,t,n,a){for(const c of e)if(c.issues.length===0)return t.value=c.value,t;const o=e.filter(c=>!Er(c));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(c=>c.issues.map(u=>Pi(u,a,$i())))}),t)}const NL=ne("$ZodUnion",(e,t)=>{zt.init(e,t),ct(e._zod,"optin",()=>t.options.some(o=>o._zod.optin==="optional")?"optional":void 0),ct(e._zod,"optout",()=>t.options.some(o=>o._zod.optout==="optional")?"optional":void 0),ct(e._zod,"values",()=>{if(t.options.every(o=>o._zod.values))return new Set(t.options.flatMap(o=>Array.from(o._zod.values)))}),ct(e._zod,"pattern",()=>{if(t.options.every(o=>o._zod.pattern)){const o=t.options.map(c=>c._zod.pattern);return new RegExp(`^(${o.map(c=>Ip(c.source)).join("|")})$`)}});const n=t.options.length===1,a=t.options[0]._zod.run;e._zod.parse=(o,c)=>{if(n)return a(o,c);let u=!1;const f=[];for(const m of t.options){const p=m._zod.run({value:o.value,issues:[]},c);if(p instanceof Promise)f.push(p),u=!0;else{if(p.issues.length===0)return p;f.push(p)}}return u?Promise.all(f).then(m=>Tx(m,o,e,c)):Tx(f,o,e,c)}}),CL=ne("$ZodIntersection",(e,t)=>{zt.init(e,t),e._zod.parse=(n,a)=>{const o=n.value,c=t.left._zod.run({value:o,issues:[]},a),u=t.right._zod.run({value:o,issues:[]},a);return c instanceof Promise||u instanceof Promise?Promise.all([c,u]).then(([m,p])=>Rx(n,m,p)):Rx(n,c,u)}});function Bm(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Ir(e)&&Ir(t)){const n=Object.keys(t),a=Object.keys(e).filter(c=>n.indexOf(c)!==-1),o={...e,...t};for(const c of a){const u=Bm(e[c],t[c]);if(!u.valid)return{valid:!1,mergeErrorPath:[c,...u.mergeErrorPath]};o[c]=u.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let a=0;a<e.length;a++){const o=e[a],c=t[a],u=Bm(o,c);if(!u.valid)return{valid:!1,mergeErrorPath:[a,...u.mergeErrorPath]};n.push(u.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Rx(e,t,n){const a=new Map;let o;for(const f of t.issues)if(f.code==="unrecognized_keys"){o??(o=f);for(const m of f.keys)a.has(m)||a.set(m,{}),a.get(m).l=!0}else e.issues.push(f);for(const f of n.issues)if(f.code==="unrecognized_keys")for(const m of f.keys)a.has(m)||a.set(m,{}),a.get(m).r=!0;else e.issues.push(f);const c=[...a].filter(([,f])=>f.l&&f.r).map(([f])=>f);if(c.length&&o&&e.issues.push({...o,keys:c}),Er(e))return e;const u=Bm(t.value,n.value);if(!u.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(u.mergeErrorPath)}`);return e.value=u.data,e}const kL=ne("$ZodRecord",(e,t)=>{zt.init(e,t),e._zod.parse=(n,a)=>{const o=n.value;if(!Ir(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;const c=[],u=t.keyType._zod.values;if(u){n.value={};const f=new Set;for(const p of u)if(typeof p=="string"||typeof p=="number"||typeof p=="symbol"){f.add(typeof p=="number"?p.toString():p);const v=t.valueType._zod.run({value:o[p],issues:[]},a);v instanceof Promise?c.push(v.then(y=>{y.issues.length&&n.issues.push(...Ar(p,y.issues)),n.value[p]=y.value})):(v.issues.length&&n.issues.push(...Ar(p,v.issues)),n.value[p]=v.value)}let m;for(const p in o)f.has(p)||(m=m??[],m.push(p));m&&m.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:m})}else{n.value={};for(const f of Reflect.ownKeys(o)){if(f==="__proto__")continue;let m=t.keyType._zod.run({value:f,issues:[]},a);if(m instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof f=="string"&&Lw.test(f)&&m.issues.length){const y=t.keyType._zod.run({value:Number(f),issues:[]},a);if(y instanceof Promise)throw new Error("Async schemas not supported in object keys currently");y.issues.length===0&&(m=y)}if(m.issues.length){t.mode==="loose"?n.value[f]=o[f]:n.issues.push({code:"invalid_key",origin:"record",issues:m.issues.map(y=>Pi(y,a,$i())),input:f,path:[f],inst:e});continue}const v=t.valueType._zod.run({value:o[f],issues:[]},a);v instanceof Promise?c.push(v.then(y=>{y.issues.length&&n.issues.push(...Ar(f,y.issues)),n.value[m.value]=y.value})):(v.issues.length&&n.issues.push(...Ar(f,v.issues)),n.value[m.value]=v.value)}}return c.length?Promise.all(c).then(()=>n):n}}),zL=ne("$ZodEnum",(e,t)=>{zt.init(e,t);const n=Cw(t.entries),a=new Set(n);e._zod.values=a,e._zod.pattern=new RegExp(`^(${n.filter(o=>UR.has(typeof o)).map(o=>typeof o=="string"?Br(o):o.toString()).join("|")})$`),e._zod.parse=(o,c)=>{const u=o.value;return a.has(u)||o.issues.push({code:"invalid_value",values:n,input:u,inst:e}),o}}),_L=ne("$ZodLiteral",(e,t)=>{if(zt.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(a=>typeof a=="string"?Br(a):a?Br(a.toString()):String(a)).join("|")})$`),e._zod.parse=(a,o)=>{const c=a.value;return n.has(c)||a.issues.push({code:"invalid_value",values:t.values,input:c,inst:e}),a}}),EL=ne("$ZodTransform",(e,t)=>{zt.init(e,t),e._zod.parse=(n,a)=>{if(a.direction==="backward")throw new ww(e.constructor.name);const o=t.transform(n.value,n);if(a.async)return(o instanceof Promise?o:Promise.resolve(o)).then(u=>(n.value=u,n));if(o instanceof Promise)throw new Dr;return n.value=o,n}});function Ox(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const qw=ne("$ZodOptional",(e,t)=>{zt.init(e,t),e._zod.optin="optional",e._zod.optout="optional",ct(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),ct(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Ip(n.source)})?$`):void 0}),e._zod.parse=(n,a)=>{if(t.innerType._zod.optin==="optional"){const o=t.innerType._zod.run(n,a);return o instanceof Promise?o.then(c=>Ox(c,n.value)):Ox(o,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,a)}}),AL=ne("$ZodExactOptional",(e,t)=>{qw.init(e,t),ct(e._zod,"values",()=>t.innerType._zod.values),ct(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,a)=>t.innerType._zod.run(n,a)}),TL=ne("$ZodNullable",(e,t)=>{zt.init(e,t),ct(e._zod,"optin",()=>t.innerType._zod.optin),ct(e._zod,"optout",()=>t.innerType._zod.optout),ct(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Ip(n.source)}|null)$`):void 0}),ct(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,a)=>n.value===null?n:t.innerType._zod.run(n,a)}),RL=ne("$ZodDefault",(e,t)=>{zt.init(e,t),e._zod.optin="optional",ct(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,a)=>{if(a.direction==="backward")return t.innerType._zod.run(n,a);if(n.value===void 0)return n.value=t.defaultValue,n;const o=t.innerType._zod.run(n,a);return o instanceof Promise?o.then(c=>Lx(c,t)):Lx(o,t)}});function Lx(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const OL=ne("$ZodPrefault",(e,t)=>{zt.init(e,t),e._zod.optin="optional",ct(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,a)=>(a.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,a))}),LL=ne("$ZodNonOptional",(e,t)=>{zt.init(e,t),ct(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(a=>a!==void 0)):void 0}),e._zod.parse=(n,a)=>{const o=t.innerType._zod.run(n,a);return o instanceof Promise?o.then(c=>Dx(c,e)):Dx(o,e)}});function Dx(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const DL=ne("$ZodCatch",(e,t)=>{zt.init(e,t),ct(e._zod,"optin",()=>t.innerType._zod.optin),ct(e._zod,"optout",()=>t.innerType._zod.optout),ct(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,a)=>{if(a.direction==="backward")return t.innerType._zod.run(n,a);const o=t.innerType._zod.run(n,a);return o instanceof Promise?o.then(c=>(n.value=c.value,c.issues.length&&(n.value=t.catchValue({...n,error:{issues:c.issues.map(u=>Pi(u,a,$i()))},input:n.value}),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(c=>Pi(c,a,$i()))},input:n.value}),n.issues=[]),n)}}),ML=ne("$ZodPipe",(e,t)=>{zt.init(e,t),ct(e._zod,"values",()=>t.in._zod.values),ct(e._zod,"optin",()=>t.in._zod.optin),ct(e._zod,"optout",()=>t.out._zod.optout),ct(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,a)=>{if(a.direction==="backward"){const c=t.out._zod.run(n,a);return c instanceof Promise?c.then(u=>eu(u,t.in,a)):eu(c,t.in,a)}const o=t.in._zod.run(n,a);return o instanceof Promise?o.then(c=>eu(c,t.out,a)):eu(o,t.out,a)}});function eu(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const $L=ne("$ZodReadonly",(e,t)=>{zt.init(e,t),ct(e._zod,"propValues",()=>t.innerType._zod.propValues),ct(e._zod,"values",()=>t.innerType._zod.values),ct(e._zod,"optin",()=>t.innerType?._zod?.optin),ct(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(n,a)=>{if(a.direction==="backward")return t.innerType._zod.run(n,a);const o=t.innerType._zod.run(n,a);return o instanceof Promise?o.then(Mx):Mx(o)}});function Mx(e){return e.value=Object.freeze(e.value),e}const PL=ne("$ZodCustom",(e,t)=>{kn.init(e,t),zt.init(e,t),e._zod.parse=(n,a)=>n,e._zod.check=n=>{const a=n.value,o=t.fn(a);if(o instanceof Promise)return o.then(c=>$x(c,n,a,e));$x(o,n,a,e)}});function $x(e,t,n,a){if(!e){const o={code:"custom",input:n,inst:a,path:[...a._zod.def.path??[]],continue:!a._zod.def.abort};a._zod.def.params&&(o.params=a._zod.def.params),t.issues.push(dl(o))}}var Px;class UL{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const a=n[0];return this._map.set(t,a),a&&typeof a=="object"&&"id"in a&&this._idmap.set(a.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const a={...this.get(n)??{}};delete a.id;const o={...a,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function IL(){return new UL}(Px=globalThis).__zod_globalRegistry??(Px.__zod_globalRegistry=IL());const Jo=globalThis.__zod_globalRegistry;function BL(e,t){return new e({type:"string",...ke(t)})}function qL(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...ke(t)})}function Ux(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...ke(t)})}function KL(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...ke(t)})}function HL(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...ke(t)})}function GL(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...ke(t)})}function FL(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...ke(t)})}function ZL(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...ke(t)})}function VL(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...ke(t)})}function QL(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...ke(t)})}function YL(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...ke(t)})}function JL(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...ke(t)})}function XL(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...ke(t)})}function WL(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...ke(t)})}function eD(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...ke(t)})}function tD(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...ke(t)})}function nD(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...ke(t)})}function sD(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...ke(t)})}function iD(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...ke(t)})}function aD(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...ke(t)})}function rD(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...ke(t)})}function oD(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...ke(t)})}function lD(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...ke(t)})}function cD(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...ke(t)})}function uD(e,t){return new e({type:"string",format:"date",check:"string_format",...ke(t)})}function dD(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...ke(t)})}function fD(e,t){return new e({type:"string",format:"duration",check:"string_format",...ke(t)})}function hD(e,t){return new e({type:"number",checks:[],...ke(t)})}function mD(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...ke(t)})}function pD(e,t){return new e({type:"boolean",...ke(t)})}function gD(e){return new e({type:"unknown"})}function yD(e,t){return new e({type:"never",...ke(t)})}function Ix(e,t){return new Mw({check:"less_than",...ke(t),value:e,inclusive:!1})}function im(e,t){return new Mw({check:"less_than",...ke(t),value:e,inclusive:!0})}function Bx(e,t){return new $w({check:"greater_than",...ke(t),value:e,inclusive:!1})}function am(e,t){return new $w({check:"greater_than",...ke(t),value:e,inclusive:!0})}function qx(e,t){return new RO({check:"multiple_of",...ke(t),value:e})}function Kw(e,t){return new LO({check:"max_length",...ke(t),maximum:e})}function $u(e,t){return new DO({check:"min_length",...ke(t),minimum:e})}function Hw(e,t){return new MO({check:"length_equals",...ke(t),length:e})}function vD(e,t){return new $O({check:"string_format",format:"regex",...ke(t),pattern:e})}function bD(e){return new PO({check:"string_format",format:"lowercase",...ke(e)})}function xD(e){return new UO({check:"string_format",format:"uppercase",...ke(e)})}function SD(e,t){return new IO({check:"string_format",format:"includes",...ke(t),includes:e})}function jD(e,t){return new BO({check:"string_format",format:"starts_with",...ke(t),prefix:e})}function wD(e,t){return new qO({check:"string_format",format:"ends_with",...ke(t),suffix:e})}function Hr(e){return new KO({check:"overwrite",tx:e})}function ND(e){return Hr(t=>t.normalize(e))}function CD(){return Hr(e=>e.trim())}function kD(){return Hr(e=>e.toLowerCase())}function zD(){return Hr(e=>e.toUpperCase())}function _D(){return Hr(e=>$R(e))}function ED(e,t,n){return new e({type:"array",element:t,...ke(n)})}function AD(e,t,n){return new e({type:"custom",check:"custom",fn:t,...ke(n)})}function TD(e){const t=RD(n=>(n.addIssue=a=>{if(typeof a=="string")n.issues.push(dl(a,n.value,t._zod.def));else{const o=a;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=n.value),o.inst??(o.inst=t),o.continue??(o.continue=!t._zod.def.abort),n.issues.push(dl(o))}},e(n.value,n)));return t}function RD(e,t){const n=new kn({check:"custom",...ke(t)});return n._zod.check=e,n}function Gw(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??Jo,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function Ht(e,t,n={path:[],schemaPath:[]}){var a;const o=e._zod.def,c=t.seen.get(e);if(c)return c.count++,n.schemaPath.includes(e)&&(c.cycle=n.path),c.schema;const u={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,u);const f=e._zod.toJSONSchema?.();if(f)u.schema=f;else{const v={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,u.schema,v);else{const b=u.schema,x=t.processors[o.type];if(!x)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);x(e,t,b,v)}const y=e._zod.parent;y&&(u.ref||(u.ref=y),Ht(y,t,v),t.seen.get(y).isParent=!0)}const m=t.metadataRegistry.get(e);return m&&Object.assign(u.schema,m),t.io==="input"&&dn(e)&&(delete u.schema.examples,delete u.schema.default),t.io==="input"&&u.schema._prefault&&((a=u.schema).default??(a.default=u.schema._prefault)),delete u.schema._prefault,t.seen.get(e).schema}function Fw(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const a=new Map;for(const u of e.seen.entries()){const f=e.metadataRegistry.get(u[0])?.id;if(f){const m=a.get(f);if(m&&m!==u[0])throw new Error(`Duplicate schema id "${f}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);a.set(f,u[0])}}const o=u=>{const f=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const y=e.external.registry.get(u[0])?.id,b=e.external.uri??(N=>N);if(y)return{ref:b(y)};const x=u[1].defId??u[1].schema.id??`schema${e.counter++}`;return u[1].defId=x,{defId:x,ref:`${b("__shared")}#/${f}/${x}`}}if(u[1]===n)return{ref:"#"};const p=`#/${f}/`,v=u[1].schema.id??`__schema${e.counter++}`;return{defId:v,ref:p+v}},c=u=>{if(u[1].schema.$ref)return;const f=u[1],{ref:m,defId:p}=o(u);f.def={...f.schema},p&&(f.defId=p);const v=f.schema;for(const y in v)delete v[y];v.$ref=m};if(e.cycles==="throw")for(const u of e.seen.entries()){const f=u[1];if(f.cycle)throw new Error(`Cycle detected: #/${f.cycle?.join("/")}/<root>
93
-
94
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const u of e.seen.entries()){const f=u[1];if(t===u[0]){c(u);continue}if(e.external){const p=e.external.registry.get(u[0])?.id;if(t!==u[0]&&p){c(u);continue}}if(e.metadataRegistry.get(u[0])?.id){c(u);continue}if(f.cycle){c(u);continue}if(f.count>1&&e.reused==="ref"){c(u);continue}}}function Zw(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const a=u=>{const f=e.seen.get(u);if(f.ref===null)return;const m=f.def??f.schema,p={...m},v=f.ref;if(f.ref=null,v){a(v);const b=e.seen.get(v),x=b.schema;if(x.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(m.allOf=m.allOf??[],m.allOf.push(x)):Object.assign(m,x),Object.assign(m,p),u._zod.parent===v)for(const S in m)S==="$ref"||S==="allOf"||S in p||delete m[S];if(x.$ref&&b.def)for(const S in m)S==="$ref"||S==="allOf"||S in b.def&&JSON.stringify(m[S])===JSON.stringify(b.def[S])&&delete m[S]}const y=u._zod.parent;if(y&&y!==v){a(y);const b=e.seen.get(y);if(b?.schema.$ref&&(m.$ref=b.schema.$ref,b.def))for(const x in m)x==="$ref"||x==="allOf"||x in b.def&&JSON.stringify(m[x])===JSON.stringify(b.def[x])&&delete m[x]}e.override({zodSchema:u,jsonSchema:m,path:f.path??[]})};for(const u of[...e.seen.entries()].reverse())a(u[0]);const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const u=e.external.registry.get(t)?.id;if(!u)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(u)}Object.assign(o,n.def??n.schema);const c=e.external?.defs??{};for(const u of e.seen.entries()){const f=u[1];f.def&&f.defId&&(c[f.defId]=f.def)}e.external||Object.keys(c).length>0&&(e.target==="draft-2020-12"?o.$defs=c:o.definitions=c);try{const u=JSON.parse(JSON.stringify(o));return Object.defineProperty(u,"~standard",{value:{...t["~standard"],jsonSchema:{input:Pu(t,"input",e.processors),output:Pu(t,"output",e.processors)}},enumerable:!1,writable:!1}),u}catch{throw new Error("Error converting schema to JSON.")}}function dn(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const a=e._zod.def;if(a.type==="transform")return!0;if(a.type==="array")return dn(a.element,n);if(a.type==="set")return dn(a.valueType,n);if(a.type==="lazy")return dn(a.getter(),n);if(a.type==="promise"||a.type==="optional"||a.type==="nonoptional"||a.type==="nullable"||a.type==="readonly"||a.type==="default"||a.type==="prefault")return dn(a.innerType,n);if(a.type==="intersection")return dn(a.left,n)||dn(a.right,n);if(a.type==="record"||a.type==="map")return dn(a.keyType,n)||dn(a.valueType,n);if(a.type==="pipe")return dn(a.in,n)||dn(a.out,n);if(a.type==="object"){for(const o in a.shape)if(dn(a.shape[o],n))return!0;return!1}if(a.type==="union"){for(const o of a.options)if(dn(o,n))return!0;return!1}if(a.type==="tuple"){for(const o of a.items)if(dn(o,n))return!0;return!!(a.rest&&dn(a.rest,n))}return!1}const OD=(e,t={})=>n=>{const a=Gw({...n,processors:t});return Ht(e,a),Fw(a,e),Zw(a,e)},Pu=(e,t,n={})=>a=>{const{libraryOptions:o,target:c}=a??{},u=Gw({...o??{},target:c,io:t,processors:n});return Ht(e,u),Fw(u,e),Zw(u,e)},LD={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},DD=(e,t,n,a)=>{const o=n;o.type="string";const{minimum:c,maximum:u,format:f,patterns:m,contentEncoding:p}=e._zod.bag;if(typeof c=="number"&&(o.minLength=c),typeof u=="number"&&(o.maxLength=u),f&&(o.format=LD[f]??f,o.format===""&&delete o.format,f==="time"&&delete o.format),p&&(o.contentEncoding=p),m&&m.size>0){const v=[...m];v.length===1?o.pattern=v[0].source:v.length>1&&(o.allOf=[...v.map(y=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:y.source}))])}},MD=(e,t,n,a)=>{const o=n,{minimum:c,maximum:u,format:f,multipleOf:m,exclusiveMaximum:p,exclusiveMinimum:v}=e._zod.bag;typeof f=="string"&&f.includes("int")?o.type="integer":o.type="number",typeof v=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.minimum=v,o.exclusiveMinimum=!0):o.exclusiveMinimum=v),typeof c=="number"&&(o.minimum=c,typeof v=="number"&&t.target!=="draft-04"&&(v>=c?delete o.minimum:delete o.exclusiveMinimum)),typeof p=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(o.maximum=p,o.exclusiveMaximum=!0):o.exclusiveMaximum=p),typeof u=="number"&&(o.maximum=u,typeof p=="number"&&t.target!=="draft-04"&&(p<=u?delete o.maximum:delete o.exclusiveMaximum)),typeof m=="number"&&(o.multipleOf=m)},$D=(e,t,n,a)=>{n.type="boolean"},PD=(e,t,n,a)=>{n.not={}},UD=(e,t,n,a)=>{},ID=(e,t,n,a)=>{const o=e._zod.def,c=Cw(o.entries);c.every(u=>typeof u=="number")&&(n.type="number"),c.every(u=>typeof u=="string")&&(n.type="string"),n.enum=c},BD=(e,t,n,a)=>{const o=e._zod.def,c=[];for(const u of o.values)if(u===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof u=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");c.push(Number(u))}else c.push(u);if(c.length!==0)if(c.length===1){const u=c[0];n.type=u===null?"null":typeof u,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[u]:n.const=u}else c.every(u=>typeof u=="number")&&(n.type="number"),c.every(u=>typeof u=="string")&&(n.type="string"),c.every(u=>typeof u=="boolean")&&(n.type="boolean"),c.every(u=>u===null)&&(n.type="null"),n.enum=c},qD=(e,t,n,a)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},KD=(e,t,n,a)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},HD=(e,t,n,a)=>{const o=n,c=e._zod.def,{minimum:u,maximum:f}=e._zod.bag;typeof u=="number"&&(o.minItems=u),typeof f=="number"&&(o.maxItems=f),o.type="array",o.items=Ht(c.element,t,{...a,path:[...a.path,"items"]})},GD=(e,t,n,a)=>{const o=n,c=e._zod.def;o.type="object",o.properties={};const u=c.shape;for(const p in u)o.properties[p]=Ht(u[p],t,{...a,path:[...a.path,"properties",p]});const f=new Set(Object.keys(u)),m=new Set([...f].filter(p=>{const v=c.shape[p]._zod;return t.io==="input"?v.optin===void 0:v.optout===void 0}));m.size>0&&(o.required=Array.from(m)),c.catchall?._zod.def.type==="never"?o.additionalProperties=!1:c.catchall?c.catchall&&(o.additionalProperties=Ht(c.catchall,t,{...a,path:[...a.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},FD=(e,t,n,a)=>{const o=e._zod.def,c=o.inclusive===!1,u=o.options.map((f,m)=>Ht(f,t,{...a,path:[...a.path,c?"oneOf":"anyOf",m]}));c?n.oneOf=u:n.anyOf=u},ZD=(e,t,n,a)=>{const o=e._zod.def,c=Ht(o.left,t,{...a,path:[...a.path,"allOf",0]}),u=Ht(o.right,t,{...a,path:[...a.path,"allOf",1]}),f=p=>"allOf"in p&&Object.keys(p).length===1,m=[...f(c)?c.allOf:[c],...f(u)?u.allOf:[u]];n.allOf=m},VD=(e,t,n,a)=>{const o=n,c=e._zod.def;o.type="object";const u=c.keyType,m=u._zod.bag?.patterns;if(c.mode==="loose"&&m&&m.size>0){const v=Ht(c.valueType,t,{...a,path:[...a.path,"patternProperties","*"]});o.patternProperties={};for(const y of m)o.patternProperties[y.source]=v}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=Ht(c.keyType,t,{...a,path:[...a.path,"propertyNames"]})),o.additionalProperties=Ht(c.valueType,t,{...a,path:[...a.path,"additionalProperties"]});const p=u._zod.values;if(p){const v=[...p].filter(y=>typeof y=="string"||typeof y=="number");v.length>0&&(o.required=v)}},QD=(e,t,n,a)=>{const o=e._zod.def,c=Ht(o.innerType,t,a),u=t.seen.get(e);t.target==="openapi-3.0"?(u.ref=o.innerType,n.nullable=!0):n.anyOf=[c,{type:"null"}]},YD=(e,t,n,a)=>{const o=e._zod.def;Ht(o.innerType,t,a);const c=t.seen.get(e);c.ref=o.innerType},JD=(e,t,n,a)=>{const o=e._zod.def;Ht(o.innerType,t,a);const c=t.seen.get(e);c.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},XD=(e,t,n,a)=>{const o=e._zod.def;Ht(o.innerType,t,a);const c=t.seen.get(e);c.ref=o.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},WD=(e,t,n,a)=>{const o=e._zod.def;Ht(o.innerType,t,a);const c=t.seen.get(e);c.ref=o.innerType;let u;try{u=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=u},e5=(e,t,n,a)=>{const o=e._zod.def,c=t.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;Ht(c,t,a);const u=t.seen.get(e);u.ref=c},t5=(e,t,n,a)=>{const o=e._zod.def;Ht(o.innerType,t,a);const c=t.seen.get(e);c.ref=o.innerType,n.readOnly=!0},Vw=(e,t,n,a)=>{const o=e._zod.def;Ht(o.innerType,t,a);const c=t.seen.get(e);c.ref=o.innerType},n5=ne("ZodISODateTime",(e,t)=>{sL.init(e,t),Et.init(e,t)});function s5(e){return cD(n5,e)}const i5=ne("ZodISODate",(e,t)=>{iL.init(e,t),Et.init(e,t)});function a5(e){return uD(i5,e)}const r5=ne("ZodISOTime",(e,t)=>{aL.init(e,t),Et.init(e,t)});function o5(e){return dD(r5,e)}const l5=ne("ZodISODuration",(e,t)=>{rL.init(e,t),Et.init(e,t)});function c5(e){return fD(l5,e)}const u5=(e,t)=>{Ew.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>YR(e,n)},flatten:{value:n=>QR(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,Im,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,Im,2)}},isEmpty:{get(){return e.issues.length===0}}})},ts=ne("ZodError",u5,{Parent:Error}),d5=qp(ts),f5=Kp(ts),h5=id(ts),m5=ad(ts),p5=WR(ts),g5=eO(ts),y5=tO(ts),v5=nO(ts),b5=sO(ts),x5=iO(ts),S5=aO(ts),j5=rO(ts),_t=ne("ZodType",(e,t)=>(zt.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Pu(e,"input"),output:Pu(e,"output")}}),e.toJSONSchema=OD(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(Ki(t,{checks:[...t.checks??[],...n.map(a=>typeof a=="function"?{_zod:{check:a,def:{check:"custom"},onattach:[]}}:a)]}),{parent:!0}),e.with=e.check,e.clone=(n,a)=>Hi(e,n,a),e.brand=()=>e,e.register=((n,a)=>(n.add(e,a),e)),e.parse=(n,a)=>d5(e,n,a,{callee:e.parse}),e.safeParse=(n,a)=>h5(e,n,a),e.parseAsync=async(n,a)=>f5(e,n,a,{callee:e.parseAsync}),e.safeParseAsync=async(n,a)=>m5(e,n,a),e.spa=e.safeParseAsync,e.encode=(n,a)=>p5(e,n,a),e.decode=(n,a)=>g5(e,n,a),e.encodeAsync=async(n,a)=>y5(e,n,a),e.decodeAsync=async(n,a)=>v5(e,n,a),e.safeEncode=(n,a)=>b5(e,n,a),e.safeDecode=(n,a)=>x5(e,n,a),e.safeEncodeAsync=async(n,a)=>S5(e,n,a),e.safeDecodeAsync=async(n,a)=>j5(e,n,a),e.refine=(n,a)=>e.check(gM(n,a)),e.superRefine=n=>e.check(yM(n)),e.overwrite=n=>e.check(Hr(n)),e.optional=()=>Gx(e),e.exactOptional=()=>sM(e),e.nullable=()=>Fx(e),e.nullish=()=>Gx(Fx(e)),e.nonoptional=n=>cM(e,n),e.array=()=>xe(e),e.or=n=>Q5([e,n]),e.and=n=>J5(e,n),e.transform=n=>Zx(e,tM(n)),e.default=n=>rM(e,n),e.prefault=n=>lM(e,n),e.catch=n=>dM(e,n),e.pipe=n=>Zx(e,n),e.readonly=()=>mM(e),e.describe=n=>{const a=e.clone();return Jo.add(a,{description:n}),a},Object.defineProperty(e,"description",{get(){return Jo.get(e)?.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return Jo.get(e);const a=e.clone();return Jo.add(a,n[0]),a},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),Qw=ne("_ZodString",(e,t)=>{Hp.init(e,t),_t.init(e,t),e._zod.processJSONSchema=(a,o,c)=>DD(e,a,o);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...a)=>e.check(vD(...a)),e.includes=(...a)=>e.check(SD(...a)),e.startsWith=(...a)=>e.check(jD(...a)),e.endsWith=(...a)=>e.check(wD(...a)),e.min=(...a)=>e.check($u(...a)),e.max=(...a)=>e.check(Kw(...a)),e.length=(...a)=>e.check(Hw(...a)),e.nonempty=(...a)=>e.check($u(1,...a)),e.lowercase=a=>e.check(bD(a)),e.uppercase=a=>e.check(xD(a)),e.trim=()=>e.check(CD()),e.normalize=(...a)=>e.check(ND(...a)),e.toLowerCase=()=>e.check(kD()),e.toUpperCase=()=>e.check(zD()),e.slugify=()=>e.check(_D())}),w5=ne("ZodString",(e,t)=>{Hp.init(e,t),Qw.init(e,t),e.email=n=>e.check(qL(N5,n)),e.url=n=>e.check(ZL(C5,n)),e.jwt=n=>e.check(lD(I5,n)),e.emoji=n=>e.check(VL(k5,n)),e.guid=n=>e.check(Ux(Kx,n)),e.uuid=n=>e.check(KL(tu,n)),e.uuidv4=n=>e.check(HL(tu,n)),e.uuidv6=n=>e.check(GL(tu,n)),e.uuidv7=n=>e.check(FL(tu,n)),e.nanoid=n=>e.check(QL(z5,n)),e.guid=n=>e.check(Ux(Kx,n)),e.cuid=n=>e.check(YL(_5,n)),e.cuid2=n=>e.check(JL(E5,n)),e.ulid=n=>e.check(XL(A5,n)),e.base64=n=>e.check(aD($5,n)),e.base64url=n=>e.check(rD(P5,n)),e.xid=n=>e.check(WL(T5,n)),e.ksuid=n=>e.check(eD(R5,n)),e.ipv4=n=>e.check(tD(O5,n)),e.ipv6=n=>e.check(nD(L5,n)),e.cidrv4=n=>e.check(sD(D5,n)),e.cidrv6=n=>e.check(iD(M5,n)),e.e164=n=>e.check(oD(U5,n)),e.datetime=n=>e.check(s5(n)),e.date=n=>e.check(a5(n)),e.time=n=>e.check(o5(n)),e.duration=n=>e.check(c5(n))});function L(e){return BL(w5,e)}const Et=ne("ZodStringFormat",(e,t)=>{Nt.init(e,t),Qw.init(e,t)}),N5=ne("ZodEmail",(e,t)=>{VO.init(e,t),Et.init(e,t)}),Kx=ne("ZodGUID",(e,t)=>{FO.init(e,t),Et.init(e,t)}),tu=ne("ZodUUID",(e,t)=>{ZO.init(e,t),Et.init(e,t)}),C5=ne("ZodURL",(e,t)=>{QO.init(e,t),Et.init(e,t)}),k5=ne("ZodEmoji",(e,t)=>{YO.init(e,t),Et.init(e,t)}),z5=ne("ZodNanoID",(e,t)=>{JO.init(e,t),Et.init(e,t)}),_5=ne("ZodCUID",(e,t)=>{XO.init(e,t),Et.init(e,t)}),E5=ne("ZodCUID2",(e,t)=>{WO.init(e,t),Et.init(e,t)}),A5=ne("ZodULID",(e,t)=>{eL.init(e,t),Et.init(e,t)}),T5=ne("ZodXID",(e,t)=>{tL.init(e,t),Et.init(e,t)}),R5=ne("ZodKSUID",(e,t)=>{nL.init(e,t),Et.init(e,t)}),O5=ne("ZodIPv4",(e,t)=>{oL.init(e,t),Et.init(e,t)}),L5=ne("ZodIPv6",(e,t)=>{lL.init(e,t),Et.init(e,t)}),D5=ne("ZodCIDRv4",(e,t)=>{cL.init(e,t),Et.init(e,t)}),M5=ne("ZodCIDRv6",(e,t)=>{uL.init(e,t),Et.init(e,t)}),$5=ne("ZodBase64",(e,t)=>{dL.init(e,t),Et.init(e,t)}),P5=ne("ZodBase64URL",(e,t)=>{hL.init(e,t),Et.init(e,t)}),U5=ne("ZodE164",(e,t)=>{mL.init(e,t),Et.init(e,t)}),I5=ne("ZodJWT",(e,t)=>{gL.init(e,t),Et.init(e,t)}),Yw=ne("ZodNumber",(e,t)=>{Uw.init(e,t),_t.init(e,t),e._zod.processJSONSchema=(a,o,c)=>MD(e,a,o),e.gt=(a,o)=>e.check(Bx(a,o)),e.gte=(a,o)=>e.check(am(a,o)),e.min=(a,o)=>e.check(am(a,o)),e.lt=(a,o)=>e.check(Ix(a,o)),e.lte=(a,o)=>e.check(im(a,o)),e.max=(a,o)=>e.check(im(a,o)),e.int=a=>e.check(Hx(a)),e.safe=a=>e.check(Hx(a)),e.positive=a=>e.check(Bx(0,a)),e.nonnegative=a=>e.check(am(0,a)),e.negative=a=>e.check(Ix(0,a)),e.nonpositive=a=>e.check(im(0,a)),e.multipleOf=(a,o)=>e.check(qx(a,o)),e.step=(a,o)=>e.check(qx(a,o)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function _e(e){return hD(Yw,e)}const B5=ne("ZodNumberFormat",(e,t)=>{yL.init(e,t),Yw.init(e,t)});function Hx(e){return mD(B5,e)}const q5=ne("ZodBoolean",(e,t)=>{vL.init(e,t),_t.init(e,t),e._zod.processJSONSchema=(n,a,o)=>$D(e,n,a)});function kt(e){return pD(q5,e)}const K5=ne("ZodUnknown",(e,t)=>{bL.init(e,t),_t.init(e,t),e._zod.processJSONSchema=(n,a,o)=>UD()});function Uu(){return gD(K5)}const H5=ne("ZodNever",(e,t)=>{xL.init(e,t),_t.init(e,t),e._zod.processJSONSchema=(n,a,o)=>PD(e,n,a)});function G5(e){return yD(H5,e)}const F5=ne("ZodArray",(e,t)=>{SL.init(e,t),_t.init(e,t),e._zod.processJSONSchema=(n,a,o)=>HD(e,n,a,o),e.element=t.element,e.min=(n,a)=>e.check($u(n,a)),e.nonempty=n=>e.check($u(1,n)),e.max=(n,a)=>e.check(Kw(n,a)),e.length=(n,a)=>e.check(Hw(n,a)),e.unwrap=()=>e.element});function xe(e,t){return ED(F5,e,t)}const Z5=ne("ZodObject",(e,t)=>{wL.init(e,t),_t.init(e,t),e._zod.processJSONSchema=(n,a,o)=>GD(e,n,a,o),ct(e,"shape",()=>t.shape),e.keyof=()=>wt(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Uu()}),e.loose=()=>e.clone({...e._zod.def,catchall:Uu()}),e.strict=()=>e.clone({...e._zod.def,catchall:G5()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>HR(e,n),e.safeExtend=n=>GR(e,n),e.merge=n=>FR(e,n),e.pick=n=>qR(e,n),e.omit=n=>KR(e,n),e.partial=(...n)=>ZR(Jw,e,n[0]),e.required=(...n)=>VR(Xw,e,n[0])});function ve(e,t){const n={type:"object",shape:e??{},...ke(t)};return new Z5(n)}const V5=ne("ZodUnion",(e,t)=>{NL.init(e,t),_t.init(e,t),e._zod.processJSONSchema=(n,a,o)=>FD(e,n,a,o),e.options=t.options});function Q5(e,t){return new V5({type:"union",options:e,...ke(t)})}const Y5=ne("ZodIntersection",(e,t)=>{CL.init(e,t),_t.init(e,t),e._zod.processJSONSchema=(n,a,o)=>ZD(e,n,a,o)});function J5(e,t){return new Y5({type:"intersection",left:e,right:t})}const X5=ne("ZodRecord",(e,t)=>{kL.init(e,t),_t.init(e,t),e._zod.processJSONSchema=(n,a,o)=>VD(e,n,a,o),e.keyType=t.keyType,e.valueType=t.valueType});function yl(e,t,n){return new X5({type:"record",keyType:e,valueType:t,...ke(n)})}const qm=ne("ZodEnum",(e,t)=>{zL.init(e,t),_t.init(e,t),e._zod.processJSONSchema=(a,o,c)=>ID(e,a,o),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(a,o)=>{const c={};for(const u of a)if(n.has(u))c[u]=t.entries[u];else throw new Error(`Key ${u} not found in enum`);return new qm({...t,checks:[],...ke(o),entries:c})},e.exclude=(a,o)=>{const c={...t.entries};for(const u of a)if(n.has(u))delete c[u];else throw new Error(`Key ${u} not found in enum`);return new qm({...t,checks:[],...ke(o),entries:c})}});function wt(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(a=>[a,a])):e;return new qm({type:"enum",entries:n,...ke(t)})}const W5=ne("ZodLiteral",(e,t)=>{_L.init(e,t),_t.init(e,t),e._zod.processJSONSchema=(n,a,o)=>BD(e,n,a),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function fl(e,t){return new W5({type:"literal",values:Array.isArray(e)?e:[e],...ke(t)})}const eM=ne("ZodTransform",(e,t)=>{EL.init(e,t),_t.init(e,t),e._zod.processJSONSchema=(n,a,o)=>KD(e,n),e._zod.parse=(n,a)=>{if(a.direction==="backward")throw new ww(e.constructor.name);n.addIssue=c=>{if(typeof c=="string")n.issues.push(dl(c,n.value,t));else{const u=c;u.fatal&&(u.continue=!1),u.code??(u.code="custom"),u.input??(u.input=n.value),u.inst??(u.inst=e),n.issues.push(dl(u))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(c=>(n.value=c,n)):(n.value=o,n)}});function tM(e){return new eM({type:"transform",transform:e})}const Jw=ne("ZodOptional",(e,t)=>{qw.init(e,t),_t.init(e,t),e._zod.processJSONSchema=(n,a,o)=>Vw(e,n,a,o),e.unwrap=()=>e._zod.def.innerType});function Gx(e){return new Jw({type:"optional",innerType:e})}const nM=ne("ZodExactOptional",(e,t)=>{AL.init(e,t),_t.init(e,t),e._zod.processJSONSchema=(n,a,o)=>Vw(e,n,a,o),e.unwrap=()=>e._zod.def.innerType});function sM(e){return new nM({type:"optional",innerType:e})}const iM=ne("ZodNullable",(e,t)=>{TL.init(e,t),_t.init(e,t),e._zod.processJSONSchema=(n,a,o)=>QD(e,n,a,o),e.unwrap=()=>e._zod.def.innerType});function Fx(e){return new iM({type:"nullable",innerType:e})}const aM=ne("ZodDefault",(e,t)=>{RL.init(e,t),_t.init(e,t),e._zod.processJSONSchema=(n,a,o)=>JD(e,n,a,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function rM(e,t){return new aM({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():zw(t)}})}const oM=ne("ZodPrefault",(e,t)=>{OL.init(e,t),_t.init(e,t),e._zod.processJSONSchema=(n,a,o)=>XD(e,n,a,o),e.unwrap=()=>e._zod.def.innerType});function lM(e,t){return new oM({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():zw(t)}})}const Xw=ne("ZodNonOptional",(e,t)=>{LL.init(e,t),_t.init(e,t),e._zod.processJSONSchema=(n,a,o)=>YD(e,n,a,o),e.unwrap=()=>e._zod.def.innerType});function cM(e,t){return new Xw({type:"nonoptional",innerType:e,...ke(t)})}const uM=ne("ZodCatch",(e,t)=>{DL.init(e,t),_t.init(e,t),e._zod.processJSONSchema=(n,a,o)=>WD(e,n,a,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function dM(e,t){return new uM({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const fM=ne("ZodPipe",(e,t)=>{ML.init(e,t),_t.init(e,t),e._zod.processJSONSchema=(n,a,o)=>e5(e,n,a,o),e.in=t.in,e.out=t.out});function Zx(e,t){return new fM({type:"pipe",in:e,out:t})}const hM=ne("ZodReadonly",(e,t)=>{$L.init(e,t),_t.init(e,t),e._zod.processJSONSchema=(n,a,o)=>t5(e,n,a,o),e.unwrap=()=>e._zod.def.innerType});function mM(e){return new hM({type:"readonly",innerType:e})}const pM=ne("ZodCustom",(e,t)=>{PL.init(e,t),_t.init(e,t),e._zod.processJSONSchema=(n,a,o)=>qD(e,n)});function gM(e,t={}){return AD(pM,e,t)}function yM(e){return TD(e)}ve({maxConcurrency:_e().int().positive(),maxRequestsPerMinute:_e().int().positive(),maxRequestsPerDay:_e().int().positive()});const Gr=L().min(1);L().min(1);const Gp=ve({label:L().min(1),city:L().min(1),region:L().min(1),country:L().length(2),timezone:L().optional()}),Ww=wt(["citation.lost","citation.gained","run.completed","run.failed"]);ve({id:L(),projectId:L(),channel:fl("webhook"),url:L().url(),urlDisplay:L(),urlHost:L(),events:xe(Ww),enabled:kt().default(!0),webhookSecret:L().optional(),createdAt:L(),updatedAt:L()});const eN=wt(["cli","api","config-file"]);function vM(e){const t=new Set,n=new Set;for(const a of e){if(t.has(a.label)){n.add(a.label);continue}t.add(a.label)}return[...n]}function bM(e,t){return t?e.some(n=>n.label===t):!0}ve({displayName:L().min(1),canonicalDomain:L().min(1),ownedDomains:xe(L().min(1)).optional(),country:L().length(2),language:L().min(2),tags:xe(L()).optional(),labels:yl(L(),L()).optional(),providers:xe(Gr).optional(),locations:xe(Gp).optional(),defaultLocation:L().nullable().optional(),configSource:eN.optional()});ve({id:L(),name:L(),displayName:L().optional(),canonicalDomain:L(),ownedDomains:xe(L()).default([]),country:L().length(2),language:L().min(2),tags:xe(L()).default([]),labels:yl(L(),L()).default({}),locations:xe(Gp).default([]),defaultLocation:L().nullable().optional(),configSource:eN.default("cli"),configRevision:_e().int().positive().default(1),createdAt:L().optional(),updatedAt:L().optional()});function Km(e){let t=e.trim().toLowerCase();try{t.includes("://")&&(t=new URL(t).hostname.toLowerCase())}catch{}return t.replace(/^www\./,"")}function xM(e){const t=[e.canonicalDomain,...e.ownedDomains??[]],n=new Set,a=[];for(const o of t){const c=o.trim();if(!c)continue;const u=Km(c);n.has(u)||(n.add(u),a.push(c))}return a}const SM=ve({name:L().min(1).max(63).regex(/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/,{message:"Name must be a lowercase slug (letters, numbers, hyphens)"}),labels:yl(L(),L()).optional().default({})}),jM=ve({preset:L().optional(),cron:L().optional(),timezone:L().optional().default("UTC"),providers:xe(Gr).optional().default([])}).refine(e=>e.preset&&!e.cron||!e.preset&&e.cron,{message:'Exactly one of "preset" or "cron" must be provided'}).optional(),wM=ve({channel:fl("webhook"),url:L().url(),events:xe(Ww).min(1)}),NM=ve({gsc:ve({propertyUrl:L()}).optional(),syncSchedule:ve({preset:L().optional(),cron:L().optional()}).optional()}).optional(),CM=ve({displayName:L().min(1),canonicalDomain:L().min(1),ownedDomains:xe(L().min(1)).optional().default([]),country:L().length(2),language:L().min(2),keywords:xe(L().min(1)).optional().default([]),competitors:xe(L().min(1)).optional().default([]),providers:xe(Gr).optional().default([]),locations:xe(Gp).optional().default([]),defaultLocation:L().optional(),schedule:jM,notifications:xe(wM).optional().default([]),google:NM}).superRefine((e,t)=>{const n=vM(e.locations);n.length>0&&t.addIssue({code:"custom",message:`Duplicate location labels are not allowed: ${n.join(", ")}`,path:["locations"]}),bM(e.locations,e.defaultLocation)||t.addIssue({code:"custom",message:`defaultLocation "${e.defaultLocation}" must match a configured location label`,path:["defaultLocation"]})});ve({apiVersion:fl("canonry/v1"),kind:fl("Project"),metadata:SM,spec:CM});const kM=wt(["gsc","ga4"]);ve({id:L(),domain:L(),connectionType:kM,propertyId:L().nullable().optional(),sitemapUrl:L().nullable().optional(),scopes:xe(L()).default([]),createdAt:L(),updatedAt:L()});ve({date:L(),query:L(),page:L(),country:L().nullable().optional(),device:L().nullable().optional(),clicks:_e(),impressions:_e(),ctr:_e(),position:_e()});const Hm=ve({id:L(),url:L(),indexingState:L().nullable().optional(),verdict:L().nullable().optional(),coverageState:L().nullable().optional(),pageFetchState:L().nullable().optional(),robotsTxtState:L().nullable().optional(),crawlTime:L().nullable().optional(),lastCrawlResult:L().nullable().optional(),isMobileFriendly:kt().nullable().optional(),richResults:xe(L()).default([]),inspectedAt:L()});wt(["stable","reindexed","deindexed","still-missing","new"]);const zM=ve({url:L(),previousState:L().nullable(),currentState:L().nullable(),transitionDate:L()}),_M=ve({reason:L(),count:_e(),urls:xe(Hm).default([])});ve({summary:ve({total:_e(),indexed:_e(),notIndexed:_e(),deindexed:_e(),percentage:_e()}),lastInspectedAt:L().nullable(),indexed:xe(Hm).default([]),notIndexed:xe(Hm).default([]),deindexed:xe(zM).default([]),reasonGroups:xe(_M).default([])});ve({url:L(),type:wt(["URL_UPDATED","URL_DELETED"]),notifiedAt:L()});ve({url:L(),type:wt(["URL_UPDATED","URL_DELETED"]),notifiedAt:L(),status:wt(["success","error"]),error:L().optional()});ve({date:L(),indexed:_e(),notIndexed:_e(),reasonBreakdown:yl(L(),_e()).default({})});ve({id:L(),domain:L(),siteUrl:L().nullable().optional(),createdAt:L(),updatedAt:L()});const rm=ve({id:L(),url:L(),httpCode:_e().nullable().optional(),inIndex:kt().nullable().optional(),lastCrawledDate:L().nullable().optional(),inIndexDate:L().nullable().optional(),inspectedAt:L(),documentSize:_e().nullable().optional(),anchorCount:_e().nullable().optional(),discoveryDate:L().nullable().optional()});ve({summary:ve({total:_e(),indexed:_e(),notIndexed:_e(),unknown:_e().optional(),percentage:_e()}),lastInspectedAt:L().nullable(),indexed:xe(rm).default([]),notIndexed:xe(rm).default([]),unknown:xe(rm).default([]).optional()});ve({query:L(),impressions:_e(),clicks:_e(),ctr:_e(),averagePosition:_e()});ve({url:L(),status:wt(["success","error"]),submittedAt:L(),error:L().optional()});const Fr=wt(["live","staging"]);ve({projectName:L(),url:L(),stagingUrl:L().optional(),username:L(),defaultEnv:Fr,createdAt:L(),updatedAt:L()});const Vx=ve({url:L(),reachable:kt(),pageCount:_e().nullable().optional(),version:L().nullable().optional(),error:L().nullable().optional(),plugins:xe(L()).optional(),authenticatedUser:ve({id:_e(),slug:L()}).nullable().optional()});ve({connected:kt(),projectName:L(),defaultEnv:Fr,live:Vx.nullable(),staging:Vx.nullable(),adminUrl:L().nullable().optional()});const EM=ve({id:_e(),slug:L(),title:L(),status:L(),modifiedAt:L().nullable().optional(),link:L().nullable().optional()}),tN=ve({title:L().nullable(),description:L().nullable(),noindex:kt().nullable(),writable:kt().default(!1),writeTargets:xe(L()).default([])}),AM=ve({type:L(),json:yl(L(),Uu())}),TM=EM.extend({env:Fr,content:L(),seo:tN,schemaBlocks:xe(AM).default([])}),Qx=TM.extend({contentHash:L(),contentSnippet:L()}),nN=ve({manualRequired:fl(!0),targetUrl:L(),adminUrl:L().nullable().optional(),content:L(),nextSteps:xe(L()).default([])}),RM=ve({slug:L(),severity:wt(["high","medium","low"]),code:wt(["noindex","missing-seo-title","missing-meta-description","missing-schema","thin-content"]),message:L()});ve({slug:L(),title:L(),status:L(),wordCount:_e(),seo:tN,schemaPresent:kt(),issues:xe(RM).default([])});const OM=ve({slug:L(),status:wt(["applied","skipped","manual"]),error:L().optional(),manualAssist:nN.optional()});ve({env:Fr,strategy:wt(["plugin","manual"]),results:xe(OM)});const LM=ve({slug:L(),status:wt(["deployed","stripped","skipped","failed"]),schemasInjected:xe(L()).optional(),manualAssist:nN.optional(),error:L().optional()});ve({env:Fr,results:xe(LM)});const DM=ve({slug:L(),title:L(),canonrySchemas:xe(L()),thirdPartySchemas:xe(L()),hasCanonrySchema:kt()});ve({env:Fr,pages:xe(DM)});const MM=ve({name:L(),status:wt(["completed","skipped","failed"]),summary:L().optional(),error:L().optional()});ve({projectName:L(),steps:xe(MM)});ve({slug:L(),live:Qx,staging:Qx,hasDifferences:kt(),differences:ve({title:kt(),slug:kt(),content:kt(),seoTitle:kt(),seoDescription:kt(),noindex:kt(),schema:kt()})});const $M=wt(["queued","running","completed","partial","failed","cancelled"]),PM=wt(["answer-visibility","site-audit","gsc-sync","inspect-sitemap"]),UM=wt(["manual","scheduled","config-apply"]),IM=wt(["cited","not-cited"]),BM=wt(["visible","not-visible"]),qM=wt(["new","cited","lost","emerging","not-cited"]);ve({id:L(),projectId:L(),kind:PM,status:$M,trigger:UM.default("manual"),location:L().nullable().optional(),startedAt:L().nullable().optional(),finishedAt:L().nullable().optional(),error:L().nullable().optional(),createdAt:L()});const sN=ve({uri:L(),title:L()});ve({id:L(),runId:L(),keywordId:L(),keyword:L().optional(),provider:Gr,citationState:IM,answerMentioned:kt().optional(),visibilityState:BM.optional(),transition:qM.optional(),answerText:L().nullable().optional(),citedDomains:xe(L()).default([]),competitorOverlap:xe(L()).default([]),recommendedCompetitors:xe(L()).default([]),groundingSources:xe(sN).default([]),searchQueries:xe(L()).default([]),model:L().nullable().optional(),location:L().nullable().optional(),createdAt:L()});ve({id:L(),projectId:L().nullable().optional(),actor:L(),action:L(),entityType:L(),entityId:L().nullable().optional(),diff:Uu().optional(),createdAt:L()});const KM=wt(["yes","no","unknown","not-mentioned"]);ve({companyName:L().min(1),domain:L().min(1),phrases:xe(L().min(1)).optional().default([]),competitors:xe(L().min(1)).optional().default([])});const HM=ve({name:L(),count:_e().int().nonnegative()}),GM=ve({id:L(),name:L(),weight:_e(),score:_e(),grade:L(),status:wt(["pass","partial","fail"]),findings:xe(ve({type:L(),message:L()})).default([]),recommendations:xe(L()).default([])}),FM=ve({url:L(),finalUrl:L(),auditedAt:L(),overallScore:_e(),overallGrade:L(),summary:L(),factors:xe(GM).default([])}),ZM=ve({industry:L(),summary:L(),services:xe(L()).default([]),categoryTerms:xe(L()).default([])}),VM=ve({provider:L(),displayName:L(),model:L().nullable().optional(),mentioned:kt(),cited:kt(),describedAccurately:KM,accuracyNotes:L().nullable().optional(),incorrectClaims:xe(L()).default([]),recommendedCompetitors:xe(L()).default([]),citedDomains:xe(L()).default([]),groundingSources:xe(sN).default([]),searchQueries:xe(L()).default([]),answerText:L(),error:L().nullable().optional()}),QM=ve({phrase:L(),providerResults:xe(VM).default([])}),YM=ve({totalQueries:_e().int().nonnegative(),totalProviders:_e().int().nonnegative(),totalComparisons:_e().int().nonnegative(),mentionCount:_e().int().nonnegative(),citationCount:_e().int().nonnegative(),topCompetitors:xe(HM).default([]),visibilityGap:L(),whatThisMeans:xe(L()).default([]),recommendedActions:xe(L()).default([])});ve({companyName:L(),domain:L(),homepageUrl:L(),generatedAt:L(),phrases:xe(L()).default([]),competitors:xe(L()).default([]),profile:ZM,audit:FM,queryResults:xe(QM).default([]),summary:YM});ve({id:L(),projectId:L(),cronExpr:L(),preset:L().nullable().optional(),timezone:L().default("UTC"),enabled:kt().default(!0),providers:xe(Gr).default([]),lastRunAt:L().nullable().optional(),nextRunAt:L().nullable().optional(),createdAt:L(),updatedAt:L()});ve({preset:L().optional(),cron:L().optional(),timezone:L().optional().default("UTC"),enabled:kt().optional().default(!0),providers:xe(Gr).optional().default([])}).refine(e=>e.preset&&!e.cron||!e.preset&&e.cron,{message:'Exactly one of "preset" or "cron" must be provided'});ve({id:L(),projectId:L(),propertyId:L(),clientEmail:L(),connected:kt(),createdAt:L(),updatedAt:L()});ve({date:L(),landingPage:L(),sessions:_e(),organicSessions:_e(),users:_e()});const JM=ve({source:L(),medium:L(),sessions:_e(),users:_e()});ve({totalSessions:_e(),totalOrganicSessions:_e(),totalUsers:_e(),topPages:xe(ve({landingPage:L(),sessions:_e(),organicSessions:_e(),users:_e()})),aiReferrals:xe(JM),lastSyncedAt:L().nullable()});function hn({text:e}){return r.jsxs("span",{className:"info-tooltip-wrapper",children:[r.jsxs("svg",{className:"info-tooltip-icon",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[r.jsx("circle",{cx:"8",cy:"8",r:"7",stroke:"currentColor",strokeWidth:"1.5"}),r.jsx("path",{d:"M8 7v4M8 5.5v0",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]}),r.jsx("span",{className:"info-tooltip-bubble",role:"tooltip",children:e})]})}function Yx(e,t){const n=t.filter(u=>u.trim().length>1),a=e.split(/(\*\*[^*]+\*\*)/).filter(Boolean).map(u=>u.startsWith("**")&&u.endsWith("**")?{type:"bold",value:u.slice(2,-2)}:{type:"text",value:u});if(n.length===0)return a.map((u,f)=>u.type==="bold"?us.createElement("strong",{key:`b-${f}`,className:"text-zinc-200 font-semibold"},u.value):u.value).filter(Boolean);const o=n.map(u=>u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),c=new RegExp(`(${o.join("|")})`,"gi");return a.flatMap((u,f)=>u.value.split(c).map((p,v)=>p?v%2===1?u.type==="bold"?us.createElement("mark",{key:`hl-${f}-${v}`,className:"answer-highlight"},us.createElement("strong",{className:"text-zinc-200 font-semibold"},p)):us.createElement("mark",{key:`hl-${f}-${v}`,className:"answer-highlight"},p):u.type==="bold"?us.createElement("strong",{key:`b-${f}-${v}`,className:"text-zinc-200 font-semibold"},p):p:null)).filter(Boolean)}function om(e,t){switch(e){case"new":return"First observation";case"emerging":return"First visibility";case"lost":return"Lost since last run";default:return t==="visible"?"Visible in latest run":t==="pending"?"Awaiting first run":"Not visible in latest run"}}function XM({evidence:e,project:t,onClose:n}){const[a,o]=w.useState(!1),[c,u]=w.useState("mentions"),[f,m]=w.useState(-1),[p,v]=w.useState(null),[y,b]=w.useState(!1),[x,N]=w.useState({}),S=xM(t.project),C=new Set(S.map(Km)),k=e.runHistory,T=k.length>1,[A,z]=w.useState(null),$=w.useRef(!1);w.useEffect(()=>{if($.current||e.answerSnippet&&(e.visibilityState!=null||e.answerMentioned!=null))return;const M=k.at(-1);M&&($.current=!0,Ur(M.runId).then(J=>{const V=J.snapshots.find(Q=>Q.keyword===e.keyword&&Q.provider===e.provider);V&&z({citationState:V.citationState,answerMentioned:V.answerMentioned,visibilityState:V.visibilityState,visibilityTransition:M.visibilityTransition,provider:V.provider,model:V.model??e.model,answerSnippet:V.answerText??e.answerSnippet,citedDomains:V.citedDomains??e.citedDomains,competitorDomains:V.competitorOverlap??e.competitorDomains,recommendedCompetitors:V.recommendedCompetitors??e.recommendedCompetitors??[],groundingSources:V.groundingSources??e.groundingSources,evidenceUrls:[],changeLabel:e.visibilityChangeLabel??e.changeLabel,summary:e.summary})}).catch(()=>{}))},[e,k]);const P=f>=0&&p!==null,E=P?p:A||{citationState:e.citationState,answerMentioned:e.answerMentioned,visibilityState:e.visibilityState,visibilityTransition:k.at(-1)?.visibilityTransition,provider:e.provider,model:e.model,answerSnippet:e.answerSnippet,citedDomains:e.citedDomains,competitorDomains:e.competitorDomains,recommendedCompetitors:e.recommendedCompetitors??[],groundingSources:e.groundingSources,evidenceUrls:e.evidenceUrls,changeLabel:e.visibilityChangeLabel??e.changeLabel,summary:e.summary},O=E.visibilityState==="pending"||E.citationState==="pending",K=O?!1:E.visibilityState!=null?E.visibilityState==="visible":E.answerMentioned!=null?E.answerMentioned:E.citationState==="cited"||E.citationState==="emerging",ee=E.answerMentioned!=null||E.visibilityState!=null||E.recommendedCompetitors.length>0,X=E.citedDomains.length>0||E.groundingSources.length>0||E.evidenceUrls.length>0,se=t.project.displayName||t.project.name,de=[...S.map(Km),se,se.split(" ").slice(0,2).join(" ")].filter(M=>M.trim().length>2),Ee=O?"pending":E.visibilityTransition==="lost"?"lost":K?"cited":"not-cited",be=w.useRef(0),H=w.useCallback(async M=>{const J=++be.current;if(M===-1||M===k.length-1){m(-1),v(null),o(!1);return}m(M),o(!1);const V=k[M],Q=`${V.runId}::${e.keyword}::${e.provider}`;if(x[Q]){v(x[Q]);return}b(!0);try{const me=await Ur(V.runId);if(J!==be.current)return;const ge=me.snapshots.find(he=>he.keyword===e.keyword&&he.provider===e.provider)??me.snapshots.find(he=>he.keyword===e.keyword),Ne=ge?{citationState:ge.citationState,answerMentioned:ge.answerMentioned,visibilityState:ge.visibilityState,visibilityTransition:V.visibilityTransition,provider:ge.provider,model:ge.model??null,answerSnippet:ge.answerText??"",citedDomains:ge.citedDomains,competitorDomains:ge.competitorOverlap,recommendedCompetitors:ge.recommendedCompetitors??[],groundingSources:ge.groundingSources,evidenceUrls:[],changeLabel:om(V.visibilityTransition,V.visibilityState),summary:""}:{citationState:V.citationState,answerMentioned:V.answerMentioned,visibilityState:V.visibilityState,visibilityTransition:V.visibilityTransition,provider:e.provider,model:V.model??null,answerSnippet:"",citedDomains:[],competitorDomains:[],recommendedCompetitors:[],groundingSources:[],evidenceUrls:[],changeLabel:om(V.visibilityTransition,V.visibilityState),summary:"Snapshot data not available for this run."};N(he=>({...he,[Q]:Ne})),v(Ne)}catch{if(J!==be.current)return;v({citationState:V.citationState,answerMentioned:V.answerMentioned,visibilityState:V.visibilityState,visibilityTransition:V.visibilityTransition,provider:e.provider,model:V.model??null,answerSnippet:"",citedDomains:[],competitorDomains:[],recommendedCompetitors:[],groundingSources:[],evidenceUrls:[],changeLabel:om(V.visibilityTransition,V.visibilityState),summary:"Failed to load historical run data."})}finally{J===be.current&&b(!1)}},[k,e.keyword,e.provider,x]),pe=(P||e.historyScope!=="provider")&&E.model?`${E.provider} (${E.model}) · ${E.changeLabel.toLowerCase()}`:`${E.provider} · ${E.changeLabel.toLowerCase()}`,ce=!P&&e.historyScope==="provider"?[e.model?`Current model: ${e.model}`:null,e.modelsSeen&&e.modelsSeen.length>1?`History spans ${e.modelsSeen.length} models`:null].filter(Boolean).join(" · "):"",U=K?{label:"Visible in answer",title:"Your brand or domain is mentioned in this answer",meta:pe}:E.visibilityTransition==="lost"?{label:"Visibility lost",title:"Your brand no longer appears in this answer",meta:pe}:O?{label:"Pending",title:"Awaiting first visibility run",meta:"No provider data yet"}:{label:"Not visible in answer",title:"Your brand or domain was not mentioned in this answer",meta:pe},R=()=>{if(!E.answerSnippet)return null;const M=E.answerSnippet.split(`
95
- `),J=[];let V=[],Q=0;const me=()=>{if(V.length===0)return;const ge=V.join(" ").trim();ge&&J.push(r.jsx("p",{className:J.length>0?"mt-2.5":"",children:Yx(ge,de)},Q++)),V=[]};for(const ge of M){const Ne=ge.trim();if(/^[-\u2013\u2014]{3,}$/.test(Ne)){me(),J.push(r.jsx("hr",{className:"border-zinc-800/60 my-3"},Q++));continue}const he=Ne.match(/^(#{1,3})\s+(.+)$/);if(he){me();const Me=he[1].length,Je=he[2].replace(/^[\p{Emoji}\p{Emoji_Component}\s#]+/u,"").trim()||he[2],le=Me===1?"text-[13px] font-semibold text-zinc-100 mt-4 mb-1":Me===2?"text-xs font-semibold text-zinc-200 mt-3 mb-0.5":"text-xs font-medium text-zinc-300 mt-2";J.push(r.jsx("p",{className:le,children:Yx(Je,de)},Q++));continue}if(Ne===""){me();continue}V.push(Ne)}return me(),J};return r.jsx(pw,{open:!0,onOpenChange:M=>{M||n()},children:r.jsxs(gw,{children:[r.jsx(Dp,{className:"fixed inset-0 z-50 bg-black/80 backdrop-blur-sm"}),r.jsxs(Mp,{className:"evidence-modal","aria-describedby":void 0,children:[r.jsxs("div",{className:"evidence-modal-header",children:[r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsxs("p",{className:"eyebrow eyebrow-soft",children:[t.project.name," ","·"," ",E.provider||"All providers"]}),r.jsx($p,{className:"text-lg font-semibold text-zinc-50 truncate",children:e.keyword})]}),r.jsxs(vw,{className:"inline-flex size-8 items-center justify-center rounded-md text-zinc-500 transition hover:bg-zinc-800 hover:text-zinc-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-zinc-400 shrink-0",children:[r.jsx(Yu,{className:"size-4"}),r.jsx("span",{className:"sr-only",children:"Close"})]})]}),T&&r.jsxs("div",{className:"evidence-modal-timeline",children:[r.jsx("p",{className:"drawer-section-label mb-1.5",children:"Run history"}),r.jsx("div",{className:"flex items-center gap-1 overflow-x-auto pb-1",children:k.map((M,J)=>{const V=f===-1&&J===k.length-1||f===J,Q=M.visibilityState??(M.answerMentioned?"visible":"not-visible"),me=M.visibilityTransition??Q,ge=Q==="visible"?"bg-emerald-400":me==="emerging"?"bg-amber-400":me==="lost"?"bg-rose-400":"bg-zinc-600",he=new Date(M.createdAt).toLocaleDateString(void 0,{month:"short",day:"numeric"}),Me=!!(M.model&&J>0&&k[J-1]?.model&&k[J-1].model!==M.model);return r.jsxs("button",{type:"button",className:`evidence-run-dot ${V?"evidence-run-dot--selected":""}`,onClick:()=>H(J===k.length-1?-1:J),"aria-label":[`Run ${he}: ${Q}`,M.model?`model ${M.model}`:null,Me?"model changed":null].filter(Boolean).join(" — "),"aria-pressed":V,children:[r.jsx("span",{className:`size-2 rounded-full ${ge} ${Me?"ring-1 ring-amber-300/80 ring-offset-2 ring-offset-zinc-950":""}`,"aria-hidden":"true"}),r.jsx("span",{className:"text-[10px] text-zinc-500",children:he})]},J)})}),f>=0&&f<k.length&&r.jsxs("p",{className:"text-[11px] text-zinc-500 mt-1",children:["Viewing run from ",new Date(k[f].createdAt).toLocaleString()," ","—"," ",r.jsx("span",{className:"capitalize",children:k[f].visibilityState??(k[f].answerMentioned?"visible":"not-visible")}),r.jsxs("button",{type:"button",className:"text-zinc-400 hover:text-zinc-200 ml-2",onClick:()=>H(-1),children:["←"," Back to latest"]})]}),!P&&(e.modelTransitions?.length??0)>0&&r.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:e.modelTransitions.map(M=>r.jsx("span",{className:"inline-flex items-center rounded-full border border-amber-400/30 bg-amber-400/10 px-2 py-1 text-[10px] text-amber-100",children:`${M.fromModel??"unknown"} -> ${M.toModel??"unknown"} on ${new Date(M.createdAt).toLocaleDateString()}`},`${M.runId}:${M.toModel??"unknown"}`))})]}),r.jsxs("div",{className:"evidence-modal-body",children:[y&&r.jsxs("div",{className:"md:col-span-2 flex items-center justify-center py-12 text-zinc-500 text-sm",children:["Loading historical run data","…"]}),!y&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"evidence-modal-main",children:[r.jsxs("div",{className:`evidence-position-hero evidence-position-hero--${Ee}`,children:[r.jsx("p",{className:`evidence-position-label evidence-position-label--${Ee}`,children:U.label}),r.jsx("p",{className:`evidence-position-title evidence-position-title--${Ee}`,children:U.title}),r.jsx("p",{className:"evidence-position-meta",children:U.meta}),ce&&r.jsx("p",{className:"mt-1 text-[11px] text-zinc-500",children:ce})]}),E.answerSnippet&&r.jsxs("div",{children:[r.jsx("p",{className:"drawer-section-label",children:"What the AI said"}),r.jsx("div",{className:`answer-snippet-block ${a?"evidence-answer-expanded":"evidence-answer-collapsed"}`,children:R()}),E.answerSnippet.length>280&&r.jsx("button",{type:"button",className:"mt-1.5 text-xs text-zinc-500 hover:text-zinc-300 transition-colors",onClick:()=>o(!a),children:a?"↑ Collapse":"↓ Show full answer"})]}),!E.answerSnippet&&!y&&r.jsx("div",{className:"rounded-lg border border-zinc-800/40 bg-zinc-900/20 px-4 py-8 text-center text-zinc-600 text-sm",children:"No answer text recorded for this run"}),!P&&e.relatedTechnicalSignals.length>0&&r.jsxs("div",{children:[r.jsx("p",{className:"drawer-section-label",children:K?"Why you're visible":"What to fix"}),r.jsx("div",{className:"action-items-list",children:e.relatedTechnicalSignals.map((M,J)=>r.jsxs("div",{className:"action-item",children:[r.jsx("svg",{className:`action-item-icon ${K?"text-emerald-400":"text-amber-400"}`,viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:K?r.jsx("path",{d:"M3 8l3.5 3.5L13 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}):r.jsxs(r.Fragment,{children:[r.jsx("circle",{cx:"8",cy:"8",r:"7",stroke:"currentColor",strokeWidth:"1.5"}),r.jsx("path",{d:"M8 5v3.5M8 10.5v0",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}),r.jsx("span",{className:"action-item-text",children:M})]},J))})]}),E.summary&&r.jsx("p",{className:"text-xs text-zinc-600 border-t border-zinc-800/40 pt-3 mt-1",children:E.summary})]}),r.jsxs("div",{className:"evidence-modal-sidebar",children:[(ee||X)&&r.jsxs("div",{className:"sidebar-tabs",children:[r.jsx("button",{className:`sidebar-tab ${c==="mentions"?"sidebar-tab--active":""}`,onClick:()=>u("mentions"),type:"button",title:"Canonry's answer-level visibility assessment and any company names extracted from the answer text.",children:"Mentions"}),r.jsx("button",{className:`sidebar-tab ${c==="sources"?"sidebar-tab--active":""}`,onClick:()=>u("sources"),type:"button",title:"Grounding links the model used to build the answer. These are supporting sources, not the primary visibility signal.",children:"Sources"})]}),c==="mentions"&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{children:[r.jsxs("div",{className:"drawer-section-label flex items-center",children:[r.jsx("span",{children:"Answer visibility"}),r.jsx(hn,{text:"This status comes from Canonry's answer-level matching against your owned domains and project name. It is independent from grounding or citation sources."})]}),r.jsxs("div",{className:`citation-leaderboard-item citation-leaderboard-item--${K?"you":"not-cited"}`,children:[r.jsx("span",{className:"citation-leaderboard-rank",children:K?"✓":"—"}),r.jsx("span",{className:"citation-leaderboard-domain",children:O?"Awaiting first visibility run":K?"Your brand or domain appears in the answer text":"Your brand or domain does not appear in the answer text"}),!O&&r.jsx("span",{className:"citation-leaderboard-tag",children:K?"Visible":"Not visible"})]})]}),E.recommendedCompetitors.length>0&&r.jsxs("div",{children:[r.jsxs("div",{className:"drawer-section-label flex items-center",children:[r.jsx("span",{children:"Company names mentioned"}),r.jsx(hn,{text:"Best-effort company names extracted from the answer text. This is supplementary context only."})]}),r.jsx("div",{className:"citation-leaderboard",children:E.recommendedCompetitors.map((M,J)=>r.jsxs("div",{className:"citation-leaderboard-item citation-leaderboard-item--competitor",children:[r.jsxs("span",{className:"citation-leaderboard-rank",children:["#",J+1]}),r.jsx("span",{className:"citation-leaderboard-domain",children:M})]},M))})]})]}),c==="sources"&&r.jsxs(r.Fragment,{children:[E.citedDomains.length>0&&r.jsxs("div",{children:[r.jsxs("div",{className:"drawer-section-label flex items-center",children:[r.jsx("span",{children:"Domains from source links"}),r.jsx(hn,{text:"These domains were extracted from grounding or citation URLs. They are supporting-source metadata, not proof that the answer text mentioned them."})]}),r.jsx("div",{className:"citation-leaderboard",children:E.citedDomains.map((M,J)=>{const V=M.toLowerCase().replace(/^www\./,""),Q=C.has(V),me=!Q&&E.competitorDomains.some(Ne=>Ne.toLowerCase().replace(/^www\./,"")===V),ge=Q?"you":me?"competitor":"other";return r.jsxs("div",{className:`citation-leaderboard-item citation-leaderboard-item--${ge}`,children:[r.jsxs("span",{className:"citation-leaderboard-rank",children:["#",J+1]}),r.jsx("span",{className:"citation-leaderboard-domain",children:M}),Q&&r.jsx("span",{className:"citation-leaderboard-tag",children:"You"}),me&&r.jsx("span",{className:"citation-leaderboard-tag",children:"Competitor"})]},M)})})]}),E.groundingSources.length>0&&r.jsxs("div",{children:[r.jsxs("div",{className:"drawer-section-label flex items-center",children:[r.jsxs("span",{children:["Grounding source links (",E.groundingSources.length,")"]}),r.jsx(hn,{text:"Links the model used as grounding or supporting context while producing the answer. These are not the same thing as answer visibility."})]}),r.jsx("ul",{className:"grid gap-0.5",children:E.groundingSources.map((M,J)=>r.jsx("li",{className:"truncate text-sm",children:r.jsx("a",{href:M.uri,target:"_blank",rel:"noreferrer",className:"text-zinc-400 hover:text-zinc-200 transition-colors",children:M.title||M.uri})},J))})]}),E.evidenceUrls.length>0&&r.jsxs("div",{children:[r.jsx("p",{className:"drawer-section-label",children:"Evidence URLs"}),r.jsx("ul",{className:"grid gap-1",children:E.evidenceUrls.map(M=>r.jsx("li",{className:"truncate text-sm",children:r.jsx("a",{href:M,target:"_blank",rel:"noreferrer",className:"text-zinc-400 hover:text-zinc-200 transition-colors",children:M})},M))})]}),E.citedDomains.length===0&&E.groundingSources.length===0&&E.evidenceUrls.length===0&&r.jsxs("div",{className:"flex items-center justify-center h-24 text-zinc-600 text-sm",children:["No source data ",P?"for this run":"yet"]})]}),!ee&&!X&&r.jsxs("div",{className:"flex items-center justify-center h-24 text-zinc-600 text-sm",children:["No answer visibility data ",P?"for this run":"yet"]})]})]})]})]})]})})}function ls(e){const t=new Date("2026-02-20");return e.map((n,a)=>({runId:`run_mock_${a+1}`,citationState:n,createdAt:new Date(t.getTime()+a*2*24*60*60*1e3).toISOString()}))}const lm=[{id:"project_citypoint",name:"Citypoint Dental NYC",canonicalDomain:"citypointdental.com",ownedDomains:[],country:"US",language:"en",tags:["local intent","priority"],labels:{},locations:[],defaultLocation:null,configSource:"cli",configRevision:1},{id:"project_harbor",name:"Harbor Legal Group",canonicalDomain:"harborlegal.com",ownedDomains:[],country:"US",language:"en",tags:["lead gen"],labels:{},locations:[],defaultLocation:null,configSource:"cli",configRevision:1},{id:"project_northstar",name:"Northstar Orthopedics",canonicalDomain:"northstarortho.com",ownedDomains:[],country:"US",language:"en",tags:["multi-location"],labels:{},locations:[],defaultLocation:null,configSource:"cli",configRevision:1}];function od(e){return{id:e.id,projectId:e.projectId,projectName:e.projectName,kind:e.kind,kindLabel:e.kindLabel,status:e.status,trigger:e.trigger??"manual",createdAt:e.createdAt,startedAt:e.startedAt,duration:e.duration,statusDetail:e.statusDetail,summary:e.summary,triggerLabel:e.triggerLabel}}const WM=od({id:"run_citypoint_visibility_20260308",projectId:"project_citypoint",projectName:"Citypoint Dental NYC",kind:"answer-visibility",kindLabel:"Answer visibility sweep",status:"completed",createdAt:"2026-03-08T12:15:00.000Z",startedAt:"Mar 8, 12:15 PM",duration:"6m 12s",statusDetail:"18 tracked queries checked; 3 citation losses detected on emergency-intent prompts.",summary:"Citation losses on emergency-intent prompts",triggerLabel:"Scheduled"}),e4=od({id:"run_citypoint_queued_20260309",projectId:"project_citypoint",projectName:"Citypoint Dental NYC",kind:"answer-visibility",kindLabel:"Answer visibility sweep",status:"queued",createdAt:"2026-03-09T08:05:00.000Z",startedAt:"Mar 9, 8:05 AM",duration:"Waiting for slot",statusDetail:"Ready to enqueue after the next provider rate window clears.",summary:"Queued follow-up after local ranking movement",triggerLabel:"Manual"}),t4=od({id:"run_harbor_visibility_20260308",projectId:"project_harbor",projectName:"Harbor Legal Group",kind:"answer-visibility",kindLabel:"Answer visibility sweep",status:"completed",createdAt:"2026-03-08T11:05:00.000Z",startedAt:"Mar 8, 11:05 AM",duration:"5m 07s",statusDetail:"12 tracked queries checked; local-intent visibility held steady across branded prompts.",summary:"Branded prompts remain stable",triggerLabel:"Scheduled"}),n4=od({id:"run_northstar_visibility_20260308",projectId:"project_northstar",projectName:"Northstar Orthopedics",kind:"answer-visibility",kindLabel:"Answer visibility sweep",status:"running",createdAt:"2026-03-08T13:40:00.000Z",startedAt:"Mar 8, 1:40 PM",duration:"3m 10s",statusDetail:"Provider responses still in flight for 9 multi-location prompts.",summary:"Mid-run on treatment-location prompts",triggerLabel:"Manual"}),s4=[{id:"evidence_citypoint_emergency_gemini",keyword:"emergency dentist brooklyn",provider:"gemini",model:"gemini-3-flash",location:null,citationState:"lost",changeLabel:"Lost since Mar 5",answerSnippet:"For urgent dental care in Brooklyn, Downtown Smiles and Harbor Dental are now cited first for emergency availability and same-day booking.",citedDomains:["downtownsmiles.com","harbordental.com"],evidenceUrls:["https://downtownsmiles.com/emergency-dentist-brooklyn","https://harbordental.com/same-day-emergency-care"],competitorDomains:["downtownsmiles.com","harbordental.com"],groundingSources:[],relatedTechnicalSignals:["FAQ schema missing on the emergency service page","llms.txt not found during latest site audit","Location pages link weakly into the emergency care hub"],summary:"AI answers now cite two competitors while your emergency page is no longer grounded.",runHistory:ls(["cited","cited","cited","cited","cited","cited","cited","not-cited","not-cited"])},{id:"evidence_citypoint_emergency_openai",keyword:"emergency dentist brooklyn",provider:"openai",model:"gpt-5.4",location:null,citationState:"cited",changeLabel:"Cited for 6 runs",answerSnippet:"Citypoint Dental is listed as a top emergency dentist in Brooklyn for same-day appointments and walk-in availability.",citedDomains:["citypointdental.com","downtownsmiles.com"],evidenceUrls:["https://citypointdental.com/emergency-dentist-brooklyn"],competitorDomains:["downtownsmiles.com"],groundingSources:[],relatedTechnicalSignals:["Emergency page indexed with structured data"],summary:"OpenAI cites your emergency page consistently alongside one competitor.",runHistory:ls(["not-cited","cited","cited","cited","cited","cited","cited"])},{id:"evidence_citypoint_emergency_claude",keyword:"emergency dentist brooklyn",provider:"claude",model:"claude-sonnet-4-6",location:null,citationState:"not-cited",changeLabel:"No citation across 12 runs",answerSnippet:"Based on the search results, top-rated emergency dental practices in Brooklyn include Downtown Smiles and Harbor Dental.",citedDomains:["downtownsmiles.com","harbordental.com"],evidenceUrls:[],competitorDomains:["downtownsmiles.com","harbordental.com"],groundingSources:[],relatedTechnicalSignals:["FAQ schema missing","llms.txt not found"],summary:"Claude does not cite your domain for this emergency query.",runHistory:ls(["not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited"])},{id:"evidence_citypoint_invisalign_openai",keyword:"best invisalign dentist downtown brooklyn",provider:"openai",model:"gpt-5.4",location:null,citationState:"emerging",changeLabel:"First citation in 7 days",answerSnippet:"Citypoint Dental appears as an emerging recommendation for Invisalign in Downtown Brooklyn, supported by recent before-and-after case pages.",citedDomains:["citypointdental.com","clearlineortho.com"],evidenceUrls:["https://citypointdental.com/invisalign-downtown-brooklyn","https://citypointdental.com/case-studies/invisalign-open-bite"],competitorDomains:["clearlineortho.com"],groundingSources:[],relatedTechnicalSignals:["Structured data now present on two case-study pages","Internal links from service pages to case studies improved crawl depth"],summary:"Fresh case-study content is starting to earn citations on Invisalign prompts.",runHistory:ls(["not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","cited"])},{id:"evidence_citypoint_invisalign_gemini",keyword:"best invisalign dentist downtown brooklyn",provider:"gemini",model:"gemini-3-flash",location:null,citationState:"cited",changeLabel:"Cited for 8 runs",answerSnippet:"Citypoint Dental in Downtown Brooklyn is highlighted for its Invisalign expertise and patient outcomes.",citedDomains:["citypointdental.com"],evidenceUrls:["https://citypointdental.com/invisalign-downtown-brooklyn"],competitorDomains:[],groundingSources:[],relatedTechnicalSignals:["Case study pages well-indexed"],summary:"Gemini consistently cites your Invisalign page with no competitor overlap.",runHistory:ls(["cited","cited","cited","cited","cited","cited","cited","cited"])},{id:"evidence_citypoint_invisalign_claude",keyword:"best invisalign dentist downtown brooklyn",provider:"claude",model:"claude-sonnet-4-6",location:null,citationState:"not-cited",changeLabel:"No citation across 12 runs",answerSnippet:"For Invisalign in Downtown Brooklyn, Clear Line Ortho and Brooklyn Smiles are frequently recommended for their experienced orthodontists.",citedDomains:["clearlineortho.com","brooklynsmiles.com"],evidenceUrls:[],competitorDomains:["clearlineortho.com"],groundingSources:[],relatedTechnicalSignals:["No before/after schema on case study pages"],summary:"Claude does not surface your Invisalign content despite strong page quality.",runHistory:ls(["not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited"])},{id:"evidence_citypoint_children_claude",keyword:"pediatric dentist brooklyn heights",provider:"claude",model:"claude-sonnet-4-6",location:null,citationState:"not-cited",changeLabel:"No citation across 4 runs",answerSnippet:"Answers cite neighborhood-specific pediatric practices with stronger family-focused FAQ content and clearer insurance details.",citedDomains:["brightkidsdental.com","parkpediatricdental.com"],evidenceUrls:["https://brightkidsdental.com/pediatric-dentist-brooklyn-heights","https://parkpediatricdental.com/insurance"],competitorDomains:["brightkidsdental.com","parkpediatricdental.com"],groundingSources:[],relatedTechnicalSignals:["No dedicated pediatric service page exists for Brooklyn Heights","Insurance content is buried three clicks deep"],summary:"Coverage gap is content-driven, not purely technical.",runHistory:ls(["not-cited","not-cited","not-cited","not-cited"])},{id:"evidence_citypoint_children_gemini",keyword:"pediatric dentist brooklyn heights",provider:"gemini",model:"gemini-3-flash",location:null,citationState:"not-cited",changeLabel:"No citation across 12 runs",answerSnippet:"For pediatric dentistry in Brooklyn Heights, Bright Kids Dental and Park Pediatric Dental are cited for family-friendly care.",citedDomains:["brightkidsdental.com","parkpediatricdental.com"],evidenceUrls:[],competitorDomains:["brightkidsdental.com","parkpediatricdental.com"],groundingSources:[],relatedTechnicalSignals:["No dedicated pediatric page for Brooklyn Heights"],summary:"Gemini does not surface your domain for pediatric queries in this area.",runHistory:ls(["not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited","not-cited"])},{id:"evidence_citypoint_children_openai",keyword:"pediatric dentist brooklyn heights",provider:"openai",model:"gpt-5.4",location:null,citationState:"cited",changeLabel:"First citation this month",answerSnippet:"Citypoint Dental is mentioned as offering pediatric services in Brooklyn, though specialized pediatric-only practices are also highlighted.",citedDomains:["citypointdental.com","brightkidsdental.com"],evidenceUrls:["https://citypointdental.com/family-dentistry"],competitorDomains:["brightkidsdental.com"],groundingSources:[],relatedTechnicalSignals:["Family dentistry page recently updated"],summary:"OpenAI recently started citing your family dentistry page for this query.",runHistory:ls(["not-cited","not-cited","not-cited","not-cited","not-cited","cited"])}];lm[0],lm[1],ls(["cited","cited","cited","cited","cited"]),lm[2],2/7,ls(["not-cited","not-cited","not-cited","cited"]);function i4(e,t){return e.projects.find(n=>n.project.id===t)}function a4(e,t){return e.runs.find(n=>n.id===t)}function r4(e,t){for(const n of e.projects){const a=n.visibilityEvidence.find(o=>o.id===t);if(a)return{project:n,evidence:a}}}function iN(e){return{id:e.id,name:e.name,displayName:e.displayName,canonicalDomain:e.canonicalDomain,ownedDomains:e.ownedDomains??[],country:e.country,language:e.language,tags:e.tags,labels:e.labels,locations:e.locations??[],defaultLocation:e.defaultLocation??null,configSource:e.configSource,configRevision:e.configRevision,createdAt:e.createdAt,updatedAt:e.updatedAt}}function Jx(e){try{return new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}catch{return e}}function o4(e,t){if(!e)return"Waiting";if(!t)return"Running";const n=new Date(t).getTime()-new Date(e).getTime();if(n<1e3)return"<1s";const a=Math.floor(n/1e3);if(a<60)return`${a}s`;const o=Math.floor(a/60),c=a%60;return`${o}m ${c}s`}function aN(e){return e==="answer-visibility"?"Answer visibility sweep":e}function l4(e){return e==="manual"?"Manual":e==="scheduled"?"Scheduled":e==="config-apply"?"Config apply":e}function Fp(e,t){return{id:e.id,projectId:e.projectId,projectName:t,kind:e.kind,kindLabel:aN(e.kind),status:e.status,trigger:e.trigger??"manual",location:e.location??null,createdAt:e.createdAt,startedAt:e.startedAt?Jx(e.startedAt):Jx(e.createdAt),duration:o4(e.startedAt,e.finishedAt),statusDetail:e.error?rN(e.error):c4(e),summary:u4(e),triggerLabel:l4(e.trigger)}}function rN(e){try{const n=JSON.parse(e);if(typeof n=="object"&&n!==null){const a=n.message??n.error?.message??n[0]?.error?.message;if(typeof a=="string"&&a.length>0)return a.length>200?a.slice(0,200)+"…":a}}catch{}const t=e.match(/\[.*?\]\s*(.+)/);if(t){const n=t[1];return n.length>200?n.slice(0,200)+"…":n}return e.length>200?e.slice(0,200)+"…":e}function c4(e){switch(e.status){case"queued":return"Waiting for execution slot.";case"running":return"Provider queries in progress.";case"completed":return"All key phrases checked.";case"partial":return"Run completed with some key phrases skipped.";case"failed":return e.error?rN(e.error):"Run failed.";default:return""}}function u4(e){switch(e.status){case"queued":return"Queued for execution";case"running":return"In progress";case"completed":return"Visibility sweep completed";case"partial":return"Partial completion";case"failed":return"Run failed";default:return e.status}}function oN(e){if(e.length===0)return{score:0,citedCount:0,totalCount:0};const t=new Map;for(const c of e){const u=c.keyword??c.id;t.has(u)||t.set(u,!1),c.citationState==="cited"&&t.set(u,!0)}const n=t.size,a=[...t.values()].filter(Boolean).length;return{score:n>0?Math.round(a/n*100):0,citedCount:a,totalCount:n}}function d4(e){return e>=70?"positive":e>=40?"caution":"negative"}function f4(e){return e==="High"?"negative":e==="Moderate"?"caution":"neutral"}function h4(e,t){return e===0?"positive":(t>0?e/t:0)>=.3?"negative":"caution"}function m4(e){if(e.length===0)return{label:"Gap Key Phrases",value:"No data",delta:"Run a sweep first",tone:"neutral",description:"Run a visibility sweep to identify key phrases where competitors are cited and your domain is not.",tooltip:"Tracked key phrases where a competitor is cited in the latest run but your domain is not.",trend:[]};const t=new Map;for(const c of e){const u=c.keywordId,f=t.get(u)??{cited:!1,competitorOverlap:new Set};c.citationState==="cited"&&(f.cited=!0);for(const m of c.competitorOverlap)f.competitorOverlap.add(m);t.set(u,f)}const n=t.size,a=[...t.values()].filter(c=>!c.cited&&c.competitorOverlap.size>0).length,o=a===1?"key phrase":"key phrases";return{label:"Gap Key Phrases",value:`${a}`,delta:`${a} of ${n} key phrases at risk`,tone:h4(a,n),description:a>0?`${a} tracked ${o} currently cite competitors without citing your domain.`:"No competitive key phrase gaps detected in the latest visibility run.",tooltip:"Tracked key phrases where a competitor is cited in the latest run but your domain is not.",trend:[],progress:n>0?a/n:0}}function p4(e,t){return e&&e.summary.total>0?{provider:"Google",...e.summary}:t&&t.summary.total>0?{provider:"Bing",...t.summary,deindexed:0}:e?{provider:"Google",...e.summary}:t?{provider:"Bing",...t.summary,deindexed:0}:null}function g4(e){return e.provider==="Google"&&e.deindexed>0?"negative":e.percentage>=90?"positive":e.percentage>=70?"caution":"negative"}function y4(e,t){const n=p4(e,t);if(!n||n.total===0)return{label:"Index Coverage",value:"No data",delta:"Connect GSC or Bing",tone:"neutral",description:"Connect Google Search Console or Bing Webmaster Tools and inspect your sitemap to populate coverage.",tooltip:"Percentage of inspected URLs currently indexed. Google Search Console is preferred when available, otherwise Bing Webmaster Tools is used.",trend:[]};const a=n.notIndexed===1?"URL is":"URLs are",o=n.deindexed===1?"URL":"URLs";return{label:"Index Coverage",value:`${Math.round(n.percentage)}`,delta:`${n.provider} · ${n.indexed} of ${n.total} indexed`,tone:g4(n),description:n.provider==="Google"&&n.deindexed>0?`${n.deindexed} deindexed ${o} detected in the latest Google Search Console inspection.`:`${n.notIndexed} ${a} not indexed in ${n.provider==="Google"?"Google Search Console":"Bing Webmaster Tools"}.`,tooltip:"Percentage of inspected URLs currently indexed. Google Search Console is preferred when available, otherwise Bing Webmaster Tools is used.",trend:[]}}function lN(e,t){if(e.length===0||t.length===0)return{label:"None",count:0};const n=new Set(t);let a=0;for(const c of e)c.competitorOverlap.some(u=>n.has(u))&&a++;const o=a/e.length;return o>=.5?{label:"High",count:a}:o>=.2?{label:"Moderate",count:a}:{label:"Low",count:a}}function v4(e,t,n,a){const o=[];let c=0;const u=new Set;if(n){const f=new Map;for(const b of n.snapshots)if(b.keyword){const x=`${b.keyword}::${b.provider}`;f.set(x,b)}const m=new Set(n.snapshots.map(b=>b.provider)),p=new Set(t.flatMap(b=>Object.keys(b.providerRuns??{}))),v=[...new Set([...m,...p])].sort(),y=v.length>0?v:["gemini"];for(const b of t){if(b.runs.length===0)continue;u.add(b.keyword);const x=b.runs.at(-1),N=x?.transition??"not-cited";for(const S of y){const C=f.get(`${b.keyword}::${S}`),k=(b.providerRuns?.[S]?.length??0)>0;if(!C&&!k)continue;const T=C?.model??null,A=T?`${S}:${T}`:null,z=A?b.modelRuns?.[A]:void 0,$=b.providerRuns?.[S],P=($?.length?$:null)??(z?.length?z:null),E=$?.length?"provider":z?.length?"model":"keyword",O=P?P.at(-1).transition:N,K=P?P.at(-1).visibilityTransition??(P.at(-1).visibilityState==="visible"?"visible":"not-visible"):x?.visibilityTransition??(x?.visibilityState==="visible"?"visible":"not-visible"),ee=P?.at(-1)?.citationState,X=P?.at(-1)?.visibilityState,se=C?O==="lost"?"lost":O==="emerging"?"emerging":C.citationState==="cited"?"cited":"not-cited":ee==="cited"?"cited":"not-cited",de=C?.visibilityState??(X==="visible"?"visible":X==="pending"?"pending":"not-visible"),Ee=Gm(P||b.runs),be=Xx(P||b.runs),H=b4(b,S),ae=(P??b.runs).map(R=>({runId:R.runId,citationState:R.citationState,createdAt:R.createdAt,model:H.get(R.runId)??null,answerMentioned:R.answerMentioned,visibilityState:R.visibilityState,visibilityTransition:R.visibilityTransition})),pe=x4(ae),ce=E==="provider"&&pe.length<=1?"model":E,U=S4(ae);o.push({id:`evidence_${e}_${c++}`,keyword:b.keyword,provider:C?.provider??S,model:C?.model??null,location:C?.location??null,citationState:se,answerMentioned:C?.answerMentioned,visibilityState:de,visibilityChangeLabel:Wx(K,be,{positive:"visible",negative:"not visible",first:"first visibility"}),changeLabel:Wx(O,Ee),answerSnippet:C?.answerText??"",citedDomains:C?.citedDomains??[],evidenceUrls:[],competitorDomains:C?.competitorOverlap??[],recommendedCompetitors:C?.recommendedCompetitors??[],relatedTechnicalSignals:[],groundingSources:C?.groundingSources??[],summary:j4(de,K,b.keyword),runHistory:ae,historyScope:ce,modelsSeen:pe,modelTransitions:U})}}}for(const f of a)u.has(f.keyword)||o.push({id:`evidence_${e}_${c++}`,keyword:f.keyword,provider:"",model:null,location:null,citationState:"pending",visibilityState:"pending",visibilityChangeLabel:"Awaiting first run",changeLabel:"Awaiting first run",answerSnippet:"",citedDomains:[],evidenceUrls:[],competitorDomains:[],recommendedCompetitors:[],relatedTechnicalSignals:[],groundingSources:[],summary:`"${f.keyword}" has been added but no visibility run has been triggered yet.`,runHistory:[],historyScope:"keyword",modelsSeen:[],modelTransitions:[]});return o}function b4(e,t){const n=new Map,a=`${t}:`;for(const[o,c]of Object.entries(e.modelRuns??{})){if(!o.startsWith(a))continue;const u=o.slice(a.length),f=u==="unknown"?null:u;for(const m of c)n.set(m.runId,f)}return n}function x4(e){const t=new Set;for(const n of e)n.model&&t.add(n.model);return[...t]}function S4(e){const t=[];let n=null;for(const a of e){const o=a.model??null;o!==n&&n!==null&&t.push({runId:a.runId,createdAt:a.createdAt,fromModel:n,toModel:o}),n=o}return t}function Gm(e){if(e.length===0)return 0;const t=e[e.length-1].citationState;let n=0;for(let a=e.length-1;a>=0&&e[a].citationState===t;a--)n++;return n}function Xx(e){if(e.length===0)return 0;const t=e[e.length-1].visibilityState??"not-visible";let n=0;for(let a=e.length-1;a>=0&&(e[a].visibilityState??"not-visible")===t;a--)n++;return n}function Wx(e,t,n){const a={positive:n?.positive??"cited",negative:n?.negative??"not cited",first:n?.first??"first citation"};switch(e){case"new":return"First observation";case"cited":case"visible":return t<=1?`${Qo(a.positive)} in latest run`:`${Qo(a.positive)} for ${t} runs`;case"lost":return"Lost since last run";case"emerging":return Qo(a.first);case"not-cited":case"not-visible":return t<=1?`${Qo(a.negative)} in latest run`:`${Qo(a.negative)} across ${t} runs`;default:return e}}function Qo(e){return e.charAt(0).toUpperCase()+e.slice(1)}function j4(e,t,n){switch(t){case"lost":return`Visibility was lost for "${n}". Your brand no longer appeared in the latest answer.`;case"emerging":return`Your brand started appearing in AI answers for "${n}".`}switch(e){case"visible":return`Your brand or domain is visible in AI answers for "${n}".`;case"pending":return`"${n}" has been added but no visibility run has been triggered yet.`;default:return`Your brand or domain was not mentioned in AI answers for "${n}".`}}function eS(e,t){const n=new Set(t),a=new Map;for(const o of e)if(o.keyword)for(const c of o.competitorOverlap){if(!n.has(c))continue;const u=a.get(c)??new Set;u.add(o.keyword),a.set(c,u)}return a}const cm=3;function w4(e){const{evidence:t,timeline:n,latestSnapshots:a,previousSnapshots:o,trackedCompetitors:c}=e,u=[],f=[],m=new Set;for(const k of t)k.citationState==="lost"&&(m.has(k.keyword)||(m.add(k.keyword),f.push({keyword:k.keyword,evidenceId:k.id,provider:k.provider,citationState:"lost"})));f.length>0&&u.push({id:"insight_lost",tone:"negative",title:`Lost citation on ${f.length} key phrase${f.length>1?"s":""}`,detail:"Citations dropped since the last run.",actionLabel:"Lost",affectedPhrases:f});const p=eS(a,c),v=eS(o,c);for(const k of c){const T=p.get(k)??new Set,A=v.get(k)??new Set,z=[...T].filter($=>!A.has($));z.length>0&&u.push({id:`insight_comp_gained_${k}`,tone:"negative",title:`${k} appeared on ${z.length} key phrase${z.length>1?"s":""}`,detail:"A tracked competitor gained new citations.",actionLabel:"Competitor",affectedPhrases:z.map($=>{const P=t.find(E=>E.keyword===$);return{keyword:$,evidenceId:P?.id??"",citationState:"cited"}})})}const y=new Map;for(const k of n){const T=k.runs.at(-1);T&&y.set(k.keyword,{transition:T.transition,citationState:T.citationState})}const b=[],x=[],N=new Set;for(const[k,{transition:T,citationState:A}]of y){if(!(T==="emerging"||T==="new"&&A==="cited"))continue;N.add(k);const $=t.find(P=>P.keyword===k&&(P.citationState==="emerging"||P.citationState==="cited"));b.push({keyword:k,evidenceId:$?.id??"",provider:$?.provider,citationState:"emerging"})}for(const k of t)k.citationState==="emerging"&&(N.has(k.keyword)||x.push({keyword:k.keyword,evidenceId:k.id,provider:k.provider,citationState:"emerging"}));if(x.length>0){const k=new Set(x.map(T=>T.keyword)).size;u.push({id:"insight_provider_pickup",tone:"positive",title:`Picked up by new provider on ${k} key phrase${k>1?"s":""}`,detail:"Your domain started appearing on additional providers.",actionLabel:"Pickup",affectedPhrases:x})}b.length>0&&u.push({id:"insight_first_citation",tone:"positive",title:`First citation on ${N.size} key phrase${N.size>1?"s":""}`,detail:"Your domain appeared in AI answers for the first time.",actionLabel:"New",affectedPhrases:b});const S=new Set(t.map(k=>k.keyword)),C=[];for(const k of n){if(!S.has(k.keyword)||k.runs.length<cm||k.runs.at(-1)?.citationState!=="not-cited")continue;if(Gm(k.runs)>=cm){const z=t.find($=>$.keyword===k.keyword);C.push({keyword:k.keyword,evidenceId:z?.id??"",citationState:"not-cited"})}}C.length>0&&u.push({id:"insight_persistent_gap",tone:"caution",title:`${C.length} key phrase${C.length>1?"s":""} uncited for ${cm}+ runs`,detail:"These key phrases have not been cited by any provider across multiple consecutive runs.",actionLabel:"Gap",affectedPhrases:C});for(const k of c){const T=p.get(k)??new Set,z=[...v.get(k)??new Set].filter($=>!T.has($));z.length>0&&u.push({id:`insight_comp_lost_${k}`,tone:"neutral",title:`${k} dropped from ${z.length} key phrase${z.length>1?"s":""}`,detail:"A tracked competitor lost citations.",actionLabel:"Competitor",affectedPhrases:z.map($=>{const P=t.find(E=>E.keyword===$);return{keyword:$,evidenceId:P?.id??"",citationState:"not-cited"}})})}return u.length===0&&u.push({id:"insight_stable",tone:"neutral",title:"No significant changes",detail:"Citation state is stable across all tracked key phrases.",actionLabel:"Stable",affectedPhrases:[]}),u}function N4(e,t){if(t.length===0){const m=new Set(e.filter(p=>p.citationState==="cited").map(p=>p.keyword)).size;return{gained:m,lost:0,tone:m>0?"positive":"neutral",hasPreviousRun:!1}}const n=m=>{const p=new Set;for(const v of m)v.citationState==="cited"&&v.keyword&&p.add(v.keyword);return p},a=n(e),o=n(t);let c=0,u=0;for(const m of a)o.has(m)||c++;for(const m of o)a.has(m)||u++;const f=u>c?"negative":c>u?"positive":"neutral";return{gained:c,lost:u,tone:f,hasPreviousRun:!0}}function C4(e){const t=e[0];if(!t)return{label:"Run Status",value:"None",delta:"No runs yet",tone:"neutral",description:"Trigger a visibility sweep to start tracking.",tooltip:"Current execution state of visibility sweeps. Shows the status of the most recent run and total run count.",trend:[]};const n=t.status==="completed"?"Healthy":t.status==="running"?"Running":t.status==="queued"?"Queued":t.status==="partial"?"Partial":"Failed",a=t.status==="completed"?"positive":t.status==="failed"?"negative":t.status==="partial"?"caution":"neutral";return{label:"Run Status",value:n,delta:`${e.length} total runs`,tone:a,description:`Latest: ${aN(t.kind)} — ${t.status}`,tooltip:"Current execution state of visibility sweeps. Shows the status of the most recent run and total run count.",trend:[]}}function k4(e){const t=iN(e.project),n=v4(t.name,e.timeline,e.latestRunDetail,e.keywords),a=e.latestRunDetail?.snapshots??[],o=oN(a),c=m4(a),u=y4(e.gscCoverage,e.bingCoverage),f=lN(a,e.competitors.map(x=>x.domain)),m=w4({evidence:n,timeline:e.timeline,latestSnapshots:e.latestRunDetail?.snapshots??[],previousSnapshots:e.previousRunDetail?.snapshots??[],trackedCompetitors:e.competitors.map(x=>x.domain)}),p=[...e.runs].sort((x,N)=>N.createdAt.localeCompare(x.createdAt)),v=p.map(x=>Fp(x,e.project.displayName||e.project.name)),y=new Map;for(const x of a){const N=x.provider||"gemini",S=x.model??null,C=`${N}::${S??"unknown"}`,k=y.get(C)??{provider:N,model:S,cited:0,total:0};k.total++,x.citationState==="cited"&&k.cited++,y.set(C,k)}const b=[...y.values()].sort((x,N)=>x.provider.localeCompare(N.provider)||(x.model??"").localeCompare(N.model??"")).map(({provider:x,model:N,cited:S,total:C})=>({provider:x,model:N,score:C>0?Math.round(S/C*100):0,cited:S,total:C}));return{project:t,dateRangeLabel:"All time",contextLabel:`${t.country} / ${t.language.toUpperCase()}`,visibilitySummary:{label:"Answer Visibility",value:a.length>0?`${o.score}`:"No data",delta:a.length>0?`${o.citedCount} of ${o.totalCount} key phrases visible`:"Run a sweep first",tone:a.length>0?d4(o.score):"neutral",description:a.length>0?`${o.citedCount} of ${o.totalCount} tracked key phrases found your domain in at least one AI answer engine.`:"No visibility data yet. Trigger a run to start tracking.",tooltip:'Percentage of tracked key phrases where your domain is cited by at least one AI answer engine. A key phrase is "visible" if any configured provider includes your site in its response.',trend:[]},keywordCounts:{cited:o.citedCount,total:o.totalCount},gapKeyPhrases:c,indexCoverage:u,providerScores:b,competitorPressure:{label:"Competitor Pressure",value:f.label,delta:f.count>0?`${f.count} overlapping citations`:"No overlap detected",tone:f4(f.label),description:e.competitors.length>0?`${e.competitors.length} competitor${e.competitors.length>1?"s":""} tracked.`:"No competitors configured.",tooltip:"How often competitor domains appear alongside yours in AI answers. High pressure means competitors are frequently cited for the same key phrases.",trend:[]},runStatus:C4(p),movementSummary:N4(e.latestRunDetail?.snapshots??[],e.previousRunDetail?.snapshots??[]),insights:m,visibilityEvidence:n,competitors:e.competitors.map((x,N)=>{const S=new Set;for(const z of a)(z.competitorOverlap.includes(x.domain)||z.citedDomains.includes(x.domain))&&z.keyword&&S.add(z.keyword);const C=[...S],k=new Set(a.map(z=>z.keyword).filter(Boolean)),T=k.size>0?C.length/k.size:0,A=T>=.5?"High":T>=.2?"Moderate":C.length>0?"Low":"None";return{id:x.id||`comp_${N}`,domain:x.domain,citationCount:C.length,totalKeywords:k.size,pressureLabel:A,citedKeywords:C,movement:"",notes:""}}),recentRuns:v.slice(0,5)}}function z4(e){const t=iN(e.project),n=e.latestRunDetail?.snapshots??[],a=oN(n),o=lN(n,e.competitors.map(m=>m.domain)),u=[...e.runs].sort((m,p)=>p.createdAt.localeCompare(m.createdAt))[0],f=u?Fp(u,e.project.displayName||e.project.name):{id:"none",projectId:e.project.id,projectName:e.project.displayName||e.project.name,kind:"answer-visibility",kindLabel:"No runs yet",status:"queued",trigger:"manual",createdAt:"",startedAt:"",duration:"",statusDetail:"",summary:"No runs yet",triggerLabel:""};return{project:t,visibilityScore:a.score,visibilityDelta:n.length>0?`${a.citedCount} of ${a.totalCount} key phrases`:"No data",lastRun:f,insight:n.length>0?`${a.citedCount} of ${a.totalCount} key phrases visible across ${new Set(n.map(m=>m.provider)).size} provider${new Set(n.map(m=>m.provider)).size>1?"s":""}.`:"No runs completed yet.",trend:[],competitorPressureLabel:o.label}}function _4(e,t){const n=[],a=[],o=[];for(const u of e){a.push(k4(u)),o.push(z4(u));const f=[...u.runs].sort((m,p)=>p.createdAt.localeCompare(m.createdAt));for(const m of f)n.push(Fp(m,u.project.displayName||u.project.name))}n.sort((u,f)=>f.createdAt.localeCompare(u.createdAt));const c=e.length>0;return{portfolioOverview:{projects:o,attentionItems:c?E4(a):[{id:"attention_setup",tone:"neutral",title:"No projects yet",detail:"Create your first project using the setup wizard, CLI, or API.",actionLabel:"Open setup",href:"/setup"}],recentRuns:n.slice(0,5),systemHealth:[{id:"api",label:"API",tone:"positive",detail:"Connected",meta:"Real-time data"},{id:"provider",label:"Gemini",tone:"positive",detail:"Configured",meta:"Provider active"}],lastUpdatedAt:new Date().toLocaleString("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit",timeZoneName:"short"}),...c?{}:{emptyState:{title:"No projects yet",detail:"Canonry becomes useful after one project, a small key phrase set, and one competitor list are in place.",ctaLabel:"Launch setup",ctaHref:"/setup"}}},projects:a,runs:n,setup:{healthChecks:[{id:"api",label:"API reachable",detail:"API is responding.",state:"ready",guidance:"Required for project creation and run history."},{id:"provider",label:"Provider configured",detail:"Gemini key is configured.",state:"ready",guidance:"Required for answer-visibility sweeps."}],projectDraft:{name:"",canonicalDomain:"",country:"US",language:"en"},keywordImportState:{mode:"paste",keywordCount:0,preview:[]},competitorDraft:{domains:[],notes:"Use the CLI to add competitors."},launchState:{enabled:c,ctaLabel:c?"Trigger run":"Create a project first",summary:c?"Ready to run.":"Create a project first to launch a run."}},settings:{providerStatuses:(t?.providers??[]).map(u=>({name:u.name,displayName:u.displayName,keyUrl:u.keyUrl,modelHint:u.modelHint,model:u.model,state:u.configured?"ready":"needs-config",detail:u.configured?"Provider is configured.":"API key is missing.",quota:u.quota})),google:{state:t?.google?.configured?"ready":"needs-config",detail:t?.google?.configured?"Google OAuth app credentials are configured. Project-level GSC connections can be created from the dashboard.":"Google OAuth client ID and client secret are not configured yet."},bing:{state:t?.bing?.configured?"ready":"needs-config",detail:t?.bing?.configured?"Bing Webmaster Tools API key is configured. Project-level Bing connections can be created from the dashboard.":"Bing Webmaster Tools API key is not configured yet."},selfHostNotes:["Configuration is stored in ~/.canonry/config.yaml.","The local config file is the source of truth for authentication credentials.","Google OAuth app credentials and per-domain Google tokens are stored in local config, not the database.","Database is SQLite at ~/.canonry/data.db.","API key was auto-generated during canonry init."],bootstrapNote:"Use the UI, CLI, or ~/.canonry/config.yaml to manage settings. Authentication credentials persist to local config."}}}function E4(e){const t=[];for(const n of e){const a=n.visibilityEvidence.filter(c=>c.citationState==="lost");a.length>0&&t.push({id:`attention_${n.project.id}_lost`,tone:"negative",title:`${n.project.displayName||n.project.name} lost citations`,detail:`${a.length} key phrase${a.length>1?"s":""} lost citation.`,actionLabel:"Open project",href:`/projects/${n.project.id}`});const o=n.recentRuns.filter(c=>c.status==="running"||c.status==="queued");o.length>0&&t.push({id:`attention_${n.project.id}_active`,tone:"neutral",title:`${n.project.displayName||n.project.name} has active runs`,detail:`${o.length} run${o.length>1?"s":""} in progress.`,actionLabel:"View runs",href:"/runs"})}return t.length===0&&t.push({id:"attention_stable",tone:"positive",title:"All projects stable",detail:"No citation losses or active runs to flag.",actionLabel:"View portfolio",href:"/"}),t}const Qn={projects:{all:["projects"],detail:(e,t)=>["projects",e,t],keywords:e=>["projects",e,"keywords"],competitors:e=>["projects",e,"competitors"],timeline:(e,t)=>["projects",e,"timeline",t]},runs:{all:["runs"],detail:e=>["runs",e]},settings:["settings"],health:["health"]},cN=w.createContext(null);cN.Provider;function vl(){return w.useContext(cN)}function La(e){const n=vl()?.dashboard??null,a=xa({queryKey:Qn.projects.all,queryFn:tj,enabled:!n}),o=xa({queryKey:Qn.runs.all,queryFn:sj,enabled:!n,refetchInterval:N=>N.state.data?.some(k=>k.status==="running"||k.status==="queued")?3e3:!1}),c=xa({queryKey:Qn.settings,queryFn:()=>Cp().catch(()=>null),enabled:!n}),u=a.data??[],f=o.data??[],m=Fk({queries:u.map(N=>{const S=f.filter(k=>k.projectId===N.id),C=S.filter(k=>(k.status==="completed"||k.status==="partial")&&k.kind==="answer-visibility").sort((k,T)=>T.createdAt.localeCompare(k.createdAt));return{queryKey:Qn.projects.detail(N.id,C[0]?.id),queryFn:async()=>{const[k,T,A,z,$,P,E]=await Promise.all([W_(N.name).catch(()=>[]),ij(N.name).catch(()=>[]),aj(N.name).catch(()=>[]),C[0]?Ur(C[0].id).catch(()=>null):Promise.resolve(null),C[1]?Ur(C[1].id).catch(()=>null):Promise.resolve(null),kp(N.name).catch(()=>null),zp(N.name).catch(()=>null)]);return{project:N,runs:S,keywords:k,competitors:T,timeline:A,latestRunDetail:z,previousRunDetail:$,gscCoverage:P,bingCoverage:E}},enabled:!n&&a.isSuccess&&o.isSuccess}})}),p=m.every(N=>N.isSuccess),v=w.useMemo(()=>{if(n)return n;if(!a.data||!o.data||u.length>0&&!p)return null;const N=m.map(S=>S.data).filter(S=>S!=null);return _4(N,c.data??null)},[n,a.data,o.data,c.data,p,m,u.length]),y=!n&&(a.isError||o.isError),b=!n&&!v&&!y,x=w.useCallback(async()=>{await Promise.all([a.refetch(),o.refetch(),c.refetch()])},[a.refetch,o.refetch,c.refetch]);return{dashboard:v,isLoading:b,isError:y,refetch:x}}function A4(){return typeof window<"u"&&window.__CANONRY_CONFIG__?.basePath?window.__CANONRY_CONFIG__.basePath:"/"}const tS=A4(),Fm=tS==="/"?"":tS.replace(/\/$/,"");async function T4(){const e=Fm?`${Fm}/health`:"/health",t=await V2(e,"API"),n=t.state==="ok"?{label:"Runner",state:"ok",detail:"In-process job runner"}:{label:"Runner",state:t.state,detail:"Depends on API"};return{apiStatus:t,workerStatus:n}}function ld(e,t){return xa({queryKey:Qn.health,queryFn:T4,enabled:e,refetchInterval:15e3,initialData:t})}function R4(e){return xa({queryKey:Qn.runs.detail(e??""),queryFn:()=>Ur(e),enabled:!!e,refetchInterval:t=>{const n=t.state.data?.status;return n==="running"||n==="queued"?3e3:!1}})}function Zr(){const e=Bi(),t=Zu({strict:!1}),n=Cn({select:m=>m.location.pathname}),a=t.runId??null,o=t.evidenceId??null;return{runId:a,evidenceId:o,openRun:m=>e({to:n,from:ds.to,search:p=>({...p,runId:m,evidenceId:void 0})}),openEvidence:m=>e({to:n,from:ds.to,search:p=>({...p,evidenceId:m,runId:void 0})}),closeDrawer:()=>e({to:n,from:ds.to,search:m=>({...m,runId:void 0,evidenceId:void 0})})}}const O4={negative:"toast-card-negative",caution:"toast-card-caution",positive:"toast-card-positive",neutral:"toast-card-neutral"};function L4(e){if(e.cta)return`${e.cta.label}: ${e.title}`}function D4(){const e=w.useSyncExternalStore(eE,Xb,Xb),t=Bi(),{openRun:n}=Zr(),a=w.useCallback(c=>{Lm(c)},[]),o=w.useCallback(c=>{c.cta&&(c.cta.intent==="open-run-drawer"?n(c.cta.runId):t({to:"/runs"}),Lm(c.id))},[t,n]);return e.length===0?null:r.jsx("div",{className:"toast-viewport","aria-label":"Notifications",children:e.map(c=>r.jsxs("section",{role:c.tone==="negative"?"alert":"status","aria-live":c.tone==="negative"?"assertive":"polite","data-state":c.state,className:`toast-card ${O4[c.tone]}`,children:[r.jsxs("div",{className:"toast-copy",children:[r.jsx("p",{className:"toast-title",children:c.title}),c.detail?r.jsx("p",{className:"toast-detail",children:c.detail}):null,c.cta?r.jsx("button",{type:"button",className:"toast-action",onClick:()=>o(c),"aria-label":L4(c),children:c.cta.label}):null]}),r.jsx("button",{type:"button",onClick:()=>a(c.id),className:"toast-dismiss","aria-label":"Dismiss",children:r.jsx(Yu,{className:"size-3.5"})})]},c.id))})}const nS=[{label:"Architecture",href:"https://github.com/AINYC/canonry/blob/main/docs/architecture.md"},{label:"Testing Guide",href:"https://github.com/AINYC/canonry/blob/main/docs/testing.md"}],sS=e=>({label:e,state:"checking",detail:"Checking service health"}),M4={apiStatus:sS("API"),workerStatus:sS("Worker")};function $4(e){return e==="gsc-sync"?"GSC sync":e==="inspect-sitemap"?"Sitemap inspection":"Visibility sweep"}function P4(e){return e==="completed"?"positive":e==="partial"?"caution":"negative"}function U4(e){const t=$4(e.kind);return e.status==="completed"?`${t} completed`:e.status==="partial"?`${t} completed with partial results`:e.status==="cancelled"?`${t} cancelled`:`${t} failed`}function I4(e,t){return e.error?`${t}: ${e.error}`:e.location?`${t} · ${e.location}`:t}function B4(e,t,n){if(t)return t;const a=n.find(o=>o.id===e);return a?.displayName||a?.name||e}function q4(e,t){return[e.completed>0?`${e.completed} completed`:null,e.partial>0?`${e.partial} partial`:null,e.failed>0?`${e.failed} failed`:null,e.cancelled>0?`${e.cancelled} cancelled`:null,t>0?`${t} skipped at queue time`:null].filter(Boolean).join(", ")}function K4(e){return e.failed>0||e.cancelled>0?"negative":e.partial>0?"caution":"positive"}function H4(){const e=w.useSyncExternalStore(HE,za,za),t=Object.keys(e.runs).length>0||Object.keys(e.batches).length>0,n=xa({queryKey:Qn.runs.all,queryFn:sj,enabled:t}),a=xa({queryKey:Qn.projects.all,queryFn:tj,enabled:t}),o=w.useRef({}),c=w.useCallback(()=>{n.refetch()},[n.refetch]);return w.useEffect(()=>{t&&c()},[t,c]),w.useEffect(()=>{if(!t||typeof window>"u")return;const u=()=>{document.visibilityState==="visible"&&c()};return window.addEventListener("focus",c),document.addEventListener("visibilitychange",u),()=>{window.removeEventListener("focus",c),document.removeEventListener("visibilitychange",u)}},[t,c]),w.useEffect(()=>{const u=n.data??[],f=a.data??[],m=Object.fromEntries(u.map(v=>[v.id,v])),p=Object.fromEntries(u.map(v=>[v.id,v.status]));for(const v of Object.values(e.runs)){const y=m[v.runId];if(!y||!ZE(y.status)||(o.current[y.id]??v.lastAnnouncedStatus)===y.status)continue;if(v.sourceAction==="run-all"){ix(y.id);continue}const x=B4(y.projectId,v.projectLabel,f);Fe({title:U4(y),detail:I4(y,x),tone:P4(y.status),dedupeKey:`run:${y.id}`,dedupeMode:"replace",cta:{label:"View run",intent:"open-run-drawer",runId:y.id}}),ix(y.id)}for(const v of Object.values(e.batches)){const y=VE(v.runIds,m);y.finished&&(Fe({title:"Run-all batch finished",detail:q4(y,v.skippedCount),tone:K4(y),dedupeKey:`batch:${v.batchId}`,dedupeMode:"replace",cta:{label:"View runs",intent:"go-to-runs"}}),FE(v.batchId))}o.current=p},[a.data,n.data,e]),null}function G4(){const e=vl(),{dashboard:t,isLoading:n,refetch:a}=La(),u=ld(!e,e?.health).data??e?.health??M4,f=Q_(),{runId:m,evidenceId:p,closeDrawer:v}=Zr(),[y,b]=w.useState(!1),x=R4(m),N=x.data??null,S=x.isLoading;w.useEffect(()=>{N&&N.status!=="running"&&N.status!=="queued"&&a()},[N?.status,a]),w.useEffect(()=>{b(!1)},[f.pathname]),w.useEffect(()=>{if(typeof window>"u"||!m&&!p)return;const z=$=>{$.key==="Escape"&&v()};return window.addEventListener("keydown",z),()=>{window.removeEventListener("keydown",z)}},[m,p,v]);const C=t??e?.dashboard??null,k=m&&C?a4(C,m):void 0,T=p&&C?r4(C,p):void 0,A=(()=>{const z=f.pathname;if(z==="/")return"Portfolio";if(z==="/projects")return"Projects";if(z==="/runs")return"Runs";if(z==="/settings")return"Settings";if(z==="/setup")return"Setup";if(z.startsWith("/projects/")){const P=z.split("/").filter(Boolean)[1];if(P&&C){const E=C.projects.find(O=>O.project.id===P);if(E)return E.project.name}return"Project"}return"Not found"})();return r.jsxs("div",{className:"app-shell",children:[r.jsx("a",{className:"skip-link",href:"#content",children:"Skip to content"}),r.jsxs("aside",{className:"sidebar","aria-label":"Primary navigation",children:[r.jsx("div",{className:"sidebar-brand",children:r.jsx(mx,{})}),r.jsxs("nav",{className:"sidebar-nav",children:[r.jsxs(St,{to:"/",className:"sidebar-link",activeProps:{className:"sidebar-link sidebar-link-active"},activeOptions:{exact:!0},children:[r.jsx(pE,{className:"sidebar-icon"}),r.jsx("span",{children:"Overview"})]}),r.jsxs(St,{to:"/projects",className:"sidebar-link",activeProps:{className:"sidebar-link sidebar-link-active"},activeOptions:{exact:!1},children:[r.jsx(hE,{className:"sidebar-icon"}),r.jsx("span",{children:"Projects"})]}),r.jsxs(St,{to:"/runs",className:"sidebar-link",activeProps:{className:"sidebar-link sidebar-link-active"},activeOptions:{exact:!0},children:[r.jsx(bE,{className:"sidebar-icon"}),r.jsx("span",{children:"Runs"})]}),r.jsxs(St,{to:"/settings",className:"sidebar-link",activeProps:{className:"sidebar-link sidebar-link-active"},activeOptions:{exact:!0},children:[r.jsx(zE,{className:"sidebar-icon"}),r.jsx("span",{children:"Settings"})]}),n?r.jsxs(r.Fragment,{children:[r.jsx("p",{className:"sidebar-section-title",children:"Projects"}),[1,2,3].map(z=>r.jsxs("div",{className:"sidebar-skeleton-item",children:[r.jsx("span",{className:"skeleton-circle size-2"}),r.jsx("span",{className:"skeleton-text flex-1",style:{width:`${50+z*15}%`}})]},z))]}):C&&C.projects.length>0?r.jsxs(r.Fragment,{children:[r.jsx("p",{className:"sidebar-section-title",children:"Projects"}),C.projects.map(z=>{const $=z.visibilitySummary.tone;return r.jsxs(St,{to:"/projects/$projectId",params:{projectId:z.project.id},className:"sidebar-project",activeProps:{className:"sidebar-project sidebar-project-active"},children:[r.jsx("span",{className:`sidebar-dot sidebar-dot-${$}`}),r.jsx("span",{children:z.project.name})]},z.project.id)})]}):n?null:r.jsxs(r.Fragment,{children:[r.jsx("p",{className:"sidebar-section-title",children:"Resources"}),r.jsxs(St,{to:"/setup",className:"sidebar-link",activeProps:{className:"sidebar-link sidebar-link-active"},activeOptions:{exact:!0},children:[r.jsx(wE,{className:"sidebar-icon"}),r.jsx("span",{children:"Setup"})]})]})]}),r.jsx("div",{className:"sidebar-footer",children:nS.map(z=>r.jsx("a",{className:"sidebar-footer-link",href:z.href,target:"_blank",rel:"noreferrer",children:z.label},z.href))})]}),r.jsxs("div",{className:"main-area",children:[r.jsxs("header",{className:"topbar",children:[r.jsxs("div",{className:"topbar-left",children:[r.jsx("div",{className:"topbar-brand-mobile",children:r.jsx(mx,{compact:!0})}),r.jsxs("nav",{className:"breadcrumb","aria-label":"Breadcrumb",children:[r.jsx(St,{to:"/",children:"Home"}),r.jsx(Qu,{className:"breadcrumb-sep size-3"}),r.jsx("span",{className:"breadcrumb-current",children:A})]})]}),r.jsxs("div",{className:"topbar-actions",children:[r.jsxs("div",{className:"health-pill-row",children:[r.jsxs("span",{className:`health-pill health-pill-${u.apiStatus.state}`,children:["API ",u.apiStatus.state==="ok"?"ok":u.apiStatus.state]}),r.jsxs("span",{className:`health-pill health-pill-${u.workerStatus.state}`,children:["Worker ",u.workerStatus.state==="ok"?"ok":u.workerStatus.state]})]}),r.jsxs(oe,{className:"nav-toggle",variant:"secondary",size:"icon",type:"button","aria-expanded":y,"aria-controls":"mobile-nav",onClick:()=>b(z=>!z),children:[r.jsx(yE,{className:"size-4"}),r.jsx("span",{className:"sr-only",children:"Open navigation"})]})]})]}),r.jsxs("div",{id:"mobile-nav",className:`mobile-nav ${y?"mobile-nav-open":""}`,children:[r.jsxs(oe,{className:"mobile-nav-close",variant:"ghost",size:"icon",type:"button",onClick:()=>b(!1),children:[r.jsx(Yu,{className:"size-5"}),r.jsx("span",{className:"sr-only",children:"Close navigation"})]}),r.jsx(St,{to:"/",className:"mobile-nav-link",activeProps:{className:"mobile-nav-link mobile-nav-link-active"},activeOptions:{exact:!0},children:"Overview"}),r.jsx(St,{to:"/projects",className:"mobile-nav-link",activeProps:{className:"mobile-nav-link mobile-nav-link-active"},activeOptions:{exact:!1},children:"Projects"}),r.jsx(St,{to:"/runs",className:"mobile-nav-link",activeProps:{className:"mobile-nav-link mobile-nav-link-active"},activeOptions:{exact:!0},children:"Runs"}),r.jsx(St,{to:"/settings",className:"mobile-nav-link",activeProps:{className:"mobile-nav-link mobile-nav-link-active"},activeOptions:{exact:!0},children:"Settings"}),C&&C.projects.length>0?r.jsxs("div",{className:"mobile-nav-section",children:[r.jsx("p",{className:"mobile-nav-section-title",children:"Projects"}),C.projects.map(z=>r.jsx(St,{to:"/projects/$projectId",params:{projectId:z.project.id},className:"mobile-nav-link",children:z.project.name},z.project.id))]}):null]}),r.jsx("main",{id:"content",className:"page-shell",children:n&&!e?r.jsxs("div",{className:"page-skeleton",children:[r.jsxs("div",{className:"page-skeleton-header",children:[r.jsx("div",{className:"skeleton-text h-6 w-40"}),r.jsx("div",{className:"skeleton-text-sm w-72"})]}),r.jsx("div",{className:"page-skeleton-grid",children:[1,2,3].map(z=>r.jsxs("div",{className:"page-skeleton-card",children:[r.jsx("div",{className:"skeleton-text w-24"}),r.jsx("div",{className:"skeleton-text w-full"}),r.jsx("div",{className:"skeleton-text-sm w-3/4"})]},z))}),r.jsx("div",{className:"page-skeleton-grid",style:{gridTemplateColumns:"1fr 1fr"},children:[1,2].map(z=>r.jsxs("div",{className:"page-skeleton-card",children:[r.jsx("div",{className:"skeleton-text w-20"}),r.jsx("div",{className:"space-y-2",children:[1,2,3].map($=>r.jsx("div",{className:"skeleton-text-sm w-full"},$))})]},z))})]}):r.jsx(Np,{})}),r.jsxs("footer",{className:"footer",children:[r.jsxs("a",{href:"https://github.com/AINYC/canonry",target:"_blank",rel:"noreferrer",className:"footer-brand",children:[r.jsx(dE,{className:"size-3.5"}),r.jsx("span",{children:"Canonry"})]}),r.jsx("div",{className:"footer-links",children:nS.map(z=>r.jsx("a",{href:z.href,target:"_blank",rel:"noreferrer",children:z.label},z.href))})]})]}),k?r.jsxs(DR,{open:k!==void 0,title:k.summary,subtitle:`${k.projectName} · ${k.kindLabel}`,onClose:v,children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-x-5 gap-y-1 text-sm",children:[r.jsx(ed,{status:k.status}),r.jsx("span",{className:"text-zinc-400",children:k.startedAt}),r.jsx("span",{className:"text-zinc-500",children:k.duration}),r.jsx("span",{className:"text-zinc-600",children:k.triggerLabel})]}),k.status==="failed"&&k.statusDetail&&r.jsx("p",{className:"text-sm text-rose-300/80 mt-2",children:k.statusDetail}),r.jsxs("div",{className:"mt-4",children:[r.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-zinc-500 mb-2",children:"Activity Log"}),S?r.jsx("p",{className:"text-sm text-zinc-500",children:"Loading run details..."}):N&&N.snapshots.length>0?r.jsxs("div",{className:"space-y-2",children:[N.snapshots.map(z=>r.jsxs("div",{className:"rounded-lg border border-zinc-800/60 bg-zinc-900/30 p-3",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2 mb-1",children:[r.jsx("p",{className:"text-sm font-medium text-zinc-200 truncate",children:z.keyword??"Unknown key phrase"}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(ll,{provider:z.provider}),r.jsx(Mj,{variant:z.citationState==="cited"?"success":"neutral",children:z.citationState})]})]}),z.model&&r.jsx("p",{className:"text-[11px] text-zinc-500 font-mono",children:z.model}),z.citedDomains.length>0&&r.jsxs("p",{className:"text-xs text-zinc-500 mt-1",children:[r.jsx("span",{className:"text-zinc-400",children:"Sources:"})," ",z.citedDomains.join(", ")]}),z.competitorOverlap.length>0&&r.jsxs("p",{className:"text-xs text-rose-400/80 mt-0.5",children:["Competitor cited: ",z.competitorOverlap.join(", ")]}),z.groundingSources&&z.groundingSources.length>0&&r.jsxs("details",{className:"mt-2",children:[r.jsxs("summary",{className:"text-xs text-zinc-500 cursor-pointer hover:text-zinc-400",children:[z.groundingSources.length," grounding source",z.groundingSources.length!==1?"s":""]}),r.jsx("ul",{className:"mt-1 space-y-0.5",children:z.groundingSources.map(($,P)=>r.jsx("li",{className:"text-xs text-zinc-500 truncate",children:r.jsx("a",{href:$.uri,target:"_blank",rel:"noreferrer",className:"hover:text-zinc-300",children:$.title||$.uri})},P))})]}),z.answerText&&r.jsxs("details",{className:"mt-1",children:[r.jsx("summary",{className:"text-xs text-zinc-500 cursor-pointer hover:text-zinc-400",children:"Answer preview"}),r.jsx("p",{className:"mt-1 text-xs text-zinc-400 leading-relaxed whitespace-pre-wrap",children:z.answerText})]})]},z.id)),N.status==="running"&&r.jsxs("div",{className:"flex items-center gap-2 p-3 text-sm text-zinc-500",children:[r.jsx("span",{className:"inline-block h-2 w-2 rounded-full bg-amber-500 animate-pulse"}),"Querying remaining key phrases..."]})]}):N&&N.status==="running"?r.jsxs("div",{className:"flex items-center gap-2 p-3 text-sm text-zinc-500",children:[r.jsx("span",{className:"inline-block h-2 w-2 rounded-full bg-amber-500 animate-pulse"}),"Waiting for first key phrase result..."]}):N&&N.status==="queued"?r.jsxs("div",{className:"flex items-center gap-2 p-3 text-sm text-zinc-500",children:[r.jsx("span",{className:"inline-block h-2 w-2 rounded-full bg-zinc-500 animate-pulse"}),"Run queued, waiting for execution slot..."]}):N&&N.error?r.jsxs("div",{className:"rounded-lg border border-rose-800/40 bg-rose-950/20 p-3",children:[r.jsx("p",{className:"text-sm font-medium text-rose-300 mb-2",children:"Run failed"}),r.jsx("pre",{className:"text-xs text-rose-300/80 whitespace-pre-wrap break-words max-h-48 overflow-y-auto font-mono leading-5",children:$E(N.error)})]}):r.jsx("p",{className:"text-sm text-zinc-500",children:"No snapshot data available."})]})]}):null,T?r.jsx(XM,{evidence:T.evidence,project:T.project,onClose:v}):null,r.jsx(H4,{}),r.jsx(D4,{})]})}class F4 extends w.Component{state={error:null};static getDerivedStateFromError(t){return{error:t}}componentDidCatch(t,n){console.error("[ErrorBoundary]",t,n.componentStack)}handleReset=()=>{this.setState({error:null})};render(){return this.state.error?r.jsx("div",{className:"page-container",children:r.jsxs("div",{className:"flex flex-col items-center justify-center gap-4 py-20 text-center",children:[r.jsx("div",{className:"rounded-full bg-rose-950/40 p-3",children:r.jsx(TE,{className:"size-6 text-rose-400"})}),r.jsx("h2",{className:"text-lg font-semibold text-zinc-100",children:"Something went wrong"}),r.jsx("p",{className:"text-sm text-zinc-400 max-w-md",children:this.state.error.message||"An unexpected error occurred while rendering this page."}),r.jsxs("div",{className:"flex gap-3 mt-2",children:[r.jsxs(oe,{variant:"secondary",size:"sm",onClick:this.handleReset,children:[r.jsx(CE,{className:"size-3.5 mr-1.5"}),"Try again"]}),r.jsx(oe,{variant:"secondary",size:"sm",onClick:()=>{window.location.href="/"},children:"Go home"})]})]})}):this.props.children}}const Le=w.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,className:es("rounded-xl border border-zinc-800 bg-zinc-950/75 shadow-[0_0_0_1px_rgba(255,255,255,0.01)] backdrop-blur",e),...t}));Le.displayName="Card";const Zm=w.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,className:es("flex flex-col gap-1.5 p-5",e),...t}));Zm.displayName="CardHeader";const Vm=w.forwardRef(({className:e,...t},n)=>r.jsx("h3",{ref:n,className:es("font-medium tracking-tight text-zinc-50",e),...t}));Vm.displayName="CardTitle";const Qm=w.forwardRef(({className:e,...t},n)=>r.jsx("p",{ref:n,className:es("text-sm text-zinc-500",e),...t}));Qm.displayName="CardDescription";const gu=w.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,className:es("p-5 pt-0",e),...t}));gu.displayName="CardContent";function Z4({points:e,tone:t}){const n=w.useId();if(e.length===0)return null;const a=42,o=132,c=5,u=Math.min(...e),m=Math.max(...e)-u||1,p=o-c*2,v=a-c*2,y=e.map((b,x)=>{const N=c+x/Math.max(e.length-1,1)*p,S=c+(1-(b-u)/m)*v;return`${N},${S}`}).join(" ");return r.jsxs("svg",{className:`sparkline sparkline-${t}`,viewBox:`0 0 ${o} ${a}`,"aria-hidden":"true",children:[r.jsx("defs",{children:r.jsx("clipPath",{id:n,children:r.jsx("rect",{x:c,y:c,width:p,height:v,rx:"8"})})}),r.jsx("line",{className:"sparkline-guide",x1:c,x2:o-c,y1:a-c,y2:a-c}),r.jsx("polyline",{clipPath:`url(#${n})`,points:y,vectorEffect:"non-scaling-stroke"})]})}function V4(e){return e.displayName??e.name.charAt(0).toUpperCase()+e.name.slice(1)}function Q4(e,t,n){return e.map(a=>{if(a.id==="api")return{...a,tone:Ou(t.apiStatus),detail:t.apiStatus.state==="ok"?"Healthy":"Needs attention",meta:t.apiStatus.detail};if(a.id==="worker")return{...a,tone:Ou(t.workerStatus),detail:t.workerStatus.state==="ok"?"Healthy":"Needs attention",meta:t.workerStatus.detail};const o=n.providerStatuses.filter(m=>m.state==="ready").length,c=n.providerStatuses.length,u=o>0,f=n.providerStatuses.filter(m=>m.state==="ready").map(m=>V4(m)).join(" · ");return{...a,label:"Providers",tone:u?"positive":"caution",detail:`${o} of ${c} configured`,meta:f||"None configured"}})}function Y4(e,t){if(e.apiStatus.state!=="ok")return"Launch is blocked until the API responds cleanly.";if(e.apiStatus.databaseConfigured===!1)return"Launch is blocked until the API has a database connection configured.";if(e.workerStatus.state!=="ok")return"Launch is blocked until the worker is healthy and heartbeats are current.";if(!t.providerStatuses.some(n=>n.state==="ready"))return"Launch is blocked until at least one provider is configured."}function J4(e,t,n){const a=Y4(t,n),o=structuredClone(e);return o.healthChecks=o.healthChecks.map(c=>{if(c.id==="api")return{...c,detail:t.apiStatus.detail,state:t.apiStatus.state==="ok"?"ready":"attention"};if(c.id==="worker")return{...c,detail:t.workerStatus.detail,state:t.workerStatus.state==="ok"?"ready":"attention"};const u=n.providerStatuses.some(f=>f.state==="ready");return{...c,detail:u?"At least one provider configured.":"No providers configured.",state:u?"ready":"attention"}}),o.launchState.enabled=a===void 0,o.launchState.blockedReason=a,o.launchState.summary=a??"Queue a visibility sweep first, then follow with a site audit to explain movement.",o}function X4({project:e}){return r.jsxs(St,{to:"/projects/$projectId",params:{projectId:e.project.id},className:"project-row cursor-pointer",children:[r.jsxs("div",{className:"project-row-primary",children:[r.jsxs("div",{children:[r.jsx("p",{className:"project-name",children:e.project.name}),r.jsx("p",{className:"project-domain",children:e.project.canonicalDomain})]}),r.jsx("p",{className:"project-insight",children:e.insight})]}),r.jsx("div",{className:"project-row-stat",children:r.jsxs("div",{className:"metric-inline-block",children:[r.jsx("p",{className:"metric-inline-label",children:"Answer Visibility"}),r.jsx("p",{className:"metric-inline-value",children:e.visibilityScore}),r.jsx("p",{className:"metric-inline-delta",children:e.visibilityDelta})]})}),r.jsx("div",{className:"project-row-stat",children:r.jsxs("div",{className:"metric-inline-block",children:[r.jsx("p",{className:"metric-inline-label",children:"Competitor Pressure"}),r.jsx("p",{className:"metric-inline-value",children:e.competitorPressureLabel}),r.jsxs("p",{className:"metric-inline-delta",children:[e.lastRun.kindLabel," · ",Ju(e.lastRun.status)]})]})}),r.jsx("div",{className:"project-row-chart",children:r.jsx(Z4,{points:e.trend,tone:$j(e.lastRun.status)})}),r.jsx("span",{className:"project-row-link",children:r.jsx(Qu,{className:"h-4 w-4 text-zinc-500"})})]})}function W4(){const e=vl(),{dashboard:t,isLoading:n}=La(),a=t??e?.dashboard;if(!a||n)return r.jsxs("div",{className:"page-skeleton",children:[r.jsxs("div",{className:"page-skeleton-header",children:[r.jsx("div",{className:"skeleton-text h-6 w-32"}),r.jsx("div",{className:"skeleton-text-sm w-64"})]}),r.jsx("div",{className:"space-y-3",children:[1,2,3].map(v=>r.jsxs("div",{className:"rounded-xl border border-zinc-800/60 bg-zinc-900/30 p-4 flex items-center gap-4",children:[r.jsxs("div",{className:"flex-1 space-y-2",children:[r.jsx("div",{className:"skeleton-text w-36"}),r.jsx("div",{className:"skeleton-text-sm w-48"})]}),r.jsx("div",{className:"skeleton-text w-16"}),r.jsx("div",{className:"skeleton-text w-16"}),r.jsx("div",{className:"skeleton h-8 w-20 rounded"})]},v))})]});const o=a.portfolioOverview,f=ld(!e,e?.health).data??e?.health??{apiStatus:{label:"API",state:"checking",detail:"Checking service health"},workerStatus:{label:"Worker",state:"checking",detail:"Checking service health"}},m=Q4(o.systemHealth,f,a.settings),{openRun:p}=Zr();return r.jsxs("div",{className:"page-container",children:[r.jsxs("div",{className:"page-header",children:[r.jsxs("div",{className:"page-header-left",children:[r.jsx("h1",{className:"page-title",children:"Portfolio"}),r.jsx("p",{className:"page-subtitle",children:"Visibility and execution state across all projects"})]}),r.jsx("div",{className:"page-header-right",children:r.jsx("p",{className:"text-[11px] text-zinc-600",children:o.lastUpdatedAt})})]}),o.projects.length>0?r.jsx("div",{className:"project-list project-list-scrollable",children:o.projects.map(v=>r.jsx(X4,{project:v},v.project.id))}):r.jsxs(Le,{className:"surface-card empty-card",children:[r.jsx("h3",{children:o.emptyState?.title??"No projects yet"}),r.jsx("p",{className:"supporting-copy",children:o.emptyState?.detail}),r.jsx(oe,{size:"sm",asChild:!0,children:r.jsx(St,{to:o.emptyState?.ctaHref==="/setup"||!o.emptyState?.ctaHref?"/setup":"/",children:o.emptyState?.ctaLabel??"Launch setup"})})]}),r.jsxs("div",{className:"overview-secondary-grid",children:[o.attentionItems.length>0&&r.jsxs("section",{className:"overview-secondary-section",children:[r.jsx("div",{className:"section-head section-head-inline",children:r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Needs attention"}),r.jsx("h2",{className:"section-title-sm",children:"What changed"})]})}),r.jsx("div",{className:"attention-list attention-list-scrollable",children:o.attentionItems.map(v=>r.jsxs(St,{to:v.href,className:`attention-item attention-item-${v.tone}`,children:[r.jsxs("div",{children:[r.jsx("p",{className:"attention-title",children:v.title}),r.jsx("p",{className:"attention-detail",children:v.detail})]}),r.jsx("span",{className:"attention-action",children:v.actionLabel})]},v.id))})]}),r.jsxs("section",{className:"overview-secondary-section",children:[r.jsx("div",{className:"section-head section-head-inline",children:r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Recent runs"}),r.jsx("h2",{className:"section-title-sm",children:"Activity"})]})}),r.jsx("div",{className:"compact-stack compact-stack-scrollable",children:o.recentRuns.length>0?o.recentRuns.map(v=>r.jsxs("button",{className:"compact-run",type:"button",onClick:()=>p(v.id),children:[r.jsxs("div",{children:[r.jsx("p",{className:"compact-run-title",children:v.projectName}),r.jsx("p",{className:"compact-run-detail",children:v.summary})]}),r.jsx(ed,{status:v.status})]},v.id)):r.jsx("p",{className:"supporting-copy",children:"Run history appears here after the first launch."})})]})]}),r.jsxs("section",{className:"page-section",children:[r.jsx("div",{className:"section-head section-head-inline",children:r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"System health"}),r.jsx("h2",{className:"section-title-sm",children:"Infrastructure"})]})}),r.jsx("div",{className:"health-grid",children:m.map(v=>r.jsxs(Le,{className:"surface-card compact-card",children:[r.jsxs("div",{className:"section-head",children:[r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:v.label}),r.jsx("h3",{children:v.detail})]}),r.jsx(lt,{tone:v.tone,children:v.label})]}),r.jsx("p",{className:"supporting-copy",children:v.meta})]},v.id))})]})]})}const Zp=Symbol.for("yaml.alias"),Ym=Symbol.for("yaml.document"),Di=Symbol.for("yaml.map"),uN=Symbol.for("yaml.pair"),Ns=Symbol.for("yaml.scalar"),Vr=Symbol.for("yaml.seq"),Jn=Symbol.for("yaml.node.type"),Da=e=>!!e&&typeof e=="object"&&e[Jn]===Zp,cd=e=>!!e&&typeof e=="object"&&e[Jn]===Ym,bl=e=>!!e&&typeof e=="object"&&e[Jn]===Di,Pt=e=>!!e&&typeof e=="object"&&e[Jn]===uN,gt=e=>!!e&&typeof e=="object"&&e[Jn]===Ns,xl=e=>!!e&&typeof e=="object"&&e[Jn]===Vr;function Mt(e){if(e&&typeof e=="object")switch(e[Jn]){case Di:case Vr:return!0}return!1}function $t(e){if(e&&typeof e=="object")switch(e[Jn]){case Zp:case Di:case Ns:case Vr:return!0}return!1}const dN=e=>(gt(e)||Mt(e))&&!!e.anchor,ha=Symbol("break visit"),e3=Symbol("skip children"),tl=Symbol("remove node");function Qr(e,t){const n=t3(t);cd(e)?Tr(null,e.contents,n,Object.freeze([e]))===tl&&(e.contents=null):Tr(null,e,n,Object.freeze([]))}Qr.BREAK=ha;Qr.SKIP=e3;Qr.REMOVE=tl;function Tr(e,t,n,a){const o=n3(e,t,n,a);if($t(o)||Pt(o))return s3(e,a,o),Tr(e,o,n,a);if(typeof o!="symbol"){if(Mt(t)){a=Object.freeze(a.concat(t));for(let c=0;c<t.items.length;++c){const u=Tr(c,t.items[c],n,a);if(typeof u=="number")c=u-1;else{if(u===ha)return ha;u===tl&&(t.items.splice(c,1),c-=1)}}}else if(Pt(t)){a=Object.freeze(a.concat(t));const c=Tr("key",t.key,n,a);if(c===ha)return ha;c===tl&&(t.key=null);const u=Tr("value",t.value,n,a);if(u===ha)return ha;u===tl&&(t.value=null)}}return o}function t3(e){return typeof e=="object"&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function n3(e,t,n,a){if(typeof n=="function")return n(e,t,a);if(bl(t))return n.Map?.(e,t,a);if(xl(t))return n.Seq?.(e,t,a);if(Pt(t))return n.Pair?.(e,t,a);if(gt(t))return n.Scalar?.(e,t,a);if(Da(t))return n.Alias?.(e,t,a)}function s3(e,t,n){const a=t[t.length-1];if(Mt(a))a.items[e]=n;else if(Pt(a))e==="key"?a.key=n:a.value=n;else if(cd(a))a.contents=n;else{const o=Da(a)?"alias":"scalar";throw new Error(`Cannot replace node with ${o} parent`)}}const i3={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},a3=e=>e.replace(/[!,[\]{}]/g,t=>i3[t]);class fn{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},fn.defaultYaml,t),this.tags=Object.assign({},fn.defaultTags,n)}clone(){const t=new fn(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){const t=new fn(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:fn.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},fn.defaultTags);break}return t}add(t,n){this.atNextDocument&&(this.yaml={explicit:fn.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},fn.defaultTags),this.atNextDocument=!1);const a=t.trim().split(/[ \t]+/),o=a.shift();switch(o){case"%TAG":{if(a.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),a.length<2))return!1;const[c,u]=a;return this.tags[c]=u,!0}case"%YAML":{if(this.yaml.explicit=!0,a.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;const[c]=a;if(c==="1.1"||c==="1.2")return this.yaml.version=c,!0;{const u=/^\d+\.\d+$/.test(c);return n(6,`Unsupported YAML version ${c}`,u),!1}}default:return n(0,`Unknown directive ${o}`,!0),!1}}tagName(t,n){if(t==="!")return"!";if(t[0]!=="!")return n(`Not a valid tag: ${t}`),null;if(t[1]==="<"){const u=t.slice(2,-1);return u==="!"||u==="!!"?(n(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&n("Verbatim tags must end with a >"),u)}const[,a,o]=t.match(/^(.*!)([^!]*)$/s);o||n(`The ${t} tag has no suffix`);const c=this.tags[a];if(c)try{return c+decodeURIComponent(o)}catch(u){return n(String(u)),null}return a==="!"?t:(n(`Could not resolve tag: ${t}`),null)}tagString(t){for(const[n,a]of Object.entries(this.tags))if(t.startsWith(a))return n+a3(t.substring(a.length));return t[0]==="!"?t:`!<${t}>`}toString(t){const n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],a=Object.entries(this.tags);let o;if(t&&a.length>0&&$t(t.contents)){const c={};Qr(t.contents,(u,f)=>{$t(f)&&f.tag&&(c[f.tag]=!0)}),o=Object.keys(c)}else o=[];for(const[c,u]of a)c==="!!"&&u==="tag:yaml.org,2002:"||(!t||o.some(f=>f.startsWith(u)))&&n.push(`%TAG ${c} ${u}`);return n.join(`
96
- `)}}fn.defaultYaml={explicit:!1,version:"1.2"};fn.defaultTags={"!!":"tag:yaml.org,2002:"};function fN(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){const n=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw new Error(n)}return!0}function hN(e){const t=new Set;return Qr(e,{Value(n,a){a.anchor&&t.add(a.anchor)}}),t}function mN(e,t){for(let n=1;;++n){const a=`${e}${n}`;if(!t.has(a))return a}}function r3(e,t){const n=[],a=new Map;let o=null;return{onAnchor:c=>{n.push(c),o??(o=hN(e));const u=mN(t,o);return o.add(u),u},setAnchors:()=>{for(const c of n){const u=a.get(c);if(typeof u=="object"&&u.anchor&&(gt(u.node)||Mt(u.node)))u.node.anchor=u.anchor;else{const f=new Error("Failed to resolve repeated object (this should not happen)");throw f.source=c,f}}},sourceObjects:a}}function Rr(e,t,n,a){if(a&&typeof a=="object")if(Array.isArray(a))for(let o=0,c=a.length;o<c;++o){const u=a[o],f=Rr(e,a,String(o),u);f===void 0?delete a[o]:f!==u&&(a[o]=f)}else if(a instanceof Map)for(const o of Array.from(a.keys())){const c=a.get(o),u=Rr(e,a,o,c);u===void 0?a.delete(o):u!==c&&a.set(o,u)}else if(a instanceof Set)for(const o of Array.from(a)){const c=Rr(e,a,o,o);c===void 0?a.delete(o):c!==o&&(a.delete(o),a.add(c))}else for(const[o,c]of Object.entries(a)){const u=Rr(e,a,o,c);u===void 0?delete a[o]:u!==c&&(a[o]=u)}return e.call(t,n,a)}function Yn(e,t,n){if(Array.isArray(e))return e.map((a,o)=>Yn(a,String(o),n));if(e&&typeof e.toJSON=="function"){if(!n||!dN(e))return e.toJSON(t,n);const a={aliasCount:0,count:1,res:void 0};n.anchors.set(e,a),n.onCreate=c=>{a.res=c,delete n.onCreate};const o=e.toJSON(t,n);return n.onCreate&&n.onCreate(o),o}return typeof e=="bigint"&&!n?.keep?Number(e):e}class Vp{constructor(t){Object.defineProperty(this,Jn,{value:t})}clone(){const t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(t.range=this.range.slice()),t}toJS(t,{mapAsMap:n,maxAliasCount:a,onAnchor:o,reviver:c}={}){if(!cd(t))throw new TypeError("A document argument is required");const u={anchors:new Map,doc:t,keep:!0,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof a=="number"?a:100},f=Yn(this,"",u);if(typeof o=="function")for(const{count:m,res:p}of u.anchors.values())o(p,m);return typeof c=="function"?Rr(c,{"":f},"",f):f}}class Qp extends Vp{constructor(t){super(Zp),this.source=t,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(t,n){let a;n?.aliasResolveCache?a=n.aliasResolveCache:(a=[],Qr(t,{Node:(c,u)=>{(Da(u)||dN(u))&&a.push(u)}}),n&&(n.aliasResolveCache=a));let o;for(const c of a){if(c===this)break;c.anchor===this.source&&(o=c)}return o}toJSON(t,n){if(!n)return{source:this.source};const{anchors:a,doc:o,maxAliasCount:c}=n,u=this.resolve(o,n);if(!u){const m=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(m)}let f=a.get(u);if(f||(Yn(u,null,n),f=a.get(u)),f?.res===void 0){const m="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(m)}if(c>=0&&(f.count+=1,f.aliasCount===0&&(f.aliasCount=yu(o,u,a)),f.count*f.aliasCount>c)){const m="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(m)}return f.res}toString(t,n,a){const o=`*${this.source}`;if(t){if(fN(this.source),t.options.verifyAliasOrder&&!t.anchors.has(this.source)){const c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(c)}if(t.implicitKey)return`${o} `}return o}}function yu(e,t,n){if(Da(t)){const a=t.resolve(e),o=n&&a&&n.get(a);return o?o.count*o.aliasCount:0}else if(Mt(t)){let a=0;for(const o of t.items){const c=yu(e,o,n);c>a&&(a=c)}return a}else if(Pt(t)){const a=yu(e,t.key,n),o=yu(e,t.value,n);return Math.max(a,o)}return 1}const pN=e=>!e||typeof e!="function"&&typeof e!="object";class Re extends Vp{constructor(t){super(Ns),this.value=t}toJSON(t,n){return n?.keep?this.value:Yn(this.value,t,n)}toString(){return String(this.value)}}Re.BLOCK_FOLDED="BLOCK_FOLDED";Re.BLOCK_LITERAL="BLOCK_LITERAL";Re.PLAIN="PLAIN";Re.QUOTE_DOUBLE="QUOTE_DOUBLE";Re.QUOTE_SINGLE="QUOTE_SINGLE";const o3="tag:yaml.org,2002:";function l3(e,t,n){if(t){const a=n.filter(c=>c.tag===t),o=a.find(c=>!c.format)??a[0];if(!o)throw new Error(`Tag ${t} not found`);return o}return n.find(a=>a.identify?.(e)&&!a.format)}function hl(e,t,n){if(cd(e)&&(e=e.contents),$t(e))return e;if(Pt(e)){const y=n.schema[Di].createNode?.(n.schema,null,n);return y.items.push(e),y}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<"u"&&e instanceof BigInt)&&(e=e.valueOf());const{aliasDuplicateObjects:a,onAnchor:o,onTagObj:c,schema:u,sourceObjects:f}=n;let m;if(a&&e&&typeof e=="object"){if(m=f.get(e),m)return m.anchor??(m.anchor=o(e)),new Qp(m.anchor);m={anchor:null,node:null},f.set(e,m)}t?.startsWith("!!")&&(t=o3+t.slice(2));let p=l3(e,t,u.tags);if(!p){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){const y=new Re(e);return m&&(m.node=y),y}p=e instanceof Map?u[Di]:Symbol.iterator in Object(e)?u[Vr]:u[Di]}c&&(c(p),delete n.onTagObj);const v=p?.createNode?p.createNode(n.schema,e,n):typeof p?.nodeClass?.from=="function"?p.nodeClass.from(n.schema,e,n):new Re(e);return t?v.tag=t:p.default||(v.tag=p.tag),m&&(m.node=v),v}function Iu(e,t,n){let a=n;for(let o=t.length-1;o>=0;--o){const c=t[o];if(typeof c=="number"&&Number.isInteger(c)&&c>=0){const u=[];u[c]=a,a=u}else a=new Map([[c,a]])}return hl(a,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}const Xo=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done;class gN extends Vp{constructor(t,n){super(t),Object.defineProperty(this,"schema",{value:n,configurable:!0,enumerable:!1,writable:!0})}clone(t){const n=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return t&&(n.schema=t),n.items=n.items.map(a=>$t(a)||Pt(a)?a.clone(t):a),this.range&&(n.range=this.range.slice()),n}addIn(t,n){if(Xo(t))this.add(n);else{const[a,...o]=t,c=this.get(a,!0);if(Mt(c))c.addIn(o,n);else if(c===void 0&&this.schema)this.set(a,Iu(this.schema,o,n));else throw new Error(`Expected YAML collection at ${a}. Remaining path: ${o}`)}}deleteIn(t){const[n,...a]=t;if(a.length===0)return this.delete(n);const o=this.get(n,!0);if(Mt(o))return o.deleteIn(a);throw new Error(`Expected YAML collection at ${n}. Remaining path: ${a}`)}getIn(t,n){const[a,...o]=t,c=this.get(a,!0);return o.length===0?!n&&gt(c)?c.value:c:Mt(c)?c.getIn(o,n):void 0}hasAllNullValues(t){return this.items.every(n=>{if(!Pt(n))return!1;const a=n.value;return a==null||t&&gt(a)&&a.value==null&&!a.commentBefore&&!a.comment&&!a.tag})}hasIn(t){const[n,...a]=t;if(a.length===0)return this.has(n);const o=this.get(n,!0);return Mt(o)?o.hasIn(a):!1}setIn(t,n){const[a,...o]=t;if(o.length===0)this.set(a,n);else{const c=this.get(a,!0);if(Mt(c))c.setIn(o,n);else if(c===void 0&&this.schema)this.set(a,Iu(this.schema,o,n));else throw new Error(`Expected YAML collection at ${a}. Remaining path: ${o}`)}}}const c3=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function Zs(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}const va=(e,t,n)=>e.endsWith(`
97
- `)?Zs(n,t):n.includes(`
98
- `)?`
99
- `+Zs(n,t):(e.endsWith(" ")?"":" ")+n,yN="flow",Jm="block",vu="quoted";function ud(e,t,n="flow",{indentAtStart:a,lineWidth:o=80,minContentWidth:c=20,onFold:u,onOverflow:f}={}){if(!o||o<0)return e;o<c&&(c=0);const m=Math.max(1+c,1+o-t.length);if(e.length<=m)return e;const p=[],v={};let y=o-t.length;typeof a=="number"&&(a>o-Math.max(2,c)?p.push(0):y=o-a);let b,x,N=!1,S=-1,C=-1,k=-1;n===Jm&&(S=iS(e,S,t.length),S!==-1&&(y=S+m));for(let A;A=e[S+=1];){if(n===vu&&A==="\\"){switch(C=S,e[S+1]){case"x":S+=3;break;case"u":S+=5;break;case"U":S+=9;break;default:S+=1}k=S}if(A===`
100
- `)n===Jm&&(S=iS(e,S,t.length)),y=S+t.length+m,b=void 0;else{if(A===" "&&x&&x!==" "&&x!==`
101
- `&&x!==" "){const z=e[S+1];z&&z!==" "&&z!==`
102
- `&&z!==" "&&(b=S)}if(S>=y)if(b)p.push(b),y=b+m,b=void 0;else if(n===vu){for(;x===" "||x===" ";)x=A,A=e[S+=1],N=!0;const z=S>k+1?S-2:C-1;if(v[z])return e;p.push(z),v[z]=!0,y=z+m,b=void 0}else N=!0}x=A}if(N&&f&&f(),p.length===0)return e;u&&u();let T=e.slice(0,p[0]);for(let A=0;A<p.length;++A){const z=p[A],$=p[A+1]||e.length;z===0?T=`
103
- ${t}${e.slice(0,$)}`:(n===vu&&v[z]&&(T+=`${e[z]}\\`),T+=`
104
- ${t}${e.slice(z+1,$)}`)}return T}function iS(e,t,n){let a=t,o=t+1,c=e[o];for(;c===" "||c===" ";)if(t<o+n)c=e[++t];else{do c=e[++t];while(c&&c!==`
105
- `);a=t,o=t+1,c=e[o]}return a}const dd=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),fd=e=>/^(%|---|\.\.\.)/m.test(e);function u3(e,t,n){if(!t||t<0)return!1;const a=t-n,o=e.length;if(o<=a)return!1;for(let c=0,u=0;c<o;++c)if(e[c]===`
106
- `){if(c-u>a)return!0;if(u=c+1,o-u<=a)return!1}return!0}function nl(e,t){const n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;const{implicitKey:a}=t,o=t.options.doubleQuotedMinMultiLineLength,c=t.indent||(fd(e)?" ":"");let u="",f=0;for(let m=0,p=n[m];p;p=n[++m])if(p===" "&&n[m+1]==="\\"&&n[m+2]==="n"&&(u+=n.slice(f,m)+"\\ ",m+=1,f=m,p="\\"),p==="\\")switch(n[m+1]){case"u":{u+=n.slice(f,m);const v=n.substr(m+2,4);switch(v){case"0000":u+="\\0";break;case"0007":u+="\\a";break;case"000b":u+="\\v";break;case"001b":u+="\\e";break;case"0085":u+="\\N";break;case"00a0":u+="\\_";break;case"2028":u+="\\L";break;case"2029":u+="\\P";break;default:v.substr(0,2)==="00"?u+="\\x"+v.substr(2):u+=n.substr(m,6)}m+=5,f=m+1}break;case"n":if(a||n[m+2]==='"'||n.length<o)m+=1;else{for(u+=n.slice(f,m)+`
107
-
108
- `;n[m+2]==="\\"&&n[m+3]==="n"&&n[m+4]!=='"';)u+=`
109
- `,m+=2;u+=c,n[m+2]===" "&&(u+="\\"),m+=1,f=m+1}break;default:m+=1}return u=f?u+n.slice(f):n,a?u:ud(u,c,vu,dd(t,!1))}function Xm(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
110
- `)||/[ \t]\n|\n[ \t]/.test(e))return nl(e,t);const n=t.indent||(fd(e)?" ":""),a="'"+e.replace(/'/g,"''").replace(/\n+/g,`$&
111
- ${n}`)+"'";return t.implicitKey?a:ud(a,n,yN,dd(t,!1))}function Or(e,t){const{singleQuote:n}=t.options;let a;if(n===!1)a=nl;else{const o=e.includes('"'),c=e.includes("'");o&&!c?a=Xm:c&&!o?a=nl:a=n?Xm:nl}return a(e,t)}let Wm;try{Wm=new RegExp(`(^|(?<!
112
- ))
113
- +(?!
114
- |$)`,"g")}catch{Wm=/\n+(?!\n|$)/g}function bu({comment:e,type:t,value:n},a,o,c){const{blockQuote:u,commentString:f,lineWidth:m}=a.options;if(!u||/\n[\t ]+$/.test(n))return Or(n,a);const p=a.indent||(a.forceBlockIndent||fd(n)?" ":""),v=u==="literal"?!0:u==="folded"||t===Re.BLOCK_FOLDED?!1:t===Re.BLOCK_LITERAL?!0:!u3(n,m,p.length);if(!n)return v?`|
115
- `:`>
116
- `;let y,b;for(b=n.length;b>0;--b){const $=n[b-1];if($!==`
117
- `&&$!==" "&&$!==" ")break}let x=n.substring(b);const N=x.indexOf(`
118
- `);N===-1?y="-":n===x||N!==x.length-1?(y="+",c&&c()):y="",x&&(n=n.slice(0,-x.length),x[x.length-1]===`
119
- `&&(x=x.slice(0,-1)),x=x.replace(Wm,`$&${p}`));let S=!1,C,k=-1;for(C=0;C<n.length;++C){const $=n[C];if($===" ")S=!0;else if($===`
120
- `)k=C;else break}let T=n.substring(0,k<C?k+1:C);T&&(n=n.substring(T.length),T=T.replace(/\n+/g,`$&${p}`));let z=(S?p?"2":"1":"")+y;if(e&&(z+=" "+f(e.replace(/ ?[\r\n]+/g," ")),o&&o()),!v){const $=n.replace(/\n+/g,`
121
- $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${p}`);let P=!1;const E=dd(a,!0);u!=="folded"&&t!==Re.BLOCK_FOLDED&&(E.onOverflow=()=>{P=!0});const O=ud(`${T}${$}${x}`,p,Jm,E);if(!P)return`>${z}
122
- ${p}${O}`}return n=n.replace(/\n+/g,`$&${p}`),`|${z}
123
- ${p}${T}${n}${x}`}function d3(e,t,n,a){const{type:o,value:c}=e,{actualString:u,implicitKey:f,indent:m,indentStep:p,inFlow:v}=t;if(f&&c.includes(`
124
- `)||v&&/[[\]{},]/.test(c))return Or(c,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(c))return f||v||!c.includes(`
125
- `)?Or(c,t):bu(e,t,n,a);if(!f&&!v&&o!==Re.PLAIN&&c.includes(`
126
- `))return bu(e,t,n,a);if(fd(c)){if(m==="")return t.forceBlockIndent=!0,bu(e,t,n,a);if(f&&m===p)return Or(c,t)}const y=c.replace(/\n+/g,`$&
127
- ${m}`);if(u){const b=S=>S.default&&S.tag!=="tag:yaml.org,2002:str"&&S.test?.test(y),{compat:x,tags:N}=t.doc.schema;if(N.some(b)||x?.some(b))return Or(c,t)}return f?y:ud(y,m,yN,dd(t,!1))}function Yp(e,t,n,a){const{implicitKey:o,inFlow:c}=t,u=typeof e.value=="string"?e:Object.assign({},e,{value:String(e.value)});let{type:f}=e;f!==Re.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(u.value)&&(f=Re.QUOTE_DOUBLE);const m=v=>{switch(v){case Re.BLOCK_FOLDED:case Re.BLOCK_LITERAL:return o||c?Or(u.value,t):bu(u,t,n,a);case Re.QUOTE_DOUBLE:return nl(u.value,t);case Re.QUOTE_SINGLE:return Xm(u.value,t);case Re.PLAIN:return d3(u,t,n,a);default:return null}};let p=m(f);if(p===null){const{defaultKeyType:v,defaultStringType:y}=t.options,b=o&&v||y;if(p=m(b),p===null)throw new Error(`Unsupported default string type ${b}`)}return p}function vN(e,t){const n=Object.assign({blockQuote:!0,commentString:c3,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trueStr:"true",verifyAliasOrder:!0},e.schema.toStringOptions,t);let a;switch(n.collectionStyle){case"block":a=!1;break;case"flow":a=!0;break;default:a=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:typeof n.indent=="number"?" ".repeat(n.indent):" ",inFlow:a,options:n}}function f3(e,t){if(t.tag){const o=e.filter(c=>c.tag===t.tag);if(o.length>0)return o.find(c=>c.format===t.format)??o[0]}let n,a;if(gt(t)){a=t.value;let o=e.filter(c=>c.identify?.(a));if(o.length>1){const c=o.filter(u=>u.test);c.length>0&&(o=c)}n=o.find(c=>c.format===t.format)??o.find(c=>!c.format)}else a=t,n=e.find(o=>o.nodeClass&&a instanceof o.nodeClass);if(!n){const o=a?.constructor?.name??(a===null?"null":typeof a);throw new Error(`Tag not resolved for ${o} value`)}return n}function h3(e,t,{anchors:n,doc:a}){if(!a.directives)return"";const o=[],c=(gt(e)||Mt(e))&&e.anchor;c&&fN(c)&&(n.add(c),o.push(`&${c}`));const u=e.tag??(t.default?null:t.tag);return u&&o.push(a.directives.tagString(u)),o.join(" ")}function qr(e,t,n,a){if(Pt(e))return e.toString(t,n,a);if(Da(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw new TypeError("Cannot stringify circular structure without alias nodes");t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let o;const c=$t(e)?e:t.doc.createNode(e,{onTagObj:m=>o=m});o??(o=f3(t.doc.schema.tags,c));const u=h3(c,o,t);u.length>0&&(t.indentAtStart=(t.indentAtStart??0)+u.length+1);const f=typeof o.stringify=="function"?o.stringify(c,t,n,a):gt(c)?Yp(c,t,n,a):c.toString(t,n,a);return u?gt(c)||f[0]==="{"||f[0]==="["?`${u} ${f}`:`${u}
128
- ${t.indent}${f}`:f}function m3({key:e,value:t},n,a,o){const{allNullValues:c,doc:u,indent:f,indentStep:m,options:{commentString:p,indentSeq:v,simpleKeys:y}}=n;let b=$t(e)&&e.comment||null;if(y){if(b)throw new Error("With simple keys, key nodes cannot have comments");if(Mt(e)||!$t(e)&&typeof e=="object"){const E="With simple keys, collection cannot be used as a key value";throw new Error(E)}}let x=!y&&(!e||b&&t==null&&!n.inFlow||Mt(e)||(gt(e)?e.type===Re.BLOCK_FOLDED||e.type===Re.BLOCK_LITERAL:typeof e=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!x&&(y||!c),indent:f+m});let N=!1,S=!1,C=qr(e,n,()=>N=!0,()=>S=!0);if(!x&&!n.inFlow&&C.length>1024){if(y)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");x=!0}if(n.inFlow){if(c||t==null)return N&&a&&a(),C===""?"?":x?`? ${C}`:C}else if(c&&!y||t==null&&x)return C=`? ${C}`,b&&!N?C+=va(C,n.indent,p(b)):S&&o&&o(),C;N&&(b=null),x?(b&&(C+=va(C,n.indent,p(b))),C=`? ${C}
129
- ${f}:`):(C=`${C}:`,b&&(C+=va(C,n.indent,p(b))));let k,T,A;$t(t)?(k=!!t.spaceBefore,T=t.commentBefore,A=t.comment):(k=!1,T=null,A=null,t&&typeof t=="object"&&(t=u.createNode(t))),n.implicitKey=!1,!x&&!b&&gt(t)&&(n.indentAtStart=C.length+1),S=!1,!v&&m.length>=2&&!n.inFlow&&!x&&xl(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let z=!1;const $=qr(t,n,()=>z=!0,()=>S=!0);let P=" ";if(b||k||T){if(P=k?`
130
- `:"",T){const E=p(T);P+=`
131
- ${Zs(E,n.indent)}`}$===""&&!n.inFlow?P===`
132
- `&&A&&(P=`
133
-
134
- `):P+=`
135
- ${n.indent}`}else if(!x&&Mt(t)){const E=$[0],O=$.indexOf(`
136
- `),K=O!==-1,ee=n.inFlow??t.flow??t.items.length===0;if(K||!ee){let X=!1;if(K&&(E==="&"||E==="!")){let se=$.indexOf(" ");E==="&"&&se!==-1&&se<O&&$[se+1]==="!"&&(se=$.indexOf(" ",se+1)),(se===-1||O<se)&&(X=!0)}X||(P=`
137
- ${n.indent}`)}}else($===""||$[0]===`
138
- `)&&(P="");return C+=P+$,n.inFlow?z&&a&&a():A&&!z?C+=va(C,n.indent,p(A)):S&&o&&o(),C}function p3(e,t){(e==="debug"||e==="warn")&&console.warn(t)}const nu="<<",Vs={identify:e=>e===nu||typeof e=="symbol"&&e.description===nu,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new Re(Symbol(nu)),{addToJSMap:bN}),stringify:()=>nu},g3=(e,t)=>(Vs.identify(t)||gt(t)&&(!t.type||t.type===Re.PLAIN)&&Vs.identify(t.value))&&e?.doc.schema.tags.some(n=>n.tag===Vs.tag&&n.default);function bN(e,t,n){if(n=e&&Da(n)?n.resolve(e.doc):n,xl(n))for(const a of n.items)um(e,t,a);else if(Array.isArray(n))for(const a of n)um(e,t,a);else um(e,t,n)}function um(e,t,n){const a=e&&Da(n)?n.resolve(e.doc):n;if(!bl(a))throw new Error("Merge sources must be maps or map aliases");const o=a.toJSON(null,e,Map);for(const[c,u]of o)t instanceof Map?t.has(c)||t.set(c,u):t instanceof Set?t.add(c):Object.prototype.hasOwnProperty.call(t,c)||Object.defineProperty(t,c,{value:u,writable:!0,enumerable:!0,configurable:!0});return t}function xN(e,t,{key:n,value:a}){if($t(n)&&n.addToJSMap)n.addToJSMap(e,t,a);else if(g3(e,n))bN(e,t,a);else{const o=Yn(n,"",e);if(t instanceof Map)t.set(o,Yn(a,o,e));else if(t instanceof Set)t.add(o);else{const c=y3(n,o,e),u=Yn(a,c,e);c in t?Object.defineProperty(t,c,{value:u,writable:!0,enumerable:!0,configurable:!0}):t[c]=u}}return t}function y3(e,t,n){if(t===null)return"";if(typeof t!="object")return String(t);if($t(e)&&n?.doc){const a=vN(n.doc,{});a.anchors=new Set;for(const c of n.anchors.keys())a.anchors.add(c.anchor);a.inFlow=!0,a.inStringifyKey=!0;const o=e.toString(a);if(!n.mapKeyWarned){let c=JSON.stringify(o);c.length>40&&(c=c.substring(0,36)+'..."'),p3(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${c}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return o}return JSON.stringify(t)}function Jp(e,t,n){const a=hl(e,void 0,n),o=hl(t,void 0,n);return new pn(a,o)}class pn{constructor(t,n=null){Object.defineProperty(this,Jn,{value:uN}),this.key=t,this.value=n}clone(t){let{key:n,value:a}=this;return $t(n)&&(n=n.clone(t)),$t(a)&&(a=a.clone(t)),new pn(n,a)}toJSON(t,n){const a=n?.mapAsMap?new Map:{};return xN(n,a,this)}toString(t,n,a){return t?.doc?m3(this,t,n,a):JSON.stringify(this)}}function SN(e,t,n){return(t.inFlow??e.flow?b3:v3)(e,t,n)}function v3({comment:e,items:t},n,{blockItemPrefix:a,flowChars:o,itemIndent:c,onChompKeep:u,onComment:f}){const{indent:m,options:{commentString:p}}=n,v=Object.assign({},n,{indent:c,type:null});let y=!1;const b=[];for(let N=0;N<t.length;++N){const S=t[N];let C=null;if($t(S))!y&&S.spaceBefore&&b.push(""),Bu(n,b,S.commentBefore,y),S.comment&&(C=S.comment);else if(Pt(S)){const T=$t(S.key)?S.key:null;T&&(!y&&T.spaceBefore&&b.push(""),Bu(n,b,T.commentBefore,y))}y=!1;let k=qr(S,v,()=>C=null,()=>y=!0);C&&(k+=va(k,c,p(C))),y&&C&&(y=!1),b.push(a+k)}let x;if(b.length===0)x=o.start+o.end;else{x=b[0];for(let N=1;N<b.length;++N){const S=b[N];x+=S?`
139
- ${m}${S}`:`
140
- `}}return e?(x+=`
141
- `+Zs(p(e),m),f&&f()):y&&u&&u(),x}function b3({items:e},t,{flowChars:n,itemIndent:a}){const{indent:o,indentStep:c,flowCollectionPadding:u,options:{commentString:f}}=t;a+=c;const m=Object.assign({},t,{indent:a,inFlow:!0,type:null});let p=!1,v=0;const y=[];for(let N=0;N<e.length;++N){const S=e[N];let C=null;if($t(S))S.spaceBefore&&y.push(""),Bu(t,y,S.commentBefore,!1),S.comment&&(C=S.comment);else if(Pt(S)){const T=$t(S.key)?S.key:null;T&&(T.spaceBefore&&y.push(""),Bu(t,y,T.commentBefore,!1),T.comment&&(p=!0));const A=$t(S.value)?S.value:null;A?(A.comment&&(C=A.comment),A.commentBefore&&(p=!0)):S.value==null&&T?.comment&&(C=T.comment)}C&&(p=!0);let k=qr(S,m,()=>C=null);N<e.length-1&&(k+=","),C&&(k+=va(k,a,f(C))),!p&&(y.length>v||k.includes(`
142
- `))&&(p=!0),y.push(k),v=y.length}const{start:b,end:x}=n;if(y.length===0)return b+x;if(!p){const N=y.reduce((S,C)=>S+C.length+2,2);p=t.options.lineWidth>0&&N>t.options.lineWidth}if(p){let N=b;for(const S of y)N+=S?`
143
- ${c}${o}${S}`:`
144
- `;return`${N}
145
- ${o}${x}`}else return`${b}${u}${y.join(" ")}${u}${x}`}function Bu({indent:e,options:{commentString:t}},n,a,o){if(a&&o&&(a=a.replace(/^\n+/,"")),a){const c=Zs(t(a),e);n.push(c.trimStart())}}function ba(e,t){const n=gt(t)?t.value:t;for(const a of e)if(Pt(a)&&(a.key===t||a.key===n||gt(a.key)&&a.key.value===n))return a}class Vn extends gN{static get tagName(){return"tag:yaml.org,2002:map"}constructor(t){super(Di,t),this.items=[]}static from(t,n,a){const{keepUndefined:o,replacer:c}=a,u=new this(t),f=(m,p)=>{if(typeof c=="function")p=c.call(n,m,p);else if(Array.isArray(c)&&!c.includes(m))return;(p!==void 0||o)&&u.items.push(Jp(m,p,a))};if(n instanceof Map)for(const[m,p]of n)f(m,p);else if(n&&typeof n=="object")for(const m of Object.keys(n))f(m,n[m]);return typeof t.sortMapEntries=="function"&&u.items.sort(t.sortMapEntries),u}add(t,n){let a;Pt(t)?a=t:!t||typeof t!="object"||!("key"in t)?a=new pn(t,t?.value):a=new pn(t.key,t.value);const o=ba(this.items,a.key),c=this.schema?.sortMapEntries;if(o){if(!n)throw new Error(`Key ${a.key} already set`);gt(o.value)&&pN(a.value)?o.value.value=a.value:o.value=a.value}else if(c){const u=this.items.findIndex(f=>c(a,f)<0);u===-1?this.items.push(a):this.items.splice(u,0,a)}else this.items.push(a)}delete(t){const n=ba(this.items,t);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(t,n){const o=ba(this.items,t)?.value;return(!n&&gt(o)?o.value:o)??void 0}has(t){return!!ba(this.items,t)}set(t,n){this.add(new pn(t,n),!0)}toJSON(t,n,a){const o=a?new a:n?.mapAsMap?new Map:{};n?.onCreate&&n.onCreate(o);for(const c of this.items)xN(n,o,c);return o}toString(t,n,a){if(!t)return JSON.stringify(this);for(const o of this.items)if(!Pt(o))throw new Error(`Map items must all be pairs; found ${JSON.stringify(o)} instead`);return!t.allNullValues&&this.hasAllNullValues(!1)&&(t=Object.assign({},t,{allNullValues:!0})),SN(this,t,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:t.indent||"",onChompKeep:a,onComment:n})}}const Yr={collection:"map",default:!0,nodeClass:Vn,tag:"tag:yaml.org,2002:map",resolve(e,t){return bl(e)||t("Expected a mapping for this tag"),e},createNode:(e,t,n)=>Vn.from(e,t,n)};class Ea extends gN{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(t){super(Vr,t),this.items=[]}add(t){this.items.push(t)}delete(t){const n=su(t);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(t,n){const a=su(t);if(typeof a!="number")return;const o=this.items[a];return!n&&gt(o)?o.value:o}has(t){const n=su(t);return typeof n=="number"&&n<this.items.length}set(t,n){const a=su(t);if(typeof a!="number")throw new Error(`Expected a valid index, not ${t}.`);const o=this.items[a];gt(o)&&pN(n)?o.value=n:this.items[a]=n}toJSON(t,n){const a=[];n?.onCreate&&n.onCreate(a);let o=0;for(const c of this.items)a.push(Yn(c,String(o++),n));return a}toString(t,n,a){return t?SN(this,t,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(t.indent||"")+" ",onChompKeep:a,onComment:n}):JSON.stringify(this)}static from(t,n,a){const{replacer:o}=a,c=new this(t);if(n&&Symbol.iterator in Object(n)){let u=0;for(let f of n){if(typeof o=="function"){const m=n instanceof Set?f:String(u++);f=o.call(n,m,f)}c.items.push(hl(f,void 0,a))}}return c}}function su(e){let t=gt(e)?e.value:e;return t&&typeof t=="string"&&(t=Number(t)),typeof t=="number"&&Number.isInteger(t)&&t>=0?t:null}const Jr={collection:"seq",default:!0,nodeClass:Ea,tag:"tag:yaml.org,2002:seq",resolve(e,t){return xl(e)||t("Expected a sequence for this tag"),e},createNode:(e,t,n)=>Ea.from(e,t,n)},hd={identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify(e,t,n,a){return t=Object.assign({actualString:!0},t),Yp(e,t,n,a)}},md={identify:e=>e==null,createNode:()=>new Re(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Re(null),stringify:({source:e},t)=>typeof e=="string"&&md.test.test(e)?e:t.options.nullStr},Xp={identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new Re(e[0]==="t"||e[0]==="T"),stringify({source:e,value:t},n){if(e&&Xp.test.test(e)){const a=e[0]==="t"||e[0]==="T";if(t===a)return e}return t?n.options.trueStr:n.options.falseStr}};function hs({format:e,minFractionDigits:t,tag:n,value:a}){if(typeof a=="bigint")return String(a);const o=typeof a=="number"?a:Number(a);if(!isFinite(o))return isNaN(o)?".nan":o<0?"-.inf":".inf";let c=Object.is(a,-0)?"-0":JSON.stringify(a);if(!e&&t&&(!n||n==="tag:yaml.org,2002:float")&&/^\d/.test(c)){let u=c.indexOf(".");u<0&&(u=c.length,c+=".");let f=t-(c.length-u-1);for(;f-- >0;)c+="0"}return c}const jN={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:hs},wN={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){const t=Number(e.value);return isFinite(t)?t.toExponential():hs(e)}},NN={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){const t=new Re(parseFloat(e)),n=e.indexOf(".");return n!==-1&&e[e.length-1]==="0"&&(t.minFractionDigits=e.length-n-1),t},stringify:hs},pd=e=>typeof e=="bigint"||Number.isInteger(e),Wp=(e,t,n,{intAsBigInt:a})=>a?BigInt(e):parseInt(e.substring(t),n);function CN(e,t,n){const{value:a}=e;return pd(a)&&a>=0?n+a.toString(t):hs(e)}const kN={identify:e=>pd(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,n)=>Wp(e,2,8,n),stringify:e=>CN(e,8,"0o")},zN={identify:pd,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>Wp(e,0,10,n),stringify:hs},_N={identify:e=>pd(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>Wp(e,2,16,n),stringify:e=>CN(e,16,"0x")},x3=[Yr,Jr,hd,md,Xp,kN,zN,_N,jN,wN,NN];function aS(e){return typeof e=="bigint"||Number.isInteger(e)}const iu=({value:e})=>JSON.stringify(e),S3=[{identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:iu},{identify:e=>e==null,createNode:()=>new Re(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:iu},{identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>e==="true",stringify:iu},{identify:aS,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>aS(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:iu}],j3={default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}},w3=[Yr,Jr].concat(S3,j3),eg={identify:e=>e instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(e,t){if(typeof atob=="function"){const n=atob(e.replace(/[\n\r]/g,"")),a=new Uint8Array(n.length);for(let o=0;o<n.length;++o)a[o]=n.charCodeAt(o);return a}else return t("This environment does not support reading binary tags; either Buffer or atob is required"),e},stringify({comment:e,type:t,value:n},a,o,c){if(!n)return"";const u=n;let f;if(typeof btoa=="function"){let m="";for(let p=0;p<u.length;++p)m+=String.fromCharCode(u[p]);f=btoa(m)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(t??(t=Re.BLOCK_LITERAL),t!==Re.QUOTE_DOUBLE){const m=Math.max(a.options.lineWidth-a.indent.length,a.options.minContentWidth),p=Math.ceil(f.length/m),v=new Array(p);for(let y=0,b=0;y<p;++y,b+=m)v[y]=f.substr(b,m);f=v.join(t===Re.BLOCK_LITERAL?`
146
- `:" ")}return Yp({comment:e,type:t,value:f},a,o,c)}};function EN(e,t){if(xl(e))for(let n=0;n<e.items.length;++n){let a=e.items[n];if(!Pt(a)){if(bl(a)){a.items.length>1&&t("Each pair must have its own sequence indicator");const o=a.items[0]||new pn(new Re(null));if(a.commentBefore&&(o.key.commentBefore=o.key.commentBefore?`${a.commentBefore}
147
- ${o.key.commentBefore}`:a.commentBefore),a.comment){const c=o.value??o.key;c.comment=c.comment?`${a.comment}
148
- ${c.comment}`:a.comment}a=o}e.items[n]=Pt(a)?a:new pn(a)}}else t("Expected a sequence for this tag");return e}function AN(e,t,n){const{replacer:a}=n,o=new Ea(e);o.tag="tag:yaml.org,2002:pairs";let c=0;if(t&&Symbol.iterator in Object(t))for(let u of t){typeof a=="function"&&(u=a.call(t,String(c++),u));let f,m;if(Array.isArray(u))if(u.length===2)f=u[0],m=u[1];else throw new TypeError(`Expected [key, value] tuple: ${u}`);else if(u&&u instanceof Object){const p=Object.keys(u);if(p.length===1)f=p[0],m=u[f];else throw new TypeError(`Expected tuple with one key, not ${p.length} keys`)}else f=u;o.items.push(Jp(f,m,n))}return o}const tg={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:EN,createNode:AN};class Mr extends Ea{constructor(){super(),this.add=Vn.prototype.add.bind(this),this.delete=Vn.prototype.delete.bind(this),this.get=Vn.prototype.get.bind(this),this.has=Vn.prototype.has.bind(this),this.set=Vn.prototype.set.bind(this),this.tag=Mr.tag}toJSON(t,n){if(!n)return super.toJSON(t);const a=new Map;n?.onCreate&&n.onCreate(a);for(const o of this.items){let c,u;if(Pt(o)?(c=Yn(o.key,"",n),u=Yn(o.value,c,n)):c=Yn(o,"",n),a.has(c))throw new Error("Ordered maps must not include duplicate keys");a.set(c,u)}return a}static from(t,n,a){const o=AN(t,n,a),c=new this;return c.items=o.items,c}}Mr.tag="tag:yaml.org,2002:omap";const ng={collection:"seq",identify:e=>e instanceof Map,nodeClass:Mr,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){const n=EN(e,t),a=[];for(const{key:o}of n.items)gt(o)&&(a.includes(o.value)?t(`Ordered maps must not include duplicate keys: ${o.value}`):a.push(o.value));return Object.assign(new Mr,n)},createNode:(e,t,n)=>Mr.from(e,t,n)};function TN({value:e,source:t},n){return t&&(e?RN:ON).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}const RN={identify:e=>e===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new Re(!0),stringify:TN},ON={identify:e=>e===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new Re(!1),stringify:TN},N3={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:hs},C3={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,"")),stringify(e){const t=Number(e.value);return isFinite(t)?t.toExponential():hs(e)}},k3={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){const t=new Re(parseFloat(e.replace(/_/g,""))),n=e.indexOf(".");if(n!==-1){const a=e.substring(n+1).replace(/_/g,"");a[a.length-1]==="0"&&(t.minFractionDigits=a.length)}return t},stringify:hs},Sl=e=>typeof e=="bigint"||Number.isInteger(e);function gd(e,t,n,{intAsBigInt:a}){const o=e[0];if((o==="-"||o==="+")&&(t+=1),e=e.substring(t).replace(/_/g,""),a){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}const u=BigInt(e);return o==="-"?BigInt(-1)*u:u}const c=parseInt(e,n);return o==="-"?-1*c:c}function sg(e,t,n){const{value:a}=e;if(Sl(a)){const o=a.toString(t);return a<0?"-"+n+o.substr(1):n+o}return hs(e)}const z3={identify:Sl,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>gd(e,2,2,n),stringify:e=>sg(e,2,"0b")},_3={identify:Sl,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>gd(e,1,8,n),stringify:e=>sg(e,8,"0")},E3={identify:Sl,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>gd(e,0,10,n),stringify:hs},A3={identify:Sl,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>gd(e,2,16,n),stringify:e=>sg(e,16,"0x")};class $r extends Vn{constructor(t){super(t),this.tag=$r.tag}add(t){let n;Pt(t)?n=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?n=new pn(t.key,null):n=new pn(t,null),ba(this.items,n.key)||this.items.push(n)}get(t,n){const a=ba(this.items,t);return!n&&Pt(a)?gt(a.key)?a.key.value:a.key:a}set(t,n){if(typeof n!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);const a=ba(this.items,t);a&&!n?this.items.splice(this.items.indexOf(a),1):!a&&n&&this.items.push(new pn(t))}toJSON(t,n){return super.toJSON(t,n,Set)}toString(t,n,a){if(!t)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},t,{allNullValues:!0}),n,a);throw new Error("Set items must all have null values")}static from(t,n,a){const{replacer:o}=a,c=new this(t);if(n&&Symbol.iterator in Object(n))for(let u of n)typeof o=="function"&&(u=o.call(n,u,u)),c.items.push(Jp(u,null,a));return c}}$r.tag="tag:yaml.org,2002:set";const ig={collection:"map",identify:e=>e instanceof Set,nodeClass:$r,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,n)=>$r.from(e,t,n),resolve(e,t){if(bl(e)){if(e.hasAllNullValues(!0))return Object.assign(new $r,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};function ag(e,t){const n=e[0],a=n==="-"||n==="+"?e.substring(1):e,o=u=>t?BigInt(u):Number(u),c=a.replace(/_/g,"").split(":").reduce((u,f)=>u*o(60)+o(f),o(0));return n==="-"?o(-1)*c:c}function LN(e){let{value:t}=e,n=u=>u;if(typeof t=="bigint")n=u=>BigInt(u);else if(isNaN(t)||!isFinite(t))return hs(e);let a="";t<0&&(a="-",t*=n(-1));const o=n(60),c=[t%o];return t<60?c.unshift(0):(t=(t-c[0])/o,c.unshift(t%o),t>=60&&(t=(t-c[0])/o,c.unshift(t))),a+c.map(u=>String(u).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}const DN={identify:e=>typeof e=="bigint"||Number.isInteger(e),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:n})=>ag(e,n),stringify:LN},MN={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>ag(e,!1),stringify:LN},yd={identify:e=>e instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(e){const t=e.match(yd.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");const[,n,a,o,c,u,f]=t.map(Number),m=t[7]?Number((t[7]+"00").substr(1,3)):0;let p=Date.UTC(n,a-1,o,c||0,u||0,f||0,m);const v=t[8];if(v&&v!=="Z"){let y=ag(v,!1);Math.abs(y)<30&&(y*=60),p-=6e4*y}return new Date(p)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""},rS=[Yr,Jr,hd,md,RN,ON,z3,_3,E3,A3,N3,C3,k3,eg,Vs,ng,tg,ig,DN,MN,yd],oS=new Map([["core",x3],["failsafe",[Yr,Jr,hd]],["json",w3],["yaml11",rS],["yaml-1.1",rS]]),lS={binary:eg,bool:Xp,float:NN,floatExp:wN,floatNaN:jN,floatTime:MN,int:zN,intHex:_N,intOct:kN,intTime:DN,map:Yr,merge:Vs,null:md,omap:ng,pairs:tg,seq:Jr,set:ig,timestamp:yd},T3={"tag:yaml.org,2002:binary":eg,"tag:yaml.org,2002:merge":Vs,"tag:yaml.org,2002:omap":ng,"tag:yaml.org,2002:pairs":tg,"tag:yaml.org,2002:set":ig,"tag:yaml.org,2002:timestamp":yd};function dm(e,t,n){const a=oS.get(t);if(a&&!e)return n&&!a.includes(Vs)?a.concat(Vs):a.slice();let o=a;if(!o)if(Array.isArray(e))o=[];else{const c=Array.from(oS.keys()).filter(u=>u!=="yaml11").map(u=>JSON.stringify(u)).join(", ");throw new Error(`Unknown schema "${t}"; use one of ${c} or define customTags array`)}if(Array.isArray(e))for(const c of e)o=o.concat(c);else typeof e=="function"&&(o=e(o.slice()));return n&&(o=o.concat(Vs)),o.reduce((c,u)=>{const f=typeof u=="string"?lS[u]:u;if(!f){const m=JSON.stringify(u),p=Object.keys(lS).map(v=>JSON.stringify(v)).join(", ");throw new Error(`Unknown custom tag ${m}; use one of ${p}`)}return c.includes(f)||c.push(f),c},[])}const R3=(e,t)=>e.key<t.key?-1:e.key>t.key?1:0;class rg{constructor({compat:t,customTags:n,merge:a,resolveKnownTags:o,schema:c,sortMapEntries:u,toStringDefaults:f}){this.compat=Array.isArray(t)?dm(t,"compat"):t?dm(null,t):null,this.name=typeof c=="string"&&c||"core",this.knownTags=o?T3:{},this.tags=dm(n,this.name,a),this.toStringOptions=f??null,Object.defineProperty(this,Di,{value:Yr}),Object.defineProperty(this,Ns,{value:hd}),Object.defineProperty(this,Vr,{value:Jr}),this.sortMapEntries=typeof u=="function"?u:u===!0?R3:null}clone(){const t=Object.create(rg.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}}function O3(e,t){const n=[];let a=t.directives===!0;if(t.directives!==!1&&e.directives){const m=e.directives.toString(e);m?(n.push(m),a=!0):e.directives.docStart&&(a=!0)}a&&n.push("---");const o=vN(e,t),{commentString:c}=o.options;if(e.commentBefore){n.length!==1&&n.unshift("");const m=c(e.commentBefore);n.unshift(Zs(m,""))}let u=!1,f=null;if(e.contents){if($t(e.contents)){if(e.contents.spaceBefore&&a&&n.push(""),e.contents.commentBefore){const v=c(e.contents.commentBefore);n.push(Zs(v,""))}o.forceBlockIndent=!!e.comment,f=e.contents.comment}const m=f?void 0:()=>u=!0;let p=qr(e.contents,o,()=>f=null,m);f&&(p+=va(p,"",c(f))),(p[0]==="|"||p[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${p}`:n.push(p)}else n.push(qr(e.contents,o));if(e.directives?.docEnd)if(e.comment){const m=c(e.comment);m.includes(`
149
- `)?(n.push("..."),n.push(Zs(m,""))):n.push(`... ${m}`)}else n.push("...");else{let m=e.comment;m&&u&&(m=m.replace(/^\n+/,"")),m&&((!u||f)&&n[n.length-1]!==""&&n.push(""),n.push(Zs(c(m),"")))}return n.join(`
150
- `)+`
151
- `}class vd{constructor(t,n,a){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Jn,{value:Ym});let o=null;typeof n=="function"||Array.isArray(n)?o=n:a===void 0&&n&&(a=n,n=void 0);const c=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},a);this.options=c;let{version:u}=c;a?._directives?(this.directives=a._directives.atDocument(),this.directives.yaml.explicit&&(u=this.directives.yaml.version)):this.directives=new fn({version:u}),this.setSchema(u,a),this.contents=t===void 0?null:this.createNode(t,o,a)}clone(){const t=Object.create(vd.prototype,{[Jn]:{value:Ym}});return t.commentBefore=this.commentBefore,t.comment=this.comment,t.errors=this.errors.slice(),t.warnings=this.warnings.slice(),t.options=Object.assign({},this.options),this.directives&&(t.directives=this.directives.clone()),t.schema=this.schema.clone(),t.contents=$t(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(t){kr(this.contents)&&this.contents.add(t)}addIn(t,n){kr(this.contents)&&this.contents.addIn(t,n)}createAlias(t,n){if(!t.anchor){const a=hN(this);t.anchor=!n||a.has(n)?mN(n||"a",a):n}return new Qp(t.anchor)}createNode(t,n,a){let o;if(typeof n=="function")t=n.call({"":t},"",t),o=n;else if(Array.isArray(n)){const C=T=>typeof T=="number"||T instanceof String||T instanceof Number,k=n.filter(C).map(String);k.length>0&&(n=n.concat(k)),o=n}else a===void 0&&n&&(a=n,n=void 0);const{aliasDuplicateObjects:c,anchorPrefix:u,flow:f,keepUndefined:m,onTagObj:p,tag:v}=a??{},{onAnchor:y,setAnchors:b,sourceObjects:x}=r3(this,u||"a"),N={aliasDuplicateObjects:c??!0,keepUndefined:m??!1,onAnchor:y,onTagObj:p,replacer:o,schema:this.schema,sourceObjects:x},S=hl(t,v,N);return f&&Mt(S)&&(S.flow=!0),b(),S}createPair(t,n,a={}){const o=this.createNode(t,null,a),c=this.createNode(n,null,a);return new pn(o,c)}delete(t){return kr(this.contents)?this.contents.delete(t):!1}deleteIn(t){return Xo(t)?this.contents==null?!1:(this.contents=null,!0):kr(this.contents)?this.contents.deleteIn(t):!1}get(t,n){return Mt(this.contents)?this.contents.get(t,n):void 0}getIn(t,n){return Xo(t)?!n&&gt(this.contents)?this.contents.value:this.contents:Mt(this.contents)?this.contents.getIn(t,n):void 0}has(t){return Mt(this.contents)?this.contents.has(t):!1}hasIn(t){return Xo(t)?this.contents!==void 0:Mt(this.contents)?this.contents.hasIn(t):!1}set(t,n){this.contents==null?this.contents=Iu(this.schema,[t],n):kr(this.contents)&&this.contents.set(t,n)}setIn(t,n){Xo(t)?this.contents=n:this.contents==null?this.contents=Iu(this.schema,Array.from(t),n):kr(this.contents)&&this.contents.setIn(t,n)}setSchema(t,n={}){typeof t=="number"&&(t=String(t));let a;switch(t){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new fn({version:"1.1"}),a={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=t:this.directives=new fn({version:t}),a={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,a=null;break;default:{const o=JSON.stringify(t);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${o}`)}}if(n.schema instanceof Object)this.schema=n.schema;else if(a)this.schema=new rg(Object.assign(a,n));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:t,jsonArg:n,mapAsMap:a,maxAliasCount:o,onAnchor:c,reviver:u}={}){const f={anchors:new Map,doc:this,keep:!t,mapAsMap:a===!0,mapKeyWarned:!1,maxAliasCount:typeof o=="number"?o:100},m=Yn(this.contents,n??"",f);if(typeof c=="function")for(const{count:p,res:v}of f.anchors.values())c(v,p);return typeof u=="function"?Rr(u,{"":m},"",m):m}toJSON(t,n){return this.toJS({json:!0,jsonArg:t,mapAsMap:!1,onAnchor:n})}toString(t={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in t&&(!Number.isInteger(t.indent)||Number(t.indent)<=0)){const n=JSON.stringify(t.indent);throw new Error(`"indent" option must be a positive integer, not ${n}`)}return O3(this,t)}}function kr(e){if(Mt(e))return!0;throw new Error("Expected a YAML collection as document contents")}class $N extends Error{constructor(t,n,a,o){super(),this.name=t,this.code=a,this.message=o,this.pos=n}}class au extends $N{constructor(t,n,a){super("YAMLParseError",t,n,a)}}class L3 extends $N{constructor(t,n,a){super("YAMLWarning",t,n,a)}}const cS=(e,t)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(f=>t.linePos(f));const{line:a,col:o}=n.linePos[0];n.message+=` at line ${a}, column ${o}`;let c=o-1,u=e.substring(t.lineStarts[a-1],t.lineStarts[a]).replace(/[\n\r]+$/,"");if(c>=60&&u.length>80){const f=Math.min(c-39,u.length-79);u="…"+u.substring(f),c-=f-1}if(u.length>80&&(u=u.substring(0,79)+"…"),a>1&&/^ *$/.test(u.substring(0,c))){let f=e.substring(t.lineStarts[a-2],t.lineStarts[a-1]);f.length>80&&(f=f.substring(0,79)+`…
152
- `),u=f+u}if(/[^ ]/.test(u)){let f=1;const m=n.linePos[1];m?.line===a&&m.col>o&&(f=Math.max(1,Math.min(m.col-o,80-c)));const p=" ".repeat(c)+"^".repeat(f);n.message+=`:
153
-
154
- ${u}
155
- ${p}
156
- `}};function Kr(e,{flow:t,indicator:n,next:a,offset:o,onError:c,parentIndent:u,startOnNewline:f}){let m=!1,p=f,v=f,y="",b="",x=!1,N=!1,S=null,C=null,k=null,T=null,A=null,z=null,$=null;for(const O of e)switch(N&&(O.type!=="space"&&O.type!=="newline"&&O.type!=="comma"&&c(O.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),N=!1),S&&(p&&O.type!=="comment"&&O.type!=="newline"&&c(S,"TAB_AS_INDENT","Tabs are not allowed as indentation"),S=null),O.type){case"space":!t&&(n!=="doc-start"||a?.type!=="flow-collection")&&O.source.includes(" ")&&(S=O),v=!0;break;case"comment":{v||c(O,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");const K=O.source.substring(1)||" ";y?y+=b+K:y=K,b="",p=!1;break}case"newline":p?y?y+=O.source:(!z||n!=="seq-item-ind")&&(m=!0):b+=O.source,p=!0,x=!0,(C||k)&&(T=O),v=!0;break;case"anchor":C&&c(O,"MULTIPLE_ANCHORS","A node can have at most one anchor"),O.source.endsWith(":")&&c(O.offset+O.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),C=O,$??($=O.offset),p=!1,v=!1,N=!0;break;case"tag":{k&&c(O,"MULTIPLE_TAGS","A node can have at most one tag"),k=O,$??($=O.offset),p=!1,v=!1,N=!0;break}case n:(C||k)&&c(O,"BAD_PROP_ORDER",`Anchors and tags must be after the ${O.source} indicator`),z&&c(O,"UNEXPECTED_TOKEN",`Unexpected ${O.source} in ${t??"collection"}`),z=O,p=n==="seq-item-ind"||n==="explicit-key-ind",v=!1;break;case"comma":if(t){A&&c(O,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`),A=O,p=!1,v=!1;break}default:c(O,"UNEXPECTED_TOKEN",`Unexpected ${O.type} token`),p=!1,v=!1}const P=e[e.length-1],E=P?P.offset+P.source.length:o;return N&&a&&a.type!=="space"&&a.type!=="newline"&&a.type!=="comma"&&(a.type!=="scalar"||a.source!=="")&&c(a.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),S&&(p&&S.indent<=u||a?.type==="block-map"||a?.type==="block-seq")&&c(S,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:A,found:z,spaceBefore:m,comment:y,hasNewline:x,anchor:C,tag:k,newlineAfterProp:T,end:E,start:$??E}}function ml(e){if(!e)return null;switch(e.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(e.source.includes(`
157
- `))return!0;if(e.end){for(const t of e.end)if(t.type==="newline")return!0}return!1;case"flow-collection":for(const t of e.items){for(const n of t.start)if(n.type==="newline")return!0;if(t.sep){for(const n of t.sep)if(n.type==="newline")return!0}if(ml(t.key)||ml(t.value))return!0}return!1;default:return!0}}function ep(e,t,n){if(t?.type==="flow-collection"){const a=t.end[0];a.indent===e&&(a.source==="]"||a.source==="}")&&ml(t)&&n(a,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}function PN(e,t,n){const{uniqueKeys:a}=e.options;if(a===!1)return!1;const o=typeof a=="function"?a:(c,u)=>c===u||gt(c)&&gt(u)&&c.value===u.value;return t.some(c=>o(c.key,n))}const uS="All mapping items must start at the same column";function D3({composeNode:e,composeEmptyNode:t},n,a,o,c){const u=c?.nodeClass??Vn,f=new u(n.schema);n.atRoot&&(n.atRoot=!1);let m=a.offset,p=null;for(const v of a.items){const{start:y,key:b,sep:x,value:N}=v,S=Kr(y,{indicator:"explicit-key-ind",next:b??x?.[0],offset:m,onError:o,parentIndent:a.indent,startOnNewline:!0}),C=!S.found;if(C){if(b&&(b.type==="block-seq"?o(m,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in b&&b.indent!==a.indent&&o(m,"BAD_INDENT",uS)),!S.anchor&&!S.tag&&!x){p=S.end,S.comment&&(f.comment?f.comment+=`
158
- `+S.comment:f.comment=S.comment);continue}(S.newlineAfterProp||ml(b))&&o(b??y[y.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else S.found?.indent!==a.indent&&o(m,"BAD_INDENT",uS);n.atKey=!0;const k=S.end,T=b?e(n,b,S,o):t(n,k,y,null,S,o);n.schema.compat&&ep(a.indent,b,o),n.atKey=!1,PN(n,f.items,T)&&o(k,"DUPLICATE_KEY","Map keys must be unique");const A=Kr(x??[],{indicator:"map-value-ind",next:N,offset:T.range[2],onError:o,parentIndent:a.indent,startOnNewline:!b||b.type==="block-scalar"});if(m=A.end,A.found){C&&(N?.type==="block-map"&&!A.hasNewline&&o(m,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&S.start<A.found.offset-1024&&o(T.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));const z=N?e(n,N,A,o):t(n,m,x,null,A,o);n.schema.compat&&ep(a.indent,N,o),m=z.range[2];const $=new pn(T,z);n.options.keepSourceTokens&&($.srcToken=v),f.items.push($)}else{C&&o(T.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),A.comment&&(T.comment?T.comment+=`
159
- `+A.comment:T.comment=A.comment);const z=new pn(T);n.options.keepSourceTokens&&(z.srcToken=v),f.items.push(z)}}return p&&p<m&&o(p,"IMPOSSIBLE","Map comment with trailing content"),f.range=[a.offset,m,p??m],f}function M3({composeNode:e,composeEmptyNode:t},n,a,o,c){const u=c?.nodeClass??Ea,f=new u(n.schema);n.atRoot&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let m=a.offset,p=null;for(const{start:v,value:y}of a.items){const b=Kr(v,{indicator:"seq-item-ind",next:y,offset:m,onError:o,parentIndent:a.indent,startOnNewline:!0});if(!b.found)if(b.anchor||b.tag||y)y?.type==="block-seq"?o(b.end,"BAD_INDENT","All sequence items must start at the same column"):o(m,"MISSING_CHAR","Sequence item without - indicator");else{p=b.end,b.comment&&(f.comment=b.comment);continue}const x=y?e(n,y,b,o):t(n,b.end,v,null,b,o);n.schema.compat&&ep(a.indent,y,o),m=x.range[2],f.items.push(x)}return f.range=[a.offset,m,p??m],f}function jl(e,t,n,a){let o="";if(e){let c=!1,u="";for(const f of e){const{source:m,type:p}=f;switch(p){case"space":c=!0;break;case"comment":{n&&!c&&a(f,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");const v=m.substring(1)||" ";o?o+=u+v:o=v,u="";break}case"newline":o&&(u+=m),c=!0;break;default:a(f,"UNEXPECTED_TOKEN",`Unexpected ${p} at node end`)}t+=m.length}}return{comment:o,offset:t}}const fm="Block collections are not allowed within flow collections",hm=e=>e&&(e.type==="block-map"||e.type==="block-seq");function $3({composeNode:e,composeEmptyNode:t},n,a,o,c){const u=a.start.source==="{",f=u?"flow map":"flow sequence",m=c?.nodeClass??(u?Vn:Ea),p=new m(n.schema);p.flow=!0;const v=n.atRoot;v&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let y=a.offset+a.start.source.length;for(let C=0;C<a.items.length;++C){const k=a.items[C],{start:T,key:A,sep:z,value:$}=k,P=Kr(T,{flow:f,indicator:"explicit-key-ind",next:A??z?.[0],offset:y,onError:o,parentIndent:a.indent,startOnNewline:!1});if(!P.found){if(!P.anchor&&!P.tag&&!z&&!$){C===0&&P.comma?o(P.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${f}`):C<a.items.length-1&&o(P.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${f}`),P.comment&&(p.comment?p.comment+=`
160
- `+P.comment:p.comment=P.comment),y=P.end;continue}!u&&n.options.strict&&ml(A)&&o(A,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(C===0)P.comma&&o(P.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${f}`);else if(P.comma||o(P.start,"MISSING_CHAR",`Missing , between ${f} items`),P.comment){let E="";e:for(const O of T)switch(O.type){case"comma":case"space":break;case"comment":E=O.source.substring(1);break e;default:break e}if(E){let O=p.items[p.items.length-1];Pt(O)&&(O=O.value??O.key),O.comment?O.comment+=`
161
- `+E:O.comment=E,P.comment=P.comment.substring(E.length+1)}}if(!u&&!z&&!P.found){const E=$?e(n,$,P,o):t(n,P.end,z,null,P,o);p.items.push(E),y=E.range[2],hm($)&&o(E.range,"BLOCK_IN_FLOW",fm)}else{n.atKey=!0;const E=P.end,O=A?e(n,A,P,o):t(n,E,T,null,P,o);hm(A)&&o(O.range,"BLOCK_IN_FLOW",fm),n.atKey=!1;const K=Kr(z??[],{flow:f,indicator:"map-value-ind",next:$,offset:O.range[2],onError:o,parentIndent:a.indent,startOnNewline:!1});if(K.found){if(!u&&!P.found&&n.options.strict){if(z)for(const se of z){if(se===K.found)break;if(se.type==="newline"){o(se,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}P.start<K.found.offset-1024&&o(K.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else $&&("source"in $&&$.source?.[0]===":"?o($,"MISSING_CHAR",`Missing space after : in ${f}`):o(K.start,"MISSING_CHAR",`Missing , or : between ${f} items`));const ee=$?e(n,$,K,o):K.found?t(n,K.end,z,null,K,o):null;ee?hm($)&&o(ee.range,"BLOCK_IN_FLOW",fm):K.comment&&(O.comment?O.comment+=`
162
- `+K.comment:O.comment=K.comment);const X=new pn(O,ee);if(n.options.keepSourceTokens&&(X.srcToken=k),u){const se=p;PN(n,se.items,O)&&o(E,"DUPLICATE_KEY","Map keys must be unique"),se.items.push(X)}else{const se=new Vn(n.schema);se.flow=!0,se.items.push(X);const de=(ee??O).range;se.range=[O.range[0],de[1],de[2]],p.items.push(se)}y=ee?ee.range[2]:K.end}}const b=u?"}":"]",[x,...N]=a.end;let S=y;if(x?.source===b)S=x.offset+x.source.length;else{const C=f[0].toUpperCase()+f.substring(1),k=v?`${C} must end with a ${b}`:`${C} in block collection must be sufficiently indented and end with a ${b}`;o(y,v?"MISSING_CHAR":"BAD_INDENT",k),x&&x.source.length!==1&&N.unshift(x)}if(N.length>0){const C=jl(N,S,n.options.strict,o);C.comment&&(p.comment?p.comment+=`
163
- `+C.comment:p.comment=C.comment),p.range=[a.offset,S,C.offset]}else p.range=[a.offset,S,S];return p}function mm(e,t,n,a,o,c){const u=n.type==="block-map"?D3(e,t,n,a,c):n.type==="block-seq"?M3(e,t,n,a,c):$3(e,t,n,a,c),f=u.constructor;return o==="!"||o===f.tagName?(u.tag=f.tagName,u):(o&&(u.tag=o),u)}function P3(e,t,n,a,o){const c=a.tag,u=c?t.directives.tagName(c.source,b=>o(c,"TAG_RESOLVE_FAILED",b)):null;if(n.type==="block-seq"){const{anchor:b,newlineAfterProp:x}=a,N=b&&c?b.offset>c.offset?b:c:b??c;N&&(!x||x.offset<N.offset)&&o(N,"MISSING_CHAR","Missing newline after block sequence props")}const f=n.type==="block-map"?"map":n.type==="block-seq"?"seq":n.start.source==="{"?"map":"seq";if(!c||!u||u==="!"||u===Vn.tagName&&f==="map"||u===Ea.tagName&&f==="seq")return mm(e,t,n,o,u);let m=t.schema.tags.find(b=>b.tag===u&&b.collection===f);if(!m){const b=t.schema.knownTags[u];if(b?.collection===f)t.schema.tags.push(Object.assign({},b,{default:!1})),m=b;else return b?o(c,"BAD_COLLECTION_TYPE",`${b.tag} used for ${f} collection, but expects ${b.collection??"scalar"}`,!0):o(c,"TAG_RESOLVE_FAILED",`Unresolved tag: ${u}`,!0),mm(e,t,n,o,u)}const p=mm(e,t,n,o,u,m),v=m.resolve?.(p,b=>o(c,"TAG_RESOLVE_FAILED",b),t.options)??p,y=$t(v)?v:new Re(v);return y.range=p.range,y.tag=u,m?.format&&(y.format=m.format),y}function U3(e,t,n){const a=t.offset,o=I3(t,e.options.strict,n);if(!o)return{value:"",type:null,comment:"",range:[a,a,a]};const c=o.mode===">"?Re.BLOCK_FOLDED:Re.BLOCK_LITERAL,u=t.source?B3(t.source):[];let f=u.length;for(let S=u.length-1;S>=0;--S){const C=u[S][1];if(C===""||C==="\r")f=S;else break}if(f===0){const S=o.chomp==="+"&&u.length>0?`
164
- `.repeat(Math.max(1,u.length-1)):"";let C=a+o.length;return t.source&&(C+=t.source.length),{value:S,type:c,comment:o.comment,range:[a,C,C]}}let m=t.indent+o.indent,p=t.offset+o.length,v=0;for(let S=0;S<f;++S){const[C,k]=u[S];if(k===""||k==="\r")o.indent===0&&C.length>m&&(m=C.length);else{C.length<m&&n(p+C.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),o.indent===0&&(m=C.length),v=S,m===0&&!e.atRoot&&n(p,"BAD_INDENT","Block scalar values in collections must be indented");break}p+=C.length+k.length+1}for(let S=u.length-1;S>=f;--S)u[S][0].length>m&&(f=S+1);let y="",b="",x=!1;for(let S=0;S<v;++S)y+=u[S][0].slice(m)+`
165
- `;for(let S=v;S<f;++S){let[C,k]=u[S];p+=C.length+k.length+1;const T=k[k.length-1]==="\r";if(T&&(k=k.slice(0,-1)),k&&C.length<m){const z=`Block scalar lines must not be less indented than their ${o.indent?"explicit indentation indicator":"first line"}`;n(p-k.length-(T?2:1),"BAD_INDENT",z),C=""}c===Re.BLOCK_LITERAL?(y+=b+C.slice(m)+k,b=`
166
- `):C.length>m||k[0]===" "?(b===" "?b=`
167
- `:!x&&b===`
168
- `&&(b=`
169
-
170
- `),y+=b+C.slice(m)+k,b=`
171
- `,x=!0):k===""?b===`
172
- `?y+=`
173
- `:b=`
174
- `:(y+=b+k,b=" ",x=!1)}switch(o.chomp){case"-":break;case"+":for(let S=f;S<u.length;++S)y+=`
175
- `+u[S][0].slice(m);y[y.length-1]!==`
176
- `&&(y+=`
177
- `);break;default:y+=`
178
- `}const N=a+o.length+t.source.length;return{value:y,type:c,comment:o.comment,range:[a,N,N]}}function I3({offset:e,props:t},n,a){if(t[0].type!=="block-scalar-header")return a(t[0],"IMPOSSIBLE","Block scalar header not found"),null;const{source:o}=t[0],c=o[0];let u=0,f="",m=-1;for(let b=1;b<o.length;++b){const x=o[b];if(!f&&(x==="-"||x==="+"))f=x;else{const N=Number(x);!u&&N?u=N:m===-1&&(m=e+b)}}m!==-1&&a(m,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${o}`);let p=!1,v="",y=o.length;for(let b=1;b<t.length;++b){const x=t[b];switch(x.type){case"space":p=!0;case"newline":y+=x.source.length;break;case"comment":n&&!p&&a(x,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),y+=x.source.length,v=x.source.substring(1);break;case"error":a(x,"UNEXPECTED_TOKEN",x.message),y+=x.source.length;break;default:{const N=`Unexpected token in block scalar header: ${x.type}`;a(x,"UNEXPECTED_TOKEN",N);const S=x.source;S&&typeof S=="string"&&(y+=S.length)}}}return{mode:c,indent:u,chomp:f,comment:v,length:y}}function B3(e){const t=e.split(/\n( *)/),n=t[0],a=n.match(/^( *)/),c=[a?.[1]?[a[1],n.slice(a[1].length)]:["",n]];for(let u=1;u<t.length;u+=2)c.push([t[u],t[u+1]]);return c}function q3(e,t,n){const{offset:a,type:o,source:c,end:u}=e;let f,m;const p=(b,x,N)=>n(a+b,x,N);switch(o){case"scalar":f=Re.PLAIN,m=K3(c,p);break;case"single-quoted-scalar":f=Re.QUOTE_SINGLE,m=H3(c,p);break;case"double-quoted-scalar":f=Re.QUOTE_DOUBLE,m=G3(c,p);break;default:return n(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${o}`),{value:"",type:null,comment:"",range:[a,a+c.length,a+c.length]}}const v=a+c.length,y=jl(u,v,t,n);return{value:m,type:f,comment:y.comment,range:[a,v,y.offset]}}function K3(e,t){let n="";switch(e[0]){case" ":n="a tab character";break;case",":n="flow indicator character ,";break;case"%":n="directive indicator character %";break;case"|":case">":{n=`block scalar indicator ${e[0]}`;break}case"@":case"`":{n=`reserved character ${e[0]}`;break}}return n&&t(0,"BAD_SCALAR_START",`Plain value cannot start with ${n}`),UN(e)}function H3(e,t){return(e[e.length-1]!=="'"||e.length===1)&&t(e.length,"MISSING_CHAR","Missing closing 'quote"),UN(e.slice(1,-1)).replace(/''/g,"'")}function UN(e){let t,n;try{t=new RegExp(`(.*?)(?<![ ])[ ]*\r?
179
- `,"sy"),n=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
180
- `,"sy")}catch{t=/(.*?)[ \t]*\r?\n/sy,n=/[ \t]*(.*?)[ \t]*\r?\n/sy}let a=t.exec(e);if(!a)return e;let o=a[1],c=" ",u=t.lastIndex;for(n.lastIndex=u;a=n.exec(e);)a[1]===""?c===`
181
- `?o+=c:c=`
182
- `:(o+=c+a[1],c=" "),u=n.lastIndex;const f=/[ \t]*(.*)/sy;return f.lastIndex=u,a=f.exec(e),o+c+(a?.[1]??"")}function G3(e,t){let n="";for(let a=1;a<e.length-1;++a){const o=e[a];if(!(o==="\r"&&e[a+1]===`
183
- `))if(o===`
184
- `){const{fold:c,offset:u}=F3(e,a);n+=c,a=u}else if(o==="\\"){let c=e[++a];const u=Z3[c];if(u)n+=u;else if(c===`
185
- `)for(c=e[a+1];c===" "||c===" ";)c=e[++a+1];else if(c==="\r"&&e[a+1]===`
186
- `)for(c=e[++a+1];c===" "||c===" ";)c=e[++a+1];else if(c==="x"||c==="u"||c==="U"){const f={x:2,u:4,U:8}[c];n+=V3(e,a+1,f,t),a+=f}else{const f=e.substr(a-1,2);t(a-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${f}`),n+=f}}else if(o===" "||o===" "){const c=a;let u=e[a+1];for(;u===" "||u===" ";)u=e[++a+1];u!==`
187
- `&&!(u==="\r"&&e[a+2]===`
188
- `)&&(n+=a>c?e.slice(c,a+1):o)}else n+=o}return(e[e.length-1]!=='"'||e.length===1)&&t(e.length,"MISSING_CHAR",'Missing closing "quote'),n}function F3(e,t){let n="",a=e[t+1];for(;(a===" "||a===" "||a===`
189
- `||a==="\r")&&!(a==="\r"&&e[t+2]!==`
190
- `);)a===`
191
- `&&(n+=`
192
- `),t+=1,a=e[t+1];return n||(n=" "),{fold:n,offset:t}}const Z3={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
193
- `,r:"\r",t:" ",v:"\v",N:"…",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function V3(e,t,n,a){const o=e.substr(t,n),u=o.length===n&&/^[0-9a-fA-F]+$/.test(o)?parseInt(o,16):NaN;if(isNaN(u)){const f=e.substr(t-2,n+2);return a(t-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${f}`),f}return String.fromCodePoint(u)}function IN(e,t,n,a){const{value:o,type:c,comment:u,range:f}=t.type==="block-scalar"?U3(e,t,a):q3(t,e.options.strict,a),m=n?e.directives.tagName(n.source,y=>a(n,"TAG_RESOLVE_FAILED",y)):null;let p;e.options.stringKeys&&e.atKey?p=e.schema[Ns]:m?p=Q3(e.schema,o,m,n,a):t.type==="scalar"?p=Y3(e,o,t,a):p=e.schema[Ns];let v;try{const y=p.resolve(o,b=>a(n??t,"TAG_RESOLVE_FAILED",b),e.options);v=gt(y)?y:new Re(y)}catch(y){const b=y instanceof Error?y.message:String(y);a(n??t,"TAG_RESOLVE_FAILED",b),v=new Re(o)}return v.range=f,v.source=o,c&&(v.type=c),m&&(v.tag=m),p.format&&(v.format=p.format),u&&(v.comment=u),v}function Q3(e,t,n,a,o){if(n==="!")return e[Ns];const c=[];for(const f of e.tags)if(!f.collection&&f.tag===n)if(f.default&&f.test)c.push(f);else return f;for(const f of c)if(f.test?.test(t))return f;const u=e.knownTags[n];return u&&!u.collection?(e.tags.push(Object.assign({},u,{default:!1,test:void 0})),u):(o(a,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),e[Ns])}function Y3({atKey:e,directives:t,schema:n},a,o,c){const u=n.tags.find(f=>(f.default===!0||e&&f.default==="key")&&f.test?.test(a))||n[Ns];if(n.compat){const f=n.compat.find(m=>m.default&&m.test?.test(a))??n[Ns];if(u.tag!==f.tag){const m=t.tagString(u.tag),p=t.tagString(f.tag),v=`Value may be parsed as either ${m} or ${p}`;c(o,"TAG_RESOLVE_FAILED",v,!0)}}return u}function J3(e,t,n){if(t){n??(n=t.length);for(let a=n-1;a>=0;--a){let o=t[a];switch(o.type){case"space":case"comment":case"newline":e-=o.source.length;continue}for(o=t[++a];o?.type==="space";)e+=o.source.length,o=t[++a];break}}return e}const X3={composeNode:BN,composeEmptyNode:og};function BN(e,t,n,a){const o=e.atKey,{spaceBefore:c,comment:u,anchor:f,tag:m}=n;let p,v=!0;switch(t.type){case"alias":p=W3(e,t,a),(f||m)&&a(t,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":p=IN(e,t,m,a),f&&(p.anchor=f.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":p=P3(X3,e,t,n,a),f&&(p.anchor=f.source.substring(1));break;default:{const y=t.type==="error"?t.message:`Unsupported token (type: ${t.type})`;a(t,"UNEXPECTED_TOKEN",y),p=og(e,t.offset,void 0,null,n,a),v=!1}}return f&&p.anchor===""&&a(f,"BAD_ALIAS","Anchor cannot be an empty string"),o&&e.options.stringKeys&&(!gt(p)||typeof p.value!="string"||p.tag&&p.tag!=="tag:yaml.org,2002:str")&&a(m??t,"NON_STRING_KEY","With stringKeys, all keys must be strings"),c&&(p.spaceBefore=!0),u&&(t.type==="scalar"&&t.source===""?p.comment=u:p.commentBefore=u),e.options.keepSourceTokens&&v&&(p.srcToken=t),p}function og(e,t,n,a,{spaceBefore:o,comment:c,anchor:u,tag:f,end:m},p){const v={type:"scalar",offset:J3(t,n,a),indent:-1,source:""},y=IN(e,v,f,p);return u&&(y.anchor=u.source.substring(1),y.anchor===""&&p(u,"BAD_ALIAS","Anchor cannot be an empty string")),o&&(y.spaceBefore=!0),c&&(y.comment=c,y.range[2]=m),y}function W3({options:e},{offset:t,source:n,end:a},o){const c=new Qp(n.substring(1));c.source===""&&o(t,"BAD_ALIAS","Alias cannot be an empty string"),c.source.endsWith(":")&&o(t+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);const u=t+n.length,f=jl(a,u,e.strict,o);return c.range=[t,u,f.offset],f.comment&&(c.comment=f.comment),c}function e$(e,t,{offset:n,start:a,value:o,end:c},u){const f=Object.assign({_directives:t},e),m=new vd(void 0,f),p={atKey:!1,atRoot:!0,directives:m.directives,options:m.options,schema:m.schema},v=Kr(a,{indicator:"doc-start",next:o??c?.[0],offset:n,onError:u,parentIndent:0,startOnNewline:!0});v.found&&(m.directives.docStart=!0,o&&(o.type==="block-map"||o.type==="block-seq")&&!v.hasNewline&&u(v.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),m.contents=o?BN(p,o,v,u):og(p,v.end,a,null,v,u);const y=m.contents.range[2],b=jl(c,y,!1,u);return b.comment&&(m.comment=b.comment),m.range=[n,y,b.offset],m}function Yo(e){if(typeof e=="number")return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];const{offset:t,source:n}=e;return[t,t+(typeof n=="string"?n.length:1)]}function dS(e){let t="",n=!1,a=!1;for(let o=0;o<e.length;++o){const c=e[o];switch(c[0]){case"#":t+=(t===""?"":a?`
194
-
195
- `:`
196
- `)+(c.substring(1)||" "),n=!0,a=!1;break;case"%":e[o+1]?.[0]!=="#"&&(o+=1),n=!1;break;default:n||(a=!0),n=!1}}return{comment:t,afterEmptyLine:a}}class t${constructor(t={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(n,a,o,c)=>{const u=Yo(n);c?this.warnings.push(new L3(u,a,o)):this.errors.push(new au(u,a,o))},this.directives=new fn({version:t.version||"1.2"}),this.options=t}decorate(t,n){const{comment:a,afterEmptyLine:o}=dS(this.prelude);if(a){const c=t.contents;if(n)t.comment=t.comment?`${t.comment}
197
- ${a}`:a;else if(o||t.directives.docStart||!c)t.commentBefore=a;else if(Mt(c)&&!c.flow&&c.items.length>0){let u=c.items[0];Pt(u)&&(u=u.key);const f=u.commentBefore;u.commentBefore=f?`${a}
198
- ${f}`:a}else{const u=c.commentBefore;c.commentBefore=u?`${a}
199
- ${u}`:a}}n?(Array.prototype.push.apply(t.errors,this.errors),Array.prototype.push.apply(t.warnings,this.warnings)):(t.errors=this.errors,t.warnings=this.warnings),this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:dS(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(t,n=!1,a=-1){for(const o of t)yield*this.next(o);yield*this.end(n,a)}*next(t){switch(t.type){case"directive":this.directives.add(t.source,(n,a,o)=>{const c=Yo(t);c[0]+=n,this.onError(c,"BAD_DIRECTIVE",a,o)}),this.prelude.push(t.source),this.atDirectives=!0;break;case"document":{const n=e$(this.options,this.directives,t,this.onError);this.atDirectives&&!n.directives.docStart&&this.onError(t,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(n,!1),this.doc&&(yield this.doc),this.doc=n,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(t.source);break;case"error":{const n=t.source?`${t.message}: ${JSON.stringify(t.source)}`:t.message,a=new au(Yo(t),"UNEXPECTED_TOKEN",n);this.atDirectives||!this.doc?this.errors.push(a):this.doc.errors.push(a);break}case"doc-end":{if(!this.doc){const a="Unexpected doc-end without preceding document";this.errors.push(new au(Yo(t),"UNEXPECTED_TOKEN",a));break}this.doc.directives.docEnd=!0;const n=jl(t.end,t.offset+t.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),n.comment){const a=this.doc.comment;this.doc.comment=a?`${a}
200
- ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new au(Yo(t),"UNEXPECTED_TOKEN",`Unsupported token ${t.type}`))}}*end(t=!1,n=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(t){const a=Object.assign({_directives:this.directives},this.options),o=new vd(void 0,a);this.atDirectives&&this.onError(n,"MISSING_CHAR","Missing directives-end indicator line"),o.range=[0,n,n],this.decorate(o,!1),yield o}}}const qN="\uFEFF",KN="",HN="",tp="";function n$(e){switch(e){case qN:return"byte-order-mark";case KN:return"doc-mode";case HN:return"flow-error-end";case tp:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
201
- `:case`\r
202
- `:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(e[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}function os(e){switch(e){case void 0:case" ":case`
203
- `:case"\r":case" ":return!0;default:return!1}}const fS=new Set("0123456789ABCDEFabcdef"),s$=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),ru=new Set(",[]{}"),i$=new Set(` ,[]{}
204
- \r `),pm=e=>!e||i$.has(e);class a${constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(t,n=!1){if(t){if(typeof t!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+t:t,this.lineEndPos=null}this.atEnd=!n;let a=this.next??"stream";for(;a&&(n||this.hasChars(1));)a=yield*this.parseNext(a)}atLineEnd(){let t=this.pos,n=this.buffer[t];for(;n===" "||n===" ";)n=this.buffer[++t];return!n||n==="#"||n===`
205
- `?!0:n==="\r"?this.buffer[t+1]===`
206
- `:!1}charAt(t){return this.buffer[this.pos+t]}continueScalar(t){let n=this.buffer[t];if(this.indentNext>0){let a=0;for(;n===" ";)n=this.buffer[++a+t];if(n==="\r"){const o=this.buffer[a+t+1];if(o===`
207
- `||!o&&!this.atEnd)return t+a+1}return n===`
208
- `||a>=this.indentNext||!n&&!this.atEnd?t+a:-1}if(n==="-"||n==="."){const a=this.buffer.substr(t,3);if((a==="---"||a==="...")&&os(this.buffer[t+3]))return-1}return t}getLine(){let t=this.lineEndPos;return(typeof t!="number"||t!==-1&&t<this.pos)&&(t=this.buffer.indexOf(`
209
- `,this.pos),this.lineEndPos=t),t===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[t-1]==="\r"&&(t-=1),this.buffer.substring(this.pos,t))}hasChars(t){return this.pos+t<=this.buffer.length}setNext(t){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=t,null}peek(t){return this.buffer.substr(this.pos,t)}*parseNext(t){switch(t){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let t=this.getLine();if(t===null)return this.setNext("stream");if(t[0]===qN&&(yield*this.pushCount(1),t=t.substring(1)),t[0]==="%"){let n=t.length,a=t.indexOf("#");for(;a!==-1;){const c=t[a-1];if(c===" "||c===" "){n=a-1;break}else a=t.indexOf("#",a+1)}for(;;){const c=t[n-1];if(c===" "||c===" ")n-=1;else break}const o=(yield*this.pushCount(n))+(yield*this.pushSpaces(!0));return yield*this.pushCount(t.length-o),this.pushNewline(),"stream"}if(this.atLineEnd()){const n=yield*this.pushSpaces(!0);return yield*this.pushCount(t.length-n),yield*this.pushNewline(),"stream"}return yield KN,yield*this.parseLineStart()}*parseLineStart(){const t=this.charAt(0);if(!t&&!this.atEnd)return this.setNext("line-start");if(t==="-"||t==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");const n=this.peek(3);if((n==="---"||n==="...")&&os(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,n==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!os(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){const[t,n]=this.peek(2);if(!n&&!this.atEnd)return this.setNext("block-start");if((t==="-"||t==="?"||t===":")&&os(n)){const a=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=a,yield*this.parseBlockStart()}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);const t=this.getLine();if(t===null)return this.setNext("doc");let n=yield*this.pushIndicators();switch(t[n]){case"#":yield*this.pushCount(t.length-n);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(pm),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return n+=yield*this.parseBlockScalarHeader(),n+=yield*this.pushSpaces(!0),yield*this.pushCount(t.length-n),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let t,n,a=-1;do t=yield*this.pushNewline(),t>0?(n=yield*this.pushSpaces(!1),this.indentValue=a=n):n=0,n+=yield*this.pushSpaces(!0);while(t+n>0);const o=this.getLine();if(o===null)return this.setNext("flow");if((a!==-1&&a<this.indentNext&&o[0]!=="#"||a===0&&(o.startsWith("---")||o.startsWith("..."))&&os(o[3]))&&!(a===this.indentNext-1&&this.flowLevel===1&&(o[0]==="]"||o[0]==="}")))return this.flowLevel=0,yield HN,yield*this.parseLineStart();let c=0;for(;o[c]===",";)c+=yield*this.pushCount(1),c+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(c+=yield*this.pushIndicators(),o[c]){case void 0:return"flow";case"#":return yield*this.pushCount(o.length-c),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(pm),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{const u=this.charAt(1);if(this.flowKey||os(u)||u===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){const t=this.charAt(0);let n=this.buffer.indexOf(t,this.pos+1);if(t==="'")for(;n!==-1&&this.buffer[n+1]==="'";)n=this.buffer.indexOf("'",n+2);else for(;n!==-1;){let c=0;for(;this.buffer[n-1-c]==="\\";)c+=1;if(c%2===0)break;n=this.buffer.indexOf('"',n+1)}const a=this.buffer.substring(0,n);let o=a.indexOf(`
210
- `,this.pos);if(o!==-1){for(;o!==-1;){const c=this.continueScalar(o+1);if(c===-1)break;o=a.indexOf(`
211
- `,c)}o!==-1&&(n=o-(a[o-1]==="\r"?2:1))}if(n===-1){if(!this.atEnd)return this.setNext("quoted-scalar");n=this.buffer.length}return yield*this.pushToIndex(n+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let t=this.pos;for(;;){const n=this.buffer[++t];if(n==="+")this.blockScalarKeep=!0;else if(n>"0"&&n<="9")this.blockScalarIndent=Number(n)-1;else if(n!=="-")break}return yield*this.pushUntil(n=>os(n)||n==="#")}*parseBlockScalar(){let t=this.pos-1,n=0,a;e:for(let c=this.pos;a=this.buffer[c];++c)switch(a){case" ":n+=1;break;case`
212
- `:t=c,n=0;break;case"\r":{const u=this.buffer[c+1];if(!u&&!this.atEnd)return this.setNext("block-scalar");if(u===`
213
- `)break}default:break e}if(!a&&!this.atEnd)return this.setNext("block-scalar");if(n>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=n:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{const c=this.continueScalar(t+1);if(c===-1)break;t=this.buffer.indexOf(`
214
- `,c)}while(t!==-1);if(t===-1){if(!this.atEnd)return this.setNext("block-scalar");t=this.buffer.length}}let o=t+1;for(a=this.buffer[o];a===" ";)a=this.buffer[++o];if(a===" "){for(;a===" "||a===" "||a==="\r"||a===`
215
- `;)a=this.buffer[++o];t=o-1}else if(!this.blockScalarKeep)do{let c=t-1,u=this.buffer[c];u==="\r"&&(u=this.buffer[--c]);const f=c;for(;u===" ";)u=this.buffer[--c];if(u===`
216
- `&&c>=this.pos&&c+1+n>f)t=c;else break}while(!0);return yield tp,yield*this.pushToIndex(t+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){const t=this.flowLevel>0;let n=this.pos-1,a=this.pos-1,o;for(;o=this.buffer[++a];)if(o===":"){const c=this.buffer[a+1];if(os(c)||t&&ru.has(c))break;n=a}else if(os(o)){let c=this.buffer[a+1];if(o==="\r"&&(c===`
217
- `?(a+=1,o=`
218
- `,c=this.buffer[a+1]):n=a),c==="#"||t&&ru.has(c))break;if(o===`
219
- `){const u=this.continueScalar(a+1);if(u===-1)break;a=Math.max(a,u-2)}}else{if(t&&ru.has(o))break;n=a}return!o&&!this.atEnd?this.setNext("plain-scalar"):(yield tp,yield*this.pushToIndex(n+1,!0),t?"flow":"doc")}*pushCount(t){return t>0?(yield this.buffer.substr(this.pos,t),this.pos+=t,t):0}*pushToIndex(t,n){const a=this.buffer.slice(this.pos,t);return a?(yield a,this.pos+=a.length,a.length):(n&&(yield""),0)}*pushIndicators(){switch(this.charAt(0)){case"!":return(yield*this.pushTag())+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"&":return(yield*this.pushUntil(pm))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{const t=this.flowLevel>0,n=this.charAt(1);if(os(n)||t&&ru.has(n))return t?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,(yield*this.pushCount(1))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators())}}return 0}*pushTag(){if(this.charAt(1)==="<"){let t=this.pos+2,n=this.buffer[t];for(;!os(n)&&n!==">";)n=this.buffer[++t];return yield*this.pushToIndex(n===">"?t+1:t,!1)}else{let t=this.pos+1,n=this.buffer[t];for(;n;)if(s$.has(n))n=this.buffer[++t];else if(n==="%"&&fS.has(this.buffer[t+1])&&fS.has(this.buffer[t+2]))n=this.buffer[t+=3];else break;return yield*this.pushToIndex(t,!1)}}*pushNewline(){const t=this.buffer[this.pos];return t===`
220
- `?yield*this.pushCount(1):t==="\r"&&this.charAt(1)===`
221
- `?yield*this.pushCount(2):0}*pushSpaces(t){let n=this.pos-1,a;do a=this.buffer[++n];while(a===" "||t&&a===" ");const o=n-this.pos;return o>0&&(yield this.buffer.substr(this.pos,o),this.pos=n),o}*pushUntil(t){let n=this.pos,a=this.buffer[n];for(;!t(a);)a=this.buffer[++n];return yield*this.pushToIndex(n,!1)}}class r${constructor(){this.lineStarts=[],this.addNewLine=t=>this.lineStarts.push(t),this.linePos=t=>{let n=0,a=this.lineStarts.length;for(;n<a;){const c=n+a>>1;this.lineStarts[c]<t?n=c+1:a=c}if(this.lineStarts[n]===t)return{line:n+1,col:1};if(n===0)return{line:0,col:t};const o=this.lineStarts[n-1];return{line:n,col:t-o+1}}}}function _i(e,t){for(let n=0;n<e.length;++n)if(e[n].type===t)return!0;return!1}function hS(e){for(let t=0;t<e.length;++t)switch(e[t].type){case"space":case"comment":case"newline":break;default:return t}return-1}function GN(e){switch(e?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function ou(e){switch(e.type){case"document":return e.start;case"block-map":{const t=e.items[e.items.length-1];return t.sep??t.start}case"block-seq":return e.items[e.items.length-1].start;default:return[]}}function zr(e){if(e.length===0)return[];let t=e.length;e:for(;--t>=0;)switch(e[t].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;e[++t]?.type==="space";);return e.splice(t,e.length)}function mS(e){if(e.start.type==="flow-seq-start")for(const t of e.items)t.sep&&!t.value&&!_i(t.start,"explicit-key-ind")&&!_i(t.sep,"map-value-ind")&&(t.key&&(t.value=t.key),delete t.key,GN(t.value)?t.value.end?Array.prototype.push.apply(t.value.end,t.sep):t.value.end=t.sep:Array.prototype.push.apply(t.start,t.sep),delete t.sep)}class o${constructor(t){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new a$,this.onNewLine=t}*parse(t,n=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(const a of this.lexer.lex(t,n))yield*this.next(a);n||(yield*this.end())}*next(t){if(this.source=t,this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=t.length;return}const n=n$(t);if(n)if(n==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=n,yield*this.step(),n){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+t.length);break;case"space":this.atNewLine&&t[0]===" "&&(this.indent+=t.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=t.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=t.length}else{const a=`Not a YAML token: ${t}`;yield*this.pop({type:"error",offset:this.offset,message:a,source:t}),this.offset+=t.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){const t=this.peek(1);if(this.type==="doc-end"&&t?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!t)return yield*this.stream();switch(t.type){case"document":return yield*this.document(t);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(t);case"block-scalar":return yield*this.blockScalar(t);case"block-map":return yield*this.blockMap(t);case"block-seq":return yield*this.blockSequence(t);case"flow-collection":return yield*this.flowCollection(t);case"doc-end":return yield*this.documentEnd(t)}yield*this.pop()}peek(t){return this.stack[this.stack.length-t]}*pop(t){const n=t??this.stack.pop();if(!n)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield n;else{const a=this.peek(1);switch(n.type==="block-scalar"?n.indent="indent"in a?a.indent:0:n.type==="flow-collection"&&a.type==="document"&&(n.indent=0),n.type==="flow-collection"&&mS(n),a.type){case"document":a.value=n;break;case"block-scalar":a.props.push(n);break;case"block-map":{const o=a.items[a.items.length-1];if(o.value){a.items.push({start:[],key:n,sep:[]}),this.onKeyLine=!0;return}else if(o.sep)o.value=n;else{Object.assign(o,{key:n,sep:[]}),this.onKeyLine=!o.explicitKey;return}break}case"block-seq":{const o=a.items[a.items.length-1];o.value?a.items.push({start:[],value:n}):o.value=n;break}case"flow-collection":{const o=a.items[a.items.length-1];!o||o.value?a.items.push({start:[],key:n,sep:[]}):o.sep?o.value=n:Object.assign(o,{key:n,sep:[]});return}default:yield*this.pop(),yield*this.pop(n)}if((a.type==="document"||a.type==="block-map"||a.type==="block-seq")&&(n.type==="block-map"||n.type==="block-seq")){const o=n.items[n.items.length-1];o&&!o.sep&&!o.value&&o.start.length>0&&hS(o.start)===-1&&(n.indent===0||o.start.every(c=>c.type!=="comment"||c.indent<n.indent))&&(a.type==="document"?a.end=o.start:a.items.push({start:o.start}),n.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{const t={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&t.start.push(this.sourceToken),this.stack.push(t);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(t){if(t.value)return yield*this.lineEnd(t);switch(this.type){case"doc-start":{hS(t.start)!==-1?(yield*this.pop(),yield*this.step()):t.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":t.start.push(this.sourceToken);return}const n=this.startBlockValue(t);n?this.stack.push(n):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(t){if(this.type==="map-value-ind"){const n=ou(this.peek(2)),a=zr(n);let o;t.end?(o=t.end,o.push(this.sourceToken),delete t.end):o=[this.sourceToken];const c={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:a,key:t,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=c}else yield*this.lineEnd(t)}*blockScalar(t){switch(this.type){case"space":case"comment":case"newline":t.props.push(this.sourceToken);return;case"scalar":if(t.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let n=this.source.indexOf(`
222
- `)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
223
- `,n)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(t){const n=t.items[t.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,n.value){const a="end"in n.value?n.value.end:void 0;(Array.isArray(a)?a[a.length-1]:void 0)?.type==="comment"?a?.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)t.items.push({start:[this.sourceToken]});else if(n.sep)n.sep.push(this.sourceToken);else{if(this.atIndentedComment(n.start,t.indent)){const o=t.items[t.items.length-2]?.value?.end;if(Array.isArray(o)){Array.prototype.push.apply(o,n.start),o.push(this.sourceToken),t.items.pop();return}}n.start.push(this.sourceToken)}return}if(this.indent>=t.indent){const a=!this.onKeyLine&&this.indent===t.indent,o=a&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind";let c=[];if(o&&n.sep&&!n.value){const u=[];for(let f=0;f<n.sep.length;++f){const m=n.sep[f];switch(m.type){case"newline":u.push(f);break;case"space":break;case"comment":m.indent>t.indent&&(u.length=0);break;default:u.length=0}}u.length>=2&&(c=n.sep.splice(u[1]))}switch(this.type){case"anchor":case"tag":o||n.value?(c.push(this.sourceToken),t.items.push({start:c}),this.onKeyLine=!0):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"explicit-key-ind":!n.sep&&!n.explicitKey?(n.start.push(this.sourceToken),n.explicitKey=!0):o||n.value?(c.push(this.sourceToken),t.items.push({start:c,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(n.explicitKey)if(n.sep)if(n.value)t.items.push({start:[],key:null,sep:[this.sourceToken]});else if(_i(n.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:c,key:null,sep:[this.sourceToken]}]});else if(GN(n.key)&&!_i(n.sep,"newline")){const u=zr(n.start),f=n.key,m=n.sep;m.push(this.sourceToken),delete n.key,delete n.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:u,key:f,sep:m}]})}else c.length>0?n.sep=n.sep.concat(c,this.sourceToken):n.sep.push(this.sourceToken);else if(_i(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{const u=zr(n.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:u,key:null,sep:[this.sourceToken]}]})}else n.sep?n.value||o?t.items.push({start:c,key:null,sep:[this.sourceToken]}):_i(n.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const u=this.flowScalar(this.type);o||n.value?(t.items.push({start:c,key:u,sep:[]}),this.onKeyLine=!0):n.sep?this.stack.push(u):(Object.assign(n,{key:u,sep:[]}),this.onKeyLine=!0);return}default:{const u=this.startBlockValue(t);if(u){if(u.type==="block-seq"){if(!n.explicitKey&&n.sep&&!_i(n.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else a&&t.items.push({start:c});this.stack.push(u);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(t){const n=t.items[t.items.length-1];switch(this.type){case"newline":if(n.value){const a="end"in n.value?n.value.end:void 0;(Array.isArray(a)?a[a.length-1]:void 0)?.type==="comment"?a?.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)t.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(n.start,t.indent)){const o=t.items[t.items.length-2]?.value?.end;if(Array.isArray(o)){Array.prototype.push.apply(o,n.start),o.push(this.sourceToken),t.items.pop();return}}n.start.push(this.sourceToken)}return;case"anchor":case"tag":if(n.value||this.indent<=t.indent)break;n.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==t.indent)break;n.value||_i(n.start,"seq-item-ind")?t.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return}if(this.indent>t.indent){const a=this.startBlockValue(t);if(a){this.stack.push(a);return}}yield*this.pop(),yield*this.step()}*flowCollection(t){const n=t.items[t.items.length-1];if(this.type==="flow-error-end"){let a;do yield*this.pop(),a=this.peek(1);while(a?.type==="flow-collection")}else if(t.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!n||n.sep?t.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return;case"map-value-ind":!n||n.value?t.items.push({start:[],key:null,sep:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!n||n.value?t.items.push({start:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const o=this.flowScalar(this.type);!n||n.value?t.items.push({start:[],key:o,sep:[]}):n.sep?this.stack.push(o):Object.assign(n,{key:o,sep:[]});return}case"flow-map-end":case"flow-seq-end":t.end.push(this.sourceToken);return}const a=this.startBlockValue(t);a?this.stack.push(a):(yield*this.pop(),yield*this.step())}else{const a=this.peek(2);if(a.type==="block-map"&&(this.type==="map-value-ind"&&a.indent===t.indent||this.type==="newline"&&!a.items[a.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&a.type!=="flow-collection"){const o=ou(a),c=zr(o);mS(t);const u=t.end.splice(1,t.end.length);u.push(this.sourceToken);const f={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:c,key:t,sep:u}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=f}else yield*this.lineEnd(t)}}flowScalar(t){if(this.onNewLine){let n=this.source.indexOf(`
224
- `)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
225
- `,n)+1}return{type:t,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(t){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;const n=ou(t),a=zr(n);return a.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:a,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;const n=ou(t),a=zr(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:a,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(t,n){return this.type!=="comment"||this.indent<=n?!1:t.every(a=>a.type==="newline"||a.type==="space")}*documentEnd(t){this.type!=="doc-mode"&&(t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(t){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}}function l$(e){const t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new r$||null,prettyErrors:t}}function c$(e,t={}){const{lineCounter:n,prettyErrors:a}=l$(t),o=new o$(n?.addNewLine),c=new t$(t),u=Array.from(c.compose(o.parse(e)));if(a&&n)for(const f of u)f.errors.forEach(cS(e,n)),f.warnings.forEach(cS(e,n));return u.length>0?u:Object.assign([],{empty:!0},c.streamInfo())}function u$({onApplied:e}){const[t,n]=w.useState(""),[a,o]=w.useState(!1),[c,u]=w.useState([]),[f,m]=w.useState([]),p=async()=>{if(!t.trim())return;o(!0),u([]),m([]);const v=c$(t),y=[],b=[];for(let x=0;x<v.length;x++){const N=v[x];if(N.errors.length>0){y.push(`Document ${x+1}: ${N.errors[0]?.message}`);continue}const S=N.toJSON();if(!(!S||typeof S!="object"))try{const C=await S2(S);b.push(`Applied "${C.displayName||C.name}" (revision ${C.configRevision})`)}catch(C){y.push(`Document ${x+1}: ${C instanceof Error?C.message:String(C)}`)}}u(b),m(y),o(!1),b.length>0&&(Fe({title:"YAML applied",detail:`Applied ${b.length} document${b.length===1?"":"s"} successfully.`,tone:y.length>0?"caution":"positive",dedupeKey:"yaml:apply",dedupeMode:"replace"}),e())};return r.jsxs("section",{className:"mt-8",children:[r.jsx("div",{className:"page-section-divider"}),r.jsx("div",{className:"section-head mt-6",children:r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Config as code"}),r.jsx("h2",{className:"text-sm font-medium text-zinc-200",children:"Apply YAML"})]})}),r.jsxs("p",{className:"text-zinc-500 text-sm mb-3",children:["Paste a ",r.jsx("code",{className:"text-zinc-400",children:"canonry.yaml"})," config (multi-document YAML with ",r.jsx("code",{className:"text-zinc-400",children:"---"})," separators supported)."]}),r.jsx("textarea",{className:"setup-input w-full font-mono text-xs",rows:10,placeholder:`apiVersion: canonry/v1
226
- kind: Project
227
- metadata:
228
- name: my-project
229
- spec:
230
- canonicalDomain: example.com
231
- country: US
232
- language: en
233
- keywords: []`,value:t,onChange:v=>n(v.target.value)}),c.length>0&&r.jsx("ul",{className:"mt-2 space-y-1",children:c.map((v,y)=>r.jsx("li",{className:"text-emerald-400 text-sm",children:v},y))}),f.length>0&&r.jsx("ul",{className:"mt-2 space-y-1",children:f.map((v,y)=>r.jsx("li",{className:"text-rose-400 text-sm",children:v},y))}),r.jsx("div",{className:"mt-3",children:r.jsx(oe,{type:"button",disabled:!t.trim()||a,onClick:p,children:a?"Applying...":"Apply"})})]})}function d$(){const{dashboard:e,isLoading:t,refetch:n}=La();if(!e||t)return r.jsxs("div",{className:"page-skeleton",children:[r.jsxs("div",{className:"page-skeleton-header",children:[r.jsx("div",{className:"skeleton-text h-6 w-28"}),r.jsx("div",{className:"skeleton-text-sm w-40"})]}),r.jsxs("div",{className:"rounded-xl border border-zinc-800/60 bg-zinc-900/30 overflow-hidden",children:[r.jsx("div",{className:"p-3 border-b border-zinc-800/60 flex gap-8",children:["Name","Domain","Visibility","Last run","Country"].map(E=>r.jsx("div",{className:"skeleton-text-sm w-16"},E))}),[1,2,3].map(E=>r.jsxs("div",{className:"p-3 border-b border-zinc-800/40 flex gap-8 items-center",children:[r.jsxs("div",{className:"flex-1 space-y-1",children:[r.jsx("div",{className:"skeleton-text w-28"}),r.jsx("div",{className:"skeleton-text-sm w-16"})]}),r.jsx("div",{className:"skeleton-text w-24"}),r.jsx("div",{className:"skeleton h-5 w-14 rounded-full"}),r.jsx("div",{className:"skeleton h-5 w-16 rounded-full"}),r.jsx("div",{className:"skeleton-text-sm w-8"})]},E))]})]});const a=e.projects,o=Bi(),[c,u]=w.useState(!1),[f,m]=w.useState(""),[p,v]=w.useState(""),[y,b]=w.useState(""),[x,N]=w.useState("US"),[S,C]=w.useState("en"),[k,T]=w.useState(!1),[A,z]=w.useState(null),$=f.toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,""),P=async()=>{if(!(!$||!y)){T(!0),z(null);try{const E=await Vu($,{displayName:p||f,canonicalDomain:y,country:x,language:S});Fe({title:"Project created",detail:`${E.displayName||E.name} is ready to configure.`,tone:"positive",dedupeKey:`project:create:${E.name}`,dedupeMode:"drop"}),n(),m(""),v(""),b(""),N("US"),C("en"),u(!1),o({to:"/projects/$projectId",params:{projectId:E.id}})}catch(E){z(E instanceof Error?E.message:"Failed to create project")}finally{T(!1)}}};return r.jsxs("div",{className:"page-container",children:[r.jsxs("div",{className:"page-header",children:[r.jsxs("div",{className:"page-header-left",children:[r.jsx("h1",{className:"page-title",children:"Projects"}),r.jsxs("p",{className:"page-subtitle",children:[a.length," project",a.length!==1?"s":""," tracked"]})]}),r.jsx("div",{className:"page-header-right",children:r.jsxs(oe,{type:"button",onClick:()=>u(E=>!E),children:[r.jsx(ex,{className:"size-4 mr-1.5"}),"Add project"]})})]}),c?r.jsxs(Le,{className:"surface-card mb-6",children:[r.jsx("div",{className:"section-head",children:r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"New project"}),r.jsx("h2",{className:"text-sm font-medium text-zinc-200",children:"Create a new monitoring project"})]})}),r.jsxs("div",{className:"compact-stack mt-4",children:[r.jsxs("div",{className:"setup-field-row",children:[r.jsxs("div",{className:"setup-field",children:[r.jsx("label",{className:"setup-label",htmlFor:"new-project-name",children:"Project name"}),r.jsx("input",{id:"new-project-name",className:"setup-input",type:"text",placeholder:"my-project",value:f,onChange:E=>m(E.target.value)}),$&&$!==f?r.jsxs("p",{className:"supporting-copy",children:["Slug: ",$]}):null]}),r.jsxs("div",{className:"setup-field",children:[r.jsx("label",{className:"setup-label",htmlFor:"new-display-name",children:"Display name"}),r.jsx("input",{id:"new-display-name",className:"setup-input",type:"text",placeholder:"My Project",value:p,onChange:E=>v(E.target.value)})]})]}),r.jsxs("div",{className:"setup-field",children:[r.jsx("label",{className:"setup-label",htmlFor:"new-domain",children:"Canonical domain"}),r.jsx("input",{id:"new-domain",className:"setup-input",type:"text",placeholder:"example.com",value:y,onChange:E=>b(E.target.value)})]}),r.jsxs("div",{className:"setup-field-row",children:[r.jsxs("div",{className:"setup-field",children:[r.jsx("label",{className:"setup-label",htmlFor:"new-country",children:"Country"}),r.jsx("input",{id:"new-country",className:"setup-input",type:"text",placeholder:"US",maxLength:2,value:x,onChange:E=>N(E.target.value.toUpperCase())})]}),r.jsxs("div",{className:"setup-field",children:[r.jsx("label",{className:"setup-label",htmlFor:"new-language",children:"Language"}),r.jsx("input",{id:"new-language",className:"setup-input",type:"text",placeholder:"en",maxLength:5,value:S,onChange:E=>C(E.target.value.toLowerCase())})]})]})]}),A?r.jsx("p",{className:"text-rose-400 text-sm mt-3",children:A}):null,r.jsxs("div",{className:"flex items-center gap-3 mt-4",children:[r.jsx(oe,{type:"button",disabled:!$||!y||k,onClick:P,children:k?"Creating...":"Create project"}),r.jsx(oe,{type:"button",variant:"ghost",onClick:()=>u(!1),children:"Cancel"})]})]}):null,a.length>0?r.jsx("div",{className:"data-table-wrapper",children:r.jsxs("table",{className:"data-table",children:[r.jsx("thead",{children:r.jsxs("tr",{children:[r.jsx("th",{children:"Name"}),r.jsx("th",{children:"Domain"}),r.jsx("th",{children:"Visibility"}),r.jsx("th",{children:"Last run"}),r.jsx("th",{className:"text-right",children:"Country"})]})}),r.jsx("tbody",{children:a.map(E=>{const O=E.recentRuns[0];return r.jsxs("tr",{className:"cursor-pointer",onClick:()=>o({to:"/projects/$projectId",params:{projectId:E.project.id}}),children:[r.jsxs("td",{children:[r.jsx(St,{to:"/projects/$projectId",params:{projectId:E.project.id},className:"text-zinc-100 font-medium hover:underline",onClick:K=>K.stopPropagation(),children:E.project.displayName||E.project.name}),r.jsx("p",{className:"text-[11px] text-zinc-500",children:E.project.name})]}),r.jsx("td",{className:"text-zinc-400",children:E.project.canonicalDomain}),r.jsx("td",{children:r.jsx(lt,{tone:E.visibilitySummary.tone,children:E.visibilitySummary.value})}),r.jsx("td",{className:"text-zinc-500 text-sm",children:O?r.jsx(ed,{status:O.status}):r.jsx("span",{className:"text-zinc-600",children:"No runs"})}),r.jsx("td",{className:"text-right text-zinc-500",children:E.project.country})]},E.project.id)})})]})}):c?null:r.jsxs(Le,{className:"surface-card empty-card",children:[r.jsx("h3",{children:"No projects yet"}),r.jsx("p",{className:"supporting-copy",children:"Create your first monitoring project to start tracking AI visibility."}),r.jsxs(oe,{type:"button",onClick:()=>u(!0),children:[r.jsx(ex,{className:"size-4 mr-1.5"}),"Add project"]})]}),r.jsx(u$,{onApplied:()=>{n()}})]})}function np({state:e}){return r.jsx(lt,{tone:QA(e),children:Ju(e)})}function FN({run:e}){const{openRun:t}=Zr();return r.jsxs("article",{className:"run-row",children:[r.jsxs("div",{className:"run-row-main",children:[r.jsxs("div",{className:"run-row-head",children:[r.jsxs("div",{children:[r.jsx("p",{className:"run-row-title",children:e.summary}),r.jsxs("p",{className:"run-row-subtitle",children:[e.projectName,e.location?` · ${e.location}`:""," · ",e.kindLabel]})]}),r.jsx(ed,{status:e.status})]}),r.jsx("p",{className:"run-row-detail",children:e.statusDetail})]}),r.jsxs("dl",{className:"run-row-meta",children:[r.jsxs("div",{children:[r.jsx("dt",{children:"Started"}),r.jsx("dd",{children:e.startedAt})]}),r.jsxs("div",{children:[r.jsx("dt",{children:"Duration"}),r.jsx("dd",{children:e.duration})]}),r.jsxs("div",{children:[r.jsx("dt",{children:"Trigger"}),r.jsx("dd",{children:e.triggerLabel})]})]}),r.jsx(oe,{variant:"outline",size:"sm",type:"button",onClick:()=>t(e.id),children:"View run"})]})}function ZN({value:e,label:t,delta:n,tone:a,description:o,tooltip:c,isNumeric:u=!0,progress:f}){const v=2*Math.PI*48,y=Number.parseInt(e,10),b=typeof f=="number"&&Number.isFinite(f)?Math.min(Math.max(f,0),1):u&&!Number.isNaN(y)?Math.min(y/100,1):.5,x=v*(1-b);return r.jsxs("div",{className:"score-gauge",children:[r.jsxs("div",{className:"gauge-ring-wrapper",children:[r.jsxs("svg",{className:"gauge-ring",viewBox:"0 0 120 120","aria-hidden":"true",children:[r.jsx("circle",{className:"gauge-bg",cx:"60",cy:"60",r:48,strokeWidth:6}),r.jsx("circle",{className:`gauge-fill gauge-fill-${a}`,cx:"60",cy:"60",r:48,strokeWidth:6,strokeDasharray:v,strokeDashoffset:x,transform:"rotate(-90 60 60)"})]}),r.jsx("div",{className:"gauge-center",children:r.jsx("span",{className:u?"gauge-value":"gauge-value-text",children:e.split(" / ")[0]})})]}),r.jsxs("p",{className:"gauge-label",children:[t,c&&r.jsx(hn,{text:c})]}),r.jsx("p",{className:"gauge-delta",children:n}),r.jsx("p",{className:"gauge-description",children:o})]})}function pS({history:e,maxDots:t=12}){const n=e.slice(-t);if(n.length===0)return r.jsx("span",{className:"text-[11px] text-zinc-600",children:"No data"});const a={cited:"bg-emerald-400","not-cited":"bg-zinc-600",lost:"bg-rose-400",emerging:"bg-amber-400 ring-1 ring-amber-300/60"},o=new Date(n[0].createdAt).toLocaleDateString(void 0,{month:"short",day:"numeric"}),c=new Date(n[n.length-1].createdAt).toLocaleDateString(void 0,{month:"short",day:"numeric"});return r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("span",{className:"text-[9px] text-zinc-600 shrink-0",children:o}),r.jsx("div",{className:"flex items-center gap-[3px]",title:`${n.length} runs`,children:n.map((u,f)=>r.jsx("div",{className:`h-2.5 w-2.5 rounded-sm ${a[u.citationState]??"bg-zinc-700"} ${u.model&&f>0&&n[f-1]?.model&&n[f-1].model!==u.model?"ring-1 ring-amber-300/80 ring-offset-1 ring-offset-zinc-950":""}`,title:[u.citationState,new Date(u.createdAt).toLocaleDateString(),u.model?`model ${u.model}`:null,u.model&&f>0&&n[f-1]?.model&&n[f-1].model!==u.model?"model changed":null].filter(Boolean).join(" — ")},f))}),r.jsx("span",{className:"text-[9px] text-zinc-600 shrink-0",children:c})]})}function f$(e){const t=new Map;for(const a of e)for(const o of a.runHistory){const c=t.get(o.createdAt);c?c.states.push(o.citationState):t.set(o.createdAt,{states:[o.citationState],runId:o.runId})}return[...t.entries()].sort(([a],[o])=>a.localeCompare(o)).map(([a,{states:o,runId:c}])=>({runId:c,createdAt:a,citationState:o.includes("cited")?"cited":o.includes("emerging")?"emerging":"not-cited"}))}function h$({evidence:e}){const{openEvidence:t}=Zr(),[n,a]=w.useState(new Set),o=w.useMemo(()=>{const u=new Map;for(const f of e){const m=u.get(f.keyword)??[];u.set(f.keyword,[...m,f])}return[...u.entries()].map(([f,m])=>({phrase:f,items:m}))},[e]),c=u=>{a(f=>{const m=new Set(f);return m.has(u)?m.delete(u):m.add(u),m})};return r.jsx("div",{className:"evidence-table-wrap",children:r.jsxs("table",{className:"evidence-table",children:[r.jsx("thead",{children:r.jsxs("tr",{children:[r.jsx("th",{style:{width:"2rem"}}),r.jsx("th",{children:"Key Phrase"}),r.jsx("th",{children:"Status"}),r.jsx("th",{children:"Citation History"}),r.jsx("th",{children:"Change"}),r.jsx("th",{})]})}),r.jsx("tbody",{children:o.map(({phrase:u,items:f})=>{const m=n.has(u),p=f.map(N=>N.citationState),v=p.includes("cited")?"cited":p.includes("emerging")?"emerging":p.includes("lost")?"lost":p.every(N=>N==="pending")?"pending":"not-cited",y=f$(f),b=f.filter(N=>N.citationState==="cited"||N.citationState==="emerging").length,x=(()=>{if(y.length===0)return"Awaiting first run";if(y.length===1)return"First observation";const N=y[y.length-1].citationState,S=y[y.length-2].citationState;if(S!=="cited"&&N==="cited")return"Newly cited";if(S==="cited"&&N!=="cited")return"Lost since last run";let C=0;for(let k=y.length-1;k>=0&&y[k].citationState===N;k--)C++;return N==="cited"?C<=1?"Cited in latest run":`Cited for ${C} runs`:C<=1?"Not cited in latest run":`Not cited across ${C} runs`})();return r.jsxs(w.Fragment,{children:[r.jsxs("tr",{className:"evidence-phrase-row cursor-pointer hover:bg-zinc-800/40",onClick:()=>c(u),"aria-expanded":m,children:[r.jsx("td",{children:r.jsx(Qu,{size:14,className:`transition-transform duration-150 text-zinc-500 ${m?"rotate-90":""}`})}),r.jsx("td",{className:"evidence-keyword-cell",children:r.jsxs("div",{children:[r.jsx("span",{className:"font-medium text-zinc-100",children:u}),r.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:f.map(N=>r.jsx(ll,{provider:N.provider},N.id))})]})}),r.jsx("td",{children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(np,{state:v}),r.jsxs("span",{className:"text-[11px] text-zinc-500",children:[b,"/",f.length]})]})}),r.jsx("td",{children:r.jsx(pS,{history:y})}),r.jsx("td",{className:"evidence-change-cell",children:x}),r.jsx("td",{})]}),m&&f.map(N=>r.jsxs("tr",{className:"bg-zinc-900/30",children:[r.jsx("td",{}),r.jsx("td",{className:"evidence-keyword-cell pl-5",children:r.jsx(ll,{provider:N.provider})}),r.jsx("td",{children:r.jsx(np,{state:N.citationState})}),r.jsx("td",{children:r.jsx(pS,{history:N.runHistory})}),r.jsx("td",{className:"evidence-change-cell",children:N.changeLabel}),r.jsx("td",{children:r.jsx(oe,{variant:"ghost",size:"sm",type:"button",onClick:S=>{S.stopPropagation(),t(N.id)},children:"View"})})]},N.id))]},u)})})]})})}function m$({competitors:e}){return e.length===0?r.jsx("p",{className:"text-sm text-zinc-500",children:"No competitors configured. Add competitors to track overlap."}):r.jsx("div",{className:"competitor-table-wrap",children:r.jsxs("table",{className:"competitor-table",children:[r.jsx("thead",{children:r.jsxs("tr",{children:[r.jsx("th",{children:"Domain"}),r.jsx("th",{children:"Pressure"}),r.jsx("th",{children:"Citations"}),r.jsx("th",{children:"Key Phrases"})]})}),r.jsx("tbody",{children:e.map(t=>r.jsxs("tr",{children:[r.jsx("td",{className:"font-medium text-zinc-100",children:t.domain}),r.jsx("td",{children:r.jsx(lt,{tone:YA(t.pressureLabel),children:t.pressureLabel})}),r.jsx("td",{className:"text-zinc-300 tabular-nums",children:t.totalKeywords>0?`${t.citationCount} / ${t.totalKeywords}`:"—"}),r.jsx("td",{className:"text-zinc-500 text-xs",children:t.citedKeywords.length>0?t.citedKeywords.join(", "):"Not cited"})]},t.id))})]})})}const p$=["7d","30d","90d","all"],g$=["gap","cited","uncited"],VN={forum:"bg-amber-500",social:"bg-blue-500",news:"bg-zinc-400",reference:"bg-purple-500",blog:"bg-emerald-500",ecommerce:"bg-orange-500",video:"bg-red-500",academic:"bg-cyan-500",other:"bg-zinc-600"};function y$({projectName:e}){const[t,n]=w.useState("30d"),[a,o]=w.useState(null),[c,u]=w.useState(null),[f,m]=w.useState(null),[p,v]=w.useState(null),[y,b]=w.useState(!0);return w.useEffect(()=>{let x=!1;return b(!0),Promise.all([K2(e,t),H2(e,t),G2(e,t)]).then(([N,S,C])=>{x||(o(N),u(S),m(C),b(!1))}).catch(()=>{x||b(!1)}),()=>{x=!0}},[e,t]),y&&!a?r.jsx("p",{className:"text-sm text-zinc-500 py-8 text-center",children:"Loading analytics…"}):r.jsxs(r.Fragment,{children:[r.jsxs("section",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-zinc-500 mb-1",children:"Citation Metrics"}),r.jsxs("h2",{className:"text-base font-semibold text-zinc-50 flex items-center gap-1.5",children:["Citation Rate Trends ",r.jsx(hn,{text:"Citation rate over time across all runs within the selected window. Each data point represents the percentage of queries where your brand was cited by AI providers."})]})]}),r.jsx("div",{className:"flex gap-1",children:p$.map(x=>r.jsx("button",{type:"button",className:`px-3 py-1 text-xs rounded-full border transition-colors ${t===x?"bg-zinc-700 border-zinc-600 text-zinc-50":"border-zinc-800 text-zinc-400 hover:border-zinc-700 hover:text-zinc-300"}`,onClick:()=>n(x),children:x==="all"?"All":x},x))})]}),a&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-6",children:[r.jsx(ZN,{value:`${Math.round(a.overall.citationRate*100)}`,label:"Citation Rate",delta:`${a.overall.cited} / ${a.overall.total}`,tone:a.trend==="improving"?"positive":a.trend==="declining"?"negative":"neutral",description:`Trend: ${a.trend}`,isNumeric:!0}),r.jsxs("div",{className:"flex-1 space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-xs text-zinc-500",children:"Trend"}),r.jsx(lt,{tone:a.trend==="improving"?"positive":a.trend==="declining"?"negative":"neutral",children:a.trend})]}),Object.keys(a.byProvider).length>0&&r.jsxs("table",{className:"w-full text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"text-[10px] uppercase tracking-wider text-zinc-500",children:[r.jsx("th",{className:"text-left py-1 font-medium",children:"Provider"}),r.jsx("th",{className:"text-right py-1 font-medium",children:"Rate"}),r.jsx("th",{className:"text-right py-1 font-medium",children:"Cited / Total"})]})}),r.jsx("tbody",{children:Object.entries(a.byProvider).map(([x,N])=>r.jsxs("tr",{className:"border-t border-zinc-800/40",children:[r.jsx("td",{className:"py-1.5 text-zinc-300",children:x}),r.jsxs("td",{className:"py-1.5 text-right text-zinc-200",children:[(N.citationRate*100).toFixed(1),"%"]}),r.jsxs("td",{className:"py-1.5 text-right text-zinc-400",children:[N.cited," / ",N.total]})]},x))})]})]})]}),a.buckets.length>=1&&r.jsx(v$,{buckets:a.buckets,keywordChanges:a.keywordChanges??[]})]})]}),r.jsx("div",{className:"page-section-divider"}),r.jsxs("section",{children:[r.jsx("div",{className:"flex items-center justify-between mb-4",children:r.jsxs("div",{children:[r.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-zinc-500 mb-1",children:"Opportunity Analysis"}),r.jsxs("h2",{className:"text-base font-semibold text-zinc-50 flex items-center gap-1.5",children:["Brand Gap Analysis ",r.jsx(hn,{text:"Classification based on the most recent completed run. Cited: your brand appeared in the AI answer. Gap: a competitor was cited but you were not. Not Cited: neither mentioned. Consistency shows how often each key phrase was cited across all runs in the selected window."})]})]})}),c&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"flex gap-1 mb-4",children:g$.map(x=>{const N=x==="cited"?c.cited.length:x==="gap"?c.gap.length:c.uncited.length,S=p===x;return r.jsxs("button",{type:"button",className:`px-3 py-1 text-xs rounded-full border transition-colors ${S?x==="gap"?"bg-amber-900/40 border-amber-700/60 text-amber-300":x==="cited"?"bg-emerald-900/40 border-emerald-700/60 text-emerald-300":"bg-zinc-800/40 border-zinc-700 text-zinc-300":"border-zinc-800 text-zinc-400 hover:border-zinc-700"}`,onClick:()=>v(S?null:x),children:[x==="gap"?"Gap":x==="cited"?"Cited":"Not Cited"," (",N,")"]},x)})}),r.jsx(b$,{gaps:c,filter:p})]})]}),r.jsx("div",{className:"page-section-divider"}),r.jsxs("section",{children:[r.jsxs("div",{className:"mb-4",children:[r.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-zinc-500 mb-1",children:"Source Intelligence"}),r.jsxs("h2",{className:"text-base font-semibold text-zinc-50 flex items-center gap-1.5",children:["Source Origin Breakdown ",r.jsx(hn,{text:"Aggregated across all runs in the selected window. Shows what types of websites AI engines cite as grounding sources. More runs = more statistically meaningful breakdown."})]})]}),f&&f.overall.length>0&&r.jsxs("div",{className:"space-y-4",children:[r.jsx(x$,{categories:f.overall}),r.jsxs("table",{className:"w-full text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"text-[10px] uppercase tracking-wider text-zinc-500",children:[r.jsx("th",{className:"text-left py-1 font-medium",children:"Category"}),r.jsx("th",{className:"text-right py-1 font-medium",children:"Count"}),r.jsx("th",{className:"text-right py-1 font-medium",children:"%"}),r.jsx("th",{className:"text-left py-1 pl-4 font-medium",children:"Top Sources"})]})}),r.jsx("tbody",{children:f.overall.map(x=>r.jsxs("tr",{className:"border-t border-zinc-800/40",children:[r.jsxs("td",{className:"py-1.5 text-zinc-300 flex items-center gap-2",children:[r.jsx("span",{className:`inline-block w-2 h-2 rounded-full ${VN[x.category]??"bg-zinc-600"}`}),x.label]}),r.jsx("td",{className:"py-1.5 text-right text-zinc-200",children:x.count}),r.jsxs("td",{className:"py-1.5 text-right text-zinc-400",children:[(x.percentage*100).toFixed(1),"%"]}),r.jsx("td",{className:"py-1.5 pl-4 text-zinc-500 text-xs truncate max-w-[200px]",children:x.topDomains.slice(0,3).map(N=>N.domain).join(", ")})]},x.category))})]})]}),f&&f.overall.length===0&&r.jsx("p",{className:"text-sm text-zinc-500 py-4",children:"No source data available. Run a visibility sweep first."})]})]})}function v$({buckets:e,keywordChanges:t}){const[n,a]=w.useState(null),o=600,c=140,u={top:30,right:10,bottom:20,left:40},f=o-u.left-u.right,m=c-u.top-u.bottom,p=1,v=e.map((x,N)=>{const S=u.left+(e.length>1?N/(e.length-1)*f:f/2),C=u.top+m-x.citationRate/p*m;return{x:S,y:C}}),y=w.useMemo(()=>{if(!t||t.length===0||e.length<2)return[];const x=new Date(e[0].startDate).getTime(),S=new Date(e[e.length-1].startDate).getTime()-x;return S<=0?[]:t.map(C=>{const T=(new Date(C.date).getTime()-x)/S;return T<0||T>1?null:{...C,x:u.left+T*f}}).filter(C=>C!==null)},[e,t,u.left,f]),b=v.map(x=>`${x.x},${x.y}`).join(" ");return r.jsxs("div",{className:"surface-card rounded-lg p-3 border border-zinc-800/60",children:[r.jsx("p",{className:"text-[10px] text-zinc-500 mb-1 flex items-center gap-1",children:"kp = key phrases tracked in this window"}),r.jsxs("svg",{viewBox:`0 0 ${o} ${c}`,className:"w-full h-auto","aria-label":"Citation rate trend chart",onMouseLeave:()=>a(null),children:[r.jsxs("text",{x:u.left-4,y:u.top+4,textAnchor:"end",className:"fill-zinc-500",fontSize:"9",children:[(p*100).toFixed(0),"%"]}),r.jsx("text",{x:u.left-4,y:u.top+m+4,textAnchor:"end",className:"fill-zinc-500",fontSize:"9",children:"0%"}),r.jsx("line",{x1:u.left,y1:u.top+m,x2:u.left+f,y2:u.top+m,stroke:"currentColor",className:"text-zinc-800",strokeWidth:"0.5"}),r.jsx("polyline",{fill:"none",stroke:"currentColor",className:"text-emerald-500",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",points:b}),y.map((x,N)=>r.jsxs("g",{children:[r.jsx("line",{x1:x.x,y1:u.top,x2:x.x,y2:u.top+m,stroke:"currentColor",className:"text-zinc-600",strokeWidth:"0.5",strokeDasharray:"4 2"}),r.jsx("text",{x:x.x,y:u.top-6,textAnchor:"middle",className:"fill-zinc-500",fontSize:"7",fontWeight:"500",children:x.label})]},`kw-change-${N}`)),n!==null&&r.jsx("line",{x1:v[n].x,y1:u.top,x2:v[n].x,y2:u.top+m,stroke:"currentColor",className:"text-zinc-600",strokeWidth:"0.5",strokeDasharray:"3 2"}),e.map((x,N)=>{const{x:S,y:C}=v[N],k=n===N;return r.jsxs("g",{children:[r.jsx("circle",{cx:S,cy:C,r:"10",fill:"transparent",onMouseEnter:()=>a(N),style:{cursor:"pointer"}}),r.jsx("circle",{cx:S,cy:C,r:k?5:3,className:k?"fill-emerald-400":"fill-emerald-500"})]},N)}),n!==null&&(()=>{const x=e[n],{x:N,y:S}=v[n],C=`${(x.citationRate*100).toFixed(1)}%`,k=x.keywordCount?`${x.keywordCount} kp`:"",T=56,A=30,z=Math.max(u.left,Math.min(N-T/2,o-u.right-T)),$=S-A-8;return r.jsxs("g",{children:[r.jsx("rect",{x:z,y:$,width:T,height:A,rx:"4",className:"fill-zinc-800",stroke:"currentColor",strokeWidth:"0.5"}),r.jsx("text",{x:z+T/2,y:$+13,textAnchor:"middle",className:"fill-zinc-50",fontSize:"11",fontWeight:"600",children:C}),k&&r.jsx("text",{x:z+T/2,y:$+24,textAnchor:"middle",className:"fill-zinc-400",fontSize:"8",children:k})]})})(),e.map((x,N)=>({b:x,i:N})).filter(({i:x})=>x===0||x===e.length-1||e.length<=7).map(({b:x,i:N})=>{const S=v[N].x;return r.jsx("text",{x:S,y:c-2,textAnchor:"middle",className:"fill-zinc-500",fontSize:"8",children:x.startDate.slice(5,10)},N)})]})]})}function b$({gaps:e,filter:t}){const n=w.useMemo(()=>{const a=[...e.gap.map(o=>({...o,_sort:0})),...e.cited.map(o=>({...o,_sort:1})),...e.uncited.map(o=>({...o,_sort:2}))];return t?a.filter(o=>o.category===t):a.sort((o,c)=>o._sort-c._sort)},[e,t]);return n.length===0?r.jsxs("p",{className:"text-sm text-zinc-500 py-4",children:["No key phrases found",t?` with status "${t}"`:"","."]}):r.jsxs("table",{className:"w-full text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"text-[10px] uppercase tracking-wider text-zinc-500",children:[r.jsx("th",{className:"text-left py-1 font-medium",children:"Keyword"}),r.jsx("th",{className:"text-left py-1 font-medium",children:"Status"}),r.jsx("th",{className:"text-left py-1 font-medium",children:"Providers Citing"}),r.jsx("th",{className:"text-left py-1 font-medium",children:"Competitors Citing"}),r.jsx("th",{className:"text-right py-1 font-medium",children:"Consistency"})]})}),r.jsx("tbody",{children:n.map(a=>{const o=a.category==="cited"?"positive":a.category==="gap"?"caution":"neutral";return r.jsxs("tr",{className:`border-t border-zinc-800/40 ${a.category==="gap"?"border-l-2 border-l-amber-600/60":""}`,children:[r.jsx("td",{className:"py-1.5 text-zinc-200",children:a.keyword}),r.jsx("td",{className:"py-1.5",children:r.jsx(lt,{tone:o,children:a.category==="gap"?"Gap":a.category==="cited"?"Cited":"Not Cited"})}),r.jsx("td",{className:"py-1.5 text-zinc-400 text-xs",children:a.providers.length>0?a.providers.join(", "):"—"}),r.jsx("td",{className:"py-1.5 text-zinc-400 text-xs",children:a.competitorsCiting.length>0?a.competitorsCiting.join(", "):"—"}),r.jsx("td",{className:"py-1.5 text-right text-zinc-400 text-xs",children:a.consistency.totalRuns>0?`${a.consistency.citedRuns}/${a.consistency.totalRuns} runs`:"—"})]},a.keywordId)})})]})}function x$({categories:e}){const t=e.reduce((n,a)=>n+a.count,0);return t===0?null:r.jsx("div",{className:"flex rounded-full overflow-hidden h-3 bg-zinc-800","aria-label":"Source category distribution",children:e.map(n=>{const a=n.count/t*100;return a<.5?null:r.jsx("div",{className:`${VN[n.category]??"bg-zinc-600"} transition-all`,style:{width:`${a}%`},title:`${n.label}: ${(n.percentage*100).toFixed(1)}%`},n.category)})})}function lu(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e.toLocaleString()}function S$(e){const t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4);if(n<1)return"just now";if(n<60)return`${n}m ago`;const a=Math.floor(n/60);return a<24?`${a}h ago`:`${Math.floor(a/24)}d ago`}function j$({projectName:e}){const[t,n]=w.useState(null),[a,o]=w.useState(null),[c,u]=w.useState(!0),[f,m]=w.useState(!1),[p,v]=w.useState(!1),[y,b]=w.useState(null),[x,N]=w.useState(null),[S,C]=w.useState("sessions"),[k,T]=w.useState("desc"),[A,z]=w.useState("sessions"),[$,P]=w.useState("desc");function E(ce){u(!0),Qb(e).then(U=>{if(!ce.current)return n(U),U.connected?Yb(e):null}).then(U=>{ce.current||(o(U??null),u(!1))}).catch(U=>{ce.current||(b(U instanceof Error?U.message:"Failed to load GA4 data"),u(!1))})}w.useEffect(()=>{const ce={current:!1};return E(ce),()=>{ce.current=!0}},[e]);async function O(){m(!0),b(null),N(null);try{const ce=await fj(e);N(`Synced ${ce.rowCount.toLocaleString()} page rows and ${ce.aiReferralCount.toLocaleString()} AI referral rows (${ce.days} days)`);const U=await Yb(e);o(U);const R=await Qb(e);n(R)}catch(ce){b(ce instanceof Error?ce.message:"Sync failed")}finally{m(!1)}}async function K(){v(!0),b(null),N(null);try{await Z2(e),n({connected:!1,propertyId:null,clientEmail:null,lastSyncedAt:null,createdAt:null,updatedAt:null}),o(null),N("GA4 disconnected")}catch(ce){b(ce instanceof Error?ce.message:"Disconnect failed")}finally{v(!1)}}function ee(ce){S===ce?T(U=>U==="desc"?"asc":"desc"):(C(ce),T("desc"))}function X(ce){A===ce?P(U=>U==="desc"?"asc":"desc"):(z(ce),P("desc"))}const se=w.useMemo(()=>a?.topPages?[...a.topPages].sort((ce,U)=>{const R=ce[S],M=U[S];return typeof R=="string"&&typeof M=="string"?k==="asc"?R.localeCompare(M):M.localeCompare(R):k==="asc"?R-M:M-R}):[],[a?.topPages,S,k]),de=w.useMemo(()=>a?.aiReferrals?[...a.aiReferrals].sort((ce,U)=>{const R=ce[A],M=U[A];return typeof R=="string"&&typeof M=="string"?$==="asc"?R.localeCompare(M):M.localeCompare(R):$==="asc"?R-M:M-R}):[],[a?.aiReferrals,A,$]);if(c&&!t)return r.jsx("p",{className:"text-sm text-zinc-500 py-8 text-center",children:"Loading traffic data…"});if(!t?.connected)return r.jsx(w$,{projectName:e,onConnected:()=>E({current:!1})});const Ee=a&&a.totalSessions>0?Math.round(a.totalOrganicSessions/a.totalSessions*100):0,be=a?.aiReferrals.reduce((ce,U)=>ce+U.sessions,0)??0,H=a&&a.totalSessions>0?Math.round(be/a.totalSessions*100):0,ae=a?new Set(a.aiReferrals.map(ce=>ce.source.toLowerCase())).size:0,pe=de[0]??null;return r.jsxs(r.Fragment,{children:[y&&r.jsx("div",{className:"mb-4 px-4 py-2 rounded-lg bg-rose-900/20 border border-rose-800/60 text-sm text-rose-300",children:y}),x&&r.jsx("div",{className:"mb-4 px-4 py-2 rounded-lg bg-emerald-900/20 border border-emerald-800/60 text-sm text-emerald-300",children:x}),r.jsxs("div",{className:"flex items-center justify-between mb-6",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("span",{className:"inline-block w-2 h-2 rounded-full bg-emerald-500"}),r.jsxs("span",{className:"text-xs text-zinc-400",children:["Property ",r.jsx("span",{className:"text-zinc-300",children:t.propertyId}),t.clientEmail&&r.jsxs(r.Fragment,{children:[" · ",r.jsx("span",{className:"text-zinc-500",children:t.clientEmail})]})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(oe,{variant:"outline",size:"sm",disabled:f,onClick:O,children:[r.jsx(tx,{className:`w-3.5 h-3.5 mr-1.5 ${f?"animate-spin":""}`}),f?"Syncing…":"Sync"]}),r.jsxs(oe,{variant:"ghost",size:"sm",className:"text-rose-400 hover:text-rose-300",disabled:p,onClick:K,children:[r.jsx(OE,{className:"w-3.5 h-3.5 mr-1.5"}),"Disconnect"]})]})]}),r.jsxs("section",{children:[r.jsxs("div",{className:"mb-4",children:[r.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-zinc-500 mb-1",children:"Traffic Overview"}),r.jsxs("h2",{className:"text-base font-semibold text-zinc-50 flex items-center gap-1.5",children:["Site Traffic",r.jsx(hn,{text:"Aggregated traffic metrics from Google Analytics 4. Sessions and users are summed across all synced dates. Organic sessions are Google organic search sessions specifically."})]})]}),a?r.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[r.jsx(gm,{value:lu(a.totalSessions),label:"Total Sessions",subtitle:a.totalSessions.toLocaleString(),tone:"neutral"}),r.jsx(gm,{value:lu(a.totalOrganicSessions),label:"Organic Sessions",subtitle:`${Ee}% of total`,tone:"positive"}),r.jsx(gm,{value:lu(a.totalUsers),label:"Total Users",subtitle:a.totalUsers.toLocaleString(),tone:"neutral"})]}):r.jsxs("div",{className:"surface-card rounded-lg p-6 text-center border border-zinc-800/60",children:[r.jsx("p",{className:"text-sm text-zinc-400 mb-3",children:"No traffic data yet."}),r.jsxs(oe,{variant:"outline",size:"sm",disabled:f,onClick:O,children:[r.jsx(tx,{className:`w-3.5 h-3.5 mr-1.5 ${f?"animate-spin":""}`}),"Sync from GA4"]})]})]}),a&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"page-section-divider"}),r.jsxs("section",{children:[r.jsxs("div",{className:"mb-4",children:[r.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-zinc-500 mb-1",children:"AI Attribution"}),r.jsxs("h2",{className:"text-base font-semibold text-zinc-50 flex items-center gap-1.5",children:["AI Referral Sources",r.jsx(hn,{text:"Counts explicit AI referrers detected in GA4 sessionSource values, such as ChatGPT, Claude, Gemini, Perplexity, OpenAI, and Copilot. Generic search-engine sources like plain Bing are intentionally excluded to avoid false positives."})]})]}),r.jsxs("div",{className:"grid gap-4 xl:grid-cols-[minmax(0,0.9fr)_minmax(0,1.5fr)]",children:[r.jsxs(Le,{className:"surface-card p-5",children:[r.jsxs("div",{className:"mb-4",children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Summary"}),r.jsx("h3",{className:"text-sm font-semibold text-zinc-100",children:"Attributable AI visits"})]}),a.aiReferrals.length>0?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"grid gap-3 sm:grid-cols-3",children:[r.jsx(ym,{label:"AI Sessions",value:lu(be),hint:`${be.toLocaleString()} sessions`,tone:"positive"}),r.jsx(ym,{label:"Share of Traffic",value:`${H}%`,hint:"of total sessions",tone:"neutral"}),r.jsx(ym,{label:"Tracked Sources",value:String(ae),hint:`${a.aiReferrals.length} source rows`,tone:"neutral"})]}),r.jsx("div",{className:"mt-4 rounded-lg border border-emerald-800/40 bg-emerald-500/6 px-4 py-3 text-sm text-emerald-100",children:pe?`Top explicit AI referrer: ${pe.source} via ${pe.medium}, accounting for ${pe.sessions.toLocaleString()} sessions in the current sync window.`:"Explicit AI referrers detected in the current sync window."})]}):r.jsx("div",{className:"rounded-lg border border-amber-800/40 bg-amber-500/6 px-4 py-4 text-sm text-amber-100",children:"No explicit AI referrers were detected in the current sync window. This view intentionally favors precision over broad matching, so unattributed traffic hidden inside generic search sources is excluded."})]}),r.jsxs(Le,{className:"surface-card p-5",children:[r.jsxs("div",{className:"mb-4 flex items-end justify-between gap-3",children:[r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Breakdown"}),r.jsx("h3",{className:"text-sm font-semibold text-zinc-100",children:"Source / medium"})]}),r.jsx("p",{className:"text-xs text-zinc-500",children:a.aiReferrals.length>0?`${a.aiReferrals.length} rows`:"No source rows"})]}),a.aiReferrals.length>0?r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"text-[10px] uppercase tracking-wider text-zinc-500",children:[r.jsx(Ci,{label:"Source",sortKey:"source",current:A,dir:$,onSort:X,align:"left"}),r.jsx(Ci,{label:"Medium",sortKey:"medium",current:A,dir:$,onSort:X,align:"left"}),r.jsx(Ci,{label:"Sessions",sortKey:"sessions",current:A,dir:$,onSort:X,align:"right"}),r.jsx("th",{className:"py-1 font-medium text-right",children:"Share"}),r.jsx(Ci,{label:"Users",sortKey:"users",current:A,dir:$,onSort:X,align:"right"})]})}),r.jsx("tbody",{children:de.map(ce=>r.jsx(C$,{referral:ce,totalSessions:be},`${ce.source}:${ce.medium}`))})]})}):r.jsx("div",{className:"rounded-lg border border-dashed border-zinc-800/60 bg-zinc-950/40 px-4 py-6 text-sm text-zinc-500",children:"Connect GA4 and sync traffic to monitor explicit AI referral sources here."})]})]})]})]}),a&&a.topPages.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"page-section-divider"}),r.jsxs("section",{children:[r.jsxs("div",{className:"mb-4",children:[r.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-zinc-500 mb-1",children:"Page Performance"}),r.jsxs("h2",{className:"text-base font-semibold text-zinc-50 flex items-center gap-1.5",children:["Top Landing Pages",r.jsx(hn,{text:"Landing pages ranked by session volume. Click column headers to sort. Organic % shows the share of sessions coming from Google organic search."})]})]}),r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"text-[10px] uppercase tracking-wider text-zinc-500",children:[r.jsx(Ci,{label:"Landing Page",sortKey:"landingPage",current:S,dir:k,onSort:ee,align:"left"}),r.jsx(Ci,{label:"Sessions",sortKey:"sessions",current:S,dir:k,onSort:ee,align:"right"}),r.jsx(Ci,{label:"Organic",sortKey:"organicSessions",current:S,dir:k,onSort:ee,align:"right"}),r.jsx("th",{className:"text-right py-1 font-medium",children:"Organic %"}),r.jsx(Ci,{label:"Users",sortKey:"users",current:S,dir:k,onSort:ee,align:"right"})]})}),r.jsx("tbody",{children:se.map(ce=>r.jsx(N$,{page:ce},ce.landingPage))})]})})]})]}),r.jsxs("div",{className:"mt-6 flex items-center justify-between text-xs text-zinc-500",children:[r.jsx("span",{children:a?.lastSyncedAt?`Last synced ${S$(a.lastSyncedAt)}`:"Never synced"}),r.jsx("span",{children:a?`${a.topPages.length} pages · ${a.aiReferrals.length} AI rows`:""})]})]})}function w$({projectName:e,onConnected:t}){const[n,a]=w.useState(""),[o,c]=w.useState(null),[u,f]=w.useState(null),[m,p]=w.useState(!1),[v,y]=w.useState(null),b=w.useRef(null),x=w.useCallback(S=>{const C=S.target.files?.[0];if(!C)return;y(null),c(C.name);const k=new FileReader;k.onload=()=>{const T=k.result;try{const A=JSON.parse(T);if(!A.client_email||!A.private_key){y("JSON file is missing required fields: client_email and private_key. Make sure you downloaded a service account key (not an OAuth client)."),f(null);return}f(T)}catch{y("File is not valid JSON. Please upload a service account key file (.json) downloaded from Google Cloud Console."),f(null)}},k.onerror=()=>{y("Failed to read file."),f(null)},k.readAsText(C)},[]);async function N(){if(y(null),!n.trim()){y("Property ID is required.");return}if(!u){y("Please upload a service account key file.");return}p(!0);try{await F2(e,{propertyId:n.trim(),keyJson:u});try{await fj(e)}catch{}t()}catch(S){y(S instanceof Error?S.message:"Failed to connect GA4")}finally{p(!1)}}return r.jsxs(Le,{className:"surface-card p-6",children:[r.jsx("h3",{className:"text-base font-semibold text-zinc-50 mb-1",children:"Connect Google Analytics 4"}),r.jsx("p",{className:"text-sm text-zinc-400 mb-5",children:"Connect a GA4 property to see traffic data for this project. You'll need a service account key file from Google Cloud Console."}),v&&r.jsx("div",{className:"mb-4 px-4 py-2 rounded-lg bg-rose-900/20 border border-rose-800/60 text-sm text-rose-300",children:v}),r.jsxs("div",{className:"mb-4",children:[r.jsx("label",{htmlFor:"ga4-property-id",className:"block text-xs font-medium text-zinc-400 mb-1.5",children:"GA4 Property ID"}),r.jsx("input",{id:"ga4-property-id",type:"text",placeholder:"e.g. 123456789",value:n,onChange:S=>a(S.target.value),className:"w-full rounded-lg bg-zinc-900/60 border border-zinc-800/60 px-3 py-2 text-sm text-zinc-200 placeholder:text-zinc-600 focus:outline-none focus:ring-1 focus:ring-zinc-600"}),r.jsx("p",{className:"mt-1 text-[11px] text-zinc-500",children:"Find this in GA4 → Admin → Property Settings. It's a numeric ID, not the Measurement ID (G-XXXXXX)."})]}),r.jsxs("div",{className:"mb-5",children:[r.jsx("label",{className:"block text-xs font-medium text-zinc-400 mb-1.5",children:"Service Account Key File"}),r.jsx("input",{ref:b,type:"file",accept:".json,application/json",onChange:x,className:"hidden"}),r.jsxs("button",{type:"button",onClick:()=>b.current?.click(),className:"flex items-center gap-2 w-full rounded-lg bg-zinc-900/60 border border-zinc-800/60 border-dashed px-4 py-3 text-sm text-zinc-400 hover:border-zinc-600 hover:text-zinc-300 transition-colors cursor-pointer",children:[r.jsx(DE,{className:"w-4 h-4 shrink-0"}),o?r.jsx("span",{className:"text-zinc-200 truncate",children:o}):r.jsx("span",{children:"Upload .json key file"})]}),r.jsxs("p",{className:"mt-1 text-[11px] text-zinc-500",children:["Download from Google Cloud Console → IAM & Admin → Service Accounts → Keys → Add Key → JSON. The service account must have ",r.jsx("span",{className:"text-zinc-400",children:"Viewer"})," access on the GA4 property."]})]}),r.jsx(oe,{variant:"default",size:"sm",disabled:m||!n.trim()||!u,onClick:N,children:m?"Connecting & syncing…":"Connect GA4"})]})}function Ci({label:e,sortKey:t,current:n,dir:a,onSort:o,align:c}){const u=n===t;return r.jsxs("th",{className:`py-1 font-medium cursor-pointer select-none hover:text-zinc-300 transition-colors ${c==="right"?"text-right":"text-left"}`,onClick:()=>o(t),children:[e,u&&r.jsx("span",{className:"ml-0.5",children:a==="asc"?"↑":"↓"})]})}const QN={positive:"text-emerald-400",caution:"text-amber-400",negative:"text-rose-400",neutral:"text-zinc-50"};function gm({value:e,label:t,subtitle:n,tone:a}){return r.jsxs("div",{className:"rounded-lg bg-zinc-900/30 border border-zinc-800/60 px-5 py-4",children:[r.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-zinc-500 mb-1",children:t}),r.jsx("p",{className:`text-2xl font-bold tabular-nums ${QN[a]}`,children:e}),r.jsx("p",{className:"text-xs text-zinc-500 mt-1",children:n})]})}function ym({value:e,label:t,hint:n,tone:a}){return r.jsxs("div",{className:"rounded-lg border border-zinc-800/60 bg-zinc-950/40 px-4 py-3",children:[r.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider text-zinc-500 mb-1",children:t}),r.jsx("p",{className:`text-xl font-semibold tabular-nums ${QN[a]}`,children:e}),r.jsx("p",{className:"text-xs text-zinc-500 mt-1",children:n})]})}function N$({page:e}){const t=e.sessions>0?(e.organicSessions/e.sessions*100).toFixed(1):"0.0";return r.jsxs("tr",{className:"border-t border-zinc-800/40",children:[r.jsx("td",{className:"py-1.5 text-zinc-300 max-w-[400px] truncate",title:e.landingPage,children:e.landingPage}),r.jsx("td",{className:"py-1.5 text-right text-zinc-200 tabular-nums",children:e.sessions.toLocaleString()}),r.jsx("td",{className:"py-1.5 text-right text-emerald-400 tabular-nums",children:e.organicSessions.toLocaleString()}),r.jsxs("td",{className:"py-1.5 text-right text-zinc-400 tabular-nums",children:[t,"%"]}),r.jsx("td",{className:"py-1.5 text-right text-zinc-200 tabular-nums",children:e.users.toLocaleString()})]})}function C$({referral:e,totalSessions:t}){const n=t>0?(e.sessions/t*100).toFixed(1):"0.0";return r.jsxs("tr",{className:"border-t border-zinc-800/40",children:[r.jsx("td",{className:"py-1.5 text-zinc-200 max-w-[220px] truncate",title:e.source,children:e.source}),r.jsx("td",{className:"py-1.5 text-zinc-500 max-w-[180px] truncate",title:e.medium,children:e.medium}),r.jsx("td",{className:"py-1.5 text-right text-emerald-400 tabular-nums",children:e.sessions.toLocaleString()}),r.jsxs("td",{className:"py-1.5 text-right text-zinc-400 tabular-nums",children:[n,"%"]}),r.jsx("td",{className:"py-1.5 text-right text-zinc-200 tabular-nums",children:e.users.toLocaleString()})]})}function wl(e){e.invalidateQueries({queryKey:Qn.runs.all}),e.invalidateQueries({queryKey:Qn.projects.all})}function k$(e){return e==="gsc-sync"?"GSC sync queued":e==="inspect-sitemap"?"Sitemap inspection queued":"Visibility sweep queued"}function z$(e,t){const n=e??"Project";return t==="gsc-sync"?`${n} will refresh after the sync completes.`:t==="inspect-sitemap"?`${n} will notify you when sitemap inspection finishes.`:`${n} will notify you when the run finishes.`}function bd(e,t){yj({id:e.id,projectId:e.projectId,kind:e.kind,projectLabel:t.projectLabel,sourceAction:t.sourceAction,lastAnnouncedStatus:"queued"}),Fe({title:k$(e.kind),detail:z$(t.projectLabel,e.kind),tone:"neutral",dedupeKey:`run:${e.id}`,dedupeMode:"replace"})}function _$(e){const t=e.filter(o=>o.status!=="conflict"),n=e.filter(o=>o.status==="conflict");if(t.length===0){Fe({title:"No runs queued",detail:n.length>0?`${n.length} project${n.length===1?"":"s"} already had a run in progress.`:"No projects were available to queue.",tone:"caution",durationMs:8e3,dedupeKey:"run-all:conflict",dedupeMode:"replace"});return}for(const o of t)yj({id:o.id,projectId:o.projectId,kind:o.kind,projectLabel:o.projectName,sourceAction:"run-all",lastAnnouncedStatus:"queued"});const a=GE({runIds:t.map(o=>o.id),queuedCount:t.length,skippedCount:n.length});Fe({title:"Run-all batch queued",detail:n.length>0?`${t.length} project${t.length===1?"":"s"} queued, ${n.length} skipped because a run is already active.`:`${t.length} project${t.length===1?"":"s"} queued.`,tone:n.length>0?"caution":"neutral",dedupeKey:`batch:${a}`,dedupeMode:"replace"})}function xd(e,t){if(e instanceof Eu&&e.code==="RUN_IN_PROGRESS"){Fe({title:"Run already in progress",detail:t?.projectLabel?`${t.projectLabel} already has an active run. Wait for it to finish, then retry.`:"This project already has an active run. Wait for it to finish, then retry.",tone:"caution",durationMs:8e3,dedupeKey:`run-in-progress:${t?.projectKey??"project"}:${t?.sourceAction??"run"}`,dedupeMode:"replace"});return}Fe({title:e instanceof Error?e.message:"Failed to queue run",tone:"negative"})}function YN(){const e=Ui();return gl({meta:{skipGlobalErrorToast:!0},mutationFn:({projectName:t,opts:n})=>s2(t,n),onSuccess:(t,n)=>{wl(e),bd(t,{projectLabel:n.projectLabel??n.projectName,sourceAction:n.sourceAction})},onError:(t,n)=>{xd(t,{projectKey:n.projectName,projectLabel:n.projectLabel??n.projectName,sourceAction:n.sourceAction})}})}function E$(){const e=Ui();return gl({meta:{skipGlobalErrorToast:!0},mutationFn:t=>j2(t),onSuccess:t=>{wl(e),_$(t)},onError:t=>{Fe({title:t instanceof Error?t.message:"Failed to queue runs",tone:"negative"})}})}function A$(){const e=Ui();return gl({meta:{skipGlobalErrorToast:!0},mutationFn:({projectName:t,opts:n})=>lj(t,n),onSuccess:(t,n)=>{wl(e),bd(t,{projectLabel:n.projectLabel??n.projectName,sourceAction:"gsc-sync"})},onError:(t,n)=>{xd(t,{projectKey:n.projectName,projectLabel:n.projectLabel??n.projectName,sourceAction:"gsc-sync"})}})}function T$(){const e=Ui();return gl({meta:{skipGlobalErrorToast:!0},mutationFn:({projectName:t})=>D2(t),onSuccess:(t,n)=>{wl(e),bd(t.run,{projectLabel:n.projectLabel??n.projectName,sourceAction:"discover-sitemaps"})},onError:(t,n)=>{xd(t,{projectKey:n.projectName,projectLabel:n.projectLabel??n.projectName,sourceAction:"discover-sitemaps"})}})}function R$(){const e=Ui();return gl({meta:{skipGlobalErrorToast:!0},mutationFn:({projectName:t,opts:n})=>O2(t,n),onSuccess:(t,n)=>{wl(e),bd(t,{projectLabel:n.projectLabel??n.projectName,sourceAction:"inspect-sitemap"})},onError:(t,n)=>{xd(t,{projectKey:n.projectName,projectLabel:n.projectLabel??n.projectName,sourceAction:"inspect-sitemap"})}})}function O$({projectName:e}){const[t,n]=w.useState(!1),[a,o]=w.useState([]),[c,u]=w.useState([]),[f,m]=w.useState([]),[p,v]=w.useState([]),[y,b]=w.useState([]),[x,N]=w.useState(null),[S,C]=w.useState(""),[k,T]=w.useState(""),[A,z]=w.useState("30"),[$,P]=w.useState(!1),[E,O]=w.useState({startDate:"",endDate:"",query:"",page:"",limit:"20"}),[K,ee]=w.useState(""),[X,se]=w.useState(!0),[de,Ee]=w.useState(!1),[be,H]=w.useState(!1),[ae,pe]=w.useState(!1),[ce,U]=w.useState(!1),[R,M]=w.useState(!1),[J,V]=w.useState(!1),[Q,me]=w.useState(null),[ge,Ne]=w.useState(!1),[he,Me]=w.useState(!1),[Je,le]=w.useState(null),[Ie,Ye]=w.useState(""),[Vt,Ut]=w.useState(!1),[Mn,nn]=w.useState(!1),[At,re]=w.useState("indexed"),[Ze,ut]=w.useState([]),[Qt,Ve]=w.useState(null),[$e,Xe]=w.useState(!1),[Ct,Ke]=w.useState(null),[Ma,gn]=w.useState(null),st=a.find(B=>B.connectionType==="gsc"),Xr=f.length>0||p.length>0||y.length>0,ns=A$(),mt=T$(),yn=R$();async function ue(B){if(!B){u([]),C("");return}H(!0);try{const{sites:fe}=await C2(e);u(fe),C(B.propertyId??fe[0]?.siteUrl??"")}catch(fe){u([]),Ke(fe instanceof Error?fe.message:"Failed to load Search Console properties")}finally{H(!1)}}async function zn(){U(!0);try{const B=await _2(e,{startDate:E.startDate||void 0,endDate:E.endDate||void 0,query:E.query||void 0,page:E.page||void 0,limit:parseInt(E.limit,10)||20});m(B)}catch(B){m([]),Ke(B instanceof Error?B.message:"Failed to load GSC performance data")}finally{U(!1)}}async function $a(){M(!0);try{const[B,fe]=await Promise.all([A2(e,{url:K.trim()||void 0,limit:20}),T2(e)]);v(B),b(fe)}catch(B){v([]),b([]),Ke(B instanceof Error?B.message:"Failed to load GSC inspection history")}finally{M(!1)}}async function Cl(){Ne(!0);try{const[B,fe]=await Promise.all([kp(e),R2(e).catch(()=>[])]);me(B),ut(fe)}catch(B){me(null),ut([]),Ke(B instanceof Error?B.message:"Failed to load coverage data")}finally{Ne(!1)}}async function Gi(B){Xe(!0),Ke(null);try{const fe=await Zb(e,{urls:B}),{succeeded:bt,failed:Gt,total:ln}=fe.summary;Fe({title:"Indexing requested",detail:Gt===0?`${bt} URL${bt!==1?"s":""} submitted for indexing.`:`${bt}/${ln} submitted successfully, ${Gt} failed.`,tone:Gt===0?"positive":"caution",dedupeKey:`gsc:indexing:${e}`,dedupeMode:"replace"})}catch(fe){Ke(fe instanceof Error?fe.message:"Failed to request indexing")}finally{Xe(!1)}}async function Pa(){Xe(!0),Ke(null);try{const B=await Zb(e,{urls:[],allUnindexed:!0}),{succeeded:fe,failed:bt,total:Gt}=B.summary;Fe({title:"Indexing requested",detail:bt===0?`${fe} unindexed URL${fe!==1?"s":""} submitted for indexing.`:`${fe}/${Gt} submitted successfully, ${bt} failed.`,tone:bt===0?"positive":"caution",dedupeKey:`gsc:indexing-all:${e}`,dedupeMode:"replace"})}catch(B){Ke(B instanceof Error?B.message:"Failed to request indexing")}finally{Xe(!1)}}async function Cs(){if(Ie.trim()){Ut(!0),Ke(null);try{await z2(e,"gsc",Ie.trim()),o(B=>B.map(fe=>fe.connectionType==="gsc"?{...fe,sitemapUrl:Ie.trim()}:fe)),Fe({title:"Sitemap URL saved",detail:`${e} will use the updated sitemap URL.`,tone:"positive",dedupeKey:`gsc:sitemap:${e}`,dedupeMode:"drop"}),Ye("")}catch(B){Ke(B instanceof Error?B.message:"Failed to save sitemap URL")}finally{Ut(!1)}}}async function ms(){Ke(null);try{const B=await mt.mutateAsync({projectName:e,projectLabel:e});le(B.sitemaps),o(fe=>fe.map(bt=>bt.connectionType==="gsc"?{...bt,sitemapUrl:B.primarySitemapUrl}:bt))}catch{}}async function Ua(){Me(!0),Ke(null);try{const B=await L2(e);le(B.sitemaps),B.sitemaps.length===0&&gn("No sitemaps found in this GSC property. Submit a sitemap in Google Search Console first.")}catch(B){Ke(B instanceof Error?B.message:"Failed to list sitemaps")}finally{Me(!1)}}async function Ys(){se(!0),Ke(null);try{const[B,fe]=await Promise.all([Cp().catch(()=>null),oj(e).catch(()=>[])]);n(!!B?.google?.configured),o(fe);const bt=fe.find(Gt=>Gt.connectionType==="gsc");await Promise.all([ue(bt),zn(),$a(),Cl()])}finally{se(!1)}}w.useEffect(()=>{Ys()},[e]);async function jd(){if(!t){Ke("Google OAuth app credentials are not configured yet. Set them on the Settings page first.");return}Ee(!0),Ke(null),gn(null);try{const{authUrl:B}=await w2(e,"gsc");if(!B.startsWith("https://accounts.google.com/")){Ke("Unexpected OAuth redirect URL. Please try again.");return}const fe=window.open(B,"_blank","width=600,height=700");if(!fe){window.location.assign(B);return}gn("Finish the Google consent flow in the popup, then close it to refresh this project.");const bt=window.setInterval(()=>{fe.closed&&(window.clearInterval(bt),gn(null),Ys())},1e3)}catch(B){Ke(B instanceof Error?B.message:"Failed to start OAuth flow")}finally{Ee(!1)}}async function kl(){Ke(null),gn(null);try{await N2(e,"gsc"),o(B=>B.filter(fe=>fe.connectionType!=="gsc")),u([]),C("")}catch(B){Ke(B instanceof Error?B.message:"Failed to disconnect")}}async function Wr(){if(S){pe(!0),Ke(null);try{await k2(e,"gsc",S),o(B=>B.map(fe=>fe.connectionType==="gsc"?{...fe,propertyId:S}:fe)),Fe({title:"GSC property updated",detail:`${e} is now linked to ${S}.`,tone:"positive",dedupeKey:`gsc:property:${e}`,dedupeMode:"drop"})}catch(B){Ke(B instanceof Error?B.message:"Failed to save GSC property")}finally{pe(!1)}}}async function Fi(){Ke(null),gn(null);try{await ns.mutateAsync({projectName:e,projectLabel:e,opts:{days:parseInt(A,10)||void 0,full:$||void 0}})}catch{}}async function zl(){if(k.trim()){V(!0),Ke(null),gn(null);try{const B=await E2(e,k.trim());N(B),T(""),await $a()}catch(B){Ke(B instanceof Error?B.message:"Failed to inspect URL")}finally{V(!1)}}}return r.jsxs("section",{className:"page-section-divider",children:[r.jsxs("div",{className:"section-head section-head-inline",children:[r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Search Console"}),r.jsx("h2",{children:"Google Search Console"})]}),r.jsx("div",{className:"flex items-center gap-2",children:st&&r.jsx(oe,{type:"button",variant:"outline",size:"sm",disabled:ce,onClick:()=>{zn()},children:ce?"Refreshing…":"Refresh data"})})]}),Ct&&r.jsxs("div",{className:"mb-3 rounded-lg border border-rose-800/40 bg-rose-950/20 px-3 py-2 text-sm text-rose-300",children:[Ct,r.jsx("button",{type:"button",className:"ml-2 text-rose-400 hover:text-rose-200",onClick:()=>Ke(null),children:"×"})]}),Ma&&r.jsxs("div",{className:"mb-3 rounded-lg border border-emerald-800/40 bg-emerald-950/20 px-3 py-2 text-sm text-emerald-300",children:[Ma,r.jsx("button",{type:"button",className:"ml-2 text-emerald-400 hover:text-emerald-200",onClick:()=>gn(null),children:"×"})]}),X?r.jsx("p",{className:"text-sm text-zinc-500",children:"Loading…"}):r.jsxs("div",{className:"space-y-3",children:[r.jsxs(Le,{className:"surface-card",children:[r.jsxs("div",{className:"section-head section-head-inline",children:[r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Connection"}),r.jsx("h3",{children:"Domain authorization"})]}),r.jsx(lt,{tone:st?"positive":t?"caution":"negative",children:st?"Connected":t?"Ready to connect":"App credentials missing"})]}),st?r.jsxs("div",{className:"mt-3 space-y-3",children:[r.jsxs("div",{className:"rounded-lg border border-zinc-800/60 bg-zinc-900/30 px-4 py-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("span",{className:"h-2 w-2 rounded-full bg-emerald-500"}),r.jsx("span",{className:"text-sm text-zinc-200",children:"Authorized for this project domain"}),r.jsx("span",{className:"text-xs text-zinc-500",children:st.domain}),r.jsx("button",{type:"button",className:"ml-auto text-xs text-zinc-500 hover:text-rose-400 transition-colors",onClick:kl,children:"Disconnect"})]}),r.jsxs("p",{className:"mt-2 text-xs text-zinc-500",children:["Canonry stores OAuth tokens per canonical domain. This project currently maps to ",r.jsx("code",{children:st.domain}),"."]})]}),r.jsxs("div",{className:"grid gap-3 lg:grid-cols-2",children:[r.jsxs("div",{className:"rounded-lg border border-zinc-800/60 bg-zinc-900/20 p-3",children:[r.jsx("p",{className:"text-xs uppercase tracking-wide text-zinc-500",children:"Selected property"}),r.jsx("p",{className:"mt-1 text-sm text-zinc-200",children:st.propertyId??"No property selected yet"})]}),r.jsxs("div",{className:"rounded-lg border border-zinc-800/60 bg-zinc-900/20 p-3",children:[r.jsx("p",{className:"text-xs uppercase tracking-wide text-zinc-500",children:"Last auth update"}),r.jsx("p",{className:"mt-1 text-sm text-zinc-200",children:cs(st.updatedAt)})]})]})]}):r.jsxs("div",{className:"mt-3 rounded-lg border border-zinc-800/60 bg-zinc-900/30 px-4 py-5",children:[r.jsx("p",{className:"text-sm text-zinc-300",children:t?"Generate a Google OAuth link for this project and have the client sign in with a Google account that already has access to the correct Search Console property.":"Set Google OAuth client credentials first. Once configured, you can generate a consent link for this project domain."}),r.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[t?r.jsx(oe,{type:"button",variant:"outline",size:"sm",disabled:de,onClick:jd,children:de?"Opening…":"Connect Google Search Console"}):r.jsx(oe,{type:"button",variant:"outline",size:"sm",asChild:!0,children:r.jsx(St,{to:"/settings",children:"Open Settings"})}),!t&&r.jsx("p",{className:"text-xs text-zinc-500",children:"The same Google OAuth app credentials are shared across all projects."})]})]})]}),st&&!st.sitemapUrl&&r.jsx("div",{className:"rounded-lg border border-amber-800/40 bg-amber-950/20 px-4 py-3",children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("span",{className:"mt-0.5 text-amber-400",children:r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:"h-5 w-5","aria-hidden":"true",children:r.jsx("path",{fillRule:"evenodd",d:"M8.485 2.495c.673-1.167 2.357-1.167 3.03 0l6.28 10.875c.673 1.167-.17 2.625-1.516 2.625H3.72c-1.347 0-2.189-1.458-1.515-2.625L8.485 2.495zM10 6a.75.75 0 01.75.75v3.5a.75.75 0 01-1.5 0v-3.5A.75.75 0 0110 6zm0 9a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm font-medium text-amber-300",children:"Set your sitemap URL"}),r.jsx("p",{className:"mt-1 text-xs text-amber-400/70",children:"Canonry uses your sitemap to discover URLs for index coverage inspection. Auto-discover from GSC or enter it manually."}),r.jsxs("div",{className:"mt-2 flex flex-col gap-2",children:[r.jsxs("div",{className:"flex flex-col gap-2 lg:flex-row",children:[r.jsx(oe,{type:"button",size:"sm",disabled:mt.isPending||!st.propertyId,onClick:ms,children:mt.isPending?"Discovering…":"Auto-discover from GSC"}),r.jsx("span",{className:"self-center text-xs text-amber-400/60",children:"or enter manually:"})]}),r.jsxs("div",{className:"flex flex-col gap-2 lg:flex-row",children:[r.jsx("input",{className:"flex-1 rounded border border-amber-800/40 bg-transparent px-2 py-1.5 text-sm text-zinc-200 placeholder-zinc-500 focus:border-amber-600 focus:outline-none",type:"url",placeholder:"https://example.com/sitemap.xml",value:Ie,onChange:B=>Ye(B.target.value),onKeyDown:B=>B.key==="Enter"&&void Cs()}),r.jsx(oe,{type:"button",size:"sm",variant:"outline",disabled:Vt||!Ie.trim(),onClick:Cs,children:Vt?"Saving…":"Save sitemap URL"})]})]})]})]})}),(st||Xr)&&r.jsxs(r.Fragment,{children:[r.jsxs(Le,{className:"surface-card",children:[r.jsxs("div",{className:"section-head section-head-inline",children:[r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Coverage"}),r.jsx("h3",{children:"Index coverage"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[Q&&Q.notIndexed.length>0&&r.jsx(oe,{type:"button",variant:"outline",size:"sm",disabled:$e,onClick:()=>{Pa()},children:$e?"Requesting…":`Request indexing (${Q.notIndexed.length})`}),r.jsx(oe,{type:"button",variant:"outline",size:"sm",disabled:ge,onClick:()=>{Cl()},children:ge?"Loading…":"Refresh coverage"})]})]}),Q&&Q.summary.total>0?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"mt-6 flex flex-col items-center",children:(()=>{const B=Q.summary.indexed+Q.summary.notIndexed,fe=B>0?Q.summary.indexed/B:0,bt=B>0?Q.summary.notIndexed/B:0,Gt=54,ln=2*Math.PI*Gt,Ia=ln*(1-fe),ps=ln*bt,cn=ln*fe;return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"relative h-48 w-48",children:[r.jsxs("svg",{viewBox:"0 0 128 128",className:"h-full w-full","aria-hidden":"true",children:[r.jsx("circle",{cx:"64",cy:"64",r:Gt,fill:"none",stroke:"rgba(255,255,255,0.04)",strokeWidth:"14"}),r.jsx("circle",{cx:"64",cy:"64",r:Gt,fill:"none",stroke:"#10b981",strokeWidth:"14",strokeDasharray:ln,strokeDashoffset:Ia,strokeLinecap:"round",transform:"rotate(-90 64 64)",style:{transition:"stroke-dashoffset 0.6s ease"}}),Q.summary.notIndexed>0&&r.jsx("circle",{cx:"64",cy:"64",r:Gt,fill:"none",stroke:"#52525b",strokeWidth:"14",strokeDasharray:`${ps} ${ln-ps}`,strokeDashoffset:-cn,transform:"rotate(-90 64 64)",style:{transition:"stroke-dasharray 0.6s ease, stroke-dashoffset 0.6s ease"}})]}),r.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:[r.jsxs("span",{className:"text-3xl font-bold tabular-nums text-zinc-50",children:[(fe*100).toFixed(0),"%"]}),r.jsx("span",{className:"text-xs uppercase tracking-widest text-zinc-500 mt-0.5",children:"Indexed"})]})]}),r.jsxs("div",{className:"mt-4 flex items-center justify-center gap-8",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"inline-block h-2.5 w-2.5 rounded-full bg-emerald-500"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-semibold tabular-nums text-zinc-50",children:Q.summary.indexed.toLocaleString()}),r.jsx("p",{className:"text-[11px] uppercase tracking-wide text-zinc-500",children:"Indexed"})]})]}),r.jsx("div",{className:"h-8 w-px bg-zinc-800"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"inline-block h-2.5 w-2.5 rounded-full bg-zinc-500"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-semibold tabular-nums text-zinc-50",children:Q.summary.notIndexed.toLocaleString()}),r.jsxs("p",{className:"text-[11px] uppercase tracking-wide text-zinc-500",children:["Not indexed",(Q.reasonGroups??[]).length>0&&r.jsxs("span",{className:"ml-1 text-zinc-600",children:["· ",(Q.reasonGroups??[]).length," ",(Q.reasonGroups??[]).length===1?"reason":"reasons"]})]})]})]}),Q.summary.deindexed>0&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"h-8 w-px bg-zinc-800"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"inline-block h-2.5 w-2.5 rounded-full bg-rose-500"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-semibold tabular-nums text-zinc-50",children:Q.summary.deindexed.toLocaleString()}),r.jsx("p",{className:"text-[11px] uppercase tracking-wide text-zinc-500",children:"Deindexed"})]})]})]})]})]})})()}),r.jsx("div",{className:"mt-3 flex gap-1",children:["indexed","notIndexed","deindexed"].map(B=>{const fe=B==="indexed"?Q.indexed.length:B==="notIndexed"?Q.notIndexed.length:Q.deindexed.length,bt=B==="indexed"?"Indexed":B==="notIndexed"?"Not Indexed":"Deindexed";return r.jsxs("button",{type:"button",className:`rounded-full px-3 py-1 text-xs font-medium transition-colors ${At===B?"bg-zinc-700 text-zinc-100":"text-zinc-400 hover:bg-zinc-800 hover:text-zinc-200"}`,onClick:()=>{re(B),Ve(null)},children:[bt," (",fe,")"]},B)})}),r.jsxs("div",{className:"mt-3 overflow-x-auto",children:[At==="indexed"&&Q.indexed.length>0&&r.jsxs("table",{className:"data-table w-full text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{children:[r.jsx("th",{className:"text-left",children:"URL"}),r.jsx("th",{className:"text-left",children:"Verdict"}),r.jsx("th",{className:"text-left",children:"Last Crawl"}),r.jsx("th",{className:"text-left",children:"Mobile"})]})}),r.jsx("tbody",{children:Q.indexed.map(B=>r.jsxs("tr",{children:[r.jsx("td",{className:"max-w-sm truncate text-zinc-200",children:B.url}),r.jsx("td",{className:"text-zinc-400",children:B.verdict??"Unknown"}),r.jsx("td",{className:"text-zinc-400",children:B.crawlTime?B.crawlTime.split("T")[0]:"—"}),r.jsx("td",{className:"text-zinc-400",children:B.isMobileFriendly===!0?"Yes":B.isMobileFriendly===!1?"No":"—"})]},B.id))})]}),At==="notIndexed"&&!Qt&&(Q.reasonGroups??[]).length>0&&r.jsxs("table",{className:"data-table w-full text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{children:[r.jsx("th",{className:"text-left",children:"Reason"}),r.jsx("th",{className:"text-right",children:"Pages"})]})}),r.jsx("tbody",{children:(Q.reasonGroups??[]).map(B=>r.jsxs("tr",{className:"cursor-pointer hover:bg-zinc-800/40",onClick:()=>Ve(B.reason),children:[r.jsx("td",{className:"text-zinc-200",children:B.reason}),r.jsx("td",{className:"text-right tabular-nums text-zinc-400",children:B.count})]},B.reason))})]}),At==="notIndexed"&&!Qt&&(Q.reasonGroups??[]).length===0&&Q.notIndexed.length>0&&r.jsxs("table",{className:"data-table w-full text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{children:[r.jsx("th",{className:"text-left",children:"URL"}),r.jsx("th",{className:"text-left",children:"Indexing State"}),r.jsx("th",{className:"text-left",children:"Coverage"})]})}),r.jsx("tbody",{children:Q.notIndexed.map(B=>r.jsxs("tr",{children:[r.jsx("td",{className:"max-w-sm truncate text-zinc-200",children:B.url}),r.jsx("td",{className:"text-zinc-400",children:B.indexingState??"Unknown"}),r.jsx("td",{className:"text-zinc-400",children:B.coverageState??"Unknown"})]},B.id))})]}),At==="notIndexed"&&Qt&&(()=>{const B=(Q.reasonGroups??[]).find(fe=>fe.reason===Qt);return B?r.jsxs("div",{children:[r.jsx("div",{className:"flex items-center gap-2 mb-3",children:r.jsxs("button",{type:"button",className:"text-xs text-zinc-400 hover:text-zinc-200 transition-colors",onClick:()=>Ve(null),children:["←"," Back to reasons"]})}),r.jsxs("div",{className:"mb-3 flex items-center justify-between rounded-lg border border-zinc-800/60 bg-zinc-900/20 p-3",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium text-zinc-200",children:B.reason}),r.jsxs("p",{className:"mt-1 text-xs text-zinc-500",children:[B.count," affected page",B.count!==1?"s":""]})]}),r.jsx(oe,{type:"button",variant:"outline",size:"sm",disabled:$e,onClick:()=>{Gi(B.urls.map(fe=>fe.url))},children:$e?"Requesting…":`Request indexing (${B.count})`})]}),r.jsxs("table",{className:"data-table w-full text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{children:[r.jsx("th",{className:"text-left",children:"URL"}),r.jsx("th",{className:"text-left",children:"Last Crawl"}),r.jsx("th",{className:"w-8"})]})}),r.jsx("tbody",{children:B.urls.map(fe=>r.jsxs("tr",{children:[r.jsx("td",{className:"max-w-sm truncate text-zinc-200",children:fe.url}),r.jsx("td",{className:"text-zinc-400",children:fe.crawlTime?fe.crawlTime.split("T")[0]:"—"}),r.jsx("td",{children:r.jsx("button",{type:"button",className:"text-xs text-zinc-500 hover:text-zinc-200 transition-colors",disabled:$e,onClick:()=>{Gi([fe.url])},title:"Request indexing",children:"Index"})})]},fe.id))})]})]}):null})(),At==="deindexed"&&Q.deindexed.length>0&&r.jsxs("table",{className:"data-table w-full text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{children:[r.jsx("th",{className:"text-left",children:"URL"}),r.jsx("th",{className:"text-left",children:"Previous"}),r.jsx("th",{className:"text-left",children:"Current"}),r.jsx("th",{className:"text-left",children:"Detected"})]})}),r.jsx("tbody",{children:Q.deindexed.map((B,fe)=>r.jsxs("tr",{children:[r.jsx("td",{className:"max-w-sm truncate text-zinc-200",children:B.url}),r.jsx("td",{className:"text-zinc-400",children:B.previousState}),r.jsx("td",{className:"text-zinc-400",children:B.currentState}),r.jsx("td",{className:"text-zinc-400",children:B.transitionDate.split("T")[0]})]},`${B.url}-${fe}`))})]}),(At==="indexed"&&Q.indexed.length===0||At==="notIndexed"&&!Qt&&Q.notIndexed.length===0||At==="deindexed"&&Q.deindexed.length===0)&&r.jsx("p",{className:"text-sm text-zinc-500",children:"No URLs in this category."})]})]}):r.jsx("p",{className:"mt-3 text-sm text-zinc-500",children:ge?"Loading coverage data…":"No coverage data yet. Inspect your sitemap to populate this view."})]}),r.jsxs(Le,{className:"surface-card",children:[r.jsxs("div",{className:"section-head section-head-inline",children:[r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Performance"}),r.jsx("h3",{children:"Search performance"})]}),r.jsx(oe,{type:"button",variant:"outline",size:"sm",disabled:ce,onClick:()=>{zn()},children:ce?"Loading…":"Apply filters"})]}),f.length>0&&(()=>{const B=new Map;for(const Pe of f){const We=B.get(Pe.date);We?(We.clicks+=Pe.clicks,We.impressions+=Pe.impressions):B.set(Pe.date,{clicks:Pe.clicks,impressions:Pe.impressions})}const fe=[...B.entries()].sort(([Pe],[We])=>Pe.localeCompare(We));if(fe.length===0)return null;const bt=Math.max(...fe.map(([,Pe])=>Pe.impressions),1),Gt=fe.reduce((Pe,[,We])=>Pe+We.clicks,0),ln=fe.reduce((Pe,[,We])=>Pe+We.impressions,0),Ia=ln>0?(Gt/ln*100).toFixed(1):"0.0",ps=700,cn=220,it={top:12,bottom:36,left:48,right:12},sn=ps-it.left-it.right,_n=cn-it.top-it.bottom,ks=sn/fe.length,Ba=Math.max(Math.min(ks*.35,24),4),_l=Math.max(Ba*.15,1),El=Pe=>{if(Pe<=0)return 1;const We=Math.pow(10,Math.floor(Math.log10(Pe))),at=Pe/We,ss=at<=1.5?1.5:at<=3?3:at<=5?5:10;return Math.ceil(ss*We)},gs=4,Js=Math.ceil(El(bt)/gs)*gs,Xs=Array.from({length:gs+1},(Pe,We)=>Js/gs*We),Ws=Pe=>Pe>=1e3?`${(Pe/1e3).toFixed(Pe>=1e4?0:1)}k`:String(Pe);return r.jsxs("div",{className:"mt-3",children:[r.jsxs("div",{className:"flex items-center gap-5 mb-2",children:[r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"inline-block h-2.5 w-2.5 rounded-sm bg-emerald-500"}),r.jsxs("span",{className:"text-xs text-zinc-400",children:["Clicks ",r.jsx("span",{className:"text-zinc-200 tabular-nums font-medium",children:Gt.toLocaleString()})]})]}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"inline-block h-2.5 w-2.5 rounded-sm bg-blue-500"}),r.jsxs("span",{className:"text-xs text-zinc-400",children:["Impressions ",r.jsx("span",{className:"text-zinc-200 tabular-nums font-medium",children:ln.toLocaleString()})]})]}),r.jsxs("span",{className:"text-xs text-zinc-500",children:["CTR ",r.jsxs("span",{className:"text-amber-400 tabular-nums font-medium",children:[Ia,"%"]})]})]}),r.jsx("div",{className:"relative w-full",style:{aspectRatio:`${ps} / ${cn}`},children:r.jsxs("svg",{viewBox:`0 0 ${ps} ${cn}`,className:"h-full w-full",children:[Xs.map((Pe,We)=>{const at=it.top+_n-Pe/Js*_n;return r.jsxs("g",{children:[r.jsx("line",{x1:it.left,y1:at,x2:ps-it.right,y2:at,stroke:"rgba(255,255,255,0.06)",strokeWidth:"1"}),r.jsx("text",{x:it.left-6,y:at+3.5,textAnchor:"end",fill:"#a1a1aa",fontSize:"10",fontFamily:"inherit",children:Ws(Pe)})]},`t-${We}`)}),fe.map(([Pe,We],at)=>{const ss=it.left+ks*at+ks/2,Zi=We.impressions/Js*_n,ys=We.clicks/Js*_n;return r.jsxs("g",{children:[r.jsx("title",{children:`${Pe}
234
- Clicks: ${We.clicks}
235
- Impressions: ${We.impressions}
236
- CTR: ${We.impressions>0?(We.clicks/We.impressions*100).toFixed(1):0}%`}),r.jsx("rect",{x:ss-Ba-_l/2,y:it.top+_n-Zi,width:Ba,height:Math.max(Zi,1),rx:2,fill:"#3b82f6",opacity:.85}),r.jsx("rect",{x:ss+_l/2,y:it.top+_n-ys,width:Ba,height:Math.max(ys,1),rx:2,fill:"#10b981",opacity:.85})]},Pe)}),(()=>{const Pe=Math.min(fe.length,7);return Array.from({length:Pe},(We,at)=>{const ss=fe.length===1?0:Math.round(at/(Pe-1)*(fe.length-1)),Zi=it.left+ks*ss+ks/2;return r.jsx("text",{x:Zi,y:cn-8,textAnchor:"middle",fill:"#71717a",fontSize:"10",fontFamily:"inherit",children:fe[ss][0].slice(5)},`xl-${ss}`)})})()]})})]})})(),r.jsxs("div",{className:"mt-3 grid gap-2 lg:grid-cols-5",children:[r.jsx("input",{className:"rounded border border-zinc-700 bg-transparent px-2 py-1.5 text-sm text-zinc-200 placeholder-zinc-600 focus:border-zinc-500 focus:outline-none",type:"date",value:E.startDate,onChange:B=>O(fe=>({...fe,startDate:B.target.value}))}),r.jsx("input",{className:"rounded border border-zinc-700 bg-transparent px-2 py-1.5 text-sm text-zinc-200 placeholder-zinc-600 focus:border-zinc-500 focus:outline-none",type:"date",value:E.endDate,onChange:B=>O(fe=>({...fe,endDate:B.target.value}))}),r.jsx("input",{className:"rounded border border-zinc-700 bg-transparent px-2 py-1.5 text-sm text-zinc-200 placeholder-zinc-600 focus:border-zinc-500 focus:outline-none",type:"text",placeholder:"Filter query",value:E.query,onChange:B=>O(fe=>({...fe,query:B.target.value}))}),r.jsx("input",{className:"rounded border border-zinc-700 bg-transparent px-2 py-1.5 text-sm text-zinc-200 placeholder-zinc-600 focus:border-zinc-500 focus:outline-none",type:"text",placeholder:"Filter page",value:E.page,onChange:B=>O(fe=>({...fe,page:B.target.value}))}),r.jsx("input",{className:"rounded border border-zinc-700 bg-transparent px-2 py-1.5 text-sm text-zinc-200 placeholder-zinc-600 focus:border-zinc-500 focus:outline-none",type:"number",min:"1",placeholder:"Limit",value:E.limit,onChange:B=>O(fe=>({...fe,limit:B.target.value}))})]}),f.length>0?r.jsx("div",{className:"mt-3 overflow-x-auto",children:r.jsxs("table",{className:"data-table w-full text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{children:[r.jsx("th",{className:"text-left",children:"Date"}),r.jsx("th",{className:"text-left",children:"Query"}),r.jsx("th",{className:"text-left",children:"Page"}),r.jsx("th",{className:"text-right",children:"Clicks"}),r.jsx("th",{className:"text-right",children:"Impressions"}),r.jsx("th",{className:"text-right",children:"CTR"}),r.jsx("th",{className:"text-right",children:"Position"})]})}),r.jsx("tbody",{children:f.map((B,fe)=>r.jsxs("tr",{children:[r.jsx("td",{className:"text-zinc-400",children:B.date}),r.jsx("td",{className:"max-w-xs truncate text-zinc-200",children:B.query}),r.jsx("td",{className:"max-w-xs truncate text-zinc-400",children:B.page}),r.jsx("td",{className:"text-right tabular-nums text-zinc-300",children:B.clicks.toLocaleString()}),r.jsx("td",{className:"text-right tabular-nums text-zinc-400",children:B.impressions.toLocaleString()}),r.jsxs("td",{className:"text-right tabular-nums text-zinc-400",children:[(Number.isFinite(B.ctr)?B.ctr*100:0).toFixed(1),"%"]}),r.jsx("td",{className:"text-right tabular-nums text-zinc-400",children:B.position.toFixed(1)})]},`${B.date}:${B.query}:${B.page}:${fe}`))})]})}):r.jsx("p",{className:"mt-3 text-sm text-zinc-500",children:"No performance rows match the current filters yet."})]}),r.jsxs(Le,{className:"surface-card",children:[r.jsx("div",{className:"section-head",children:r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Inspection"}),r.jsx("h3",{children:"Inspect a URL"})]})}),r.jsxs("div",{className:"mt-3 flex flex-col gap-2 lg:flex-row",children:[r.jsx("input",{className:"flex-1 rounded border border-zinc-700 bg-transparent px-2 py-1.5 text-sm text-zinc-200 placeholder-zinc-600 focus:border-zinc-500 focus:outline-none",type:"url",placeholder:"https://example.com/page",value:k,onChange:B=>T(B.target.value),onKeyDown:B=>B.key==="Enter"&&void zl()}),r.jsx(oe,{type:"button",size:"sm",disabled:J||!st?.propertyId||!k.trim(),onClick:zl,children:J?"Inspecting…":"Inspect URL"})]}),x&&r.jsxs("div",{className:"mt-3 grid gap-3 md:grid-cols-2 xl:grid-cols-4",children:[r.jsxs("div",{className:"rounded-lg border border-zinc-800/60 bg-zinc-900/20 p-3",children:[r.jsx("p",{className:"text-xs uppercase tracking-wide text-zinc-500",children:"Indexing state"}),r.jsx("p",{className:"mt-1 text-sm text-zinc-200",children:x.indexingState??"Unknown"})]}),r.jsxs("div",{className:"rounded-lg border border-zinc-800/60 bg-zinc-900/20 p-3",children:[r.jsx("p",{className:"text-xs uppercase tracking-wide text-zinc-500",children:"Verdict"}),r.jsx("p",{className:"mt-1 text-sm text-zinc-200",children:x.verdict??"Unknown"})]}),r.jsxs("div",{className:"rounded-lg border border-zinc-800/60 bg-zinc-900/20 p-3",children:[r.jsx("p",{className:"text-xs uppercase tracking-wide text-zinc-500",children:"Mobile friendly"}),r.jsx("p",{className:"mt-1 text-sm text-zinc-200",children:nx(x.isMobileFriendly)})]}),r.jsxs("div",{className:"rounded-lg border border-zinc-800/60 bg-zinc-900/20 p-3",children:[r.jsx("p",{className:"text-xs uppercase tracking-wide text-zinc-500",children:"Last crawl"}),r.jsx("p",{className:"mt-1 text-sm text-zinc-200",children:cs(x.crawlTime)})]})]})]}),r.jsxs(Le,{className:"surface-card",children:[r.jsxs("div",{className:"section-head section-head-inline",children:[r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"History"}),r.jsx("h3",{children:"Inspection log"})]}),r.jsx(oe,{type:"button",variant:"outline",size:"sm",disabled:R,onClick:()=>{$a()},children:R?"Loading…":"Refresh history"})]}),r.jsxs("div",{className:"mt-3 flex flex-col gap-2 lg:flex-row",children:[r.jsx("input",{className:"flex-1 rounded border border-zinc-700 bg-transparent px-2 py-1.5 text-sm text-zinc-200 placeholder-zinc-600 focus:border-zinc-500 focus:outline-none",type:"text",placeholder:"Filter exact URL",value:K,onChange:B=>ee(B.target.value)}),r.jsx(oe,{type:"button",size:"sm",variant:"outline",disabled:R,onClick:()=>{$a()},children:"Apply filter"})]}),p.length>0?r.jsx("div",{className:"mt-3 overflow-x-auto",children:r.jsxs("table",{className:"data-table w-full text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{children:[r.jsx("th",{className:"text-left",children:"URL"}),r.jsx("th",{className:"text-left",children:"Indexing"}),r.jsx("th",{className:"text-left",children:"Verdict"}),r.jsx("th",{className:"text-left",children:"Coverage"}),r.jsx("th",{className:"text-left",children:"Mobile"}),r.jsx("th",{className:"text-left",children:"Inspected"})]})}),r.jsx("tbody",{children:p.map(B=>r.jsxs("tr",{children:[r.jsx("td",{className:"max-w-sm truncate text-zinc-200",children:B.url}),r.jsx("td",{className:"text-zinc-300",children:B.indexingState??"Unknown"}),r.jsx("td",{className:"text-zinc-400",children:B.verdict??"Unknown"}),r.jsx("td",{className:"text-zinc-400",children:B.coverageState??"Unknown"}),r.jsx("td",{className:"text-zinc-400",children:nx(B.isMobileFriendly)}),r.jsx("td",{className:"text-zinc-400",children:cs(B.inspectedAt)})]},B.id))})]})}):r.jsx("p",{className:"mt-3 text-sm text-zinc-500",children:"No inspection history yet."})]}),r.jsxs(Le,{className:"surface-card",children:[r.jsx("div",{className:"section-head",children:r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Deindexed"}),r.jsx("h3",{children:"Recent indexing losses"})]})}),y.length>0?r.jsx("div",{className:"mt-3 overflow-x-auto",children:r.jsxs("table",{className:"data-table w-full text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{children:[r.jsx("th",{className:"text-left",children:"URL"}),r.jsx("th",{className:"text-left",children:"Previous"}),r.jsx("th",{className:"text-left",children:"Current"}),r.jsx("th",{className:"text-left",children:"Changed at"})]})}),r.jsx("tbody",{children:y.map(B=>r.jsxs("tr",{children:[r.jsx("td",{className:"max-w-sm truncate text-zinc-200",children:B.url}),r.jsx("td",{className:"text-zinc-400",children:B.previousState??"Unknown"}),r.jsx("td",{className:"text-zinc-300",children:B.currentState??"Unknown"}),r.jsx("td",{className:"text-zinc-400",children:cs(B.transitionDate)})]},`${B.url}:${B.transitionDate}`))})]})}):r.jsx("p",{className:"mt-3 text-sm text-zinc-500",children:"No deindexed transitions recorded."})]})]}),st&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"border-t border-zinc-800/60 pt-3",children:r.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 text-left",onClick:()=>nn(B=>!B),children:[r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",className:`h-4 w-4 text-zinc-500 transition-transform ${Mn?"rotate-90":""}`,"aria-hidden":"true",children:r.jsx("path",{fillRule:"evenodd",d:"M7.21 14.77a.75.75 0 01.02-1.06L11.168 10 7.23 6.29a.75.75 0 111.04-1.08l4.5 4.25a.75.75 0 010 1.08l-4.5 4.25a.75.75 0 01-1.06-.02z",clipRule:"evenodd"})}),r.jsx("span",{className:"text-xs uppercase tracking-wide text-zinc-500",children:"Setup & Configuration"})]})}),Mn&&r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"grid gap-3 xl:grid-cols-2",children:[r.jsxs(Le,{className:"surface-card",children:[r.jsx("div",{className:"section-head",children:r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Property"}),r.jsx("h3",{children:"Pick the Search Console property"})]})}),r.jsxs("div",{className:"mt-3 space-y-2",children:[r.jsx("label",{className:"text-xs text-zinc-500",htmlFor:`gsc-property-${e}`,children:"Property URL"}),r.jsx("select",{id:`gsc-property-${e}`,className:"w-full rounded border border-zinc-700 bg-transparent px-2 py-1.5 text-sm text-zinc-200 focus:border-zinc-500 focus:outline-none",value:S,disabled:be||c.length===0,onChange:B=>C(B.target.value),children:c.length===0?r.jsx("option",{value:"",children:be?"Loading properties…":"No properties available"}):c.map(B=>r.jsxs("option",{value:B.siteUrl,children:[B.siteUrl," · ",B.permissionLevel]},B.siteUrl))}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx(oe,{type:"button",size:"sm",variant:"outline",disabled:be,onClick:()=>{ue(st)},children:be?"Refreshing…":"Refresh properties"}),r.jsx(oe,{type:"button",size:"sm",disabled:!S||ae,onClick:Wr,children:ae?"Saving…":"Save property"})]}),r.jsx("p",{className:"text-xs text-zinc-500",children:"The selected property is used for future syncs and URL inspections for this project."})]})]}),r.jsxs(Le,{className:"surface-card",children:[r.jsx("div",{className:"section-head",children:r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Sync"}),r.jsx("h3",{children:"Import GSC performance data"})]})}),r.jsxs("div",{className:"mt-3 space-y-3",children:[r.jsxs("div",{className:"grid gap-3 sm:grid-cols-[160px_1fr]",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-xs text-zinc-500",htmlFor:`gsc-sync-days-${e}`,children:"Days"}),r.jsx("input",{id:`gsc-sync-days-${e}`,type:"number",min:"1",className:"mt-0.5 w-full rounded border border-zinc-700 bg-transparent px-2 py-1.5 text-sm text-zinc-200 placeholder-zinc-600 focus:border-zinc-500 focus:outline-none",value:A,onChange:B=>z(B.target.value)})]}),r.jsxs("label",{className:"flex items-center gap-2 rounded border border-zinc-800/60 bg-zinc-900/20 px-3 py-2 text-sm text-zinc-300",children:[r.jsx("input",{type:"checkbox",checked:$,onChange:B=>P(B.target.checked)}),"Replace existing imported rows for the requested range"]})]}),r.jsx(oe,{type:"button",size:"sm",disabled:ns.isPending||!st.propertyId,onClick:Fi,children:ns.isPending?"Queueing…":"Queue sync"}),!st.propertyId&&r.jsx("p",{className:"text-xs text-amber-400",children:"Select a Search Console property before queueing a sync."})]})]})]}),r.jsxs(Le,{className:"surface-card",children:[r.jsx("div",{className:"section-head",children:r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Sitemap"}),r.jsx("h3",{children:"Sitemap configuration"})]})}),r.jsxs("div",{className:"mt-3 space-y-3",children:[st.sitemapUrl&&r.jsxs("div",{className:"rounded-lg border border-zinc-800/60 bg-zinc-900/20 p-3",children:[r.jsx("p",{className:"text-xs uppercase tracking-wide text-zinc-500",children:"Current sitemap URL"}),r.jsx("p",{className:"mt-1 text-sm text-zinc-200 break-all",children:st.sitemapUrl})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx(oe,{type:"button",size:"sm",variant:"outline",disabled:he||!st.propertyId,onClick:()=>{Ua()},children:he?"Loading…":"Browse sitemaps from GSC"}),r.jsx(oe,{type:"button",size:"sm",variant:"outline",disabled:mt.isPending||!st.propertyId,onClick:ms,children:mt.isPending?"Discovering…":"Auto-discover and queue inspection"})]}),r.jsx("p",{className:"text-xs text-zinc-500",children:"Browse lists available sitemaps without queueing a run. Auto-discover saves the primary sitemap and queues an inspection."}),Je&&Je.length>0&&r.jsxs("div",{className:"rounded-lg border border-zinc-800/60 bg-zinc-900/20 p-3 space-y-2",children:[r.jsxs("p",{className:"text-xs uppercase tracking-wide text-zinc-500",children:["Sitemaps (",Je.length,")"]}),Je.map(B=>{const fe=B.contents?.[0];return r.jsxs("div",{className:"flex items-start justify-between gap-2 text-xs",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-zinc-200 break-all",children:B.path}),B.lastSubmitted&&r.jsxs("p",{className:"text-zinc-500",children:["Submitted: ",B.lastSubmitted.split("T")[0]]})]}),r.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[fe&&r.jsxs("div",{className:"text-right",children:[r.jsxs("p",{className:"text-zinc-300",children:[fe.indexed," / ",fe.submitted]}),r.jsx("p",{className:"text-zinc-500",children:"indexed"})]}),r.jsx("button",{type:"button",className:"text-xs text-zinc-400 hover:text-zinc-200 transition-colors",onClick:()=>Ye(B.path),children:"Use"})]})]},B.path)})]}),r.jsxs("div",{className:"flex flex-col gap-2 lg:flex-row",children:[r.jsx("input",{className:"flex-1 rounded border border-zinc-700 bg-transparent px-2 py-1.5 text-sm text-zinc-200 placeholder-zinc-600 focus:border-zinc-500 focus:outline-none",type:"url",placeholder:st.sitemapUrl?"Update sitemap URL…":"https://example.com/sitemap.xml",value:Ie,onChange:B=>Ye(B.target.value),onKeyDown:B=>B.key==="Enter"&&Ie.trim()&&void Cs()}),r.jsx(oe,{type:"button",size:"sm",disabled:Vt||!Ie.trim(),onClick:Cs,children:Vt?"Saving…":st.sitemapUrl?"Update":"Save"})]}),r.jsxs("div",{className:"flex flex-col gap-2 lg:flex-row",children:[r.jsx("input",{className:"flex-1 rounded border border-zinc-700 bg-transparent px-2 py-1.5 text-sm text-zinc-200 placeholder-zinc-600 focus:border-zinc-500 focus:outline-none",type:"url",placeholder:"Sitemap URL for inspection (leave empty for saved default)",id:`gsc-sitemap-inspect-${e}`}),r.jsx(oe,{type:"button",size:"sm",variant:"outline",disabled:yn.isPending||!st.propertyId,onClick:async()=>{const fe=document.getElementById(`gsc-sitemap-inspect-${e}`)?.value?.trim()||st.sitemapUrl||void 0;Ke(null),gn(null);try{await yn.mutateAsync({projectName:e,projectLabel:e,opts:{sitemapUrl:fe}})}catch{}},children:yn.isPending?"Queueing…":"Inspect sitemap"})]}),!st.propertyId&&r.jsx("p",{className:"text-xs text-amber-400",children:"Select a Search Console property first."})]})]})]})]})]})]})}function L$({project:e,onUpdateProject:t,onRefresh:n}){const[a,o]=w.useState(!1),[c,u]=w.useState(!1),[f,m]=w.useState(null),[p,v]=w.useState(e.displayName),[y,b]=w.useState(e.canonicalDomain),[x,N]=w.useState(e.country),[S,C]=w.useState(e.language),[k,T]=w.useState(e.ownedDomains??[]),[A,z]=w.useState(""),[$,P]=w.useState(null),[E,O]=w.useState(!1),[K,ee]=w.useState(!1),[X,se]=w.useState(""),[de,Ee]=w.useState(""),[be,H]=w.useState(""),[ae,pe]=w.useState(""),[ce,U]=w.useState("");w.useEffect(()=>{a||(v(e.displayName),b(e.canonicalDomain),N(e.country),C(e.language),T(e.ownedDomains??[]))},[e,a]);function R(){o(!1),m(null),v(e.displayName),b(e.canonicalDomain),N(e.country),C(e.language),T(e.ownedDomains??[]),z("")}function M(){const le=A.trim();le&&(k.includes(le)||T([...k,le]),z(""))}function J(le){T(k.filter(Ie=>Ie!==le))}async function V(){if(!(!p.trim()||!y.trim()||!x.trim()||!S.trim())){u(!0),m(null);try{await t(e.name,{displayName:p.trim(),canonicalDomain:y.trim(),ownedDomains:k,country:x.trim(),language:S.trim()}),o(!1),Fe({title:"Project settings saved",detail:`${p.trim()} was updated.`,tone:"positive",dedupeKey:`project:update:${e.name}`,dedupeMode:"replace"})}catch(le){m(le instanceof Error?le.message:"Failed to save")}finally{u(!1)}}}async function Q(){const le=X.trim(),Ie=de.trim(),Ye=be.trim(),Vt=ae.trim();if(!(!le||!Ie||!Ye||!Vt)){O(!0),P(null);try{const Ut={label:le,city:Ie,region:Ye,country:Vt};ce.trim()&&(Ut.timezone=ce.trim()),await i2(e.name,Ut),n(),se(""),Ee(""),H(""),pe(""),U(""),ee(!1),Fe({title:"Location added",detail:`${le} is now available for ${e.name}.`,tone:"positive",dedupeKey:`project:location:add:${e.name}:${le}`,dedupeMode:"drop"})}catch(Ut){P(Ut instanceof Error?Ut.message:"Failed to add location")}finally{O(!1)}}}async function me(le){O(!0),P(null);try{await a2(e.name,le),n(),Fe({title:"Location removed",detail:`${le} was removed from ${e.name}.`,tone:"positive",dedupeKey:`project:location:remove:${e.name}:${le}`,dedupeMode:"drop"})}catch(Ie){P(Ie instanceof Error?Ie.message:"Failed to remove location")}finally{O(!1)}}async function ge(le){O(!0),P(null);try{await r2(e.name,le),n(),Fe({title:"Default location updated",detail:`${le} is now the default for ${e.name}.`,tone:"positive",dedupeKey:`project:location:default:${e.name}`,dedupeMode:"replace"})}catch(Ie){P(Ie instanceof Error?Ie.message:"Failed to set default location")}finally{O(!1)}}const Ne=p!==e.displayName||y!==e.canonicalDomain||x!==e.country||S!==e.language||JSON.stringify(k)!==JSON.stringify(e.ownedDomains??[]),he="w-full rounded border border-zinc-700 bg-transparent px-2 py-1.5 text-sm text-zinc-200 placeholder-zinc-600 focus:border-zinc-500 focus:outline-none",Me="block text-xs font-medium text-zinc-400 mb-1",Je=X.trim()&&de.trim()&&be.trim()&&ae.trim();return r.jsxs("section",{className:"page-section-divider",children:[r.jsxs("div",{className:"section-head section-head-inline",children:[r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Configuration"}),r.jsx("h2",{children:"Project settings"})]}),!a&&r.jsx(oe,{type:"button",variant:"outline",size:"sm",onClick:()=>o(!0),children:"Edit settings"})]}),f&&r.jsxs("div",{className:"mb-3 rounded-lg border border-rose-800/40 bg-rose-950/20 px-3 py-2 text-sm text-rose-300",children:[f,r.jsx("button",{type:"button",className:"ml-2 text-rose-400 hover:text-rose-200",onClick:()=>m(null),children:"×"})]}),a?r.jsxs("div",{className:"rounded-lg border border-zinc-800 bg-zinc-900/40 p-4 space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:Me,children:"Display name"}),r.jsx("input",{className:he,type:"text",value:p,onChange:le=>v(le.target.value),placeholder:"My Project"})]}),r.jsxs("div",{children:[r.jsx("label",{className:Me,children:"Canonical domain"}),r.jsx("input",{className:he,type:"text",value:y,onChange:le=>b(le.target.value),placeholder:"example.com"})]}),r.jsxs("div",{children:[r.jsx("label",{className:Me,children:"Country"}),r.jsx("input",{className:he,type:"text",value:x,onChange:le=>N(le.target.value),placeholder:"US",maxLength:2})]}),r.jsxs("div",{children:[r.jsx("label",{className:Me,children:"Language"}),r.jsx("input",{className:he,type:"text",value:S,onChange:le=>C(le.target.value),placeholder:"en"})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:Me,children:"Owned domains"}),r.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2",children:k.map(le=>r.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full border border-zinc-700/60 bg-zinc-800/40 px-2 py-0.5 text-xs text-zinc-300",children:[le,r.jsx("button",{type:"button",className:"ml-0.5 text-zinc-500 hover:text-zinc-200 transition-colors",onClick:()=>J(le),"aria-label":`Remove ${le}`,children:"×"})]},le))}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx("input",{className:`${he} flex-1`,type:"text",placeholder:"docs.example.com",value:A,onChange:le=>z(le.target.value),onKeyDown:le=>le.key==="Enter"&&(le.preventDefault(),M())}),r.jsx(oe,{type:"button",variant:"outline",size:"sm",disabled:!A.trim(),onClick:M,children:"Add"})]})]}),r.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t border-zinc-800/60",children:[r.jsx(oe,{type:"button",disabled:c||!Ne||!p.trim()||!y.trim(),onClick:V,children:c?"Saving...":"Save changes"}),r.jsx(oe,{type:"button",variant:"outline",disabled:c,onClick:R,children:"Cancel"})]})]}):r.jsx("div",{className:"rounded-lg border border-zinc-800/60 bg-zinc-900/30 overflow-hidden",children:r.jsx("table",{className:"w-full text-sm",children:r.jsxs("tbody",{children:[r.jsxs("tr",{className:"border-b border-zinc-800/40",children:[r.jsx("td",{className:"px-4 py-2.5 text-zinc-500 font-medium w-40",children:"Display name"}),r.jsx("td",{className:"px-4 py-2.5 text-zinc-200",children:e.displayName||"—"})]}),r.jsxs("tr",{className:"border-b border-zinc-800/40",children:[r.jsx("td",{className:"px-4 py-2.5 text-zinc-500 font-medium",children:"Canonical domain"}),r.jsx("td",{className:"px-4 py-2.5 text-zinc-200",children:e.canonicalDomain})]}),r.jsxs("tr",{className:"border-b border-zinc-800/40",children:[r.jsx("td",{className:"px-4 py-2.5 text-zinc-500 font-medium",children:"Owned domains"}),r.jsx("td",{className:"px-4 py-2.5",children:(e.ownedDomains??[]).length>0?r.jsx("div",{className:"flex flex-wrap gap-1.5",children:e.ownedDomains.map(le=>r.jsx("span",{className:"rounded-full border border-zinc-700/60 bg-zinc-800/40 px-2 py-0.5 text-xs text-zinc-300",children:le},le))}):r.jsx("span",{className:"text-zinc-500",children:"—"})})]}),r.jsxs("tr",{className:"border-b border-zinc-800/40",children:[r.jsx("td",{className:"px-4 py-2.5 text-zinc-500 font-medium",children:"Country"}),r.jsx("td",{className:"px-4 py-2.5 text-zinc-200",children:e.country})]}),r.jsxs("tr",{className:"border-b border-zinc-800/40",children:[r.jsx("td",{className:"px-4 py-2.5 text-zinc-500 font-medium",children:"Language"}),r.jsx("td",{className:"px-4 py-2.5 text-zinc-200",children:e.language})]}),r.jsxs("tr",{children:[r.jsx("td",{className:"px-4 py-2.5 text-zinc-500 font-medium align-top pt-3",children:"Locations"}),r.jsxs("td",{className:"px-4 py-2.5",children:[$&&r.jsxs("div",{className:"mb-2 rounded border border-rose-800/40 bg-rose-950/20 px-2 py-1 text-xs text-rose-300",children:[$,r.jsx("button",{type:"button",className:"ml-1 text-rose-400 hover:text-rose-200",onClick:()=>P(null),children:"×"})]}),(e.locations??[]).length>0?r.jsxs("table",{className:"w-full text-xs mb-2",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"text-zinc-600",children:[r.jsx("th",{className:"text-left pb-1 font-medium pr-3",children:"Label"}),r.jsx("th",{className:"text-left pb-1 font-medium pr-3",children:"City"}),r.jsx("th",{className:"text-left pb-1 font-medium pr-3",children:"Region"}),r.jsx("th",{className:"text-left pb-1 font-medium pr-3",children:"Country"}),r.jsx("th",{className:"text-left pb-1 font-medium pr-3",children:"Timezone"}),r.jsx("th",{className:"pb-1"})]})}),r.jsx("tbody",{children:e.locations.map(le=>r.jsxs("tr",{className:"border-t border-zinc-800/30",children:[r.jsx("td",{className:"py-1.5 pr-3",children:r.jsxs("span",{className:`inline-flex items-center gap-1 rounded-full border px-1.5 py-0.5 text-[10px] font-medium ${le.label===e.defaultLocation?"border-emerald-700/60 bg-emerald-950/30 text-emerald-300":"border-zinc-700/60 bg-zinc-800/40 text-zinc-300"}`,children:[le.label,le.label===e.defaultLocation?" ★":""]})}),r.jsx("td",{className:"py-1.5 pr-3 text-zinc-300",children:le.city}),r.jsx("td",{className:"py-1.5 pr-3 text-zinc-300",children:le.region}),r.jsx("td",{className:"py-1.5 pr-3 text-zinc-300",children:le.country}),r.jsx("td",{className:"py-1.5 pr-3 text-zinc-500",children:le.timezone??"—"}),r.jsx("td",{className:"py-1.5",children:r.jsxs("div",{className:"flex items-center gap-1.5",children:[le.label!==e.defaultLocation&&r.jsx("button",{type:"button",disabled:E,onClick:()=>ge(le.label),className:"text-[10px] text-zinc-500 hover:text-emerald-400 transition-colors disabled:opacity-40","aria-label":`Set ${le.label} as default location`,children:"Set default"}),r.jsx("button",{type:"button",disabled:E,onClick:()=>me(le.label),className:"text-[10px] text-zinc-500 hover:text-rose-400 transition-colors disabled:opacity-40","aria-label":`Remove location ${le.label}`,children:"Remove"})]})})]},le.label))})]}):r.jsx("p",{className:"text-zinc-500 text-xs mb-2",children:"No locations configured"}),K?r.jsxs("div",{className:"mt-2 rounded border border-zinc-800 bg-zinc-900/50 p-3 space-y-2",children:[r.jsx("p",{className:"text-[10px] font-medium uppercase tracking-wide text-zinc-500",children:"Add location"}),r.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[r.jsxs("div",{children:[r.jsx("label",{className:"block text-[10px] text-zinc-500 mb-0.5",children:"Label *"}),r.jsx("input",{className:he,type:"text",value:X,onChange:le=>se(le.target.value),placeholder:"nyc"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-[10px] text-zinc-500 mb-0.5",children:"City *"}),r.jsx("input",{className:he,type:"text",value:de,onChange:le=>Ee(le.target.value),placeholder:"New York"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-[10px] text-zinc-500 mb-0.5",children:"Region *"}),r.jsx("input",{className:he,type:"text",value:be,onChange:le=>H(le.target.value),placeholder:"NY"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"block text-[10px] text-zinc-500 mb-0.5",children:"Country *"}),r.jsx("input",{className:he,type:"text",value:ae,onChange:le=>pe(le.target.value),placeholder:"US",maxLength:2})]}),r.jsxs("div",{className:"col-span-2",children:[r.jsx("label",{className:"block text-[10px] text-zinc-500 mb-0.5",children:"Timezone (optional)"}),r.jsx("input",{className:he,type:"text",value:ce,onChange:le=>U(le.target.value),placeholder:"America/New_York"})]})]}),r.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[r.jsx(oe,{type:"button",size:"sm",disabled:E||!Je,onClick:Q,children:E?"Adding...":"Add location"}),r.jsx(oe,{type:"button",size:"sm",variant:"outline",disabled:E,onClick:()=>{ee(!1),P(null)},children:"Cancel"})]})]}):r.jsx(oe,{type:"button",size:"sm",variant:"outline",onClick:()=>ee(!0),children:"+ Add location"})]})]})]})})})]})}const D$=[{value:"daily",label:"Every day"},{value:"weekly@mon",label:"Every Monday"},{value:"weekly@wed",label:"Every Wednesday"},{value:"weekly@fri",label:"Every Friday"},{value:"twice-daily",label:"Twice a day (6am & 6pm)"},{value:"custom",label:"Custom cron expression"}],gS=["UTC","America/New_York","America/Chicago","America/Denver","America/Los_Angeles","America/Toronto","America/Vancouver","Europe/London","Europe/Paris","Europe/Berlin","Asia/Tokyo","Asia/Shanghai","Asia/Singapore","Australia/Sydney"];function M$({projectName:e}){const[t,n]=w.useState("loading"),[a,o]=w.useState(!1),[c,u]=w.useState("daily"),[f,m]=w.useState(6),[p,v]=w.useState(""),[y,b]=w.useState("UTC"),[x,N]=w.useState(!1),[S,C]=w.useState(""),[k,T]=w.useState(!1),[A,z]=w.useState(!1),[$,P]=w.useState(null);w.useEffect(()=>{m2(e).then(n).catch(()=>n(null))},[e]);const E=()=>{if(t&&t!=="loading"){const X=UE(t.preset??null,t.cronExpr);u(X.freq),m(X.hour),v(X.customCron);const se=gS.includes(t.timezone);b(se?t.timezone:"Other"),N(!se),C(se?"":t.timezone)}else u("daily"),m(6),v(""),b("UTC"),N(!1),C("");P(null),o(!0)},O=async()=>{T(!0),P(null);try{const se={timezone:x?S.trim()||"UTC":y};c==="custom"?se.cron=p.trim():se.preset=PE(c,f);const de=await Gb(e,se);n(de),o(!1),Fe({title:"Schedule saved",detail:Vh(de.preset??null,de.cronExpr,de.timezone),tone:"positive",dedupeKey:`schedule:${e}`,dedupeMode:"replace"})}catch(X){P(X instanceof Error?X.message:"Failed to save schedule")}finally{T(!1)}},K=async()=>{if(!(!t||t==="loading")){T(!0),P(null);try{const X={timezone:t.timezone,enabled:!t.enabled};t.preset?X.preset=t.preset:X.cron=t.cronExpr;const se=await Gb(e,X);n(se),Fe({title:se.enabled?"Schedule resumed":"Schedule paused",detail:Vh(se.preset??null,se.cronExpr,se.timezone),tone:"positive",dedupeKey:`schedule:toggle:${e}`,dedupeMode:"replace"})}catch(X){P(X instanceof Error?X.message:"Failed to update schedule")}finally{T(!1)}}},ee=async()=>{z(!0),P(null);try{await p2(e),n(null),o(!1),Fe({title:"Schedule removed",detail:`${e} will no longer run automatically.`,tone:"positive",dedupeKey:`schedule:remove:${e}`,dedupeMode:"drop"})}catch(X){P(X instanceof Error?X.message:"Failed to remove schedule")}finally{z(!1)}};return r.jsxs("section",{className:"page-section-divider",children:[r.jsxs("div",{className:"section-head section-head-inline",children:[r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Automation"}),r.jsx("h2",{children:"Scheduled runs"})]}),t!=="loading"&&!a&&r.jsx(oe,{type:"button",variant:"outline",size:"sm",onClick:E,children:t?"Edit schedule":"+ Set schedule"})]}),t==="loading"&&r.jsx("p",{className:"supporting-copy",children:"Loading..."}),t!=="loading"&&!a&&t===null&&r.jsx(Le,{className:"surface-card compact-card",children:r.jsx("p",{className:"supporting-copy",children:"No schedule configured. Set one to automatically trigger visibility sweeps."})}),t!=="loading"&&!a&&t!==null&&r.jsxs(Le,{className:"surface-card compact-card",children:[r.jsxs("div",{className:"flex items-start justify-between gap-4",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-sm font-medium text-zinc-200",children:Vh(t.preset??null,t.cronExpr,t.timezone)}),r.jsxs("p",{className:"text-xs text-zinc-500",children:["Cron: ",r.jsx("span",{className:"font-mono",children:t.cronExpr})]}),t.nextRunAt&&r.jsxs("p",{className:"text-xs text-zinc-500",children:["Next run: ",new Date(t.nextRunAt).toLocaleString()]}),t.lastRunAt&&r.jsxs("p",{className:"text-xs text-zinc-500",children:["Last run: ",new Date(t.lastRunAt).toLocaleString()]})]}),r.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[r.jsx(lt,{tone:t.enabled?"positive":"neutral",children:t.enabled?"Active":"Paused"}),r.jsx(oe,{type:"button",variant:"outline",size:"sm",disabled:k,onClick:K,children:t.enabled?"Pause":"Resume"}),r.jsx(oe,{type:"button",variant:"ghost",size:"sm",disabled:A,onClick:ee,children:A?"Removing...":"Remove"})]})]}),$&&r.jsx("p",{className:"text-rose-400 text-sm mt-2",children:$})]}),a&&r.jsxs("div",{className:"rounded-lg border border-zinc-800 bg-zinc-900/40 p-4 space-y-3",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{className:"text-xs font-medium text-zinc-400",children:"Frequency"}),r.jsx("select",{className:"w-full rounded border border-zinc-700 bg-zinc-900 px-2 py-1.5 text-sm text-zinc-200 focus:border-zinc-500 focus:outline-none",value:c,onChange:X=>u(X.target.value),children:D$.map(X=>r.jsx("option",{value:X.value,children:X.label},X.value))})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{className:"text-xs font-medium text-zinc-400",children:"Time"}),r.jsx("select",{className:"w-full rounded border border-zinc-700 bg-zinc-900 px-2 py-1.5 text-sm text-zinc-200 focus:border-zinc-500 focus:outline-none disabled:opacity-40",value:f,disabled:c==="twice-daily"||c==="custom",onChange:X=>m(parseInt(X.target.value)),children:Array.from({length:24},(X,se)=>r.jsx("option",{value:se,children:Dm(se)},se))})]})]}),c==="custom"&&r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{className:"text-xs font-medium text-zinc-400",children:"Cron expression"}),r.jsx("input",{className:"w-full rounded border border-zinc-700 bg-transparent px-2 py-1.5 text-sm text-zinc-200 placeholder-zinc-600 font-mono focus:border-zinc-500 focus:outline-none",type:"text",placeholder:"0 9 * * 1-5",value:p,onChange:X=>v(X.target.value)})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{className:"text-xs font-medium text-zinc-400",children:"Timezone"}),r.jsxs("select",{className:"w-full rounded border border-zinc-700 bg-zinc-900 px-2 py-1.5 text-sm text-zinc-200 focus:border-zinc-500 focus:outline-none",value:x?"Other":y,onChange:X=>{X.target.value==="Other"?(N(!0),b("Other")):(N(!1),b(X.target.value))},children:[gS.map(X=>r.jsx("option",{value:X,children:X},X)),r.jsxs("option",{value:"Other",children:["Other (enter manually)","…"]})]}),x&&r.jsx("input",{className:"w-full rounded border border-zinc-700 bg-transparent px-2 py-1.5 text-sm text-zinc-200 placeholder-zinc-600 focus:border-zinc-500 focus:outline-none",type:"text",placeholder:"e.g. America/New_York",value:S,onChange:X=>C(X.target.value)})]}),$&&r.jsx("p",{className:"text-rose-400 text-sm",children:$}),r.jsxs("div",{className:"flex gap-2 justify-end",children:[r.jsx(oe,{type:"button",variant:"outline",size:"sm",onClick:()=>{o(!1),P(null)},children:"Cancel"}),r.jsx(oe,{type:"button",size:"sm",disabled:k||c==="custom"&&!p.trim(),onClick:O,children:k?"Saving...":"Save schedule"})]})]})]})}const $$=[{value:"citation.lost",label:"Citation lost"},{value:"citation.gained",label:"Citation gained"},{value:"run.completed",label:"Run completed"},{value:"run.failed",label:"Run failed"}];function P$({projectName:e}){const[t,n]=w.useState("loading"),[a,o]=w.useState(!1),[c,u]=w.useState(""),[f,m]=w.useState(["citation.lost","citation.gained"]),[p,v]=w.useState(!1),[y,b]=w.useState(null),[x,N]=w.useState({});w.useEffect(()=>{g2(e).then(n).catch(()=>n([]))},[e]);const S=A=>{m(z=>z.includes(A)?z.filter($=>$!==A):[...z,A])},C=async()=>{if(!(!c.trim()||f.length===0)){v(!0),b(null);try{const A=await y2(e,{channel:"webhook",url:c.trim(),events:f});n(z=>z==="loading"?[A]:[...z,A]),u(""),m(["citation.lost","citation.gained"]),o(!1),Fe({title:"Webhook added",detail:`Notifications will be sent to ${A.url}.`,tone:"positive",dedupeKey:`notification:add:${e}`,dedupeMode:"drop"})}catch(A){b(A instanceof Error?A.message:"Failed to add webhook")}finally{v(!1)}}},k=async A=>{try{await v2(e,A),n(z=>z==="loading"?z:z.filter($=>$.id!==A)),Fe({title:"Webhook removed",detail:`${e} no longer sends notifications to this endpoint.`,tone:"positive",dedupeKey:`notification:remove:${e}:${A}`,dedupeMode:"drop"})}catch(z){b(z instanceof Error?z.message:"Failed to remove webhook")}},T=async A=>{N(z=>({...z,[A]:{state:"testing"}}));try{const z=await b2(e,A);N($=>({...$,[A]:{state:z.ok?"ok":"fail",status:z.status}})),z.ok&&Fe({title:"Test notification sent",detail:`Webhook returned status ${z.status}.`,tone:"positive",dedupeKey:`notification:test:${e}:${A}`,dedupeMode:"replace"})}catch{N(z=>({...z,[A]:{state:"fail"}}))}};return r.jsxs("section",{className:"page-section-divider",children:[r.jsxs("div",{className:"section-head section-head-inline",children:[r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Automation"}),r.jsx("h2",{children:"Notifications"})]}),t!=="loading"&&r.jsx(oe,{type:"button",variant:"outline",size:"sm",onClick:()=>{o(!a),b(null)},children:a?"Cancel":"+ Add webhook"})]}),a&&r.jsxs("div",{className:"mb-3 rounded-lg border border-zinc-800 bg-zinc-900/40 p-4 space-y-3",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{className:"text-xs font-medium text-zinc-400",children:"Webhook URL"}),r.jsx("input",{className:"w-full rounded border border-zinc-700 bg-transparent px-2 py-1.5 text-sm text-zinc-200 placeholder-zinc-600 focus:border-zinc-500 focus:outline-none",type:"url",placeholder:"https://hooks.example.com/canonry",value:c,onChange:A=>u(A.target.value)})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx("label",{className:"text-xs font-medium text-zinc-400",children:"Trigger on"}),r.jsx("div",{className:"flex flex-wrap gap-3",children:$$.map(A=>r.jsxs("label",{className:"flex items-center gap-1.5 cursor-pointer select-none",children:[r.jsx("input",{type:"checkbox",className:"rounded border-zinc-600 bg-zinc-800",checked:f.includes(A.value),onChange:()=>S(A.value)}),r.jsx("span",{className:"text-sm text-zinc-300",children:A.label})]},A.value))})]}),y&&r.jsx("p",{className:"text-rose-400 text-sm",children:y}),r.jsxs("div",{className:"flex gap-2 justify-end",children:[r.jsx(oe,{type:"button",variant:"outline",size:"sm",onClick:()=>{o(!1),b(null)},children:"Cancel"}),r.jsx(oe,{type:"button",size:"sm",disabled:p||!c.trim()||f.length===0,onClick:C,children:p?"Adding...":"Add webhook"})]})]}),t==="loading"&&r.jsx("p",{className:"supporting-copy",children:"Loading..."}),t!=="loading"&&t.length===0&&!a&&r.jsx(Le,{className:"surface-card compact-card",children:r.jsx("p",{className:"supporting-copy",children:"No webhooks configured. Add one to get alerted when citations change or runs complete."})}),t!=="loading"&&t.length>0&&r.jsxs("div",{className:"evidence-table-wrap",children:[r.jsxs("table",{className:"evidence-table",children:[r.jsx("thead",{children:r.jsxs("tr",{children:[r.jsx("th",{children:"Endpoint"}),r.jsx("th",{children:"Events"}),r.jsx("th",{children:"Status"}),r.jsx("th",{})]})}),r.jsx("tbody",{children:t.map(A=>r.jsxs("tr",{children:[r.jsx("td",{className:"evidence-keyword-cell",children:r.jsx("span",{className:"font-mono text-xs text-zinc-300 break-all",title:A.urlHost,children:A.urlDisplay??A.url})}),r.jsx("td",{children:r.jsx("div",{className:"flex flex-wrap gap-1",children:A.events.map(z=>r.jsx("span",{className:"inline-flex items-center rounded-full border border-zinc-700 bg-zinc-800/60 px-2 py-0.5 text-[10px] font-medium text-zinc-400 uppercase tracking-wide",children:z.replace("."," ")},z))})}),r.jsx("td",{children:r.jsx(lt,{tone:A.enabled?"positive":"neutral",children:A.enabled?"Active":"Paused"})}),r.jsx("td",{children:r.jsxs("div",{className:"flex items-center gap-1 justify-end",children:[x[A.id]&&(()=>{const z=x[A.id],$=z.state==="testing"?"Sending…":z.state==="ok"?`Delivered${z.status?` (${z.status})`:""}`:`Failed${z.status?` (${z.status})`:""}`;return r.jsx(lt,{tone:z.state==="ok"?"positive":z.state==="fail"?"negative":"neutral",children:$})})(),r.jsx(oe,{variant:"ghost",size:"sm",type:"button",disabled:x[A.id]?.state==="testing",onClick:()=>T(A.id),children:"Test"}),r.jsx(oe,{variant:"ghost",size:"sm",type:"button",onClick:()=>k(A.id),children:"Remove"})]})})]},A.id))})]}),y&&r.jsx("p",{className:"text-rose-400 text-sm mt-2",children:y})]})]})}function yS({eyebrow:e,title:t,status:n,tone:a,targetLabel:o,targetValue:c,coverageValue:u,note:f,updatedAt:m,active:p,onClick:v}){return r.jsxs("button",{type:"button",onClick:v,className:`surface-card w-full text-left transition-colors ${p?"border-zinc-200 bg-zinc-900/50":"hover:border-zinc-700 hover:bg-zinc-900/40"}`,children:[r.jsxs("div",{className:"section-head",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:e}),r.jsx("h3",{children:t})]}),r.jsx(lt,{tone:a,children:n})]}),r.jsxs("div",{className:"mt-4 grid gap-3 sm:grid-cols-2",children:[r.jsxs("div",{className:"rounded-lg border border-zinc-800/60 bg-zinc-900/20 p-3",children:[r.jsx("p",{className:"text-xs uppercase tracking-wide text-zinc-500",children:o}),r.jsx("p",{className:"mt-1 truncate text-sm text-zinc-200",children:c})]}),r.jsxs("div",{className:"rounded-lg border border-zinc-800/60 bg-zinc-900/20 p-3",children:[r.jsx("p",{className:"text-xs uppercase tracking-wide text-zinc-500",children:"Coverage"}),r.jsx("p",{className:"mt-1 text-sm text-zinc-200",children:u})]})]}),r.jsxs("div",{className:"mt-3 flex flex-col gap-1 text-xs text-zinc-500 sm:flex-row sm:items-center sm:justify-between",children:[r.jsx("span",{children:f}),r.jsx("span",{children:m?`Updated ${cs(m)}`:"No recent sync yet"})]})]})}function cu({label:e,value:t,tone:n}){const a=n==="positive"?"text-emerald-400":n==="negative"?"text-rose-400":"text-zinc-200";return r.jsxs("div",{className:"rounded-lg border border-zinc-800/60 bg-zinc-900/20 p-3",children:[r.jsx("p",{className:"text-xs uppercase tracking-wide text-zinc-500",children:e}),r.jsx("p",{className:`mt-2 text-2xl font-semibold ${a}`,children:t})]})}function U$({projectName:e,refreshNonce:t}){const[n,a]=w.useState(null),[o,c]=w.useState([]),[u,f]=w.useState(null),[m,p]=w.useState([]),[v,y]=w.useState([]),[b,x]=w.useState(null),[N,S]=w.useState(""),[C,k]=w.useState(""),[T,A]=w.useState(""),[z,$]=w.useState(!0),[P,E]=w.useState(!1),[O,K]=w.useState(null),[ee,X]=w.useState("coverage");w.useEffect(()=>{se()},[e,t]);async function se(){$(!0),K(null);try{const U=await cj(e);if(a(U),U.connected){const[R,M,J,V]=await Promise.all([zp(e).catch(()=>null),uj(e).catch(()=>[]),B2(e).catch(()=>[]),U.siteUrl?Promise.resolve([]):U2(e).then(Q=>Q.sites).catch(()=>[])]);f(R),p(M),y(J),c(V)}else f(null),p([]),y([]),c([])}catch(U){K(U instanceof Error?U.message:"Failed to load Bing data")}finally{$(!1)}}async function de(){if(C.trim()){K(null);try{const U=await $2(e,C.trim());k(""),U.availableSites.length>0&&c(U.availableSites),await se()}catch(U){K(U instanceof Error?U.message:"Failed to connect")}}}async function Ee(){try{await P2(e),a(null),c([]),f(null),p([]),y([]),x(null),A(""),K(null)}catch(U){K(U instanceof Error?U.message:"Failed to disconnect")}}async function be(){if(T)try{await I2(e,T),await se()}catch(U){K(U instanceof Error?U.message:"Failed to set site")}}async function H(){if(N.trim())try{const U=await dj(e,N.trim());x(U),p(R=>[U,...R])}catch(U){K(U instanceof Error?U.message:"Inspection failed")}}async function ae(U){E(!0),K(null);try{const R=await Vb(e,{urls:[U]}),{succeeded:M,failed:J,total:V}=R.summary;Fe({title:"Bing submission requested",detail:J===0?`${M} URL submitted to Bing.`:`${M}/${V} submitted successfully, ${J} failed.`,tone:J===0?"positive":"caution",dedupeKey:`bing:indexing:${e}:${U}`,dedupeMode:"replace"})}catch(R){const M=R instanceof Error?R.message:"Submission failed";K(M),Fe({title:"Bing submission failed",detail:M,tone:"negative",dedupeKey:`bing:indexing:${e}:${U}`,dedupeMode:"replace"})}finally{E(!1)}}async function pe(){E(!0),K(null),Fe({title:"Submitting URLs to Bing",detail:"Requesting indexing for all currently unindexed URLs.",tone:"neutral",dedupeKey:`bing:indexing-all:${e}`,dedupeMode:"replace"});try{const U=await Vb(e,{allUnindexed:!0}),{succeeded:R,failed:M,total:J}=U.summary;Fe({title:"Bing submissions requested",detail:M===0?`${R}/${J} URL${J!==1?"s":""} submitted to Bing.`:`${R}/${J} submitted successfully, ${M} failed.`,tone:M===0?"positive":"caution",dedupeKey:`bing:indexing-all:${e}`,dedupeMode:"replace"})}catch(U){const R=U instanceof Error?U.message:"Batch submission failed";K(R),Fe({title:"Bing submissions failed",detail:R,tone:"negative",dedupeKey:`bing:indexing-all:${e}`,dedupeMode:"replace"})}finally{E(!1)}}if(z)return r.jsx(Le,{className:"surface-card",children:r.jsx("div",{className:"text-sm text-zinc-400",children:"Loading Bing data..."})});if(!n?.connected)return r.jsxs(Le,{className:"surface-card",children:[r.jsxs("div",{className:"section-head section-head-inline",children:[r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Connection"}),r.jsx("h3",{children:"Domain authorization"})]}),r.jsx(lt,{tone:"caution",children:"Not connected"})]}),r.jsx("p",{className:"text-sm text-zinc-300",children:"Connect Bing Webmaster Tools to inspect URLs, monitor index coverage, and submit pages for indexing."}),r.jsxs("div",{className:"mt-3",children:[r.jsx("label",{className:"text-xs text-zinc-500",htmlFor:"bing-api-key",children:"API Key"}),r.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[r.jsx("input",{id:"bing-api-key",type:"password",className:"flex-1 rounded border border-zinc-700 bg-transparent px-2 py-1.5 text-sm text-zinc-200 placeholder-zinc-600 focus:border-zinc-500 focus:outline-none",placeholder:"Bing Webmaster Tools API key",value:C,onChange:U=>k(U.target.value),onKeyDown:U=>U.key==="Enter"&&de()}),r.jsx(oe,{size:"sm",disabled:!C.trim(),onClick:de,children:"Connect"})]}),r.jsxs("p",{className:"mt-1 text-[11px] text-zinc-500",children:["Get your API key from"," ",r.jsx("a",{href:"https://www.bing.com/webmasters/",target:"_blank",rel:"noopener noreferrer",className:"text-zinc-400 hover:text-zinc-300 underline underline-offset-2",children:"Bing Webmaster Tools"})]})]}),O&&r.jsx("p",{className:"mt-3 text-xs text-rose-400",children:O})]});if(!n.siteUrl)return r.jsxs(Le,{className:"surface-card",children:[r.jsxs("div",{className:"section-head section-head-inline",children:[r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Connection"}),r.jsx("h3",{children:"Domain authorization"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(lt,{tone:"positive",children:"Connected"}),r.jsx(oe,{size:"sm",variant:"ghost",onClick:Ee,children:"Disconnect"})]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"rounded-lg border border-zinc-800/60 bg-zinc-900/30 px-4 py-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("span",{className:"h-2 w-2 rounded-full bg-emerald-500"}),r.jsx("span",{className:"text-sm text-zinc-200",children:"Authorized for this project domain"}),r.jsx("span",{className:"text-xs text-zinc-500",children:n.domain})]}),r.jsx("p",{className:"mt-2 text-xs text-zinc-500",children:"The API key is connected, but no Bing site is selected yet. Pick the verified site that should receive inspections and indexing requests."})]}),r.jsxs("div",{className:"grid gap-3 lg:grid-cols-2",children:[r.jsxs("div",{className:"rounded-lg border border-zinc-800/60 bg-zinc-900/20 p-3",children:[r.jsx("p",{className:"text-xs uppercase tracking-wide text-zinc-500",children:"Registered domain"}),r.jsx("p",{className:"mt-1 text-sm text-zinc-200",children:n.domain})]}),r.jsxs("div",{className:"rounded-lg border border-zinc-800/60 bg-zinc-900/20 p-3",children:[r.jsx("p",{className:"text-xs uppercase tracking-wide text-zinc-500",children:"Last auth update"}),r.jsx("p",{className:"mt-1 text-sm text-zinc-200",children:n.updatedAt?cs(n.updatedAt):"—"})]})]}),r.jsxs("div",{className:"rounded-lg border border-zinc-800/60 bg-zinc-900/20 p-3",children:[r.jsx("p",{className:"text-xs uppercase tracking-wide text-zinc-500",children:"Select site"}),o.length>0?r.jsxs("div",{className:"mt-3 flex flex-col gap-2 lg:flex-row",children:[r.jsxs("select",{className:"flex-1 rounded border border-zinc-700 bg-zinc-900 px-2 py-1.5 text-sm text-zinc-200 focus:border-zinc-500 focus:outline-none",value:T,onChange:U=>A(U.target.value),children:[r.jsx("option",{value:"",children:"Select a site..."}),o.map(U=>r.jsxs("option",{value:U.url,children:[U.url,U.verified?" (verified)":""]},U.url))]}),r.jsx(oe,{size:"sm",disabled:!T,onClick:be,children:"Set Site"})]}):r.jsx("p",{className:"mt-3 text-xs text-zinc-500",children:"No verified Bing sites are available yet. Verify the domain in Bing Webmaster Tools, then use the page-level refresh to reload everything."})]})]}),O&&r.jsx("p",{className:"mt-3 text-xs text-rose-400",children:O})]});const ce=[{key:"coverage",label:"Coverage"},{key:"inspections",label:"Inspections"},{key:"performance",label:"Performance"}];return r.jsxs("div",{className:"space-y-3",children:[r.jsxs(Le,{className:"surface-card",children:[r.jsxs("div",{className:"section-head section-head-inline",children:[r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Connection"}),r.jsx("h3",{children:"Domain authorization"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(lt,{tone:"positive",children:"Connected"}),r.jsx(oe,{size:"sm",variant:"ghost",onClick:Ee,children:"Disconnect"})]})]}),O&&r.jsx("p",{className:"mb-3 text-xs text-rose-400",children:O}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"rounded-lg border border-zinc-800/60 bg-zinc-900/30 px-4 py-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("span",{className:"h-2 w-2 rounded-full bg-emerald-500"}),r.jsx("span",{className:"text-sm text-zinc-200",children:"Authorized for this project domain"}),r.jsx("span",{className:"text-xs text-zinc-500",children:n.domain})]}),r.jsxs("p",{className:"mt-2 text-xs text-zinc-500",children:["Canonry stores Bing connections per canonical domain. This project is currently mapped to ",r.jsx("code",{children:n.siteUrl}),"."]})]}),r.jsxs("div",{className:"grid gap-3 lg:grid-cols-2",children:[r.jsxs("div",{className:"rounded-lg border border-zinc-800/60 bg-zinc-900/20 p-3",children:[r.jsx("p",{className:"text-xs uppercase tracking-wide text-zinc-500",children:"Selected site"}),r.jsx("p",{className:"mt-1 text-sm text-zinc-200",children:n.siteUrl})]}),r.jsxs("div",{className:"rounded-lg border border-zinc-800/60 bg-zinc-900/20 p-3",children:[r.jsx("p",{className:"text-xs uppercase tracking-wide text-zinc-500",children:"Last auth update"}),r.jsx("p",{className:"mt-1 text-sm text-zinc-200",children:n.updatedAt?cs(n.updatedAt):"—"})]})]})]})]}),r.jsxs(Le,{className:"surface-card",children:[r.jsxs("div",{className:"section-head section-head-inline",children:[r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Coverage"}),r.jsx("h3",{children:"Index monitoring"})]}),r.jsx("p",{className:"text-xs text-zinc-500",children:u?.lastInspectedAt?`Last inspected ${cs(u.lastInspectedAt)}`:"No inspection history yet"})]}),r.jsx("div",{className:"flex gap-1 border-b border-zinc-800",children:ce.map(U=>r.jsx("button",{className:`px-3 py-1.5 text-xs font-medium border-b-2 transition-colors ${ee===U.key?"border-zinc-200 text-zinc-200":"border-transparent text-zinc-500 hover:text-zinc-300"}`,onClick:()=>X(U.key),children:U.label},U.key))}),ee==="coverage"&&u&&r.jsxs("div",{className:"mt-4 space-y-4",children:[r.jsxs("div",{className:"grid gap-3 sm:grid-cols-4",children:[r.jsx(cu,{label:"Indexed",value:u.summary.indexed,tone:"positive"}),r.jsx(cu,{label:"Not in index",value:u.summary.notIndexed+(u.summary.unknown??0),tone:"negative"}),r.jsx(cu,{label:"Status unknown",value:u.summary.unknown??0,tone:"neutral"}),r.jsx(cu,{label:"Coverage",value:`${u.summary.percentage}%`,tone:"neutral"})]}),u.notIndexed.length>0&&r.jsxs("div",{children:[r.jsxs("div",{className:"mb-2 flex items-center justify-between gap-3",children:[r.jsxs("h4",{className:"text-xs font-medium text-zinc-400",children:["Not Indexed (",u.notIndexed.length,")"]}),r.jsx(oe,{size:"sm",variant:"ghost",disabled:P,onClick:pe,children:P?"Submitting…":"Submit all to Bing"})]}),r.jsx("div",{className:"overflow-x-auto rounded-lg border border-zinc-800/60",children:r.jsxs("table",{className:"w-full text-xs",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b border-zinc-800",children:[r.jsx("th",{className:"text-left py-1.5 px-3 text-zinc-500 font-medium",children:"URL"}),r.jsx("th",{className:"text-left py-1.5 px-3 text-zinc-500 font-medium w-16",children:"HTTP"}),r.jsx("th",{className:"text-right py-1.5 px-3 text-zinc-500 font-medium w-20",children:"Action"})]})}),r.jsx("tbody",{children:u.notIndexed.map(U=>r.jsxs("tr",{className:"border-b border-zinc-800/50",children:[r.jsx("td",{className:"py-1.5 px-3 text-zinc-300 truncate max-w-[480px]",children:U.url}),r.jsx("td",{className:"py-1.5 px-3 text-zinc-400",children:U.httpCode??"—"}),r.jsx("td",{className:"py-1.5 px-3 text-right",children:r.jsx("button",{className:"text-[10px] text-zinc-400 hover:text-zinc-200 underline underline-offset-2",disabled:P,onClick:()=>ae(U.url),children:"Submit"})})]},U.id))})]})})]}),(u.unknown??[]).length>0&&r.jsxs("div",{children:[r.jsxs("div",{className:"mb-2 flex items-center justify-between gap-3",children:[r.jsxs("h4",{className:"text-xs font-medium text-zinc-400",children:["Unknown — not yet confirmed (",(u.unknown??[]).length,")"]}),r.jsx(oe,{size:"sm",variant:"ghost",disabled:P,onClick:pe,children:P?"Submitting…":"Submit all to Bing"})]}),r.jsx("div",{className:"overflow-x-auto rounded-lg border border-zinc-800/60",children:r.jsxs("table",{className:"w-full text-xs",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b border-zinc-800",children:[r.jsx("th",{className:"text-left py-1.5 px-3 text-zinc-500 font-medium",children:"URL"}),r.jsx("th",{className:"text-left py-1.5 px-3 text-zinc-500 font-medium w-32",children:"Last Crawled"}),r.jsx("th",{className:"text-right py-1.5 px-3 text-zinc-500 font-medium w-20",children:"Action"})]})}),r.jsx("tbody",{children:(u.unknown??[]).map(U=>r.jsxs("tr",{className:"border-b border-zinc-800/50",children:[r.jsx("td",{className:"py-1.5 px-3 text-zinc-300 truncate max-w-[480px]",children:U.url}),r.jsx("td",{className:"py-1.5 px-3 text-zinc-400",children:U.lastCrawledDate?cs(U.lastCrawledDate):"—"}),r.jsx("td",{className:"py-1.5 px-3 text-right",children:r.jsx("button",{className:"text-[10px] text-zinc-400 hover:text-zinc-200 underline underline-offset-2",disabled:P,onClick:()=>ae(U.url),children:"Submit"})})]},U.id))})]})})]}),u.indexed.length>0&&r.jsxs("div",{children:[r.jsxs("h4",{className:"mb-2 text-xs font-medium text-zinc-400",children:["Indexed (",u.indexed.length,")"]}),r.jsx("div",{className:"overflow-x-auto rounded-lg border border-zinc-800/60",children:r.jsxs("table",{className:"w-full text-xs",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b border-zinc-800",children:[r.jsx("th",{className:"text-left py-1.5 px-3 text-zinc-500 font-medium",children:"URL"}),r.jsx("th",{className:"text-left py-1.5 px-3 text-zinc-500 font-medium w-32",children:"Last Crawled"})]})}),r.jsx("tbody",{children:u.indexed.map(U=>r.jsxs("tr",{className:"border-b border-zinc-800/50",children:[r.jsx("td",{className:"py-1.5 px-3 text-zinc-300 truncate max-w-[480px]",children:U.url}),r.jsx("td",{className:"py-1.5 px-3 text-zinc-400",children:U.lastCrawledDate?cs(U.lastCrawledDate):"—"})]},U.id))})]})})]})]}),ee==="coverage"&&!u&&r.jsx("p",{className:"mt-4 text-xs text-zinc-500",children:"No coverage data yet. Inspect URLs to build coverage data."}),ee==="inspections"&&r.jsxs("div",{className:"mt-4 space-y-3",children:[r.jsxs("div",{className:"flex flex-col gap-2 lg:flex-row",children:[r.jsx("input",{type:"text",className:"flex-1 rounded border border-zinc-700 bg-transparent px-2 py-1.5 text-sm text-zinc-200 placeholder-zinc-600 focus:border-zinc-500 focus:outline-none",placeholder:"URL to inspect",value:N,onChange:U=>S(U.target.value),onKeyDown:U=>U.key==="Enter"&&H()}),r.jsx(oe,{size:"sm",disabled:!N.trim(),onClick:H,children:"Inspect"})]}),b&&r.jsxs("div",{className:"rounded border border-zinc-800 bg-zinc-900/40 p-3 text-xs space-y-1",children:[r.jsx("div",{className:"font-medium text-zinc-200",children:b.url}),r.jsxs("div",{className:"text-zinc-400",children:["In Index: ",r.jsx("span",{className:b.inIndex?"text-emerald-400":"text-rose-400",children:b.inIndex?"Yes":"No"})," · ","HTTP: ",b.httpCode??"—"," · ","Crawled: ",b.lastCrawledDate??"—"]})]}),m.length>0&&r.jsx("div",{className:"overflow-x-auto rounded-lg border border-zinc-800/60",children:r.jsxs("table",{className:"w-full text-xs",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b border-zinc-800",children:[r.jsx("th",{className:"text-left py-1.5 px-3 text-zinc-500 font-medium",children:"URL"}),r.jsx("th",{className:"text-left py-1.5 px-3 text-zinc-500 font-medium w-16",children:"Index"}),r.jsx("th",{className:"text-left py-1.5 px-3 text-zinc-500 font-medium w-14",children:"HTTP"}),r.jsx("th",{className:"text-left py-1.5 px-3 text-zinc-500 font-medium w-32",children:"Inspected"})]})}),r.jsx("tbody",{children:m.map(U=>r.jsxs("tr",{className:"border-b border-zinc-800/50",children:[r.jsx("td",{className:"py-1.5 px-3 text-zinc-300 truncate max-w-[480px]",children:U.url}),r.jsx("td",{className:"py-1.5 px-3",children:r.jsx(lt,{tone:U.inIndex?"positive":"negative",children:U.inIndex?"Yes":"No"})}),r.jsx("td",{className:"py-1.5 px-3 text-zinc-400",children:U.httpCode??"—"}),r.jsx("td",{className:"py-1.5 px-3 text-zinc-400",children:cs(U.inspectedAt)})]},U.id))})]})})]}),ee==="performance"&&r.jsx("div",{className:"mt-4",children:v.length===0?r.jsx("p",{className:"text-xs text-zinc-500",children:"No Bing performance data available."}):r.jsx("div",{className:"overflow-x-auto rounded-lg border border-zinc-800/60",children:r.jsxs("table",{className:"w-full text-xs",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b border-zinc-800",children:[r.jsx("th",{className:"text-left py-1.5 px-3 text-zinc-500 font-medium",children:"Query"}),r.jsx("th",{className:"text-right py-1.5 px-3 text-zinc-500 font-medium w-16",children:"Clicks"}),r.jsx("th",{className:"text-right py-1.5 px-3 text-zinc-500 font-medium w-16",children:"Impr"}),r.jsx("th",{className:"text-right py-1.5 px-3 text-zinc-500 font-medium w-14",children:"CTR"}),r.jsx("th",{className:"text-right py-1.5 px-3 text-zinc-500 font-medium w-14",children:"Pos"})]})}),r.jsx("tbody",{children:v.map((U,R)=>r.jsxs("tr",{className:"border-b border-zinc-800/50",children:[r.jsx("td",{className:"py-1.5 px-3 text-zinc-300 truncate max-w-[480px]",children:U.query}),r.jsx("td",{className:"py-1.5 px-3 text-right text-zinc-200",children:U.clicks}),r.jsx("td",{className:"py-1.5 px-3 text-right text-zinc-400",children:U.impressions}),r.jsxs("td",{className:"py-1.5 px-3 text-right text-zinc-400",children:[(Number.isFinite(U.ctr)?U.ctr*100:0).toFixed(1),"%"]}),r.jsx("td",{className:"py-1.5 px-3 text-right text-zinc-400",children:U.averagePosition.toFixed(1)})]},R))})]})})})]})]})}function I$({projectName:e}){const[t,n]=w.useState("google"),[a,o]=w.useState(!0),[c,u]=w.useState("idle"),[f,m]=w.useState(null),p=w.useRef(null),[v,y]=w.useState(!1),[b,x]=w.useState(null),[N,S]=w.useState(null),[C,k]=w.useState(!1),[T,A]=w.useState(null),[z,$]=w.useState(null),[P,E]=w.useState(0);async function O(R=!1){R||o(!0),m(null);try{const[M,J,V]=await Promise.all([Cp().catch(()=>null),oj(e).catch(()=>[]),cj(e).catch(()=>null)]),Q=J.find(Ne=>Ne.connectionType==="gsc")??null;y(!!M?.google?.configured),k(!!M?.bing?.configured),x(Q),A(V);const[me,ge]=await Promise.all([Q?kp(e).catch(()=>null):Promise.resolve(null),V?.connected?zp(e).catch(()=>null):Promise.resolve(null)]);S(me),$(ge)}catch(M){m(M instanceof Error?M.message:"Failed to load search console overview")}finally{o(!1)}}async function K(){if(c!=="idle")return;p.current?.abort();const R=new AbortController;p.current=R;const M=R.signal;u("syncing"),m(null);const J=[];try{async function V(){if(!b)return;const Ne=await lj(e);if(!Ne?.id)return;const he=2e3,Je=Date.now()+12e4;for(;Date.now()<Je;){if(M.aborted||(await new Promise(Ie=>setTimeout(Ie,he)),M.aborted))return;const le=await Ur(Ne.id).catch(()=>null);if(!le)break;if(["completed","failed","cancelled"].includes(le.status)){le.status!=="completed"&&J.push(`Google sync ${le.status}`);break}}}const Q=10;async function me(){if(!T?.connected)return;const Ne=await uj(e).catch(()=>[]),he=[...new Set(Ne.map(Me=>Me.url))];if(he.length!==0)for(let Me=0;Me<he.length;Me+=Q){if(M.aborted)return;const Je=he.slice(Me,Me+Q),Ie=(await Promise.allSettled(Je.map(Ye=>dj(e,Ye)))).filter(Ye=>Ye.status==="rejected").length;Ie>0&&J.push(`${Ie} Bing inspection(s) failed`)}}const ge=await Promise.allSettled([V(),me()]);for(const Ne of ge)Ne.status==="rejected"&&J.push(Ne.reason instanceof Error?Ne.reason.message:"Sync failed");if(M.aborted)return;u("reloading"),await O(!0),E(Ne=>Ne+1),J.length>0&&m(`Partial refresh: ${J.join("; ")}`)}catch(V){M.aborted||m(V instanceof Error?V.message:"Refresh failed")}finally{M.aborted||u("idle")}}w.useEffect(()=>(O(),()=>{p.current?.abort()}),[e]);const ee=b?"positive":v?"caution":"negative",X=b?"Connected":v?"Ready to connect":"Needs setup",se=N?`${N.summary.percentage}% indexed`:b?"Awaiting coverage":"No coverage data",de=N?`${N.summary.notIndexed} not indexed${N.summary.deindexed>0?` · ${N.summary.deindexed} deindexed`:""}`:b?"Run sitemap inspection to populate coverage":v?"Connect Search Console for this domain":"Add Google OAuth credentials in Settings",Ee=N?.lastInspectedAt??b?.updatedAt??null,be=T?.connected?"positive":C?"caution":"negative",H=T?.connected?"Connected":C?"Ready to connect":"Needs setup",ae=z?`${z.summary.percentage}% indexed`:T?.connected?"Awaiting coverage":"No coverage data",pe=z?z.summary.notIndexed+(z.summary.unknown??0):0,ce=z?`${pe} not in index`:T?.connected?"Inspect URLs to populate coverage":C?"Connect Bing Webmaster Tools for this domain":"Add a Bing API key in Settings",U=z?.lastInspectedAt??T?.updatedAt??null;return r.jsxs("div",{className:"space-y-6",children:[r.jsxs(Le,{className:"surface-card",children:[r.jsxs("div",{className:"section-head section-head-inline",children:[r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Search console"}),r.jsx("h2",{children:"Search Engine Intelligence"}),r.jsx("p",{className:"mt-1 max-w-3xl text-sm leading-6 text-zinc-500",children:"Scan both engines at a glance, then open the Google or Bing workspace when you need to inspect coverage or take action."})]}),r.jsx(oe,{type:"button",variant:"outline",size:"sm",disabled:a||c!=="idle",onClick:()=>{K()},children:a?"Loading…":c==="syncing"?"Refreshing Google & Bing…":c==="reloading"?"Reloading workspaces…":"Refresh all"})]}),f&&r.jsx("div",{className:"mb-3 rounded-lg border border-rose-800/40 bg-rose-950/20 px-3 py-2 text-sm text-rose-300",children:f}),r.jsxs("div",{className:"grid gap-3 lg:grid-cols-2",children:[r.jsx(yS,{eyebrow:"Google",title:"Google Search Console",status:a?"Loading…":X,tone:a?"neutral":ee,targetLabel:"Selected property",targetValue:b?.propertyId??"No property selected",coverageValue:a?"Loading…":se,note:a?"Loading overview…":de,updatedAt:Ee,active:t==="google",onClick:()=>n("google")}),r.jsx(yS,{eyebrow:"Bing",title:"Bing Webmaster Tools",status:a?"Loading…":H,tone:a?"neutral":be,targetLabel:"Selected site",targetValue:T?.siteUrl??"No site selected",coverageValue:a?"Loading…":ae,note:a?"Loading overview…":ce,updatedAt:U,active:t==="bing",onClick:()=>n("bing")})]})]}),r.jsx("div",{className:"flex flex-wrap gap-2",role:"tablist","aria-label":"Search engine workspaces",children:[["google","Google"],["bing","Bing"]].map(([R,M])=>r.jsx("button",{type:"button",role:"tab","aria-selected":t===R,className:`project-subnav-link ${t===R?"project-subnav-link-active":""}`,onClick:()=>n(R),children:M},R))}),t==="google"&&r.jsx(O$,{projectName:e}),t==="bing"&&r.jsxs("section",{className:"page-section-divider",children:[r.jsx("div",{className:"section-head section-head-inline",children:r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Search engine"}),r.jsx("h2",{children:"Bing Webmaster Tools"})]})}),r.jsx(U$,{projectName:e,refreshNonce:P})]})]})}function B$({insights:e}){const{openEvidence:t}=Zr(),[n,a]=w.useState(null);return r.jsx("div",{className:"insight-list",children:e.map(o=>{const c=n===o.id,u=o.affectedPhrases.length>0;return r.jsxs("div",{children:[r.jsxs("div",{className:`insight-row insight-row-${o.tone} ${u?"cursor-pointer":""}`,onClick:u?()=>a(c?null:o.id):void 0,children:[r.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[u&&r.jsx(Qu,{size:12,className:`shrink-0 text-zinc-500 transition-transform duration-150 ${c?"rotate-90":""}`}),r.jsx(lt,{tone:o.tone,children:o.actionLabel}),r.jsx("span",{className:"text-sm font-medium text-zinc-100 truncate",children:o.title}),r.jsx("span",{className:"hidden sm:inline text-xs text-zinc-500 truncate",children:o.detail})]}),u&&r.jsxs("span",{className:"text-[11px] text-zinc-600 whitespace-nowrap",children:[o.affectedPhrases.length," phrase",o.affectedPhrases.length>1?"s":""]})]}),c&&r.jsx("div",{className:"divide-y divide-zinc-800/20",children:o.affectedPhrases.map(f=>r.jsxs("div",{className:"flex items-center justify-between gap-3 px-4 py-2 pl-9 bg-zinc-900/40",children:[r.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[r.jsx(np,{state:f.citationState}),r.jsx("span",{className:"text-sm text-zinc-200 truncate",children:f.keyword}),r.jsx("div",{className:"hidden sm:flex gap-1",children:f.provider&&r.jsx(ll,{provider:f.provider})})]}),r.jsx("button",{type:"button",className:"text-xs text-zinc-400 hover:text-zinc-200 whitespace-nowrap transition-colors",onClick:m=>{m.stopPropagation(),t(f.evidenceId)},children:"View →"})]},f.evidenceId))})]},o.id)})})}function Sd({tab:e}){const{projectId:t}=Fu({from:"/projects/$projectId"}),n=Bi(),{dashboard:a,isLoading:o,refetch:c}=La();if(!a||o)return r.jsxs("div",{className:"page-skeleton",children:[r.jsxs("div",{className:"page-skeleton-header",children:[r.jsx("div",{className:"skeleton-text h-6 w-48"}),r.jsx("div",{className:"skeleton-text-sm w-32"})]}),r.jsx("div",{className:"grid grid-cols-3 gap-4",children:[1,2,3].map(re=>r.jsxs("div",{className:"page-skeleton-card flex flex-col items-center",children:[r.jsx("div",{className:"skeleton-circle size-20"}),r.jsx("div",{className:"skeleton-text w-16 mt-3"})]},re))}),r.jsxs("div",{className:"page-skeleton-card",children:[r.jsx("div",{className:"skeleton-text w-28"}),r.jsx("div",{className:"space-y-2 mt-2",children:[1,2,3,4].map(re=>r.jsx("div",{className:"skeleton-text-sm w-full"},re))})]})]});const u=i4(a,t),[f,m]=w.useState(!1),[p,v]=w.useState(!1),[y,b]=w.useState(!1),[x,N]=w.useState(""),[S,C]=w.useState(!1),[k,T]=w.useState(!1),[A,z]=w.useState(""),[$,P]=w.useState(!1),[E,O]=w.useState(!1),[K,ee]=w.useState(""),[X,se]=w.useState(!1),[de,Ee]=w.useState(void 0),[be,H]=w.useState(!1),[ae,pe]=w.useState(null),[ce,U]=w.useState(!1),R=u?.visibilityEvidence??[],M=u?.project.name??"",J=u?.project.displayName||u?.project.name||M,V=YN(),Q=w.useMemo(()=>new Set(R.map(re=>re.location??"")),[R]),me=Q.has(""),ge=w.useMemo(()=>[...Q].filter(Boolean),[Q]);w.useEffect(()=>{if(de===void 0||de===""||!M){pe(null),U(!1);return}U(!0),aj(M,de).then(re=>{pe(re),U(!1)}).catch(()=>{pe(null),U(!1)})},[de,M]);const Ne=w.useMemo(()=>{if(!ae)return null;const re=new Map;for(const Ze of ae){for(const[ut,Qt]of Object.entries(Ze.providerRuns??{}))re.set(`${Ze.keyword}::${ut}`,Qt.map(Ve=>({runId:Ve.runId,citationState:Ve.citationState,createdAt:Ve.createdAt,answerMentioned:Ve.answerMentioned,visibilityState:Ve.visibilityState,visibilityTransition:Ve.visibilityTransition})));(!Ze.providerRuns||Object.keys(Ze.providerRuns).length===0)&&re.set(`${Ze.keyword}::`,Ze.runs.map(ut=>({runId:ut.runId,citationState:ut.citationState,createdAt:ut.createdAt,answerMentioned:ut.answerMentioned,visibilityState:ut.visibilityState,visibilityTransition:ut.visibilityTransition})))}return re},[ae]),he=w.useMemo(()=>{const re=de!==void 0?R.filter(Ze=>de===""?!Ze.location:Ze.location===de):R;return Ne?re.map(Ze=>{const ut=Ne.get(`${Ze.keyword}::${Ze.provider}`)??Ne.get(`${Ze.keyword}::`);return ut?{...Ze,runHistory:ut}:Ze}):re},[R,de,Ne]);if(!u)return r.jsx("div",{className:"page-container",children:r.jsxs(Le,{className:"surface-card empty-card",children:[r.jsx("h1",{children:"Project not found"}),r.jsxs("p",{children:['Could not find a project with ID "',t,'".']}),r.jsx(oe,{asChild:!0,children:r.jsx(St,{to:"/",children:"Return to overview"})})]})});async function Me(){try{await V.mutateAsync({projectName:M,projectLabel:J,sourceAction:"project-run"}),c()}catch{}}async function Je(){v(!0);try{await o2(M),Fe({title:"Project deleted",detail:`${J} was removed.`,tone:"positive",dedupeKey:`project:delete:${M}`,dedupeMode:"drop"}),n({to:"/"}),c()}catch(re){console.error("Failed to delete project:",re)}finally{v(!1)}}async function le(){const re=await l2(M),Ze=typeof re=="string"?re:JSON.stringify(re,null,2),ut=new Blob([Ze],{type:"text/yaml"}),Qt=URL.createObjectURL(ut),Ve=document.createElement("a");Ve.href=Qt,Ve.download=`${M}.yaml`,Ve.click()}async function Ie(){const re=x.split(`
237
- `).map(Ze=>Ze.trim()).filter(Boolean);if(re.length!==0){C(!0);try{await t2(M,re),c(),N(""),b(!1)}finally{C(!1)}}}async function Ye(){const re=A.trim();if(re){P(!0);try{const ut=(await ij(M)).map(Ve=>Ve.domain),Qt=[...new Set([...ut,re])];await rj(M,Qt),c(),z(""),T(!1)}finally{P(!1)}}}async function Vt(){const re=K.trim();if(re){se(!0);try{const Ze=u?.project.ownedDomains??[];await Hb(M,[...Ze,re]),c(),ee(""),O(!1)}finally{se(!1)}}}async function Ut(re){se(!0);try{const Ze=u?.project.ownedDomains??[];await Hb(M,Ze.filter(ut=>ut!==re)),c()}finally{se(!1)}}async function Mn(re,Ze){await n2(re,Ze),c()}const nn=re=>!Number.isNaN(Number.parseInt(re,10)),At=[{key:"overview",label:"Overview",href:`/projects/${u.project.id}`},{key:"search-console",label:"Search Engine Intelligence",href:`/projects/${u.project.id}/search-console`},{key:"traffic",label:"Traffic",href:`/projects/${u.project.id}/traffic`},{key:"analytics",label:"Visibility",href:`/projects/${u.project.id}/analytics`}];return r.jsxs("div",{className:"page-container",children:[f?r.jsxs(Le,{className:"surface-card p-6 mb-6 border-rose-800/60",children:[r.jsx("h3",{className:"text-base font-semibold text-rose-400 mb-2",children:"Delete project?"}),r.jsxs("p",{className:"text-sm text-zinc-400 mb-4",children:["This will permanently delete ",r.jsx("strong",{className:"text-zinc-200",children:u.project.displayName||u.project.name})," and all its key phrases, competitors, runs, and snapshots. This cannot be undone."]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(oe,{type:"button",variant:"destructive",disabled:p,onClick:Je,children:p?"Deleting...":"Yes, delete project"}),r.jsx(oe,{type:"button",variant:"outline",disabled:p,onClick:()=>m(!1),children:"Cancel"})]})]}):null,r.jsxs("div",{className:"page-header",children:[r.jsxs("div",{className:"page-header-left",children:[r.jsx("h1",{className:"page-title",children:u.project.displayName||u.project.name}),r.jsxs("p",{className:"page-subtitle",children:[u.project.canonicalDomain,(u.project.ownedDomains??[]).length===0&&!E&&r.jsx("button",{type:"button",className:"ml-2 text-[10px] uppercase tracking-wide text-zinc-600 hover:text-zinc-400 transition-colors",onClick:()=>O(!0),children:"+ add domain"})," "," · ",u.contextLabel]}),r.jsxs("div",{className:"tag-row",children:[r.jsx("span",{className:"tag",children:u.project.country}),r.jsx("span",{className:"tag",children:u.project.language.toUpperCase()}),u.project.tags.map(re=>r.jsx("span",{className:"tag",children:re},re))]}),((u.project.ownedDomains??[]).length>0||E)&&r.jsxs("div",{className:"mt-1.5 flex flex-wrap items-center gap-1.5",children:[r.jsx("span",{className:"text-[10px] uppercase tracking-wide text-zinc-500 mr-1",children:"Also tracking"}),(u.project.ownedDomains??[]).map(re=>r.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full border border-zinc-700/60 bg-zinc-800/40 px-2 py-0.5 text-xs text-zinc-300",children:[re,r.jsx("button",{type:"button",className:"ml-0.5 text-zinc-500 hover:text-zinc-200 transition-colors",disabled:X,onClick:()=>Ut(re),"aria-label":`Remove ${re}`,children:"×"})]},re)),E?r.jsxs("span",{className:"inline-flex items-center gap-1",children:[r.jsx("input",{className:"rounded border border-zinc-700 bg-transparent px-1.5 py-0.5 text-xs text-zinc-200 placeholder-zinc-600 focus:border-zinc-500 focus:outline-none w-40",type:"text",placeholder:"docs.example.com",value:K,onChange:re=>ee(re.target.value),onKeyDown:re=>re.key==="Enter"&&Vt(),autoFocus:!0}),r.jsx(oe,{type:"button",size:"sm",disabled:!K.trim()||X,onClick:Vt,children:X?"...":"Add"}),r.jsx("button",{type:"button",className:"text-xs text-zinc-500 hover:text-zinc-300",onClick:()=>{O(!1),ee("")},children:"Cancel"})]}):r.jsx("button",{type:"button",className:"rounded-full border border-dashed border-zinc-700 px-2 py-0.5 text-[10px] uppercase tracking-wide text-zinc-500 hover:text-zinc-300 hover:border-zinc-500 transition-colors",onClick:()=>O(!0),children:"+ domain"})]})]}),r.jsxs("div",{className:"page-header-right",children:[r.jsx("p",{className:"text-sm text-zinc-500",children:u.dateRangeLabel}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(oe,{type:"button",variant:"outline",size:"icon",onClick:le,"aria-label":"Export project as YAML",children:r.jsx(cE,{className:"h-4 w-4 text-zinc-400"})}),r.jsx(oe,{type:"button",variant:"outline",size:"icon",onClick:()=>m(!0),"aria-label":"Delete project",children:r.jsx(EE,{className:"h-4 w-4 text-zinc-400"})}),r.jsx(oe,{type:"button",disabled:V.isPending,onClick:Me,children:V.isPending?"Starting...":"Run now"})]})]})]}),r.jsx("nav",{className:"project-subnav","aria-label":"Project sections",children:At.map(re=>r.jsx(St,{to:re.href,className:`project-subnav-link ${re.key===e?"project-subnav-link-active":""}`,"aria-current":re.key===e?"page":void 0,children:re.label},re.key))}),e==="overview"?r.jsxs(r.Fragment,{children:[r.jsxs("section",{className:"gauge-row",children:[r.jsx(ZN,{value:u.visibilitySummary.value,label:u.visibilitySummary.label,delta:u.visibilitySummary.delta,tone:u.visibilitySummary.tone,description:u.visibilitySummary.description,tooltip:u.visibilitySummary.tooltip,isNumeric:nn(u.visibilitySummary.value),progress:u.visibilitySummary.progress}),r.jsxs("div",{className:"metric-card",children:[r.jsxs("p",{className:"metric-card-eyebrow",children:["Gap Key Phrases",r.jsx(hn,{text:"Tracked key phrases where competitors are cited in the latest completed visibility run but your domain is not."})]}),r.jsxs("p",{className:"metric-card-big-value",children:[r.jsx("span",{className:"text-zinc-50",children:u.gapKeyPhrases.value}),r.jsxs("span",{className:"text-zinc-600",children:[" / ",u.keywordCounts.total]})]}),r.jsx("div",{className:"metric-card-bar",children:r.jsx("div",{className:`metric-card-bar-fill progress-fill-${u.gapKeyPhrases.tone}`,style:{width:u.gapKeyPhrases.progress!==void 0?`${u.gapKeyPhrases.progress*100}%`:"0%"}})}),r.jsx("p",{className:"metric-card-detail",children:u.gapKeyPhrases.delta}),r.jsx("p",{className:"metric-card-sub",children:u.gapKeyPhrases.description})]}),r.jsxs("div",{className:"metric-card",children:[r.jsxs("p",{className:"metric-card-eyebrow",children:["Index Coverage",r.jsx(hn,{text:"Percentage of inspected URLs that are currently indexed. Google Search Console is preferred when available, otherwise Bing Webmaster Tools is used."})]}),r.jsxs("p",{className:"metric-card-big-value",children:[r.jsx("span",{className:"text-zinc-50",children:u.indexCoverage.value}),r.jsx("span",{className:"text-zinc-600",children:"%"})]}),r.jsx("div",{className:"metric-card-bar",children:r.jsx("div",{className:`metric-card-bar-fill progress-fill-${u.indexCoverage.tone}`,style:{width:`${Number.parseInt(u.indexCoverage.value,10)||0}%`}})}),r.jsx("p",{className:"metric-card-detail",children:u.indexCoverage.delta}),r.jsx("p",{className:"metric-card-sub",children:u.indexCoverage.description})]}),r.jsxs("div",{className:"metric-card",children:[r.jsxs("p",{className:"metric-card-eyebrow",children:["Since Last Run",r.jsx(hn,{text:"Keyword-level citation changes compared to the previous completed run."})]}),u.movementSummary.hasPreviousRun?r.jsxs("div",{className:"metric-card-movement",children:[r.jsxs("span",{className:u.movementSummary.gained>0?"text-emerald-400":"text-zinc-500",children:["+",u.movementSummary.gained," gained"]}),r.jsx("span",{className:"text-zinc-600 mx-1.5",children:"·"}),r.jsxs("span",{className:u.movementSummary.lost>0?"text-rose-400":"text-zinc-500",children:["−",u.movementSummary.lost," lost"]})]}):r.jsx("p",{className:"metric-card-movement text-zinc-500",children:"First run — no comparison yet"}),r.jsx("p",{className:"metric-card-sub mt-auto",children:u.movementSummary.gained===0&&u.movementSummary.lost===0&&u.movementSummary.hasPreviousRun?"No changes since last run":u.movementSummary.gained>u.movementSummary.lost?"Visibility improving":u.movementSummary.lost>u.movementSummary.gained?"Visibility declining":""})]})]}),u.providerScores.length>1&&r.jsxs("section",{className:"page-section-divider",children:[r.jsx("div",{className:"section-head section-head-inline",children:r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Model breakdown"}),r.jsxs("h2",{children:["Visibility by model ",r.jsx(hn,{text:"Per-model citation rate. Shows how often each AI model cites your domain across all tracked key phrases. Switching models can significantly affect citation rates."})]})]})}),r.jsx("div",{className:"evidence-table-wrap",children:r.jsxs("table",{className:"evidence-table",children:[r.jsx("thead",{children:r.jsxs("tr",{children:[r.jsx("th",{children:"Model"}),r.jsx("th",{children:"Score"}),r.jsx("th",{children:"Cited key phrases"})]})}),r.jsx("tbody",{children:u.providerScores.map(re=>r.jsxs("tr",{children:[r.jsx("td",{children:r.jsxs("div",{className:"flex flex-col items-start gap-0.5",children:[r.jsx(ll,{provider:re.provider}),re.model&&r.jsx("span",{className:"text-[11px] font-mono text-zinc-500",children:re.model})]})}),r.jsx("td",{children:r.jsxs("span",{className:`font-semibold ${re.score>=70?"text-emerald-400":re.score>=40?"text-amber-400":"text-rose-400"}`,children:[re.score,"%"]})}),r.jsxs("td",{className:"text-zinc-500",children:[re.cited," of ",re.total]})]},`${re.provider}::${re.model??"unknown"}`))})]})})]}),r.jsxs("section",{className:"page-section-divider",children:[r.jsx("div",{className:"section-head section-head-inline",children:r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"What changed"}),r.jsx("h2",{children:"Citation signals"})]})}),r.jsx(B$,{insights:u.insights})]}),r.jsxs("section",{className:"page-section-divider",children:[r.jsxs("div",{className:"section-head section-head-inline",children:[r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Visibility evidence"}),r.jsx("h2",{children:"Key phrase citation tracking"})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("p",{className:"supporting-copy",children:[new Set(u.visibilityEvidence.map(re=>re.keyword)).size," key phrases tracked"]}),r.jsx(oe,{type:"button",variant:"outline",size:"sm",onClick:()=>b(!y),children:y?"Cancel":"+ Add key phrases"})]})]}),y&&r.jsxs("div",{className:"mb-3 rounded-lg border border-zinc-800 bg-zinc-900/40 p-3",children:[r.jsx("textarea",{className:"w-full resize-none rounded border border-zinc-700 bg-transparent px-2 py-1.5 text-sm text-zinc-200 placeholder-zinc-600 focus:border-zinc-500 focus:outline-none",rows:3,placeholder:"Enter key phrases, one per line",value:x,onChange:re=>N(re.target.value)}),r.jsxs("div",{className:"mt-2 flex items-center justify-between",children:[r.jsxs("p",{className:"text-xs text-zinc-500",children:[x.split(`
238
- `).filter(re=>re.trim()).length," key phrases"]}),r.jsx(oe,{type:"button",size:"sm",disabled:!x.trim()||S,onClick:Ie,children:S?"Adding...":"Add key phrases"})]})]}),u.project.locations&&u.project.locations.length>0&&r.jsxs("div",{className:"filter-row mb-3",role:"toolbar","aria-label":"Location filters",children:[r.jsx("button",{className:`filter-chip ${de===void 0?"filter-chip-active":""}`,type:"button","aria-pressed":de===void 0,onClick:()=>{Ee(void 0)},children:"All locations"}),u.project.locations.map(re=>Q.has(re.label)&&r.jsx("button",{className:`filter-chip ${de===re.label?"filter-chip-active":""}`,type:"button","aria-pressed":de===re.label,onClick:()=>{Ee(re.label),H(!1)},children:re.label},re.label)),me&&r.jsx("button",{className:`filter-chip ${de===""?"filter-chip-active":""}`,type:"button","aria-pressed":de==="",onClick:()=>{Ee(""),H(!1)},children:"No location"}),ge.length>1&&de===void 0&&r.jsx("button",{className:`filter-chip filter-chip-compare ${be?"filter-chip-active":""}`,type:"button","aria-pressed":be,onClick:()=>H(re=>!re),title:"Side-by-side location comparison",children:"Compare"})]}),r.jsx(h$,{evidence:he})]}),r.jsxs("section",{className:"page-section-divider",children:[r.jsxs("div",{className:"section-head section-head-inline",children:[r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Competitors"}),r.jsx("h2",{children:"Competitive landscape"})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("p",{className:"supporting-copy",children:[u.competitors.length," tracked"]}),r.jsx(oe,{type:"button",variant:"outline",size:"sm",onClick:()=>T(!k),children:k?"Cancel":"+ Add competitor"})]})]}),k&&r.jsxs("div",{className:"mb-3 flex gap-2 rounded-lg border border-zinc-800 bg-zinc-900/40 p-3",children:[r.jsx("input",{className:"flex-1 rounded border border-zinc-700 bg-transparent px-2 py-1.5 text-sm text-zinc-200 placeholder-zinc-600 focus:border-zinc-500 focus:outline-none",type:"text",placeholder:"competitor.com",value:A,onChange:re=>z(re.target.value),onKeyDown:re=>re.key==="Enter"&&Ye()}),r.jsx(oe,{type:"button",size:"sm",disabled:!A.trim()||$,onClick:Ye,children:$?"Adding...":"Add"})]}),r.jsx(m$,{competitors:u.competitors})]}),r.jsxs("section",{className:"page-section-divider",children:[r.jsx("div",{className:"section-head section-head-inline",children:r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Run timeline"}),r.jsx("h2",{children:"Recent execution history"})]})}),r.jsx("div",{className:"run-list",children:u.recentRuns.map(re=>r.jsx(FN,{run:re},re.id))})]}),r.jsx(L$,{project:{...u.project,displayName:u.project.displayName??u.project.name,defaultLocation:u.project.defaultLocation??null},onUpdateProject:Mn,onRefresh:()=>{c()}}),r.jsx(M$,{projectName:u.project.name}),r.jsx(P$,{projectName:u.project.name})]}):e==="analytics"?r.jsx(y$,{projectName:u.project.name}):e==="traffic"?r.jsx(j$,{projectName:u.project.name}):r.jsx(I$,{projectName:u.project.name})]})}function q$(){const{dashboard:e,isLoading:t}=La(),n=E$();if(!e||t)return r.jsxs("div",{className:"page-skeleton",children:[r.jsxs("div",{className:"page-skeleton-header",children:[r.jsx("div",{className:"skeleton-text h-6 w-20"}),r.jsx("div",{className:"skeleton-text-sm w-72"})]}),r.jsx("div",{className:"space-y-2",children:[1,2,3,4].map(m=>r.jsxs("div",{className:"rounded-xl border border-zinc-800/60 bg-zinc-900/30 p-3 flex items-center gap-3",children:[r.jsxs("div",{className:"flex-1 space-y-1.5",children:[r.jsx("div",{className:"skeleton-text w-40"}),r.jsx("div",{className:"skeleton-text-sm w-56"})]}),r.jsx("div",{className:"skeleton h-5 w-16 rounded-full"})]},m))})]});const a=e.runs,[o,c]=w.useState("all"),u=o==="all"?a:a.filter(m=>m.status===o),f=async()=>{try{await n.mutateAsync(void 0)}catch{}};return r.jsxs("div",{className:"page-container",children:[r.jsxs("div",{className:"page-header",children:[r.jsxs("div",{className:"page-header-left",children:[r.jsx("h1",{className:"page-title",children:"Runs"}),r.jsx("p",{className:"page-subtitle",children:"Status, type, project, duration, and the shortest explanation that makes the outcome trustworthy."})]}),r.jsx(oe,{type:"button",variant:"outline",size:"sm",disabled:n.isPending,onClick:()=>{f()},children:n.isPending?"Queueing…":"Run all projects"})]}),r.jsxs("section",{children:[r.jsx("div",{className:"filter-row",role:"toolbar","aria-label":"Run filters",children:["all","queued","running","completed","partial","failed","cancelled"].map(m=>r.jsx("button",{className:`filter-chip ${o===m?"filter-chip-active":""}`,type:"button","aria-pressed":o===m,onClick:()=>c(m),children:m==="all"?"All runs":Ju(m)},m))}),r.jsx("div",{className:"run-list",children:u.length>0?u.map(m=>r.jsx(FN,{run:m},m.id)):r.jsxs(Le,{className:"surface-card empty-card",children:[r.jsx("h2",{children:"No runs match this filter"}),r.jsx("p",{children:"Try another status filter or queue a new run from a project command center."})]})})]})]})}function K$({providerName:e,keyUrl:t,modelHint:n,onSaved:a}){const o=e.toLowerCase()==="local",[c,u]=w.useState(""),[f,m]=w.useState(""),[p,v]=w.useState(""),[y,b]=w.useState(""),[x,N]=w.useState(""),[S,C]=w.useState(""),[k,T]=w.useState(!1),[A,z]=w.useState(null),[$,P]=w.useState(!1),E=o?f.trim().length>0:c.trim().length>0;async function O(){if(E){T(!0),z(null),P(!1);try{const ee=be=>{const H=parseInt(be.trim(),10);return Number.isFinite(H)&&H>0?H:void 0},X={},se=ee(y);se!==void 0&&(X.maxConcurrency=se);const de=ee(x);de!==void 0&&(X.maxRequestsPerMinute=de);const Ee=ee(S);Ee!==void 0&&(X.maxRequestsPerDay=Ee),await f2(e.toLowerCase(),{...c.trim()?{apiKey:c.trim()}:{},...f.trim()?{baseUrl:f.trim()}:{},...p.trim()?{model:p.trim()}:{},...Object.keys(X).length>0?{quota:X}:{}}),u(""),m(""),v(""),b(""),N(""),C(""),P(!0),Fe({title:"Provider updated",detail:`${e} configuration saved.`,tone:"positive",dedupeKey:`settings:provider:${e}`,dedupeMode:"replace"}),a()}catch(ee){z(ee instanceof Error?ee.message:"Failed to update provider")}finally{T(!1)}}}const K=n??"Use default model";return r.jsxs("div",{className:"mt-3 rounded-lg border border-zinc-800 bg-zinc-900/40 p-3 space-y-2",children:[o&&r.jsxs("div",{children:[r.jsx("label",{className:"text-xs text-zinc-500",htmlFor:`base-url-${e}`,children:"Base URL"}),r.jsx("input",{id:`base-url-${e}`,type:"text",className:"mt-0.5 w-full rounded border border-zinc-700 bg-transparent px-2 py-1.5 text-sm text-zinc-200 placeholder-zinc-600 focus:border-zinc-500 focus:outline-none",placeholder:"http://localhost:11434/v1",value:f,onChange:ee=>m(ee.target.value)}),r.jsx("p",{className:"mt-0.5 text-[10px] text-zinc-600",children:"Any OpenAI-compatible endpoint — Ollama, LM Studio, llama.cpp, vLLM"})]}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("label",{className:"text-xs text-zinc-500",htmlFor:`api-key-${e}`,children:["API Key",o?" (optional)":""]}),t&&r.jsxs("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"text-[10px] text-zinc-500 hover:text-zinc-300 underline underline-offset-2",children:["Get API key ","↗"]})]}),r.jsx("input",{id:`api-key-${e}`,type:"password",className:"mt-0.5 w-full rounded border border-zinc-700 bg-transparent px-2 py-1.5 text-sm text-zinc-200 placeholder-zinc-600 focus:border-zinc-500 focus:outline-none",placeholder:o?"Optional — most local servers don't need one":`Enter ${e} API key`,value:c,onChange:ee=>u(ee.target.value)})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-xs text-zinc-500",htmlFor:`model-${e}`,children:"Model (optional)"}),r.jsx("input",{id:`model-${e}`,type:"text",className:"mt-0.5 w-full rounded border border-zinc-700 bg-transparent px-2 py-1.5 text-sm text-zinc-200 placeholder-zinc-600 focus:border-zinc-500 focus:outline-none",placeholder:K,value:p,onChange:ee=>v(ee.target.value)})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-xs text-zinc-500",children:"Quota (optional)"}),r.jsxs("div",{className:"mt-0.5 grid grid-cols-3 gap-1.5",children:[r.jsxs("div",{children:[r.jsx("input",{type:"number",min:"1",className:"w-full rounded border border-zinc-700 bg-transparent px-2 py-1.5 text-sm text-zinc-200 placeholder-zinc-600 focus:border-zinc-500 focus:outline-none",placeholder:"Concurrent",value:y,onChange:ee=>b(ee.target.value)}),r.jsx("p",{className:"mt-0.5 text-[10px] text-zinc-600",children:"Max concurrent"})]}),r.jsxs("div",{children:[r.jsx("input",{type:"number",min:"1",className:"w-full rounded border border-zinc-700 bg-transparent px-2 py-1.5 text-sm text-zinc-200 placeholder-zinc-600 focus:border-zinc-500 focus:outline-none",placeholder:"/min",value:x,onChange:ee=>N(ee.target.value)}),r.jsx("p",{className:"mt-0.5 text-[10px] text-zinc-600",children:"Per minute"})]}),r.jsxs("div",{children:[r.jsx("input",{type:"number",min:"1",className:"w-full rounded border border-zinc-700 bg-transparent px-2 py-1.5 text-sm text-zinc-200 placeholder-zinc-600 focus:border-zinc-500 focus:outline-none",placeholder:"/day",value:S,onChange:ee=>C(ee.target.value)}),r.jsx("p",{className:"mt-0.5 text-[10px] text-zinc-600",children:"Per day"})]})]})]}),A&&r.jsx("p",{className:"text-xs text-rose-400",children:A}),$&&r.jsx("p",{className:"text-xs text-emerald-400",children:"Provider updated."}),r.jsx(oe,{type:"button",size:"sm",disabled:!E||k,onClick:O,children:k?"Saving...":"Save"})]})}function H$({onSaved:e}){const[t,n]=w.useState(""),[a,o]=w.useState(""),[c,u]=w.useState(!1),[f,m]=w.useState(null),[p,v]=w.useState(!1),y=t.trim().length>0&&a.trim().length>0;async function b(){if(y){u(!0),m(null),v(!1);try{await h2({clientId:t.trim(),clientSecret:a.trim()}),n(""),o(""),v(!0),Fe({title:"Google OAuth app updated",detail:"Dashboard Google credentials were saved.",tone:"positive",dedupeKey:"settings:google-oauth",dedupeMode:"replace"}),e()}catch(x){m(x instanceof Error?x.message:"Failed to update Google OAuth credentials")}finally{u(!1)}}}return r.jsxs("div",{className:"mt-3 rounded-lg border border-zinc-800 bg-zinc-900/40 p-3 space-y-2",children:[r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("label",{className:"text-xs text-zinc-500",htmlFor:"google-client-id",children:"Client ID"}),r.jsxs("a",{href:"https://console.cloud.google.com/apis/credentials",target:"_blank",rel:"noopener noreferrer",className:"text-[10px] text-zinc-500 hover:text-zinc-300 underline underline-offset-2",children:["Google Cloud ","↗"]})]}),r.jsx("input",{id:"google-client-id",type:"text",className:"mt-0.5 w-full rounded border border-zinc-700 bg-transparent px-2 py-1.5 text-sm text-zinc-200 placeholder-zinc-600 focus:border-zinc-500 focus:outline-none",placeholder:"Google OAuth client ID",value:t,onChange:x=>n(x.target.value)})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-xs text-zinc-500",htmlFor:"google-client-secret",children:"Client secret"}),r.jsx("input",{id:"google-client-secret",type:"password",className:"mt-0.5 w-full rounded border border-zinc-700 bg-transparent px-2 py-1.5 text-sm text-zinc-200 placeholder-zinc-600 focus:border-zinc-500 focus:outline-none",placeholder:"Google OAuth client secret",value:a,onChange:x=>o(x.target.value)})]}),r.jsxs("p",{className:"text-[11px] text-zinc-500",children:["These credentials are stored in ",r.jsx("code",{children:"~/.canonry/config.yaml"}),". Project-level Search Console connections are created separately per canonical domain."]}),f&&r.jsx("p",{className:"text-xs text-rose-400",children:f}),p&&r.jsx("p",{className:"text-xs text-emerald-400",children:"Google OAuth credentials updated."}),r.jsx(oe,{type:"button",size:"sm",disabled:!y||c,onClick:b,children:c?"Saving...":"Save Google OAuth app"})]})}function G$(){const[e,t]=w.useState(null),[n,a]=w.useState(null),[o,c]=w.useState(!1),[u,f]=w.useState("localhost"),[m,p]=w.useState("9222"),[v,y]=w.useState(!1);return w.useEffect(()=>{Fb().then(t).catch(b=>{const x=b instanceof Error?b.message:String(b);x.includes("501")||a(x)})},[]),r.jsxs(Le,{className:"surface-card",children:[r.jsxs("div",{className:"section-head",children:[r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Browser provider"}),r.jsx("h2",{children:"ChatGPT (CDP)"})]}),r.jsx(lt,{tone:e?.connected?"positive":"caution",children:e?.connected?"Connected":"Not connected"})]}),r.jsxs("dl",{className:"definition-list mt-3",children:[e?.endpoint&&r.jsxs("div",{children:[r.jsx("dt",{children:"Endpoint"}),r.jsx("dd",{className:"font-mono text-xs",children:e.endpoint})]}),e?.browserVersion&&r.jsxs("div",{children:[r.jsx("dt",{children:"Browser"}),r.jsx("dd",{className:"text-xs",children:e.browserVersion})]}),e?.targets&&e.targets.length>0&&r.jsxs("div",{children:[r.jsx("dt",{children:"Tabs"}),r.jsx("dd",{children:e.targets.map(b=>r.jsxs("span",{className:"mr-2",children:[b.name,": ",b.alive?"● alive":"○ idle"]},b.name))})]})]}),r.jsx("p",{className:"mt-2 text-sm text-zinc-500",children:e?.connected?"Connected to Chrome via CDP. Launch Chrome with --remote-debugging-port to use this provider.":n||"Not configured. Set an endpoint below or run: canonry cdp connect --host localhost --port 9222"}),r.jsx("div",{className:"mt-2",children:r.jsx(oe,{type:"button",variant:"outline",size:"sm",onClick:()=>c(!o),children:o?"Cancel":e?.connected?"Update endpoint":"Configure"})}),o&&r.jsxs("form",{className:"mt-3 flex flex-col gap-2",onSubmit:async b=>{b.preventDefault(),y(!0);try{await M2(u,parseInt(m,10)||9222);const x=await Fb().catch(()=>null);x&&t(x),c(!1),Fe({title:"CDP endpoint saved",detail:`${u}:${parseInt(m,10)||9222} is now configured.`,tone:"positive",dedupeKey:"settings:cdp",dedupeMode:"replace"})}catch(x){a(x instanceof Error?x.message:String(x))}finally{y(!1)}},children:[r.jsxs("div",{className:"flex gap-2",children:[r.jsx("input",{className:"flex-1 rounded border border-zinc-700 bg-zinc-900 px-2 py-1 text-sm text-zinc-100 placeholder-zinc-500 focus:outline-none focus:ring-1 focus:ring-zinc-500",placeholder:"localhost",value:u,onChange:b=>f(b.target.value),"aria-label":"CDP host"}),r.jsx("input",{className:"w-24 rounded border border-zinc-700 bg-zinc-900 px-2 py-1 text-sm text-zinc-100 placeholder-zinc-500 focus:outline-none focus:ring-1 focus:ring-zinc-500",placeholder:"9222",value:m,onChange:b=>p(b.target.value),"aria-label":"CDP port"})]}),r.jsx("div",{children:r.jsx(oe,{type:"submit",size:"sm",disabled:v,children:v?"Saving…":"Save endpoint"})})]})]})}const F$={apiStatus:{state:"checking",detail:"Checking service health"},workerStatus:{state:"checking",detail:"Checking service health"}};function Z$(){const e=vl(),{dashboard:t}=La(),n=t?.settings??e?.dashboard?.settings,c=ld(!e,e?.health).data??e?.health??F$,[u,f]=w.useState(null),[m,p]=w.useState(!1),[v,y]=w.useState(!1),[b,x]=w.useState(""),[N,S]=w.useState(!1),[C,k]=w.useState(null),[T,A]=w.useState(!1);return n?r.jsxs("div",{className:"page-container",children:[r.jsx("div",{className:"page-header",children:r.jsxs("div",{className:"page-header-left",children:[r.jsx("h1",{className:"page-title",children:"Settings"}),r.jsx("p",{className:"page-subtitle",children:"Provider state, Google OAuth, Bing WMT setup, and service health."})]})}),r.jsxs("section",{className:"settings-grid",children:[n.providerStatuses.map(z=>r.jsxs(Le,{className:"surface-card",children:[r.jsxs("div",{className:"section-head",children:[r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Provider"}),r.jsx("h2",{children:z.displayName??z.name})]}),r.jsx(lt,{tone:z.state==="ready"?"positive":"caution",children:z.state==="ready"?"Ready":"Needs config"})]}),r.jsxs("dl",{className:"definition-list mt-3",children:[r.jsxs("div",{children:[r.jsx("dt",{children:"Model"}),r.jsx("dd",{className:"font-mono text-xs",children:z.model})]}),z.quota&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{children:[r.jsx("dt",{children:"Concurrency"}),r.jsx("dd",{children:z.quota.maxConcurrency})]}),r.jsxs("div",{children:[r.jsx("dt",{children:"Rate limit"}),r.jsxs("dd",{children:[z.quota.maxRequestsPerMinute,"/min · ",z.quota.maxRequestsPerDay,"/day"]})]})]})]}),r.jsx("p",{className:"mt-2 text-sm text-zinc-500",children:z.detail}),r.jsx("div",{className:"mt-2",children:r.jsx(oe,{type:"button",variant:"outline",size:"sm",onClick:()=>f(u===z.name?null:z.name),children:u===z.name?"Cancel":z.state==="ready"?z.name.toLowerCase()==="local"?"Update config":"Update key":"Configure"})}),u===z.name&&r.jsx(K$,{providerName:z.name,keyUrl:z.keyUrl,modelHint:z.modelHint,onSaved:()=>{f(null)}})]},z.name)),r.jsxs(Le,{className:"surface-card",children:[r.jsxs("div",{className:"section-head",children:[r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Google"}),r.jsx("h2",{children:"Search Console OAuth"})]}),r.jsx(lt,{tone:n.google.state==="ready"?"positive":"caution",children:n.google.state==="ready"?"Ready":"Needs config"})]}),r.jsxs("dl",{className:"definition-list mt-3",children:[r.jsxs("div",{children:[r.jsx("dt",{children:"Auth model"}),r.jsx("dd",{children:"One app credential set, then one OAuth connection per project domain"})]}),r.jsxs("div",{children:[r.jsx("dt",{children:"Storage"}),r.jsx("dd",{className:"font-mono text-xs",children:"~/.canonry/config.yaml"})]})]}),r.jsx("p",{className:"mt-2 text-sm text-zinc-500",children:n.google.detail}),r.jsx("div",{className:"mt-2",children:r.jsx(oe,{type:"button",variant:"outline",size:"sm",onClick:()=>p(!m),children:m?"Cancel":n.google.state==="ready"?"Update OAuth app":"Configure Google OAuth"})}),m&&r.jsx(H$,{onSaved:()=>{p(!1)}})]}),r.jsxs(Le,{className:"surface-card",children:[r.jsxs("div",{className:"section-head",children:[r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Bing"}),r.jsx("h2",{children:"Webmaster Tools"})]}),r.jsx(lt,{tone:n.bing.state==="ready"?"positive":"caution",children:n.bing.state==="ready"?"Ready":"Needs config"})]}),r.jsxs("dl",{className:"definition-list mt-3",children:[r.jsxs("div",{children:[r.jsx("dt",{children:"Auth model"}),r.jsx("dd",{children:"API key authentication — no OAuth needed"})]}),r.jsxs("div",{children:[r.jsx("dt",{children:"Storage"}),r.jsx("dd",{className:"font-mono text-xs",children:"~/.canonry/config.yaml"})]})]}),r.jsx("p",{className:"mt-2 text-sm text-zinc-500",children:n.bing.detail}),r.jsx("div",{className:"mt-2",children:r.jsx(oe,{type:"button",variant:"outline",size:"sm",onClick:()=>y(!v),children:v?"Cancel":n.bing.state==="ready"?"Update API key":"Configure Bing"})}),v&&r.jsxs("div",{className:"mt-3 rounded-lg border border-zinc-800 bg-zinc-900/40 p-3 space-y-2",children:[r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("label",{className:"text-xs text-zinc-500",htmlFor:"bing-api-key",children:"API Key"}),r.jsx("a",{href:"https://www.bing.com/webmasters/",target:"_blank",rel:"noopener noreferrer",className:"text-[10px] text-zinc-500 hover:text-zinc-300 underline underline-offset-2",children:"Bing Webmaster Tools"})]}),r.jsx("input",{id:"bing-api-key",type:"password",className:"mt-0.5 w-full rounded border border-zinc-700 bg-transparent px-2 py-1.5 text-sm text-zinc-200 placeholder-zinc-600 focus:border-zinc-500 focus:outline-none",placeholder:"Bing Webmaster Tools API key",value:b,onChange:z=>x(z.target.value)})]}),r.jsxs("p",{className:"text-[11px] text-zinc-500",children:["This key is stored in ",r.jsx("code",{children:"~/.canonry/config.yaml"}),". Project-level Bing connections are created separately per canonical domain."]}),C&&r.jsx("p",{className:"text-xs text-rose-400",children:C}),T&&r.jsx("p",{className:"text-xs text-emerald-400",children:"Bing API key updated."}),r.jsx(oe,{type:"button",size:"sm",disabled:!b.trim()||N,onClick:async()=>{if(b.trim()){S(!0),k(null),A(!1);try{await q2(b.trim()),x(""),A(!0),y(!1),Fe({title:"Bing API key updated",detail:"Dashboard Bing credentials were saved.",tone:"positive",dedupeKey:"settings:bing",dedupeMode:"replace"})}catch(z){k(z instanceof Error?z.message:"Failed to update Bing API key")}finally{S(!1)}}},children:N?"Saving...":"Save Bing API key"})]})]}),r.jsx(G$,{}),r.jsxs(Le,{className:"surface-card",children:[r.jsx("div",{className:"section-head",children:r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Service health"}),r.jsx("h2",{children:"API and worker"})]})}),r.jsxs("div",{className:"compact-stack",children:[r.jsxs("div",{className:"health-row",children:[r.jsxs("div",{children:[r.jsx("p",{className:"run-row-title",children:"API"}),r.jsx("p",{className:"supporting-copy",children:c.apiStatus.detail})]}),r.jsx(lt,{tone:Ou(c.apiStatus),children:c.apiStatus.state==="ok"?"Healthy":"Attention"})]}),r.jsxs("div",{className:"health-row",children:[r.jsxs("div",{children:[r.jsx("p",{className:"run-row-title",children:"Worker"}),r.jsx("p",{className:"supporting-copy",children:c.workerStatus.detail})]}),r.jsx(lt,{tone:Ou(c.workerStatus),children:c.workerStatus.state==="ok"?"Healthy":"Attention"})]})]})]})]}),r.jsx("section",{className:"page-section",children:r.jsxs(Le,{className:"surface-card",children:[r.jsx("div",{className:"section-head",children:r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Self-host notes"}),r.jsx("h2",{children:"Operational guidance"})]})}),r.jsx("ul",{className:"detail-list",children:n.selfHostNotes.map(z=>r.jsx("li",{children:z},z))}),r.jsx("p",{className:"supporting-copy",children:n.bootstrapNote})]})})]}):null}const V$=[{label:"System check",description:"Verify your instance is ready"},{label:"Create project",description:"Name, domain, and locale"},{label:"Key phrases",description:"Add key phrases to track"},{label:"Competitors",description:"Add competitor domains"},{label:"Launch",description:"Start your first visibility sweep"}];function Q$({current:e,labels:t}){return r.jsx("div",{className:"setup-steps",role:"list","aria-label":"Setup progress",children:t.map((n,a)=>{const o=a<e,c=a===e;return r.jsxs("div",{className:`setup-step ${o?"setup-step-done":""} ${c?"setup-step-active":""}`,role:"listitem","aria-current":c?"step":void 0,children:[r.jsx("span",{className:"setup-step-number",children:o?"✓":a+1}),r.jsx("span",{className:"setup-step-label",children:n.label})]},n.label)})})}function Y$(){const e=vl(),{dashboard:t,isLoading:n,refetch:a}=La(),o=t??e?.dashboard;if(!o||n)return r.jsxs("div",{className:"page-skeleton",children:[r.jsxs("div",{className:"page-skeleton-header",children:[r.jsx("div",{className:"skeleton-text h-6 w-24"}),r.jsx("div",{className:"skeleton-text-sm w-80"})]}),r.jsxs("div",{className:"page-skeleton-card",children:[r.jsx("div",{className:"skeleton-text w-32"}),r.jsx("div",{className:"space-y-3 mt-3",children:[1,2,3].map(ue=>r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-1 flex-1",children:[r.jsx("div",{className:"skeleton-text w-24"}),r.jsx("div",{className:"skeleton-text-sm w-48"})]}),r.jsx("div",{className:"skeleton h-6 w-16 rounded-full"})]},ue))})]})]});const c=o.settings,m=ld(!e,e?.health).data??e?.health??{apiStatus:{label:"API",state:"checking",detail:"Checking service health"},workerStatus:{label:"Worker",state:"checking",detail:"Checking service health"}},p=J4(o.setup,m,c),v=Bi(),[y,b]=w.useState(0),[x,N]=w.useState(""),[S,C]=w.useState(""),[k,T]=w.useState(""),[A,z]=w.useState("US"),[$,P]=w.useState("en"),[E,O]=w.useState(null),[K,ee]=w.useState(null),[X,se]=w.useState(null),[de,Ee]=w.useState(!1),[be,H]=w.useState(""),[ae,pe]=w.useState(!1),[ce,U]=w.useState(null),[R,M]=w.useState(!1),J=c.providerStatuses.filter(ue=>ue.state==="ready"),[V,Q]=w.useState(J[0]?.name??""),[me,ge]=w.useState(5),[Ne,he]=w.useState(!1),[Me,Je]=w.useState(null),[le,Ie]=w.useState(""),[Ye,Vt]=w.useState(!1),[Ut,Mn]=w.useState(null),[nn,At]=w.useState(!1),[re,Ze]=w.useState(!1),[ut,Qt]=w.useState(!1),Ve=YN(),$e=x.toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,""),Xe=be.split(`
239
- `).map(ue=>ue.trim()).filter(Boolean),Ct=le.split(`
240
- `).map(ue=>ue.trim()).filter(Boolean),Ke=p.healthChecks.some(ue=>ue.id==="api"&&ue.state==="ready"),Ma=async()=>{if(!(!$e||!k)){Ee(!0),se(null);try{const ue=await Vu($e,{displayName:S||x,canonicalDomain:k,country:A,language:$});O($e),ee(ue.id),Fe({title:"Project created",detail:`${ue.displayName||ue.name} is ready for setup.`,tone:"positive",dedupeKey:`project:create:${ue.name}`,dedupeMode:"drop"}),a(),b(2)}catch(ue){se(ue instanceof Error?ue.message:"Failed to create project")}finally{Ee(!1)}}},gn=async()=>{if(!E)return;const ue=Xe;if(ue.length!==0){M(!0),U(null);try{await e2(E,ue),pe(!0),a(),b(3)}catch(zn){U(zn instanceof Error?zn.message:"Failed to save key phrases")}finally{M(!1)}}},st=async()=>{if(!(!E||!V)){he(!0),Je(null);try{const ue=await x2(E,V,me);if(ue.keywords.length>0){const zn=be?be.trimEnd()+`
241
- `+ue.keywords.join(`
242
- `):ue.keywords.join(`
243
- `);H(zn)}}catch(ue){Je(ue instanceof Error?ue.message:"Failed to generate key phrases")}finally{he(!1)}}},Xr=async()=>{if(!E)return;const ue=Ct;if(ue.length!==0){At(!0),Mn(null);try{await rj(E,ue),Vt(!0),a(),b(4)}catch(zn){Mn(zn instanceof Error?zn.message:"Failed to save competitors")}finally{At(!1)}}},ns=async()=>{if(E){Qt(!0);try{await Ve.mutateAsync({projectName:E,projectLabel:S||x||E,sourceAction:"setup-launch"}),Ze(!0),a()}catch{}finally{Qt(!1)}}},mt=()=>b(ue=>Math.max(0,ue-1)),yn=(()=>{switch(y){case 0:return r.jsxs(Le,{className:"surface-card step-card",children:[r.jsx("div",{className:"section-head",children:r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Step 1 of 5"}),r.jsx("h2",{children:"System ready"})]})}),r.jsx("p",{className:"supporting-copy",children:"Checking that your Canonry instance is configured and reachable."}),r.jsx("div",{className:"compact-stack",children:p.healthChecks.map(ue=>r.jsxs("div",{className:"health-check-row",children:[r.jsxs("div",{children:[r.jsx("p",{className:"run-row-title",children:ue.label}),r.jsx("p",{className:"supporting-copy",children:ue.detail}),ue.id==="provider"&&ue.state!=="ready"&&r.jsx(St,{to:"/settings",className:"text-emerald-400 hover:text-emerald-300 text-sm mt-1 underline underline-offset-2 cursor-pointer",children:"Configure providers"})]}),r.jsx(lt,{tone:ue.state==="ready"?"positive":"caution",children:ue.state==="ready"?"Ready":"Attention"})]},ue.id))}),r.jsxs("div",{className:"setup-nav",children:[r.jsx("span",{}),r.jsx(oe,{type:"button",disabled:!Ke,onClick:()=>b(1),children:"Continue"})]})]});case 1:return r.jsxs(Le,{className:"surface-card step-card",children:[r.jsxs("div",{className:"section-head",children:[r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Step 2 of 5"}),r.jsx("h2",{children:"Create project"})]}),E?r.jsx(lt,{tone:"positive",children:"Created"}):null]}),E?r.jsxs("div",{className:"compact-stack",children:[r.jsxs("p",{className:"text-zinc-300",children:["Project ",r.jsx("span",{className:"text-zinc-100 font-medium",children:E})," created successfully."]}),r.jsxs("div",{className:"setup-nav",children:[r.jsx(oe,{type:"button",variant:"outline",onClick:mt,children:"Back"}),r.jsx(oe,{type:"button",onClick:()=>b(2),children:"Continue"})]})]}):r.jsxs("div",{className:"compact-stack",children:[r.jsxs("div",{className:"setup-field",children:[r.jsx("label",{className:"setup-label",htmlFor:"project-name",children:"Project name"}),r.jsx("input",{id:"project-name",className:"setup-input",type:"text",placeholder:"my-website",value:x,onChange:ue=>N(ue.target.value)}),$e&&$e!==x?r.jsxs("p",{className:"supporting-copy",children:["Slug: ",$e]}):null]}),r.jsxs("div",{className:"setup-field",children:[r.jsx("label",{className:"setup-label",htmlFor:"display-name",children:"Display name (optional)"}),r.jsx("input",{id:"display-name",className:"setup-input",type:"text",placeholder:"My Website",value:S,onChange:ue=>C(ue.target.value)})]}),r.jsxs("div",{className:"setup-field",children:[r.jsx("label",{className:"setup-label",htmlFor:"domain",children:"Canonical domain"}),r.jsx("input",{id:"domain",className:"setup-input",type:"text",placeholder:"example.com",value:k,onChange:ue=>T(ue.target.value)})]}),r.jsxs("div",{className:"setup-field-row",children:[r.jsxs("div",{className:"setup-field",children:[r.jsx("label",{className:"setup-label",htmlFor:"country",children:"Country"}),r.jsx("input",{id:"country",className:"setup-input",type:"text",placeholder:"US",maxLength:2,value:A,onChange:ue=>z(ue.target.value.toUpperCase())})]}),r.jsxs("div",{className:"setup-field",children:[r.jsx("label",{className:"setup-label",htmlFor:"language",children:"Language"}),r.jsx("input",{id:"language",className:"setup-input",type:"text",placeholder:"en",maxLength:5,value:$,onChange:ue=>P(ue.target.value.toLowerCase())})]})]}),X?r.jsx("p",{className:"text-rose-400 text-sm",children:X}):null,r.jsxs("div",{className:"setup-nav",children:[r.jsx(oe,{type:"button",variant:"outline",onClick:mt,children:"Back"}),r.jsx(oe,{type:"button",disabled:!$e||!k||de,onClick:Ma,children:de?"Creating...":"Create project"})]})]})]});case 2:return r.jsxs(Le,{className:"surface-card step-card",children:[r.jsxs("div",{className:"section-head",children:[r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Step 3 of 5"}),r.jsx("h2",{children:"Add key phrases"})]}),ae?r.jsxs(lt,{tone:"positive",children:[Xe.length," saved"]}):r.jsxs(lt,{tone:"neutral",children:[Xe.length," key phrase",Xe.length!==1?"s":""]})]}),r.jsx("p",{className:"supporting-copy",children:"Enter the search queries you want to track. One per line."}),ae?r.jsxs("div",{className:"compact-stack",children:[r.jsx("ul",{className:"detail-list",children:Xe.map(ue=>r.jsx("li",{children:ue},ue))}),r.jsxs("div",{className:"setup-nav",children:[r.jsx(oe,{type:"button",variant:"outline",onClick:mt,children:"Back"}),r.jsx(oe,{type:"button",onClick:()=>b(3),children:"Continue"})]})]}):r.jsxs("div",{className:"compact-stack",children:[J.length>0?r.jsxs("div",{className:"compact-stack",children:[r.jsxs("div",{className:"flex items-center gap-2 text-zinc-500 text-xs uppercase tracking-wide",children:[r.jsx("span",{className:"flex-1 border-t border-zinc-800"}),"auto-generate",r.jsx("span",{className:"flex-1 border-t border-zinc-800"})]}),r.jsxs("div",{className:"flex items-end gap-2",children:[r.jsxs("div",{className:"setup-field flex-1",children:[r.jsx("label",{className:"setup-label",htmlFor:"gen-provider",children:"Provider"}),r.jsx("select",{id:"gen-provider",className:"setup-input",value:V,onChange:ue=>Q(ue.target.value),children:J.map(ue=>r.jsxs("option",{value:ue.name,children:[ue.displayName??ue.name,ue.model?` (${ue.model})`:""]},ue.name))})]}),r.jsxs("div",{className:"setup-field",children:[r.jsx("label",{className:"setup-label",htmlFor:"gen-count",children:"Count"}),r.jsx("select",{id:"gen-count",className:"setup-input",value:me,onChange:ue=>ge(Number(ue.target.value)),children:[3,5,10,15,20].map(ue=>r.jsx("option",{value:ue,children:ue},ue))})]}),r.jsx(oe,{type:"button",variant:"outline",disabled:Ne||!V,onClick:st,children:Ne?"Analyzing site...":"Generate"})]}),Me?r.jsx("p",{className:"text-rose-400 text-sm",children:Me}):null]}):null,r.jsxs("div",{className:"flex items-center gap-2 text-zinc-500 text-xs uppercase tracking-wide",children:[r.jsx("span",{className:"flex-1 border-t border-zinc-800"}),"or type manually",r.jsx("span",{className:"flex-1 border-t border-zinc-800"})]}),r.jsxs("div",{className:"setup-field",children:[r.jsx("label",{className:"setup-label",htmlFor:"keywords",children:"Key phrases (one per line)"}),r.jsx("textarea",{id:"keywords",className:"setup-textarea",rows:6,placeholder:`emergency dentist brooklyn
244
- best invisalign downtown brooklyn
245
- pediatric dentist brooklyn heights`,value:be,onChange:ue=>H(ue.target.value)})]}),ce?r.jsx("p",{className:"text-rose-400 text-sm",children:ce}):null,r.jsxs("div",{className:"setup-nav",children:[r.jsx(oe,{type:"button",variant:"outline",onClick:mt,children:"Back"}),r.jsx(oe,{type:"button",disabled:Xe.length===0||R,onClick:gn,children:R?"Saving...":`Save ${Xe.length} key phrase${Xe.length!==1?"s":""}`})]})]})]});case 3:return r.jsxs(Le,{className:"surface-card step-card",children:[r.jsxs("div",{className:"section-head",children:[r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Step 4 of 5"}),r.jsx("h2",{children:"Add competitors"})]}),Ye?r.jsx(lt,{tone:"positive",children:"Saved"}):null]}),r.jsx("p",{className:"supporting-copy",children:"Domains that compete for the same key phrases. One per line."}),Ye?r.jsxs("div",{className:"compact-stack",children:[r.jsx("ul",{className:"detail-list",children:Ct.map(ue=>r.jsx("li",{children:ue},ue))}),r.jsxs("div",{className:"setup-nav",children:[r.jsx(oe,{type:"button",variant:"outline",onClick:mt,children:"Back"}),r.jsx(oe,{type:"button",onClick:()=>b(4),children:"Continue"})]})]}):r.jsxs("div",{className:"compact-stack",children:[r.jsxs("div",{className:"setup-field",children:[r.jsx("label",{className:"setup-label",htmlFor:"competitors",children:"Competitor domains (one per line)"}),r.jsx("textarea",{id:"competitors",className:"setup-textarea",rows:4,placeholder:`competitor1.com
246
- competitor2.com`,value:le,onChange:ue=>Ie(ue.target.value)})]}),Ut?r.jsx("p",{className:"text-rose-400 text-sm",children:Ut}):null,r.jsxs("div",{className:"setup-nav",children:[r.jsx(oe,{type:"button",variant:"outline",onClick:mt,children:"Back"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(oe,{type:"button",variant:"outline",onClick:()=>b(4),children:"Skip"}),r.jsx(oe,{type:"button",disabled:Ct.length===0||nn,onClick:Xr,children:nn?"Saving...":`Save ${Ct.length} competitor${Ct.length!==1?"s":""}`})]})]})]})]});case 4:return r.jsxs(Le,{className:"surface-card step-card",children:[r.jsxs("div",{className:"section-head",children:[r.jsxs("div",{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Step 5 of 5"}),r.jsx("h2",{children:"Launch first run"})]}),re?r.jsx(lt,{tone:"positive",children:"Queued"}):null]}),re?r.jsxs("div",{className:"compact-stack",children:[r.jsx("p",{className:"text-zinc-300",children:"Visibility sweep has been queued. View progress on the project page."}),r.jsxs("div",{className:"setup-nav",children:[r.jsx("span",{}),r.jsx(oe,{type:"button",onClick:()=>v({to:K?`/projects/${K}`:"/"}),children:"Open project"})]})]}):r.jsxs("div",{className:"compact-stack",children:[r.jsxs("p",{className:"supporting-copy",children:["Everything is configured. Launch an answer-visibility sweep to start tracking citations for ",r.jsx("span",{className:"text-zinc-100 font-medium",children:E}),"."]}),r.jsxs("div",{className:"setup-nav",children:[r.jsx(oe,{type:"button",variant:"outline",onClick:mt,children:"Back"}),r.jsx(oe,{type:"button",disabled:ut,onClick:ns,children:ut?"Launching...":"Launch visibility sweep"})]})]})]});default:return null}})();return r.jsxs("div",{className:"page-container",children:[r.jsx("div",{className:"page-header",children:r.jsxs("div",{className:"page-header-left",children:[r.jsx("h1",{className:"page-title",children:"Setup"}),r.jsx("p",{className:"page-subtitle",children:"Create a project, add key phrases, add competitors, and launch the first run."})]})}),r.jsx(Q$,{current:y,labels:V$}),r.jsx("section",{className:"setup-wizard",children:yn})]})}function J$(){return r.jsx("div",{className:"page-container",children:r.jsx("section",{className:"page-section",children:r.jsxs(Le,{className:"surface-card empty-card",children:[r.jsx("h1",{children:"Route not found"}),r.jsx("p",{children:"The current path does not map to a dashboard view."}),r.jsx(oe,{asChild:!0,children:r.jsx(St,{to:"/",children:"Return to overview"})})]})})})}function X$(){return r.jsx(F4,{children:r.jsx(G4,{})})}const ds=D_()({component:X$,validateSearch:e=>({runId:typeof e.runId=="string"?e.runId:void 0,evidenceId:typeof e.evidenceId=="string"?e.evidenceId:void 0})}),W$=Wn({getParentRoute:()=>ds,path:"/",component:W4,beforeLoad:({context:e})=>{const t=e.queryClient.getQueryData(Qn.projects.all);if(t&&t.length===0)throw mp({to:"/setup"})}}),eP=Wn({getParentRoute:()=>ds,path:"/projects",component:d$}),Nl=Wn({getParentRoute:()=>ds,path:"/projects/$projectId",component:()=>r.jsx(Np,{})}),tP=Wn({getParentRoute:()=>Nl,path:"/",component:()=>r.jsx(Sd,{tab:"overview"})}),nP=Wn({getParentRoute:()=>Nl,path:"/search-console",component:()=>r.jsx(Sd,{tab:"search-console"})}),sP=Wn({getParentRoute:()=>Nl,path:"/analytics",component:()=>r.jsx(Sd,{tab:"analytics"})}),iP=Wn({getParentRoute:()=>Nl,path:"/traffic",component:()=>r.jsx(Sd,{tab:"traffic"})}),aP=Wn({getParentRoute:()=>ds,path:"/runs",component:q$}),rP=Wn({getParentRoute:()=>ds,path:"/settings",component:Z$,beforeLoad:({context:e})=>{}}),oP=Wn({getParentRoute:()=>ds,path:"/setup",component:Y$,beforeLoad:({context:e})=>{const t=e.queryClient.getQueryData(Qn.projects.all);if(t&&t.length>0)throw mp({to:"/"})}}),lP=Wn({getParentRoute:()=>ds,path:"*",component:J$}),cP=ds.addChildren([W$,eP,Nl.addChildren([tP,nP,sP,iP]),aP,rP,oP,lP]);function uP(e,t){return G_({routeTree:cP,basepath:Fm||"/",context:{queryClient:e},...t?.initialEntries})}const JN=tE(),dP=uP(JN),XN=document.getElementById("root");if(!XN)throw new Error("Expected #root element for web app bootstrap.");function fP(){const[e,t]=w.useState(Kb()?"ready":"checking"),[n,a]=w.useState(""),[o,c]=w.useState(""),[u,f]=w.useState(null),[m,p]=w.useState(!1);w.useEffect(()=>{if(Kb())return;let b=!1;return c2().then(x=>{b||(x.authenticated?t("ready"):t(x.setupRequired?"setup":"login"))}).catch(x=>{b||(f(x instanceof Error?x.message:"Failed to reach the Canonry API"),t("login"))}),()=>{b=!0}},[]);const v=async b=>{if(b.preventDefault(),!n.trim()||n.trim().length<8){f("Password must be at least 8 characters");return}if(n!==o){f("Passwords do not match");return}p(!0),f(null);try{if(!(await u2(n.trim())).authenticated){f("Setup failed");return}a(""),c(""),t("ready")}catch(x){f(x instanceof Eu||x instanceof Error?x.message:"Setup failed")}finally{p(!1)}},y=async b=>{if(b.preventDefault(),!!n.trim()){p(!0),f(null);try{if(!(await d2(n.trim())).authenticated){f("Incorrect password");return}a(""),t("ready")}catch(x){f(x instanceof Eu||x instanceof Error?x.message:"Authentication failed")}finally{p(!1)}}};return e==="ready"?r.jsx(qk,{client:JN,children:r.jsx(V_,{router:dP})}):r.jsx("div",{className:"min-h-screen bg-zinc-950 px-4 py-8",children:r.jsx("div",{className:"mx-auto flex min-h-[calc(100vh-4rem)] max-w-md items-center justify-center",children:r.jsx(Le,{className:"surface-card w-full",children:e==="checking"?r.jsx(gu,{className:"py-8",children:r.jsx("p",{className:"supporting-copy text-center",children:"Connecting to Canonry…"})}):e==="setup"?r.jsxs(r.Fragment,{children:[r.jsxs(Zm,{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"First-time setup"}),r.jsx(Vm,{children:"Create a dashboard password"}),r.jsx(Qm,{children:"Choose a password to protect the Canonry dashboard. You will use this to sign in on future visits."})]}),r.jsx(gu,{children:r.jsxs("form",{className:"space-y-4",onSubmit:v,children:[r.jsxs("label",{className:"block space-y-1.5",children:[r.jsx("span",{className:"text-xs font-medium text-zinc-400",children:"Password"}),r.jsx("input",{autoFocus:!0,className:"w-full rounded-md border border-zinc-800 bg-zinc-950 px-3 py-2 text-sm text-zinc-100 outline-none transition focus:border-zinc-600",type:"password",value:n,onChange:b=>a(b.target.value),placeholder:"At least 8 characters"})]}),r.jsxs("label",{className:"block space-y-1.5",children:[r.jsx("span",{className:"text-xs font-medium text-zinc-400",children:"Confirm password"}),r.jsx("input",{className:"w-full rounded-md border border-zinc-800 bg-zinc-950 px-3 py-2 text-sm text-zinc-100 outline-none transition focus:border-zinc-600",type:"password",value:o,onChange:b=>c(b.target.value),placeholder:"Re-enter password"})]}),u?r.jsx("p",{className:"text-sm text-rose-400",children:u}):null,r.jsx(oe,{type:"submit",disabled:m||!n.trim()||!o.trim(),children:m?"Setting up…":"Create password & open dashboard"})]})})]}):r.jsxs(r.Fragment,{children:[r.jsxs(Zm,{children:[r.jsx("p",{className:"eyebrow eyebrow-soft",children:"Dashboard access"}),r.jsx(Vm,{children:"Sign in to Canonry"}),r.jsx(Qm,{children:"Enter your dashboard password to continue."})]}),r.jsx(gu,{children:r.jsxs("form",{className:"space-y-4",onSubmit:y,children:[r.jsxs("label",{className:"block space-y-1.5",children:[r.jsx("span",{className:"text-xs font-medium text-zinc-400",children:"Password"}),r.jsx("input",{autoFocus:!0,className:"w-full rounded-md border border-zinc-800 bg-zinc-950 px-3 py-2 text-sm text-zinc-100 outline-none transition focus:border-zinc-600",type:"password",value:n,onChange:b=>a(b.target.value),placeholder:"Dashboard password"})]}),u?r.jsx("p",{className:"text-sm text-rose-400",children:u}):null,r.jsx(oe,{type:"submit",disabled:m||!n.trim(),children:m?"Signing in…":"Open dashboard"})]})})]})})})})}yk.createRoot(XN).render(r.jsx(w.StrictMode,{children:r.jsx(fP,{})}));