vendor: 4,720 bytes, line 1
1function yme(e,n){for(var i=0;i<n.length;i++){const r=n[i];if(typeof r!="string"&&!Array.isArray(r)){for(const o in r)if(o!=="default"&&!(o in e)){const s=Object.getOwnPropertyDescriptor(r,o);s&&Object.defineProperty(e,o,s.get?s:{enumerable:!0,get:()=>r[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const s of o)if(s.type==="childList")for(const a of s.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function i(o){const s={};return o.integrity&&(s.integrity=o.integrity),o.referrerPolicy&&(s.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?s.credentials="include":o.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(o){if(o.ep)return;o.ep=!0;const s=i(o);fetch(o.href,s)}})();function Tu(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var EN={exports:{}},nw={};var NL;function xme(){if(NL)return nw;NL=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function i(r,o,s){var a=null;if(s!==void 0&&(a=""+s),o.key!==void 0&&(a=""+o.key),"key"in o){s={};for(var c in o)c!=="key"&&(s[c]=o[c])}else s=o;return o=s.ref,{$$typeof:e,type:r,key:a,ref:o!==void 0?o:null,props:s}}return nw.Fragment=n,nw.jsx=i,nw.jsxs=i,nw}var zL;function bme(){return zL||(zL=1,EN.exports=xme()),EN.exports}var t=bme(),MN={exports:{}},iw={},RN={exports:{}},ON={};var TL;function vme(){return TL||(TL=1,(function(e){function n(U,X){var Q=U.length;U.push(X);e:for(;0<Q;){var K=Q-1>>>1,G=U[K];if(0<o(G,X))U[K]=X,U[Q]=G,Q=K;else break e}}function i(U){return U.length===0?null:U[0]}function r(U){if(U.length===0)return null;var X=U[0],Q=U.pop();if(Q!==X){U[0]=Q;e:for(var K=0,G=U.length,L=G>>>1;K<L;){var q=2*(K+1)-1,W=U[q],oe=q+1,se=U[oe];if(0>o(W,Q))oe<G&&0>o(se,W)?(U[K]=se,U[oe]=Q,K=oe):(U[K]=W,U[q]=Q,K=q);else if(oe<G&&0>o(se,Q))U[K]=se,U[oe]=Q,K=oe;else break e}}return X}function o(U,X){var Q=U.sortIndex-X.sortIndex;return Q!==0?Q:U.id-X.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var a=Date,c=a.now();e.unstable_now=function(){return a.now()-c}}var u=[],m=[],h=1,g=null,x=3,y=!1,w=!1,j=!1,v=!1,_=typeof setTimeout=="function"?setTimeout:null,$=typeof clearTimeout=="function"?clearTimeout:null,k=typeof setImmediate<"u"?setImmediate:null;function P(U){for(var X=i(m);X!==null;){if(X.callback===null)r(m);else if(X.startTime<=U)r(m),X.sortIndex=X.expirationTime,n(u,X);else break;X=i(m)}}function S(U){if(j=!1,P(U),!w)if(i(u)!==null)w=!0,I||(I=!0,R());else{var X=i(m);X!==null&&H(S,X.startTime-U)}}var I=!1,A=-1,E=5,B=-1;function T(){return v?!0:!(e.unstable_now()-B<E)}function M(){if(v=!1,I){var U=e.unstable_now();B=U;var X=!0;try{e:{w=!1,j&&(j=!1,$(A),A=-1),y=!0;var Q=x;try{t:{for(P(U),g=i(u);g!==null&&!(g.expirationTime>U&&T());){var K=g.callback;if(typeof K=="function"){g.callback=null,x=g.priorityLevel;var G=K(g.expirationTime<=U);if(U=e.unstable_now(),typeof G=="function"){g.callback=G,P(U),X=!0;break t}g===i(u)&&r(u),P(U)}else r(u);g=i(u)}if(g!==null)X=!0;else{var L=i(m);L!==null&&H(S,L.startTime-U),X=!1}}break e}finally{g=null,x=Q,y=!1}X=void 0}}finally{X?R():I=!1}}}var R;if(typeof k=="function")R=function(){k(M)};else if(typeof MessageChannel<"u"){var F=new MessageChannel,Y=F.port2;F.port1.onmessage=M,R=function(){Y.postMessage(null)}}else R=function(){_(M,0)};function H(U,X){A=_(function(){U(e.unstable_now())},X)}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(U){U.callback=null},e.unstable_forceFrameRate=function(U){0>U||125<U?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):E=0<U?Math.floor(1e3/U):5},e.unstable_getCurrentPriorityLevel=function(){return x},e.unstable_next=function(U){switch(x){case 1:case 2:case 3:var X=3;break;default:X=x}var Q=x;x=X;try{return U()}finally{x=Q}},e.unstable_requestPaint=function(){v=!0},e.unstable_runWithPriority=function(U,X){switch(U){case 1:case 2:case 3:case 4:case 5:break;default:U=3}var Q=x;x=U;try{return X()}finally{x=Q}},e.unstable_scheduleCallback=function(U,X,Q){var K=e.unstable_now();switch(typeof Q=="object"&&Q!==null?(Q=Q.delay,Q=typeof Q=="number"&&0<Q?
vendor: 12,664 bytes, line 1
1K+Q:K):Q=K,U){case 1:var G=-1;break;case 2:G=250;break;case 5:G=1073741823;break;case 4:G=1e4;break;default:G=5e3}return G=Q+G,U={id:h++,callback:X,priorityLevel:U,startTime:Q,expirationTime:G,sortIndex:-1},Q>K?(U.sortIndex=Q,n(m,U),i(u)===null&&U===i(m)&&(j?($(A),A=-1):j=!0,H(S,Q-K))):(U.sortIndex=G,n(u,U),w||y||(w=!0,I||(I=!0,R()))),U},e.unstable_shouldYield=T,e.unstable_wrapCallback=function(U){var X=x;return function(){var Q=x;x=X;try{return U.apply(this,arguments)}finally{x=Q}}}})(ON)),ON}var EL;function wme(){return EL||(EL=1,RN.exports=vme()),RN.exports}var DN={exports:{}},Jn={};var ML;function jme(){if(ML)return Jn;ML=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),s=Symbol.for("react.consumer"),a=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),x=Symbol.iterator;function y(L){return L===null||typeof L!="object"?null:(L=x&&L[x]||L["@@iterator"],typeof L=="function"?L:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,v={};function _(L,q,W){this.props=L,this.context=q,this.refs=v,this.updater=W||w}_.prototype.isReactComponent={},_.prototype.setState=function(L,q){if(typeof L!="object"&&typeof L!="function"&&L!=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,L,q,"setState")},_.prototype.forceUpdate=function(L){this.updater.enqueueForceUpdate(this,L,"forceUpdate")};function $(){}$.prototype=_.prototype;function k(L,q,W){this.props=L,this.context=q,this.refs=v,this.updater=W||w}var P=k.prototype=new $;P.constructor=k,j(P,_.prototype),P.isPureReactComponent=!0;var S=Array.isArray;function I(){}var A={H:null,A:null,T:null,S:null},E=Object.prototype.hasOwnProperty;function B(L,q,W){var oe=W.ref;return{$$typeof:e,type:L,key:q,ref:oe!==void 0?oe:null,props:W}}function T(L,q){return B(L.type,q,L.props)}function M(L){return typeof L=="object"&&L!==null&&L.$$typeof===e}function R(L){var q={"=":"=0",":":"=2"};return"$"+L.replace(/[=:]/g,function(W){return q[W]})}var F=/\/+/g;function Y(L,q){return typeof L=="object"&&L!==null&&L.key!=null?R(""+L.key):q.toString(36)}function H(L){switch(L.status){case"fulfilled":return L.value;case"rejected":throw L.reason;default:switch(typeof L.status=="string"?L.then(I,I):(L.status="pending",L.then(function(q){L.status==="pending"&&(L.status="fulfilled",L.value=q)},function(q){L.status==="pending"&&(L.status="rejected",L.reason=q)})),L.status){case"fulfilled":return L.value;case"rejected":throw L.reason}}throw L}function U(L,q,W,oe,se){var de=typeof L;(de==="undefined"||de==="boolean")&&(L=null);var le=!1;if(L===null)le=!0;else switch(de){case"bigint":case"string":case"number":le=!0;break;case"object":switch(L.$$typeof){case e:case n:le=!0;break;case h:return le=L._init,U(le(L._payload),q,W,oe,se)}}if(le)return se=se(L),le=oe===""?"."+Y(L,0):oe,S(se)?(W="",le!=null&&(W=le.replace(F,"$&/")+"/"),U(se,q,W,"",function(ne){return ne})):se!=null&&(M(se)&&(se=T(se,W+(se.key==null||L&&L.key===se.key?"":(""+se.key).replace(F,"$&/")+"/")+le)),q.push(se)),1;le=0;var me=oe===""?".":oe+":";if(S(L))for(var ee=0;ee<L.length;ee++)oe=L[ee],de=me+Y(oe,ee),le+=U(oe,q,W,de,se);else if(ee=y(L),typeof ee=="function")for(L=ee.call(L),ee=0;!(oe=L.next()).done;)oe=oe.value,de=me+Y(oe,ee++),le+=U(oe,q,W,de,se);else if(de==="object"){if(typeof L.then=="function")return U(H(L),q,W,oe,se);throw q=String(L),Error("Objects are not valid as a React child (found: "+(q==="[object Object]"?"object with keys {"+Object.keys(L).join(", ")+"}":q)+"). If you meant to render a collection of children, use an array instead.")}return le}function X(L,q,W){if(L==null)return L;var oe=[],se=0;return U(L,oe,"","",function(de){return q.call(W,de,se++)}),oe}function Q(L){if(L._status===-1){var q=L._result;q=q(),q.then(function(W){(L._status===0||L._status===-1)&&(L._status=1,L._result=W)},function(W){(L._status===0||L._status===-1)&&(L._status=2,L._result=W)}),L._status===-1&&(L._status=0,L._result=q)}if(L._status===1)return L._result.default;throw L._result}var K=typeof reportError=="function"?reportError:function(L){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var q=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof L=="object"&&L!==null&&typeof L.message=="string"?String(L.message):String(L),error:L});if(!window.dispatchEvent(q))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",L);return}console.error(L)},G={map:X,forEach:function(L,q,W){X(L,function(){q.apply(this,arguments)},W)},count:function(L){var q=0;return X(L,function(){q++}),q},toArray:function(L){return X(L,function(q){return q})||[]},only:function(L){if(!M(L))throw Error("React.Children.only expected to receive a single React element child.");return L}};return Jn.Activity=g,Jn.Children=G,Jn.Component=_,Jn.Fragment=i,Jn.Profiler=o,Jn.PureComponent=k,Jn.StrictMode=r,Jn.Suspense=u,Jn.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=A,Jn.__COMPILER_RUNTIME={__proto__:null,c:function(L){return A.H.useMemoCache(L)}},Jn.cache=function(L){return function(){return L.apply(null,arguments)}},Jn.cacheSignal=function(){return null},Jn.cloneElement=function(L,q,W){if(L==null)throw Error("The argument must be a React element, but you passed "+L+".");var oe=j({},L.props),se=L.key;if(q!=null)for(de in q.key!==void 0&&(se=""+q.key),q)!E.call(q,de)||de==="key"||de==="__self"||de==="__source"||de==="ref"&&q.ref===void 0||(oe[de]=q[de]);var de=arguments.length-2;if(de===1)oe.children=W;else if(1<de){for(var le=Array(de),me=0;me<de;me++)le[me]=arguments[me+2];oe.children=le}return B(L.type,se,oe)},Jn.createContext=function(L){return L={$$typeof:a,_currentValue:L,_currentValue2:L,_threadCount:0,Provider:null,Consumer:null},L.Provider=L,L.Consumer={$$typeof:s,_context:L},L},Jn.createElement=function(L,q,W){var oe,se={},de=null;if(q!=null)for(oe in q.key!==void 0&&(de=""+q.key),q)E.call(q,oe)&&oe!=="key"&&oe!=="__self"&&oe!=="__source"&&(se[oe]=q[oe]);var le=arguments.length-2;if(le===1)se.children=W;else if(1<le){for(var me=Array(le),ee=0;ee<le;ee++)me[ee]=arguments[ee+2];se.children=me}if(L&&L.defaultProps)for(oe in le=L.defaultProps,le)se[oe]===void 0&&(se[oe]=le[oe]);return B(L,de,se)},Jn.createRef=function(){return{current:null}},Jn.forwardRef=function(L){return{$$typeof:c,render:L}},Jn.isValidElement=M,Jn.lazy=function(L){return{$$typeof:h,_payload:{_status:-1,_result:L},_init:Q}},Jn.memo=function(L,q){return{$$typeof:m,type:L,compare:q===void 0?null:q}},Jn.startTransition=function(L){var q=A.T,W={};A.T=W;try{var oe=L(),se=A.S;se!==null&&se(W,oe),typeof oe=="object"&&oe!==null&&typeof oe.then=="function"&&oe.then(I,K)}catch(de){K(de)}finally{q!==null&&W.types!==null&&(q.types=W.types),A.T=q}},Jn.unstable_useCacheRefresh=function(){return A.H.useCacheRefresh()},Jn.use=function(L){return A.H.use(L)},Jn.useActionState=function(L,q,W){return A.H.useActionState(L,q,W)},Jn.useCallback=function(L,q){return A.H.useCallback(L,q)},Jn.useContext=function(L){return A.H.useContext(L)},Jn.useDebugValue=function(){},Jn.useDeferredValue=function(L,q){return A.H.useDeferredValue(L,q)},Jn.useEffect=function(L,q){return A.H.useEffect(L,q)},Jn.useEffectEvent=function(L){return A.H.useEffectEvent(L)},Jn.useId=function(){return A.H.useId()},Jn.useImperativeHandle=function(L,q,W){return A.H.useImperativeHandle(L,q,W)},Jn.useInsertionEffect=function(L,q){return A.H.useInsertionEffect(L,q)},Jn.useLayoutEffect=function(L,q){return A.H.useLayoutEffect(L,q)},Jn.useMemo=function(L,q){return A.H.useMemo(L,q)},Jn.useOptimistic=function(L,q){return A.H.useOptimistic(L,q)},Jn.useReducer=function(L,q,W){return A.H.useReducer(L,q,W)},Jn.useRef=function(L){return A.H.useRef(L)},Jn.useState=function(L){return A.H.useState(L)},Jn.useSyncExternalStore=function(L,q,W){return A.H.useSyncExternalStore(L,q,W)},Jn.useTransition=function(){return A.H.useTransition()},Jn.version="19.2.1",Jn}var RL;function n1(){return RL||(RL=1,DN.exports=jme()),DN.exports}var LN={exports:{}},Ra={};var OL;function _me(){if(OL)return Ra;OL=1;var e=n1();function n(u){var m="https://react.dev/errors/"+u;if(1<arguments.length){m+="?args[]="+encodeURIComponent(arguments[1]);for(var h=2;h<arguments.length;h++)m+="&args[]="+encodeURIComponent(arguments[h])}return"Minified React error #"+u+"; visit "+m+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(){}var r={d:{f:i,r:function(){throw Error(n(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},o=Symbol.for("react.portal");function s(u,m,h){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:g==null?null:""+g,children:u,containerInfo:m,implementation:h}}var a=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(u,m){if(u==="font")return"";if(typeof m=="string")return m==="use-credentials"?m:""}return Ra.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,Ra.createPortal=function(u,m){var h=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!m||m.nodeType!==1&&m.nodeType!==9&&m.nodeType!==11)throw Error(n(299));return s(u,m,null,h)},Ra.flushSync=function(u){var m=a.T,h=r.p;try{if(a.T=null,r.p=2,u)return u()}finally{a.T=m,r.p=h,r.d.f()}},Ra.preconnect=function(u,m){typeof u=="string"&&(m?(m=m.crossOrigin,m=typeof m=="string"?m==="use-credentials"?m:"":void 0):m=null,r.d.C(u,m))},Ra.prefetchDNS=function(u){typeof u=="string"&&r.d.D(u)},Ra.preinit=function(u,m){if(typeof u=="string"&&m&&typeof m.as=="string"){var h=m.as,g=c(h,m.crossOrigin),x=typeof m.integrity=="string"?m.integrity:void 0,y=typeof m.fetchPriority=="string"?m.fetchPriority:void 0;h==="style"?r.d.S(u,typeof m.precedence=="string"?m.precedence:void 0,{crossOrigin:g,integrity:x,fetchPriority:y}):h==="script"&&r.d.X(u,{crossOrigin:g,integrity:x,fetchPriority:y,nonce:typeof m.nonce=="string"?m.nonce:void 0})}},Ra.preinitModule=function(u,m){if(typeof u=="string")if(typeof m=="object"&&m!==null){if(m.as==null||m.as==="script"){var h=c(m.as,m.crossOrigin);r.d.M(u,{crossOrigin:h,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0})}}else m==null&&r.d.M(u)},Ra.preload=function(u,m){if(typeof u=="string"&&typeof m=="object"&&m!==null&&typeof m.as=="string"){var h=m.as,g=c(h,m.crossOrigin);r.d.L(u,h,{crossOrigin:g,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0,type:typeof m.type=="string"?m.type:void 0,fetchPriority:typeof m.fetchPriority=="string"?m.fetchPriority:void 0,referrerPolicy:typeof m.referrerPolicy=="string"?m.referrerPolicy:void 0,imageSrcSet:typeof m.imageSrcSet=="string"?m.imageSrcSet:void 0,imageSizes:typeof m.imageSizes=="string"?m.imageSizes:void 0,media:typeof m.media=="string"?m.media:void 0})}},Ra.preloadModule=function(u,m){if(typeof u=="string")if(m){var h=c(m.as,m.crossOrigin);r.d.m(u,{as:typeof m.as=="string"&&m.as!=="script"?m.as:void 0,crossOrigin:h,integrity:typeof m.integrity=="string"?m.integrity:void 0})}else r.d.m(u)},Ra.requestFormReset=function(u){r.d.r(u)},Ra.unstable_batchedUpdates=function(u,m){return u(m)},Ra.useFormState=function(u,m,h){return a.H.useFormState(u,m,h)},Ra.useFormStatus=function(){return a.H.useHostTransitionStatus()},Ra.version="19.2.1",Ra}var DL;function Ate(){if(DL)return LN.exports;DL=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(n){console.error(n)}}return e(),LN.exports=_me(),LN.exports}var LL;function Cme(){if(LL)return iw;LL=1;var e=wme(),n=n1(),i=Ate();function r(d){var f="https://react.dev/errors/"+d;if(1<arguments.length){f+="?args[]="+encodeURIComponent(arguments[1]);for(var b=2;b<arguments.length;b++)f+="&args[]="+encodeURIComponent(arguments[b])}return"Minified React error #"+d+"; visit "+f+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(d){return!(!d||d.nodeType!==1&&d.nodeType!==9&&d.nodeType!==11)}function s(d){var f=d,b=d;if(d.alternate)for(;f.return;)f=f.return;else{d=f;do f=d,(f.flags&4098)!==0&&(b=f.return),d=f.return;while(d)}return f.tag===3?b:null}
vendor: 12,863 bytes, lines 1-8
1function a(d){if(d.tag===13){var f=d.memoizedState;if(f===null&&(d=d.alternate,d!==null&&(f=d.memoizedState)),f!==null)return f.dehydrated}return null}function c(d){if(d.tag===31){var f=d.memoizedState;if(f===null&&(d=d.alternate,d!==null&&(f=d.memoizedState)),f!==null)return f.dehydrated}return null}function u(d){if(s(d)!==d)throw Error(r(188))}function m(d){var f=d.alternate;if(!f){if(f=s(d),f===null)throw Error(r(188));return f!==d?null:d}for(var b=d,C=f;;){var N=b.return;if(N===null)break;var D=N.alternate;if(D===null){if(C=N.return,C!==null){b=C;continue}break}if(N.child===D.child){for(D=N.child;D;){if(D===b)return u(N),d;if(D===C)return u(N),f;D=D.sibling}throw Error(r(188))}if(b.return!==C.return)b=N,C=D;else{for(var J=!1,ve=N.child;ve;){if(ve===b){J=!0,b=N,C=D;break}if(ve===C){J=!0,C=N,b=D;break}ve=ve.sibling}if(!J){for(ve=D.child;ve;){if(ve===b){J=!0,b=D,C=N;break}if(ve===C){J=!0,C=D,b=N;break}ve=ve.sibling}if(!J)throw Error(r(189))}}if(b.alternate!==C)throw Error(r(190))}if(b.tag!==3)throw Error(r(188));return b.stateNode.current===b?d:f}function h(d){var f=d.tag;if(f===5||f===26||f===27||f===6)return d;for(d=d.child;d!==null;){if(f=h(d),f!==null)return f;d=d.sibling}return null}var g=Object.assign,x=Symbol.for("react.element"),y=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),v=Symbol.for("react.strict_mode"),_=Symbol.for("react.profiler"),$=Symbol.for("react.consumer"),k=Symbol.for("react.context"),P=Symbol.for("react.forward_ref"),S=Symbol.for("react.suspense"),I=Symbol.for("react.suspense_list"),A=Symbol.for("react.memo"),E=Symbol.for("react.lazy"),B=Symbol.for("react.activity"),T=Symbol.for("react.memo_cache_sentinel"),M=Symbol.iterator;function R(d){return d===null||typeof d!="object"?null:(d=M&&d[M]||d["@@iterator"],typeof d=="function"?d:null)}var F=Symbol.for("react.client.reference");function Y(d){if(d==null)return null;if(typeof d=="function")return d.$$typeof===F?null:d.displayName||d.name||null;if(typeof d=="string")return d;switch(d){case j:return"Fragment";case _:return"Profiler";case v:return"StrictMode";case S:return"Suspense";case I:return"SuspenseList";case B:return"Activity"}if(typeof d=="object")switch(d.$$typeof){case w:return"Portal";case k:return d.displayName||"Context";case $:return(d._context.displayName||"Context")+".Consumer";case P:var f=d.render;return d=d.displayName,d||(d=f.displayName||f.name||"",d=d!==""?"ForwardRef("+d+")":"ForwardRef"),d;case A:return f=d.displayName||null,f!==null?f:Y(d.type)||"Memo";case E:f=d._payload,d=d._init;try{return Y(d(f))}catch{}}return null}var H=Array.isArray,U=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Q={pending:!1,data:null,method:null,action:null},K=[],G=-1;function L(d){return{current:d}}function q(d){0>G||(d.current=K[G],K[G]=null,G--)}function W(d,f){G++,K[G]=d.current,d.current=f}var oe=L(null),se=L(null),de=L(null),le=L(null);function me(d,f){switch(W(de,f),W(se,d),W(oe,null),f.nodeType){case 9:case 11:d=(d=f.documentElement)&&(d=d.namespaceURI)?eL(d):0;break;default:if(d=f.tagName,f=f.namespaceURI)f=eL(f),d=tL(f,d);else switch(d){case"svg":d=1;break;case"math":d=2;break;default:d=0}}q(oe),W(oe,d)}function ee(){q(oe),q(se),q(de)}function ne(d){d.memoizedState!==null&&W(le,d);var f=oe.current,b=tL(f,d.type);f!==b&&(W(se,d),W(oe,b))}function Ae(d){se.current===d&&(q(oe),q(se)),le.current===d&&(q(le),Zv._currentValue=Q)}var _e,we;function Ke(d){if(_e===void 0)try{throw Error()}catch(b){var f=b.stack.trim().match(/\n( *(at )?)/);_e=f&&f[1]||"",we=-1<b.stack.indexOf(` 2 at`)?" (<anonymous>)":-1<b.stack.indexOf("@")?"@unknown:0:0":""}return` 3`+_e+d+we}var ce=!1;function ie(d,f){if(!d||ce)return"";ce=!0;var b=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var C={DetermineComponentFrameRoot:function(){try{if(f){var Gt=function(){throw Error()};if(Object.defineProperty(Gt.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Gt,[])}catch(Mt){var Pt=Mt}Reflect.construct(d,[],Gt)}else{try{Gt.call()}catch(Mt){Pt=Mt}d.call(Gt.prototype)}}else{try{throw Error()}catch(Mt){Pt=Mt}(Gt=d())&&typeof Gt.catch=="function"&&Gt.catch(function(){})}}catch(Mt){if(Mt&&Pt&&typeof Mt.stack=="string")return[Mt.stack,Pt.stack]}return[null,null]}};C.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var N=Object.getOwnPropertyDescriptor(C.DetermineComponentFrameRoot,"name");N&&N.configurable&&Object.defineProperty(C.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var D=C.DetermineComponentFrameRoot(),J=D[0],ve=D[1];if(J&&ve){var Ze=J.split(` 4`),$t=ve.split(` 5`);for(N=C=0;C<Ze.length&&!Ze[C].includes("DetermineComponentFrameRoot");)C++;for(;N<$t.length&&!$t[N].includes("DetermineComponentFrameRoot");)N++;if(C===Ze.length||N===$t.length)for(C=Ze.length-1,N=$t.length-1;1<=C&&0<=N&&Ze[C]!==$t[N];)N--;for(;1<=C&&0<=N;C--,N--)if(Ze[C]!==$t[N]){if(C!==1||N!==1)do if(C--,N--,0>N||Ze[C]!==$t[N]){var Bt=` 6`+Ze[C].replace(" at new "," at ");return d.displayName&&Bt.includes("<anonymous>")&&(Bt=Bt.replace("<anonymous>",d.displayName)),Bt}while(1<=C&&0<=N);break}}}finally{ce=!1,Error.prepareStackTrace=b}return(b=d?d.displayName||d.name:"")?Ke(b):""}function Re(d,f){switch(d.tag){case 26:case 27:case 5:return Ke(d.type);case 16:return Ke("Lazy");case 13:return d.child!==f&&f!==null?Ke("Suspense Fallback"):Ke("Suspense");case 19:return Ke("SuspenseList");case 0:case 15:return ie(d.type,!1);case 11:return ie(d.type.render,!1);case 1:return ie(d.type,!0);case 31:return Ke("Activity");default:return""}}function Be(d){try{var f="",b=null;do f+=Re(d,b),b=d,d=d.return;while(d);return f}catch(C){return` 7Error generating stack: `+C.message+` 8`+C.stack}}var tt=Object.prototype.hasOwnProperty,dt=e.unstable_scheduleCallback,je=e.unstable_cancelCallback,Me=e.unstable_shouldYield,Se=e.unstable_requestPaint,it=e.unstable_now,De=e.unstable_getCurrentPriorityLevel,te=e.unstable_ImmediatePriority,ge=e.unstable_UserBlockingPriority,Je=e.unstable_NormalPriority,Ee=e.unstable_LowPriority,Xe=e.unstable_IdlePriority,yt=e.log,Ne=e.unstable_setDisableYieldValue,Le=null,Ue=null;function We(d){if(typeof yt=="function"&&Ne(d),Ue&&typeof Ue.setStrictMode=="function")try{Ue.setStrictMode(Le,d)}catch{}}var Qe=Math.clz32?Math.clz32:be,ht=Math.log,pe=Math.LN2;function be(d){return d>>>=0,d===0?32:31-(ht(d)/pe|0)|0}var rt=256,ze=262144,lt=4194304;function vt(d){var f=d&42;if(f!==0)return f;switch(d&-d){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 d&261888;case 262144:case 524288:case 1048576:case 2097152:return d&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return d&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return d}}function Wt(d,f,b){var C=d.pendingLanes;if(C===0)return 0;var N=0,D=d.suspendedLanes,J=d.pingedLanes;d=d.warmLanes;var ve=C&134217727;return ve!==0?(C=ve&~D,C!==0?N=vt(C):(J&=ve,J!==0?N=vt(J):b||(b=ve&~d,b!==0&&(N=vt(b))))):(ve=C&~D,ve!==0?N=vt(ve):J!==0?N=vt(J):b||(b=C&~d,b!==0&&(N=vt(b)))),N===0?0:f!==0&&f!==N&&(f&D)===0&&(D=N&-N,b=f&-f,D>=b||D===32&&(b&4194048)!==0)?f:N}function Qt(d,f){return(d.pendingLanes&~(d.suspendedLanes&~d.pingedLanes)&f)===0}function Yt(d,f){switch(d){case 1:case 2:case 4:case 8:case 64:return f+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 f+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 Zt(){var d=lt;return lt<<=1,(lt&62914560)===0&&(lt=4194304),d}function tn(d){for(var f=[],b=0;31>b;b++)f.push(d);return f}function nn(d,f){d.pendingLanes|=f,f!==268435456&&(d.suspendedLanes=0,d.pingedLanes=0,d.warmLanes=0)}function xn(d,f,b,C,N,D){var J=d.pendingLanes;d.pendingLanes=b,d.suspendedLanes=0,d.pingedLanes=0,d.warmLanes=0,d.expiredLanes&=b,d.entangledLanes&=b,d.errorRecoveryDisabledLanes&=b,d.shellSuspendCounter=0;var ve=d.entanglements,Ze=d.expirationTimes,$t=d.hiddenUpdates;for(b=J&~b;0<b;){var Bt=31-Qe(b),Gt=1<<Bt;ve[Bt]=0,Ze[Bt]=-1;var Pt=$t[Bt];if(Pt!==null)for($t[Bt]=null,Bt=0;Bt<Pt.length;Bt++){var Mt=Pt[Bt];Mt!==null&&(Mt.lane&=-536870913)}b&=~Gt}C!==0&&st(d,C,0),D!==0&&N===0&&d.tag!==0&&(d.suspendedLanes|=D&~(J&~f))}function st(d,f,b){d.pendingLanes|=f,d.suspendedLanes&=~f;var C=31-Qe(f);d.entangledLanes|=f,d.entanglements[C]=d.entanglements[C]|1073741824|b&261930}function Ct(d,f){var b=d.entangledLanes|=f;for(d=d.entanglements;b;){var C=31-Qe(b),N=1<<C;N&f|d[C]&f&&(d[C]|=f),b&=~N}}function Ie(d,f){var b=f&-f;return b=(b&42)!==0?1:ae(b),(b&(d.suspendedLanes|f))!==0?0:b}function ae(d){switch(d){case 2:d=1;break;case 8:d=4;break;case 32:d=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:d=128;break;case 268435456:d=134217728;break;default:d=0}return d}function Fe(d){return d&=-d,2<d?8<d?(d&134217727)!==0?32:268435456:8:2}function Ge(){var d=X.p;return d!==0?d:(d=window.event,d===void 0?32:CL(d.type))}function wt(d,f){var b=X.p;try{return X.p=d,f()}finally{X.p=b}}var ke=Math.random().toString(36).slice(2),Ve="__reactFiber$"+ke,pt="__reactProps$"+ke,Nt="__reactContainer$"+ke,qe="__reactEvents$"+ke,qt="__reactListeners$"+ke,Mn="__reactHandles$"+ke,zt="__reactResources$"+ke,dn="__reactMarker$"+ke;function rn(d){delete d[Ve],delete d[pt],delete d[qe],delete d[qt],delete d[Mn]}function bn(d){var f=d[Ve];if(f)return f;for(var b=d.parentNode;b;){if(f=b[Nt]||b[Ve]){if(b=f.alternate,f.child!==null||b!==null&&b.child!==null)for(d=lL(d);d!==null;){if(b=d[Ve])return b;d=lL(d)}return f}d=b,b=d.parentNode}return null}function kt(d){if(d=d[Ve]||d[Nt]){var f=d.tag;if(f===5||f===6||f===13||f===31||f===26||f===27||f===3)return d}return null}function Kt(d){var f=d.tag;if(f===5||f===26||f===27||f===6)return d.stateNode;throw Error(r(33))}function un(d){var f=d[zt];return f||(f=d[zt]={hoistableStyles:new Map,hoistableScripts:new Map}),f}function pn(d){d[dn]=!0}var $n=new Set,Ii={};function _i(d,f){di(d,f),di(d+"Capture",f)}function di(d,f){for(Ii[d]=f,d=0;d<f.length;d++)$n.add(f[d])}var Co=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]*$"),Gr={},Go={};function Qc(d){return tt.call(Go,d)?!0:tt.call(Gr,d)?!1:Co.test(d)?Go[d]=!0:(Gr[d]=!0,!1)}function Zs(d,f,b){if(Qc(f))if(b===null)d.removeAttribute(f);else{switch(typeof b){case"undefined":case"function":case"symbol":d.removeAttribute(f);return;case"boolean":var C=f.toLowerCase().slice(0,5);if(C!=="data-"&&C!=="aria-"){d.removeAttribute(f);return}}d.setAttribute(f,""+b)}}function jl(d,f,b){if(b===null)d.removeAttribute(f);else{switch(typeof b){case"undefined":case"function":case"symbol":case"boolean":d.removeAttribute(f);return}d.setAttribute(f,""+b)}}function Vo(d,f,b,C){if(C===null)d.removeAttribute(b);else{switch(typeof C){case"undefined":case"function":case"symbol":case"boolean":d.removeAttribute(b);return}d.setAttributeNS(f,b,""+C)}}function Ro(d){switch(typeof d){case"bigint":case"boolean":case"number":case"string":case"undefined":return d;case"object":return d;default:return""}}function So(d){var f=d.type;return(d=d.nodeName)&&d.toLowerCase()==="input"&&(f==="checkbox"||f==="radio")}function ic(d,f,b){var C=Object.getOwnPropertyDescriptor(d.constructor.prototype,f);if(!d.hasOwnProperty(f)&&typeof C<"u"&&typeof C.get=="function"&&typeof C.set=="function"){var N=C.get,D=C.set;return Object.defineProperty(d,f,{configurable:!0,get:function(){return N.call(this)},set:function(J){b=""+J,D.call(this,J)}}),Object.defineProperty(d,f,{enumerable:C.enumerable}),{getValue:function(){return b},setValue:function(J){b=""+J},stopTracking:function(){d._valueTracker=null,delete d[f]}}}}function cs(d){if(!d._valueTracker){var f=So(d)?"checked":"value";d._valueTracker=ic(d,f,""+d[f])}}function rc(d){if(!d)return!1;var f=d._valueTracker;if(!f)return!0;var b=f.getValue(),C="";
vendor: 4,737 bytes, line 8
8return d&&(C=So(d)?d.checked?"true":"false":d.value),d=C,d!==b?(f.setValue(d),!0):!1}function _l(d){if(d=d||(typeof document<"u"?document:void 0),typeof d>"u")return null;try{return d.activeElement||d.body}catch{return d.body}}var Ns=/[\n"\\]/g;function Ti(d){return d.replace(Ns,function(f){return"\\"+f.charCodeAt(0).toString(16)+" "})}function ds(d,f,b,C,N,D,J,ve){d.name="",J!=null&&typeof J!="function"&&typeof J!="symbol"&&typeof J!="boolean"?d.type=J:d.removeAttribute("type"),f!=null?J==="number"?(f===0&&d.value===""||d.value!=f)&&(d.value=""+Ro(f)):d.value!==""+Ro(f)&&(d.value=""+Ro(f)):J!=="submit"&&J!=="reset"||d.removeAttribute("value"),f!=null?Sl(d,J,Ro(f)):b!=null?Sl(d,J,Ro(b)):C!=null&&d.removeAttribute("value"),N==null&&D!=null&&(d.defaultChecked=!!D),N!=null&&(d.checked=N&&typeof N!="function"&&typeof N!="symbol"),ve!=null&&typeof ve!="function"&&typeof ve!="symbol"&&typeof ve!="boolean"?d.name=""+Ro(ve):d.removeAttribute("name")}function Cl(d,f,b,C,N,D,J,ve){if(D!=null&&typeof D!="function"&&typeof D!="symbol"&&typeof D!="boolean"&&(d.type=D),f!=null||b!=null){if(!(D!=="submit"&&D!=="reset"||f!=null)){cs(d);return}b=b!=null?""+Ro(b):"",f=f!=null?""+Ro(f):b,ve||f===d.value||(d.value=f),d.defaultValue=f}C=C??N,C=typeof C!="function"&&typeof C!="symbol"&&!!C,d.checked=ve?d.checked:!!C,d.defaultChecked=!!C,J!=null&&typeof J!="function"&&typeof J!="symbol"&&typeof J!="boolean"&&(d.name=J),cs(d)}function Sl(d,f,b){f==="number"&&_l(d.ownerDocument)===d||d.defaultValue===""+b||(d.defaultValue=""+b)}function Ko(d,f,b,C){if(d=d.options,f){f={};for(var N=0;N<b.length;N++)f["$"+b[N]]=!0;for(b=0;b<d.length;b++)N=f.hasOwnProperty("$"+d[b].value),d[b].selected!==N&&(d[b].selected=N),N&&C&&(d[b].defaultSelected=!0)}else{for(b=""+Ro(b),f=null,N=0;N<d.length;N++){if(d[N].value===b){d[N].selected=!0,C&&(d[N].defaultSelected=!0);return}f!==null||d[N].disabled||(f=d[N])}f!==null&&(f.selected=!0)}}function Zc(d,f,b){if(f!=null&&(f=""+Ro(f),f!==d.value&&(d.value=f),b==null)){d.defaultValue!==f&&(d.defaultValue=f);return}d.defaultValue=b!=null?""+Ro(b):""}function us(d,f,b,C){if(f==null){if(C!=null){if(b!=null)throw Error(r(92));if(H(C)){if(1<C.length)throw Error(r(93));C=C[0]}b=C}b==null&&(b=""),f=b}b=Ro(f),d.defaultValue=b,C=d.textContent,C===b&&C!==""&&C!==null&&(d.value=C),cs(d)}function Js(d,f){if(f){var b=d.firstChild;if(b&&b===d.lastChild&&b.nodeType===3){b.nodeValue=f;return}}d.textContent=f}var Fp=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 oc(d,f,b){var C=f.indexOf("--")===0;b==null||typeof b=="boolean"||b===""?C?d.setProperty(f,""):f==="float"?d.cssFloat="":d[f]="":C?d.setProperty(f,b):typeof b!="number"||b===0||Fp.has(f)?f==="float"?d.cssFloat=b:d[f]=(""+b).trim():d[f]=b+"px"}function va(d,f,b){if(f!=null&&typeof f!="object")throw Error(r(62));if(d=d.style,b!=null){for(var C in b)!b.hasOwnProperty(C)||f!=null&&f.hasOwnProperty(C)||(C.indexOf("--")===0?d.setProperty(C,""):C==="float"?d.cssFloat="":d[C]="");for(var N in f)C=f[N],f.hasOwnProperty(N)&&b[N]!==C&&oc(d,N,C)}else for(var D in f)f.hasOwnProperty(D)&&oc(d,D,f[D])}function sc(d){if(d.indexOf("-")===-1)return!1;switch(d){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 wa=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"],["colorRen
8dering","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"]]),Wp=/^[\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 ac(d){return Wp.test(""+d)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":d}function Vr(){}var Jc=null;function Oo(d){return d=d.target||d.srcElement||window,d.correspondingUseElement&&(d=d.correspondingUseElement),d.nodeType===3?d.parentNode:d}var qa=null,Kn=null;function Ga(d){var f=kt(d);if(f&&(d=f.stateNode)){var b=d[pt]||null;e:switch(d=f.stateNode,f.type){case"input":if(ds(d,b.value,b.defaultValue,b.defaultValue,b.checked,b.defaultChecked,b.type,b.name),f=b.name,b.type==="radio"&&f!=null){for(b=d;b.parentNode;)b=b.parentNode;for(b=b.querySelectorAll('input[name="'+Ti(""+f)+'"][type="radio"]'),f=0;f<b.length;f++){var C=b[f];if(C!==d&&C.form===d.form){var N=C[pt]||null;if(!N)throw Error(r(90));ds(C,N.value,N.defaultValue,N.defaultValue,N.checked,N.defaultChecked,N.type,N.name)}}for(f=0;f<b.length;f++)C=b[f],C.form===d.form&&rc(C)}break e;case"textarea":Zc(d,b.value,b.defaultValue);break e;case"select":f=b.value,f!=null&&Ko(d,!!b.multiple,f,!1)}}}var an=!1;function Va(d,f,b){if(an)return d(f,b);an=!0;try{var C=d(f);return C}finally{if(an=!1,(qa!==null||Kn!==null)&&(BS(),qa&&(f=qa,d=Kn,Kn=qa=null,Ga(f),d)))for(f=0;f<d.length;f++)Ga(d[f])}}function Ka(d,f){var b=d.stateNode;if(b===null)return null;var C=b[pt]||null;if(C===null)return null;b=C[f];e:switch(f){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(C=!C.disabled)||(d=d.type,C=!(d==="button"||d==="input"||d==="select"||d==="textarea")),d=!C;break e;default:d=!1}if(d)return null;if(b&&typeof b!="function")throw Error(r(231,f,typeof b));return b}var Kr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),mo=!1;if(Kr)try{var ja={};Object.defineProperty(ja,"passive",{get:function(){mo=!0}}),window.addEventListener("test",ja,ja),window.removeEventListener("test",ja,ja)}catch{mo=!1}var gi=null,Or=null,ea=null;function Hd(){if(ea)return ea;var d,f=Or,b=f.length,C,N="value"in gi?gi.value:gi.textContent,D=N.length;for(d=0;d<b&&f[d]===N[d];d++);var J=b-d;for(C=1;C<=J&&f[b-C]===N[D-C];C++);return ea=N.slice(d,1<C?1-C:void 0)}function _a(d){var f=d.keyCode;
vendor: 2,826 bytes, line 8
8return"charCode"in d?(d=d.charCode,d===0&&f===13&&(d=13)):d=f,d===10&&(d=13),32<=d||d===13?d:0}function kl(){return!0}function Ca(){return!1}function to(d){function f(b,C,N,D,J){this._reactName=b,this._targetInst=N,this.type=C,this.nativeEvent=D,this.target=J,this.currentTarget=null;for(var ve in d)d.hasOwnProperty(ve)&&(b=d[ve],this[ve]=b?b(D):D[ve]);return this.isDefaultPrevented=(D.defaultPrevented!=null?D.defaultPrevented:D.returnValue===!1)?kl:Ca,this.isPropagationStopped=Ca,this}return g(f.prototype,{preventDefault:function(){this.defaultPrevented=!0;var b=this.nativeEvent;b&&(b.preventDefault?b.preventDefault():typeof b.returnValue!="unknown"&&(b.returnValue=!1),this.isDefaultPrevented=kl)},stopPropagation:function(){var b=this.nativeEvent;b&&(b.stopPropagation?b.stopPropagation():typeof b.cancelBubble!="unknown"&&(b.cancelBubble=!0),this.isPropagationStopped=kl)},persist:function(){},isPersistent:kl}),f}var zs={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(d){return d.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Sa=to(zs),ta=g({},zs,{view:0,detail:0}),Du=to(ta),ps,lc,na,Ya=g({},ta,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ti,button:0,buttons:0,relatedTarget:function(d){return d.relatedTarget===void 0?d.fromElement===d.srcElement?d.toElement:d.fromElement:d.relatedTarget},movementX:function(d){return"movementX"in d?d.movementX:(d!==na&&(na&&d.type==="mousemove"?(ps=d.screenX-na.screenX,lc=d.screenY-na.screenY):lc=ps=0,na=d),ps)},movementY:function(d){return"movementY"in d?d.movementY:lc}}),Yo=to(Ya),Up=g({},Ya,{dataTransfer:0}),ed=to(Up),Xa=g({},ta,{relatedTarget:0}),$l=to(Xa),Lu=g({},zs,{animationName:0,elapsedTime:0,pseudoElement:0}),td=to(Lu),nd=g({},zs,{clipboardData:function(d){return"clipboardData"in d?d.clipboardData:window.clipboardData}}),qd=to(nd),id=g({},zs,{data:0}),Qa=to(id),ka={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},_r={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"},Gd={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Cr(d){var f=this.nativeEvent;return f.getModifierState?f.getModifierState(d):(d=Gd[d])?!!f[d]:!1}function ti(){return Cr}var Ts=g({},ta,{key:function(d){if(d.key){var f=ka[d.key]||d.key;if(f!=="Unidentified")return f}
vendor: 7,848 bytes, line 8
8return d.type==="keypress"?(d=_a(d),d===13?"Enter":String.fromCharCode(d)):d.type==="keydown"||d.type==="keyup"?_r[d.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ti,charCode:function(d){return d.type==="keypress"?_a(d):0},keyCode:function(d){return d.type==="keydown"||d.type==="keyup"?d.keyCode:0},which:function(d){return d.type==="keypress"?_a(d):d.type==="keydown"||d.type==="keyup"?d.keyCode:0}}),cc=to(Ts),hh=g({},Ya,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Hp=to(hh),dc=g({},ta,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ti}),Vd=to(dc),$a=g({},zs,{propertyName:0,elapsedTime:0,pseudoElement:0}),Bu=to($a),Za=g({},Ya,{deltaX:function(d){return"deltaX"in d?d.deltaX:"wheelDeltaX"in d?-d.wheelDeltaX:0},deltaY:function(d){return"deltaY"in d?d.deltaY:"wheelDeltaY"in d?-d.wheelDeltaY:"wheelDelta"in d?-d.wheelDelta:0},deltaZ:0,deltaMode:0}),Il=to(Za),Pl=g({},zs,{newState:0,oldState:0}),Kd=to(Pl),Ki=[9,13,27,32],Ia=Kr&&"CompositionEvent"in window,Pa=null;Kr&&"documentMode"in document&&(Pa=document.documentMode);var Aa=Kr&&"TextEvent"in window&&!Pa,It=Kr&&(!Ia||Pa&&8<Pa&&11>=Pa),Dt=" ",ut=!1;function Lt(d,f){switch(d){case"keyup":return Ki.indexOf(f.keyCode)!==-1;case"keydown":return f.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function gt(d){return d=d.detail,typeof d=="object"&&"data"in d?d.data:null}var Ln=!1;function yi(d,f){switch(d){case"compositionend":return gt(f);case"keypress":return f.which!==32?null:(ut=!0,Dt);case"textInput":return d=f.data,d===Dt&&ut?null:d;default:return null}}function Jt(d,f){if(Ln)return d==="compositionend"||!Ia&&Lt(d,f)?(d=Hd(),ea=Or=gi=null,Ln=!1,d):null;switch(d){case"paste":return null;case"keypress":if(!(f.ctrlKey||f.altKey||f.metaKey)||f.ctrlKey&&f.altKey){if(f.char&&1<f.char.length)return f.char;if(f.which)return String.fromCharCode(f.which)}return null;case"compositionend":return It&&f.locale!=="ko"?null:f.data;default:return null}}var Qn={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 Ja(d){var f=d&&d.nodeName&&d.nodeName.toLowerCase();return f==="input"?!!Qn[d.type]:f==="textarea"}function ms(d,f,b,C){qa?Kn?Kn.push(C):Kn=[C]:qa=C,f=VS(f,"onChange"),0<f.length&&(b=new Sa("onChange","change",null,b,C),d.push({event:b,listeners:f}))}var xe=null,Oe=null;function He(d){KD(d,0)}function Ye(d){var f=Kt(d);if(rc(f))return d}function ft(d,f){if(d==="change")return f}var Ot=!1;if(Kr){var ln;if(Kr){var on="oninput"in document;if(!on){var In=document.createElement("div");In.setAttribute("oninput","return;"),on=typeof In.oninput=="function"}ln=on}else ln=!1;Ot=ln&&(!document.documentMode||9<document.documentMode)}function xi(){xe&&(xe.detachEvent("onpropertychange",ai),Oe=xe=null)}function ai(d){if(d.propertyName==="value"&&Ye(Oe)){var f=[];ms(f,Oe,d,Oo(d)),Va(He,f)}}function Yi(d,f,b){d==="focusin"?(xi(),xe=f,Oe=b,xe.attachEvent("onpropertychange",ai)):d==="focusout"&&xi()}function ar(d){if(d==="selectionchange"||d==="keyup"||d==="keydown")return Ye(Oe)}function Pi(d,f){if(d==="click")return Ye(f)}function Xo(d,f){if(d==="input"||d==="change")return Ye(f)}function rd(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}var xr=typeof Object.is=="function"?Object.is:rd;function Yr(d,f){if(xr(d,f))return!0;if(typeof d!="object"||d===null||typeof f!="object"||f===null)return!1;var b=Object.keys(d),C=Object.keys(f);if(b.length!==C.length)return!1;for(C=0;C<b.length;C++){var N=b[C];if(!tt.call(f,N)||!xr(d[N],f[N]))return!1}return!0}function Vy(d){for(;d&&d.firstChild;)d=d.firstChild;return d}function qp(d,f){var b=Vy(d);d=0;for(var C;b;){if(b.nodeType===3){if(C=d+b.textContent.length,d<=f&&C>=f)return{node:b,offset:f-d};d=C}e:{for(;b;){if(b.nextSibling){b=b.nextSibling;break e}b=b.parentNode}b=void 0}b=Vy(b)}}function Gp(d,f){return d&&f?d===f?!0:d&&d.nodeType===3?!1:f&&f.nodeType===3?Gp(d,f.parentNode):"contains"in d?d.contains(f):d.compareDocumentPosition?!!(d.compareDocumentPosition(f)&16):!1:!1}function Fu(d){d=d!=null&&d.ownerDocument!=null&&d.ownerDocument.defaultView!=null?d.ownerDocument.defaultView:window;for(var f=_l(d.document);f instanceof d.HTMLIFrameElement;){try{var b=typeof f.contentWindow.location.href=="string"}catch{b=!1}if(b)d=f.contentWindow;else break;f=_l(d.document)}return f}function Ky(d){var f=d&&d.nodeName&&d.nodeName.toLowerCase();return f&&(f==="input"&&(d.type==="text"||d.type==="search"||d.type==="tel"||d.type==="url"||d.type==="password")||f==="textarea"||d.contentEditable==="true")}var BC=Kr&&"documentMode"in document&&11>=document.documentMode,fh=null,qf=null,Do=null,Di=!1;function FC(d,f,b){var C=b.window===b?b.document:b.nodeType===9?b:b.ownerDocument;Di||fh==null||fh!==_l(C)||(C=fh,"selectionStart"in C&&Ky(C)?C={start:C.selectionStart,end:C.selectionEnd}:(C=(C.ownerDocument&&C.ownerDocument.defaultView||window).getSelection(),C={anchorNode:C.anchorNode,anchorOffset:C.anchorOffset,focusNode:C.focusNode,focusOffset:C.focusOffset}),Do&&Yr(Do,C)||(Do=C,C=VS(qf,"onSelect"),0<C.length&&(f=new Sa("onSelect","select",null,f,b),d.push({event:f,listeners:C}),f.target=fh)))}function hi(d,f){var b={};return b[d.toLowerCase()]=f.toLowerCase(),b["Webkit"+d]="webkit"+f,b["Moz"+d]="moz"+f,b}var vn={animationend:hi("Animation","AnimationEnd"),animationiteration:hi("Animation","AnimationIteration"),animationstart:hi("Animation","AnimationStart"),transitionrun:hi("Transition","TransitionRun"),transitionstart:hi("Transition","TransitionStart"),transitioncancel:hi("Transition","TransitionCancel"),transitionend:hi("Transition","TransitionEnd")},Vp={},D1={};Kr&&(D1=document.createElement("div").style,"AnimationEvent"in window||(delete vn.animationend.animation,delete vn.animationiteration.animation,delete vn.animationstart.animation),"TransitionEvent"in window||delete vn.transitionend.transition);function Wu(d){if(Vp[d])return Vp[d];if(!vn[d])return d;var f=vn[d],b;for(b in f)if(f.hasOwnProperty(b)&&b in D1)return Vp[d]=f[b];return d}var L1=Wu("animationend"),B1=Wu("animationiteration"),F1=Wu("animationstart"),WC=Wu("transitionrun"),UC=Wu("transitionstart"),HC=Wu("transitioncancel"),W1=Wu("transitionend"),U1=new Map,Yy="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(" ");Yy.push("scrollEnd");function Al(d,f){U1.set(d,f),_i(f,[d])}var Gf=typeof reportError=="function"?reportError:function(d){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var f=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof d=="object"&&d!==null&&typeof d.message=="string"?String(d.message):String(d),error:d});if(!window.dispatchEvent(f))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",d);return}console.error(d)},el=[],Kp=0,Xy=0;function Vf(){for(var d=Kp,f=Xy=Kp=0;f<d;){var b=el[f];el[f++]=null;var C=el[f];el[f++]=null;var N=el[f];el[f++]=null;var D=el[f];if(el[f++]=null,C!==null&&N!==null){var J=C.pending;J===null?N.next=N:(N.next=J.next,J.next=N),C.pending=N}D!==0&&H1(b,N,D)}}
vendor: 18,371 bytes, line 8
8function Kf(d,f,b,C){el[Kp++]=d,el[Kp++]=f,el[Kp++]=b,el[Kp++]=C,Xy|=C,d.lanes|=C,d=d.alternate,d!==null&&(d.lanes|=C)}function Qy(d,f,b,C){return Kf(d,f,b,C),Yf(d)}function Uu(d,f){return Kf(d,null,null,f),Yf(d)}function H1(d,f,b){d.lanes|=b;var C=d.alternate;C!==null&&(C.lanes|=b);for(var N=!1,D=d.return;D!==null;)D.childLanes|=b,C=D.alternate,C!==null&&(C.childLanes|=b),D.tag===22&&(d=D.stateNode,d===null||d._visibility&1||(N=!0)),d=D,D=D.return;return d.tag===3?(D=d.stateNode,N&&f!==null&&(N=31-Qe(b),d=D.hiddenUpdates,C=d[N],C===null?d[N]=[f]:C.push(f),f.lane=b|536870912),D):null}function Yf(d){if(50<qv)throw qv=0,rN=null,Error(r(185));for(var f=d.return;f!==null;)d=f,f=d.return;return d.tag===3?d.stateNode:null}var Yp={};function qC(d,f,b,C){this.tag=d,this.key=b,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=f,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=C,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Na(d,f,b,C){return new qC(d,f,b,C)}function Zy(d){return d=d.prototype,!(!d||!d.isReactComponent)}function od(d,f){var b=d.alternate;return b===null?(b=Na(d.tag,f,d.key,d.mode),b.elementType=d.elementType,b.type=d.type,b.stateNode=d.stateNode,b.alternate=d,d.alternate=b):(b.pendingProps=f,b.type=d.type,b.flags=0,b.subtreeFlags=0,b.deletions=null),b.flags=d.flags&65011712,b.childLanes=d.childLanes,b.lanes=d.lanes,b.child=d.child,b.memoizedProps=d.memoizedProps,b.memoizedState=d.memoizedState,b.updateQueue=d.updateQueue,f=d.dependencies,b.dependencies=f===null?null:{lanes:f.lanes,firstContext:f.firstContext},b.sibling=d.sibling,b.index=d.index,b.ref=d.ref,b.refCleanup=d.refCleanup,b}function q1(d,f){d.flags&=65011714;var b=d.alternate;return b===null?(d.childLanes=0,d.lanes=f,d.child=null,d.subtreeFlags=0,d.memoizedProps=null,d.memoizedState=null,d.updateQueue=null,d.dependencies=null,d.stateNode=null):(d.childLanes=b.childLanes,d.lanes=b.lanes,d.child=b.child,d.subtreeFlags=0,d.deletions=null,d.memoizedProps=b.memoizedProps,d.memoizedState=b.memoizedState,d.updateQueue=b.updateQueue,d.type=b.type,f=b.dependencies,d.dependencies=f===null?null:{lanes:f.lanes,firstContext:f.firstContext}),d}function Xf(d,f,b,C,N,D){var J=0;if(C=d,typeof d=="function")Zy(d)&&(J=1);else if(typeof d=="string")J=ome(d,b,oe.current)?26:d==="html"||d==="head"||d==="body"?27:5;else e:switch(d){case B:return d=Na(31,b,f,N),d.elementType=B,d.lanes=D,d;case j:return Hu(b.children,N,D,f);case v:J=8,N|=24;break;case _:return d=Na(12,b,f,N|2),d.elementType=_,d.lanes=D,d;case S:return d=Na(13,b,f,N),d.elementType=S,d.lanes=D,d;case I:return d=Na(19,b,f,N),d.elementType=I,d.lanes=D,d;default:if(typeof d=="object"&&d!==null)switch(d.$$typeof){case k:J=10;break e;case $:J=9;break e;case P:J=11;break e;case A:J=14;break e;case E:J=16,C=null;break e}J=29,b=Error(r(130,d===null?"null":typeof d,"")),C=null}return f=Na(J,b,f,N),f.elementType=d,f.type=C,f.lanes=D,f}function Hu(d,f,b,C){return d=Na(7,d,C,f),d.lanes=b,d}function Jy(d,f,b){return d=Na(6,d,null,f),d.lanes=b,d}function G1(d){var f=Na(18,null,null,0);return f.stateNode=d,f}function V1(d,f,b){return f=Na(4,d.children!==null?d.children:[],d.key,f),f.lanes=b,f.stateNode={containerInfo:d.containerInfo,pendingChildren:null,implementation:d.implementation},f}var Qf=new WeakMap;function Nl(d,f){if(typeof d=="object"&&d!==null){var b=Qf.get(d);return b!==void 0?b:(f={value:d,source:f,stack:Be(f)},Qf.set(d,f),f)}return{value:d,source:f,stack:Be(f)}}var za=[],zl=0,ia=null,ra=0,hs=[],Ta=0,tl=null,Tl=1,oa="";function uc(d,f){za[zl++]=ra,za[zl++]=ia,ia=d,ra=f}function Xp(d,f,b){hs[Ta++]=Tl,hs[Ta++]=oa,hs[Ta++]=tl,tl=d;var C=Tl;d=oa;var N=32-Qe(C)-1;C&=~(1<<N),b+=1;var D=32-Qe(f)+N;if(30<D){var J=N-N%5;D=(C&(1<<J)-1).toString(32),C>>=J,N-=J,Tl=1<<32-Qe(f)+N|b<<N|C,oa=D+d}else Tl=1<<D|b<<N|C,oa=d}function Zf(d){d.return!==null&&(uc(d,1),Xp(d,1,0))}function qu(d){for(;d===ia;)ia=za[--zl],za[zl]=null,ra=za[--zl],za[zl]=null;for(;d===tl;)tl=hs[--Ta],hs[Ta]=null,oa=hs[--Ta],hs[Ta]=null,Tl=hs[--Ta],hs[Ta]=null}function e0(d,f){hs[Ta++]=Tl,hs[Ta++]=oa,hs[Ta++]=tl,Tl=f.id,oa=f.overflow,tl=d}var no=null,Ci=null,ri=!1,El=null,fs=!1,K1=Error(r(519));function Gu(d){var f=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw gh(Nl(f,d)),K1}function Jf(d){var f=d.stateNode,b=d.type,C=d.memoizedProps;switch(f[Ve]=d,f[pt]=C,b){case"dialog":vi("cancel",f),vi("close",f);break;case"iframe":case"object":case"embed":vi("load",f);break;case"video":case"audio":for(b=0;b<Vv.length;b++)vi(Vv[b],f);break;case"source":vi("error",f);break;case"img":case"image":case"link":vi("error",f),vi("load",f);break;case"details":vi("toggle",f);break;case"input":vi("invalid",f),Cl(f,C.value,C.defaultValue,C.checked,C.defaultChecked,C.type,C.name,!0);break;case"select":vi("invalid",f);break;case"textarea":vi("invalid",f),us(f,C.value,C.defaultValue,C.children)}b=C.children,typeof b!="string"&&typeof b!="number"&&typeof b!="bigint"||f.textContent===""+b||C.suppressHydrationWarning===!0||ZD(f.textContent,b)?(C.popover!=null&&(vi("beforetoggle",f),vi("toggle",f)),C.onScroll!=null&&vi("scroll",f),C.onScrollEnd!=null&&vi("scrollend",f),C.onClick!=null&&(f.onclick=Vr),f=!0):f=!1,f||Gu(d,!0)}function GC(d){for(no=d.return;no;)switch(no.tag){case 5:case 31:case 13:fs=!1;return;case 27:case 3:fs=!0;return;default:no=no.return}}function Yd(d){if(d!==no)return!1;if(!ri)return GC(d),ri=!0,!1;var f=d.tag,b;if((b=f!==3&&f!==27)&&((b=f===5)&&(b=d.type,b=!(b!=="form"&&b!=="button")||bN(d.type,d.memoizedProps)),b=!b),b&&Ci&&Gu(d),GC(d),f===13){if(d=d.memoizedState,d=d!==null?d.dehydrated:null,!d)throw Error(r(317));Ci=aL(d)}else if(f===31){if(d=d.memoizedState,d=d!==null?d.dehydrated:null,!d)throw Error(r(317));Ci=aL(d)}else f===27?(f=Ci,Oh(d.type)?(d=CN,CN=null,Ci=d):Ci=f):Ci=no?md(d.stateNode.nextSibling):null;return!0}function Vu(){Ci=no=null,ri=!1}function t0(){var d=El;return d!==null&&(Ml===null?Ml=d:Ml.push.apply(Ml,d),El=null),d}function gh(d){El===null?El=[d]:El.push(d)}var n0=L(null),Ku=null,sd=null;function Xd(d,f,b){W(n0,f._currentValue),f._currentValue=b}function ad(d){d._currentValue=n0.current,q(n0)}function i0(d,f,b){for(;d!==null;){var C=d.alternate;if((d.childLanes&f)!==f?(d.childLanes|=f,C!==null&&(C.childLanes|=f)):C!==null&&(C.childLanes&f)!==f&&(C.childLanes|=f),d===b)break;d=d.return}}function r0(d,f,b,C){var N=d.child;for(N!==null&&(N.return=d);N!==null;){var D=N.dependencies;if(D!==null){var J=N.child;D=D.firstContext;e:for(;D!==null;){var ve=D;D=N;for(var Ze=0;Ze<f.length;Ze++)if(ve.context===f[Ze]){D.lanes|=b,ve=D.alternate,ve!==null&&(ve.lanes|=b),i0(D.return,b,d),C||(J=null);break e}D=ve.next}}else if(N.tag===18){if(J=N.return,J===null)throw Error(r(341));J.lanes|=b,D=J.alternate,D!==null&&(D.lanes|=b),i0(J,b,d),J=null}else J=N.child;if(J!==null)J.return=N;else for(J=N;J!==null;){if(J===d){J=null;break}if(N=J.sibling,N!==null){N.return=J.return,J=N;break}J=J.return}N=J}}function Qp(d,f,b,C){d=null;for(var N=f,D=!1;N!==null;){if(!D){if((N.flags&524288)!==0)D=!0;else if((N.flags&262144)!==0)break}if(N.tag===10){var J=N.alternate;if(J===null)throw Error(r(387));if(J=J.memoizedProps,J!==null){var ve=N.type;xr(N.pendingProps.value,J.value)||(d!==null?d.push(ve):d=[ve])}}else if(N===le.current){if(J=N.alternate,J===null)throw Error(r(387));J.memoizedState.memoizedState!==N.memoizedState.memoizedState&&(d!==null?d.push(Zv):d=[Zv])}N=N.return}d!==null&&r0(f,d,b,C),f.flags|=262144}function Yu(d){for(d=d.firstContext;d!==null;){if(!xr(d.context._currentValue,d.memoizedValue))return!0;d=d.next}return!1}function Zp(d){Ku=d,sd=null,d=d.dependencies,d!==null&&(d.firstContext=null)}function Sr(d){return Xu(Ku,d)}function o0(d,f){return Ku===null&&Zp(d),Xu(d,f)}function Xu(d,f){var b=f._currentValue;if(f={context:f,memoizedValue:b,next:null},sd===null){if(d===null)throw Error(r(308));sd=f,d.dependencies={lanes:0,firstContext:f},d.flags|=524288}else sd=sd.next=f;return b}var UA=typeof AbortController<"u"?AbortController:function(){var d=[],f=this.signal={aborted:!1,addEventListener:function(b,C){d.push(C)}};this.abort=function(){f.aborted=!0,d.forEach(function(b){return b()})}},eg=e.unstable_scheduleCallback,HA=e.unstable_NormalPriority,kr={$$typeof:k,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Y1(){return{controller:new UA,data:new Map,refCount:0}}function Qu(d){d.refCount--,d.refCount===0&&eg(HA,function(){d.controller.abort()})}var Zu=null,Jp=0,em=0,ld=null;function qA(d,f){if(Zu===null){var b=Zu=[];Jp=0,em=dN(),ld={status:"pending",value:void 0,then:function(C){b.push(C)}}}return Jp++,f.then(yh,yh),f}function yh(){if(--Jp===0&&Zu!==null){ld!==null&&(ld.status="fulfilled");var d=Zu;Zu=null,em=0,ld=null;for(var f=0;f<d.length;f++)(0,d[f])()}}function GA(d,f){var b=[],C={status:"pending",value:null,reason:null,then:function(N){b.push(N)}};return d.then(function(){C.status="fulfilled",C.value=f;for(var N=0;N<b.length;N++)(0,b[N])(f)},function(N){for(C.status="rejected",C.reason=N,N=0;N<b.length;N++)(0,b[N])(void 0)}),C}var tm=U.S;U.S=function(d,f){jD=it(),typeof f=="object"&&f!==null&&typeof f.then=="function"&&qA(d,f),tm!==null&&tm(d,f)};var pc=L(null);function s0(){var d=pc.current;return d!==null?d:Ir.pooledCache}function tg(d,f){f===null?W(pc,pc.current):W(pc,f.pool)}function X1(){var d=s0();return d===null?null:{parent:kr._currentValue,pool:d}}var Ju=Error(r(460)),Q1=Error(r(474)),xh=Error(r(542)),a0={then:function(){}};function l0(d){return d=d.status,d==="fulfilled"||d==="rejected"}function c0(d,f,b){switch(b=d[b],b===void 0?d.push(f):b!==f&&(f.then(Vr,Vr),f=b),f.status){case"fulfilled":return f.value;case"rejected":throw d=f.reason,VC(d),d;default:if(typeof f.status=="string")f.then(Vr,Vr);else{if(d=Ir,d!==null&&100<d.shellSuspendCounter)throw Error(r(482));d=f,d.status="pending",d.then(function(C){if(f.status==="pending"){var N=f;N.status="fulfilled",N.value=C}},function(C){if(f.status==="pending"){var N=f;N.status="rejected",N.reason=C}})}switch(f.status){case"fulfilled":return f.value;case"rejected":throw d=f.reason,VC(d),d}throw Qd=f,Ju}}function ep(d){try{var f=d._init;return f(d._payload)}catch(b){throw b!==null&&typeof b=="object"&&typeof b.then=="function"?(Qd=b,Ju):b}}var Qd=null;function Z1(){if(Qd===null)throw Error(r(459));var d=Qd;return Qd=null,d}function VC(d){if(d===Ju||d===xh)throw Error(r(483))}var nm=null,ng=0;function tp(d){var f=ng;return ng+=1,nm===null&&(nm=[]),c0(nm,d,f)}function ig(d,f){f=f.props.ref,d.ref=f!==void 0?f:null}function np(d,f){throw f.$$typeof===x?Error(r(525)):(d=Object.prototype.toString.call(f),Error(r(31,d==="[object Object]"?"object with keys {"+Object.keys(f).join(", ")+"}":d)))}function KC(d){function f(xt,ct){if(d){var St=xt.deletions;St===null?(xt.deletions=[ct],xt.flags|=16):St.push(ct)}}function b(xt,ct){if(!d)return null;for(;ct!==null;)f(xt,ct),ct=ct.sibling;return null}function C(xt){for(var ct=new Map;xt!==null;)xt.key!==null?ct.set(xt.key,xt):ct.set(xt.index,xt),xt=xt.sibling;return ct}function N(xt,ct){return xt=od(xt,ct),xt.index=0,xt.sibling=null,xt}function D(xt,ct,St){return xt.index=St,d?(St=xt.alternate,St!==null?(St=St.index,St<ct?(xt.flags|=67108866,ct):St):(xt.flags|=67108866,ct)):(xt.flags|=1048576,ct)}function J(xt){return d&&xt.alternate===null&&(xt.flags|=67108866),xt}function ve(xt,ct,St,Ht){return ct===null||ct.tag!==6?(ct=Jy(St,xt.mode,Ht),ct.return=xt,ct):(ct=N(ct,St),ct.return=xt,ct)}function Ze(xt,ct,St,Ht){var On=St.type;return On===j?Bt(xt,ct,St.props.children,Ht,St.key):ct!==null&&(ct.elementType===On||typeof On=="object"&&On!==null&&On.$$typeof===E&&ep(On)===ct.type)?(ct=N(ct,St.props),ig(ct,St),ct.return=xt,ct):(ct=Xf(St.type,St.key,St.props,null,xt.mode,Ht),ig(ct,St),ct.return=xt,ct)}function $t(xt,ct,St,Ht){return ct===null||ct.tag!==4||ct.stateNode.containerInfo!==St.containerInfo||ct.stateNode.implementation!==St.implementation?(ct=V1(St,xt.mode,Ht),ct.return=xt,ct):(ct=N(ct,St.children||[]),ct.return=xt,ct)}function Bt(xt,ct,St,Ht,On){return ct===null||ct.tag!==7?(ct=Hu(St,xt.mode,Ht,On),ct.return=xt,ct):(ct=N(ct,St),ct.return=xt,ct)}function Gt(xt,ct,St){if(typeof ct=="string"&&ct!==""||typeof ct=="number"||typeof ct=="bigint")return ct=Jy(""+ct,xt.mode,St),ct.return=xt,ct;if(typeof ct=="object"&&ct!==null){switch(ct.$$typeof){case y:return St=Xf(ct.type,ct.key,ct.props,null,xt.mode,St),ig(St,ct),St.return=xt,St;case w:return ct=V1(ct,xt.mode,St),ct.return=xt,ct;case E:return ct=ep(ct),Gt(xt,ct,St)}if(H(ct)||R(ct))return ct=Hu(ct,xt.mode,St,null),ct.return=xt,ct;if(typeof ct.then=="function")return Gt(xt,tp(ct),St);if(ct.$$typeof===k)return Gt(xt,o0(xt,ct),St);np(xt,ct)}return null}function Pt(xt,ct,St,Ht){var On=ct!==null?ct.key:null;if(typeof St=="string"&&St!==""||typeof St=="number"||typeof St=="bigint")return On!==null?null:ve(xt,ct,""+St,Ht);if(typeof St=="object"&&St!==null){switch(St.$$typeof){case y:return St.key===On?Ze(xt,ct,St,Ht):null;case w:return St.key===On?$t(xt,ct,St,Ht):null;case E:return St=ep(St),Pt(xt,ct,St,Ht)}if(H(St)||R(St))return On!==null?null:Bt(xt,ct,St,Ht,null);if(typeof St.then=="function")return Pt(xt,ct,tp(St),Ht);if(St.$$typeof===k)return Pt(xt,ct,o0(xt,St),Ht);np(xt,St)}return null}function Mt(xt,ct,St,Ht,On){if(typeof Ht=="string"&&Ht!==""||typeof Ht=="number"||typeof Ht=="bigint")return xt=xt.get(St)||null,ve(ct,xt,""+Ht,On);if(typeof Ht=="object"&&Ht!==null){switch(Ht.$$typeof){case y:return xt=xt.get(Ht.key===null?St:Ht.key)||null,Ze(ct,xt,Ht,On);case w:return xt=xt.get(Ht.key===null?St:Ht.key)||null,$t(ct,xt,Ht,On);case E:return Ht=ep(Ht),Mt(xt,ct,St,Ht,On)}if(H(Ht)||R(Ht))return xt=xt.get(St)||null,Bt(ct,xt,Ht,On,null);if(typeof Ht.then=="function")return Mt(xt,ct,St,tp(Ht),On);if(Ht.$$typeof===k)return Mt(xt,ct,St,o0(ct,Ht),On);np(ct,Ht)}return null}function _n(xt,ct,St,Ht){for(var On=null,Li=null,Pn=ct,li=ct=0,ki=null;Pn!==null&&li<St.length;li++){Pn.index>li?(ki=Pn,Pn=null):ki=Pn.sibling;var Bi=Pt(xt,Pn,St[li],Ht);if(Bi===null){Pn===null&&(Pn=ki);break}d&&Pn&&Bi.alternate===null&&f(xt,Pn),ct=D(Bi,ct,li),Li===null?On=Bi:Li.sibling=Bi,Li=Bi,Pn=ki}if(li===St.length)return b(xt,Pn),ri&&uc(xt,li),On;if(Pn===null){for(;li<St.length;li++)Pn=Gt(xt,St[li],Ht),Pn!==null&&(ct=D(Pn,ct,li),Li===null?On=Pn:Li.sibling=Pn,Li=Pn);return ri&&uc(xt,li),On}for(Pn=C(Pn);li<St.length;li++)ki=Mt(Pn,xt,li,St[li],Ht),ki!==null&&(d&&ki.alternate!==null&&Pn.delete(ki.key===null?li:ki.key),ct=D(ki,ct,li),Li===null?On=ki:Li.sibling=ki,Li=ki);return d&&Pn.forEach(function(Wh){return f(xt,Wh)}),ri&&uc(xt,li),On}function Un(xt,ct,St,Ht){if(St==null)throw Error(r(151));for(var On=null,Li=null,Pn=ct,li=ct=0,ki=null,Bi=St.next();Pn!==null&&!Bi.done;li++,Bi=St.next()){Pn.index>li?(ki=Pn,Pn=null):ki=Pn.sibling;var Wh=Pt(xt,Pn,Bi.value,Ht);if(Wh===null){Pn===null&&(Pn=ki);break}d&&Pn&&Wh.alternate===null&&f(xt,Pn),ct=D(Wh,ct,li),Li===null?On=Wh:Li.sibling=Wh,Li=Wh,Pn=ki}if(Bi.done)return b(xt,Pn),ri&&uc(xt,li),On;if(Pn===null){for(;!Bi.done;li++,Bi=St.next())Bi=Gt(xt,Bi.value,Ht),Bi!==null&&(ct=D(Bi,ct,li),Li===null?On=Bi:Li.sibling=Bi,Li=Bi);return ri&&uc(xt,li),On}for(Pn=C(Pn);!Bi.done;li++,Bi=St.next())Bi=Mt(Pn,xt,li,Bi.value,Ht),Bi!==null&&(d&&Bi.alternate!==null&&Pn.delete(Bi.key===null?li:Bi.key),ct=D(Bi,ct,li),Li===null?On=Bi:Li.sibling=Bi,Li=Bi);return d&&Pn.forEach(function(gme){return f(xt,gme)}),ri&&uc(xt,li),On}function wr(xt,ct,St,Ht){if(typeof St=="object"&&St!==null&&St.type===j&&St.key===null&&(St=St.props.children),typeof St=="object"&&St!==null){switch(St.$$typeof){case y:e:{for(var On=St.key;ct!==null;){if(ct.key===On){if(On=St.type,On===j){if(ct.tag===7){b(xt,ct.sibling),Ht=N(ct,St.props.children),Ht.return=xt,xt=Ht;break e}}else if(ct.elementType===On||typeof On=="object"&&On!==null&&On.$$typeof===E&&ep(On)===ct.type){b(xt,ct.sibling),Ht=N(ct,St.props),ig(Ht,St),Ht.return=xt,xt=Ht;break e}b(xt,ct);break}else f(xt,ct);ct=ct.sibling}St.type===j?(Ht=Hu(St.props.children,xt.mode,Ht,St.key),Ht.return=xt,xt=Ht):(Ht=Xf(St.type,St.key,St.props,null,xt.mode,Ht),ig(Ht,St),Ht.return=xt,xt=Ht)}return J(xt);case w:e:{for(On=St.key;ct!==null;){if(ct.key===On)if(ct.tag===4&&ct.stateNode.containerInfo===St.containerInfo&&ct.stateNode.implementation===St.implementation){b(xt,ct.sibling),Ht=N(ct,St.children||[]),Ht.return=xt,xt=Ht;break e}else{b(xt,ct);break}else f(xt,ct);ct=ct.sibling}Ht=V1(St,xt.mode,Ht),Ht.return=xt,xt=Ht}return J(xt);case E:return St=ep(St),wr(xt,ct,St,Ht)}if(H(St))return _n(xt,ct,St,Ht);if(R(St)){if(On=R(St),typeof On!="function")throw Error(r(150));return St=On.call(St),Un(xt,ct,St,Ht)}if(typeof St.then=="function")return wr(xt,ct,tp(St),Ht);if(St.$$typeof===k)return wr(xt,ct,o0(xt,St),Ht);np(xt,St)}return typeof St=="string"&&St!==""||typeof St=="number"||typeof St=="bigint"?(St=""+St,ct!==null&&ct.tag===6?(b(xt,ct.sibling),Ht=N(ct,St),Ht.return=xt,xt=Ht):(b(xt,ct),Ht=Jy(St,xt.mode,Ht),Ht.return=xt,xt=Ht),J(xt)):b(xt,ct)}return function(xt,ct,St,Ht){try{ng=0;var On=wr(xt,ct,St,Ht);return nm=null,On}catch(Pn){if(Pn===Ju||Pn===xh)throw Pn;var Li=Na(29,Pn,null,xt.mode);return Li.lanes=Ht,Li.return=xt,Li}finally{}}}var mc=KC(!0),d0=KC(!1),hc=!1;function u0(d){d.updateQueue={baseState:d.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function rg(d,f){d=d.updateQueue,f.updateQueue===d&&(f.updateQueue={baseState:d.baseState,firstBaseUpdate:d.firstBaseUpdate,lastBaseUpdate:d.lastBaseUpdate,shared:d.shared,callbacks:null})}function ip(d){return{lane:d,tag:0,payload:null,callback:null,next:null}}function cd(d,f,b){var C=d.updateQueue;if(C===null)return null;if(C=C.shared,(Ui&2)!==0){var N=C.pending;return N===null?f.next=f:(f.next=N.next,N.next=f),C.pending=f,f=Yf(d),H1(d,null,b),f}return Kf(d,C,f,b),Yf(d)}function og(d,f,b){if(f=f.updateQueue,f!==null&&(f=f.shared,(b&4194048)!==0)){var C=f.lanes;C&=d.pendingLanes,b|=C,f.lanes=b,Ct(d,b)}}function p0(d,f){var b=d.updateQueue,C=d.alternate;if(C!==null&&(C=C.updateQueue,b===C)){var N=null,D=null;if(b=b.firstBaseUpdate,b!==null){do{var J={lane:b.lane,tag:b.tag,payload:b.payload,callback:null,next:null};D===null?N=D=J:D=D.next=J,b=b.next}
vendor: 5,775 bytes, line 8
8while(b!==null);D===null?N=D=f:D=D.next=f}else N=D=f;b={baseState:C.baseState,firstBaseUpdate:N,lastBaseUpdate:D,shared:C.shared,callbacks:C.callbacks},d.updateQueue=b;return}d=b.lastBaseUpdate,d===null?b.firstBaseUpdate=f:d.next=f,b.lastBaseUpdate=f}var J1=!1;function bh(){if(J1){var d=ld;if(d!==null)throw d}}function vh(d,f,b,C){J1=!1;var N=d.updateQueue;hc=!1;var D=N.firstBaseUpdate,J=N.lastBaseUpdate,ve=N.shared.pending;if(ve!==null){N.shared.pending=null;var Ze=ve,$t=Ze.next;Ze.next=null,J===null?D=$t:J.next=$t,J=Ze;var Bt=d.alternate;Bt!==null&&(Bt=Bt.updateQueue,ve=Bt.lastBaseUpdate,ve!==J&&(ve===null?Bt.firstBaseUpdate=$t:ve.next=$t,Bt.lastBaseUpdate=Ze))}if(D!==null){var Gt=N.baseState;J=0,Bt=$t=Ze=null,ve=D;do{var Pt=ve.lane&-536870913,Mt=Pt!==ve.lane;if(Mt?(Si&Pt)===Pt:(C&Pt)===Pt){Pt!==0&&Pt===em&&(J1=!0),Bt!==null&&(Bt=Bt.next={lane:0,tag:ve.tag,payload:ve.payload,callback:null,next:null});e:{var _n=d,Un=ve;Pt=f;var wr=b;switch(Un.tag){case 1:if(_n=Un.payload,typeof _n=="function"){Gt=_n.call(wr,Gt,Pt);break e}Gt=_n;break e;case 3:_n.flags=_n.flags&-65537|128;case 0:if(_n=Un.payload,Pt=typeof _n=="function"?_n.call(wr,Gt,Pt):_n,Pt==null)break e;Gt=g({},Gt,Pt);break e;case 2:hc=!0}}Pt=ve.callback,Pt!==null&&(d.flags|=64,Mt&&(d.flags|=8192),Mt=N.callbacks,Mt===null?N.callbacks=[Pt]:Mt.push(Pt))}else Mt={lane:Pt,tag:ve.tag,payload:ve.payload,callback:ve.callback,next:null},Bt===null?($t=Bt=Mt,Ze=Gt):Bt=Bt.next=Mt,J|=Pt;if(ve=ve.next,ve===null){if(ve=N.shared.pending,ve===null)break;Mt=ve,ve=Mt.next,Mt.next=null,N.lastBaseUpdate=Mt,N.shared.pending=null}}while(!0);Bt===null&&(Ze=Gt),N.baseState=Ze,N.firstBaseUpdate=$t,N.lastBaseUpdate=Bt,D===null&&(N.shared.lanes=0),zh|=J,d.lanes=J,d.memoizedState=Gt}}function wh(d,f){if(typeof d!="function")throw Error(r(191,d));d.call(f)}function YC(d,f){var b=d.callbacks;if(b!==null)for(d.callbacks=null,d=0;d<b.length;d++)wh(b[d],f)}var rp=L(null),m0=L(0);function jh(d,f){d=lm,W(m0,d),W(rp,f),lm=d|f.baseLanes}function sg(){W(m0,lm),W(rp,rp.current)}function _h(){lm=m0.current,q(rp),q(m0)}var nl=L(null),sa=null;function il(d){var f=d.alternate;W(io,io.current&1),W(nl,d),sa===null&&(f===null||rp.current!==null||f.memoizedState!==null)&&(sa=d)}function h0(d){W(io,io.current),W(nl,d),sa===null&&(sa=d)}function f0(d){d.tag===22?(W(io,io.current),W(nl,d),sa===null&&(sa=d)):dd()}function dd(){W(io,io.current),W(nl,nl.current)}function aa(d){q(nl),sa===d&&(sa=null),q(io)}var io=L(0);function ag(d){for(var f=d;f!==null;){if(f.tag===13){var b=f.memoizedState;if(b!==null&&(b=b.dehydrated,b===null||jN(b)||_N(b)))return f}else if(f.tag===19&&(f.memoizedProps.revealOrder==="forwards"||f.memoizedProps.revealOrder==="backwards"||f.memoizedProps.revealOrder==="unstable_legacy-backwards"||f.memoizedProps.revealOrder==="together")){if((f.flags&128)!==0)return f}else if(f.child!==null){f.child.return=f,f=f.child;continue}if(f===d)break;for(;f.sibling===null;){if(f.return===null||f.return===d)return null;f=f.return}f.sibling.return=f.return,f=f.sibling}return null}var ud=0,Xn=null,Xi=null,ro=null,g0=!1,op=!1,Zd=!1,Ch=0,lg=0,Jd=null,XC=0;function Dr(){throw Error(r(321))}function ev(d,f){if(f===null)return!1;for(var b=0;b<f.length&&b<d.length;b++)if(!xr(d[b],f[b]))return!1;return!0}function cg(d,f,b,C,N,D){return ud=D,Xn=f,f.memoizedState=null,f.updateQueue=null,f.lanes=0,U.H=d===null||d.memoizedState===null?lS:yv,Zd=!1,D=b(C,N),Zd=!1,op&&(D=y0(f,b,C,N)),QC(d),D}function QC(d){U.H=bg;var f=Xi!==null&&Xi.next!==null;if(ud=0,ro=Xi=Xn=null,g0=!1,lg=0,Jd=null,f)throw Error(r(300));d===null||ko||(d=d.dependencies,d!==null&&Yu(d)&&(ko=!0))}function y0(d,f,b,C){Xn=d;var N=0;do{if(op&&(Jd=null),lg=0,op=!1,25<=N)throw Error(r(301));if(N+=1,ro=Xi=null,d.updateQueue!=null){var D=d.updateQueue;D.lastEffect=null,D.events=null,D.stores=null,D.memoCache!=null&&(D.memoCache.index=0)}U.H=rl,D=f(b,C)}while(op);return D}function tv(){var d=U.H,f=d.useState()[0];return f=typeof f.then=="function"?im(f):f,d=d.useState()[0],(Xi!==null?Xi.memoizedState:null)!==d&&(Xn.flags|=1024),f}function dg(){var d=Ch!==0;return Ch=0,d}function nv(d,f,b){f.updateQueue=d.updateQueue,f.flags&=-2053,d.lanes&=~b}function ug(d){if(g0){for(d=d.memoizedState;d!==null;){var f=d.queue;f!==null&&(f.pending=null),d=d.next}g0=!1}ud=0,ro=Xi=Xn=null,op=!1,lg=Ch=0,Jd=null}function Es(){var d={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ro===null?Xn.memoizedState=ro=d:ro=ro.next=d,ro}function Xr(){if(Xi===null){var d=Xn.alternate;d=d!==null?d.memoizedState:null}else d=Xi.next;var f=ro===null?Xn.memoizedState:ro.next;if(f!==null)ro=f,Xi=d;else{if(d===null)throw Xn.alternate===null?Error(r(467)):Error(r(310));Xi=d,d={memoizedState:Xi.memoizedState,baseState:Xi.baseState,baseQueue:Xi.baseQueue,queue:Xi.queue,next:null},ro===null?Xn.memoizedState=ro=d:ro=ro.next=d}return ro}function x0(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function im(d){var f=lg;return lg+=1,Jd===null&&(Jd=[]),d=c0(Jd,d,f),f=Xn,(ro===null?f.memoizedState:ro.next)===null&&(f=f.alternate,U.H=f===null||f.memoizedState===null?lS:yv),d}function b0(d){if(d!==null&&typeof d=="object"){if(typeof d.then=="function")return im(d);if(d.$$typeof===k)return Sr(d)}throw Error(r(438,String(d)))}function Sh(d){var f=null,b=Xn.updateQueue;if(b!==null&&(f=b.memoCache),f==null){var C=Xn.alternate;C!==null&&(C=C.updateQueue,C!==null&&(C=C.memoCache,C!=null&&(f={data:C.data.map(function(N){return N.slice()}),index:0})))}if(f==null&&(f={data:[],index:0}),b===null&&(b=x0(),Xn.updateQueue=b),b.memoCache=f,b=f.data[f.index],b===void 0)for(b=f.data[f.index]=Array(d),C=0;C<d;C++)b[C]=T;return f.index++,b}function fc(d,f){return typeof f=="function"?f(d):f}function rm(d){var f=Xr();return iv(f,Xi,d)}
vendor: 17,622 bytes, line 8
8function iv(d,f,b){var C=d.queue;if(C===null)throw Error(r(311));C.lastRenderedReducer=b;var N=d.baseQueue,D=C.pending;if(D!==null){if(N!==null){var J=N.next;N.next=D.next,D.next=J}f.baseQueue=N=D,C.pending=null}if(D=d.baseState,N===null)d.memoizedState=D;else{f=N.next;var ve=J=null,Ze=null,$t=f,Bt=!1;do{var Gt=$t.lane&-536870913;if(Gt!==$t.lane?(Si&Gt)===Gt:(ud&Gt)===Gt){var Pt=$t.revertLane;if(Pt===0)Ze!==null&&(Ze=Ze.next={lane:0,revertLane:0,gesture:null,action:$t.action,hasEagerState:$t.hasEagerState,eagerState:$t.eagerState,next:null}),Gt===em&&(Bt=!0);else if((ud&Pt)===Pt){$t=$t.next,Pt===em&&(Bt=!0);continue}else Gt={lane:0,revertLane:$t.revertLane,gesture:null,action:$t.action,hasEagerState:$t.hasEagerState,eagerState:$t.eagerState,next:null},Ze===null?(ve=Ze=Gt,J=D):Ze=Ze.next=Gt,Xn.lanes|=Pt,zh|=Pt;Gt=$t.action,Zd&&b(D,Gt),D=$t.hasEagerState?$t.eagerState:b(D,Gt)}else Pt={lane:Gt,revertLane:$t.revertLane,gesture:$t.gesture,action:$t.action,hasEagerState:$t.hasEagerState,eagerState:$t.eagerState,next:null},Ze===null?(ve=Ze=Pt,J=D):Ze=Ze.next=Pt,Xn.lanes|=Gt,zh|=Gt;$t=$t.next}while($t!==null&&$t!==f);if(Ze===null?J=D:Ze.next=ve,!xr(D,d.memoizedState)&&(ko=!0,Bt&&(b=ld,b!==null)))throw b;d.memoizedState=D,d.baseState=J,d.baseQueue=Ze,C.lastRenderedState=D}return N===null&&(C.lanes=0),[d.memoizedState,C.dispatch]}function pg(d){var f=Xr(),b=f.queue;if(b===null)throw Error(r(311));b.lastRenderedReducer=d;var C=b.dispatch,N=b.pending,D=f.memoizedState;if(N!==null){b.pending=null;var J=N=N.next;do D=d(D,J.action),J=J.next;while(J!==N);xr(D,f.memoizedState)||(ko=!0),f.memoizedState=D,f.baseQueue===null&&(f.baseState=D),b.lastRenderedState=D}return[D,C]}function rv(d,f,b){var C=Xn,N=Xr(),D=ri;if(D){if(b===void 0)throw Error(r(407));b=b()}else b=f();var J=!xr((Xi||N).memoizedState,b);if(J&&(N.memoizedState=b,ko=!0),N=N.queue,I0(w0.bind(null,C,N,d),[d]),N.getSnapshot!==f||J||ro!==null&&ro.memoizedState.tag&1){if(C.flags|=2048,Ih(9,{destroy:void 0},ZC.bind(null,C,N,b,f),null),Ir===null)throw Error(r(349));D||(ud&127)!==0||v0(C,f,b)}return b}function v0(d,f,b){d.flags|=16384,d={getSnapshot:f,value:b},f=Xn.updateQueue,f===null?(f=x0(),Xn.updateQueue=f,f.stores=[d]):(b=f.stores,b===null?f.stores=[d]:b.push(d))}function ZC(d,f,b,C){f.value=b,f.getSnapshot=C,JC(f)&&kh(d)}function w0(d,f,b){return b(function(){JC(f)&&kh(d)})}function JC(d){var f=d.getSnapshot;d=d.value;try{var b=f();return!xr(d,b)}catch{return!0}}function kh(d){var f=Uu(d,2);f!==null&&Rl(f,d,2)}function mg(d){var f=Es();if(typeof d=="function"){var b=d;if(d=b(),Zd){We(!0);try{b()}finally{We(!1)}}}return f.memoizedState=f.baseState=d,f.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:fc,lastRenderedState:d},f}function hg(d,f,b,C){return d.baseState=b,iv(d,Xi,typeof C=="function"?C:fc)}function VA(d,f,b,C,N){if(M0(d))throw Error(r(485));if(d=f.action,d!==null){var D={payload:N,action:d,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(J){D.listeners.push(J)}};U.T!==null?b(!0):D.isTransition=!1,C(D),b=f.pending,b===null?(D.next=f.pending=D,$h(f,D)):(D.next=b.next,f.pending=b.next=D)}}function $h(d,f){var b=f.action,C=f.payload,N=d.state;if(f.isTransition){var D=U.T,J={};U.T=J;try{var ve=b(N,C),Ze=U.S;Ze!==null&&Ze(J,ve),ov(d,f,ve)}catch($t){sv(d,f,$t)}finally{D!==null&&J.types!==null&&(D.types=J.types),U.T=D}}else try{D=b(N,C),ov(d,f,D)}catch($t){sv(d,f,$t)}}function ov(d,f,b){b!==null&&typeof b=="object"&&typeof b.then=="function"?b.then(function(C){j0(d,f,C)},function(C){return sv(d,f,C)}):j0(d,f,b)}function j0(d,f,b){f.status="fulfilled",f.value=b,_0(f),d.state=b,f=d.pending,f!==null&&(b=f.next,b===f?d.pending=null:(b=b.next,f.next=b,$h(d,b)))}function sv(d,f,b){var C=d.pending;if(d.pending=null,C!==null){C=C.next;do f.status="rejected",f.reason=b,_0(f),f=f.next;while(f!==C)}d.action=null}function _0(d){d=d.listeners;for(var f=0;f<d.length;f++)(0,d[f])()}function eS(d,f){return f}function av(d,f){if(ri){var b=Ir.formState;if(b!==null){e:{var C=Xn;if(ri){if(Ci){t:{for(var N=Ci,D=fs;N.nodeType!==8;){if(!D){N=null;break t}if(N=md(N.nextSibling),N===null){N=null;break t}}D=N.data,N=D==="F!"||D==="F"?N:null}if(N){Ci=md(N.nextSibling),C=N.data==="F!";break e}}Gu(C)}C=!1}C&&(f=b[0])}}return b=Es(),b.memoizedState=b.baseState=f,C={pending:null,lanes:0,dispatch:null,lastRenderedReducer:eS,lastRenderedState:f},b.queue=C,b=yg.bind(null,Xn,C),C.dispatch=b,C=mg(!1),D=xg.bind(null,Xn,!1,C.queue),C=Es(),N={state:f,dispatch:null,action:d,pending:null},C.queue=N,b=VA.bind(null,Xn,N,D,b),N.dispatch=b,C.memoizedState=d,[f,b,!1]}function tS(d){var f=Xr();return lv(f,Xi,d)}function lv(d,f,b){if(f=iv(d,f,eS)[0],d=rm(fc)[0],typeof f=="object"&&f!==null&&typeof f.then=="function")try{var C=im(f)}catch(J){throw J===Ju?xh:J}else C=f;f=Xr();var N=f.queue,D=N.dispatch;return b!==f.memoizedState&&(Xn.flags|=2048,Ih(9,{destroy:void 0},nS.bind(null,N,b),null)),[C,D,d]}function nS(d,f){d.action=f}function C0(d){var f=Xr(),b=Xi;if(b!==null)return lv(f,b,d);Xr(),f=f.memoizedState,b=Xr();var C=b.queue.dispatch;return b.memoizedState=d,[f,C,!1]}function Ih(d,f,b,C){return d={tag:d,create:b,deps:C,inst:f,next:null},f=Xn.updateQueue,f===null&&(f=x0(),Xn.updateQueue=f),b=f.lastEffect,b===null?f.lastEffect=d.next=d:(C=b.next,b.next=d,d.next=C,f.lastEffect=d),d}function S0(){return Xr().memoizedState}function k0(d,f,b,C){var N=Es();Xn.flags|=d,N.memoizedState=Ih(1|f,{destroy:void 0},b,C===void 0?null:C)}function fg(d,f,b,C){var N=Xr();C=C===void 0?null:C;var D=N.memoizedState.inst;Xi!==null&&C!==null&&ev(C,Xi.memoizedState.deps)?N.memoizedState=Ih(f,D,b,C):(Xn.flags|=d,N.memoizedState=Ih(1|f,D,b,C))}function $0(d,f){k0(8390656,8,d,f)}function I0(d,f){fg(2048,8,d,f)}function KA(d){Xn.flags|=4;var f=Xn.updateQueue;if(f===null)f=x0(),Xn.updateQueue=f,f.events=[d];else{var b=f.events;b===null?f.events=[d]:b.push(d)}}function cv(d){var f=Xr().memoizedState;return KA({ref:f,nextImpl:d}),function(){if((Ui&2)!==0)throw Error(r(440));return f.impl.apply(void 0,arguments)}}function dv(d,f){return fg(4,2,d,f)}function P0(d,f){return fg(4,4,d,f)}function iS(d,f){if(typeof f=="function"){d=d();var b=f(d);return function(){typeof b=="function"?b():f(null)}}if(f!=null)return d=d(),f.current=d,function(){f.current=null}}function A0(d,f,b){b=b!=null?b.concat([d]):null,fg(4,4,iS.bind(null,f,d),b)}function uv(){}function pv(d,f){var b=Xr();f=f===void 0?null:f;var C=b.memoizedState;return f!==null&&ev(f,C[1])?C[0]:(b.memoizedState=[d,f],d)}function N0(d,f){var b=Xr();f=f===void 0?null:f;var C=b.memoizedState;if(f!==null&&ev(f,C[1]))return C[0];if(C=d(),Zd){We(!0);try{d()}finally{We(!1)}}return b.memoizedState=[C,f],C}function z0(d,f,b){return b===void 0||(ud&1073741824)!==0&&(Si&261930)===0?d.memoizedState=f:(d.memoizedState=b,d=CD(),Xn.lanes|=d,zh|=d,b)}function rS(d,f,b,C){return xr(b,f)?b:rp.current!==null?(d=z0(d,b,C),xr(d,f)||(ko=!0),d):(ud&42)===0||(ud&1073741824)!==0&&(Si&261930)===0?(ko=!0,d.memoizedState=b):(d=CD(),Xn.lanes|=d,zh|=d,f)}function mv(d,f,b,C,N){var D=X.p;X.p=D!==0&&8>D?D:8;var J=U.T,ve={};U.T=ve,xg(d,!1,f,b);try{var Ze=N(),$t=U.S;if($t!==null&&$t(ve,Ze),Ze!==null&&typeof Ze=="object"&&typeof Ze.then=="function"){var Bt=GA(Ze,C);om(d,f,Bt,wc(d))}else om(d,f,C,wc(d))}catch(Gt){om(d,f,{then:function(){},status:"rejected",reason:Gt},wc())}finally{X.p=D,J!==null&&ve.types!==null&&(J.types=ve.types),U.T=J}}function YA(){}function gg(d,f,b,C){if(d.tag!==5)throw Error(r(476));var N=hv(d).queue;mv(d,N,f,Q,b===null?YA:function(){return T0(d),b(C)})}function hv(d){var f=d.memoizedState;if(f!==null)return f;f={memoizedState:Q,baseState:Q,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:fc,lastRenderedState:Q},next:null};var b={};return f.next={memoizedState:b,baseState:b,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:fc,lastRenderedState:b},next:null},d.memoizedState=f,d=d.alternate,d!==null&&(d.memoizedState=f),f}function T0(d){var f=hv(d);f.next===null&&(f=d.alternate.memoizedState),om(d,f.next.queue,{},wc())}function fv(){return Sr(Zv)}function gv(){return Xr().memoizedState}function oS(){return Xr().memoizedState}function E0(d){for(var f=d.return;f!==null;){switch(f.tag){case 24:case 3:var b=wc();d=ip(b);var C=cd(f,d,b);C!==null&&(Rl(C,f,b),og(C,f,b)),f={cache:Y1()},d.payload=f;return}f=f.return}}function sS(d,f,b){var C=wc();b={lane:C,revertLane:0,gesture:null,action:b,hasEagerState:!1,eagerState:null,next:null},M0(d)?aS(f,b):(b=Qy(d,f,b,C),b!==null&&(Rl(b,d,C),ho(b,f,C)))}function yg(d,f,b){var C=wc();om(d,f,b,C)}function om(d,f,b,C){var N={lane:C,revertLane:0,gesture:null,action:b,hasEagerState:!1,eagerState:null,next:null};if(M0(d))aS(f,N);else{var D=d.alternate;if(d.lanes===0&&(D===null||D.lanes===0)&&(D=f.lastRenderedReducer,D!==null))try{var J=f.lastRenderedState,ve=D(J,b);if(N.hasEagerState=!0,N.eagerState=ve,xr(ve,J))return Kf(d,f,N,0),Ir===null&&Vf(),!1}catch{}finally{}if(b=Qy(d,f,N,C),b!==null)return Rl(b,d,C),ho(b,f,C),!0}return!1}function xg(d,f,b,C){if(C={lane:2,revertLane:dN(),gesture:null,action:C,hasEagerState:!1,eagerState:null,next:null},M0(d)){if(f)throw Error(r(479))}else f=Qy(d,b,C,2),f!==null&&Rl(f,d,2)}function M0(d){var f=d.alternate;return d===Xn||f!==null&&f===Xn}function aS(d,f){op=g0=!0;var b=d.pending;b===null?f.next=f:(f.next=b.next,b.next=f),d.pending=f}function ho(d,f,b){if((b&4194048)!==0){var C=f.lanes;C&=d.pendingLanes,b|=C,f.lanes=b,Ct(d,b)}}var bg={readContext:Sr,use:b0,useCallback:Dr,useContext:Dr,useEffect:Dr,useImperativeHandle:Dr,useLayoutEffect:Dr,useInsertionEffect:Dr,useMemo:Dr,useReducer:Dr,useRef:Dr,useState:Dr,useDebugValue:Dr,useDeferredValue:Dr,useTransition:Dr,useSyncExternalStore:Dr,useId:Dr,useHostTransitionStatus:Dr,useFormState:Dr,useActionState:Dr,useOptimistic:Dr,useMemoCache:Dr,useCacheRefresh:Dr};bg.useEffectEvent=Dr;var lS={readContext:Sr,use:b0,useCallback:function(d,f){return Es().memoizedState=[d,f===void 0?null:f],d},useContext:Sr,useEffect:$0,useImperativeHandle:function(d,f,b){b=b!=null?b.concat([d]):null,k0(4194308,4,iS.bind(null,f,d),b)},useLayoutEffect:function(d,f){return k0(4194308,4,d,f)},useInsertionEffect:function(d,f){k0(4,2,d,f)},useMemo:function(d,f){var b=Es();f=f===void 0?null:f;var C=d();if(Zd){We(!0);try{d()}finally{We(!1)}}return b.memoizedState=[C,f],C},useReducer:function(d,f,b){var C=Es();if(b!==void 0){var N=b(f);if(Zd){We(!0);try{b(f)}finally{We(!1)}}}else N=f;return C.memoizedState=C.baseState=N,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:d,lastRenderedState:N},C.queue=d,d=d.dispatch=sS.bind(null,Xn,d),[C.memoizedState,d]},useRef:function(d){var f=Es();return d={current:d},f.memoizedState=d},useState:function(d){d=mg(d);var f=d.queue,b=yg.bind(null,Xn,f);return f.dispatch=b,[d.memoizedState,b]},useDebugValue:uv,useDeferredValue:function(d,f){var b=Es();return z0(b,d,f)},useTransition:function(){var d=mg(!1);return d=mv.bind(null,Xn,d.queue,!0,!1),Es().memoizedState=d,[!1,d]},useSyncExternalStore:function(d,f,b){var C=Xn,N=Es();if(ri){if(b===void 0)throw Error(r(407));b=b()}else{if(b=f(),Ir===null)throw Error(r(349));(Si&127)!==0||v0(C,f,b)}N.memoizedState=b;var D={value:b,getSnapshot:f};return N.queue=D,$0(w0.bind(null,C,D,d),[d]),C.flags|=2048,Ih(9,{destroy:void 0},ZC.bind(null,C,D,b,f),null),b},useId:function(){var d=Es(),f=Ir.identifierPrefix;if(ri){var b=oa,C=Tl;b=(C&~(1<<32-Qe(C)-1)).toString(32)+b,f="_"+f+"R_"+b,b=Ch++,0<b&&(f+="H"+b.toString(32)),f+="_"}else b=XC++,f="_"+f+"r_"+b.toString(32)+"_";return d.memoizedState=f},useHostTransitionStatus:fv,useFormState:av,useActionState:av,useOptimistic:function(d){var f=Es();f.memoizedState=f.baseState=d;var b={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return f.queue=b,f=xg.bind(null,Xn,!0,b),b.dispatch=f,[d,f]},useMemoCache:Sh,useCacheRefresh:function(){return Es().memoizedState=E0.bind(null,Xn)},useEffectEvent:function(d){var f=Es(),b={impl:d};return f.memoizedState=b,function(){if((Ui&2)!==0)throw Error(r(440));return b.impl.apply(void 0,arguments)}}},yv={readContext:Sr,use:b0,useCallback:pv,useContext:Sr,useEffect:I0,useImperativeHandle:A0,useInsertionEffect:dv,useLayoutEffect:P0,useMemo:N0,useReducer:rm,useRef:S0,useState:function(){return rm(fc)},useDebugValue:uv,useDeferredValue:function(d,f){var b=Xr();return rS(b,Xi.memoizedState,d,f)},useTransition:function(){var d=rm(fc)[0],f=Xr().memoizedState;return[typeof d=="boolean"?d:im(d),f]},useSyncExternalStore:rv,useId:gv,useHostTransitionStatus:fv,useFormState:tS,useActionState:tS,useOptimistic:function(d,f){var b=Xr();return hg(b,Xi,d,f)},useMemoCache:Sh,useCacheRefresh:oS};yv.useEffectEvent=cv;var rl={readContext:Sr,use:b0,useCallback:pv,useContext:Sr,useEffect:I0,useImperativeHandle:A0,useInsertionEffect:dv,useLayoutEffect:P0,useMemo:N0,useReducer:pg,useRef:S0,useState:function(){return pg(fc)},useDebugValue:uv,useDeferredValue:function(d,f){var b=Xr();return Xi===null?z0(b,d,f):rS(b,Xi.memoizedState,d,f)},useTransition:function(){var d=pg(fc)[0],f=Xr().memoizedState;return[typeof d=="boolean"?d:im(d),f]},useSyncExternalStore:rv,useId:gv,useHostTransitionStatus:fv,useFormState:C0,useActionState:C0,useOptimistic:function(d,f){var b=Xr();return Xi!==null?hg(b,Xi,d,f):(b.baseState=d,[d,b.queue.dispatch])},useMemoCache:Sh,useCacheRefresh:oS};rl.useEffectEvent=cv;function xv(d,f,b,C){f=d.memoizedState,b=b(C,f),b=b==null?f:g({},f,b),d.memoizedState=b,d.lanes===0&&(d.updateQueue.baseState=b)}var bv={enqueueSetState:function(d,f,b){d=d._reactInternals;var C=wc(),N=ip(C);N.payload=f,b!=null&&(N.callback=b),f=cd(d,N,C),f!==null&&(Rl(f,d,C),og(f,d,C))},enqueueReplaceState:function(d,f,b){d=d._reactInternals;var C=wc(),N=ip(C);N.tag=1,N.payload=f,b!=null&&(N.callback=b),f=cd(d,N,C),f!==null&&(Rl(f,d,C),og(f,d,C))},enqueueForceUpdate:function(d,f){d=d._reactInternals;var b=wc(),C=ip(b);C.tag=2,f!=null&&(C.callback=f),f=cd(d,C,b),f!==null&&(Rl(f,d,b),og(f,d,b))}};function cS(d,f,b,C,N,D,J){return d=d.stateNode,typeof d.shouldComponentUpdate=="function"?d.shouldComponentUpdate(C,D,J):f.prototype&&f.prototype.isPureReactComponent?!Yr(b,C)||!Yr(N,D):!0}function dS(d,f,b,C){d=f.state,typeof f.componentWillReceiveProps=="function"&&f.componentWillReceiveProps(b,C),typeof f.UNSAFE_componentWillReceiveProps=="function"&&f.UNSAFE_componentWillReceiveProps(b,C),f.state!==d&&bv.enqueueReplaceState(f,f.state,null)}function sm(d,f){var b=f;if("ref"in f){b={};for(var C in f)C!=="ref"&&(b[C]=f[C])}if(d=d.defaultProps){b===f&&(b=g({},b));for(var N in d)b[N]===void 0&&(b[N]=d[N])}return b}function uS(d){Gf(d)}function pS(d){console.error(d)}function mS(d){Gf(d)}function R0(d,f){try{var b=d.onUncaughtError;b(f.value,{componentStack:f.stack})}catch(C){setTimeout(function(){throw C})}}function hS(d,f,b){try{var C=d.onCaughtError;C(b.value,{componentStack:b.stack,errorBoundary:f.tag===1?f.stateNode:null})}catch(N){setTimeout(function(){throw N})}}function vv(d,f,b){return b=ip(b),b.tag=3,b.payload={element:null},b.callback=function(){R0(d,f)},b}function fS(d){return d=ip(d),d.tag=3,d}function gS(d,f,b,C){var N=b.type.getDerivedStateFromError;if(typeof N=="function"){var D=C.value;d.payload=function(){return N(D)},d.callback=function(){hS(f,b,C)}}var J=b.stateNode;J!==null&&typeof J.componentDidCatch=="function"&&(d.callback=function(){hS(f,b,C),typeof N!="function"&&(Th===null?Th=new Set([this]):Th.add(this));var ve=C.stack;this.componentDidCatch(C.value,{componentStack:ve!==null?ve:""})})}function XA(d,f,b,C,N){if(b.flags|=32768,C!==null&&typeof C=="object"&&typeof C.then=="function"){if(f=b.alternate,f!==null&&Qp(f,b,N,!0),b=nl.current,b!==null){switch(b.tag){case 31:case 13:return sa===null?FS():b.alternate===null&&Io===0&&(Io=3),b.flags&=-257,b.flags|=65536,b.lanes=N,C===a0?b.flags|=16384:(f=b.updateQueue,f===null?b.updateQueue=new Set([C]):f.add(C),aN(d,C,N)),!1;case 22:return b.flags|=65536,C===a0?b.flags|=16384:(f=b.updateQueue,f===null?(f={transitions:null,markerInstances:null,retryQueue:new Set([C])},b.updateQueue=f):(b=f.retryQueue,b===null?f.retryQueue=new Set([C]):b.add(C)),aN(d,C,N)),!1}throw Error(r(435,b.tag))}return aN(d,C,N),FS(),!1}if(ri)return f=nl.current,f!==null?((f.flags&65536)===0&&(f.flags|=256),f.flags|=65536,f.lanes=N,C!==K1&&(d=Error(r(422),{cause:C}),gh(Nl(d,b)))):(C!==K1&&(f=Error(r(423),{cause:C}),gh(Nl(f,b))),d=d.current.alternate,d.flags|=65536,N&=-N,d.lanes|=N,C=Nl(C,b),N=vv(d.stateNode,C,N),p0(d,N),Io!==4&&(Io=2)),!1;var D=Error(r(520),{cause:C});if(D=Nl(D,b),Hv===null?Hv=[D]:Hv.push(D),Io!==4&&(Io=2),f===null)return!0;C=Nl(C,b),b=f;do{switch(b.tag){case 3:return b.flags|=65536,d=N&-N,b.lanes|=d,d=vv(b.stateNode,C,d),p0(b,d),!1;case 1:if(f=b.type,D=b.stateNode,(b.flags&128)===0&&(typeof f.getDerivedStateFromError=="function"||D!==null&&typeof D.componentDidCatch=="function"&&(Th===null||!Th.has(D))))return b.flags|=65536,N&=-N,b.lanes|=N,N=fS(N),gS(N,d,b,C),p0(b,N),!1}b=b.return}while(b!==null);return!1}var wv=Error(r(461)),ko=!1;function gs(d,f,b,C){f.child=d===null?d0(f,null,b,C):mc(f,d.child,b,C)}function yS(d,f,b,C,N){b=b.render;var D=f.ref;if("ref"in C){var J={};for(var ve in C)ve!=="ref"&&(J[ve]=C[ve])}else J=C;return Zp(f),C=cg(d,f,b,J,D,N),ve=dg(),d!==null&&!ko?(nv(d,f,N),eu(d,f,N)):(ri&&ve&&Zf(f),f.flags|=1,gs(d,f,C,N),f.child)}function xS(d,f,b,C,N){if(d===null){var D=b.type;return typeof D=="function"&&!Zy(D)&&D.defaultProps===void 0&&b.compare===null?(f.tag=15,f.type=D,bS(d,f,D,C,N)):(d=Xf(b.type,null,C,f,f.mode,N),d.ref=f.ref,d.return=f,f.child=d)}if(D=d.child,!Nv(d,N)){var J=D.memoizedProps;
vendor: 9,509 bytes, line 8
8if(b=b.compare,b=b!==null?b:Yr,b(J,C)&&d.ref===f.ref)return eu(d,f,N)}return f.flags|=1,d=od(D,C),d.ref=f.ref,d.return=f,f.child=d}function bS(d,f,b,C,N){if(d!==null){var D=d.memoizedProps;if(Yr(D,C)&&d.ref===f.ref)if(ko=!1,f.pendingProps=C=D,Nv(d,N))(d.flags&131072)!==0&&(ko=!0);else return f.lanes=d.lanes,eu(d,f,N)}return jv(d,f,b,C,N)}function vS(d,f,b,C){var N=C.children,D=d!==null?d.memoizedState:null;if(d===null&&f.stateNode===null&&(f.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),C.mode==="hidden"){if((f.flags&128)!==0){if(D=D!==null?D.baseLanes|b:b,d!==null){for(C=f.child=d.child,N=0;C!==null;)N=N|C.lanes|C.childLanes,C=C.sibling;C=N&~D}else C=0,f.child=null;return wS(d,f,D,b,C)}if((b&536870912)!==0)f.memoizedState={baseLanes:0,cachePool:null},d!==null&&tg(f,D!==null?D.cachePool:null),D!==null?jh(f,D):sg(),f0(f);else return C=f.lanes=536870912,wS(d,f,D!==null?D.baseLanes|b:b,b,C)}else D!==null?(tg(f,D.cachePool),jh(f,D),dd(),f.memoizedState=null):(d!==null&&tg(f,null),sg(),dd());return gs(d,f,N,b),f.child}function Ph(d,f){return d!==null&&d.tag===22||f.stateNode!==null||(f.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),f.sibling}function wS(d,f,b,C,N){var D=s0();return D=D===null?null:{parent:kr._currentValue,pool:D},f.memoizedState={baseLanes:b,cachePool:D},d!==null&&tg(f,null),sg(),f0(f),d!==null&&Qp(d,f,C,!0),f.childLanes=N,null}function O0(d,f){return f=L0({mode:f.mode,children:f.children},d.mode),f.ref=d.ref,d.child=f,f.return=d,f}function jS(d,f,b){return mc(f,d.child,null,b),d=O0(f,f.pendingProps),d.flags|=2,aa(f),f.memoizedState=null,d}function QA(d,f,b){var C=f.pendingProps,N=(f.flags&128)!==0;if(f.flags&=-129,d===null){if(ri){if(C.mode==="hidden")return d=O0(f,C),f.lanes=536870912,Ph(null,d);if(h0(f),(d=Ci)?(d=sL(d,fs),d=d!==null&&d.data==="&"?d:null,d!==null&&(f.memoizedState={dehydrated:d,treeContext:tl!==null?{id:Tl,overflow:oa}:null,retryLane:536870912,hydrationErrors:null},b=G1(d),b.return=f,f.child=b,no=f,Ci=null)):d=null,d===null)throw Gu(f);return f.lanes=536870912,null}return O0(f,C)}var D=d.memoizedState;if(D!==null){var J=D.dehydrated;if(h0(f),N)if(f.flags&256)f.flags&=-257,f=jS(d,f,b);else if(f.memoizedState!==null)f.child=d.child,f.flags|=128,f=null;else throw Error(r(558));else if(ko||Qp(d,f,b,!1),N=(b&d.childLanes)!==0,ko||N){if(C=Ir,C!==null&&(J=Ie(C,b),J!==0&&J!==D.retryLane))throw D.retryLane=J,Uu(d,J),Rl(C,d,J),wv;FS(),f=jS(d,f,b)}else d=D.treeContext,Ci=md(J.nextSibling),no=f,ri=!0,El=null,fs=!1,d!==null&&e0(f,d),f=O0(f,C),f.flags|=4096;return f}return d=od(d.child,{mode:C.mode,children:C.children}),d.ref=f.ref,f.child=d,d.return=f,d}function D0(d,f){var b=f.ref;if(b===null)d!==null&&d.ref!==null&&(f.flags|=4194816);else{if(typeof b!="function"&&typeof b!="object")throw Error(r(284));(d===null||d.ref!==b)&&(f.flags|=4194816)}}function jv(d,f,b,C,N){return Zp(f),b=cg(d,f,b,C,void 0,N),C=dg(),d!==null&&!ko?(nv(d,f,N),eu(d,f,N)):(ri&&C&&Zf(f),f.flags|=1,gs(d,f,b,N),f.child)}function _v(d,f,b,C,N,D){return Zp(f),f.updateQueue=null,b=y0(f,C,b,N),QC(d),C=dg(),d!==null&&!ko?(nv(d,f,D),eu(d,f,D)):(ri&&C&&Zf(f),f.flags|=1,gs(d,f,b,D),f.child)}function _S(d,f,b,C,N){if(Zp(f),f.stateNode===null){var D=Yp,J=b.contextType;typeof J=="object"&&J!==null&&(D=Sr(J)),D=new b(C,D),f.memoizedState=D.state!==null&&D.state!==void 0?D.state:null,D.updater=bv,f.stateNode=D,D._reactInternals=f,D=f.stateNode,D.props=C,D.state=f.memoizedState,D.refs={},u0(f),J=b.contextType,D.context=typeof J=="object"&&J!==null?Sr(J):Yp,D.state=f.memoizedState,J=b.getDerivedStateFromProps,typeof J=="function"&&(xv(f,b,J,C),D.state=f.memoizedState),typeof b.getDerivedStateFromProps=="function"||typeof D.getSnapshotBeforeUpdate=="function"||typeof D.UNSAFE_componentWillMount!="function"&&typeof D.componentWillMount!="function"||(J=D.state,typeof D.componentWillMount=="function"&&D.componentWillMount(),typeof D.UNSAFE_componentWillMount=="function"&&D.UNSAFE_componentWillMount(),J!==D.state&&bv.enqueueReplaceState(D,D.state,null),vh(f,C,D,N),bh(),D.state=f.memoizedState),typeof D.componentDidMount=="function"&&(f.flags|=4194308),C=!0}else if(d===null){D=f.stateNode;var ve=f.memoizedProps,Ze=sm(b,ve);D.props=Ze;var $t=D.context,Bt=b.contextType;J=Yp,typeof Bt=="object"&&Bt!==null&&(J=Sr(Bt));var Gt=b.getDerivedStateFromProps;Bt=typeof Gt=="function"||typeof D.getSnapshotBeforeUpdate=="function",ve=f.pendingProps!==ve,Bt||typeof D.UNSAFE_componentWillReceiveProps!="function"&&typeof D.componentWillReceiveProps!="function"||(ve||$t!==J)&&dS(f,D,C,J),hc=!1;var Pt=f.memoizedState;D.state=Pt,vh(f,C,D,N),bh(),$t=f.memoizedState,ve||Pt!==$t||hc?(typeof Gt=="function"&&(xv(f,b,Gt,C),$t=f.memoizedState),(Ze=hc||cS(f,b,Ze,C,Pt,$t,J))?(Bt||typeof D.UNSAFE_componentWillMount!="function"&&typeof D.componentWillMount!="function"||(typeof D.componentWillMount=="function"&&D.componentWillMount(),typeof D.UNSAFE_componentWillMount=="function"&&D.UNSAFE_componentWillMount()),typeof D.componentDidMount=="function"&&(f.flags|=4194308)):(typeof D.componentDidMount=="function"&&(f.flags|=4194308),f.memoizedProps=C,f.memoizedState=$t),D.props=C,D.state=$t,D.context=J,C=Ze):(typeof D.componentDidMount=="function"&&(f.flags|=4194308),C=!1)}else{D=f.stateNode,rg(d,f),J=f.memoizedProps,Bt=sm(b,J),D.props=Bt,Gt=f.pendingProps,Pt=D.context,$t=b.contextType,Ze=Yp,typeof $t=="object"&&$t!==null&&(Ze=Sr($t)),ve=b.getDerivedStateFromProps,($t=typeof ve=="function"||typeof D.getSnapshotBeforeUpdate=="function")||typeof D.UNSAFE_componentWillReceiveProps!="function"&&typeof D.componentWillReceiveProps!="function"||(J!==Gt||Pt!==Ze)&&dS(f,D,C,Ze),hc=!1,Pt=f.memoizedState,D.state=Pt,vh(f,C,D,N),bh();var Mt=f.memoizedState;J!==Gt||Pt!==Mt||hc||d!==null&&d.dependencies!==null&&Yu(d.dependencies)?(typeof ve=="function"&&(xv(f,b,ve,C),Mt=f.memoizedState),(Bt=hc||cS(f,b,Bt,C,Pt,Mt,Ze)||d!==null&&d.dependencies!==null&&Yu(d.dependencies))?($t||typeof D.UNSAFE_componentWillUpdate!="function"&&typeof D.componentWillUpdate!="function"||(typeof D.componentWillUpdate=="function"&&D.componentWillUpdate(C,Mt,Ze),typeof D.UNSAFE_componentWillUpdate=="function"&&D.UNSAFE_componentWillUpdate(C,Mt,Ze)),typeof D.componentDidUpdate=="function"&&(f.flags|=4),typeof D.getSnapshotBeforeUpdate=="function"&&(f.flags|=1024)):(typeof D.componentDidUpdate!="function"||J===d.memoizedProps&&Pt===d.memoizedState||(f.flags|=4),typeof D.getSnapshotBeforeUpdate!="function"||J===d.memoizedProps&&Pt===d.memoizedState||(f.flags|=1024),f.memoizedProps=C,f.memoizedState=Mt),D.props=C,D.state=Mt,D.context=Ze,C=Bt):(typeof D.componentDidUpdate!="function"||J===d.memoizedProps&&Pt===d.memoizedState||(f.flags|=4),typeof D.getSnapshotBeforeUpdate!="function"||J===d.memoizedProps&&Pt===d.memoizedState||(f.flags|=1024),C=!1)}return D=C,D0(d,f),C=(f.flags&128)!==0,D||C?(D=f.stateNode,b=C&&typeof b.getDerivedStateFromError!="function"?null:D.render(),f.flags|=1,d!==null&&C?(f.child=mc(f,d.child,null,N),f.child=mc(f,null,b,N)):gs(d,f,b,N),f.memoizedState=D.state,d=f.child):d=eu(d,f,N),d}function CS(d,f,b,C){return Vu(),f.flags|=256,gs(d,f,b,C),f.child}var Cv={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Sv(d){return{baseLanes:d,cachePool:X1()}}function kv(d,f,b){return d=d!==null?d.childLanes&~b:0,f&&(d|=vc),d}function $v(d,f,b){var C=f.pendingProps,N=!1,D=(f.flags&128)!==0,J;if((J=D)||(J=d!==null&&d.memoizedState===null?!1:(io.current&2)!==0),J&&(N=!0,f.flags&=-129),J=(f.flags&32)!==0,f.flags&=-33,d===null){if(ri){if(N?il(f):dd(),(d=Ci)?(d=sL(d,fs),d=d!==null&&d.data!=="&"?d:null,d!==null&&(f.memoizedState={dehydrated:d,treeContext:tl!==null?{id:Tl,overflow:oa}:null,retryLane:536870912,hydrationErrors:null},b=G1(d),b.return=f,f.child=b,no=f,Ci=null)):d=null,d===null)throw Gu(f);return _N(d)?f.lanes=32:f.lanes=536870912,null}var ve=C.children;return C=C.fallback,N?(dd(),N=f.mode,ve=L0({mode:"hidden",children:ve},N),C=Hu(C,N,b,null),ve.return=f,C.return=f,ve.sibling=C,f.child=ve,C=f.child,C.memoizedState=Sv(b),C.childLanes=kv(d,J,b),f.memoizedState=Cv,Ph(null,C)):(il(f),Iv(f,ve))}var Ze=d.memoizedState;if(Ze!==null&&(ve=Ze.dehydrated,ve!==null)){if(D)f.flags&256?(il(f),f.flags&=-257,f=Pv(d,f,b)):f.memoizedState!==null?(dd(),f.child=d.child,f.flags|=128,f=null):(dd(),ve=C.fallback,N=f.mode,C=L0({mode:"visible",children:C.children},N),ve=Hu(ve,N,b,null),ve.flags|=2,C.return=f,ve.return=f,C.sibling=ve,f.child=C,mc(f,d.child,null,b),C=f.child,C.memoizedState=Sv(b),C.childLanes=kv(d,J,b),f.memoizedState=Cv,f=Ph(null,C));else if(il(f),_N(ve)){if(J=ve.nextSibling&&ve.nextSibling.dataset,J)var $t=J.dgst;J=$t,C=Error(r(419)),C.stack="",C.digest=J,gh({value:C,source:null,stack:null}),f=Pv(d,f,b)}else if(ko||Qp(d,f,b,!1),J=(b&d.childLanes)!==0,ko||J){if(J=Ir,J!==null&&(C=Ie(J,b),C!==0&&C!==Ze.retryLane))throw Ze.retryLane=C,Uu(d,C),Rl(J,d,C),wv;jN(ve)||FS(),f=Pv(d,f,b)}else jN(ve)?(f.flags|=192,f.child=d.child,f=null):(d=Ze.treeContext,Ci=md(ve.nextSibling),no=f,ri=!0,El=null,fs=!1,d!==null&&e0(f,d),f=Iv(f,C.children),f.flags|=4096);return f}return N?(dd(),ve=C.fallback,N=f.mode,Ze=d.child,$t=Ze.sibling,C=od(Ze,{mode:"hidden",children:C.children}),C.subtreeFlags=Ze.subtreeFlags&65011712,$t!==null?ve=od($t,ve):(ve=Hu(ve,N,b,null),ve.flags|=2),ve.return=f,C.return=f,C.sibling=ve,f.child=C,Ph(null,C),C=f.child,ve=d.child.memoizedState,ve===null?ve=Sv(b):(N=ve.cachePool,N!==null?(Ze=kr._currentValue,N=N.parent!==Ze?{parent:Ze,pool:Ze}
vendor: 7,045 bytes, line 8
8:N):N=X1(),ve={baseLanes:ve.baseLanes|b,cachePool:N}),C.memoizedState=ve,C.childLanes=kv(d,J,b),f.memoizedState=Cv,Ph(d.child,C)):(il(f),b=d.child,d=b.sibling,b=od(b,{mode:"visible",children:C.children}),b.return=f,b.sibling=null,d!==null&&(J=f.deletions,J===null?(f.deletions=[d],f.flags|=16):J.push(d)),f.child=b,f.memoizedState=null,b)}function Iv(d,f){return f=L0({mode:"visible",children:f},d.mode),f.return=d,d.child=f}function L0(d,f){return d=Na(22,d,null,f),d.lanes=0,d}function Pv(d,f,b){return mc(f,d.child,null,b),d=Iv(f,f.pendingProps.children),d.flags|=2,f.memoizedState=null,d}function SS(d,f,b){d.lanes|=f;var C=d.alternate;C!==null&&(C.lanes|=f),i0(d.return,f,b)}function Av(d,f,b,C,N,D){var J=d.memoizedState;J===null?d.memoizedState={isBackwards:f,rendering:null,renderingStartTime:0,last:C,tail:b,tailMode:N,treeForkCount:D}:(J.isBackwards=f,J.rendering=null,J.renderingStartTime=0,J.last=C,J.tail=b,J.tailMode=N,J.treeForkCount=D)}function kS(d,f,b){var C=f.pendingProps,N=C.revealOrder,D=C.tail;C=C.children;var J=io.current,ve=(J&2)!==0;if(ve?(J=J&1|2,f.flags|=128):J&=1,W(io,J),gs(d,f,C,b),C=ri?ra:0,!ve&&d!==null&&(d.flags&128)!==0)e:for(d=f.child;d!==null;){if(d.tag===13)d.memoizedState!==null&&SS(d,b,f);else if(d.tag===19)SS(d,b,f);else if(d.child!==null){d.child.return=d,d=d.child;continue}if(d===f)break e;for(;d.sibling===null;){if(d.return===null||d.return===f)break e;d=d.return}d.sibling.return=d.return,d=d.sibling}switch(N){case"forwards":for(b=f.child,N=null;b!==null;)d=b.alternate,d!==null&&ag(d)===null&&(N=b),b=b.sibling;b=N,b===null?(N=f.child,f.child=null):(N=b.sibling,b.sibling=null),Av(f,!1,N,b,D,C);break;case"backwards":case"unstable_legacy-backwards":for(b=null,N=f.child,f.child=null;N!==null;){if(d=N.alternate,d!==null&&ag(d)===null){f.child=N;break}d=N.sibling,N.sibling=b,b=N,N=d}Av(f,!0,b,null,D,C);break;case"together":Av(f,!1,null,null,void 0,C);break;default:f.memoizedState=null}return f.child}function eu(d,f,b){if(d!==null&&(f.dependencies=d.dependencies),zh|=f.lanes,(b&f.childLanes)===0)if(d!==null){if(Qp(d,f,b,!1),(b&f.childLanes)===0)return null}else return null;if(d!==null&&f.child!==d.child)throw Error(r(153));if(f.child!==null){for(d=f.child,b=od(d,d.pendingProps),f.child=b,b.return=f;d.sibling!==null;)d=d.sibling,b=b.sibling=od(d,d.pendingProps),b.return=f;b.sibling=null}return f.child}function Nv(d,f){return(d.lanes&f)!==0?!0:(d=d.dependencies,!!(d!==null&&Yu(d)))}function zv(d,f,b){switch(f.tag){case 3:me(f,f.stateNode.containerInfo),Xd(f,kr,d.memoizedState.cache),Vu();break;case 27:case 5:ne(f);break;case 4:me(f,f.stateNode.containerInfo);break;case 10:Xd(f,f.type,f.memoizedProps.value);break;case 31:if(f.memoizedState!==null)return f.flags|=128,h0(f),null;break;case 13:var C=f.memoizedState;if(C!==null)return C.dehydrated!==null?(il(f),f.flags|=128,null):(b&f.child.childLanes)!==0?$v(d,f,b):(il(f),d=eu(d,f,b),d!==null?d.sibling:null);il(f);break;case 19:var N=(d.flags&128)!==0;if(C=(b&f.childLanes)!==0,C||(Qp(d,f,b,!1),C=(b&f.childLanes)!==0),N){if(C)return kS(d,f,b);f.flags|=128}if(N=f.memoizedState,N!==null&&(N.rendering=null,N.tail=null,N.lastEffect=null),W(io,io.current),C)break;return null;case 22:return f.lanes=0,vS(d,f,b,f.pendingProps);case 24:Xd(f,kr,d.memoizedState.cache)}return eu(d,f,b)}function Tv(d,f,b){if(d!==null)if(d.memoizedProps!==f.pendingProps)ko=!0;else{if(!Nv(d,b)&&(f.flags&128)===0)return ko=!1,zv(d,f,b);ko=(d.flags&131072)!==0}else ko=!1,ri&&(f.flags&1048576)!==0&&Xp(f,ra,f.index);switch(f.lanes=0,f.tag){case 16:e:{var C=f.pendingProps;if(d=ep(f.elementType),f.type=d,typeof d=="function")Zy(d)?(C=sm(d,C),f.tag=1,f=_S(null,f,d,C,b)):(f.tag=0,f=jv(null,f,d,C,b));else{if(d!=null){var N=d.$$typeof;if(N===P){f.tag=11,f=yS(null,f,d,C,b);break e}else if(N===A){f.tag=14,f=xS(null,f,d,C,b);break e}}throw f=Y(d)||d,Error(r(306,f,""))}}return f;case 0:return jv(d,f,f.type,f.pendingProps,b);case 1:return C=f.type,N=sm(C,f.pendingProps),_S(d,f,C,N,b);case 3:e:{if(me(f,f.stateNode.containerInfo),d===null)throw Error(r(387));C=f.pendingProps;var D=f.memoizedState;N=D.element,rg(d,f),vh(f,C,null,b);var J=f.memoizedState;if(C=J.cache,Xd(f,kr,C),C!==D.cache&&r0(f,[kr],b,!0),bh(),C=J.element,D.isDehydrated)if(D={element:C,isDehydrated:!1,cache:J.cache},f.updateQueue.baseState=D,f.memoizedState=D,f.flags&256){f=CS(d,f,C,b);break e}else if(C!==N){N=Nl(Error(r(424)),f),gh(N),f=CS(d,f,C,b);break e}else{switch(d=f.stateNode.containerInfo,d.nodeType){case 9:d=d.body;break;default:d=d.nodeName==="HTML"?d.ownerDocument.body:d}for(Ci=md(d.firstChild),no=f,ri=!0,El=null,fs=!0,b=d0(f,null,C,b),f.child=b;b;)b.flags=b.flags&-3|4096,b=b.sibling}else{if(Vu(),C===N){f=eu(d,f,b);break e}gs(d,f,C,b)}f=f.child}return f;case 26:return D0(d,f),d===null?(b=pL(f.type,null,f.pendingProps,null))?f.memoizedState=b:ri||(b=f.type,d=f.pendingProps,C=KS(de.current).createElement(b),C[Ve]=f,C[pt]=d,la(C,b,d),pn(C),f.stateNode=C):f.memoizedState=pL(f.type,d.memoizedProps,f.pendingProps,d.memoizedState),null;case 27:return ne(f),d===null&&ri&&(C=f.stateNode=cL(f.type,f.pendingProps,de.current),no=f,fs=!0,N=Ci,Oh(f.type)?(CN=N,Ci=md(C.firstChild)):Ci=N),gs(d,f,f.pendingProps.children,b),D0(d,f),d===null&&(f.flags|=4194304),f.child;case 5:return d===null&&ri&&((N=C=Ci)&&(C=Gpe(C,f.type,f.pendingProps,fs),C!==null?(f.stateNode=C,no=f,Ci=md(C.firstChild),fs=!1,N=!0):N=!1),N||Gu(f)),ne(f),N=f.type,D=f.pendingProps,J=d!==null?d.memoizedProps:null,C=D.children,bN(N,D)?C=null:J!==null&&bN(N,J)&&(f.flags|=32),f.memoizedState!==null&&(N=cg(d,f,tv,null,null,b),Zv._currentValue=N),D0(d,f),gs(d,f,C,b),f.child;case 6:return d===null&&ri&&((d=b=Ci)&&(b=Vpe(b,f.pendingProps,fs),b!==null?(f.stateNode=b,no=f,Ci=null,d=!0):d=!1),d||Gu(f)),null;case 13:return $v(d,f,b);case 4:return me(f,f.stateNode.containerInfo),C=f.pendingProps,d===null?f.child=mc(f,null,C,b):gs(d,f,C,b),f.child;case 11:return yS(d,f,f.type,f.pendingProps,b);case 7:return gs(d,f,f.pendingProps,b),f.child;case 8:return gs(d,f,f.pendingProps.children,b),f.child;case 12:return gs(d,f,f.pendingProps.children,b),f.child;case 10:return C=f.pendingProps,Xd(f,f.type,C.value),gs(d,f,C.children,b),f.child;case 9:return N=f.type._context,C=f.pendingProps.children,Zp(f),N=Sr(N),C=C(N),f.flags|=1,gs(d,f,C,b),f.child;case 14:return xS(d,f,f.type,f.pendingProps,b);case 15:return bS(d,f,f.type,f.pendingProps,b);case 19:return kS(d,f,b);case 31:return QA(d,f,b);case 22:return vS(d,f,b,f.pendingProps);case 24:return Zp(f),C=Sr(kr),d===null?(N=s0(),N===null&&(N=Ir,D=Y1(),N.pooledCache=D,D.refCount++,D!==null&&(N.pooledCacheLanes|=b),N=D),f.memoizedState={parent:C,cache:N},u0(f),Xd(f,kr,N)):((d.lanes&b)!==0&&(rg(d,f),vh(f,null,null,b),bh()),N=d.memoizedState,D=f.memoizedState,N.parent!==C?(N={parent:C,cache:C},f.memoizedState=N,f.lanes===0&&(f.memoizedState=f.updateQueue.baseState=N),Xd(f,kr,C)):(C=D.cache,Xd(f,kr,C),C!==N.cache&&r0(f,[kr],b,!0))),gs(d,f,f.pendingProps.children,b),f.child;case 29:throw f.pendingProps}throw Error(r(156,f.tag))}function tu(d){d.flags|=4}
vendor: 7,285 bytes, line 8
8function Ev(d,f,b,C,N){if((f=(d.mode&32)!==0)&&(f=!1),f){if(d.flags|=16777216,(N&335544128)===N)if(d.stateNode.complete)d.flags|=8192;else if(ID())d.flags|=8192;else throw Qd=a0,Q1}else d.flags&=-16777217}function B0(d,f){if(f.type!=="stylesheet"||(f.state.loading&4)!==0)d.flags&=-16777217;else if(d.flags|=16777216,!yL(f))if(ID())d.flags|=8192;else throw Qd=a0,Q1}function F0(d,f){f!==null&&(d.flags|=4),d.flags&16384&&(f=d.tag!==22?Zt():536870912,d.lanes|=f,V0|=f)}function vg(d,f){if(!ri)switch(d.tailMode){case"hidden":f=d.tail;for(var b=null;f!==null;)f.alternate!==null&&(b=f),f=f.sibling;b===null?d.tail=null:b.sibling=null;break;case"collapsed":b=d.tail;for(var C=null;b!==null;)b.alternate!==null&&(C=b),b=b.sibling;C===null?f||d.tail===null?d.tail=null:d.tail.sibling=null:C.sibling=null}}function $r(d){var f=d.alternate!==null&&d.alternate.child===d.child,b=0,C=0;if(f)for(var N=d.child;N!==null;)b|=N.lanes|N.childLanes,C|=N.subtreeFlags&65011712,C|=N.flags&65011712,N.return=d,N=N.sibling;else for(N=d.child;N!==null;)b|=N.lanes|N.childLanes,C|=N.subtreeFlags,C|=N.flags,N.return=d,N=N.sibling;return d.subtreeFlags|=C,d.childLanes=b,f}function ZA(d,f,b){var C=f.pendingProps;switch(qu(f),f.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return $r(f),null;case 1:return $r(f),null;case 3:return b=f.stateNode,C=null,d!==null&&(C=d.memoizedState.cache),f.memoizedState.cache!==C&&(f.flags|=2048),ad(kr),ee(),b.pendingContext&&(b.context=b.pendingContext,b.pendingContext=null),(d===null||d.child===null)&&(Yd(f)?tu(f):d===null||d.memoizedState.isDehydrated&&(f.flags&256)===0||(f.flags|=1024,t0())),$r(f),null;case 26:var N=f.type,D=f.memoizedState;return d===null?(tu(f),D!==null?($r(f),B0(f,D)):($r(f),Ev(f,N,null,C,b))):D?D!==d.memoizedState?(tu(f),$r(f),B0(f,D)):($r(f),f.flags&=-16777217):(d=d.memoizedProps,d!==C&&tu(f),$r(f),Ev(f,N,d,C,b)),null;case 27:if(Ae(f),b=de.current,N=f.type,d!==null&&f.stateNode!=null)d.memoizedProps!==C&&tu(f);else{if(!C){if(f.stateNode===null)throw Error(r(166));return $r(f),null}d=oe.current,Yd(f)?Jf(f):(d=cL(N,C,b),f.stateNode=d,tu(f))}return $r(f),null;case 5:if(Ae(f),N=f.type,d!==null&&f.stateNode!=null)d.memoizedProps!==C&&tu(f);else{if(!C){if(f.stateNode===null)throw Error(r(166));return $r(f),null}if(D=oe.current,Yd(f))Jf(f);else{var J=KS(de.current);switch(D){case 1:D=J.createElementNS("http://www.w3.org/2000/svg",N);break;case 2:D=J.createElementNS("http://www.w3.org/1998/Math/MathML",N);break;default:switch(N){case"svg":D=J.createElementNS("http://www.w3.org/2000/svg",N);break;case"math":D=J.createElementNS("http://www.w3.org/1998/Math/MathML",N);break;case"script":D=J.createElement("div"),D.innerHTML="<script><\/script>",D=D.removeChild(D.firstChild);break;case"select":D=typeof C.is=="string"?J.createElement("select",{is:C.is}):J.createElement("select"),C.multiple?D.multiple=!0:C.size&&(D.size=C.size);break;default:D=typeof C.is=="string"?J.createElement(N,{is:C.is}):J.createElement(N)}}D[Ve]=f,D[pt]=C;e:for(J=f.child;J!==null;){if(J.tag===5||J.tag===6)D.appendChild(J.stateNode);else if(J.tag!==4&&J.tag!==27&&J.child!==null){J.child.return=J,J=J.child;continue}if(J===f)break e;for(;J.sibling===null;){if(J.return===null||J.return===f)break e;J=J.return}J.sibling.return=J.return,J=J.sibling}f.stateNode=D;e:switch(la(D,N,C),N){case"button":case"input":case"select":case"textarea":C=!!C.autoFocus;break e;case"img":C=!0;break e;default:C=!1}C&&tu(f)}}return $r(f),Ev(f,f.type,d===null?null:d.memoizedProps,f.pendingProps,b),null;case 6:if(d&&f.stateNode!=null)d.memoizedProps!==C&&tu(f);else{if(typeof C!="string"&&f.stateNode===null)throw Error(r(166));if(d=de.current,Yd(f)){if(d=f.stateNode,b=f.memoizedProps,C=null,N=no,N!==null)switch(N.tag){case 27:case 5:C=N.memoizedProps}d[Ve]=f,d=!!(d.nodeValue===b||C!==null&&C.suppressHydrationWarning===!0||ZD(d.nodeValue,b)),d||Gu(f,!0)}else d=KS(d).createTextNode(C),d[Ve]=f,f.stateNode=d}return $r(f),null;case 31:if(b=f.memoizedState,d===null||d.memoizedState!==null){if(C=Yd(f),b!==null){if(d===null){if(!C)throw Error(r(318));if(d=f.memoizedState,d=d!==null?d.dehydrated:null,!d)throw Error(r(557));d[Ve]=f}else Vu(),(f.flags&128)===0&&(f.memoizedState=null),f.flags|=4;$r(f),d=!1}else b=t0(),d!==null&&d.memoizedState!==null&&(d.memoizedState.hydrationErrors=b),d=!0;if(!d)return f.flags&256?(aa(f),f):(aa(f),null);if((f.flags&128)!==0)throw Error(r(558))}return $r(f),null;case 13:if(C=f.memoizedState,d===null||d.memoizedState!==null&&d.memoizedState.dehydrated!==null){if(N=Yd(f),C!==null&&C.dehydrated!==null){if(d===null){if(!N)throw Error(r(318));if(N=f.memoizedState,N=N!==null?N.dehydrated:null,!N)throw Error(r(317));N[Ve]=f}else Vu(),(f.flags&128)===0&&(f.memoizedState=null),f.flags|=4;$r(f),N=!1}else N=t0(),d!==null&&d.memoizedState!==null&&(d.memoizedState.hydrationErrors=N),N=!0;if(!N)return f.flags&256?(aa(f),f):(aa(f),null)}return aa(f),(f.flags&128)!==0?(f.lanes=b,f):(b=C!==null,d=d!==null&&d.memoizedState!==null,b&&(C=f.child,N=null,C.alternate!==null&&C.alternate.memoizedState!==null&&C.alternate.memoizedState.cachePool!==null&&(N=C.alternate.memoizedState.cachePool.pool),D=null,C.memoizedState!==null&&C.memoizedState.cachePool!==null&&(D=C.memoizedState.cachePool.pool),D!==N&&(C.flags|=2048)),b!==d&&b&&(f.child.flags|=8192),F0(f,f.updateQueue),$r(f),null);case 4:return ee(),d===null&&hN(f.stateNode.containerInfo),$r(f),null;case 10:return ad(f.type),$r(f),null;case 19:if(q(io),C=f.memoizedState,C===null)return $r(f),null;if(N=(f.flags&128)!==0,D=C.rendering,D===null)if(N)vg(C,!1);else{if(Io!==0||d!==null&&(d.flags&128)!==0)for(d=f.child;d!==null;){if(D=ag(d),D!==null){for(f.flags|=128,vg(C,!1),d=D.updateQueue,f.updateQueue=d,F0(f,d),f.subtreeFlags=0,d=b,b=f.child;b!==null;)q1(b,d),b=b.sibling;return W(io,io.current&1|2),ri&&uc(f,C.treeForkCount),f.child}d=d.sibling}C.tail!==null&&it()>DS&&(f.flags|=128,N=!0,vg(C,!1),f.lanes=4194304)}else{if(!N)if(d=ag(D),d!==null){if(f.flags|=128,N=!0,d=d.updateQueue,f.updateQueue=d,F0(f,d),vg(C,!0),C.tail===null&&C.tailMode==="hidden"&&!D.alternate&&!ri)return $r(f),null}else 2*it()-C.renderingStartTime>DS&&b!==536870912&&(f.flags|=128,N=!0,vg(C,!1),f.lanes=4194304);C.isBackwards?(D.sibling=f.child,f.child=D):(d=C.last,d!==null?d.sibling=D:f.child=D,C.last=D)}return C.tail!==null?(d=C.tail,C.rendering=d,C.tail=d.sibling,C.renderingStartTime=it(),d.sibling=null,b=io.current,W(io,N?b&1|2:b&1),ri&&uc(f,C.treeForkCount),d):($r(f),null);case 22:case 23:return aa(f),_h(),C=f.memoizedState!==null,d!==null?d.memoizedState!==null!==C&&(f.flags|=8192):C&&(f.flags|=8192),C?(b&536870912)!==0&&(f.flags&128)===0&&($r(f),f.subtreeFlags&6&&(f.flags|=8192)):$r(f),b=f.updateQueue,b!==null&&F0(f,b.retryQueue),b=null,d!==null&&d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(b=d.memoizedState.cachePool.pool),C=null,f.memoizedState!==null&&f.memoizedState.cachePool!==null&&(C=f.memoizedState.cachePool.pool),C!==b&&(f.flags|=2048),d!==null&&q(pc),null;case 24:return b=null,d!==null&&(b=d.memoizedState.cache),f.memoizedState.cache!==b&&(f.flags|=2048),ad(kr),$r(f),null;case 25:return null;case 30:return null}throw Error(r(156,f.tag))}function Mv(d,f){switch(qu(f),f.tag){case 1:return d=f.flags,d&65536?(f.flags=d&-65537|128,f):null;
vendor: 22,063 bytes, line 8
8case 3:return ad(kr),ee(),d=f.flags,(d&65536)!==0&&(d&128)===0?(f.flags=d&-65537|128,f):null;case 26:case 27:case 5:return Ae(f),null;case 31:if(f.memoizedState!==null){if(aa(f),f.alternate===null)throw Error(r(340));Vu()}return d=f.flags,d&65536?(f.flags=d&-65537|128,f):null;case 13:if(aa(f),d=f.memoizedState,d!==null&&d.dehydrated!==null){if(f.alternate===null)throw Error(r(340));Vu()}return d=f.flags,d&65536?(f.flags=d&-65537|128,f):null;case 19:return q(io),null;case 4:return ee(),null;case 10:return ad(f.type),null;case 22:case 23:return aa(f),_h(),d!==null&&q(pc),d=f.flags,d&65536?(f.flags=d&-65537|128,f):null;case 24:return ad(kr),null;case 25:return null;default:return null}}function $S(d,f){switch(qu(f),f.tag){case 3:ad(kr),ee();break;case 26:case 27:case 5:Ae(f);break;case 4:ee();break;case 31:f.memoizedState!==null&&aa(f);break;case 13:aa(f);break;case 19:q(io);break;case 10:ad(f.type);break;case 22:case 23:aa(f),_h(),d!==null&&q(pc);break;case 24:ad(kr)}}function wg(d,f){try{var b=f.updateQueue,C=b!==null?b.lastEffect:null;if(C!==null){var N=C.next;b=N;do{if((b.tag&d)===d){C=void 0;var D=b.create,J=b.inst;C=D(),J.destroy=C}b=b.next}while(b!==N)}}catch(ve){cr(f,f.return,ve)}}function sp(d,f,b){try{var C=f.updateQueue,N=C!==null?C.lastEffect:null;if(N!==null){var D=N.next;C=D;do{if((C.tag&d)===d){var J=C.inst,ve=J.destroy;if(ve!==void 0){J.destroy=void 0,N=f;var Ze=b,$t=ve;try{$t()}catch(Bt){cr(N,Ze,Bt)}}}C=C.next}while(C!==D)}}catch(Bt){cr(f,f.return,Bt)}}function IS(d){var f=d.updateQueue;if(f!==null){var b=d.stateNode;try{YC(f,b)}catch(C){cr(d,d.return,C)}}}function W0(d,f,b){b.props=sm(d.type,d.memoizedProps),b.state=d.memoizedState;try{b.componentWillUnmount()}catch(C){cr(d,f,C)}}function jg(d,f){try{var b=d.ref;if(b!==null){switch(d.tag){case 26:case 27:case 5:var C=d.stateNode;break;case 30:C=d.stateNode;break;default:C=d.stateNode}typeof b=="function"?d.refCleanup=b(C):b.current=C}}catch(N){cr(d,f,N)}}function pd(d,f){var b=d.ref,C=d.refCleanup;if(b!==null)if(typeof C=="function")try{C()}catch(N){cr(d,f,N)}finally{d.refCleanup=null,d=d.alternate,d!=null&&(d.refCleanup=null)}else if(typeof b=="function")try{b(null)}catch(N){cr(d,f,N)}else b.current=null}function U0(d){var f=d.type,b=d.memoizedProps,C=d.stateNode;try{e:switch(f){case"button":case"input":case"select":case"textarea":b.autoFocus&&C.focus();break e;case"img":b.src?C.src=b.src:b.srcSet&&(C.srcset=b.srcSet)}}catch(N){cr(d,d.return,N)}}function Rv(d,f,b){try{var C=d.stateNode;Bpe(C,d.type,b,f),C[pt]=f}catch(N){cr(d,d.return,N)}}function PS(d){return d.tag===5||d.tag===3||d.tag===26||d.tag===27&&Oh(d.type)||d.tag===4}function Ov(d){e:for(;;){for(;d.sibling===null;){if(d.return===null||PS(d.return))return null;d=d.return}for(d.sibling.return=d.return,d=d.sibling;d.tag!==5&&d.tag!==6&&d.tag!==18;){if(d.tag===27&&Oh(d.type)||d.flags&2||d.child===null||d.tag===4)continue e;d.child.return=d,d=d.child}if(!(d.flags&2))return d.stateNode}}function _g(d,f,b){var C=d.tag;if(C===5||C===6)d=d.stateNode,f?(b.nodeType===9?b.body:b.nodeName==="HTML"?b.ownerDocument.body:b).insertBefore(d,f):(f=b.nodeType===9?b.body:b.nodeName==="HTML"?b.ownerDocument.body:b,f.appendChild(d),b=b._reactRootContainer,b!=null||f.onclick!==null||(f.onclick=Vr));else if(C!==4&&(C===27&&Oh(d.type)&&(b=d.stateNode,f=null),d=d.child,d!==null))for(_g(d,f,b),d=d.sibling;d!==null;)_g(d,f,b),d=d.sibling}function H0(d,f,b){var C=d.tag;if(C===5||C===6)d=d.stateNode,f?b.insertBefore(d,f):b.appendChild(d);else if(C!==4&&(C===27&&Oh(d.type)&&(b=d.stateNode),d=d.child,d!==null))for(H0(d,f,b),d=d.sibling;d!==null;)H0(d,f,b),d=d.sibling}function AS(d){var f=d.stateNode,b=d.memoizedProps;try{for(var C=d.type,N=f.attributes;N.length;)f.removeAttributeNode(N[0]);la(f,C,b),f[Ve]=d,f[pt]=b}catch(D){cr(d,d.return,D)}}var gc=!1,$o=!1,Dv=!1,NS=typeof WeakSet=="function"?WeakSet:Set,Qo=null;function Lv(d,f){if(d=d.containerInfo,yN=tk,d=Fu(d),Ky(d)){if("selectionStart"in d)var b={start:d.selectionStart,end:d.selectionEnd};else e:{b=(b=d.ownerDocument)&&b.defaultView||window;var C=b.getSelection&&b.getSelection();if(C&&C.rangeCount!==0){b=C.anchorNode;var N=C.anchorOffset,D=C.focusNode;C=C.focusOffset;try{b.nodeType,D.nodeType}catch{b=null;break e}var J=0,ve=-1,Ze=-1,$t=0,Bt=0,Gt=d,Pt=null;t:for(;;){for(var Mt;Gt!==b||N!==0&&Gt.nodeType!==3||(ve=J+N),Gt!==D||C!==0&&Gt.nodeType!==3||(Ze=J+C),Gt.nodeType===3&&(J+=Gt.nodeValue.length),(Mt=Gt.firstChild)!==null;)Pt=Gt,Gt=Mt;for(;;){if(Gt===d)break t;if(Pt===b&&++$t===N&&(ve=J),Pt===D&&++Bt===C&&(Ze=J),(Mt=Gt.nextSibling)!==null)break;Gt=Pt,Pt=Gt.parentNode}Gt=Mt}b=ve===-1||Ze===-1?null:{start:ve,end:Ze}}else b=null}b=b||{start:0,end:0}}else b=null;for(xN={focusedElem:d,selectionRange:b},tk=!1,Qo=f;Qo!==null;)if(f=Qo,d=f.child,(f.subtreeFlags&1028)!==0&&d!==null)d.return=f,Qo=d;else for(;Qo!==null;){switch(f=Qo,D=f.alternate,d=f.flags,f.tag){case 0:if((d&4)!==0&&(d=f.updateQueue,d=d!==null?d.events:null,d!==null))for(b=0;b<d.length;b++)N=d[b],N.ref.impl=N.nextImpl;break;case 11:case 15:break;case 1:if((d&1024)!==0&&D!==null){d=void 0,b=f,N=D.memoizedProps,D=D.memoizedState,C=b.stateNode;try{var _n=sm(b.type,N);d=C.getSnapshotBeforeUpdate(_n,D),C.__reactInternalSnapshotBeforeUpdate=d}catch(Un){cr(b,b.return,Un)}}break;case 3:if((d&1024)!==0){if(d=f.stateNode.containerInfo,b=d.nodeType,b===9)wN(d);else if(b===1)switch(d.nodeName){case"HEAD":case"HTML":case"BODY":wN(d);break;default:d.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((d&1024)!==0)throw Error(r(163))}if(d=f.sibling,d!==null){d.return=f.return,Qo=d;break}Qo=f.return}}function zS(d,f,b){var C=b.flags;switch(b.tag){case 0:case 11:case 15:Rn(d,b),C&4&&wg(5,b);break;case 1:if(Rn(d,b),C&4)if(d=b.stateNode,f===null)try{d.componentDidMount()}catch(J){cr(b,b.return,J)}else{var N=sm(b.type,f.memoizedProps);f=f.memoizedState;try{d.componentDidUpdate(N,f,d.__reactInternalSnapshotBeforeUpdate)}catch(J){cr(b,b.return,J)}}C&64&&IS(b),C&512&&jg(b,b.return);break;case 3:if(Rn(d,b),C&64&&(d=b.updateQueue,d!==null)){if(f=null,b.child!==null)switch(b.child.tag){case 27:case 5:f=b.child.stateNode;break;case 1:f=b.child.stateNode}try{YC(d,f)}catch(J){cr(b,b.return,J)}}break;case 27:f===null&&C&4&&AS(b);case 26:case 5:Rn(d,b),f===null&&C&4&&U0(b),C&512&&jg(b,b.return);break;case 12:Rn(d,b);break;case 31:Rn(d,b),C&4&&MS(d,b);break;case 13:Rn(d,b),C&4&&re(d,b),C&64&&(d=b.memoizedState,d!==null&&(d=d.dehydrated,d!==null&&(b=Ipe.bind(null,b),Kpe(d,b))));break;case 22:if(C=b.memoizedState!==null||gc,!C){f=f!==null&&f.memoizedState!==null||$o,N=gc;var D=$o;gc=C,($o=f)&&!D?nu(d,b,(b.subtreeFlags&8772)!==0):Rn(d,b),gc=N,$o=D}break;case 30:break;default:Rn(d,b)}}function TS(d){var f=d.alternate;f!==null&&(d.alternate=null,TS(f)),d.child=null,d.deletions=null,d.sibling=null,d.tag===5&&(f=d.stateNode,f!==null&&rn(f)),d.stateNode=null,d.return=null,d.dependencies=null,d.memoizedProps=null,d.memoizedState=null,d.pendingProps=null,d.stateNode=null,d.updateQueue=null}var br=null,Ea=!1;function yc(d,f,b){for(b=b.child;b!==null;)ES(d,f,b),b=b.sibling}function ES(d,f,b){if(Ue&&typeof Ue.onCommitFiberUnmount=="function")try{Ue.onCommitFiberUnmount(Le,b)}catch{}switch(b.tag){case 26:$o||pd(b,f),yc(d,f,b),b.memoizedState?b.memoizedState.count--:b.stateNode&&(b=b.stateNode,b.parentNode.removeChild(b));break;case 27:$o||pd(b,f);var C=br,N=Ea;Oh(b.type)&&(br=b.stateNode,Ea=!1),yc(d,f,b),Yv(b.stateNode),br=C,Ea=N;break;case 5:$o||pd(b,f);case 6:if(C=br,N=Ea,br=null,yc(d,f,b),br=C,Ea=N,br!==null)if(Ea)try{(br.nodeType===9?br.body:br.nodeName==="HTML"?br.ownerDocument.body:br).removeChild(b.stateNode)}catch(D){cr(b,f,D)}else try{br.removeChild(b.stateNode)}catch(D){cr(b,f,D)}break;case 18:br!==null&&(Ea?(d=br,rL(d.nodeType===9?d.body:d.nodeName==="HTML"?d.ownerDocument.body:d,b.stateNode),tx(d)):rL(br,b.stateNode));break;case 4:C=br,N=Ea,br=b.stateNode.containerInfo,Ea=!0,yc(d,f,b),br=C,Ea=N;break;case 0:case 11:case 14:case 15:sp(2,b,f),$o||sp(4,b,f),yc(d,f,b);break;case 1:$o||(pd(b,f),C=b.stateNode,typeof C.componentWillUnmount=="function"&&W0(b,f,C)),yc(d,f,b);break;case 21:yc(d,f,b);break;case 22:$o=(C=$o)||b.memoizedState!==null,yc(d,f,b),$o=C;break;default:yc(d,f,b)}}function MS(d,f){if(f.memoizedState===null&&(d=f.alternate,d!==null&&(d=d.memoizedState,d!==null))){d=d.dehydrated;try{tx(d)}catch(b){cr(f,f.return,b)}}}function re(d,f){if(f.memoizedState===null&&(d=f.alternate,d!==null&&(d=d.memoizedState,d!==null&&(d=d.dehydrated,d!==null))))try{tx(d)}catch(b){cr(f,f.return,b)}}function fe(d){switch(d.tag){case 31:case 13:case 19:var f=d.stateNode;return f===null&&(f=d.stateNode=new NS),f;case 22:return d=d.stateNode,f=d._retryCache,f===null&&(f=d._retryCache=new NS),f;default:throw Error(r(435,d.tag))}}function ye(d,f){var b=fe(d);f.forEach(function(C){if(!b.has(C)){b.add(C);var N=Ppe.bind(null,d,C);C.then(N,N)}})}function Ce(d,f){var b=f.deletions;if(b!==null)for(var C=0;C<b.length;C++){var N=b[C],D=d,J=f,ve=J;e:for(;ve!==null;){switch(ve.tag){case 27:if(Oh(ve.type)){br=ve.stateNode,Ea=!1;break e}break;case 5:br=ve.stateNode,Ea=!1;break e;case 3:case 4:br=ve.stateNode.containerInfo,Ea=!0;break e}ve=ve.return}if(br===null)throw Error(r(160));ES(D,J,N),br=null,Ea=!1,D=N.alternate,D!==null&&(D.return=null),N.return=null}if(f.subtreeFlags&13886)for(f=f.child;f!==null;)mt(f,d),f=f.sibling}var et=null;function mt(d,f){var b=d.alternate,C=d.flags;switch(d.tag){case 0:case 11:case 14:case 15:Ce(f,d),Te(d),C&4&&(sp(3,d,d.return),wg(3,d),sp(5,d,d.return));break;case 1:Ce(f,d),Te(d),C&512&&($o||b===null||pd(b,b.return)),C&64&&gc&&(d=d.updateQueue,d!==null&&(C=d.callbacks,C!==null&&(b=d.shared.hiddenCallbacks,d.shared.hiddenCallbacks=b===null?C:b.concat(C))));break;case 26:var N=et;if(Ce(f,d),Te(d),C&512&&($o||b===null||pd(b,b.return)),C&4){var D=b!==null?b.memoizedState:null;if(C=d.memoizedState,b===null)if(C===null)if(d.stateNode===null){e:{C=d.type,b=d.memoizedProps,N=N.ownerDocument||N;t:switch(C){case"title":D=N.getElementsByTagName("title")[0],(!D||D[dn]||D[Ve]||D.namespaceURI==="http://www.w3.org/2000/svg"||D.hasAttribute("itemprop"))&&(D=N.createElement(C),N.head.insertBefore(D,N.querySelector("head > title"))),la(D,C,b),D[Ve]=d,pn(D),C=D;break e;case"link":var J=fL("link","href",N).get(C+(b.href||""));if(J){for(var ve=0;ve<J.length;ve++)if(D=J[ve],D.getAttribute("href")===(b.href==null||b.href===""?null:b.href)&&D.getAttribute("rel")===(b.rel==null?null:b.rel)&&D.getAttribute("title")===(b.title==null?null:b.title)&&D.getAttribute("crossorigin")===(b.crossOrigin==null?null:b.crossOrigin)){J.splice(ve,1);break t}}D=N.createElement(C),la(D,C,b),N.head.appendChild(D);break;case"meta":if(J=fL("meta","content",N).get(C+(b.content||""))){for(ve=0;ve<J.length;ve++)if(D=J[ve],D.getAttribute("content")===(b.content==null?null:""+b.content)&&D.getAttribute("name")===(b.name==null?null:b.name)&&D.getAttribute("property")===(b.property==null?null:b.property)&&D.getAttribute("http-equiv")===(b.httpEquiv==null?null:b.httpEquiv)&&D.getAttribute("charset")===(b.charSet==null?null:b.charSet)){J.splice(ve,1);break t}}D=N.createElement(C),la(D,C,b),N.head.appendChild(D);break;default:throw Error(r(468,C))}D[Ve]=d,pn(D),C=D}d.stateNode=C}else gL(N,d.type,d.stateNode);else d.stateNode=hL(N,C,d.memoizedProps);else D!==C?(D===null?b.stateNode!==null&&(b=b.stateNode,b.parentNode.removeChild(b)):D.count--,C===null?gL(N,d.type,d.stateNode):hL(N,C,d.memoizedProps)):C===null&&d.stateNode!==null&&Rv(d,d.memoizedProps,b.memoizedProps)}break;case 27:Ce(f,d),Te(d),C&512&&($o||b===null||pd(b,b.return)),b!==null&&C&4&&Rv(d,d.memoizedProps,b.memoizedProps);break;case 5:if(Ce(f,d),Te(d),C&512&&($o||b===null||pd(b,b.return)),d.flags&32){N=d.stateNode;try{Js(N,"")}catch(_n){cr(d,d.return,_n)}}C&4&&d.stateNode!=null&&(N=d.memoizedProps,Rv(d,N,b!==null?b.memoizedProps:N)),C&1024&&(Dv=!0);break;case 6:if(Ce(f,d),Te(d),C&4){if(d.stateNode===null)throw Error(r(162));C=d.memoizedProps,b=d.stateNode;try{b.nodeValue=C}catch(_n){cr(d,d.return,_n)}}break;case 3:if(QS=null,N=et,et=YS(f.containerInfo),Ce(f,d),et=N,Te(d),C&4&&b!==null&&b.memoizedState.isDehydrated)try{tx(f.containerInfo)}catch(_n){cr(d,d.return,_n)}Dv&&(Dv=!1,Tt(d));break;case 4:C=et,et=YS(d.stateNode.containerInfo),Ce(f,d),Te(d),et=C;break;case 12:Ce(f,d),Te(d);break;case 31:Ce(f,d),Te(d),C&4&&(C=d.updateQueue,C!==null&&(d.updateQueue=null,ye(d,C)));break;case 13:Ce(f,d),Te(d),d.child.flags&8192&&d.memoizedState!==null!=(b!==null&&b.memoizedState!==null)&&(OS=it()),C&4&&(C=d.updateQueue,C!==null&&(d.updateQueue=null,ye(d,C)));break;case 22:N=d.memoizedState!==null;var Ze=b!==null&&b.memoizedState!==null,$t=gc,Bt=$o;if(gc=$t||N,$o=Bt||Ze,Ce(f,d),$o=Bt,gc=$t,Te(d),C&8192)e:for(f=d.stateNode,f._visibility=N?f._visibility&-2:f._visibility|1,N&&(b===null||Ze||gc||$o||Ma(d)),b=null,f=d;;){if(f.tag===5||f.tag===26){if(b===null){Ze=b=f;try{if(D=Ze.stateNode,N)J=D.style,typeof J.setProperty=="function"?J.setProperty("display","none","important"):J.display="none";else{ve=Ze.stateNode;var Gt=Ze.memoizedProps.style,Pt=Gt!=null&&Gt.hasOwnProperty("display")?Gt.display:null;ve.style.display=Pt==null||typeof Pt=="boolean"?"":(""+Pt).trim()}}catch(_n){cr(Ze,Ze.return,_n)}}}else if(f.tag===6){if(b===null){Ze=f;try{Ze.stateNode.nodeValue=N?"":Ze.memoizedProps}catch(_n){cr(Ze,Ze.return,_n)}}}else if(f.tag===18){if(b===null){Ze=f;try{var Mt=Ze.stateNode;N?oL(Mt,!0):oL(Ze.stateNode,!1)}catch(_n){cr(Ze,Ze.return,_n)}}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===d)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===d)break e;for(;f.sibling===null;){if(f.return===null||f.return===d)break e;b===f&&(b=null),f=f.return}b===f&&(b=null),f.sibling.return=f.return,f=f.sibling}C&4&&(C=d.updateQueue,C!==null&&(b=C.retryQueue,b!==null&&(C.retryQueue=null,ye(d,b))));break;case 19:Ce(f,d),Te(d),C&4&&(C=d.updateQueue,C!==null&&(d.updateQueue=null,ye(d,C)));break;case 30:break;case 21:break;default:Ce(f,d),Te(d)}}function Te(d){var f=d.flags;if(f&2){try{for(var b,C=d.return;C!==null;){if(PS(C)){b=C;break}C=C.return}if(b==null)throw Error(r(160));switch(b.tag){case 27:var N=b.stateNode,D=Ov(d);H0(d,D,N);break;case 5:var J=b.stateNode;b.flags&32&&(Js(J,""),b.flags&=-33);var ve=Ov(d);H0(d,ve,J);break;case 3:case 4:var Ze=b.stateNode.containerInfo,$t=Ov(d);_g(d,$t,Ze);break;default:throw Error(r(161))}}catch(Bt){cr(d,d.return,Bt)}d.flags&=-3}f&4096&&(d.flags&=-4097)}function Tt(d){if(d.subtreeFlags&1024)for(d=d.child;d!==null;){var f=d;Tt(f),f.tag===5&&f.flags&1024&&f.stateNode.reset(),d=d.sibling}}function Rn(d,f){if(f.subtreeFlags&8772)for(f=f.child;f!==null;)zS(d,f.alternate,f),f=f.sibling}function Ma(d){for(d=d.child;d!==null;){var f=d;switch(f.tag){case 0:case 11:case 14:case 15:sp(4,f,f.return),Ma(f);break;case 1:pd(f,f.return);var b=f.stateNode;typeof b.componentWillUnmount=="function"&&W0(f,f.return,b),Ma(f);break;case 27:Yv(f.stateNode);case 26:case 5:pd(f,f.return),Ma(f);break;case 22:f.memoizedState===null&&Ma(f);break;case 30:Ma(f);break;default:Ma(f)}d=d.sibling}}function nu(d,f,b){for(b=b&&(f.subtreeFlags&8772)!==0,f=f.child;f!==null;){var C=f.alternate,N=d,D=f,J=D.flags;switch(D.tag){case 0:case 11:case 15:nu(N,D,b),wg(4,D);break;case 1:if(nu(N,D,b),C=D,N=C.stateNode,typeof N.componentDidMount=="function")try{N.componentDidMount()}catch($t){cr(C,C.return,$t)}if(C=D,N=C.updateQueue,N!==null){var ve=C.stateNode;try{var Ze=N.shared.hiddenCallbacks;if(Ze!==null)for(N.shared.hiddenCallbacks=null,N=0;N<Ze.length;N++)wh(Ze[N],ve)}catch($t){cr(C,C.return,$t)}}b&&J&64&&IS(D),jg(D,D.return);break;case 27:AS(D);case 26:case 5:nu(N,D,b),b&&C===null&&J&4&&U0(D),jg(D,D.return);break;case 12:nu(N,D,b);break;case 31:nu(N,D,b),b&&J&4&&MS(N,D);break;case 13:nu(N,D,b),b&&J&4&&re(N,D);break;case 22:D.memoizedState===null&&nu(N,D,b),jg(D,D.return);break;case 30:break;default:nu(N,D,b)}f=f.sibling}}function Cg(d,f){var b=null;d!==null&&d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(b=d.memoizedState.cachePool.pool),d=null,f.memoizedState!==null&&f.memoizedState.cachePool!==null&&(d=f.memoizedState.cachePool.pool),d!==b&&(d!=null&&d.refCount++,b!=null&&Qu(b))}function Bv(d,f){d=null,f.alternate!==null&&(d=f.alternate.memoizedState.cache),f=f.memoizedState.cache,f!==d&&(f.refCount++,d!=null&&Qu(d))}function xc(d,f,b,C){if(f.subtreeFlags&10256)for(f=f.child;f!==null;)Fv(d,f,b,C),f=f.sibling}function Fv(d,f,b,C){var N=f.flags;switch(f.tag){case 0:case 11:case 15:xc(d,f,b,C),N&2048&&wg(9,f);break;case 1:xc(d,f,b,C);break;case 3:xc(d,f,b,C),N&2048&&(d=null,f.alternate!==null&&(d=f.alternate.memoizedState.cache),f=f.memoizedState.cache,f!==d&&(f.refCount++,d!=null&&Qu(d)));break;case 12:if(N&2048){xc(d,f,b,C),d=f.stateNode;try{var D=f.memoizedProps,J=D.id,ve=D.onPostCommit;typeof ve=="function"&&ve(J,f.alternate===null?"mount":"update",d.passiveEffectDuration,-0)}catch(Ze){cr(f,f.return,Ze)}}else xc(d,f,b,C);break;case 31:xc(d,f,b,C);break;case 13:xc(d,f,b,C);break;case 23:break;case 22:D=f.stateNode,J=f.alternate,f.memoizedState!==null?D._visibility&2?xc(d,f,b,C):Ah(d,f):D._visibility&2?xc(d,f,b,C):(D._visibility|=2,am(d,f,b,C,(f.subtreeFlags&10256)!==0||!1)),N&2048&&Cg(J,f);break;case 24:xc(d,f,b,C),N&2048&&Bv(f.alternate,f);break;default:xc(d,f,b,C)}}function am(d,f,b,C,N){for(N=N&&((f.subtreeFlags&10256)!==0||!1),f=f.child;f!==null;){var D=d,J=f,ve=b,Ze=C,$t=J.flags;switch(J.tag){case 0:case 11:case 15:am(D,J,ve,Ze,N),wg(8,J);break;case 23:break;case 22:var Bt=J.stateNode;J.memoizedState!==null?Bt._visibility&2?am(D,J,ve,Ze,N):Ah(D,J):(Bt._visibility|=2,am(D,J,ve,Ze,N)),N&&$t&2048&&Cg(J.alternate,J);break;case 24:am(D,J,ve,Ze,N),N&&$t&2048&&Bv(J.alternate,J);break;default:am(D,J,ve,Ze,N)}f=f.sibling}}function Ah(d,f){if(f.subtreeFlags&10256)for(f=f.child;f!==null;){var b=d,C=f,N=C.flags;switch(C.tag){case 22:Ah(b,C),N&2048&&Cg(C.alternate,C);break;case 24:Ah(b,C),N&2048&&Bv(C.alternate,C);break;default:Ah(b,C)}f=f.sibling}}var Wv=8192;function q0(d,f,b){if(d.subtreeFlags&Wv)for(d=d.child;d!==null;)xD(d,f,b),d=d.sibling}function xD(d,f,b){switch(d.tag){case 26:q0(d,f,b),d.flags&Wv&&d.memoizedState!==null&&sme(b,et,d.memoizedState,d.memoizedProps);break;case 5:q0(d,f,b);break;case 3:case 4:var C=et;et=YS(d.stateNode.containerInfo),q0(d,f,b),et=C;break;case 22:d.memoizedState===null&&(C=d.alternate,C!==null&&C.memoizedState!==null?(C=Wv,Wv=16777216,q0(d,f,b),Wv=C):q0(d,f,b));break;default:q0(d,f,b)}}function bD(d){var f=d.alternate;if(f!==null&&(d=f.child,d!==null)){f.child=null;do f=d.sibling,d.sibling=null,d=f;while(d!==null)}}function Uv(d){var f=d.deletions;if((d.flags&16)!==0){if(f!==null)for(var b=0;b<f.length;b++){var C=f[b];Qo=C,wD(C,d)}bD(d)}if(d.subtreeFlags&10256)for(d=d.child;d!==null;)vD(d),d=d.sibling}function vD(d){switch(d.tag){case 0:case 11:case 15:Uv(d),d.flags&2048&&sp(9,d,d.return);break;case 3:Uv(d);break;case 12:Uv(d);break;case 22:var f=d.stateNode;d.memoizedState!==null&&f._visibility&2&&(d.return===null||d.return.tag!==13)?(f._visibility&=-3,RS(d)):Uv(d);break;default:Uv(d)}}function RS(d){var f=d.deletions;if((d.flags&16)!==0){if(f!==null)for(var b=0;b<f.length;b++){var C=f[b];Qo=C,wD(C,d)}bD(d)}for(d=d.child;d!==null;){switch(f=d,f.tag){case 0:case 11:case 15:sp(8,f,f.return),RS(f);break;case 22:b=f.stateNode,b._visibility&2&&(b._visibility&=-3,RS(f));break;default:RS(f)}d=d.sibling}}function wD(d,f){for(;Qo!==null;){var b=Qo;switch(b.tag){case 0:case 11:case 15:sp(8,b,f);break;case 23:case 22:if(b.memoizedState!==null&&b.memoizedState.cachePool!==null){var C=b.memoizedState.cachePool.pool;C!=null&&C.refCount++}break;case 24:Qu(b.memoizedState.cache)}if(C=b.child,C!==null)C.return=b,Qo=C;else e:for(b=d;Qo!==null;){C=Qo;var N=C.sibling,D=C.return;if(TS(C),C===b){Qo=null;break e}if(N!==null){N.return=D,Qo=N;break e}Qo=D}}}var wpe={getCacheForType:function(d){var f=Sr(kr),b=f.data.get(d);return b===void 0&&(b=d(),f.data.set(d,b)),b},cacheSignal:function(){return Sr(kr).controller.signal}},jpe=typeof WeakMap=="function"?WeakMap:Map,Ui=0,Ir=null,bi=null,Si=0,lr=0,bc=null,Nh=!1,G0=!1,JA=!1,lm=0,Io=0,zh=0,Sg=0,eN=0,vc=0,V0=0,Hv=null,Ml=null,tN=!1,OS=0,jD=0,DS=1/0,LS=null,Th=null,ys=0,Eh=null,K0=null,cm=0,nN=0,iN=null,_D=null,qv=0,rN=null;function wc(){return(Ui&2)!==0&&Si!==0?Si&-Si:U.T!==null?dN():Ge()}function CD(){if(vc===0)if((Si&536870912)===0||ri){var d=ze;ze<<=1,(ze&3932160)===0&&(ze=262144),vc=d}else vc=536870912;return d=nl.current,d!==null&&(d.flags|=32),vc}function Rl(d,f,b){(d===Ir&&(lr===2||lr===9)||d.cancelPendingCommit!==null)&&(Y0(d,0),Mh(d,Si,vc,!1)),nn(d,b),((Ui&2)===0||d!==Ir)&&(d===Ir&&((Ui&2)===0&&(Sg|=b),Io===4&&Mh(d,Si,vc,!1)),ap(d))}function SD(d,f,b){if((Ui&6)!==0)throw Error(r(327));var C=!b&&(f&127)===0&&(f&d.expiredLanes)===0||Qt(d,f),N=C?Spe(d,f):sN(d,f,!0),D=C;do{if(N===0){G0&&!C&&Mh(d,f,0,!1);break}else{if(b=d.current.alternate,D&&!_pe(b)){N=sN(d,f,!1),D=!1;continue}if(N===2){if(D=f,d.errorRecoveryDisabledLanes&D)var J=0;else J=d.pendingLanes&-536870913,J=J!==0?J:J&536870912?536870912:0;if(J!==0){f=J;e:{var ve=d;N=Hv;var Ze=ve.current.memoizedState.isDehydrated;if(Ze&&(Y0(ve,J).flags|=256),J=sN(ve,J,!1),J!==2){if(JA&&!Ze){ve.errorRecoveryDisabledLanes|=D,Sg|=D,N=4;break e}D=Ml,Ml=N,D!==null&&(Ml===null?Ml=D:Ml.push.apply(Ml,D))}N=J}if(D=!1,N!==2)continue}}if(N===1){Y0(d,0),Mh(d,f,0,!0);break}e:{switch(C=d,D=N,D){case 0:case 1:throw Error(r(345));case 4:if((f&4194048)!==f)break;case 6:Mh(C,f,vc,!Nh);break e;case 2:Ml=null;break;case 3:case 5:break;default:throw Error(r(329))}if((f&62914560)===f&&(N=OS+300-it(),10<N)){if(Mh(C,f,vc,!Nh),Wt(C,0,!0)!==0)break e;cm=f,C.timeoutHandle=nL(kD.bind(null,C,b,Ml,LS,tN,f,vc,Sg,V0,Nh,D,"Throttled",-0,0),N);break e}kD(C,b,Ml,LS,tN,f,vc,Sg,V0,Nh,D,null,-0,0)}}break}while(!0);ap(d)}function kD(d,f,b,C,N,D,J,ve,Ze,$t,Bt,Gt,Pt,Mt){if(d.timeoutHandle=-1,Gt=f.subtreeFlags,Gt&8192||(Gt&16785408)===16785408){Gt={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Vr},xD(f,D,Gt);
vendor: 7,758 bytes, line 8
8var _n=(D&62914560)===D?OS-it():(D&4194048)===D?jD-it():0;if(_n=ame(Gt,_n),_n!==null){cm=D,d.cancelPendingCommit=_n(ED.bind(null,d,f,D,b,C,N,J,ve,Ze,Bt,Gt,null,Pt,Mt)),Mh(d,D,J,!$t);return}}ED(d,f,D,b,C,N,J,ve,Ze)}function _pe(d){for(var f=d;;){var b=f.tag;if((b===0||b===11||b===15)&&f.flags&16384&&(b=f.updateQueue,b!==null&&(b=b.stores,b!==null)))for(var C=0;C<b.length;C++){var N=b[C],D=N.getSnapshot;N=N.value;try{if(!xr(D(),N))return!1}catch{return!1}}if(b=f.child,f.subtreeFlags&16384&&b!==null)b.return=f,f=b;else{if(f===d)break;for(;f.sibling===null;){if(f.return===null||f.return===d)return!0;f=f.return}f.sibling.return=f.return,f=f.sibling}}return!0}function Mh(d,f,b,C){f&=~eN,f&=~Sg,d.suspendedLanes|=f,d.pingedLanes&=~f,C&&(d.warmLanes|=f),C=d.expirationTimes;for(var N=f;0<N;){var D=31-Qe(N),J=1<<D;C[D]=-1,N&=~J}b!==0&&st(d,b,f)}function BS(){return(Ui&6)===0?(Gv(0),!1):!0}function oN(){if(bi!==null){if(lr===0)var d=bi.return;else d=bi,sd=Ku=null,ug(d),nm=null,ng=0,d=bi;for(;d!==null;)$S(d.alternate,d),d=d.return;bi=null}}function Y0(d,f){var b=d.timeoutHandle;b!==-1&&(d.timeoutHandle=-1,Upe(b)),b=d.cancelPendingCommit,b!==null&&(d.cancelPendingCommit=null,b()),cm=0,oN(),Ir=d,bi=b=od(d.current,null),Si=f,lr=0,bc=null,Nh=!1,G0=Qt(d,f),JA=!1,V0=vc=eN=Sg=zh=Io=0,Ml=Hv=null,tN=!1,(f&8)!==0&&(f|=f&32);var C=d.entangledLanes;if(C!==0)for(d=d.entanglements,C&=f;0<C;){var N=31-Qe(C),D=1<<N;f|=d[N],C&=~D}return lm=f,Vf(),b}function $D(d,f){Xn=null,U.H=bg,f===Ju||f===xh?(f=Z1(),lr=3):f===Q1?(f=Z1(),lr=4):lr=f===wv?8:f!==null&&typeof f=="object"&&typeof f.then=="function"?6:1,bc=f,bi===null&&(Io=1,R0(d,Nl(f,d.current)))}function ID(){var d=nl.current;return d===null?!0:(Si&4194048)===Si?sa===null:(Si&62914560)===Si||(Si&536870912)!==0?d===sa:!1}function PD(){var d=U.H;return U.H=bg,d===null?bg:d}function AD(){var d=U.A;return U.A=wpe,d}function FS(){Io=4,Nh||(Si&4194048)!==Si&&nl.current!==null||(G0=!0),(zh&134217727)===0&&(Sg&134217727)===0||Ir===null||Mh(Ir,Si,vc,!1)}function sN(d,f,b){var C=Ui;Ui|=2;var N=PD(),D=AD();(Ir!==d||Si!==f)&&(LS=null,Y0(d,f)),f=!1;var J=Io;e:do try{if(lr!==0&&bi!==null){var ve=bi,Ze=bc;switch(lr){case 8:oN(),J=6;break e;case 3:case 2:case 9:case 6:nl.current===null&&(f=!0);var $t=lr;if(lr=0,bc=null,X0(d,ve,Ze,$t),b&&G0){J=0;break e}break;default:$t=lr,lr=0,bc=null,X0(d,ve,Ze,$t)}}Cpe(),J=Io;break}catch(Bt){$D(d,Bt)}while(!0);return f&&d.shellSuspendCounter++,sd=Ku=null,Ui=C,U.H=N,U.A=D,bi===null&&(Ir=null,Si=0,Vf()),J}function Cpe(){for(;bi!==null;)ND(bi)}function Spe(d,f){var b=Ui;Ui|=2;var C=PD(),N=AD();Ir!==d||Si!==f?(LS=null,DS=it()+500,Y0(d,f)):G0=Qt(d,f);e:do try{if(lr!==0&&bi!==null){f=bi;var D=bc;t:switch(lr){case 1:lr=0,bc=null,X0(d,f,D,1);break;case 2:case 9:if(l0(D)){lr=0,bc=null,zD(f);break}f=function(){lr!==2&&lr!==9||Ir!==d||(lr=7),ap(d)},D.then(f,f);break e;case 3:lr=7;break e;case 4:lr=5;break e;case 7:l0(D)?(lr=0,bc=null,zD(f)):(lr=0,bc=null,X0(d,f,D,7));break;case 5:var J=null;switch(bi.tag){case 26:J=bi.memoizedState;case 5:case 27:var ve=bi;if(J?yL(J):ve.stateNode.complete){lr=0,bc=null;var Ze=ve.sibling;if(Ze!==null)bi=Ze;else{var $t=ve.return;$t!==null?(bi=$t,WS($t)):bi=null}break t}}lr=0,bc=null,X0(d,f,D,5);break;case 6:lr=0,bc=null,X0(d,f,D,6);break;case 8:oN(),Io=6;break e;default:throw Error(r(462))}}kpe();break}catch(Bt){$D(d,Bt)}while(!0);return sd=Ku=null,U.H=C,U.A=N,Ui=b,bi!==null?0:(Ir=null,Si=0,Vf(),Io)}function kpe(){for(;bi!==null&&!Me();)ND(bi)}function ND(d){var f=Tv(d.alternate,d,lm);d.memoizedProps=d.pendingProps,f===null?WS(d):bi=f}function zD(d){var f=d,b=f.alternate;switch(f.tag){case 15:case 0:f=_v(b,f,f.pendingProps,f.type,void 0,Si);break;case 11:f=_v(b,f,f.pendingProps,f.type.render,f.ref,Si);break;case 5:ug(f);default:$S(b,f),f=bi=q1(f,lm),f=Tv(b,f,lm)}d.memoizedProps=d.pendingProps,f===null?WS(d):bi=f}function X0(d,f,b,C){sd=Ku=null,ug(f),nm=null,ng=0;var N=f.return;try{if(XA(d,N,f,b,Si)){Io=1,R0(d,Nl(b,d.current)),bi=null;return}}catch(D){if(N!==null)throw bi=N,D;Io=1,R0(d,Nl(b,d.current)),bi=null;return}f.flags&32768?(ri||C===1?d=!0:G0||(Si&536870912)!==0?d=!1:(Nh=d=!0,(C===2||C===9||C===3||C===6)&&(C=nl.current,C!==null&&C.tag===13&&(C.flags|=16384))),TD(f,d)):WS(f)}function WS(d){var f=d;do{if((f.flags&32768)!==0){TD(f,Nh);return}d=f.return;var b=ZA(f.alternate,f,lm);if(b!==null){bi=b;return}if(f=f.sibling,f!==null){bi=f;return}bi=f=d}while(f!==null);Io===0&&(Io=5)}function TD(d,f){do{var b=Mv(d.alternate,d);if(b!==null){b.flags&=32767,bi=b;return}if(b=d.return,b!==null&&(b.flags|=32768,b.subtreeFlags=0,b.deletions=null),!f&&(d=d.sibling,d!==null)){bi=d;return}bi=d=b}while(d!==null);Io=6,bi=null}function ED(d,f,b,C,N,D,J,ve,Ze){d.cancelPendingCommit=null;do US();while(ys!==0);if((Ui&6)!==0)throw Error(r(327));if(f!==null){if(f===d.current)throw Error(r(177));if(D=f.lanes|f.childLanes,D|=Xy,xn(d,b,D,J,ve,Ze),d===Ir&&(bi=Ir=null,Si=0),K0=f,Eh=d,cm=b,nN=D,iN=N,_D=C,(f.subtreeFlags&10256)!==0||(f.flags&10256)!==0?(d.callbackNode=null,d.callbackPriority=0,Ape(Je,function(){return LD(),null})):(d.callbackNode=null,d.callbackPriority=0),C=(f.flags&13878)!==0,(f.subtreeFlags&13878)!==0||C){C=U.T,U.T=null,N=X.p,X.p=2,J=Ui,Ui|=4;try{Lv(d,f,b)}finally{Ui=J,X.p=N,U.T=C}}ys=1,MD(),RD(),OD()}}function MD(){if(ys===1){ys=0;var d=Eh,f=K0,b=(f.flags&13878)!==0;if((f.subtreeFlags&13878)!==0||b){b=U.T,U.T=null;var C=X.p;X.p=2;var N=Ui;Ui|=4;try{mt(f,d);var D=xN,J=Fu(d.containerInfo),ve=D.focusedElem,Ze=D.selectionRange;if(J!==ve&&ve&&ve.ownerDocument&&Gp(ve.ownerDocument.documentElement,ve)){if(Ze!==null&&Ky(ve)){var $t=Ze.start,Bt=Ze.end;if(Bt===void 0&&(Bt=$t),"selectionStart"in ve)ve.selectionStart=$t,ve.selectionEnd=Math.min(Bt,ve.value.length);else{var Gt=ve.ownerDocument||document,Pt=Gt&&Gt.defaultView||window;if(Pt.getSelection){var Mt=Pt.getSelection(),_n=ve.textContent.length,Un=Math.min(Ze.start,_n),wr=Ze.end===void 0?Un:Math.min(Ze.end,_n);!Mt.extend&&Un>wr&&(J=wr,wr=Un,Un=J);var xt=qp(ve,Un),ct=qp(ve,wr);if(xt&&ct&&(Mt.rangeCount!==1||Mt.anchorNode!==xt.node||Mt.anchorOffset!==xt.offset||Mt.focusNode!==ct.node||Mt.focusOffset!==ct.offset)){var St=Gt.createRange();St.setStart(xt.node,xt.offset),Mt.removeAllRanges(),Un>wr?(Mt.addRange(St),Mt.extend(ct.node,ct.offset)):(St.setEnd(ct.node,ct.offset),Mt.addRange(St))}}}}for(Gt=[],Mt=ve;Mt=Mt.parentNode;)Mt.nodeType===1&&Gt.push({element:Mt,left:Mt.scrollLeft,top:Mt.scrollTop});for(typeof ve.focus=="function"&&ve.focus(),ve=0;ve<Gt.length;ve++){var Ht=Gt[ve];Ht.element.scrollLeft=Ht.left,Ht.element.scrollTop=Ht.top}}tk=!!yN,xN=yN=null}finally{Ui=N,X.p=C,U.T=b}}d.current=f,ys=2}}function RD(){if(ys===2){ys=0;var d=Eh,f=K0,b=(f.flags&8772)!==0;if((f.subtreeFlags&8772)!==0||b){b=U.T,U.T=null;var C=X.p;X.p=2;var N=Ui;Ui|=4;try{zS(d,f.alternate,f)}finally{Ui=N,X.p=C,U.T=b}}ys=3}}function OD(){if(ys===4||ys===3){ys=0,Se();var d=Eh,f=K0,b=cm,C=_D;(f.subtreeFlags&10256)!==0||(f.flags&10256)!==0?ys=5:(ys=0,K0=Eh=null,DD(d,d.pendingLanes));var N=d.pendingLanes;if(N===0&&(Th=null),Fe(b),f=f.stateNode,Ue&&typeof Ue.onCommitFiberRoot=="function")try{Ue.onCommitFiberRoot(Le,f,void 0,(f.current.flags&128)===128)}catch{}if(C!==null){f=U.T,N=X.p,X.p=2,U.T=null;try{for(var D=d.onRecoverableError,J=0;J<C.length;J++){var ve=C[J];D(ve.value,{componentStack:ve.stack})}}finally{U.T=f,X.p=N}}(cm&3)!==0&&US(),ap(d),N=d.pendingLanes,(b&261930)!==0&&(N&42)!==0?d===rN?qv++:(qv=0,rN=d):qv=0,Gv(0)}}function DD(d,f){(d.pooledCacheLanes&=f)===0&&(f=d.pooledCache,f!=null&&(d.pooledCache=null,Qu(f)))}function US(){return MD(),RD(),OD(),LD()}function LD(){if(ys!==5)return!1;var d=Eh,f=nN;nN=0;var b=Fe(cm),C=U.T,N=X.p;try{X.p=32>b?32:b,U.T=null,b=iN,iN=null;var D=Eh,J=cm;if(ys=0,K0=Eh=null,cm=0,(Ui&6)!==0)throw Error(r(331));var ve=Ui;
vendor: 1,119 bytes, line 8
8if(Ui|=4,vD(D.current),Fv(D,D.current,J,b),Ui=ve,Gv(0,!1),Ue&&typeof Ue.onPostCommitFiberRoot=="function")try{Ue.onPostCommitFiberRoot(Le,D)}catch{}return!0}finally{X.p=N,U.T=C,DD(d,f)}}function BD(d,f,b){f=Nl(b,f),f=vv(d.stateNode,f,2),d=cd(d,f,2),d!==null&&(nn(d,2),ap(d))}function cr(d,f,b){if(d.tag===3)BD(d,d,b);else for(;f!==null;){if(f.tag===3){BD(f,d,b);break}else if(f.tag===1){var C=f.stateNode;if(typeof f.type.getDerivedStateFromError=="function"||typeof C.componentDidCatch=="function"&&(Th===null||!Th.has(C))){d=Nl(b,d),b=fS(2),C=cd(f,b,2),C!==null&&(gS(b,C,f,d),nn(C,2),ap(C));break}}f=f.return}}function aN(d,f,b){var C=d.pingCache;if(C===null){C=d.pingCache=new jpe;var N=new Set;C.set(f,N)}else N=C.get(f),N===void 0&&(N=new Set,C.set(f,N));N.has(b)||(JA=!0,N.add(b),d=$pe.bind(null,d,f,b),f.then(d,d))}function $pe(d,f,b){var C=d.pingCache;C!==null&&C.delete(f),d.pingedLanes|=d.suspendedLanes&b,d.warmLanes&=~b,Ir===d&&(Si&b)===b&&(Io===4||Io===3&&(Si&62914560)===Si&&300>it()-OS?(Ui&2)===0&&Y0(d,0):eN|=b,V0===Si&&(V0=0)),ap(d)}function FD(d,f){f===0&&(f=Zt()),d=Uu(d,f),d!==null&&(nn(d,f),ap(d))}
vendor: 4,109 bytes, line 8
8function Ipe(d){var f=d.memoizedState,b=0;f!==null&&(b=f.retryLane),FD(d,b)}function Ppe(d,f){var b=0;switch(d.tag){case 31:case 13:var C=d.stateNode,N=d.memoizedState;N!==null&&(b=N.retryLane);break;case 19:C=d.stateNode;break;case 22:C=d.stateNode._retryCache;break;default:throw Error(r(314))}C!==null&&C.delete(f),FD(d,b)}function Ape(d,f){return dt(d,f)}var HS=null,Q0=null,lN=!1,qS=!1,cN=!1,Rh=0;function ap(d){d!==Q0&&d.next===null&&(Q0===null?HS=Q0=d:Q0=Q0.next=d),qS=!0,lN||(lN=!0,zpe())}function Gv(d,f){if(!cN&&qS){cN=!0;do for(var b=!1,C=HS;C!==null;){if(d!==0){var N=C.pendingLanes;if(N===0)var D=0;else{var J=C.suspendedLanes,ve=C.pingedLanes;D=(1<<31-Qe(42|d)+1)-1,D&=N&~(J&~ve),D=D&201326741?D&201326741|1:D?D|2:0}D!==0&&(b=!0,qD(C,D))}else D=Si,D=Wt(C,C===Ir?D:0,C.cancelPendingCommit!==null||C.timeoutHandle!==-1),(D&3)===0||Qt(C,D)||(b=!0,qD(C,D));C=C.next}while(b);cN=!1}}function Npe(){WD()}function WD(){qS=lN=!1;var d=0;Rh!==0&&Wpe()&&(d=Rh);for(var f=it(),b=null,C=HS;C!==null;){var N=C.next,D=UD(C,f);D===0?(C.next=null,b===null?HS=N:b.next=N,N===null&&(Q0=b)):(b=C,(d!==0||(D&3)!==0)&&(qS=!0)),C=N}ys!==0&&ys!==5||Gv(d),Rh!==0&&(Rh=0)}function UD(d,f){for(var b=d.suspendedLanes,C=d.pingedLanes,N=d.expirationTimes,D=d.pendingLanes&-62914561;0<D;){var J=31-Qe(D),ve=1<<J,Ze=N[J];Ze===-1?((ve&b)===0||(ve&C)!==0)&&(N[J]=Yt(ve,f)):Ze<=f&&(d.expiredLanes|=ve),D&=~ve}if(f=Ir,b=Si,b=Wt(d,d===f?b:0,d.cancelPendingCommit!==null||d.timeoutHandle!==-1),C=d.callbackNode,b===0||d===f&&(lr===2||lr===9)||d.cancelPendingCommit!==null)return C!==null&&C!==null&&je(C),d.callbackNode=null,d.callbackPriority=0;if((b&3)===0||Qt(d,b)){if(f=b&-b,f===d.callbackPriority)return f;switch(C!==null&&je(C),Fe(b)){case 2:case 8:b=ge;break;case 32:b=Je;break;case 268435456:b=Xe;break;default:b=Je}return C=HD.bind(null,d),b=dt(b,C),d.callbackPriority=f,d.callbackNode=b,f}return C!==null&&C!==null&&je(C),d.callbackPriority=2,d.callbackNode=null,2}function HD(d,f){if(ys!==0&&ys!==5)return d.callbackNode=null,d.callbackPriority=0,null;var b=d.callbackNode;if(US()&&d.callbackNode!==b)return null;var C=Si;return C=Wt(d,d===Ir?C:0,d.cancelPendingCommit!==null||d.timeoutHandle!==-1),C===0?null:(SD(d,C,f),UD(d,it()),d.callbackNode!=null&&d.callbackNode===b?HD.bind(null,d):null)}function qD(d,f){if(US())return null;SD(d,f,!0)}function zpe(){Hpe(function(){(Ui&6)!==0?dt(te,Npe):WD()})}function dN(){if(Rh===0){var d=em;d===0&&(d=rt,rt<<=1,(rt&261888)===0&&(rt=256)),Rh=d}return Rh}function GD(d){return d==null||typeof d=="symbol"||typeof d=="boolean"?null:typeof d=="function"?d:ac(""+d)}function VD(d,f){var b=f.ownerDocument.createElement("input");return b.name=f.name,b.value=f.value,d.id&&b.setAttribute("form",d.id),f.parentNode.insertBefore(b,f),d=new FormData(d),b.parentNode.removeChild(b),d}function Tpe(d,f,b,C,N){if(f==="submit"&&b&&b.stateNode===N){var D=GD((N[pt]||null).action),J=C.submitter;J&&(f=(f=J[pt]||null)?GD(f.formAction):J.getAttribute("formAction"),f!==null&&(D=f,J=null));var ve=new Sa("action","action",null,C,N);d.push({event:ve,listeners:[{instance:null,listener:function(){if(C.defaultPrevented){if(Rh!==0){var Ze=J?VD(N,J):new FormData(N);gg(b,{pending:!0,data:Ze,method:N.method,action:D},null,Ze)}}else typeof D=="function"&&(ve.preventDefault(),Ze=J?VD(N,J):new FormData(N),gg(b,{pending:!0,data:Ze,method:N.method,action:D},D,Ze))},currentTarget:N}]})}}for(var uN=0;uN<Yy.length;uN++){var pN=Yy[uN],Epe=pN.toLowerCase(),Mpe=pN[0].toUpperCase()+pN.slice(1);Al(Epe,"on"+Mpe)}Al(L1,"onAnimationEnd"),Al(B1,"onAnimationIteration"),Al(F1,"onAnimationStart"),Al("dblclick","onDoubleClick"),Al("focusin","onFocus"),Al("focusout","onBlur"),Al(WC,"onTransitionRun"),Al(UC,"onTransitionStart"),Al(HC,"onTransitionCancel"),Al(W1,"onTransitionEnd"),di("onMouseEnter",["mouseout","mouseover"]),di("onMouseLeave",["mouseout","mouseover"]),di("onPointerEnter",["pointerout","pointerover"]),di("onPointerLeave",["pointerout","pointerover"]),_i("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),_i("onSelect","focusout contextmenu dragend focu
8sin keydown keyup mousedown mouseup selectionchange".split(" ")),_i("onBeforeInput",["compositionend","keypress","textInput","paste"]),_i("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),_i("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),_i("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Vv="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(" "),Rpe=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Vv));function KD(d,f){f=(f&4)!==0;for(var b=0;b<d.length;b++){var C=d[b],N=C.event;C=C.listeners;e:{var D=void 0;if(f)for(var J=C.length-1;0<=J;J--){var ve=C[J],Ze=ve.instance,$t=ve.currentTarget;if(ve=ve.listener,Ze!==D&&N.isPropagationStopped())break e;D=ve,N.currentTarget=$t;try{D(N)}catch(Bt){Gf(Bt)}N.currentTarget=null,D=Ze}else for(J=0;J<C.length;J++){if(ve=C[J],Ze=ve.instance,$t=ve.currentTarget,ve=ve.listener,Ze!==D&&N.isPropagationStopped())break e;D=ve,N.currentTarget=$t;try{D(N)}catch(Bt){Gf(Bt)}N.currentTarget=null,D=Ze}}}}function vi(d,f){var b=f[qe];b===void 0&&(b=f[qe]=new Set);var C=d+"__bubble";b.has(C)||(YD(f,d,2,!1),b.add(C))}function mN(d,f,b){var C=0;f&&(C|=4),YD(b,d,C,f)}var GS="_reactListening"+Math.random().toString(36).slice(2);function hN(d){if(!d[GS]){d[GS]=!0,$n.forEach(function(b){b!=="selectionchange"&&(Rpe.has(b)||mN(b,!1,d),mN(b,!0,d))});var f=d.nodeType===9?d:d.ownerDocument;f===null||f[GS]||(f[GS]=!0,mN("selectionchange",!1,f))}}function YD(d,f,b,C){switch(CL(f)){case 2:var N=dme;break;case 8:N=ume;break;default:N=PN}b=N.bind(null,f,b,d),N=void 0,!mo||f!=="touchstart"&&f!=="touchmove"&&f!=="wheel"||(N=!0),C?N!==void 0?d.addEventListener(f,b,{capture:!0,passive:N}):d.addEventListener(f,b,!0):N!==void 0?d.addEventListener(f,b,{passive:N}):d.addEventListener(f,b,!1)}function fN(d,f,b,C,N){var D=C;if((f&1)===0&&(f&2)===0&&C!==null)e:for(;;){if(C===null)return;var J=C.tag;if(J===3||J===4){var ve=C.stateNode.containerInfo;if(ve===N)break;if(J===4)for(J=C.return;J!==null;){var Ze=J.tag;if((Ze===3||Ze===4)&&J.stateNode.containerInfo===N)return;J=J.return}for(;ve!==null;){if(J=bn(ve),J===null)return;if(Ze=J.tag,Ze===5||Ze===6||Ze===26||Ze===27){C=D=J;continue e}ve=ve.parentNode}}C=C.return}Va(function(){var $t=D,Bt=Oo(b),Gt=[];e:{var Pt=U1.get(d);if(Pt!==void 0){var Mt=Sa,_n=d;switch(d){case"keypress":if(_a(b)===0)break e;case"keydown":case"keyup":Mt=cc;break;case"focusin":_n="focus",Mt=$l;break;case"focusout":_n="blur",Mt=$l;break;case"beforeblur":case"afterblur":Mt=$l;break;case"click":if(b.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Mt=Yo;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Mt=ed;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Mt=Vd;break;case L1:case B1:case F1:Mt=td;break;case W1:Mt=Bu;break;case"scroll":case"scrollend":Mt=Du;break;case"wheel":Mt=Il;break;case"copy":case"cut":case"paste":Mt=qd;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Mt=Hp;break;case"toggle":case"beforetoggle":Mt=Kd}var Un=(f&4)!==0,wr=!Un&&(d==="scroll"||d==="scrollend"),xt=Un?Pt!==null?Pt+"Capture":null:Pt;Un=[];for(var ct=$t,St;ct!==null;){var Ht=ct;if(St=Ht.stateNode,Ht=Ht.tag,Ht!==5&&Ht!==26&&Ht!==27||St===null||xt===null||(Ht=Ka(ct,xt),Ht!=null&&Un.push(Kv(ct,Ht,St))),wr)break;ct=ct.return}0<Un.length&&(Pt=new Mt(Pt,_n,null,b,Bt),Gt.push({event:Pt,listeners:Un}))}}if((f&7)===0){e:{if(Pt=d==="mouseover"||d==="pointerover",Mt=d==="mouseout"||d==="pointerout",Pt&&b!==Jc&&(_n=b.relatedTarget||b.fromElement)&&(bn(_n)||_n[Nt]))break e;if((Mt||Pt)&&(Pt=Bt.window===Bt?Bt:(Pt=Bt.ownerDocument)?Pt.defaultView||Pt.parentWindow:window,Mt?(_n=b.relatedTarget||b.toElement,Mt=$t,_n=_n?bn(_n):null,_n!==null&&(wr=s(_n),Un=_n.tag,_n!==wr||Un!==5&&Un!==27&&Un!==6)&&(_n=null)):(Mt=null,_n=$t),Mt!==_n)){if(Un=Yo,Ht="onMouseLeave",xt="onMouseEnter",ct="mou
8se",(d==="pointerout"||d==="pointerover")&&(Un=Hp,Ht="onPointerLeave",xt="onPointerEnter",ct="pointer"),wr=Mt==null?Pt:Kt(Mt),St=_n==null?Pt:Kt(_n),Pt=new Un(Ht,ct+"leave",Mt,b,Bt),Pt.target=wr,Pt.relatedTarget=St,Ht=null,bn(Bt)===$t&&(Un=new Un(xt,ct+"enter",_n,b,Bt),Un.target=St,Un.relatedTarget=wr,Ht=Un),wr=Ht,Mt&&_n)t:{for(Un=Ope,xt=Mt,ct=_n,St=0,Ht=xt;Ht;Ht=Un(Ht))St++;Ht=0;for(var On=ct;On;On=Un(On))Ht++;for(;0<St-Ht;)xt=Un(xt),St--;for(;0<Ht-St;)ct=Un(ct),Ht--;for(;St--;){if(xt===ct||ct!==null&&xt===ct.alternate){Un=xt;break t}xt=Un(xt),ct=Un(ct)}Un=null}else Un=null;Mt!==null&&XD(Gt,Pt,Mt,Un,!1),_n!==null&&wr!==null&&XD(Gt,wr,_n,Un,!0)}}e:{if(Pt=$t?Kt($t):window,Mt=Pt.nodeName&&Pt.nodeName.toLowerCase(),Mt==="select"||Mt==="input"&&Pt.type==="file")var Li=ft;else if(Ja(Pt))if(Ot)Li=Xo;else{Li=ar;var Pn=Yi}else Mt=Pt.nodeName,!Mt||Mt.toLowerCase()!=="input"||Pt.type!=="checkbox"&&Pt.type!=="radio"?$t&&sc($t.elementType)&&(Li=ft):Li=Pi;if(Li&&(Li=Li(d,$t))){ms(Gt,Li,b,Bt);break e}Pn&&Pn(d,Pt,$t),d==="focusout"&&$t&&Pt.type==="number"&&$t.memoizedProps.value!=null&&Sl(Pt,"number",Pt.value)}switch(Pn=$t?Kt($t):window,d){case"focusin":(Ja(Pn)||Pn.contentEditable==="true")&&(fh=Pn,qf=$t,Do=null);break;case"focusout":Do=qf=fh=null;break;case"mousedown":Di=!0;break;case"contextmenu":case"mouseup":case"dragend":Di=!1,FC(Gt,b,Bt);break;case"selectionchange":if(BC)break;case"keydown":case"keyup":FC(Gt,b,Bt)}var li;if(Ia)e:{switch(d){case"compositionstart":var ki="onCompositionStart";break e;case"compositionend":ki="onCompositionEnd";break e;case"compositionupdate":ki="onCompositionUpdate";break e}ki=void 0}else Ln?Lt(d,b)&&(ki="onCompositionEnd"):d==="keydown"&&b.keyCode===229&&(ki="onCompositionStart");ki&&(It&&b.locale!=="ko"&&(Ln||ki!=="onCompositionStart"?ki==="onCompositionEnd"&&Ln&&(li=Hd()):(gi=Bt,Or="value"in gi?gi.value:gi.textContent,Ln=!0)),Pn=VS($t,ki),0<Pn.length&&(ki=new Qa(ki,d,null,b,Bt),Gt.push({event:ki,listeners:Pn}),li?ki.data=li:(li=gt(b),li!==null&&(ki.data=li)))),(li=Aa?yi(d,b):Jt(d,b))&&(ki=VS($t,"onBeforeInput"),0<ki.length&&(Pn=new Qa("onBeforeInput","beforeinput",null,b,Bt),Gt.push({event:Pn,listeners:ki}),Pn.data=li)),Tpe(Gt,d,$t,b,Bt)}KD(Gt,f)})}function Kv(d,f,b){return{instance:d,listener:f,currentTarget:b}}function VS(d,f){for(var b=f+"Capture",C=[];d!==null;){var N=d,D=N.stateNode;if(N=N.tag,N!==5&&N!==26&&N!==27||D===null||(N=Ka(d,b),N!=null&&C.unshift(Kv(d,N,D)),N=Ka(d,f),N!=null&&C.push(Kv(d,N,D))),d.tag===3)return C;d=d.return}return[]}function Ope(d){if(d===null)return null;do d=d.return;while(d&&d.tag!==5&&d.tag!==27);return d||null}function XD(d,f,b,C,N){for(var D=f._reactName,J=[];b!==null&&b!==C;){var ve=b,Ze=ve.alternate,$t=ve.stateNode;if(ve=ve.tag,Ze!==null&&Ze===C)break;ve!==5&&ve!==26&&ve!==27||$t===null||(Ze=$t,N?($t=Ka(b,D),$t!=null&&J.unshift(Kv(b,$t,Ze))):N||($t=Ka(b,D),$t!=null&&J.push(Kv(b,$t,Ze)))),b=b.return}J.length!==0&&d.push({event:f,listeners:J})}var Dpe=/\r\n?/g,Lpe=/\u0000|\uFFFD/g;function QD(d){return(typeof d=="string"?d:""+d).replace(Dpe,` 9`).replace(Lpe,"")}function ZD(d,f){return f=QD(f),QD(d)===f}function vr(d,f,b,C,N,D){switch(b){case"children":typeof C=="string"?f==="body"||f==="textarea"&&C===""||Js(d,C):(typeof C=="number"||typeof C=="bigint")&&f!=="body"&&Js(d,""+C);break;case"className":jl(d,"class",C);break;case"tabIndex":jl(d,"tabindex",C);break;case"dir":case"role":case"viewBox":case"width":case"height":jl(d,b,C);break;case"style":va(d,C,D);break;case"data":if(f!=="object"){jl(d,"data",C);break}case"src":case"href":if(C===""&&(f!=="a"||b!=="href")){d.removeAttribute(b);break}if(C==null||typeof C=="function"||typeof C=="symbol"||typeof C=="boolean"){d.removeAttribute(b);break}C=ac(""+C),d.setAttribute(b,C);break;case"action":case"formAction":if(typeof C=="function"){d.setAttribute(b,"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 D=="function"&&(b==="formAction"?(f!=="input"&&vr(d,f,"name",N.name,N,null),vr(d,f,"formEncType",N.formEncType,N,null),vr(d,f,"formMethod",N.formMethod,N,null),vr(d,f,"formTarget",N.formTarget,N,null)):(vr(d,f,"encType",N.encType,N,null),vr(d,f,"method",N.method,N,null),vr(d,f,"target",N.target,N,null)));if(C==null||typeof C=="symbol"||typeof C=="boolean"){d.removeAttribute(b);break}C=ac(""+C),d.setAttribute(b,C);break;case"onClick":C!=null&&(d.onclick=Vr);break;case"onScroll":C!=null&&vi("scroll",d);break;case"onScrollEnd":C!=null&&vi("scrollend",d);break;case"dangerouslySetInnerHTML":if(C!=null){if(typeof C!="object"||!("__html"in C))throw Error(r(61));if(b=C.__html,b!=null){if(N.children!=null)throw Error(r(60));d.innerHTML=b}}break;case"multiple":d.multiple=C&&typeof C!="function"&&typeof C!="symbol";break;case"muted":d.muted=C&&typeof C!="function"&&typeof C!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(C==null||typeof C=="function"||typeof C=="boolean"||typeof C=="symbol"){d.removeAttribute("xlink:href");break}b=ac(""+C),d.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",b);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":C!=null&&typeof C!="function"&&typeof C!="symbol"?d.setAttribute(b,""+C):d.removeAttribute(b);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"playsInl
9ine":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":C&&typeof C!="function"&&typeof C!="symbol"?d.setAttribute(b,""):d.removeAttribute(b);break;case"capture":case"download":C===!0?d.setAttribute(b,""):C!==!1&&C!=null&&typeof C!="function"&&typeof C!="symbol"?d.setAttribute(b,C):d.removeAttribute(b);break;case"cols":case"rows":case"size":case"span":C!=null&&typeof C!="function"&&typeof C!="symbol"&&!isNaN(C)&&1<=C?d.setAttribute(b,C):d.removeAttribute(b);break;case"rowSpan":case"start":C==null||typeof C=="function"||typeof C=="symbol"||isNaN(C)?d.removeAttribute(b):d.setAttribute(b,C);break;case"popover":vi("beforetoggle",d),vi("toggle",d),Zs(d,"popover",C);break;case"xlinkActuate":Vo(d,"http://www.w3.org/1999/xlink","xlink:actuate",C);break;case"xlinkArcrole":Vo(d,"http://www.w3.org/1999/xlink","xlink:arcrole",C);break;case"xlinkRole":Vo(d,"http://www.w3.org/1999/xlink","xlink:role",C);break;case"xlinkShow":Vo(d,"http://www.w3.org/1999/xlink","xlink:show",C);break;case"xlinkTitle":Vo(d,"http://www.w3.org/1999/xlink","xlink:title",C);break;case"xlinkType":Vo(d,"http://www.w3.org/1999/xlink","xlink:type",C);break;case"xmlBase":Vo(d,"http://www.w3.org/XML/1998/namespace","xml:base",C);break;case"xmlLang":Vo(d,"http://www.w3.org/XML/1998/namespace","xml:lang",C);break;case"xmlSpace":Vo(d,"http://www.w3.org/XML/1998/namespace","xml:space",C);break;case"is":Zs(d,"is",C);break;case"innerText":case"textContent":break;default:(!(2<b.length)||b[0]!=="o"&&b[0]!=="O"||b[1]!=="n"&&b[1]!=="N")&&(b=wa.get(b)||b,Zs(d,b,C))}}function gN(d,f,b,C,N,D){switch(b){case"style":va(d,C,D);break;case"dangerouslySetInnerHTML":if(C!=null){if(typeof C!="object"||!("__html"in C))throw Error(r(61));if(b=C.__html,b!=null){if(N.children!=null)throw Error(r(60));d.innerHTML=b}}break;case"children":typeof C=="string"?Js(d,C):(typeof C=="number"||typeof C=="bigint")&&Js(d,""+C);break;case"onScroll":C!=null&&vi("scroll",d);break;case"onScrollEnd":C!=null&&vi("scrollend",d);break;case"onClick":C!=null&&(d.onclick=Vr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Ii.hasOwnProperty(b))e:{if(b[0]==="o"&&b[1]==="n"&&(N=b.endsWith("Capture"),f=b.slice(2,N?b.length-7:void 0),D=d[pt]||null,D=D!=null?D[b]:null,typeof D=="function"&&d.removeEventListener(f,D,N),typeof C=="function")){typeof D!="function"&&D!==null&&(b in d?d[b]=null:d.hasAttribute(b)&&d.removeAttribute(b)),d.addEventListener(f,C,N);break e}b in d?d[b]=C:C===!0?d.setAttribute(b,""):Zs(d,b,C)}}}function la(d,f,b){switch(f){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":vi("error",d),vi("load",d);var C=!1,N=!1,D;for(D in b)if(b.hasOwnProperty(D)){var J=b[D];if(J!=null)switch(D){case"src":C=!0;break;case"srcSet":N=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,f));default:vr(d,f,D,J,b,null)}}N&&vr(d,f,"srcSet",b.srcSet,b,null),C&&vr(d,f,"src",b.src,b,null);return;case"input":vi("invalid",d);var ve=D=J=N=null,Ze=null,$t=null;for(C in b)if(b.hasOwnProperty(C)){var Bt=b[C];if(Bt!=null)switch(C){case"name":N=Bt;break;case"type":J=Bt;break;case"checked":Ze=Bt;break;case"defaultChecked":$t=Bt;break;case"value":D=Bt;break;case"defaultValue":ve=Bt;break;case"children":case"dangerouslySetInnerHTML":if(Bt!=null)throw Error(r(137,f));break;default:vr(d,f,C,Bt,b,null)}}Cl(d,D,ve,Ze,$t,J,N,!1);return;case"select":vi("invalid",d),C=J=D=null;for(N in b)if(b.hasOwnProperty(N)&&(ve=b[N],ve!=null))switch(N){case"value":D=ve;break;case"defaultValue":J=ve;break;case"multiple":C=ve;default:vr(d,f,N,ve,b,null)}f=D,b=J,d.multiple=!!C,f!=null?Ko(d,!!C,f,!1):b!=null&&Ko(d,!!C,b,!0);return;case"textarea":vi("invalid",d),D=N=C=null;for(J in b)if(b.hasOwnProperty(J)&&(ve=b[J],ve!=null))switch(J){case"value":C=ve;break;case"defaultValue":N=ve;break;case"children":D=ve;break;case"dangerouslySetInnerHTML":if(ve!=null)throw Error(r(91));break;default:vr(d,f,J,ve,b,null)}us(d,C,N,D);return;case"option":for(Ze in b)if(b.hasOwnProperty(Ze)&&(C=b[Ze],C!=null))switch(Ze){case"selected":d.selected=C&&typeof C!="function"&&typeof C!="symbol";break;default:vr(d,f,Ze,C,b,null)}return;case"dialog":vi("beforetoggle",d),vi("toggle",d),vi("cancel",d),vi("close",d);break;case"iframe":case"object":vi("load",d);break;case"video":case"audio":for(C=0;C<Vv.length;C++)vi(Vv[C],d);break;case"image":vi("error",d),vi("load",d);break;case"details":vi("toggle",d);break;case"embed":case"source":case"link":vi("error",d),vi("load",d);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for($t in b)if(b.hasOwnProperty($t)&&(C=b[$t],C!=null))switch($t){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,f));default:vr(d,f,$t,C,b,null)}return;default:if(sc(f)){for(Bt in b)b.hasOwnProperty(Bt)&&(C=b[Bt],C!==void 0&&gN(d,f,Bt,C,b,void 0));return}}for(ve in b)b.hasOwnProperty(ve)&&(C=b[ve],C!=null&&vr(d,f,ve,C,b,null))}function Bpe(d,f,b,C){switch(f){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var N=null,D=null,J=null,ve=null,Ze=null,$t=null,Bt=null;for(Mt in b){var Gt=b[Mt];if(b.hasOwnProperty(Mt)&&Gt!=null)switch(Mt){case"checked":break;case"value":break;case"defaultValue":Ze=Gt;default:C.hasOwnProperty(Mt)||vr(d,f,Mt,null,C,Gt)}}for(var Pt in C){var Mt=C[Pt];if(Gt=b[Pt],C.hasOwnProperty(Pt)&&(Mt!=null||Gt!=null))switch(Pt){case"type":D=Mt;break;case"name":N=Mt;break;case"checked":$t=Mt;break;case"defaultChecked":Bt=Mt;break;case"value":J=Mt;break;case"defaultValue":ve=Mt;break;case"children":case"dangerouslySetInnerHTML":if(Mt!=null)throw Error(r(137,f));break;default:Mt!==Gt&&vr(d,f,Pt,Mt,C,Gt)}}ds(d,J,ve,Ze,$t,Bt,D,N);return;case"select":Mt=J=ve=Pt=null;for(D in b)if(Ze=b[D],b.hasOwnProperty(D)&&Ze!=null)switch(D){case"value":break;case"multiple":Mt=Ze;default:C.hasOwnProperty(D)||vr(d,f,D,null,C,Ze)}for(N in C)if(D=C[N],Ze=b[N],C.hasOwnProperty(N)&&(D!=null||Ze!=null))switch(N){case"value":Pt=D;break;case"defaultValue":ve=D;break;case"multiple":J=D;default:D!==Ze&&vr(d,f,N,D,C,Ze)}f=ve,b=J,C=Mt,Pt!=null?Ko(d,!!b,Pt,!1):!!C!=!!b&&(f!=null?Ko(d,!!b,f,!0):Ko(d,!!b,b?[]:"",!1));return;case"textarea":Mt=Pt=null;for(ve in b)if(N=b[ve],b.hasOwnProperty(ve)&&N!=null&&!C.hasOwnProperty(ve))switch(ve){case"value":break;case"children":break;default:vr(d,f,ve,null,C,N)}for(J in C)if(N=C[J],D=b[J],C.hasOwnProperty(J)&&(N!=null||D!=null))switch(J){case"value":Pt=N;break;case"defaultValue":Mt=N;break;case"children":break;case"dangerouslySetInnerHTML":if(N!=null)throw Error(r(91));break;default:N!==D&&vr(d,f,J,N,C,D)}Zc(d,Pt,Mt);return;case"option":for(var _n in b)if(Pt=b[_n],b.hasOwnProperty(_n)&&Pt!=null&&!C.hasOwnProperty(_n))switch(_n){case"selected":d.selected=!1;break;default:vr(d,f,_n,null,C,Pt)}for(Ze in C)if(Pt=C[Ze],Mt=b[Ze],C.hasOwnProperty(Ze)&&Pt!==Mt&&(Pt!=null||Mt!=null))switch(Ze){case"selected":d.selected=Pt&&typeof Pt!="function"&&typeof Pt!="symbol";break;default:vr(d,f,Ze,Pt,C,Mt)}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 Un in b)Pt=b[Un],b.hasOwnProperty(Un)&&Pt!=null&&!C.hasOwnProperty(Un)&&vr(d,f,Un,null,C,Pt);for($t in C)if(Pt=C[$t],Mt=b[$t],C.hasOwnProperty($t)&&Pt!==Mt&&(Pt!=null||Mt!=null))switch($t){case"children":case"dangerouslySetInnerHTML":if(Pt!=null)throw Error(r(137,f));break;default:vr(d,f,$t,Pt,C,Mt)}return;default:if(sc(f)){for(var wr in b)Pt=b[wr],b.hasOwnProperty(wr)&&Pt!==void 0&&!C.hasOwnProperty(wr)&&gN(d,f,wr,void 0,C,Pt);for(Bt in C)Pt=C[Bt],Mt=b[Bt],!C.hasOwnProperty(Bt)||Pt===Mt||Pt===void 0&&Mt===void 0||gN(d,f,Bt,Pt,C,Mt);return}}for(var xt in b)Pt=b[xt],b.hasOwnProperty(xt)&&Pt!=null&&!C.hasOwnProperty(xt)&&vr(d,f,xt,null,C,Pt);for(Gt in C)Pt=C[Gt],Mt=b[Gt],!C.hasOwnProperty(Gt)||Pt===Mt||Pt==null&&Mt==null||vr(d,f,Gt,Pt,C,Mt)}function JD(d){switch(d){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Fpe(){if(typeof performance.getEntriesByType=="function"){for(var d=0,f=0,b=performance.getEntriesByType("resource"),C=0;C<b.length;C++){var N=b[C],D=N.transferSize,J=N.initiatorType,ve=N.duration;if(D&&ve&&JD(J)){for(J=0,ve=N.responseEnd,C+=1;C<b.length;C++){var Ze=b[C],$t=Ze.startTime;if($t>ve)break;var Bt=Ze.transferSize,Gt=Ze.initiatorType;Bt&&JD(Gt)&&(Ze=Ze.responseEnd,J+=Bt*(Ze<ve?1:(ve-$t)/(Ze-$t)))}if(--C,f+=8*(D+J)/(N.duration/1e3),d++,10<d)break}}if(0<d)return f/d/1e6}return navigator.connection&&(d=navigator.connection.downlink,typeof d=="number")?d:5}var yN=null,xN=null;function KS(d){return d.nodeType===9?d:d.ownerDocument}function eL(d){switch(d){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function tL(d,f){if(d===0)switch(f){case"svg":return 1;case"math":return 2;default:return 0}return d===1&&f==="foreignObject"?0:d}function bN(d,f){return d==="textarea"||d==="noscript"||typeof f.children=="string"||typeof f.children=="number"||typeof f.children=="bigint"||typeof f.dangerouslySetInnerHTML=="object"&&f.dangerouslySetInnerHTML!==null&&f.dangerouslySetInnerHTML.__html!=null}var vN=null;function Wpe(){var d=window.event;return d&&d.type==="popstate"?d===vN?!1:(vN=d,!0):(vN=null,!1)}var nL=typeof setTimeout=="function"?setTimeout:void 0,Upe=typeof clearTimeout=="function"?clearTimeout:void 0,iL=typeof Promise=="function"?Promise:void 0,Hpe=typeof queueMicrotask=="function"?queueMicrotask:typeof iL<"u"?function(d){return iL.resolve(null).then(d).catch(qpe)}:nL;function qpe(d){setTimeout(function(){throw d})}function Oh(d){return d==="head"}function rL(d,f){var b=f,C=0;do{var N=b.nextSibling;if(d.removeChild(b),N&&N.nodeType===8)if(b=N.data,b==="/$"||b==="/&"){if(C===0){d.removeChild(N),tx(f);return}C--}else if(b==="$"||b==="$?"||b==="$~"||b==="$!"||b==="&")C++;
vendor: 15,543 bytes, line 9
9else if(b==="html")Yv(d.ownerDocument.documentElement);else if(b==="head"){b=d.ownerDocument.head,Yv(b);for(var D=b.firstChild;D;){var J=D.nextSibling,ve=D.nodeName;D[dn]||ve==="SCRIPT"||ve==="STYLE"||ve==="LINK"&&D.rel.toLowerCase()==="stylesheet"||b.removeChild(D),D=J}}else b==="body"&&Yv(d.ownerDocument.body);b=N}while(b);tx(f)}function oL(d,f){var b=d;d=0;do{var C=b.nextSibling;if(b.nodeType===1?f?(b._stashedDisplay=b.style.display,b.style.display="none"):(b.style.display=b._stashedDisplay||"",b.getAttribute("style")===""&&b.removeAttribute("style")):b.nodeType===3&&(f?(b._stashedText=b.nodeValue,b.nodeValue=""):b.nodeValue=b._stashedText||""),C&&C.nodeType===8)if(b=C.data,b==="/$"){if(d===0)break;d--}else b!=="$"&&b!=="$?"&&b!=="$~"&&b!=="$!"||d++;b=C}while(b)}function wN(d){var f=d.firstChild;for(f&&f.nodeType===10&&(f=f.nextSibling);f;){var b=f;switch(f=f.nextSibling,b.nodeName){case"HTML":case"HEAD":case"BODY":wN(b),rn(b);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(b.rel.toLowerCase()==="stylesheet")continue}d.removeChild(b)}}function Gpe(d,f,b,C){for(;d.nodeType===1;){var N=b;if(d.nodeName.toLowerCase()!==f.toLowerCase()){if(!C&&(d.nodeName!=="INPUT"||d.type!=="hidden"))break}else if(C){if(!d[dn])switch(f){case"meta":if(!d.hasAttribute("itemprop"))break;return d;case"link":if(D=d.getAttribute("rel"),D==="stylesheet"&&d.hasAttribute("data-precedence"))break;if(D!==N.rel||d.getAttribute("href")!==(N.href==null||N.href===""?null:N.href)||d.getAttribute("crossorigin")!==(N.crossOrigin==null?null:N.crossOrigin)||d.getAttribute("title")!==(N.title==null?null:N.title))break;return d;case"style":if(d.hasAttribute("data-precedence"))break;return d;case"script":if(D=d.getAttribute("src"),(D!==(N.src==null?null:N.src)||d.getAttribute("type")!==(N.type==null?null:N.type)||d.getAttribute("crossorigin")!==(N.crossOrigin==null?null:N.crossOrigin))&&D&&d.hasAttribute("async")&&!d.hasAttribute("itemprop"))break;return d;default:return d}}else if(f==="input"&&d.type==="hidden"){var D=N.name==null?null:""+N.name;if(N.type==="hidden"&&d.getAttribute("name")===D)return d}else return d;if(d=md(d.nextSibling),d===null)break}return null}function Vpe(d,f,b){if(f==="")return null;for(;d.nodeType!==3;)if((d.nodeType!==1||d.nodeName!=="INPUT"||d.type!=="hidden")&&!b||(d=md(d.nextSibling),d===null))return null;return d}function sL(d,f){for(;d.nodeType!==8;)if((d.nodeType!==1||d.nodeName!=="INPUT"||d.type!=="hidden")&&!f||(d=md(d.nextSibling),d===null))return null;return d}function jN(d){return d.data==="$?"||d.data==="$~"}function _N(d){return d.data==="$!"||d.data==="$?"&&d.ownerDocument.readyState!=="loading"}function Kpe(d,f){var b=d.ownerDocument;if(d.data==="$~")d._reactRetry=f;else if(d.data!=="$?"||b.readyState!=="loading")f();else{var C=function(){f(),b.removeEventListener("DOMContentLoaded",C)};b.addEventListener("DOMContentLoaded",C),d._reactRetry=C}}function md(d){for(;d!=null;d=d.nextSibling){var f=d.nodeType;if(f===1||f===3)break;if(f===8){if(f=d.data,f==="$"||f==="$!"||f==="$?"||f==="$~"||f==="&"||f==="F!"||f==="F")break;if(f==="/$"||f==="/&")return null}}return d}var CN=null;function aL(d){d=d.nextSibling;for(var f=0;d;){if(d.nodeType===8){var b=d.data;if(b==="/$"||b==="/&"){if(f===0)return md(d.nextSibling);f--}else b!=="$"&&b!=="$!"&&b!=="$?"&&b!=="$~"&&b!=="&"||f++}d=d.nextSibling}return null}function lL(d){d=d.previousSibling;for(var f=0;d;){if(d.nodeType===8){var b=d.data;if(b==="$"||b==="$!"||b==="$?"||b==="$~"||b==="&"){if(f===0)return d;f--}else b!=="/$"&&b!=="/&"||f++}d=d.previousSibling}return null}function cL(d,f,b){switch(f=KS(b),d){case"html":if(d=f.documentElement,!d)throw Error(r(452));return d;case"head":if(d=f.head,!d)throw Error(r(453));return d;case"body":if(d=f.body,!d)throw Error(r(454));return d;default:throw Error(r(451))}}function Yv(d){for(var f=d.attributes;f.length;)d.removeAttributeNode(f[0]);rn(d)}var hd=new Map,dL=new Set;function YS(d){return typeof d.getRootNode=="function"?d.getRootNode():d.nodeType===9?d:d.ownerDocument}var dm=X.d;X.d={f:Ype,r:Xpe,D:Qpe,C:Zpe,L:Jpe,m:eme,X:nme,S:tme,M:ime};function Ype(){var d=dm.f(),f=BS();return d||f}function Xpe(d){var f=kt(d);f!==null&&f.tag===5&&f.type==="form"?T0(f):dm.r(d)}var Z0=typeof document>"u"?null:document;function uL(d,f,b){var C=Z0;if(C&&typeof f=="string"&&f){var N=Ti(f);N='link[rel="'+d+'"][href="'+N+'"]',typeof b=="string"&&(N+='[crossorigin="'+b+'"]'),dL.has(N)||(dL.add(N),d={rel:d,crossOrigin:b,href:f},C.querySelector(N)===null&&(f=C.createElement("link"),la(f,"link",d),pn(f),C.head.appendChild(f)))}}function Qpe(d){dm.D(d),uL("dns-prefetch",d,null)}function Zpe(d,f){dm.C(d,f),uL("preconnect",d,f)}function Jpe(d,f,b){dm.L(d,f,b);var C=Z0;if(C&&d&&f){var N='link[rel="preload"][as="'+Ti(f)+'"]';f==="image"&&b&&b.imageSrcSet?(N+='[imagesrcset="'+Ti(b.imageSrcSet)+'"]',typeof b.imageSizes=="string"&&(N+='[imagesizes="'+Ti(b.imageSizes)+'"]')):N+='[href="'+Ti(d)+'"]';var D=N;switch(f){case"style":D=J0(d);break;case"script":D=ex(d)}hd.has(D)||(d=g({rel:"preload",href:f==="image"&&b&&b.imageSrcSet?void 0:d,as:f},b),hd.set(D,d),C.querySelector(N)!==null||f==="style"&&C.querySelector(Xv(D))||f==="script"&&C.querySelector(Qv(D))||(f=C.createElement("link"),la(f,"link",d),pn(f),C.head.appendChild(f)))}}function eme(d,f){dm.m(d,f);var b=Z0;if(b&&d){var C=f&&typeof f.as=="string"?f.as:"script",N='link[rel="modulepreload"][as="'+Ti(C)+'"][href="'+Ti(d)+'"]',D=N;switch(C){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":D=ex(d)}if(!hd.has(D)&&(d=g({rel:"modulepreload",href:d},f),hd.set(D,d),b.querySelector(N)===null)){switch(C){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(b.querySelector(Qv(D)))return}C=b.createElement("link"),la(C,"link",d),pn(C),b.head.appendChild(C)}}}function tme(d,f,b){dm.S(d,f,b);var C=Z0;if(C&&d){var N=un(C).hoistableStyles,D=J0(d);f=f||"default";var J=N.get(D);if(!J){var ve={loading:0,preload:null};if(J=C.querySelector(Xv(D)))ve.loading=5;else{d=g({rel:"stylesheet",href:d,"data-precedence":f},b),(b=hd.get(D))&&SN(d,b);var Ze=J=C.createElement("link");pn(Ze),la(Ze,"link",d),Ze._p=new Promise(function($t,Bt){Ze.onload=$t,Ze.onerror=Bt}),Ze.addEventListener("load",function(){ve.loading|=1}),Ze.addEventListener("error",function(){ve.loading|=2}),ve.loading|=4,XS(J,f,C)}J={type:"stylesheet",instance:J,count:1,state:ve},N.set(D,J)}}}function nme(d,f){dm.X(d,f);var b=Z0;if(b&&d){var C=un(b).hoistableScripts,N=ex(d),D=C.get(N);D||(D=b.querySelector(Qv(N)),D||(d=g({src:d,async:!0},f),(f=hd.get(N))&&kN(d,f),D=b.createElement("script"),pn(D),la(D,"link",d),b.head.appendChild(D)),D={type:"script",instance:D,count:1,state:null},C.set(N,D))}}function ime(d,f){dm.M(d,f);var b=Z0;if(b&&d){var C=un(b).hoistableScripts,N=ex(d),D=C.get(N);D||(D=b.querySelector(Qv(N)),D||(d=g({src:d,async:!0,type:"module"},f),(f=hd.get(N))&&kN(d,f),D=b.createElement("script"),pn(D),la(D,"link",d),b.head.appendChild(D)),D={type:"script",instance:D,count:1,state:null},C.set(N,D))}}function pL(d,f,b,C){var N=(N=de.current)?YS(N):null;if(!N)throw Error(r(446));switch(d){case"meta":case"title":return null;case"style":return typeof b.precedence=="string"&&typeof b.href=="string"?(f=J0(b.href),b=un(N).hoistableStyles,C=b.get(f),C||(C={type:"style",instance:null,count:0,state:null},b.set(f,C)),C):{type:"void",instance:null,count:0,state:null};case"link":if(b.rel==="stylesheet"&&typeof b.href=="string"&&typeof b.precedence=="string"){d=J0(b.href);var D=un(N).hoistableStyles,J=D.get(d);if(J||(N=N.ownerDocument||N,J={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},D.set(d,J),(D=N.querySelector(Xv(d)))&&!D._p&&(J.instance=D,J.state.loading=5),hd.has(d)||(b={rel:"preload",as:"style",href:b.href,crossOrigin:b.crossOrigin,integrity:b.integrity,media:b.media,hrefLang:b.hrefLang,referrerPolicy:b.referrerPolicy},hd.set(d,b),D||rme(N,d,b,J.state))),f&&C===null)throw Error(r(528,""));return J}if(f&&C!==null)throw Error(r(529,""));return null;case"script":return f=b.async,b=b.src,typeof b=="string"&&f&&typeof f!="function"&&typeof f!="symbol"?(f=ex(b),b=un(N).hoistableScripts,C=b.get(f),C||(C={type:"script",instance:null,count:0,state:null},b.set(f,C)),C):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,d))}}function J0(d){return'href="'+Ti(d)+'"'}function Xv(d){return'link[rel="stylesheet"]['+d+"]"}function mL(d){return g({},d,{"data-precedence":d.precedence,precedence:null})}function rme(d,f,b,C){d.querySelector('link[rel="preload"][as="style"]['+f+"]")?C.loading=1:(f=d.createElement("link"),C.preload=f,f.addEventListener("load",function(){return C.loading|=1}),f.addEventListener("error",function(){return C.loading|=2}),la(f,"link",b),pn(f),d.head.appendChild(f))}function ex(d){return'[src="'+Ti(d)+'"]'}function Qv(d){return"script[async]"+d}function hL(d,f,b){if(f.count++,f.instance===null)switch(f.type){case"style":var C=d.querySelector('style[data-href~="'+Ti(b.href)+'"]');if(C)return f.instance=C,pn(C),C;var N=g({},b,{"data-href":b.href,"data-precedence":b.precedence,href:null,precedence:null});return C=(d.ownerDocument||d).createElement("style"),pn(C),la(C,"style",N),XS(C,b.precedence,d),f.instance=C;case"stylesheet":N=J0(b.href);var D=d.querySelector(Xv(N));if(D)return f.state.loading|=4,f.instance=D,pn(D),D;C=mL(b),(N=hd.get(N))&&SN(C,N),D=(d.ownerDocument||d).createElement("link"),pn(D);var J=D;return J._p=new Promise(function(ve,Ze){J.onload=ve,J.onerror=Ze}),la(D,"link",C),f.state.loading|=4,XS(D,b.precedence,d),f.instance=D;case"script":return D=ex(b.src),(N=d.querySelector(Qv(D)))?(f.instance=N,pn(N),N):(C=b,(N=hd.get(D))&&(C=g({},b),kN(C,N)),d=d.ownerDocument||d,N=d.createElement("script"),pn(N),la(N,"link",C),d.head.appendChild(N),f.instance=N);case"void":return null;default:throw Error(r(443,f.type))}else f.type==="stylesheet"&&(f.state.loading&4)===0&&(C=f.instance,f.state.loading|=4,XS(C,b.precedence,d));return f.instance}function XS(d,f,b){for(var C=b.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),N=C.length?C[C.length-1]:null,D=N,J=0;J<C.length;J++){var ve=C[J];if(ve.dataset.precedence===f)D=ve;else if(D!==N)break}D?D.parentNode.insertBefore(d,D.nextSibling):(f=b.nodeType===9?b.head:b,f.insertBefore(d,f.firstChild))}function SN(d,f){d.crossOrigin==null&&(d.crossOrigin=f.crossOrigin),d.referrerPolicy==null&&(d.referrerPolicy=f.referrerPolicy),d.title==null&&(d.title=f.title)}function kN(d,f){d.crossOrigin==null&&(d.crossOrigin=f.crossOrigin),d.referrerPolicy==null&&(d.referrerPolicy=f.referrerPolicy),d.integrity==null&&(d.integrity=f.integrity)}var QS=null;function fL(d,f,b){if(QS===null){var C=new Map,N=QS=new Map;N.set(b,C)}else N=QS,C=N.get(b),C||(C=new Map,N.set(b,C));if(C.has(d))return C;for(C.set(d,null),b=b.getElementsByTagName(d),N=0;N<b.length;N++){var D=b[N];if(!(D[dn]||D[Ve]||d==="link"&&D.getAttribute("rel")==="stylesheet")&&D.namespaceURI!=="http://www.w3.org/2000/svg"){var J=D.getAttribute(f)||"";J=d+J;var ve=C.get(J);ve?ve.push(D):C.set(J,[D])}}return C}function gL(d,f,b){d=d.ownerDocument||d,d.head.insertBefore(b,f==="title"?d.querySelector("head > title"):null)}function ome(d,f,b){if(b===1||f.itemProp!=null)return!1;switch(d){case"meta":case"title":return!0;case"style":if(typeof f.precedence!="string"||typeof f.href!="string"||f.href==="")break;return!0;case"link":if(typeof f.rel!="string"||typeof f.href!="string"||f.href===""||f.onLoad||f.onError)break;switch(f.rel){case"stylesheet":return d=f.disabled,typeof f.precedence=="string"&&d==null;default:return!0}case"script":if(f.async&&typeof f.async!="function"&&typeof f.async!="symbol"&&!f.onLoad&&!f.onError&&f.src&&typeof f.src=="string")return!0}return!1}function yL(d){return!(d.type==="stylesheet"&&(d.state.loading&3)===0)}function sme(d,f,b,C){if(b.type==="stylesheet"&&(typeof C.media!="string"||matchMedia(C.media).matches!==!1)&&(b.state.loading&4)===0){if(b.instance===null){var N=J0(C.href),D=f.querySelector(Xv(N));if(D){f=D._p,f!==null&&typeof f=="object"&&typeof f.then=="function"&&(d.count++,d=ZS.bind(d),f.then(d,d)),b.state.loading|=4,b.instance=D,pn(D);return}D=f.ownerDocument||f,C=mL(C),(N=hd.get(N))&&SN(C,N),D=D.createElement("link"),pn(D);var J=D;J._p=new Promise(function(ve,Ze){J.onload=ve,J.onerror=Ze}),la(D,"link",C),b.instance=D}d.stylesheets===null&&(d.stylesheets=new Map),d.stylesheets.set(b,f),(f=b.state.preload)&&(b.state.loading&3)===0&&(d.count++,b=ZS.bind(d),f.addEventListener("load",b),f.addEventListener("error",b))}}var $N=0;function ame(d,f){return d.stylesheets&&d.count===0&&ek(d,d.stylesheets),0<d.count||0<d.imgCount?function(b){var C=setTimeout(function(){if(d.stylesheets&&ek(d,d.stylesheets),d.unsuspend){var D=d.unsuspend;d.unsuspend=null,D()}},6e4+f);0<d.imgBytes&&$N===0&&($N=62500*Fpe());var N=setTimeout(function(){if(d.waitingForImages=!1,d.count===0&&(d.stylesheets&&ek(d,d.stylesheets),d.unsuspend)){var D=d.unsuspend;d.unsuspend=null,D()}},(d.imgBytes>$N?50:800)+f);return d.unsuspend=b,function(){d.unsuspend=null,clearTimeout(C),clearTimeout(N)}}:null}function ZS(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)ek(this,this.stylesheets);else if(this.unsuspend){var d=this.unsuspend;this.unsuspend=null,d()}}}var JS=null;function ek(d,f){d.stylesheets=null,d.unsuspend!==null&&(d.count++,JS=new Map,f.forEach(lme,d),JS=null,ZS.call(d))}function lme(d,f){if(!(f.state.loading&4)){var b=JS.get(d);if(b)var C=b.get(null);else{b=new Map,JS.set(d,b);for(var N=d.querySelectorAll("link[data-precedence],style[data-precedence]"),D=0;D<N.length;D++){var J=N[D];(J.nodeName==="LINK"||J.getAttribute("media")!=="not all")&&(b.set(J.dataset.precedence,J),C=J)}C&&b.set(null,C)}N=f.instance,J=N.getAttribute("data-precedence"),D=b.get(J)||C,D===C&&b.set(null,N),b.set(J,N),this.count++,C=ZS.bind(this),N.addEventListener("load",C),N.addEventListener("error",C),D?D.parentNode.insertBefore(N,D.nextSibling):(d=d.nodeType===9?d.head:d,d.insertBefore(N,d.firstChild)),f.state.loading|=4}}var Zv={$$typeof:k,Provider:null,Consumer:null,_currentValue:Q,_currentValue2:Q,_threadCount:0};function cme(d,f,b,C,N,D,J,ve,Ze){this.tag=1,this.containerInfo=d,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=tn(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=tn(0),this.hiddenUpdates=tn(null),this.identifierPrefix=C,this.onUncaughtError=N,this.onCaughtError=D,this.onRecoverableError=J,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=Ze,this.incompleteTransitions=new Map}function xL(d,f,b,C,N,D,J,ve,Ze,$t,Bt,Gt){return d=new cme(d,f,b,J,Ze,$t,Bt,Gt,ve),f=1,D===!0&&(f|=24),D=Na(3,null,null,f),d.current=D,D.stateNode=d,f=Y1(),f.refCount++,d.pooledCache=f,f.refCount++,D.memoizedState={element:C,isDehydrated:b,cache:f},u0(D),d}function bL(d){return d?(d=Yp,d):Yp}function vL(d,f,b,C,N,D){N=bL(N),C.context===null?C.context=N:C.pendingContext=N,C=ip(f),C.payload={element:b},D=D===void 0?null:D,D!==null&&(C.callback=D),b=cd(d,C,f),b!==null&&(Rl(b,d,f),og(b,d,f))}function wL(d,f){if(d=d.memoizedState,d!==null&&d.dehydrated!==null){var b=d.retryLane;d.retryLane=b!==0&&b<f?b:f}}
vendor: 8,593 bytes, line 9
9function IN(d,f){wL(d,f),(d=d.alternate)&&wL(d,f)}function jL(d){if(d.tag===13||d.tag===31){var f=Uu(d,67108864);f!==null&&Rl(f,d,67108864),IN(d,67108864)}}function _L(d){if(d.tag===13||d.tag===31){var f=wc();f=ae(f);var b=Uu(d,f);b!==null&&Rl(b,d,f),IN(d,f)}}var tk=!0;function dme(d,f,b,C){var N=U.T;U.T=null;var D=X.p;try{X.p=2,PN(d,f,b,C)}finally{X.p=D,U.T=N}}function ume(d,f,b,C){var N=U.T;U.T=null;var D=X.p;try{X.p=8,PN(d,f,b,C)}finally{X.p=D,U.T=N}}function PN(d,f,b,C){if(tk){var N=AN(C);if(N===null)fN(d,f,C,nk,b),SL(d,C);else if(mme(N,d,f,b,C))C.stopPropagation();else if(SL(d,C),f&4&&-1<pme.indexOf(d)){for(;N!==null;){var D=kt(N);if(D!==null)switch(D.tag){case 3:if(D=D.stateNode,D.current.memoizedState.isDehydrated){var J=vt(D.pendingLanes);if(J!==0){var ve=D;for(ve.pendingLanes|=2,ve.entangledLanes|=2;J;){var Ze=1<<31-Qe(J);ve.entanglements[1]|=Ze,J&=~Ze}ap(D),(Ui&6)===0&&(DS=it()+500,Gv(0))}}break;case 31:case 13:ve=Uu(D,2),ve!==null&&Rl(ve,D,2),BS(),IN(D,2)}if(D=AN(C),D===null&&fN(d,f,C,nk,b),D===N)break;N=D}N!==null&&C.stopPropagation()}else fN(d,f,C,null,b)}}function AN(d){return d=Oo(d),NN(d)}var nk=null;function NN(d){if(nk=null,d=bn(d),d!==null){var f=s(d);if(f===null)d=null;else{var b=f.tag;if(b===13){if(d=a(f),d!==null)return d;d=null}else if(b===31){if(d=c(f),d!==null)return d;d=null}else if(b===3){if(f.stateNode.current.memoizedState.isDehydrated)return f.tag===3?f.stateNode.containerInfo:null;d=null}else f!==d&&(d=null)}}return nk=d,null}function CL(d){switch(d){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(De()){case te:return 2;case ge:return 8;case Je:case Ee:return 32;case Xe:return 268435456;default:return 32}default:return 32}}var zN=!1,Dh=null,Lh=null,Bh=null,Jv=new Map,ew=new Map,Fh=[],pme="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 SL(d,f){switch(d){case"focusin":case"focusout":Dh=null;break;case"dragenter":case"dragleave":Lh=null;break;case"mouseover":case"mouseout":Bh=null;break;case"pointerover":case"pointerout":Jv.delete(f.pointerId);break;case"gotpointercapture":case"lostpointercapture":ew.delete(f.pointerId)}}function tw(d,f,b,C,N,D){return d===null||d.nativeEvent!==D?(d={blockedOn:f,domEventName:b,eventSystemFlags:C,nativeEvent:D,targetContainers:[N]},f!==null&&(f=kt(f),f!==null&&jL(f)),d):(d.eventSystemFlags|=C,f=d.targetContainers,N!==null&&f.indexOf(N)===-1&&f.push(N),d)}function mme(d,f,b,C,N){switch(f){case"focusin":return Dh=tw(Dh,d,f,b,C,N),!0;case"dragenter":return Lh=tw(Lh,d,f,b,C,N),!0;case"mouseover":return Bh=tw(Bh,d,f,b,C,N),!0;case"pointerover":var D=N.pointerId;return Jv.set(D,tw(Jv.get(D)||null,d,f,b,C,N)),!0;case"gotpointercapture":return D=N.pointerId,ew.set(D,tw(ew.get(D)||null,d,f,b,C,N)),!0}return!1}function kL(d){var f=bn(d.target);if(f!==null){var b=s(f);if(b!==null){if(f=b.tag,f===13){if(f=a(b),f!==null){d.blockedOn=f,wt(d.priority,function(){_L(b)});return}}else if(f===31){if(f=c(b),f!==null){d.blockedOn=f,wt(d.priority,function(){_L(b)});return}}else if(f===3&&b.stateNode.current.memoizedState.isDehydrated){d.blockedOn=b.tag===3?b.stateNode.containerInfo:null;return}}}d.blockedOn=null}function ik(d){if(d.blockedOn!==null)return!1;for(var f=d.targetContainers;0<f.length;){var b=AN(d.nativeEvent);if(b===null){b=d.nativeEvent;var C=new b.constructor(b.type,b);Jc=C,b.target.dispatchEvent(C),Jc=null}else return f=kt(b),f!==null&&jL(f),d.blockedOn=b,!1;f.shift()}return!0}function $L(d,f,b){ik(d)&&b.delete(f)}function hme(){zN=!1,Dh!==null&&ik(Dh)&&(Dh=null),Lh!==null&&ik(Lh)&&(Lh=null),Bh!==null&&ik(Bh)&&(Bh=null),Jv.forEach($L),ew.forEach($L)}function rk(d,f){d.blockedOn===f&&(d.blockedOn=null,zN||(zN=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,hme)))}var ok=null;function IL(d){ok!==d&&(ok=d,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){ok===d&&(ok=null);for(var f=0;f<d.length;f+=3){var b=d[f],C=d[f+1],N=d[f+2];if(typeof C!="function"){if(NN(C||b)===null)continue;break}var D=kt(b);D!==null&&(d.splice(f,3),f-=3,gg(D,{pending:!0,data:N,method:b.method,action:C},C,N))}}))}function tx(d){function f(Ze){return rk(Ze,d)}Dh!==null&&rk(Dh,d),Lh!==null&&rk(Lh,d),Bh!==null&&rk(Bh,d),Jv.forEach(f),ew.forEach(f);for(var b=0;b<Fh.length;b++){var C=Fh[b];C.blockedOn===d&&(C.blockedOn=null)}for(;0<Fh.length&&(b=Fh[0],b.blockedOn===null);)kL(b),b.blockedOn===null&&Fh.shift();if(b=(d.ownerDocument||d).$$reactFormReplay,b!=null)for(C=0;C<b.length;C+=3){var N=b[C],D=b[C+1],J=N[pt]||null;if(typeof D=="function")J||IL(b);else if(J){var ve=null;if(D&&D.hasAttribute("formAction")){if(N=D,J=D[pt]||null)ve=J.formAction;else if(NN(N)!==null)continue}else ve=J.action;typeof ve=="function"?b[C+1]=ve:(b.splice(C,3),C-=3),IL(b)}}}function PL(){function d(D){D.canIntercept&&D.info==="react-transition"&&D.intercept({handler:function(){return new Promise(function(J){return N=J})},focusReset:"manual",scroll:"manual"})}function f(){N!==null&&(N(),N=null),C||setTimeout(b,20)}function b(){if(!C&&!navigation.transition){var D=navigation.currentEntry;D&&D.url!=null&&navigation.navigate(D.url,{state:D.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var C=!1,N=null;return navigation.addEventListener("navigate",d),navigation.addEventListener("navigatesuccess",f),navigation.addEventListener("navigateerror",f),setTimeout(b,100),function(){C=!0,navigation.removeEventListener("navigate",d),navigation.removeEventListener("navigatesuccess",f),navigation.removeEventListener("navigateerror",f),N!==null&&(N(),N=null)}}}function TN(d){this._internalRoot=d}sk.prototype.render=TN.prototype.render=function(d){var f=this._internalRoot;if(f===null)throw Error(r(409));var b=f.current,C=wc();vL(b,C,d,f,null,null)},sk.prototype.unmount=TN.prototype.unmount=function(){var d=this._internalRoot;if(d!==null){this._internalRoot=null;var f=d.containerInfo;vL(d.current,2,null,d,null,null),BS(),f[Nt]=null}};function sk(d){this._internalRoot=d}sk.prototype.unstable_scheduleHydration=function(d){if(d){var f=Ge();d={blockedOn:null,target:d,priority:f};for(var b=0;b<Fh.length&&f!==0&&f<Fh[b].priority;b++);Fh.splice(b,0,d),b===0&&kL(d)}};var AL=n.version;if(AL!=="19.2.1")throw Error(r(527,AL,"19.2.1"));X.findDOMNode=function(d){var f=d._reactInternals;if(f===void 0)throw typeof d.render=="function"?Error(r(188)):(d=Object.keys(d).join(","),Error(r(268,d)));return d=m(f),d=d!==null?h(d):null,d=d===null?null:d.stateNode,d};var fme={bundleType:0,version:"19.2.1",rendererPackageName:"react-dom",currentDispatcherRef:U,reconcilerVersion:"19.2.1"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var ak=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ak.isDisabled&&ak.supportsFiber)try{Le=ak.inject(fme),Ue=ak}catch{}}return iw.createRoot=function(d,f){if(!o(d))throw Error(r(299));var b=!1,C="",N=uS,D=pS,J=mS;return f!=null&&(f.unstable_strictMode===!0&&(b=!0),f.identifierPrefix!==void 0&&(C=f.identifierPrefix),f.onUncaughtError!==void 0&&(N=f.onUncaughtError),f.onCaughtError!==void 0&&(D=f.onCaughtError),f.onRecoverableError!==void 0&&(J=f.onRecoverableError)),f=xL(d,1,!1,null,null,b,C,null,N,D,J,PL),d[Nt]=f.current,hN(d),new TN(f)},iw.hydrateRoot=function(d,f,b){if(!o(d))throw Error(r(299));var C=!1,N="",D=uS,J=pS,ve=mS,Ze=null;return b!=null&&(b.unstable_strictMode===!0&&(C=!0),b.identifierPrefix!==void 0&&(N=b.
9identifierPrefix),b.onUncaughtError!==void 0&&(D=b.onUncaughtError),b.onCaughtError!==void 0&&(J=b.onCaughtError),b.onRecoverableError!==void 0&&(ve=b.onRecoverableError),b.formState!==void 0&&(Ze=b.formState)),f=xL(d,1,!0,f,b??null,C,N,Ze,D,J,ve,PL),f.context=bL(null),b=f.current,C=wc(),C=ae(C),N=ip(C),N.callback=null,cd(b,N,C),b=C,f.current.lanes=b,nn(f,b),ap(f),d[Nt]=f.current,hN(d),new sk(f)},iw.version="19.2.1",iw}var BL;function Sme(){if(BL)return MN.exports;BL=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(n){console.error(n)}}return e(),MN.exports=Cme(),MN.exports}var kme=Sme(),l=n1();const fr=Tu(l),$me=yme({__proto__:null,default:fr},[l]);var FL="popstate";function Ime(e={}){function n(r,o){let{pathname:s,search:a,hash:c}=r.location;return PE("",{pathname:s,search:a,hash:c},o.state&&o.state.usr||null,o.state&&o.state.key||"default")}function i(r,o){return typeof o=="string"?o:g_(o)}return Ame(n,i,null,e)}function lo(e,n){if(e===!1||e===null||typeof e>"u")throw new Error(n)}function Uc(e,n){if(!e){typeof console<"u"&&console.warn(n);try{throw new Error(n)}catch{}}}function Pme(){return Math.random().toString(36).substring(2,10)}function WL(e,n){return{usr:e.state,key:e.key,idx:n}}function PE(e,n,i=null,r){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof n=="string"?i1(n):n,state:i,key:n&&n.key||r||Pme()}}function g_({pathname:e="/",search:n="",hash:i=""}){return n&&n!=="?"&&(e+=n.charAt(0)==="?"?n:"?"+n),i&&i!=="#"&&(e+=i.charAt(0)==="#"?i:"#"+i),e}function i1(e){let n={};if(e){let i=e.indexOf("#");i>=0&&(n.hash=e.substring(i),e=e.substring(0,i));let r=e.indexOf("?");r>=0&&(n.search=e.substring(r),e=e.substring(0,r)),e&&(n.pathname=e)}return n}function Ame(e,n,i,r={}){let{window:o=document.defaultView,v5Compat:s=!1}=r,a=o.history,c="POP",u=null,m=h();m==null&&(m=0,a.replaceState({...a.state,idx:m},""));function h(){return(a.state||{idx:null}).idx}function g(){c="POP";let v=h(),_=v==null?null:v-m;m=v,u&&u({action:c,location:j.location,delta:_})}function x(v,_){c="PUSH";let $=PE(j.location,v,_);m=h()+1;let k=WL($,m),P=j.createHref($);try{a.pushState(k,"",P)}catch(S){if(S instanceof DOMException&&S.name==="DataCloneError")throw S;o.location.assign(P)}s&&u&&u({action:c,location:j.location,delta:1})}function y(v,_){c="REPLACE";let $=PE(j.location,v,_);m=h();let k=WL($,m),P=j.createHref($);a.replaceState(k,"",P),s&&u&&u({action:c,location:j.location,delta:0})}function w(v){return Nme(v)}let j={get action(){return c},get location(){return e(o,a)},listen(v){if(u)throw new Error("A history only accepts one active listener");return o.addEventListener(FL,g),u=v,()=>{o.removeEventListener(FL,g),u=null}},createHref(v){return n(o,v)},createURL:w,encodeLocation(v){let _=w(v);return{pathname:_.pathname,search:_.search,hash:_.hash}},push:x,replace:y,go(v){return a.go(v)}};return j}function Nme(e,n=!1){let i="http://localhost";
9typeof window<"u"&&(i=window.location.origin!=="null"?window.location.origin:window.location.href),lo(i,"No window.location.(origin|href) available to create URL");let r=typeof e=="string"?e:g_(e);return r=r.replace(/ $/,"%20"),!n&&r.startsWith("//")&&(r=i+r),new URL(r,i)}function Nte(e,n,i="/"){return zme(e,n,i,!1)}function zme(e,n,i,r){let o=typeof n=="string"?i1(n):n,s=Dm(o.pathname||"/",i);if(s==null)return null;let a=zte(e);Tme(a);let c=null;for(let u=0;c==null&&u<a.length;++u){let m=Hme(s);c=Wme(a[u],m,r)}return c}function zte(e,n=[],i=[],r="",o=!1){let s=(a,c,u=o,m)=>{let h={relativePath:m===void 0?a.path||"":m,caseSensitive:a.caseSensitive===!0,childrenIndex:c,route:a};if(h.relativePath.startsWith("/")){if(!h.relativePath.startsWith(r)&&u)return;lo(h.relativePath.startsWith(r),`Absolute route path "${h.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),h.relativePath=h.relativePath.slice(r.length)}let g=Tm([r,h.relativePath]),x=i.concat(h);a.children&&a.children.length>0&&(lo(a.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),zte(a.children,n,x,g,u)),!(a.path==null&&!a.index)&&n.push({path:g,score:Bme(g,a.index),routesMeta:x})};return e.forEach((a,c)=>{if(a.path===""||!a.path?.includes("?"))s(a,c);else for(let u of Tte(a.path))s(a,c,!0,u)}),n}function Tte(e){let n=e.split("/");if(n.length===0)return[];let[i,...r]=n,o=i.endsWith("?"),s=i.replace(/\?$/,"");if(r.length===0)return o?[s,""]:[s];let a=Tte(r.join("/")),c=[];return c.push(...a.map(u=>u===""?s:[s,u].join("/"))),o&&c.push(...a),c.map(u=>e.startsWith("/")&&u===""?"/":u)}function Tme(e){e.sort((n,i)=>n.score!==i.score?i.score-n.score:Fme(n.routesMeta.map(r=>r.childrenIndex),i.routesMeta.map(r=>r.childrenIndex)))}var Eme=/^:[\w-]+$/,Mme=3,Rme=2,Ome=1,Dme=10,Lme=-2,UL=e=>e==="*";function Bme(e,n){let i=e.split("/"),r=i.length;return i.some(UL)&&(r+=Lme),n&&(r+=Rme),i.filter(o=>!UL(o)).reduce((o,s)=>o+(Eme.test(s)?Mme:s===""?Ome:Dme),r)}function Fme(e,n){return e.length===n.length&&e.slice(0,-1).every((r,o)=>r===n[o])?e[e.length-1]-n[n.length-1]:0}function Wme(e,n,i=!1){let{routesMeta:r}=e,o={},s="/",a=[];for(let c=0;c<r.length;++c){let u=r[c],m=c===r.length-1,h=s==="/"?n:n.slice(s.length)||"/",g=pu({path:u.relativePath,caseSensitive:u.caseSensitive,end:m},h),x=u.route;if(!g&&m&&i&&!r[r.length-1].route.index&&(g=pu({path:u.relativePath,caseSensitive:u.caseSensitive,end:!1},h)),!g)return null;
9Object.assign(o,g.params),a.push({params:o,pathname:Tm([s,g.pathname]),pathnameBase:Yme(Tm([s,g.pathnameBase])),route:x}),g.pathnameBase!=="/"&&(s=Tm([s,g.pathnameBase]))}return a}function pu(e,n){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[i,r]=Ume(e.path,e.caseSensitive,e.end),o=n.match(i);if(!o)return null;let s=o[0],a=s.replace(/(.)\/+$/,"$1"),c=o.slice(1);return{params:r.reduce((m,{paramName:h,isOptional:g},x)=>{if(h==="*"){let w=c[x]||"";a=s.slice(0,s.length-w.length).replace(/(.)\/+$/,"$1")}const y=c[x];return g&&!y?m[h]=void 0:m[h]=(y||"").replace(/%2F/g,"/"),m},{}),pathname:s,pathnameBase:a,pattern:e}}function Ume(e,n=!1,i=!0){Uc(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let r=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(a,c,u)=>(r.push({paramName:c,isOptional:u!=null}),u?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),o+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):i?o+="\\/*$":e!==""&&e!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,n?void 0:"i"),r]}function Hme(e){try{return e.split("/").map(n=>decodeURIComponent(n).replace(/\//g,"%2F")).join("/")}catch(n){return Uc(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${n}).`),e}}function Dm(e,n){if(n==="/")return e;if(!e.toLowerCase().startsWith(n.toLowerCase()))return null;let i=n.endsWith("/")?n.length-1:n.length,r=e.charAt(i);return r&&r!=="/"?null:e.slice(i)||"/"}var qme=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Gme=e=>qme.test(e);function Vme(e,n="/"){let{pathname:i,search:r="",hash:o=""}=typeof e=="string"?i1(e):e,s;if(i)if(Gme(i))s=i;else{if(i.includes("//")){let a=i;i=i.replace(/\/\/+/g,"/"),Uc(!1,`Pathnames cannot have embedded double slashes - normalizing ${a} -> ${i}`)}i.startsWith("/")?s=HL(i.substring(1),"/"):s=HL(i,n)}else s=n;return{pathname:s,search:Xme(r),hash:Qme(o)}}function HL(e,n){let i=n.replace(/\/+$/,"").split("/");return e.split("/").forEach(o=>{o===".."?i.length>1&&i.pop():o!=="."&&i.push(o)}),i.length>1?i.join("/"):"/"}function BN(e,n,i,r){return`Cannot include a '${e}' character in a manually specified \`to.${n}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${i}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function Kme(e){return e.filter((n,i)=>i===0||n.route.path&&n.route.path.length>0)}function P8(e){let n=Kme(e);return n.map((i,r)=>r===n.length-1?i.pathname:i.pathnameBase)}function A8(e,n,i,r=!1){let o;typeof e=="string"?o=i1(e):(o={...e},lo(!o.pathname||!o.pathname.includes("?"),BN("?","pathname","search",o)),lo(!o.pathname||!o.pathname.includes("#"),BN("#","pathname","hash",o)),lo(!o.search||!o.search.includes("#"),BN("#","search","hash",o)));let s=e===""||o.pathname==="",a=s?"/":o.pathname,c;if(a==null)c=i;else{let g=n.length-1;if(!r&&a.startsWith("..")){let x=a.split("/");for(;x[0]==="..";)x.shift(),g-=1;o.pathname=x.join("/")}c=g>=0?n[g]:"/"}let u=Vme(o,c),m=a&&a!=="/"&&a.endsWith("/"),h=(s||a===".")&&i.endsWith("/");return!u.pathname.endsWith("/")&&(m||h)&&(u.pathname+="/"),u}var Tm=e=>e.join("/").replace(/\/\/+/g,"/"),Yme=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),Xme=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Qme=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function Zme(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function Jme(e){return e.map(n=>n.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Ete=["POST","PUT","PATCH","DELETE"];new Set(Ete);var ehe=["GET",...Ete];new Set(ehe);var r1=l.createContext(null);r1.displayName="DataRouter";var uP=l.createContext(null);uP.displayName="DataRouterState";l.createContext(!1);var Mte=l.createContext({isTransitioning:!1});Mte.displayName="ViewTransition";var the=l.createContext(new Map);the.displayName="Fetchers";var nhe=l.createContext(null);nhe.displayName="Await";var Dd=l.createContext(null);Dd.displayName="Navigation";var q_=l.createContext(null);q_.displayName="Location";var Ld=l.createContext({outlet:null,matches:[],isDataRoute:!1});Ld.displayName="Route";var N8=l.createContext(null);N8.displayName="RouteError";function ihe(e,{relative:n}={}){lo(o1(),"useHref() may be used only in the context of a <Router> component.");let{basename:i,navigator:r}=l.useContext(Dd),{hash:o,pathname:s,search:a}=G_(e,{relative:n}),c=s;return i!=="/"&&(c=s==="/"?i:Tm([i,s])),r.createHref({pathname:c,search:a,hash:o})}function o1(){return l.useContext(q_)!=null}function vo(){return lo(o1(),"useLocation() may be used only in the context of a <Router> component."),l.useContext(q_).location}var Rte="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Ote(e){l.useContext(Dd).static||l.useLayoutEffect(e)}function zn(){let{isDataRoute:e}=l.useContext(Ld);return e?yhe():rhe()}function rhe(){lo(o1(),"useNavigate() may be used only in the context of a <Router> component.");let e=l.useContext(r1),{basename:n,navigator:i}=l.useContext(Dd),{matches:r}=l.useContext(Ld),{pathname:o}=vo(),s=JSON.stringify(P8(r)),a=l.useRef(!1);
9return Ote(()=>{a.current=!0}),l.useCallback((u,m={})=>{if(Uc(a.current,Rte),!a.current)return;if(typeof u=="number"){i.go(u);return}let h=A8(u,JSON.parse(s),o,m.relative==="path");e==null&&n!=="/"&&(h.pathname=h.pathname==="/"?n:Tm([n,h.pathname])),(m.replace?i.replace:i.push)(h,m.state,m)},[n,i,s,o,e])}var Dte=l.createContext(null);function z8(){return l.useContext(Dte)}function ohe(e){let n=l.useContext(Ld).outlet;return l.useMemo(()=>n&&l.createElement(Dte.Provider,{value:e},n),[n,e])}function Gn(){let{matches:e}=l.useContext(Ld),n=e[e.length-1];return n?n.params:{}}function G_(e,{relative:n}={}){let{matches:i}=l.useContext(Ld),{pathname:r}=vo(),o=JSON.stringify(P8(i));return l.useMemo(()=>A8(e,JSON.parse(o),r,n==="path"),[e,o,r,n])}function she(e,n){return Lte(e,n)}function Lte(e,n,i,r,o){lo(o1(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:s}=l.useContext(Dd),{matches:a}=l.useContext(Ld),c=a[a.length-1],u=c?c.params:{},m=c?c.pathname:"/",h=c?c.pathnameBase:"/",g=c&&c.route;{let $=g&&g.path||"";Bte(m,!g||$.endsWith("*")||$.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${m}" (under <Route path="${$}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render. 10 11Please change the parent <Route path="${$}"> to <Route path="${$==="/"?"*":`${$}/*`}">.`)}let x=vo(),y;if(n){let $=typeof n=="string"?i1(n):n;lo(h==="/"||$.pathname?.startsWith(h),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${h}" but pathname "${$.pathname}" was given in the \`location\` prop.`),y=$}else y=x;let w=y.pathname||"/",j=w;if(h!=="/"){let $=h.replace(/^\//,"").split("/");j="/"+w.replace(/^\//,"").split("/").slice($.length).join("/")}let v=Nte(e,{pathname:j});Uc(g||v!=null,`No routes matched location "${y.pathname}${y.search}${y.hash}" `),Uc(v==null||v[v.length-1].route.element!==void 0||v[v.length-1].route.Component!==void 0||v[v.length-1].route.lazy!==void 0,`Matched leaf route at location "${y.pathname}${y.search}${y.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let _=uhe(v&&v.map($=>Object.assign({},$,{params:Object.assign({},u,$.params),pathname:Tm([h,s.encodeLocation?s.encodeLocation($.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:$.pathname]),pathnameBase:$.pathnameBase==="/"?h:Tm([h,s.encodeLocation?s.encodeLocation($.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:$.pathnameBase])})),a,i,r,o);return n&&_?l.createElement(q_.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...y},navigationType:"POP"}},_):_}function ahe(){let e=ghe(),n=Zme(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),i=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",o={padding:"0.5rem",backgroundColor:r},s={padding:"2px 4px",backgroundColor:r},a=null;return console.error("Error handled by React Router default ErrorBoundary:",e),a=l.createElement(l.Fragment,null,l.createElement("p",null,"ð¿ Hey developer ð"),l.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",l.createElement("code",{style:s},"ErrorBoundary")," or"," ",l.createElement("code",{style:s},"errorElement")," prop on your route.")),l.createElement(l.Fragment,null,l.createElement("h2",null,"Unexpected Application Error!"),l.createElement("h3",{style:{fontStyle:"italic"}},n),i?l.createElement("pre",{style:o},i):null,a)}var lhe=l.createElement(ahe,null),che=class extends l.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){this.props.onError?this.props.onError(e,n):console.error("React Router caught the following error during render",e)}render(){return this.state.error!==void 0?l.createElement(Ld.Provider,{value:this.props.routeContext},l.createElement(N8.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function dhe({routeContext:e,match:n,children:i}){let r=l.useContext(r1);return r&&r.static&&r.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=n.route.id),l.createElement(Ld.Provider,{value:e},i)}function uhe(e,n=[],i=null,r=null,o=null){if(e==null){if(!i)return null;if(i.errors)e=i.matches;else if(n.length===0&&!i.initialized&&i.matches.length>0)e=i.matches;else return null}let s=e,a=i?.errors;if(a!=null){let h=s.findIndex(g=>g.route.id&&a?.[g.route.id]!==void 0);lo(h>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(",")}`),s=s.slice(0,Math.min(s.length,h+1))}let c=!1,u=-1;if(i)for(let h=0;h<s.length;h++){let g=s[h];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(u=h),g.route.id){let{loaderData:x,errors:y}
11=i,w=g.route.loader&&!x.hasOwnProperty(g.route.id)&&(!y||y[g.route.id]===void 0);if(g.route.lazy||w){c=!0,u>=0?s=s.slice(0,u+1):s=[s[0]];break}}}let m=i&&r?(h,g)=>{r(h,{location:i.location,params:i.matches?.[0]?.params??{},unstable_pattern:Jme(i.matches),errorInfo:g})}:void 0;return s.reduceRight((h,g,x)=>{let y,w=!1,j=null,v=null;i&&(y=a&&g.route.id?a[g.route.id]:void 0,j=g.route.errorElement||lhe,c&&(u<0&&x===0?(Bte("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),w=!0,v=null):u===x&&(w=!0,v=g.route.hydrateFallbackElement||null)));let _=n.concat(s.slice(0,x+1)),$=()=>{let k;return y?k=j:w?k=v:g.route.Component?k=l.createElement(g.route.Component,null):g.route.element?k=g.route.element:k=h,l.createElement(dhe,{match:g,routeContext:{outlet:h,matches:_,isDataRoute:i!=null},children:k})};return i&&(g.route.ErrorBoundary||g.route.errorElement||x===0)?l.createElement(che,{location:i.location,revalidation:i.revalidation,component:j,error:y,children:$(),routeContext:{outlet:null,matches:_,isDataRoute:!0},onError:m}):$()},null)}function T8(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function phe(e){let n=l.useContext(r1);return lo(n,T8(e)),n}function mhe(e){let n=l.useContext(uP);return lo(n,T8(e)),n}function hhe(e){let n=l.useContext(Ld);return lo(n,T8(e)),n}function E8(e){let n=hhe(e),i=n.matches[n.matches.length-1];return lo(i.route.id,`${e} can only be used on routes that contain a unique "id"`),i.route.id}function fhe(){return E8("useRouteId")}function ghe(){let e=l.useContext(N8),n=mhe("useRouteError"),i=E8("useRouteError");return e!==void 0?e:n.errors?.[i]}function yhe(){let{router:e}=phe("useNavigate"),n=E8("useNavigate"),i=l.useRef(!1);return Ote(()=>{i.current=!0}),l.useCallback(async(o,s={})=>{Uc(i.current,Rte),i.current&&(typeof o=="number"?await e.navigate(o):await e.navigate(o,{fromRouteId:n,...s}))},[e,n])}var qL={};function Bte(e,n,i){!n&&!qL[e]&&(qL[e]=!0,Uc(!1,i))}l.memo(xhe);function xhe({routes:e,future:n,state:i,unstable_onError:r}){return Lte(e,void 0,i,r,n)}function bhe({to:e,replace:n,state:i,relative:r}){lo(o1(),"<Navigate> may be used only in the context of a <Router> component.");let{static:o}=l.useContext(Dd);Uc(!o,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:s}=l.useContext(Ld),{pathname:a}=vo(),c=zn(),u=A8(e,P8(s),a,r==="path"),m=JSON.stringify(u);return l.useEffect(()=>{c(JSON.parse(m),{replace:n,state:i,relative:r})},[c,m,r,n,i]),null}function Fte(e){return ohe(e.context)}function An(e){lo(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function vhe({basename:e="/",children:n=null,location:i,navigationType:r="POP",navigator:o,static:s=!1,unstable_useTransitions:a}){lo(!o1(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let c=e.replace(/^\/*/,"/"),u=l.useMemo(()=>({basename:c,navigator:o,static:s,unstable_useTransitions:a,future:{}}),[c,o,s,a]);typeof i=="string"&&(i=i1(i));let{pathname:m="/",search:h="",hash:g="",state:x=null,key:y="default"}=i,w=l.useMemo(()=>{let j=Dm(m,c);return j==null?null:{location:{pathname:j,search:h,hash:g,state:x,key:y},navigationType:r}},[c,m,h,g,x,y,r]);return Uc(w!=null,`<Router basename="${c}"> is not able to match the URL "${m}${h}${g}" because it does not start with the basename, so the <Router> won't render anything.`),w==null?null:l.createElement(Dd.Provider,{value:u},l.createElement(q_.Provider,{children:n,value:w}))}function whe({children:e,location:n}){return she(AE(e),n)}function AE(e,n=[]){let i=[];return l.Children.forEach(e,(r,o)=>{if(!l.isValidElement(r))return;let s=[...n,o];if(r.type===l.Fragment){i.push.apply(i,AE(r.props.children,s));return}lo(r.type===An,`[${typeof r.type=="string"?r.type:r.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),lo(!r.props.index||!r.props.children,"An index route cannot have child routes.");let a={id:r.props.id||s.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,middleware:r.props.middleware,loader:r.props.loader,action:r.props.action,hydrateFallbackElement:r.props.hydrateFallbackElement,HydrateFallback:r.props.HydrateFallback,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.hasErrorBoundary===!0||r.props.ErrorBoundary!=null||r.props.errorElement!=null,
11shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(a.children=AE(r.props.children,s)),i.push(a)}),i}var l5="get",c5="application/x-www-form-urlencoded";function pP(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function jhe(e){return pP(e)&&e.tagName.toLowerCase()==="button"}function _he(e){return pP(e)&&e.tagName.toLowerCase()==="form"}function Che(e){return pP(e)&&e.tagName.toLowerCase()==="input"}function She(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function khe(e,n){return e.button===0&&(!n||n==="_self")&&!She(e)}function NE(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((n,i)=>{let r=e[i];return n.concat(Array.isArray(r)?r.map(o=>[i,o]):[[i,r]])},[]))}function $he(e,n){let i=NE(e);return n&&n.forEach((r,o)=>{i.has(o)||n.getAll(o).forEach(s=>{i.append(o,s)})}),i}var lk=null;function Ihe(){if(lk===null)try{new FormData(document.createElement("form"),0),lk=!1}catch{lk=!0}return lk}var Phe=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function FN(e){return e!=null&&!Phe.has(e)?(Uc(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${c5}"`),null):e}function Ahe(e,n){let i,r,o,s,a;if(_he(e)){let c=e.getAttribute("action");r=c?Dm(c,n):null,i=e.getAttribute("method")||l5,o=FN(e.getAttribute("enctype"))||c5,s=new FormData(e)}else if(jhe(e)||Che(e)&&(e.type==="submit"||e.type==="image")){let c=e.form;if(c==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let u=e.getAttribute("formaction")||c.getAttribute("action");if(r=u?Dm(u,n):null,i=e.getAttribute("formmethod")||c.getAttribute("method")||l5,o=FN(e.getAttribute("formenctype"))||FN(c.getAttribute("enctype"))||c5,s=new FormData(c,e),!Ihe()){let{name:m,type:h,value:g}=e;if(h==="image"){let x=m?`${m}.`:"";s.append(`${x}x`,"0"),s.append(`${x}y`,"0")}else m&&s.append(m,g)}}else{if(pP(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');i=l5,r=null,o=c5,a=e}return s&&o==="text/plain"&&(a=s,s=void 0),{action:r,method:i.toLowerCase(),encType:o,formData:s,body:a}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function M8(e,n){if(e===!1||e===null||typeof e>"u")throw new Error(n)}function Nhe(e,n,i){let r=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r.pathname==="/"?r.pathname=`_root.${i}`:n&&Dm(r.pathname,n)==="/"?r.pathname=`${n.replace(/\/$/,"")}/_root.${i}`:r.pathname=`${r.pathname.replace(/\/$/,"")}.${i}`,r}async function zhe(e,n){if(e.id in n)return n[e.id];try{let i=await import(e.module);return n[e.id]=i,i}catch(i){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(i),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function The(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function Ehe(e,n,i){let r=await Promise.all(e.map(async o=>{let s=n.routes[o.route.id];if(s){let a=await zhe(s,i);return a.links?a.links():[]}return[]}));return Dhe(r.flat(1).filter(The).filter(o=>o.rel==="stylesheet"||o.rel==="preload").map(o=>o.rel==="stylesheet"?{...o,rel:"prefetch",as:"style"}:{...o,rel:"prefetch"}))}function GL(e,n,i,r,o,s){let a=(u,m)=>i[m]?u.route.id!==i[m].route.id:!0,c=(u,m)=>i[m].pathname!==u.pathname||i[m].route.path?.endsWith("*")&&i[m].params["*"]!==u.params["*"];return s==="assets"?n.filter((u,m)=>a(u,m)||c(u,m)):s==="data"?n.filter((u,m)=>{let h=r.routes[u.route.id];if(!h||!h.hasLoader)return!1;if(a(u,m)||c(u,m))return!0;if(u.route.shouldRevalidate){let g=u.route.shouldRevalidate({currentUrl:new URL(o.pathname+o.search+o.hash,window.origin),currentParams:i[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:u.params,defaultShouldRevalidate:!0});if(typeof g=="boolean")return g}return!0}):[]}function Mhe(e,n,{includeHydrateFallback:i}={}){return Rhe(e.map(r=>{let o=n.routes[r.route.id];if(!o)return[];let s=[o.module];return o.clientActionModule&&(s=s.concat(o.clientActionModule)),o.clientLoaderModule&&(s=s.concat(o.clientLoaderModule)),i&&o.hydrateFallbackModule&&(s=s.concat(o.hydrateFallbackModule)),o.imports&&(s=s.concat(o.imports)),s}).flat(1))}function Rhe(e){return[...new Set(e)]}function Ohe(e){let n={},i=Object.keys(e).sort();for(let r of i)n[r]=e[r];return n}function Dhe(e,n){let i=new Set;return new Set(n),e.reduce((r,o)=>{let s=JSON.stringify(Ohe(o));return i.has(s)||(i.add(s),r.push({key:s,link:o})),r},[])}function Wte(){let e=l.useContext(r1);return M8(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function Lhe(){let e=l.useContext(uP);return M8(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var R8=l.createContext(void 0);R8.displayName="FrameworkContext";
11function Ute(){let e=l.useContext(R8);return M8(e,"You must render this element inside a <HydratedRouter> element"),e}function Bhe(e,n){let i=l.useContext(R8),[r,o]=l.useState(!1),[s,a]=l.useState(!1),{onFocus:c,onBlur:u,onMouseEnter:m,onMouseLeave:h,onTouchStart:g}=n,x=l.useRef(null);l.useEffect(()=>{if(e==="render"&&a(!0),e==="viewport"){let j=_=>{_.forEach($=>{a($.isIntersecting)})},v=new IntersectionObserver(j,{threshold:.5});return x.current&&v.observe(x.current),()=>{v.disconnect()}}},[e]),l.useEffect(()=>{if(r){let j=setTimeout(()=>{a(!0)},100);return()=>{clearTimeout(j)}}},[r]);let y=()=>{o(!0)},w=()=>{o(!1),a(!1)};return i?e!=="intent"?[s,x,{}]:[s,x,{onFocus:rw(c,y),onBlur:rw(u,w),onMouseEnter:rw(m,y),onMouseLeave:rw(h,w),onTouchStart:rw(g,y)}]:[!1,x,{}]}function rw(e,n){return i=>{e&&e(i),i.defaultPrevented||n(i)}}function Fhe({page:e,...n}){let{router:i}=Wte(),r=l.useMemo(()=>Nte(i.routes,e,i.basename),[i.routes,e,i.basename]);return r?l.createElement(Uhe,{page:e,matches:r,...n}):null}function Whe(e){let{manifest:n,routeModules:i}=Ute(),[r,o]=l.useState([]);return l.useEffect(()=>{let s=!1;return Ehe(e,n,i).then(a=>{s||o(a)}),()=>{s=!0}},[e,n,i]),r}function Uhe({page:e,matches:n,...i}){let r=vo(),{manifest:o,routeModules:s}=Ute(),{basename:a}=Wte(),{loaderData:c,matches:u}=Lhe(),m=l.useMemo(()=>GL(e,n,u,o,r,"data"),[e,n,u,o,r]),h=l.useMemo(()=>GL(e,n,u,o,r,"assets"),[e,n,u,o,r]),g=l.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let w=new Set,j=!1;if(n.forEach(_=>{let $=o.routes[_.route.id];!$||!$.hasLoader||(!m.some(k=>k.route.id===_.route.id)&&_.route.id in c&&s[_.route.id]?.shouldRevalidate||$.hasClientLoader?j=!0:w.add(_.route.id))}),w.size===0)return[];let v=Nhe(e,a,"data");return j&&w.size>0&&v.searchParams.set("_routes",n.filter(_=>w.has(_.route.id)).map(_=>_.route.id).join(",")),[v.pathname+v.search]},[a,c,r,o,m,n,e,s]),x=l.useMemo(()=>Mhe(h,o),[h,o]),y=Whe(h);return l.createElement(l.Fragment,null,g.map(w=>l.createElement("link",{key:w,rel:"prefetch",as:"fetch",href:w,...i})),x.map(w=>l.createElement("link",{key:w,rel:"modulepreload",href:w,...i})),y.map(({key:w,link:j})=>l.createElement("link",{key:w,nonce:i.nonce,...j})))}function Hhe(...e){return n=>{e.forEach(i=>{typeof i=="function"?i(n):i!=null&&(i.current=n)})}}var Hte=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Hte&&(window.__reactRouterVersion="7.10.1")}catch{}function qhe({basename:e,children:n,unstable_useTransitions:i,window:r}){let o=l.useRef();o.current==null&&(o.current=Ime({window:r,v5Compat:!0}));let s=o.current,[a,c]=l.useState({action:s.action,location:s.location}),u=l.useCallback(m=>{i===!1?c(m):l.startTransition(()=>c(m))},[i]);return l.useLayoutEffect(()=>s.listen(u),[s,u]),l.createElement(vhe,{basename:e,children:n,location:a.location,navigationType:a.action,navigator:s,unstable_useTransitions:i===!0})}var qte=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Dn=l.forwardRef(function({onClick:n,discover:i="render",prefetch:r="none",relative:o,reloadDocument:s,replace:a,state:c,target:u,to:m,preventScrollReset:h,viewTransition:g,...x},y){let{basename:w,unstable_useTransitions:j}=l.useContext(Dd),v=typeof m=="string"&&qte.test(m),_,$=!1;if(typeof m=="string"&&v&&(_=m,Hte))try{let T=new URL(window.location.href),M=m.startsWith("//")?new URL(T.protocol+m):new URL(m),R=Dm(M.pathname,w);M.origin===T.origin&&R!=null?m=R+M.search+M.hash:$=!0}catch{Uc(!1,`<Link to="${m}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let k=ihe(m,{relative:o}),[P,S,I]=Bhe(r,x),A=Khe(m,{replace:a,state:c,target:u,preventScrollReset:h,relative:o,viewTransition:g,unstable_useTransitions:j});function E(T){n&&n(T),T.defaultPrevented||A(T)}let B=l.createElement("a",{...x,...I,href:_||k,onClick:$||s?n:E,ref:Hhe(y,S),target:u,"data-discover":!v&&i==="render"?"true":void 0});return P&&!v?l.createElement(l.Fragment,null,B,l.createElement(Fhe,{page:k})):B});Dn.displayName="Link";var Gte=l.forwardRef(function({"aria-current":n="page",caseSensitive:i=!1,className:r="",end:o=!1,style:s,to:a,viewTransition:c,children:u,...m},h){let g=G_(a,{relative:m.relative}),x=vo(),y=l.useContext(uP),{navigator:w,basename:j}=l.useContext(Dd),v=y!=null&&Jhe(g)&&c===!0,_=w.encodeLocation?w.encodeLocation(g).pathname:g.pathname,$=x.pathname,k=y&&y.navigation&&y.navigation.location?y.navigation.location.pathname:null;i||($=$.toLowerCase(),k=k?k.toLowerCase():null,_=_.toLowerCase()),k&&j&&(k=Dm(k,j)||k
11);const P=_!=="/"&&_.endsWith("/")?_.length-1:_.length;let S=$===_||!o&&$.startsWith(_)&&$.charAt(P)==="/",I=k!=null&&(k===_||!o&&k.startsWith(_)&&k.charAt(_.length)==="/"),A={isActive:S,isPending:I,isTransitioning:v},E=S?n:void 0,B;typeof r=="function"?B=r(A):B=[r,S?"active":null,I?"pending":null,v?"transitioning":null].filter(Boolean).join(" ");let T=typeof s=="function"?s(A):s;return l.createElement(Dn,{...m,"aria-current":E,className:B,ref:h,style:T,to:a,viewTransition:c},typeof u=="function"?u(A):u)});Gte.displayName="NavLink";var Ghe=l.forwardRef(({discover:e="render",fetcherKey:n,navigate:i,reloadDocument:r,replace:o,state:s,method:a=l5,action:c,onSubmit:u,relative:m,preventScrollReset:h,viewTransition:g,...x},y)=>{let{unstable_useTransitions:w}=l.useContext(Dd),j=Qhe(),v=Zhe(c,{relative:m}),_=a.toLowerCase()==="get"?"get":"post",$=typeof c=="string"&&qte.test(c),k=P=>{if(u&&u(P),P.defaultPrevented)return;P.preventDefault();let S=P.nativeEvent.submitter,I=S?.getAttribute("formmethod")||a,A=()=>j(S||P.currentTarget,{fetcherKey:n,method:I,navigate:i,replace:o,state:s,relative:m,preventScrollReset:h,viewTransition:g});w&&i!==!1?l.startTransition(()=>A()):A()};return l.createElement("form",{ref:y,method:_,action:v,onSubmit:r?u:k,...x,"data-discover":!$&&e==="render"?"true":void 0})});Ghe.displayName="Form";function Vhe(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Vte(e){let n=l.useContext(r1);return lo(n,Vhe(e)),n}function Khe(e,{target:n,replace:i,state:r,preventScrollReset:o,relative:s,viewTransition:a,unstable_useTransitions:c}={}){let u=zn(),m=vo(),h=G_(e,{relative:s});return l.useCallback(g=>{if(khe(g,n)){g.preventDefault();let x=i!==void 0?i:g_(m)===g_(h),y=()=>u(e,{replace:x,state:r,preventScrollReset:o,relative:s,viewTransition:a});c?l.startTransition(()=>y()):y()}},[m,u,h,i,r,n,e,o,s,a,c])}function yr(e){Uc(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let n=l.useRef(NE(e)),i=l.useRef(!1),r=vo(),o=l.useMemo(()=>$he(r.search,i.current?null:n.current),[r.search]),s=zn(),a=l.useCallback((c,u)=>{const m=NE(typeof c=="function"?c(new URLSearchParams(o)):c);i.current=!0,s("?"+m,u)},[s,o]);return[o,a]}var Yhe=0,Xhe=()=>`__${String(++Yhe)}__`;function Qhe(){let{router:e}=Vte("useSubmit"),{basename:n}=l.useContext(Dd),i=fhe(),r=e.fetch,o=e.navigate;return l.useCallback(async(s,a={})=>{let{action:c,method:u,encType:m,formData:h,body:g}=Ahe(s,n);if(a.navigate===!1){let x=a.fetcherKey||Xhe();await r(x,i,a.action||c,{preventScrollReset:a.preventScrollReset,formData:h,body:g,formMethod:a.method||u,formEncType:a.encType||m,flushSync:a.flushSync})}else await o(a.action||c,{preventScrollReset:a.preventScrollReset,formData:h,body:g,formMethod:a.method||u,formEncType:a.encType||m,replace:a.replace,state:a.state,fromRouteId:i,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,o,n,i])}function Zhe(e,{relative:n}={}){let{basename:i}=l.useContext(Dd),r=l.useContext(Ld);lo(r,"useFormAction must be used inside a RouteContext");let[o]=r.matches.slice(-1),s={...G_(e||".",{relative:n})},a=vo();if(e==null){s.search=a.search;let c=new URLSearchParams(s.search),u=c.getAll("index");if(u.some(h=>h==="")){c.delete("index"),u.filter(g=>g).forEach(g=>c.append("index",g));let h=c.toString();s.search=h?`?${h}`:""}}return(!e||e===".")&&o.route.index&&(s.search=s.search?s.search.replace(/^\?/,"?index&"):"?index"),i!=="/"&&(s.pathname=s.pathname==="/"?i:Tm([i,s.pathname])),g_(s)}function Jhe(e,{relative:n}={}){let i=l.useContext(Mte);lo(i!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=Vte("useViewTransitionState"),o=G_(e,{relative:n});if(!i.isTransitioning)return!1;let s=Dm(i.currentLocation.pathname,r)||i.currentLocation.pathname,a=Dm(i.nextLocation.pathname,r)||i.nextLocation.pathname;return pu(o.pathname,a)!=null||pu(o.pathname,s)!=null}var jr=Ate(),Ll=function(){return Ll=Object.assign||function(n){for(var i,r=1,o=arguments.length;r<o;r++){i=arguments[r];for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(n[s]=i[s])}return n},Ll.apply(this,arguments)};function y_(e,n,i){if(i||arguments.length===2)for(var r=0,o=n.length,s;r<o;r++)(s||!(r in n))&&(s||(s=Array.prototype.slice.call(n,0,r)),s[r]=n[r]);return e.concat(s||Array.prototype.slice.call(n))}var Qr="-ms-",e_="-moz-",er="-webkit-",Kte="comm",mP="rule",O8="decl",efe="@import",Yte="@keyframes",tfe="@layer",Xte=Math.abs,D8=String.fromCharCode,zE=Object.assign;function nfe(e,n){return Ws(e,0)^45?(((n<<2^Ws(e,0))<<2^Ws(e,1))<<2^Ws(e,2))<<2^Ws(e,3):0}function Qte(e){return e.trim()}function Cm(e,n){return(e=n.exec(e))?e[0]:e}function ui(e,n,i){return e.replace(n,i)}function d5(e,n,i){return e.indexOf(n,i)}function Ws(e,n){return e.charCodeAt(n)|0}function Eb(e,n,i){return e.slice(n,i)}function vp(e){return e.length}function Zte(e){return e.length}function Uj(e,n){return n.push(e),e}function ife(e,n){return e.map(n).join("")}function VL(e,n){return e.filter(function(i){return!Cm(i,n)})}var hP=1,Mb=1,Jte=0,zd=0,rs=0,s1="";function fP(e,n,i,r,o,s,a,c){return{value:e,root:n,parent:i,type:r,props:o,children:s,line:hP,column:Mb,length:a,return:"",siblings:c}}function sf(e,n){return zE(fP("",null,null,"",null,null,0,e.siblings),e,{length:-e.length},n)}function nx(e){for(;e.root;)e=sf(e.root,{children:[e]});Uj(e,e.siblings)}function rfe(){return rs}function ofe(){return rs=zd>0?Ws(s1,--zd):0,Mb--,rs===10&&(Mb=1,hP--),rs}function vu(){return rs=zd<Jte?Ws(s1,zd++):0,Mb++,rs===10&&(Mb=1,hP++),rs}function sy(){return Ws(s1,zd)}function u5(){return zd}
vendor: 24,382 bytes, lines 11-12
11function gP(e,n){return Eb(s1,e,n)}function TE(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function sfe(e){return hP=Mb=1,Jte=vp(s1=e),zd=0,[]}function afe(e){return s1="",e}function WN(e){return Qte(gP(zd-1,EE(e===91?e+2:e===40?e+1:e)))}function lfe(e){for(;(rs=sy())&&rs<33;)vu();return TE(e)>2||TE(rs)>3?"":" "}function cfe(e,n){for(;--n&&vu()&&!(rs<48||rs>102||rs>57&&rs<65||rs>70&&rs<97););return gP(e,u5()+(n<6&&sy()==32&&vu()==32))}function EE(e){for(;vu();)switch(rs){case e:return zd;case 34:case 39:e!==34&&e!==39&&EE(rs);break;case 40:e===41&&EE(e);break;case 92:vu();break}return zd}function dfe(e,n){for(;vu()&&e+rs!==57;)if(e+rs===84&&sy()===47)break;return"/*"+gP(n,zd-1)+"*"+D8(e===47?e:vu())}function ufe(e){for(;!TE(sy());)vu();return gP(e,zd)}function pfe(e){return afe(p5("",null,null,null,[""],e=sfe(e),0,[0],e))}function p5(e,n,i,r,o,s,a,c,u){for(var m=0,h=0,g=a,x=0,y=0,w=0,j=1,v=1,_=1,$=0,k="",P=o,S=s,I=r,A=k;v;)switch(w=$,$=vu()){case 40:if(w!=108&&Ws(A,g-1)==58){d5(A+=ui(WN($),"&","&\f"),"&\f",Xte(m?c[m-1]:0))!=-1&&(_=-1);break}case 34:case 39:case 91:A+=WN($);break;case 9:case 10:case 13:case 32:A+=lfe(w);break;case 92:A+=cfe(u5()-1,7);continue;case 47:switch(sy()){case 42:case 47:Uj(mfe(dfe(vu(),u5()),n,i,u),u);break;default:A+="/"}break;case 123*j:c[m++]=vp(A)*_;case 125*j:case 59:case 0:switch($){case 0:case 125:v=0;case 59+h:_==-1&&(A=ui(A,/\f/g,"")),y>0&&vp(A)-g&&Uj(y>32?YL(A+";",r,i,g-1,u):YL(ui(A," ","")+";",r,i,g-2,u),u);break;case 59:A+=";";default:if(Uj(I=KL(A,n,i,m,h,o,c,k,P=[],S=[],g,s),s),$===123)if(h===0)p5(A,n,I,I,P,s,g,c,S);else switch(x===99&&Ws(A,3)===110?100:x){case 100:case 108:case 109:case 115:p5(e,I,I,r&&Uj(KL(e,I,I,0,0,o,c,k,o,P=[],g,S),S),o,S,g,c,r?P:S);break;default:p5(A,I,I,I,[""],S,0,c,S)}}m=h=y=0,j=_=1,k=A="",g=a;break;case 58:g=1+vp(A),y=w;default:if(j<1){if($==123)--j;else if($==125&&j++==0&&ofe()==125)continue}switch(A+=D8($),$*j){case 38:_=h>0?1:(A+="\f",-1);break;case 44:c[m++]=(vp(A)-1)*_,_=1;break;case 64:sy()===45&&(A+=WN(vu())),x=sy(),h=g=vp(k=A+=ufe(u5())),$++;break;case 45:w===45&&vp(A)==2&&(j=0)}}return s}function KL(e,n,i,r,o,s,a,c,u,m,h,g){for(var x=o-1,y=o===0?s:[""],w=Zte(y),j=0,v=0,_=0;j<r;++j)for(var $=0,k=Eb(e,x+1,x=Xte(v=a[j])),P=e;$<w;++$)(P=Qte(v>0?y[$]+" "+k:ui(k,/&\f/g,y[$])))&&(u[_++]=P);return fP(e,n,i,o===0?mP:c,u,m,h,g)}function mfe(e,n,i,r){return fP(e,n,i,Kte,D8(rfe()),Eb(e,2,-2),0,r)}function YL(e,n,i,r,o){return fP(e,n,i,O8,Eb(e,0,r),Eb(e,r+1,-1),r,o)}function ene(e,n,i){switch(nfe(e,n)){case 5103:return er+"print-"+e+e;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return er+e+e;case 4789:return e_+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return er+e+e_+e+Qr+e+e;case 5936:switch(Ws(e,n+11)){case 114:return er+e+Qr+ui(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return er+e+Qr+ui(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return er+e+Qr+ui(e,/[svh]\w+-[tblr]{2}/,"lr")+e}case 6828:case 4268:case 2903:return er+e+Qr+e+e;case 6165:return er+e+Qr+"flex-"+e+e;case 5187:return er+e+ui(e,/(\w+).+(:[^]+)/,er+"box-$1$2"+Qr+"flex-$1$2")+e;case 5443:return er+e+Qr+"flex-item-"+ui(e,/flex-|-self/g,"")+(Cm(e,/flex-|baseline/)?"":Qr+"grid-row-"+ui(e,/flex-|-self/g,""))+e;case 4675:return er+e+Qr+"flex-line-pack"+ui(e,/align-content|flex-|-self/g,"")+e;case 5548:return er+e+Qr+ui(e,"shrink","negative")+e;case 5292:return er+e+Qr+ui(e,"basis","preferred-size")+e;case 6060:return er+"box-"+ui(e,"-grow","")+er+e+Qr+ui(e,"grow","positive")+e;case 4554:return er+ui(e,/([^-])(transform)/g,"$1"+er+"$2")+e;case 6187:return ui(ui(ui(e,/(zoom-|grab)/,er+"$1"),/(image-set)/,er+"$1"),e,"")+e;case 5495:case 3959:return ui(e,/(image-set\([^]*)/,er+"$1$`$1");case 4968:return ui(ui(e,/(.+:)(flex-)?(.*)/,er+"box-pack:$3"+Qr+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+er+e+e;case 4200:if(!Cm(e,/flex-|baseline/))return Qr+"grid-column-align"+Eb(e,n)+e;break;case 2592:case 3360:return Qr+ui(e,"template-","")+e;case 4384:case 3616:return i&&i.some(function(r,o){return n=o,Cm(r.props,/grid-\w+-end/)})?~d5(e+(i=i[n].value),"span",0)?e:Qr+ui(e,"-start","")+e+Qr+"grid-row-span:"+(~d5(i,"span",0)?Cm(i,/\d+/):+Cm(i,/\d+/)-+Cm(e,/\d+/))+";":Qr+ui(e,"-start","")+e;case 4896:case 4128:return i&&i.some(function(r){return Cm(r.props,/grid-\w+-start/)})?e:Qr+ui(ui(e,"-end","-span"),"span ","")+e;case 4095:case 3583:case 4068:case 2532:return ui(e,/(.+)-inline(.+)/,er+"$1$2")+e;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(vp(e)-1-n>6)switch(Ws(e,n+1)){case 109:if(Ws(e,n+4)!==45)break;case 102:return ui(e,/(.+:)(.+)-([^]+)/,"$1"+er+"$2-$3$1"+e_+(Ws(e,n+3)==108?"$3":"$2-$3"))+e;case 115:return~d5(e,"stretch",0)?ene(ui(e,"stretch","fill-available"),n,i)+e:e}break;case 5152:case 5920:return ui(e,/(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/,function(r,o,s,a,c,u,m){return Qr+o+":"+s+m+(a?Qr+o+"-span:"+(c?u:+u-+s)+m:"")+e});case 4949:if(Ws(e,n+6)===121)return ui(e,":",":"+er)+e;break;case 6444:switch(Ws(e,Ws(e,14)===45?18:11)){case 120:return ui(e,/(.+:)([^;\s!]+)(;|(\s+)?!.+)?/,"$1"+er+(Ws(e,14)===45?"inline-":"")+"box$3$1"+er+"$2$3$1"+Qr+"$2box$3")+e;case 100:return ui(e,":",":"+Qr)+e}break;case 5719:case 2647:case 2135:case 3927:case 2391:return ui(e,"scroll-","scroll-snap-")+e}return e}function D5(e,n){for(var i="",r=0;r<e.length;r++)i+=n(e[r],r,e,n)||"";return i}function hfe(e,n,i,r){switch(e.type){case tfe:if(e.children.length)break;case efe:case O8:return e.return=e.return||e.value;case Kte:return"";case Yte:return e.return=e.value+"{"+D5(e.children,r)+"}";case mP:if(!vp(e.value=e.props.join(",")))return""}return vp(i=D5(e.children,r))?e.return=e.value+"{"+i+"}":""}function ffe(e){var n=Zte(e);return function(i,r,o,s){for(var a="",c=0;c<n;c++)a+=e[c](i,r,o,s)||"";return a}}function gfe(e){return function(n){n.root||(n=n.return)&&e(n)}}function yfe(e,n,i,r){if(e.length>-1&&!e.return)switch(e.type){case O8:e.return=ene(e.value,e.length,i);return;case Yte:return D5([sf(e,{value:ui(e.value,"@","@"+er)})],r);case mP:if(e.length)return ife(i=e.props,function(o){switch(Cm(o,r=/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":nx(sf(e,{props:[ui(o,/:(read-\w+)/,":"+e_+"$1")]})),nx(sf(e,{props:[o]})),zE(e,{props:VL(i,r)});break;case"::placeholder":nx(sf(e,{props:[ui(o,/:(plac\w+)/,":"+er+"input-$1")]})),nx(sf(e,{props:[ui(o,/:(plac\w+)/,":"+e_+"$1")]})),nx(sf(e,{props:[ui(o,/:(plac\w+)/,Qr+"input-$1")]})),nx(sf(e,{props:[o]})),zE(e,{props:VL(i,r)});break}return""})}}var xfe={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},Pc={},Rb=typeof process<"u"&&Pc!==void 0&&(Pc.REACT_APP_SC_ATTR||Pc.SC_ATTR)||"data-styled",tne="active",nne="data-styled-version",yP="6.1.19",L8=`/*!sc*/ 12`,L5=typeof window<"u"&&typeof document<"u",bfe=!!(typeof SC_DISABLE_SPEEDY=="boolean"?SC_DISABLE_SPEEDY:typeof process<"u"&&Pc!==void 0&&Pc.REACT_APP_SC_DISABLE_SPEEDY!==void 0&&Pc.REACT_APP_SC_DISABLE_SPEEDY!==""?Pc.REACT_APP_SC_DISABLE_SPEEDY!=="false"&&Pc.REACT_APP_SC_DISABLE_SPEEDY:typeof process<"u"&&Pc!==void 0&&Pc.SC_DISABLE_SPEEDY!==void 0&&Pc.SC_DISABLE_SPEEDY!==""&&Pc.SC_DISABLE_SPEEDY!=="false"&&Pc.SC_DISABLE_SPEEDY),xP=Object.freeze([]),Ob=Object.freeze({});function vfe(e,n,i){return i===void 0&&(i=Ob),e.theme!==i.theme&&e.theme||n||i.theme}var ine=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","track","u","ul","use","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"]),wfe=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,jfe=/(^-|-$)/g;function XL(e){return e.replace(wfe,"-").replace(jfe,"")}var _fe=/(a)(d)/gi,ck=52,QL=function(e){return String.fromCharCode(e+(e>25?39:97))};function ME(e){var n,i="";for(n=Math.abs(e);n>ck;n=n/ck|0)i=QL(n%ck)+i;return(QL(n%ck)+i).replace(_fe,"$1-$2")}var UN,rne=5381,cb=function(e,n){for(var i=n.length;i;)e=33*e^n.charCodeAt(--i);return e},one=function(e){return cb(rne,e)};function sne(e){return ME(one(e)>>>0)}function Cfe(e){return e.displayName||e.name||"Component"}function HN(e){return typeof e=="string"&&!0}var ane=typeof Symbol=="function"&&Symbol.for,lne=ane?Symbol.for("react.memo"):60115,Sfe=ane?Symbol.for("react.forward_ref"):60112,kfe={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},$fe={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},cne={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},Ife=((UN={})[Sfe]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},UN[lne]=cne,UN);function ZL(e){return("type"in(n=e)&&n.type.$$typeof)===lne?cne:"$$typeof"in e?Ife[e.$$typeof]:kfe;var n}var Pfe=Object.defineProperty,Afe=Object.getOwnPropertyNames,JL=Object.getOwnPropertySymbols,Nfe=Object.getOwnPropertyDescriptor,zfe=Object.getPrototypeOf,e9=Object.prototype;function dne(e,n,i){if(typeof n!="string"){if(e9){var r=zfe(n);r&&r!==e9&&dne(e,r,i)}var o=Afe(n);JL&&(o=o.concat(JL(n)));for(var s=ZL(e),a=ZL(n),c=0;c<o.length;++c){var u=o[c];if(!(u in $fe||i&&i[u]||a&&u in a||s&&u in s)){var m=Nfe(n,u);try{Pfe(e,u,m)}catch{}}}}return e}function Db(e){return typeof e=="function"}function B8(e){return typeof e=="object"&&"styledComponentId"in e}function Jg(e,n){return e&&n?"".concat(e," ").concat(n):e||n||""}function RE(e,n){if(e.length===0)return"";for(var i=e[0],r=1;r<e.length;r++)i+=e[r];return i}function x_(e){return e!==null&&typeof e=="object"&&e.constructor.name===Object.name&&!("props"in e&&e.$$typeof)}function OE(e,n,i){if(i===void 0&&(i=!1),!i&&!x_(e)&&!Array.isArray(e))return n;if(Array.isArray(n))for(var r=0;r<n.length;r++)e[r]=OE(e[r],n[r]);else if(x_(n))for(var r in n)e[r]=OE(e[r],n[r]);return e}function F8(e,n){Object.defineProperty(e,"toString",{value:n})}function V_(e){for(var n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];return new Error("An error occurred. See https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/utils/errors.md#".concat(e," for more information.").concat(n.length>0?" Args: ".concat(n.join(", ")):""))}var Tfe=(function(){function e(n){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=n}return e.prototype.indexOfGroup=function(n){for(var i=0,r=0;r<n;r++)i+=this.groupSizes[r];return i},e.prototype.insertRules=function(n,i){if(n>=this.groupSizes.length){for(var r=this.groupSizes,o=r.length,s=o;n>=s;)if((s<<=1)<0)throw V_(16,"".concat(n));this.groupSizes=new Uint32Array(s),this.groupSizes.set(r),this.length=s;for(var a=o;a<s;a++)this.groupSizes[a]=0}for(var c=this.indexOfGroup(n+1),u=(a=0,i.length);a<u;a++)this.tag.insertRule(c,i[a])&&(this.groupSizes[n]++,c++)},e.prototype.clearGroup=function(n){if(n<this.length){var i=this.groupSizes[n],r=this.indexOfGroup(n),o=r+i;this.groupSizes[n]=0;for(var s=r;s<o;s++)this.tag.deleteRule(r)}},e.prototype.getGroup=function(n){var i="";if(n>=this.length||this.groupSizes[n]===0)return i;for(var r=this.groupSizes[n],o=this.indexOfGroup(n),s=o+r,a=o;a<s;a++)i+="".concat(this.tag.getRule(a)).concat(L8);return i},e})(),m5=new Map,B5=new Map,h5=1,dk=function(e){if(m5.has(e))return m5.get(e);for(;B5.has(h5);)h5++;var n=h5++;return m5.set(e,n),B5.set(n,e),n},Efe=function(e,n){h5=n+1,m5.set(e,n),B5.set(n,e)},Mfe="style[".concat(Rb,"][").concat(nne,'="').concat(yP,'"]'),Rfe=new RegExp("^".concat(Rb,'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)')),Ofe=function(e,n,i){for(var r,o=i.split(","),s=0,a=o.length;s<a;s++)(r=o[s])&&e.registerName(n,r)},Dfe=function(e,n){for(var i,r=((i=n.textContent)!==null&&i!==void 0?i:"").split(L8),o=[],s=0,a=r.length;s<a;s++){var c=r[s].trim();if(c){var u=c.match(Rfe);if(u){var m=0|parseInt(u[1],10),h=u[2];m!==0&&(Efe(h,m),Ofe(e,h,u[3]),e.getTag().insertRules(m,o)),o.length=0}else o.push(c)}}},t9=function(e){for(var n=document.querySelectorAll(Mfe),i=0,r=n.length;i<r;i++){var o=n[i];o&&o.getAttribute(Rb)!==tne&&(Dfe(e,o),o.parentNode&&o.parentNode.removeChild(o))}};function Lfe(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:null}var une=function(e){var n=document.head,i=e||n,r=document.createElement("style"),o=(function(c){var u=Array.from(c.querySelectorAll("style[".concat(Rb,"]")));return u[u.length-1]})(i),s=o!==void 0?o.nextSibling:null;r.setAttribute(Rb,tne),r.setAttribute(nne,yP);var a=Lfe();return a&&r.setAttribute("nonce",a),i.insertBefore(r,s),r},Bfe=(function(){function e(n){this.element=une(n),this.element.appendChild(document.createTextNode("")),this.sheet=(function(i){if(i.sheet)return i.sheet;for(var r=document.styleSheets,o=0,s=r.length;o<s;o++){var a=r[o];if(a.ownerNode===i)return a}throw V_(17)})(this.element),this.length=0}return e.prototype.insertRule=function(n,i){try{return this.sheet.insertRule(i,n),this.length++,!0}catch{return!1}},e.prototype.deleteRule=function(n){this.sheet.deleteRule(n),this.length--},e.prototype.getRule=function(n){var i=this.sheet.cssRules[n];return i&&i.cssText?i.cssText:""},e})(),Ffe=(function(){function e(n){this.element=une(n),this.nodes=this.element.childNodes,this.length=0}return e.prototype.insertRule=function(n,i){if(n<=this.length&&n>=0){var r=document.createTextNode(i);return this.element.insertBefore(r,this.nodes[n]||null),this.length++,!0}return!1},e.prototype.deleteRule=function(n){this.element.removeChild(this.nodes[n]),this.length--},e.prototype.getRule=function(n){return n<this.length?this.nodes[n].textContent:""},e})(),Wfe=(function(){function e(n){this.rules=[],this.length=0}return e.prototype.insertRule=function(n,i){return n<=this.length&&(this.rules.splice(n,0,i),this.length++,!0)},e.prototype.deleteRule=function(n){this.rules.splice(n,1),this.length--},e.prototype.getRule=function(n){return n<this.length?this.rules[n]:""},e})(),n9=L5,Ufe={isServer:!L5,useCSSOMInjection:!bfe},pne=(function(){function e(n,i,r){n===void 0&&(n=Ob),i===void 0&&(i={});var o=this;this.options=Ll(Ll({},Ufe),n),this.gs=i,this.names=new Map(r),this.server=!!n.isServer,!this.server&&L5&&n9&&(n9=!1,t9(this)),F8(this,function(){return(function(s){for(var a=s.getTag(),c=a.length,u="",m=function(g){var x=(function(_){return B5.get(_)})(g);if(x===void 0)return"continue";var y=s.names.get(x),w=a.getGroup(g);if(y===void 0||!y.size||w.length===0)return"continue";var j="".concat(Rb,".g").concat(g,'[id="').concat(x,'"]'),v="";y!==void 0&&y.forEach(function(_){_.length>0&&(v+="".concat(_,","))}),u+="".concat(w).concat(j,'{content:"').concat(v,'"}').concat(L8)},h=0;h<c;h++)m(h);return u})(o)})}return e.registerId=function(n){return dk(n)},e.prototype.rehydrate=function(){!this.server&&L5&&t9(this)},e.prototype.reconstructWithOptions=function(n,i){return i===void 0&&(i=!0),new e(Ll(Ll({},this.options),n),this.gs,i&&this.names||void 0)},e.prototype.allocateGSInstance=function(n){return this.gs[n]=(this.gs[n]||0)+1},e.prototype.getTag=function(){return this.tag||(this.tag=(n=(function(i){var r=i.useCSSOMInjection,o=i.target;return i.isServer?new Wfe(o):r?new Bfe(o):new Ffe(o)})(this.options),new Tfe(n)));var n},e.prototype.hasNameForId=function(n,i){return this.names.has(n)&&this.names.get(n).has(i)},e.prototype.registerName=function(n,i){if(dk(n),this.names.has(n))this.names.get(n).add(i);else{var r=new Set;r.add(i),this.names.set(n,r)}},e.prototype.insertRules=function(n,i,r){this.registerName(n,i),this.getTag().insertRules(dk(n),r)},e.prototype.clearNames=function(n){this.names.has(n)&&this.names.get(n).clear()},e.prototype.clearRules=function(n){this.getTag().clearGroup(dk(n)),this.clearNames(n)},e.prototype.clearTag=function(){this.tag=void 0},e})(),Hfe=/&/g,qfe=/^\s*\/\/.*$/gm;function mne(e,n){return e.map(function(i){return i.type==="rule"&&(i.value="".concat(n," ").concat(i.value),i.value=i.value.replaceAll(",",",".concat(n," ")),i.props=i.props.map(function(r){return"".concat(n," ").concat(r)})),Array.isArray(i.children)&&i.type!=="@keyframes"&&(i.children=mne(i.children,n)),i})}function Gfe(e){var n,i,r,o=Ob,s=o.options,a=s===void 0?Ob:s,c=o.plugins,u=c===void 0?xP:c,m=function(x,y,w){return w.startsWith(i)&&w.endsWith(i)&&w.replaceAll(i,"").length>0?".".concat(n):x},h=u.slice();h.push(function(x){x.type===mP&&x.value.includes("&")&&(x.props[0]=x.props[0].replace(Hfe,i).replace(r,m))}),a.prefix&&h.push(yfe),h.push(hfe);var g=function(x,y,w,j){y===void 0&&(y=""),w===void 0&&(w=""),j===void 0&&(j="&"),n=j,i=y,r=new RegExp("\\".concat(i,"\\b"),"g");var v=x.replace(qfe,""),_=pfe(w||y?"".concat(w," ").concat(y," { ").concat(v," }"):v);a.namespace&&(_=mne(_,a.namespace));var $=[];return D5(_,ffe(h.concat(gfe(function(k){return $.push(k)})))),$};return g.hash=u.length?u.reduce(function(x,y){return y.name||V_(15),cb(x,y.name)},rne).toString():"",g}var Vfe=new pne,DE=Gfe(),hne=fr.createContext({shouldForwardProp:void 0,styleSheet:Vfe,stylis:DE});hne.Consumer;fr.createContext(void 0);function i9(){return l.useContext(hne)}var fne=(function(){function e(n,i){var r=this;this.inject=function(o,s){s===void 0&&(s=DE);var a=r.name+s.hash;o.hasNameForId(r.id,a)||o.insertRules(r.id,a,s(r.rules,a,"@keyframes"))},this.name=n,this.id="sc-keyframes-".concat(n),this.rules=i,F8(this,function(){throw V_(12,String(r.name))})}return e.prototype.getName=function(n){return n===void 0&&(n=DE),this.name+n.hash},e})(),Kfe=function(e){return e>="A"&&e<="Z"};function r9(e){for(var n="",i=0;i<e.length;i++){var r=e[i];if(i===1&&r==="-"&&e[0]==="-")return e;Kfe(r)?n+="-"+r.toLowerCase():n+=r}return n.startsWith("ms-")?"-"+n:n}var gne=function(e){return e==null||e===!1||e===""},yne=function(e){var n,i,r=[];for(var o in e){var s=e[o];e.hasOwnProperty(o)&&!gne(s)&&(Array.isArray(s)&&s.isCss||Db(s)?r.push("".concat(r9(o),":"),s,";"):x_(s)?r.push.apply(r,y_(y_(["".concat(o," {")],yne(s),!1),["}"],!1)):r.push("".concat(r9(o),": ").concat((n=o,(i=s)==null||typeof i=="boolean"||i===""?"":typeof i!="number"||i===0||n in xfe||n.startsWith("--")?String(i).trim():"".concat(i,"px")),";")))}return r};function ay(e,n,i,r){if(gne(e))return[];if(B8(e))return[".".concat(e.styledComponentId)];if(Db(e)){if(!Db(s=e)||s.prototype&&s.prototype.isReactComponent||!n)return[e];var o=e(n);return ay(o,n,i,r)}var s;return e instanceof fne?i?(e.inject(i,r),[e.getName(r)]):[e]:x_(e)?yne(e):Array.isArray(e)?Array.prototype.concat.apply(xP,e.map(function(a){return ay(a,n,i,r)})):[e.toString()]}function Yfe(e){for(var n=0;n<e.length;n+=1){var i=e[n];if(Db(i)&&!B8(i))return!1}return!0}var Xfe=one(yP),Qfe=(function(){function e(n,i,r){this.rules=n,this.staticRulesId="",this.isStatic=(r===void 0||r.isStatic)&&Yfe(n),this.componentId=i,this.baseHash=cb(Xfe,i),this.baseStyle=r,pne.registerId(i)}return e.prototype.generateAndInjectStyles=function(n,i,r){var o=this.baseStyle?this.baseStyle.generateAndInjectStyles(n,i,r):"";if(this.isStatic&&!r.hash)if(this.staticRulesId&&i.hasNameForId(this.componentId,this.staticRulesId))o=Jg(o,this.staticRulesId);else{var s=RE(ay(this.rules,n,i,r)),a=ME(cb(this.baseHash,s)>>>0);if(!i.hasNameForId(this.componentId,a)){var c=r(s,".".concat(a),void 0,this.componentId);i.insertRules(this.componentId,a,c)}o=Jg(o,a),this.staticRulesId=a}else{for(var u=cb(this.baseHash,r.hash),m="",h=0;h<this.rules.length;h++){var g=this.rules[h];if(typeof g=="string")m+=g;else if(g){var x=RE(ay(g,n,i,r));u=cb(u,x+h),m+=x}}if(m){var y=ME(u>>>0);i.hasNameForId(this.componentId,y)||i.insertRules(this.componentId,y,r(m,".".concat(y),void 0,this.componentId)),o=Jg(o,y)}}return o},e})(),xne=fr.createContext(void 0);xne.Consumer;var qN={};function Zfe(e,n,i){var r=B8(e),o=e,s=!HN(e),a=n.attrs,c=a===void 0?xP:a,u=n.componentId,m=u===void 0?(function(P,S){var I=typeof P!="string"?"sc":XL(P);qN[I]=(qN[I]||0)+1;var A="".concat(I,"-").concat(sne(yP+I+qN[I]));return S?"".concat(S,"-").concat(A):A})(n.displayName,n.parentComponentId):u,h=n.displayName,g=h===void 0?(function(P){return HN(P)?"styled.".concat(P):"Styled(".concat(Cfe(P),")")})(e):h,x=n.displayName&&n.componentId?"".concat(XL(n.displayName),"-").concat(n.componentId):n.componentId||m,y=r&&o.attrs?o.attrs.concat(c).filter(Boolean):c,w=n.shouldForwardProp;if(r&&o.shouldForwardProp){var j=o.shouldForwardProp;if(n.shouldForwardProp){var v=n.shouldForwardProp;w=function(P,S){return j(P,S)&&v(P,S)}}else w=j}var _=new Qfe(i,x,r?o.componentStyle:void 0);function $(P,S){return(function(I,A,E){var B=I.attrs,T=I.componentStyle,M=I.defaultProps,R=I.foldedComponentIds,F=I.styledComponentId,Y=I.target,H=fr.useContext(xne),U=i9(),X=I.shouldForwardProp||U.shouldForwardProp,Q=vfe(A,H,M)||Ob,K=(function(se,de,le){for(var me,ee=Ll(Ll({},de),{className:void 0,theme:le}),ne=0;ne<se.length;ne+=1){var Ae=Db(me=se[ne])?me(ee):me;for(var _e in Ae)ee[_e]=_e==="className"?Jg(ee[_e],Ae[_e]):_e==="style"?Ll(Ll({},ee[_e]),Ae[_e]):Ae[_e]}return de.className&&(ee.className=Jg(ee.className,de.className)),ee})(B,A,Q),G=K.as||Y,L={};for(var q in K)K[q]===void 0||q[0]==="$"||q==="as"||q==="theme"&&K.theme===Q||(q==="forwardedAs"?L.as=K.forwardedAs:X&&!X(q,G)||(L[q]=K[q]));var W=(function(se,de){var le=i9(),me=se.generateAndInjectStyles(de,le.styleSheet,le.stylis);return me})(T,K),oe=Jg(R,F);return W&&(oe+=" "+W),K.className&&(oe+=" "+K.className),L[HN(G)&&!ine.has(G)?"class":"className"]=oe,E&&(L.ref=E),l.createElement(G,L)})(k,P,S)}$.displayName=g;var k=fr.forwardRef($);return k.attrs=y,k.componentStyle=_,k.displayName=g,k.shouldForwardProp=w,k.foldedComponentIds=r?Jg(o.foldedComponentIds,o.styledComponentId):"",k.styledComponentId=x,k.target=r?o.target:e,Object.defineProperty(k,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(P){this._foldedDefaultProps=r?(function(S){for(var I=[],A=1;A<arguments.length;A++)I[A-1]=arguments[A];for(var E=0,B=I;E<B.length;E++)OE(S,B[E],!0);return S})({},o.defaultProps,P):P}}),F8(k,function(){return".".concat(k.styledComponentId)}),s&&dne(k,e,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0}),k}function o9(e,n){for(var i=[e[0]],r=0,o=n.length;r<o;r+=1)i.push(n[r],e[r+1]);return i}var s9=function(e){return Object.assign(e,{isCss:!0})};function Pp(e){for(var n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];if(Db(e)||x_(e))return s9(ay(o9(xP,y_([e],n,!0))));var r=e;return n.length===0&&r.length===1&&typeof r[0]=="string"?ay(r):s9(ay(o9(r,n)))}function LE(e,n,i){if(i===void 0&&(i=Ob),!n)throw V_(1,n);var r=function(o){for(var s=[],a=1;a<arguments.length;a++)s[a-1]=arguments[a];return e(n,i,Pp.apply(void 0,y_([o],s,!1)))};return r.attrs=function(o){return LE(e,n,Ll(Ll({}
12,i),{attrs:Array.prototype.concat(i.attrs,o).filter(Boolean)}))},r.withConfig=function(o){return LE(e,n,Ll(Ll({},i),o))},r}var bne=function(e){return LE(Zfe,e)},p=bne;ine.forEach(function(e){p[e]=bne(e)});function Tn(e){for(var n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];var r=RE(Pp.apply(void 0,y_([e],n,!1))),o=sne(r);return new fne(o,r)}const vne="X_theme",Jfe={"--color-white":"#ffffff","--color-black":"#000000","--color-gray-900":"#111827","--color-gray-500":"#6b7280","--color-gray-400":"#9ca3af","--color-gray-300":"#e5e7eb","--color-gray-200":"#e5e7eb","--color-gray-100":"#f3f4f6","--color-gray-50":"#F8F9FA","--color-grid-border":"#e7e5e4","--color-brand-50":"#eef2ff","--color-brand-600":"#4F46E5","--color-brand-700":"#4338CA","--color-brand-800":"#3730A3","--color-red-50":"#fef2f2","--color-red-200":"#fecaca","--color-red-500":"#ef4444","--color-red-600":"#dc2626","--color-red-700":"#b91c1c","--color-green-50":"#ecfdf5","--color-green-100":"#d1fae5","--color-green-200":"#a7f3d0","--color-green-500":"#10b981","--color-yellow-50":"#FFFBEB","--color-yellow-100":"#FEF3C7","--color-yellow-200":"#FDE68A","--color-yellow-500":"#D97706","--shadow-focus-brand":"rgba(79, 70, 229, 0.1)","--shadow-focus-danger":"rgba(239, 68, 68, 0.1)","--shadow-focus-success":"rgba(16, 185, 129, 0.1)","--shadow-elevated-sm":"0 4px 14px rgba(0, 0, 0, 0.06)","--shadow-elevated-lg":"0 12px 28px rgba(0, 0, 0, 0.10)","--shadow-toggle-knob":"0 1px 2px rgba(0, 0, 0, 0.2)","--color-code-inline-bg":"rgba(107,114,128,0.08)","--color-code-block-bg":"rgba(107,114,128,0.06)"},ege={"--color-white":"#0b1220","--color-black":"#000000","--color-gray-900":"#f9fafb","--color-gray-500":"#cbd5e1","--color-gray-400":"#94a3b8","--color-gray-300":"#334155","--color-gray-200":"#273244","--color-gray-100":"#1b2433","--color-gray-50":"#0f172a","--color-grid-border":"#223047","--color-brand-50":"#1a1a3e","--color-brand-600":"#7c7cf6","--color-brand-700":"#6a6af0","--color-brand-800":"#5a5ae5","--color-red-50":"#2a1115","--color-red-200":"#7f1d1d","--color-red-500":"#ef4444","--color-red-600":"#f87171","--color-red-700":"#fecaca","--color-green-50":"#0b1f1a","--color-green-100":"#0f2d25","--color-green-200":"#145a3b","--color-green-500":"#34d399","--color-yellow-50":"#1a1708","--color-yellow-100":"#2a2510","--color-yellow-200":"#5c4b12","--color-yellow-500":"#fbbf24","--shadow-focus-brand":"rgba(124, 124, 246, 0.18)","--shadow-focus-danger":"rgba(239, 68, 68, 0.18)","--shadow-focus-success":"rgba(52, 211, 153, 0.18)","--shadow-elevated-sm":"0 4px 18px rgba(0, 0, 0, 0.35)","--shadow-elevated-lg":"0 12px 36px rgba(0, 0, 0, 0.45)","--shadow-toggle-knob":"0 1px 3px rgba(0, 0, 0, 0.55)","--color-code-inline-bg":"rgba(148,163,184,0.16)","--color-code-block-bg":"rgba(148,163,184,0.10)"},a9={light:Jfe,dark:ege};function W8(e){return e==="dark"?"dark":"light"}function wne(){if(typeof window>"u")return null;try{const e=window.localStorage.getItem(vne);return e==="dark"||e==="light"?e:null}catch{return null}}function BE(e){if(!(typeof window>"u"))try{window.localStorage.setItem(vne,e)}catch{}}function F5(e){if(typeof document>"u")return;const n=document.documentElement,i=a9[e]||a9.light;Object.entries(i).forEach(([r,o])=>n.style.setProperty(r,o)),n.setAttribute("data-theme",e)}const Z="var(--color-white)",O="var(--color-gray-900)",z="var(--color-gray-500)",Pe="var(--color-gray-400)",Rt="var(--color-gray-300)",V="var(--color-gray-200)",$e="var(--color-gray-100)",At="var(--color-gray-50)",Cf="var(--color-grid-border)",mn="black",hn="transparent",cn="var(--color-brand-50)",ot="var(--color-brand-600)",Ft="var(--color-brand-700)",Kl="var(--color-brand-800)",kn="var(--color-red-50)",Er="var(--color-red-200)",Ut="var(--color-red-500)",oi="var(--color-red-600)",sr="var(--color-red-700)",si="var(--color-green-50)",Ry="var(--color-green-100)",Mo="var(--color-green-200)",Vt="var(--color-green-500)",Jl="var(--color-yellow-50)",Oy="var(--color-yellow-100)",K_="var(--color-yellow-200)",$i="var(--color-yellow-500)",En="var(--shadow-focus-brand)",U8="var(--shadow-focus-danger)",tge="var(--shadow-focus-success)",nge="var(--shadow-elevated-sm)",Y_="var(--shadow-elevated-lg)",ige="var(--shadow-toggle-knob)",jne="var(--color-code-inline-bg)",_ne="var(--color-code-block-bg)",rge=Z,oge=O,Cne=Pe,sge=Rt,l9=Ut,c9=Vt,age=ot,lge=$e,cge=En,dge=U8,uge=tge,pge=p.div.withConfig({displayName:"Input__InputWrapper",componentId:"sc-18ey605-0"})` 13 position: relative; 14 width: 100%; 15`,d9=p.div.withConfig({displayName:"Input__IconWrapper",componentId:"sc-18ey605-1"})` 16 position: absolute; 17 ${e=>e.$position==="left"?"left: 0.75rem;":"right: 0.75rem;"} 18 top: 50%; 19 transform: translateY(-50%); 20 color: ${Cne}; 21 pointer-events: ${e=>e.$interactive?"auto":"none"}; 22 display: flex; 23 align-items: center; 24 justify-content: center; 25 z-index: 1; 26`,mge=p.input.withConfig({displayName:"Input__StyledInput",componentId:"sc-18ey605-2"})` 27 width: ${e=>e.$fullWidth?"100%":"auto"}; 28 padding: ${e=>{const i={sm:"0.5rem",md:"0.75rem",lg:"1rem"}[e.$size],r=e.$hasLeftIcon?`calc(${i} + 1.75rem)`:i,o=e.$hasRightIcon?`calc(${i} + 1.75rem)`:i;return`${i} ${o} ${i} ${r}`}}; 29 border: 1px solid ${e=>e.$variant==="error"?l9:e.$variant==="success"?c9:sge}; 30 border-radius: 0.375rem; 31 font-size: ${e=>({sm:"0.75rem",md:"0.875rem",lg:"1rem"})[e.$size]}; 32 transition: border-color 0.2s, box-shadow 0.2s; 33 background-color: ${rge}; 34 color: ${oge}; 35 36 &:focus { 37 outline: none; 38 border-color: ${e=>e.$variant==="error"?l9:e.$variant==="success"?c9:age}; 39 box-shadow: 0 0 0 3px ${e=>e.$variant==="error"?dge:e.$variant==="success"?uge:cge}; 40 } 41 42 &:disabled { 43 background-color: ${lge};
44 cursor: not-allowed; 45 opacity: 0.6; 46 } 47 48 &::placeholder { 49 color: ${Cne}; 50 } 51 52 /* Theme the native calendar/clock icon for date/time inputs (Chrome/Safari). */ 53 &[type="date"], 54 &[type="datetime-local"], 55 &[type="month"], 56 &[type="time"], 57 &[type="week"] { 58 &::-webkit-calendar-picker-indicator { 59 opacity: 0.75; 60 } 61 62 /* In dark theme, the UA icon can render too dark; invert it. */ 63 :root[data-theme="dark"] &::-webkit-calendar-picker-indicator { 64 filter: invert(1); 65 opacity: 0.85; 66 } 67 } 68`,Xt=l.forwardRef(function({leftIcon:n,rightIcon:i,size:r="md",variant:o="default",fullWidth:s=!0,...a},c){return t.jsxs(pge,{children:[n&&t.jsx(d9,{$position:"left",children:n}),t.jsx(mge,{ref:c,$hasLeftIcon:!!n,$hasRightIcon:!!i,$size:r,$variant:o,$fullWidth:s,...a}),i&&t.jsx(d9,{$position:"right",$interactive:!0,children:i})]})});const hge=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),fge=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(n,i,r)=>r?r.toUpperCase():i.toLowerCase()),u9=e=>{const n=fge(e);return n.charAt(0).toUpperCase()+n.slice(1)},Sne=(...e)=>e.filter((n,i,r)=>!!n&&n.trim()!==""&&r.indexOf(n)===i).join(" ").trim(),gge=e=>{for(const n in e)if(n.startsWith("aria-")||n==="role"||n==="title")return!0};var yge={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 xge=l.forwardRef(({color:e="currentColor",size:n=24,strokeWidth:i=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:a,...c},u)=>l.createElement("svg",{ref:u,...yge,width:n,height:n,stroke:e,strokeWidth:r?Number(i)*24/Number(n):i,className:Sne("lucide",o),...!s&&!gge(c)&&{"aria-hidden":"true"},...c},[...a.map(([m,h])=>l.createElement(m,h)),...Array.isArray(s)?s:[s]]));const jt=(e,n)=>{const i=l.forwardRef(({className:r,...o},s)=>l.createElement(xge,{ref:s,iconNode:n,className:Sne(`lucide-${hge(u9(e))}`,`lucide-${e}`,r),...o}));return i.displayName=u9(e),i};const bge=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],gl=jt("activity",bge);const vge=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h2",key:"tvwodi"}],["path",{d:"M20 8v11a2 2 0 0 1-2 2h-2",key:"1gkqxj"}],["path",{d:"m9 15 3-3 3 3",key:"1pd0qc"}],["path",{d:"M12 12v9",key:"192myk"}]],p9=jt("archive-restore",vge);const wge=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]],m9=jt("archive",wge);const jge=[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"M20 8h-5",key:"1vsyxs"}],["path",{d:"M15 10V6.5a2.5 2.5 0 0 1 5 0V10",key:"ag13bf"}],["path",{d:"M15 14h5l-5 6h5",key:"ur5jdg"}]],h9=jt("arrow-down-a-z",jge);const _ge=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],kne=jt("arrow-down",_ge);const Cge=[["path",{d:"M8 3 4 7l4 4",key:"9rb6wj"}],["path",{d:"M4 7h16",key:"6tx8e3"}],["path",{d:"m16 21 4-4-4-4",key:"siv7j2"}],["path",{d:"M20 17H4",key:"h6l3hr"}]],Sge=jt("arrow-left-right",Cge);const kge=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],xy=jt("arrow-left",kge);const $ge=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],H8=jt("arrow-right",$ge);const Ige=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],q8=jt("arrow-up-down",Ige);const Pge=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],G8=jt("arrow-up-right",Pge);const Age=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],$ne=jt("arrow-up",Age);const Nge=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]],zge=jt("bell",Nge);const Tge=[["path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z",key:"yt0hxn"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}]],bP=jt("bolt",Tge);
68const Ege=[["path",{d:"M10 2v8l3-3 3 3V2",key:"sqw3rj"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}]],Mge=jt("book-marked",Ege);const Rge=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],vP=jt("book-open",Rge);const Oge=[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]],Dge=jt("bookmark",Oge);const Lge=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],Dy=jt("bot",Lge);const Bge=[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]],Ine=jt("braces",Bge);const Fge=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],wP=jt("brain",Fge);const Wge=[["path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16",key:"jecpp"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]],Uge=jt("briefcase",Wge);const Hge=[["path",{d:"M10 12h4",key:"a56b0p"}],["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M14 21v-3a2 2 0 0 0-4 0v3",key:"1rgiei"}],["path",{d:"M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2",key:"secmi2"}],["path",{d:"M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16",key:"16ra0t"}]],by=jt("building-2",Hge);const qge=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],a1=jt("calendar",qge);const Gge=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],Eu=jt("chart-column",Gge);const Vge=[["path",{d:"M5 21v-6",key:"1hz6c0"}],["path",{d:"M12 21V3",key:"1lcnhd"}],["path",{d:"M19 21V9",key:"unv183"}]],Gg=jt("chart-no-axes-column",Vge);const Kge=[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]],GN=jt("check-check",Kge);const Yge=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Zn=jt("check",Yge);const Xge=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],qn=jt("chevron-down",Xge);const Qge=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],Bd=jt("chevron-left",Qge);const Zge=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Gi=jt("chevron-right",Zge);const Jge=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],yu=jt("chevron-up",Jge);const eye=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],Sf=jt("circle-alert",eye);const tye=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}]],FE=jt("circle-arrow-up",tye);const nye=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],Pne=jt("circle-check-big",nye);const iye=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],co=jt("circle-check",iye);const rye=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"10",x2:"10",y1:"15",y2:"9",key:"c1nkhi"}],["line",{x1:"14",x2:"14",y1:"15",y2:"9",key:"h65svq"}]],WE=jt("circle-pause",rye);const oye=[["path",{d:"M18 20a6 6 0 0 0-12 0",key:"1qehca"}],["circle",{cx:"12",cy:"10",r:"4",key:"1h16sb"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Ane=jt("circle-user-round",oye);const sye=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],Hc=jt("circle-x",sye);const aye=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],lye=jt("circle",aye);const cye=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],qc=jt("clock",cye);
68const dye=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],V8=jt("code-xml",dye);const uye=[["circle",{cx:"8",cy:"8",r:"6",key:"3yglwk"}],["path",{d:"M18.09 10.37A6 6 0 1 1 10.34 18",key:"t5s6rm"}],["path",{d:"M7 6h1v4",key:"1obek4"}],["path",{d:"m16.71 13.88.7.71-2.82 2.82",key:"1rbuyh"}]],vy=jt("coins",uye);const pye=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]],mye=jt("columns-3",pye);const hye=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],so=jt("copy",hye);const fye=[["path",{d:"M20 20v-7a4 4 0 0 0-4-4H4",key:"1nkjon"}],["path",{d:"M9 14 4 9l5-5",key:"102s5s"}]],gye=jt("corner-up-left",fye);const yye=[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]],ow=jt("cpu",yye);const xye=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],wp=jt("credit-card",xye);const bye=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],f9=jt("database",bye);const vye=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],K8=jt("dollar-sign",vye);const wye=[["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"}]],wy=jt("download",wye);const jye=[["path",{d:"M21.54 15H17a2 2 0 0 0-2 2v4.54",key:"1djwo0"}],["path",{d:"M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17",key:"1tzkfa"}],["path",{d:"M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05",key:"14pb5j"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Nne=jt("earth",jye);const _ye=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]],zne=jt("ellipsis-vertical",_ye);const Cye=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],Sye=jt("ellipsis",Cye);const kye=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],as=jt("external-link",kye);const $ye=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],jP=jt("eye-off",$ye);const Iye=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Dc=jt("eye",Iye);const Pye=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Ss=jt("file-text",Pye);const Aye=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"m15 15-3-3-3 3",key:"15xj92"}]],Tne=jt("file-up",Aye);const Nye=[["path",{d:"M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4",key:"1nerag"}],["path",{d:"M14 13.12c0 2.38 0 6.38-1 8.88",key:"o46ks0"}],["path",{d:"M17.29 21.02c.12-.6.43-2.3.5-3.02",key:"ptglia"}],["path",{d:"M2 12a10 10 0 0 1 18-6",key:"ydlgp0"}],["path",{d:"M2 16h.01",key:"1gqxmh"}],["path",{d:"M21.8 16c.2-2 .131-5.354 0-6",key:"drycrb"}
68],["path",{d:"M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2",key:"1tidbn"}],["path",{d:"M8.65 22c.21-.66.45-1.32.57-2",key:"13wd9y"}],["path",{d:"M9 6.8a6 6 0 0 1 9 5.2v2",key:"1fr1j5"}]],g9=jt("fingerprint-pattern",Nye);const zye=[["path",{d:"M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528",key:"1jaruq"}]],Tye=jt("flag",zye);const Eye=[["path",{d:"M12 3q1 4 4 6.5t3 5.5a1 1 0 0 1-14 0 5 5 0 0 1 1-3 1 1 0 0 0 5 0c0-2-1.5-3-1.5-5q0-2 2.5-4",key:"1slcih"}]],y9=jt("flame",Eye);const Mye=[["path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z",key:"1fr9dc"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M12 10v2",key:"hh53o1"}],["path",{d:"M16 10v6",key:"1d6xys"}]],_P=jt("folder-kanban",Mye);const Rye=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],jy=jt("folder-open",Rye);const Oye=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],Y8=jt("folder",Oye);const Dye=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],UE=jt("funnel",Dye);const Lye=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],Ene=jt("gauge",Lye);const Bye=[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]],x9=jt("git-commit-horizontal",Bye);const Fye=[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M12 6h5a2 2 0 0 1 2 2v7",key:"1yj91y"}],["path",{d:"m15 9-3-3 3-3",key:"1lwv8l"}],["circle",{cx:"19",cy:"18",r:"3",key:"1qljk2"}],["path",{d:"M12 18H7a2 2 0 0 1-2-2V9",key:"16sdep"}],["path",{d:"m9 15 3 3-3 3",key:"1m3kbl"}]],Wye=jt("git-compare-arrows",Fye);const Uye=[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["path",{d:"M11 18H8a2 2 0 0 1-2-2V9",key:"19pyzm"}]],Hye=jt("git-compare",Uye);const qye=[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 21V9a9 9 0 0 0 9 9",key:"7kw0sc"}]],Gye=jt("git-merge",qye);const Vye=[["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"}]],To=jt("globe",Vye);const Kye=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],b9=jt("grip-vertical",Kye);const Yye=[["path",{d:"m11 17 2 2a1 1 0 1 0 3-3",key:"efffak"}],["path",{d:"m14 14 2.5 2.5a1 1 0 1 0 3-3l-3.88-3.88a3 3 0 0 0-4.24 0l-.88.88a1 1 0 1 1-3-3l2.81-2.81a5.79 5.79 0 0 1 7.06-.87l.47.28a2 2 0 0 0 1.42.25L21 4",key:"9pr0kb"}],["path",{d:"m21 3 1 11h-2",key:"1tisrp"}],["path",{d:"M3 3 2 14l6.5 6.5a1 1 0 1 0 3-3",key:"1uvwmv"}],["path",{d:"M3 4h8",key:"1ep09j"}]],Xye=jt("handshake",Yye);const Qye=[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]],sw=jt("hard-drive",Qye);const Zye=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],Jye=jt("hash",Zye);const e0e=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}],["path",{d:"M3.22 13H9.5l.5-1 2 4.5 2-7 1.5 3.5h5.27",key:"auskq0"}]],Mne=jt("heart-pulse",e0e);const t0e=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],n0e=jt("house",t0e);const i0e=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],r0e=jt("image",i0e);const o0e=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],wn=jt("info",o0e);const s0e=[["path",{d:"M5 3v14",key:"9nsxs2"}],["path",{d:"M12 3v8",key:"1h2ygw"}],["path",{d:"M19 3v18",key:"1sk56x"}]],a0e=jt("kanban",s0e);const l0e=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],Rc=jt("key-round",l0e);const c0e=[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]],VN=jt("languages",c0e);const d0e=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],CP=jt("layers",d0e);const u0e=[["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"}]],X8=jt("layout-dashboard",u0e);const p0e=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],m0e=jt("layout-grid",p0e);const h0e=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}],["path",{d:"M14 4h7",key:"3xa0d5"}],["path",{d:"M14 9h7",key:"1icrd9"}],["path",{d:"M14 15h7",key:"1mj8o2"}],["path",{d:"M14 20h7",key:"11slyb"}]],f0e=jt("layout-list",h0e);const g0e=[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]],y0e=jt("lightbulb",g0e);
68const x0e=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],xu=jt("link-2",x0e);const b0e=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],v0e=jt("link",b0e);const w0e=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}]],Rne=jt("list-checks",w0e);const j0e=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],_0e=jt("list",j0e);const C0e=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Tr=jt("loader-circle",C0e);const S0e=[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]],One=jt("loader",S0e);const k0e=[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{x:"3",y:"10",width:"18",height:"12",rx:"2",key:"6s8ecr"}],["path",{d:"M7 10V7a5 5 0 0 1 10 0v3",key:"1pqi11"}]],Dne=jt("lock-keyhole",k0e);const $0e=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],ku=jt("lock",$0e);const I0e=[["path",{d:"m10 17 5-5-5-5",key:"1bsop3"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}]],Lne=jt("log-in",I0e);const P0e=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],A0e=jt("log-out",P0e);const N0e=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]],bu=jt("mail",N0e);const z0e=[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]],_y=jt("map-pin",z0e);const T0e=[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]],E0e=jt("map",T0e);const M0e=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]],f5=jt("message-circle",M0e);const R0e=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M12 8v6",key:"1ib9pf"}],["path",{d:"M9 11h6",key:"1fldmi"}]],O0e=jt("message-square-plus",R0e);const D0e=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],t_=jt("message-square",D0e);const L0e=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],B0e=jt("minimize-2",L0e);const F0e=[["path",{d:"M5 12h14",key:"1ays0h"}]],Bne=jt("minus",F0e);const W0e=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],Lb=jt("monitor",W0e);const U0e=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],H0e=jt("moon",U0e);const q0e=[["polygon",{points:"3 11 22 2 13 21 11 13 3 11",key:"1ltx0t"}]],G0e=jt("navigation",q0e);const V0e=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],n_=jt("network",V0e);const K0e=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],Y0e=jt("palette",K0e);const X0e=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]],Q0e=jt("panel-left-close",X0e);const Z0e=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}
68]],J0e=jt("panel-left-open",Z0e);const exe=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],txe=jt("panel-left",exe);const nxe=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],Fne=jt("pause",nxe);const ixe=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],v9=jt("pen",ixe);const rxe=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],Lc=jt("pencil",rxe);const oxe=[["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"}]],eh=jt("play",oxe);const sxe=[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z",key:"1xoxul"}],["path",{d:"M9 8V2",key:"14iosj"}]],SP=jt("plug",sxe);const axe=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],gr=jt("plus",axe);const lxe=[["path",{d:"M18.36 6.64A9 9 0 0 1 20.77 15",key:"dxknvb"}],["path",{d:"M6.16 6.16a9 9 0 1 0 12.68 12.68",key:"1x7qb5"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],w9=jt("power-off",lxe);const cxe=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],j9=jt("power",cxe);const dxe=[["path",{d:"M2 3h20",key:"91anmk"}],["path",{d:"M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3",key:"2k9sn8"}],["path",{d:"m7 21 5-5 5 5",key:"bip4we"}]],W5=jt("presentation",dxe);const uxe=[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]],pxe=jt("quote",uxe);const mxe=[["path",{d:"M19.07 4.93A10 10 0 0 0 6.99 3.34",key:"z3du51"}],["path",{d:"M4 6h.01",key:"oypzma"}],["path",{d:"M2.29 9.62A10 10 0 1 0 21.31 8.35",key:"qzzz0"}],["path",{d:"M16.24 7.76A6 6 0 1 0 8.23 16.67",key:"1yjesh"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M17.99 11.66A6 6 0 0 1 15.77 16.67",key:"1u2y91"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"m13.41 10.59 5.66-5.66",key:"mhq4k0"}]],hxe=jt("radar",mxe);const fxe=[["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"}]],No=jt("refresh-cw",fxe);const gxe=[["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"}]],Q8=jt("rocket",gxe);const yxe=[["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"}]],vb=jt("rotate-ccw",yxe);const xxe=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],Wne=jt("rotate-cw",xxe);const bxe=[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]],vxe=jt("scroll-text",bxe);const wxe=[["path",{d:"m13.5 8.5-5 5",key:"1cs55j"}],["path",{d:"m8.5 8.5 5 5",key:"a8mexj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],jxe=jt("search-x",wxe);const _xe=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Cs=jt("search",_xe);const Cxe=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],_9=jt("send",Cxe);const Sxe=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],kP=jt("server",Sxe);const kxe=[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]],$xe=jt("settings-2",kxe);const Ixe=[["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"}]],Bc=jt("settings",Ixe);const Pxe=[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]],Z8=jt("share-2",Pxe);const Axe=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",ke
68y:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],g5=jt("shield-alert",Axe);const Nxe=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],th=jt("shield-check",Nxe);const zxe=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m14.5 9.5-5 5",key:"17q4r4"}],["path",{d:"m9.5 9.5 5 5",key:"18nt4w"}]],y5=jt("shield-x",zxe);const Txe=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],Yl=jt("shield",Txe);const Exe=[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]],Une=jt("sliders-horizontal",Exe);const Mxe=[["path",{d:"M22 11v1a10 10 0 1 1-9-10",key:"ew0xw9"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}],["path",{d:"M16 5h6",key:"1vod17"}],["path",{d:"M19 2v6",key:"4bpg5p"}]],Rxe=jt("smile-plus",Mxe);const Oxe=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}
68],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],Sn=jt("sparkles",Oxe);const Dxe=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],Lxe=jt("sun",Dxe);const Bxe=[["polyline",{points:"14.5 17.5 3 6 3 3 6 3 17.5 14.5",key:"1hfsw2"}],["line",{x1:"13",x2:"19",y1:"19",y2:"13",key:"1vrmhu"}],["line",{x1:"16",x2:"20",y1:"16",y2:"20",key:"1bron3"}],["line",{x1:"19",x2:"21",y1:"21",y2:"19",key:"13pww6"}],["polyline",{points:"14.5 6.5 18 3 21 3 21 6 17.5 9.5",key:"hbey2j"}],["line",{x1:"5",x2:"9",y1:"14",y2:"18",key:"1hf58s"}],["line",{x1:"7",x2:"4",y1:"17",y2:"20",key:"pidxm4"}],["line",{x1:"3",x2:"5",y1:"19",y2:"21",key:"1pehsh"}]],Fxe=jt("swords",Bxe);const Wxe=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],X_=jt("tag",Wxe);const Uxe=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],$P=jt("target",Uxe);const Hxe=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],Hne=jt("terminal",Hxe);const qxe=[["path",{d:"M21 5H3",key:"1fi0y6"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 19H3",key:"z6ezky"}]],Gxe=jt("text-align-start",qxe);const Vxe=[["circle",{cx:"9",cy:"12",r:"3",key:"u3jwor"}],["rect",{width:"20",height:"14",x:"2",y:"5",rx:"7",key:"g7kal2"}]],C9=jt("toggle-left",Vxe);const Kxe=[["circle",{cx:"15",cy:"12",r:"3",key:"1afu0r"}],["rect",{width:"20",height:"14",x:"2",y:"5",rx:"7",key:"g7kal2"}]],S9=jt("toggle-right",Kxe);const Yxe=[["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"}]],Fi=jt("trash-2",Yxe);const Xxe=[["path",{d:"M16 17h6v-6",key:"t6n2it"}],["path",{d:"m22 17-8.5-8.5-5 5L2 7",key:"x473p"}]],ul=jt("trending-down",Xxe);const Qxe=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],qi=jt("trending-up",Qxe);const Zxe=[["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"}]],ei=jt("triangle-alert",Zxe);const Jxe=[["path",{d:"M10 14.66v1.626a2 2 0 0 1-.976 1.696A5 5 0 0 0 7 21.978",key:"1n3hpd"}],["path",{d:"M14 14.66v1.626a2 2 0 0 0 .976 1.696A5 5 0 0 1 17 21.978",key:"rfe1zi"}],["path",{d:"M18 9h1.5a1 1 0 0 0 0-5H18",key:"7xy6bh"}],["path",{d:"M4 22h16",key:"57wxv0"}],["path",{d:"M6 9a6 6 0 0 0 12 0V3a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1z",key:"1mhfuq"}],["path",{d:"M6 9H4.5a1 1 0 0 1 0-5H6",key:"tex48p"}]],ebe=jt("trophy",Jxe);const tbe=[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]],J8=jt("undo-2",tbe);const nbe=[["path",{d:"m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71",key:"yqzxt4"}],["path",{d:"m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71",key:"4qinb0"}],["line",{x1:"8",x2:"8",y1:"2",y2:"5",key:"1041cp"}],["line",{x1:"2",x2:"5",y1:"8",y2:"8",key:"14m1p5"}],["line",{x1:"16",x2:"16",y1:"19",y2:"22",key:"rzdirn"}],["line",{x1:"19",x2:"22",y1:"16",y2:"16",key:"ox905f"}]],k9=jt("unlink",nbe);const ibe=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],qne=jt("user-plus",ibe);const rbe=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],Hj=jt("user",rbe);const obe=[["path",{d:"M18 21a8 8 0 0 0-16 0",key:"3ypg7q"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"M22 20c0-3.37-2-6.5-4-8a5 5 0 0 0-.45-8.3",key:"10s06x"}]],sbe=jt("users-round",obe);const abe=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],Ap=jt("users",abe);const lbe=[["path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1",key:"18etb6"}],["path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4",key:"xoc0q4"}]],$9=jt("wallet",lbe);const cbe=[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]],Lm=jt("wand-sparkles",cbe);
68const dbe=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]],Gne=jt("workflow",dbe);const ube=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],Ef=jt("wrench",ube);const pbe=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ei=jt("x",pbe);const mbe=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Ks=jt("zap",mbe),hbe=p.button.withConfig({displayName:"PasswordInput__ToggleButton",componentId:"sc-1oie8fa-0"})` 69 background: none; 70 border: none; 71 color: ${Pe}; 72 cursor: pointer; 73 padding: 0.25rem; 74 display: inline-flex; 75 align-items: center; 76 justify-content: center; 77 transition: color 0.15s ease; 78 79 &:hover { 80 color: ${O}; 81 } 82 83 &:focus-visible { 84 outline: none; 85 box-shadow: 0 0 0 3px ${En}; 86 border-radius: 0.5rem; 87 color: ${ot}; 88 } 89`,Em=l.forwardRef(function({defaultVisible:n=!1,toggleLabels:i,...r},o){const[s,a]=l.useState(n),c=l.useMemo(()=>i||{show:"Show password",hide:"Hide password"},[i]);return t.jsx(Xt,{ref:o,...r,type:s?"text":"password",rightIcon:t.jsx(hbe,{type:"button",onClick:()=>a(u=>!u),"aria-label":s?c.hide:c.show,title:s?c.hide:c.show,children:s?t.jsx(jP,{size:20}):t.jsx(Dc,{size:20})})})}),aw=ot,uk=Ft,KN=Kl,fbe=Ut,gbe=oi,ybe=sr,pk=Z,I9=O,xbe=Rt,bbe=Pe,P9=Z,vbe="transparent",wbe=$e,A9=At,jbe=V,N9=$e,_be=En,ix=e=>{switch(e){case"primary":return{backgroundColor:aw,color:pk,border:"none",hoverBackground:uk,activeBackground:KN,hoverBorder:"none"};case"nav":return{backgroundColor:aw,color:pk,border:"none",hoverBackground:uk,activeBackground:KN,hoverBorder:"none"};case"navOutline":return{backgroundColor:P9,color:aw,border:`1px solid ${aw}`,hoverBackground:A9,activeBackground:N9,hoverBorder:uk};case"outline":return{backgroundColor:P9,color:I9,border:`1px solid ${xbe}`,hoverBackground:A9,activeBackground:N9,hoverBorder:bbe};case"ghost":return{backgroundColor:vbe,color:I9,border:"none",hoverBackground:wbe,activeBackground:jbe,hoverBorder:"none"};case"danger":return{backgroundColor:fbe,color:pk,border:"none",hoverBackground:gbe,activeBackground:ybe,hoverBorder:"none"};default:return{backgroundColor:aw,color:pk,border:"none",hoverBackground:uk,activeBackground:KN,hoverBorder:"none"}}},z9=p.span.withConfig({displayName:"Button__IconWrapper",componentId:"sc-9l08y0-0"})` 90 display: inline-flex; 91 align-items: center; 92 justify-content: center; 93 flex-shrink: 0; 94 line-height: 1; 95`,Cbe=p.button.withConfig({displayName:"Button__StyledButton",componentId:"sc-9l08y0-1"})` 96 width: ${e=>e.$fullWidth?"100%":"auto"}; 97 padding: ${e=>({sm:"0.5rem 1rem",md:"0.75rem 1.5rem",lg:"1rem 2rem"})[e.$size]}; 98 background-color: ${e=>ix(e.$variant).backgroundColor}; 99 color: ${e=>ix(e.$variant).color}; 100 border: ${e=>{const n=ix(e.$variant);return n.border==="none"?"1px solid transparent":n.border}}; 101 border-radius: 0.375rem; 102 font-size: ${e=>({sm:"0.75rem",md:"0.875rem",lg:"1rem"})[e.$size]}; 103 font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 104 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 105 sans-serif; 106 font-weight: 500; 107 line-height: 1.5; 108 cursor: pointer; 109 display: inline-flex; 110 align-items: center; 111 justify-content: center; 112 gap: 0.5rem; 113 transition: background-color 0.2s, border-color 0.2s, color 0.2s; 114 white-space: nowrap; 115 box-sizing: border-box; 116 height: ${e=>({sm:"2rem",md:"2.75rem",lg:"3.5rem"})[e.$size]}; 117 118 /* Compact navigation button variant (used in onboarding CTAs) */ 119 ${e=>e.$variant==="nav"||e.$variant==="navOutline"?` 120 height: 2.5rem; 121 padding: 0.5rem 1.25rem; 122 min-width: 9.5rem; 123 font-size: 0.875rem; 124 `:""} 125 126 &:hover:not(:disabled) { 127 background-color: ${e=>
127ix(e.$variant).hoverBackground}; 128 border-color: ${e=>ix(e.$variant).hoverBorder}; 129 } 130 131 &:active:not(:disabled) { 132 background-color: ${e=>ix(e.$variant).activeBackground}; 133 } 134 135 &:disabled { 136 opacity: 0.6; 137 cursor: not-allowed; 138 } 139 140 &:focus { 141 outline: none; 142 box-shadow: 0 0 0 3px ${_be}; 143 } 144`;function he({variant:e="primary",size:n="md",fullWidth:i=!1,leftIcon:r,rightIcon:o,children:s,...a}){return t.jsxs(Cbe,{$variant:e,$size:n,$fullWidth:i,...a,children:[r&&t.jsx(z9,{children:r}),s,o&&t.jsx(z9,{children:o})]})}const eM="X_access_token",tM="X_refresh_token",Q_=["/signin","/signup","/auth/callback","/auth/google-analytics/callback","/auth/partner","/forgot-password","/reset-password","/invite"],nM=["/report/s/","/site-audit-report/s/"],Td=()=>"https://api.ceyo.ai",Bb=()=>localStorage.getItem(eM),x5=()=>localStorage.getItem(tM),b_=(e,n)=>{localStorage.setItem(eM,e),localStorage.setItem(tM,n)},Im=()=>{localStorage.removeItem(eM),localStorage.removeItem(tM),sessionStorage.removeItem("X_google_oauth_state"),sessionStorage.removeItem("X_google_oauth_nonce"),sessionStorage.removeItem("X_google_oauth_success")},Vne=e=>{if(!e)return!0;try{const n=e.trim().split(".")[1];if(!n)return!0;const i=n.replace(/-/g,"+").replace(/_/g,"/"),r=i.padEnd(i.length+(4-i.length%4)%4,"="),s=JSON.parse(atob(r)).exp;return s?Date.now()>=s*1e3-6e4:!1}catch(n){return console.error("Error parsing token:",n),!0}};let lw=null;const Sbe=()=>{if(!(typeof window>"u"))try{window.dispatchEvent(new CustomEvent("auth:tokens_updated"))}catch{}},T9=()=>{if(typeof window>"u")return!1;const e=window.location.pathname;return Q_.includes(e)},kbe=async e=>lw||(lw=(async()=>{const n=x5();if(!n)return!1;const i=await fetch(`${e}/api/v1/auth/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refresh_token:n})});if(!i.ok)return!1;const r=await i.json().catch(()=>null);return!r?.access_token||!r?.refresh_token?!1:(b_(r.access_token,r.refresh_token),Sbe(),!0)})().finally(()=>{lw=null}),lw),ue=async(e,n)=>{try{const i=Bb(),r=Td();let o=e;typeof e=="string"&&!e.startsWith("http://")&&!e.startsWith("https://")&&(o=`${r}${e.startsWith("/")?e:`/${e}`}`);const s=new Headers(n?.headers),a=typeof FormData<"u"&&n?.body instanceof FormData;n?.body&&!a&&!s.has("Content-Type")&&s.set("Content-Type","application/json"),i&&!s.has("Authorization")&&s.set("Authorization",`Bearer ${i}`);const c={...n,headers:s},u=await fetch(o,c);if(u.status===401){if(!i&&!T9())return Im(),window.location.assign("/signin"),u;if(!i||T9()||(typeof o=="string"?o:o.toString()).includes("/api/v1/auth/refresh"))return u;const g=(await u.clone().json().catch(()=>null))?.error_code;if(g==="access_token_expired"){if(!await kbe(r))return Im(),window.location.assign("/signin"),u;const y=Bb();if(!y)return Im(),window.location.assign("/signin"),u;const w=new Headers(n?.headers),j=typeof FormData<"u"&&n?.body instanceof FormData;return n?.body&&!j&&!w.has("Content-Type")&&w.set("Content-Type","application/json"),w.set("Authorization",`Bearer ${y}`),fetch(o,{...n,headers:w})}else{if(g==="invalid_keys")return Im(),window.location.assign("/signin"),u;if(g==="invalid_token")return Im(),window.location.assign("/signin"),u}}return u}catch(i){throw console.log("fetchWithAuth error: ",i),i}},b5=l.createContext(null);function yn(){const e=l.useContext(b5);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e}const iM="X_pending_invite_token",rM="X_pending_invite_set_at",$be=10080*60*1e3;function oM(e){if(typeof window>"u")return;const n=e?.toString().trim();n&&(sessionStorage.setItem(iM,n),sessionStorage.setItem(rM,String(Date.now())))}function Cp(){typeof window>"u"||(sessionStorage.removeItem(iM),sessionStorage.removeItem(rM))}function wb(){if(typeof window>"u")return null;const e=sessionStorage.getItem(iM);if(!e)return null;const n=sessionStorage.getItem(rM),i=n?Number(n):NaN;return!Number.isFinite(i)||Date.now()-i>$be?(Cp(),null):e}function Kne(){const[e,n]=l.useState(!1),[i,r]=l.useState(null),{login:o}=yn(),[s,a]=l.useState(!1);return l.useEffect(()=>{if(window.google?.accounts){a(!0);return}const u=setInterval(()=>{window.google?.accounts&&(a(!0),clearInterval(u))},100),m=setTimeout(()=>{clearInterval(u),window.google?.accounts||r("Failed to load Google Identity Services")},1e4);return()=>{clearInterval(u),clearTimeout(m)}},[]),{handleGoogleSignIn:l.useCallback(()=>
144{if(!s){r("Google Identity Services is still loading. Please try again.");return}const u="3060223414-c3ngohsct14tfnijh2srgbp8vgss8rh5.apps.googleusercontent.com";n(!0),r(null);try{const g=(window.screen.width-500)/2,x=(window.screen.height-600)/2,y=`${window.location.origin}/auth/callback`,w=encodeURIComponent(y),j=encodeURIComponent("openid email profile"),v=Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15),_=Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15);sessionStorage.setItem("X_google_oauth_state",_),sessionStorage.setItem("X_google_oauth_nonce",v);const $=`https://accounts.google.com/o/oauth2/v2/auth?client_id=${u}&redirect_uri=${w}&response_type=id_token&scope=${j}&nonce=${v}&state=${_}`,k=window.open($,"Google Sign In",`width=500,height=600,left=${g},top=${x},toolbar=no,location=no,status=no,menubar=no`);if(!k){n(!1),r("Popup blocked. Please allow popups for this site.");return}let P=null,S=null;const I=()=>{P&&(clearInterval(P),P=null),S&&(clearTimeout(S),S=null),window.removeEventListener("message",A)},A=E=>{if(E.origin===window.location.origin){if(E.data.type==="GOOGLE_OAUTH_SUCCESS"&&E.data.id_token){I();try{k.close()}catch{}n(!1);const B=wb();ue("/api/v1/auth/google_verify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id_token:E.data.id_token,...B?{invite_token:B}:{}})}).then(async T=>{if(T.ok){const M=await T.json();M.access_token&&M.refresh_token&&M.user?(localStorage.setItem("X_last_auth","google"),o(M.access_token,M.refresh_token,M.user)):r("Invalid response from server")}else{const M=await T.json(),R=M?.errors?.error_code?String(M.errors.error_code):null;R==="invite_invalid"||R==="invite_inactive"||R==="invite_email_mismatch"?(Cp(),r(R==="invite_email_mismatch"?"This invitation link is for a different email address. Please continue with the invited email, or request a new invitation.":"This invitation link is invalid or has expired. Please request a new invitation.")):r(M.error||"Authentication failed")}}).catch(T=>{console.error("Error verifying Google token:",T),r("Network error. Please try again.")})}else if(E.data.type==="GOOGLE_OAUTH_ERROR"){I();try{k.close()}catch{}n(!1),r(E.data.error||"Google authentication failed")}}};window.addEventListener("message",A),S=setTimeout(()=>{I(),n(!1),sessionStorage.getItem("X_google_oauth_success")||r("Sign-in timed out. Please try again."),sessionStorage.removeItem("X_google_oauth_success");try{k.close()}catch{}},300*1e3),P=setInterval(()=>{try{k.closed&&(I(),n(!1),sessionStorage.getItem("X_google_oauth_success")||r("Sign-in was cancelled"),sessionStorage.removeItem("X_google_oauth_success"))}catch{}},500)}catch(m){console.error("Error initializing Google sign-in:",m),n(!1),r("Failed to initialize Google sign-in")}},[s,o]),isGoogleLoading:e,googleError:i}}const Ibe=At,Yne=O,Pbe=z,sM=Pe,Abe=Rt,E9=Cf,M9=Rt,Nbe=ot,Bm=p.div.withConfig({displayName:"style__Container",componentId:"sc-i8o9mv-0"})` 145 min-height: 100vh; 146 display: flex; 147 flex-direction: column; 148 149 @media (min-width: 1024px) { 150 flex-direction: row; 151 } 152`,Fm=p.div.withConfig({displayName:"style__FormSection",componentId:"sc-i8o9mv-1"})` 153 width: 100%; 154 flex: 1; 155 display: flex; 156 align-items: center; 157 justify-content: center; 158 padding: 2rem 1.5rem; 159 background-color: ${Ibe}; 160 position: relative; 161 order: 2; /* Appears second on mobile */ 162 163 @media (min-width: 1024px) { 164 width: 50%; 165 flex: 0 0 50%; 166 padding: 2rem; 167 order: 1; /* Appears first on desktop */ 168 } 169 170 /* Dashed Top Full Width Fade Grid */ 171 &::before { 172 content: ''; 173 position: absolute; 174 inset: 0; 175 z-index: 0; 176 background-image: 177 linear-gradient(to right, ${E9} 1px, ${hn} 1px), 178 linear-gradient(to bottom, ${E9} 1px, ${hn} 1px); 179 background-size: 20px 20px; 180 background-position: 0 0, 0 0; 181 mask-image: 182 repeating-linear-gradient( 183 to right, 184 ${mn} 0px, 185 ${mn} 3px, 186 ${hn} 3px, 187 ${hn} 8px 188 ), 189 repeating-linear-gradient( 190 to bottom, 191 ${mn} 0px, 192 ${mn} 3px, 193 ${hn} 3px, 194 ${hn} 8px 195 ), 196 linear-gradient(to bottom, ${mn} 0%, ${mn} 40%, ${hn} 70%); 197 -webkit-mask-image: 198 repeating-linear-gradient( 199 to right, 200 ${mn} 0px, 201 ${mn} 3px, 202 ${hn} 3px, 203 ${hn} 8px 204 ), 205 repeating-linear-gradient( 206 to bottom, 207 ${mn} 0px, 208 ${mn} 3px, 209 ${hn} 3px, 210 ${hn} 8px 211 ), 212 linear-gradient(to bottom, ${mn} 0%, ${mn} 40%, ${hn} 70%); 213 mask-composite: intersect; 214 -webkit-mask-composite: source-in; 215 pointer-events: none; 216 } 217 218 /* Subtle divider line on the right edge (desktop only) */ 219 &::after { 220 content: ''; 221 position: absolute; 222 right: 0; 223 top: 0; 224 bottom: 0; 225 width: 1px; 226 background: linear-gradient( 227 to bottom, 228 transparent 0%, 229 ${M9} 10%, 230 ${M9} 90%, 231 transparent 100% 232 ); 233 z-index: 1; 234 pointer-events: none; 235 display: none; 236 237 @media (min-width: 1024px) { 238 display: block; 239 } 240 } 241`,Wm=p.div.withConfig({displayName:"style__FormContainer",componentId:"sc-i8o9mv-2"})` 242 width: 100%; 243 max-width: 28rem; 244 position: relative; 245 z-index: 1; 246 247 @media (max-width: 1023px) { 248 max-width: 100%; 249 padding: 0; 250 } 251`,Um=p.div.withConfig({displayName:"style__Card",componentId:"sc-i8o9mv-3"})` 252 border: none; 253 box-shadow: none; 254`,Hm=p.div.withConfig({displayName:"style__CardHeader",componentId:"sc-i8o9mv-4"})` 255 display: flex; 256 flex-direction: column; 257 space-y: 0.25rem; 258 margin-bottom: 1.5rem; 259`,kf=p.h1.withConfig({displayName:"style__CardTitle",componentId:"sc-i8o9mv-5"})` 260 font-size: 1.875rem; 261 font-weight: 700; 262 line-height: 2.25rem; 263 margin-bottom: 0.5rem; 264 color: ${Yne}; 265`,$f=p.p.withConfig({displayName:"style__CardDescription",componentId:"sc-i8o9mv-6"})` 266 color: ${Pbe}; 267 font-size: 0.875rem; 268`,Z_=p.form.withConfig({displayName:"style__Form",componentId:"sc-i8o9mv-7"})` 269 display: flex; 270 flex-direction: column; 271 gap: 1.5rem; 272`,Cy=p.div.withConfig({displayName:"style__FormGroup",componentId:"sc-i8o9mv-8"})` 273 display: flex; 274 flex-direction: column; 275 gap: 0.5rem; 276`;p.button.withConfig({displayName:"style__ToggleButton",componentId:"sc-i8o9mv-9"})` 277 background: none; 278 border: none; 279 color: ${sM}; 280 cursor: pointer; 281 padding: 0.25rem; 282 display: flex; 283 align-items: center; 284 justify-content: center; 285 transition: color 0.2s; 286 287 &:hover { 288 color: ${Yne}; 289 } 290`;const Xne=p.div.withConfig({displayName:"style__Divider",componentId:"sc-i8o9mv-10"})` 291 position: relative; 292 margin: 0rem 1rem; 293 display: flex; 294 align-items: center; 295 justify-content: center; 296 gap: 0.75rem; 297`,U5=p.div.withConfig({displayName:"style__DividerLine",componentId:"sc-i8o9mv-11"})` 298 flex: 1; 299 height: 1px; 300 background-color: ${Abe}; 301`,Qne=p.div.withConfig({displayName:"style__DividerText",componentId:"sc-i8o9mv-12"})` 302 font-size: 0.75rem; 303 text-transform: uppercase; 304 color: ${sM}; 305 white-space: nowrap; 306`,Zne=p.div.withConfig({displayName:"style__StyledGoogleIcon",componentId:"sc-i8o9mv-13"})` 307 display: inline-flex; 308 align-items: center; 309 justify-content: center; 310 width: 18px; 311 height: 18px; 312 313 svg { 314 width: 18px; 315 height: 18px; 316 } 317`,Jne=p.button.withConfig({displayName:"style__GoogleSignInBtn",componentId:"sc-i8o9mv-14"})` 318 width: 100%; 319 height: 2.75rem; 320 display: inline-flex; 321 align-items: center; 322 justify-content: center; 323 gap: 0.625rem; 324 padding: 0 1.25rem; 325 background: ${Z}; 326 color: ${O}; 327 font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; 328 font-size: 0.875rem; 329 font-weight: 500; 330 line-height: 1.5; 331 border: 1px solid ${Rt}; 332 border-radius: 0.375rem; 333 cursor: pointer; 334 transition: background-color 0.15s, border-color 0.15s, box-shadow 0.15s; 335 white-space: nowrap; 336 337 &:hover:not(:disabled) { 338 background: ${At}; 339 border-color: ${Pe}; 340 box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08); 341 } 342 343 &:active:not(:disabled) { 344 background: ${$e}; 345 } 346 347 &:disabled { 348 opacity: 0.6;
349 cursor: not-allowed; 350 } 351 352 &:focus-visible { 353 outline: none; 354 box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2); 355 } 356`,zbe=p.p.withConfig({displayName:"style__SignInLink",componentId:"sc-i8o9mv-15"})` 357 text-align: center; 358 font-size: 0.875rem; 359 color: ${sM}; 360 margin-top: 1rem; 361 362 a { 363 color: ${Nbe}; 364 text-decoration: none; 365 font-weight: 500; 366 transition: text-decoration 0.2s; 367 368 &:hover { 369 text-decoration: underline; 370 } 371 } 372`,_p=p.div.withConfig({displayName:"style__ErrorMessage",componentId:"sc-i8o9mv-16"})` 373 color: ${Ut}; 374 font-size: 0.75rem; 375 margin-top: 0.25rem; 376 min-height: 1rem; 377`,Mm=p.div.withConfig({displayName:"style__FormError",componentId:"sc-i8o9mv-17"})` 378 color: ${Ut}; 379 font-size: 0.875rem; 380 text-align: center; 381 padding: 0.75rem; 382 background-color: ${kn}; 383 border: 1px solid ${Er}; 384 border-radius: 0.375rem; 385 margin-bottom: 0.5rem; 386`,eie=p.div.withConfig({displayName:"style__FormSuccess",componentId:"sc-i8o9mv-18"})` 387 color: ${Vt}; 388 font-size: 0.875rem; 389 text-align: center; 390 padding: 0.75rem; 391 background-color: ${Ry}; 392 border: 1px solid ${Mo}; 393 border-radius: 0.375rem; 394 margin-bottom: 0.5rem; 395`,Tbe=p(Dn).withConfig({displayName:"SignInstyle__ForgotLink",componentId:"sc-4ucrwd-0"})` 396 font-size: 0.875rem; 397 color: ${ot}; 398 text-decoration: none; 399 font-weight: 500; 400 transition: text-decoration 0.2s; 401 402 &:hover { 403 text-decoration: underline; 404 } 405`,Ebe=p.p.withConfig({displayName:"SignInstyle__SignUpLink",componentId:"sc-4ucrwd-1"})` 406 text-align: center; 407 font-size: 0.875rem; 408 color: ${Pe}; 409 margin-top: 1rem; 410 411 a { 412 color: ${ot}; 413 text-decoration: none; 414 font-weight: 500; 415 transition: text-decoration 0.2s; 416 417 &:hover { 418 text-decoration: underline; 419 } 420 } 421`,Mbe=(e,n)=>l.createElement("svg",{fill:"currentColor",fillRule:"evenodd",height:"1em",style:{flex:"none",lineHeight:1},viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",ref:n,...e},l.createElement("title",null,"Gemini"),l.createElement("path",{d:"M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z"})),wu=l.forwardRef(Mbe),Rbe=(e,n)=>l.createElement("svg",{fill:"currentColor",fillRule:"evenodd",height:"1em",style:{flex:"none",lineHeight:1},viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",ref:n,...e},l.createElement("title",null,"Claude"),l.createElement("path",{d:"M4.709 15.955l4.72-2.647.08-.23-.08-.128H9.2l-.79-.048-2.698-.073-2.339-.097-2.266-.122-.571-.121L0 11.784l.055-.352.48-.321.686.06 1.52.103 2.278.158 1.652.097 2.449.255h.389l.055-.157-.134-.098-.103-.097-2.358-1.596-2.552-1.688-1.336-.972-.724-.491-.364-.462-.158-1.008.656-.722.881.06.225.061.893.686 1.908 1.476 2.491 1.833.365.304.145-.103.019-.073-.164-.274-1.355-2.446-1.446-2.49-.644-1.032-.17-.619a2.97 2.97 0 01-.104-.729L6.283.134 6.696 0l.996.134.42.364.62 1.414 1.002 2.229 1.555 3.03.456.898.243.832.091.255h.158V9.01l.128-1.706.237-2.095.23-2.695.08-.76.376-.91.747-.492.584.28.48.685-.067.444-.286 1.851-.559 2.903-.364 1.942h.212l.243-.242.985-1.306 1.652-2.064.73-.82.85-.904.547-.431h1.033l.76 1.129-.34 1.166-1.064 1.347-.881 1.142-1.264 1.7-.79 1.36.073.11.188-.02 2.856-.606 1.543-.28 1.841-.315.833.388.091.395-.328.807-1.969.486-2.309.462-3.439.813-.042.03.049.061 1.549.146.662.036h1.622l3.02.225.79.522.474.638-.079.485-1.215.62-1.64-.389-3.829-.91-1.312-.329h-.182v.11l1.093 1.068 2.006 1.81 2.509 2.33.127.578-.322.455-.34-.049-2.205-1.657-.851-.747-1.926-1.62h-.128v.17l.444.649 2.345 3.521.122 1.08-.17.353-.608.213-.668-.122-1.374-1.925-1.415-2.167-1.143-1.943-.14.08-.674 7.254-.316.37-.729.28-.607-.461-.322-.747.322-1.476.389-1.924.315-1.53.286-1.9.17-.632-.012-.042-.14.018-1.434 1.967-2.18 2.945-1.726 1.845-.414.164-.717-.37.067-.662.401-.589 2.388-3.036 1.44-1.882.93-1.086-.006-.158h-.055L4.132 18.56l-1.13.146-.487-.456.061-.746.231-.243 1.908-1.312-.006.006z"})),nh=l.forwardRef(Rbe),Obe=(e,n)=>l.createElement("svg",{fill:"currentColor",fillRule:"evenodd",height:"1em",style:{flex:"none",lineHeight:1},viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",ref:n,...e},l.createElement("title",null,"OpenAI"),l.createElement("path",{d:"M21.55 10.004a5.416 5.416 0 00-.478-4.501c-1.217-2.09-3.662-3.166-6.05-2.66A5.59 5.59 0 0010.831 1C8.39.995 6.224 2.546 5.473 4.838A5.553 5.553 0 001.76 7.496a5.487 5.487 0 00.691 6.5 5.416 5.416 0 00.477 4.502c1.217 2.09 3.662 3.165 6.05 2.66A5.586 5.586 0 0013.168 23c2.443.006 4.61-1.546 5.361-3.84a5.553 5.553 0 003.715-2.66 5.488 5.488 0 00-.693-6.497v.001zm-8.381 11.558a4.199 4.199 0 01-2.675-.954c.034-.018.093-.05.132-.074l4.44-2.53a.71.71 0 00.364-.623v-6.176l1.877 1.069c.02.01.033.029.036.05v5.115c-.003 2.274-1.87 4.118-4.174 4.123zM4.192 17.78a4.059 4.059 0 01-.498-2.763c.032.02.09.055.131.078l4.44 2.53c.225.13.504.13.73 0l5.42-3.088v2.138a.068.068 0 01-.027.057L9.9 19.288c-1.999 1.136-4.552.46-5.707-1.51h-.001zM3.023 8.216A4.15 4.15 0 015.198 6.41l-.002.151v5.06a.711.711 0 00.364.624l5.42 3.087-1.876 1.07a.067.067 0 01-.063.005l-4.489-2.559c-1.995-1.14-2.679-3.658-1.53-5.63h.001zm15.417 3.54l-5.42-3.088L14.896 7.6a.067.067 0 01.063-.006l4.489 2.557c1.998 1.14 2.683 3.662 1.529 5.633a4.163 4.163 0 01-2.174 1.807V12.38a.71.71 0 00-.363-.623zm1.867-2.773a6.04 6.04 0 00-.132-.078l-4.44-2.53a.731.731 0 00-.729 0l-5.42 3.088V7.325a.068.068 0 01.027-.057L14.1 4.713c2-1.137 4.555-.46 5.707 1.513.487.833.664 1.809.499 2.757h.001zm-11.741 3.81l-1.877-1.068a.065.065 0 01-.036-.051V6.559c.001-2.277 1.873-4.122 4.181-4.12.976 0 1.92.338 2.671.954-.034.018-.092.05-.131.073l-4.44 2.53a.71.71 0 00-.365.623l-.003 6.173v.002zm1.02-2.168L12 9.25l2.414 1.375v2.75L12 14.75l-2.415-1.375v-2.75z"})),ju=l.forwardRef(Obe),Dbe=(e,n)=>l.createElement("svg",{fill:"currentColor",fillRule:"evenodd",height:"1em",style:{flex:"none",lineHeight:1},viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",ref:n,...e},l.createElement("title",null,"Perplexity"),l.createElement("path",{d:"M19.785 0v7.272H22.5V17.62h-2.935V24l-7.037-6.194v6.145h-1.091v-6.152L4.392 24v-6.465H1.5V7.188h2.884V0l7.053 6.494V.19h1.09v6.49L19.786 0zm-7.257 9.044v7.319l5.946 5.234V14.44l-5.946-5.397zm-1.099-.08l-5.946 5.398v7.235l5.946-5.234V8.965zm8.136 7.58h1.844V8.349H13.46l6.105 5.54v2.655zm-8.982-8.28H2.59v8.195h1.8v-2.576l6.192-5.62zM5.475 2.476v4.71h5.115l-5.115-4.71zm13.219 0l-5.115 4.71h5.115v-4.71z"}
421)),ih=l.forwardRef(Dbe),Lbe=(e,n)=>l.createElement("svg",{height:"1em",style:{flex:"none",lineHeight:1},viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",ref:n,...e},l.createElement("title",null,"Google"),l.createElement("path",{d:"M23 12.245c0-.905-.075-1.565-.236-2.25h-10.54v4.083h6.186c-.124 1.014-.797 2.542-2.294 3.569l-.021.136 3.332 2.53.23.022C21.779 18.417 23 15.593 23 12.245z",fill:"#4285F4"}),l.createElement("path",{d:"M12.225 23c3.03 0 5.574-.978 7.433-2.665l-3.542-2.688c-.948.648-2.22 1.1-3.891 1.1a6.745 6.745 0 01-6.386-4.572l-.132.011-3.465 2.628-.045.124C4.043 20.531 7.835 23 12.225 23z",fill:"#34A853"}),l.createElement("path",{d:"M5.84 14.175A6.65 6.65 0 015.463 12c0-.758.138-1.491.361-2.175l-.006-.147-3.508-2.67-.115.054A10.831 10.831 0 001 12c0 1.772.436 3.447 1.197 4.938l3.642-2.763z",fill:"#FBBC05"}),l.createElement("path",{d:"M12.225 5.253c2.108 0 3.529.892 4.34 1.638l3.167-3.031C17.787 2.088 15.255 1 12.225 1 7.834 1 4.043 3.469 2.197 7.062l3.63 2.763a6.77 6.77 0 016.398-4.572z",fill:"#EB4335"})),ya=l.forwardRef(Lbe),Bbe=(e,n)=>l.createElement("svg",{fill:"currentColor",fillRule:"evenodd",height:"1em",style:{flex:"none",lineHeight:1},viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",ref:n,...e},l.createElement("title",null,"Grok"),l.createElement("path",{d:"M9.27 15.29l7.978-5.897c.391-.29.95-.177 1.137.272.98 2.369.542 5.215-1.41 7.169-1.951 1.954-4.667 2.382-7.149 1.406l-2.711 1.257c3.889 2.661 8.611 2.003 11.562-.953 2.341-2.344 3.066-5.539 2.388-8.42l.006.007c-.983-4.232.242-5.924 2.75-9.383.06-.082.12-.164.179-.248l-3.301 3.305v-.01L9.267 15.292M7.623 16.723c-2.792-2.67-2.31-6.801.071-9.184 1.761-1.763 4.647-2.483 7.166-1.425l2.705-1.25a7.808 7.808 0 00-1.829-1A8.975 8.975 0 005.984 5.83c-2.533 2.536-3.33 6.436-1.962 9.764 1.022 2.487-.653 4.246-2.34 6.022-.599.63-1.199 1.259-1.682 1.925l7.62-6.815"})),Mf=l.forwardRef(Bbe),Fbe=(e,n)=>l.createElement("svg",{fill:"currentColor",fillRule:"evenodd",height:"1em",style:{flex:"none",lineHeight:1},viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",ref:n,...e},l.createElement("title",null,"GithubCopilot"),l.createElement("path",{d:"M19.245 5.364c1.322 1.36 1.877 3.216 2.11 5.817.622 0 1.2.135 1.592.654l.73.964c.21.278.323.61.323.955v2.62c0 .339-.173.669-.453.868C20.239 19.602 16.157 21.5 12 21.5c-4.6 0-9.205-2.583-11.547-4.258-.28-.2-.452-.53-.453-.868v-2.62c0-.345.113-.679.321-.956l.73-.963c.392-.517.974-.654 1.593-.654l.029-.297c.25-2.446.81-4.213 2.082-5.52 2.461-2.54 5.71-2.851 7.146-2.864h.198c1.436.013 4.685.323 7.146 2.864zm-7.244 4.328c-.284 0-.613.016-.962.05-.123.447-.305.85-.57 1.108-1.05 1.023-2.316 1.18-2.994 1.18-.638 0-1.306-.13-1.851-.464-.516.165-1.012.403-1.044.996a65.882 65.882 0 00-.063 2.884l-.002.48c-.002.563-.005 1.126-.013 1.69.002.326.204.63.51.765 2.482 1.102 4.83 1.657 6.99 1.657 2.156 0 4.504-.555 6.985-1.657a.854.854 0 00.51-.766c.03-1.682.006-3.372-.076-5.053-.031-.596-.528-.83-1.046-.996-.546.333-1.212.464-1.85.464-.677 0-1.942-.157-2.993-1.18-.266-.258-.447-.661-.57-1.108-.32-.032-.64-.049-.96-.05zm-2.525 4.013c.539 0 .976.426.976.95v1.753c0 .525-.437.95-.976.95a.964.964 0 01-.976-.95v-1.752c0-.525.437-.951.976-.951zm5 0c.539 0 .976.426.976.95v1.753c0 .525-.437.95-.976.95a.964.964 0 01-.976-.95v-1.752c0-.525.437-.951.976-.951zM7.635 5.087c-1.05.102-1.935.438-2.385.906-.975 1.037-.765 3.668-.21 4.224.405.394 1.17.657 1.995.657h.09c.649-.013 1.785-.176 2.73-1.11.435-.41.705-1.433.675-2.47-.03-.834-.27-1.52-.63-1.813-.39-.336-1.275-.482-2.265-.394zm6.465.394c-.36.292-.6.98-.63 1.813-.03 1.037.24 2.06.675 2.47.968.957 2.136 1.104 2.776 1.11h.044c.825 0 1.59-.263 1.995-.657.555-.556.765-3.187-.21-4.224-.45-.468-1.335-.804-2.385-.906-.99-.088-1.875.058-2.265.394zM12 7.615c-.24 0-.525.015-.84.044.03.16.045.336.06.526l-.001.159a2.94 2.94 0 01-.014.25c.225-.022.425-.027.612-.028h.366c.187 0 .387.006.612.028-.015-.146-.015-.277-.015-.409.015-.19.03-.365.06-.526a9.29 9.29 0 00-.84-.044z"})),Rf=l.forwardRef(Fbe),Wbe=(e,n)=>l.createElement("svg",{fill:"currentColor",fillRule:"evenodd",height:"1em",style:{flex:"none",lineHeight:1},viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",ref:n,...e},l.createElement("title",null,"You.com"),l.createElement("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm3.8 5.4l-2.85 4.35V16a.95.95 0 11-1.9 0v-4.25L8.2 7.4a.95.95 0 011.6-1.03L12 9.9l2.2-3.53a.95.95 0 011.6 1.03z"})),Ube=l.forwardRef(Wbe),Hbe=(e,n)=>l.createElement("svg",{fill:"currentColor",fillRule:"evenodd",height:"1em",style:{flex:"none",lineHeight:1},viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",ref:n,...e},l.createElement("title",null,"phind"),l.createElement("path",{d:"M3.723 4.542V24H7.37v-7.893s.00
4217 0 .007.007V15.6c1.249 1.201 2.818 2.034 4.555 2.319.418.062.844.097 1.276.097 4.325-.125 8.07-3.332 8.699-7.733a8.916 8.916 0 00-1.723-6.678A9.017 9.017 0 0014.228.092a9.023 9.023 0 00-6.71 1.715c-.238.173-.46.36-.677.555L4.288.321 2 3.153l1.723 1.389zM13 3.306a5.69 5.69 0 015.392 3.853 5.655 5.655 0 01-3.9 7.275 5.57 5.57 0 01-1.492.194c-.976 0-1.89-.243-2.692-.673a5.519 5.519 0 01-1.863-1.59 5.462 5.462 0 01-1.067-2.568 5.355 5.355 0 01-.063-.826c0-3.131 2.546-5.665 5.685-5.665z"})),qbe=l.forwardRef(Hbe),Gbe=(e,n)=>l.createElement("svg",{fill:"currentColor",fillRule:"evenodd",height:"1em",style:{flex:"none",lineHeight:1},viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",ref:n,...e},l.createElement("title",null,"Poe"),l.createElement("path",{d:"M20.708 6.876a1.412 1.412 0 00-1.029-.415h-.006a2.019 2.019 0 01-2.02-2.023A1.415 1.415 0 0016.254 3H4.871A1.412 1.412 0 003.47 4.434a2.026 2.026 0 01-2.025 2.025v.002A1.414 1.414 0 000 7.883v3.642a1.414 1.414 0 001.444 1.42 2.025 2.025 0 012.025 2.02v3.693a.5.5 0 00.89.313l2.051-2.567h9.843a1.412 1.412 0 001.4-1.434v-.002c0-1.12.904-2.025 2.026-2.025a1.412 1.412 0 001.446-1.42V7.88c0-.363-.14-.727-.417-1.005zm-2.42 4.687a2.025 2.025 0 01-2.025 2.005H4.861a2.025 2.025 0 01-2.025-2.005v-3.72A2.026 2.026 0 014.86 5.838h11.4a2.026 2.026 0 012.026 2.005v3.72h.002z"}),l.createElement("path",{d:"M7.413 7.57A1.422 1.422 0 005.99 8.99v1.422a1.422 1.422 0 102.844 0V8.99c0-.784-.636-1.422-1.422-1.422zm6.297 0a1.422 1.422 0 00-1.422 1.421v1.422a1.422 1.422 0 102.844 0V8.99c0-.784-.636-1.422-1.422-1.422z"}),l.createElement("path",{d:"M7.292 22.643l1.993-2.492h9.844a1.413 1.413 0 001.4-1.434 2.025 2.025 0 012.017-2.027h.01A1.409 1.409 0 0024 15.27v-3.594c0-.344-.113-.68-.324-.951l-.397-.519v4.127a1.415 1.415 0 01-1.444 1.42h-.007a2.026 2.026 0 00-2.018 2.025 1.415 1.415 0 01-1.402 1.436H8.565l-2.169 2.712a.574.574 0 00.896.715v.002z",fill:"url(#lobe-icons-poe-fill-0)"}),l.createElement("path",{d:"M5.004 19.992l2.12-2.65h9.844a1.414 1.414 0 001.402-1.437c0-1.116.9-2.021 2.014-2.025h.012a1.413 1.413 0 001.443-1.422v-4.13l.52.68c.21.273.324.607.324.95v3.594a1.416 1.416 0 01-1.443 1.42h-.01a2.026 2.026 0 00-2.016 2.026 1.414 1.414 0 01-1.402 1.435H7.97l-1.916 2.4a.671.671 0 01-1.049-.839v-.002z",fill:"url(#lobe-icons-poe-fill-1)"}),l.createElement("defs",null,l.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",id:"lobe-icons-poe-fill-0",x1:34.01,x2:1.086,y1:7.303,y2:27.715},l.createElement("stop",{stopColor:"#46A6F7"}),l.createElement("stop",{offset:1,stopColor:"#8364FF"})),l.createElement("linearGradient",{gradientUnits:"userSpaceOnUse",id:"lobe-icons-poe-fill-1",x1:4.915,x2:24.34,y1:23.511,y2:9.464},l.createElement("stop",{stopColor:"#FF44D3"}),l.createElement("stop",{offset:1,stopColor:"#CF4BFF"})))),Vbe=l.forwardRef(Gbe);function i_(e){let n=e[0],i=e[1],r=e[2];return Math.sqrt(n*n+i*i+r*r)}function HE(e,n){return e[0]=n[0],e[1]=n[1],e[2]=n[2],e}function Kbe(e,n,i,r){return e[0]=n,e[1]=i,e[2]=r,e}function R9(e,n,i){return e[0]=n[0]+i[0],e[1]=n[1]+i[1],e[2]=n[2]+i[2],e}function O9(e,n,i){return e[0]=n[0]-i[0],e[1]=n[1]-i[1],e[2]=n[2]-i[2],e}function Ybe(e,n,i){return e[0]=n[0]*i[0],e[1]=n[1]*i[1],e[2]=n[2]*i[2],e}function Xbe(e,n,i){return e[0]=n[0]/i[0],e[1]=n[1]/i[1],e[2]=n[2]/i[2],e}function YN(e,n,i){return e[0]=n[0]*i,e[1]=n[1]*i,e[2]=n[2]*i,e}function Qbe(e,n){let i=n[0]-e[0],r=n[1]-e[1],o=n[2]-e[2];return Math.sqrt(i*i+r*r+o*o)}function Zbe(e,n){let i=n[0]-e[0],r=n[1]-e[1],o=n[2]-e[2];return i*i+r*r+o*o}function D9(e){let n=e[0],i=e[1],r=e[2];return n*n+i*i+r*r}function Jbe(e,n){return e[0]=-n[0],e[1]=-n[1],e[2]=-n[2],e}function e1e(e,n){return e[0]=1/n[0],e[1]=1/n[1],e[2]=1/n[2],e}function qE(e,n){let i=n[0],r=n[1],o=n[2],s=i*i+r*r+o*o;return s>0&&(s=1/Math.sqrt(s)),e[0]=n[0]*s,e[1]=n[1]*s,e[2]=n[2]*s,e}function tie(e,n){return e[0]*n[0]+e[1]*n[1]+e[2]*n[2]}function L9(e,n,i){let r=n[0],o=n[1],s=n[2],a=i[0],c=i[1],u=i[2];return e[0]=o*u-s*c,e[1]=s*a-r*u,e[2]=r*c-o*a,e}function t1e(e,n,i,r){let o=n[0],s=n[1],a=n[2];return e[0]=o+r*(i[0]-o),e[1]=s+r*(i[1]-s),e[2]=a+r*(i[2]-a),e}function n1e(e,n,i,r,o){const s=Math.exp(-r*o);let a=n[0],c=n[1],u=n[2];return e[0]=i[0]+(a-i[0])*s,e[1]=i[1]+(c-i[1])*s,e[2]=i[2]+(u-i[2])*s,e}function i1e(e,n,i){let r=n[0],o=n[1],s=n[2],a=i[3]*r+i[7]*o+i[11]*s+i[15];return a=a||1,e[0]=(i[0]*r+i[4]*o+i[8]*s+i[12])/a,e[1]=(i[1]*r+i[5]*o+i[9]*s+i[13])/a,e[2]=(i[2]*r+i[6]*o+i[10]*s+i[14])/a,e}function r1e(e,n,i){let r=n[0],o=n[1],s=n[2],a=i[3]*r+i[7]*o+i[11]*s+i[15];return a=a||1,e[0]=(i[0]*r+i[4]*o+i[8]*s)/a,e[1]=(i[1]*r+i[5]*o+i[9]*s)/a,e[2]=(i[2]*r+i[6]*o+i[10]*s)/a,e}function o1e(e,n,i){let r=n[0],o=n[1],s=n[2];return e[0]=r*i[0]+o*i[3]+s*i[6],e[1]=r*i[1]+o*i[4]+s*i[7],e[2]=r*i[2]+o*i[5]+s*i[8],e}function s1e(e,n,i){let r=n[0],o=n[1],s=n[2],a=i[0],c=i[1],u=i[2],m=i[3],h=c*s-u*o,g=u*r-a*s,x=a*o-c*r,y=c*x-u*g,w=u*h-a*x,j=a*g-c*h,v=m*2;return h*=v,g*=v,x*=v,y*=2,w*=2,j*=2,e[0]=r+h+y,e[1]=o+g+w,e[2]=s+x+j,e}const a1e=(function(){const e=[0,0,0],n=[0,0,0];return function(i,r){HE(e,i),HE(n,r),qE(e,e),qE(n,n);let o=tie(e,n);return o>1?0:o<-1?Math.PI:Math.acos(o)}})();function l1e(e,n){return e[0]===n[0]&&e[1]===n[1]&&e[2]===n[2]}class Pd extends Array{constructor(n=0,i=n,r=n){return super(n,i,r),this}get x(){return this[0]}get y(){return this[1]}get z(){return this[2]}set x(n){this[0]=n}set y(n){this[1]=n}set z(n){this[2]=n}set(n,i=n,r=n){return n.length?this.copy(n):(Kbe(this,n,i,r),this)}copy(n){return HE(this,n),this}add(n,i){return i?R9(this,n,i):R9(this,this,n),this}sub(n,i){return i?O9(this,n,i):O9(this,this,n),this}multiply(n){return n.length?Ybe(this,this,n):YN(this,this,n),this}divide(n){return n.length?Xbe(this,this,n):YN(this,this,1/n),this}inverse(n=this){return e1e(this,n),this}len(){return i_(this)}distance(n){return n?Qbe(this,n):i_(this)}squaredLen(){return D9(this)}squaredDistance(n){return n?Zbe(this,n):D9(this)}negate(n=this){return Jbe(this,n),this}cross(n,i){return i?L9(this,n,i):L9(this,this,n),this}scale(n){return YN(this,this,n),this}normalize(){return qE(this,this),this}dot(n){return tie(this,n)}equals(n){return l1e(this,n)}applyMatrix3(n){return o1e(this,this,n),this}applyMatrix4(n){return i1e(this,this,n),this}scaleRotateMatrix4(n){return r1e(this,this,n),this}applyQuaternion(n){return s1e(this,this,n),this}angle(n){return a1e(this,n)}lerp(n,i){return t1e(this,this,n,i),this}smoothLerp(n,i,r){return n1e(this,this,n,i,r),this}clone(){return new Pd(this[0],this[1],this[2])}fromArray(n,i=0){return this[0]=n[i],this[1]=n[i+1],this[2]=n[i+2],this}toArray(n=[],i=0){return n[i]=this[0],n[i+1]=this[1],n[i+2]=this[2],n}transformDirection(n){const i=this[0],r=this[1],o=this[2];return this[0]=n[0]*i+n[4]*r+n[8]*o,this[1]=n[1]*i+n[5]*r+n[9]*o,this[2]=n[2]*i+n[6]*r+n[10]*o,this.normalize()}}const B9=new Pd;let c1e=1,d1e=1,F9=!1;class u1e{constructor(n,i={}){n.canvas||console.error("gl not passed as first argument to Geometry"),this.gl=n,this.attributes=i,this.id=c1e++,this.VAOs={},this.drawRange={start:0,count:0},this.instancedCount=0,this.gl.renderer.bindVertexArray(null),this.gl.renderer.currentGeometry=null,this.glState=this.gl.renderer.state;for(let r in i)this.addAttribute(r,i[r])}addAttribute(n,i){if(this.attributes[n]=i,i.id=d1e++,i.size=i.size||1,i.type=i.type||(i.data.constructor===Float32Array?this.gl.FLOAT:i.data.constructor===Uint16Array?this.gl.UNSIGNED_SHORT:this.gl.UNSIGNED_INT),i.target=n==="index"?this.gl.ELEMENT_ARRAY_BUFFER:this.gl.ARRAY_BUFFER,i.normalized=i.normalized||!1,i.stride=i.stride||0,i.offset=i.offset||0,i.count=i.count||(i.stride?i.data.byteLength/i.stride:i.data.length/i.size),i.divisor=i.instanced||0,i.needsUpdate=!1,i.usage=i.usage||this.gl.STATIC_DRAW,i.buffer||this.updateAttribute(i),i.divisor){if(this.isInstanced=!0,this.instancedCount&&this.instancedCount!==i.count*i.divisor)return console.warn("geometry has multiple instanced buffers of different length"),this.instancedCount=Math.min(this.instancedCount,i.count*i.divisor);this.instancedCount=i.count*i.divisor}else n==="index"?this.drawRange.count=i.count:this.attributes.index||(this.drawRange.count=Math.max(this.drawRange.count,i.count))}updateAttribute(n){const i=!n.buffer;i&&(n.buffer=this.gl.createBuffer()),this.glState.boundBuffer!==n.buffer&&(this.gl.bindBuffer(n.target,n.buffer),this.glState.boundBuffer=n.buffer),i?this.gl.bufferData(n.target,n.data,n.usage):this.gl.bufferSubData(n.target,0,n.data),n.needsUpdate=!1}setIndex(n){this.addAttribute("index",n)}setDrawRange(n,i){this.drawRange.start=n,this.drawRange.count=i}setInstancedCount(n){this.instancedCount=n}createVAO(n){this.VAOs[n.attributeOrder]=this.gl.renderer.createVertexArray(),this.gl.renderer.bindVertexArray(this.VAOs[n.attributeOrder]),this.bindAttributes(n)}bindAttributes(n){n.attributeLocations.forEach((i,{name:r,type:o})=>{if(!this.attributes[r]){console.warn(`active attribute ${r} not being supplied`);return}const s=this.attributes[r];this.gl.bindBuffer(s.target,s.buffer),this.glState.boundBuffer=s.buffer;let a=1;o===35674&&(a=2),o===35675&&(a=3),o===35676&&(a=4);const c=s.size/a,u=a===1?0:a*a*4,m=a===1?0:a*4;
421for(let h=0;h<a;h++)this.gl.vertexAttribPointer(i+h,c,s.type,s.normalized,s.stride+u,s.offset+h*m),this.gl.enableVertexAttribArray(i+h),this.gl.renderer.vertexAttribDivisor(i+h,s.divisor)}),this.attributes.index&&this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER,this.attributes.index.buffer)}draw({program:n,mode:i=this.gl.TRIANGLES}){this.gl.renderer.currentGeometry!==`${this.id}_${n.attributeOrder}`&&(this.VAOs[n.attributeOrder]||this.createVAO(n),this.gl.renderer.bindVertexArray(this.VAOs[n.attributeOrder]),this.gl.renderer.currentGeometry=`${this.id}_${n.attributeOrder}`),n.attributeLocations.forEach((o,{name:s})=>{const a=this.attributes[s];a.needsUpdate&&this.updateAttribute(a)});let r=2;this.attributes.index?.type===this.gl.UNSIGNED_INT&&(r=4),this.isInstanced?this.attributes.index?this.gl.renderer.drawElementsInstanced(i,this.drawRange.count,this.attributes.index.type,this.attributes.index.offset+this.drawRange.start*r,this.instancedCount):this.gl.renderer.drawArraysInstanced(i,this.drawRange.start,this.drawRange.count,this.instancedCount):this.attributes.index?this.gl.drawElements(i,this.drawRange.count,this.attributes.index.type,this.attributes.index.offset+this.drawRange.start*r):this.gl.drawArrays(i,this.drawRange.start,this.drawRange.count)}getPosition(){const n=this.attributes.position;if(n.data)return n;if(!F9)return console.warn("No position buffer data found to compute bounds"),F9=!0}computeBoundingBox(n){n||(n=this.getPosition());const i=n.data,r=n.size;this.bounds||(this.bounds={min:new Pd,max:new Pd,center:new Pd,scale:new Pd,radius:1/0});const o=this.bounds.min,s=this.bounds.max,a=this.bounds.center,c=this.bounds.scale;o.set(1/0),s.set(-1/0);for(let u=0,m=i.length;u<m;u+=r){const h=i[u],g=i[u+1],x=i[u+2];o.x=Math.min(h,o.x),o.y=Math.min(g,o.y),o.z=Math.min(x,o.z),s.x=Math.max(h,s.x),s.y=Math.max(g,s.y),s.z=Math.max(x,s.z)}c.sub(s,o),a.add(o,s).divide(2)}computeBoundingSphere(n){n||(n=this.getPosition());const i=n.data,r=n.size;this.bounds||this.computeBoundingBox(n);let o=0;for(let s=0,a=i.length;s<a;s+=r)B9.fromArray(i,s),o=Math.max(o,this.bounds.center.squaredDistance(B9));this.bounds.radius=Math.sqrt(o)}remove(){for(let n in this.VAOs)this.gl.renderer.deleteVertexArray(this.VAOs[n]),delete this.VAOs[n];for(let n in this.attributes)this.gl.deleteBuffer(this.attributes[n].buffer),delete this.attributes[n]}}let p1e=1;const W9={};class m1e{constructor(n,{vertex:i,fragment:r,uniforms:o={},transparent:s=!1,cullFace:a=n.BACK,frontFace:c=n.CCW,depthTest:u=!0,depthWrite:m=!0,depthFunc:h=n.LEQUAL}={}){n.canvas||console.error("gl not passed as first argument to Program"),this.gl=n,this.uniforms=o,this.id=p1e++,i||console.warn("vertex shader not supplied"),r||console.warn("fragment shader not supplied"),this.transparent=s,this.cullFace=a,this.frontFace=c,this.depthTest=u,this.depthWrite=m,this.depthFunc=h,this.blendFunc={},this.blendEquation={},this.stencilFunc={},this.stencilOp={},this.transparent&&!this.blendFunc.src&&(this.gl.renderer.premultipliedAlpha?this.setBlendFunc(this.gl.ONE,this.gl.ONE_MINUS_SRC_ALPHA):this.setBlendFunc(this.gl.SRC_ALPHA,this.gl.ONE_MINUS_SRC_ALPHA)),this.vertexShader=n.createShader(n.VERTEX_SHADER),this.fragmentShader=n.createShader(n.FRAGMENT_SHADER),this.program=n.createProgram(),n.attachShader(this.program,this.vertexShader),n.attachShader(this.program,this.fragmentShader),this.setShaders({vertex:i,fragment:r})}setShaders({vertex:n,fragment:i}){if(n&&(this.gl.shaderSource(this.vertexShader,n),this.gl.compileShader(this.vertexShader),this.gl.getShaderInfoLog(this.vertexShader)!==""&&console.warn(`${this.gl.getShaderInfoLog(this.vertexShader)} 422Vertex Shader 423${U9(n)}`)),i&&(this.gl.shaderSource(this.fragmentShader,i),this.gl.compileShader(this.fragmentShader),this.gl.getShaderInfoLog(this.fragmentShader)!==""&&console.warn(`${this.gl.getShaderInfoLog(this.fragmentShader)} 424Fragment Shader 425${U9(i)}`)),this.gl.linkProgram(this.program),!this.gl.getProgramParameter(this.program,this.gl.LINK_STATUS))return console.warn(this.gl.getProgramInfoLog(this.program));this.uniformLocations=new Map;let r=this.gl.getProgramParameter(this.program,this.gl.ACTIVE_UNIFORMS);for(let a=0;a<r;a++){let c=this.gl.getActiveUniform(this.program,a);this.uniformLocations.set(c,this.gl.getUniformLocation(this.program,c.name));const u=c.name.match(/(\w+)/g);c.uniformName=u[0],c.nameComponents=u.slice(1)}this.attributeLocations=new Map;const o=[],s=this.gl.getProgramParameter(this.program,this.gl.ACTIVE_ATTRIBUTES);for(let a=0;a<s;a++){const c=this.gl.getActiveAttrib(this.program,a),u=this.gl.getAttribLocation(this.program,c.name);u!==-1&&(o[u]=c.name,this.attributeLocations.set(c,u))}this.attributeOrder=o.join("")}setBlendFunc(n,i,r,o){this.blendFunc.src=n,this.blendFunc.dst=i,this.blendFunc.srcAlpha=r,this.blendFunc.dstAlpha=o,n&&(this.transparent=!0)}setBlendEquation(n,i){this.blendEquation.modeRGB=n,this.blendEquation.modeAlpha=i}setStencilFunc(n,i,r){this.stencilRef=i,this.stencilFunc.func=n,this.stencilFunc.ref=i,this.stencilFunc.mask=r}setStencilOp(n,i,r){this.stencilOp.stencilFail=n,this.stencilOp.depthFail=i,this.stencilOp.depthPass=r}applyState(){this.depthTest?this.gl.renderer.enable(this.gl.DEPTH_TEST):this.gl.renderer.disable(this.gl.DEPTH_TEST),this.cullFace?this.gl.renderer.enable(this.gl.CULL_FACE):this.gl.renderer.disable(this.gl.CULL_FACE),this.blendFunc.src?this.gl.renderer.enable(this.gl.BLEND):this.gl.renderer.disable(this.gl.BLEND),this.cullFace&&this.gl.renderer.setCullFace(this.cullFace),this.gl.renderer.setFrontFace(this.frontFace),this.gl.renderer.setDepthMask(this.depthWrite),this.gl.renderer.setDepthFunc(this.depthFunc),this.blendFunc.src&&this.gl.renderer.setBlendFunc(this.blendFunc.src,this.blendFunc.dst,this.blendFunc.srcAlpha,this.blendFunc.dstAlpha),this.gl.renderer.setBlendEquation(this.blendEquation.modeRGB,this.blendEquation.modeAlpha),this.stencilFunc.func||this.stencilOp.stencilFail?this.gl.renderer.enable(this.gl.STENCIL_TEST):this.gl.renderer.disable(this.gl.STENCIL_TEST),this.gl.renderer.setStencilFunc(this.stencilFunc.func,this.stencilFunc.ref,this.stencilFunc.mask),this.gl.renderer.setStencilOp(this.stencilOp.stencilFail,this.stencilOp.depthFail,this.stencilOp.depthPass)}use({flipFaces:n=!1}={}){let i=-1;this.gl.renderer.state.currentProgram===this.id||(this.gl.useProgram(this.program),this.gl.renderer.state.currentProgram=this.id
425),this.uniformLocations.forEach((o,s)=>{let a=this.uniforms[s.uniformName];for(const c of s.nameComponents){if(!a)break;if(c in a)a=a[c];else{if(Array.isArray(a.value))break;a=void 0;break}}if(!a)return H9(`Active uniform ${s.name} has not been supplied`);if(a&&a.value===void 0)return H9(`${s.name} uniform is missing a value parameter`);if(a.value.texture)return i=i+1,a.value.update(i),XN(this.gl,s.type,o,i);if(a.value.length&&a.value[0].texture){const c=[];return a.value.forEach(u=>{i=i+1,u.update(i),c.push(i)}),XN(this.gl,s.type,o,c)}XN(this.gl,s.type,o,a.value)}),this.applyState(),n&&this.gl.renderer.setFrontFace(this.frontFace===this.gl.CCW?this.gl.CW:this.gl.CCW)}remove(){this.gl.deleteProgram(this.program)}}function XN(e,n,i,r){r=r.length?h1e(r):r;const o=e.renderer.state.uniformLocations.get(i);if(r.length)if(o===void 0||o.length!==r.length)e.renderer.state.uniformLocations.set(i,r.slice(0));else{if(f1e(o,r))return;o.set?o.set(r):g1e(o,r),e.renderer.state.uniformLocations.set(i,o)}else{if(o===r)return;e.renderer.state.uniformLocations.set(i,r)}switch(n){case 5126:return r.length?e.uniform1fv(i,r):e.uniform1f(i,r);case 35664:return e.uniform2fv(i,r);case 35665:return e.uniform3fv(i,r);case 35666:return e.uniform4fv(i,r);case 35670:case 5124:case 35678:case 36306:case 35680:case 36289:return r.length?e.uniform1iv(i,r):e.uniform1i(i,r);case 35671:case 35667:return e.uniform2iv(i,r);case 35672:case 35668:return e.uniform3iv(i,r);case 35673:case 35669:return e.uniform4iv(i,r);case 35674:return e.uniformMatrix2fv(i,!1,r);case 35675:return e.uniformMatrix3fv(i,!1,r);case 35676:return e.uniformMatrix4fv(i,!1,r)}}function U9(e){let n=e.split(` 426`);for(let i=0;i<n.length;i++)n[i]=i+1+": "+n[i];return n.join(` 427`)}function h1e(e){const n=e.length,i=e[0].length;if(i===void 0)return e;const r=n*i;let o=W9[r];o||(W9[r]=o=new Float32Array(r));for(let s=0;s<n;s++)o.set(e[s],s*i);return o}function f1e(e,n){if(e.length!==n.length)return!1;for(let i=0,r=e.length;i<r;i++)if(e[i]!==n[i])return!1;return!0}function g1e(e,n){for(let i=0,r=e.length;i<r;i++)e[i]=n[i]}let QN=0;function H9(e){QN>100||(console.warn(e),QN++,QN>100&&console.warn("More than 100 program warnings - stopping logs."))}const ZN=new Pd;let y1e=1;class x1e{constructor({canvas:n=document.createElement("canvas"),width:i=300,height:r=150,dpr:o=1,alpha:s=!1,depth:a=!0,stencil:c=!1,antialias:u=!1,premultipliedAlpha:m=!1,preserveDrawingBuffer:h=!1,powerPreference:g="default",autoClear:x=!0,webgl:y=2}={}){const w={alpha:s,depth:a,stencil:c,antialias:u,premultipliedAlpha:m,preserveDrawingBuffer:h,powerPreference:g};this.dpr=o,this.alpha=s,this.color=!0,this.depth=a,this.stencil=c,this.premultipliedAlpha=m,this.autoClear=x,this.id=y1e++,y===2&&(this.gl=n.getContext("webgl2",w)),this.isWebgl2=!!this.gl,this.gl||(this.gl=n.getContext("webgl",w)),this.gl||console.error("unable to create webgl context"),this.gl.renderer=this,this.setSize(i,r),this.state={},this.state.blendFunc={src:this.gl.ONE,dst:this.gl.ZERO},this.state.blendEquation={modeRGB:this.gl.FUNC_ADD},this.state.cullFace=!1,this.state.frontFace=this.gl.CCW,this.state.depthMask=!0,this.state.depthFunc=this.gl.LEQUAL,this.state.premultiplyAlpha=!1,this.state.flipY=!1,this.state.unpackAlignment=4,this.state.framebuffer=null,this.state.viewport={x:0,y:0,width:null,height:null},this.state.textureUnits=[],this.state.activeTextureUnit=0,this.state.boundBuffer=null,this.state.uniformLocations=new Map,this.state.currentProgram=null,this.extensions={},this.isWebgl2?(this.getExtension("EXT_color_buffer_float"),this.getExtension("OES_texture_float_linear")):(this.getExtension("OES_texture_float"),this.getExtension("OES_texture_float_linear"),this.getExtension("OES_texture_half_float"),this.getExtension("OES_texture_half_float_linear"),this.getExtension("OES_element_index_uint"),this.getExtension("OES_standard_derivatives"),this.getExtension("EXT_sRGB"),this.getExtension("WEBGL_depth_texture"),this.getExtension("WEBGL_draw_buffers")),this.getExtension("WEBGL_compressed_texture_astc"),this.getExtension("EXT_texture_compression_bptc"),this.getExtension("WEBGL_compressed_texture_s3tc"),this.getExtension("WEBGL_compressed_texture_etc1"),this.getExtension("WEBGL_compressed_texture_pvrtc"),this.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),this.vertexAttribDivisor=this.getExtension("ANGLE_instanced_arrays","vertexAttribDivisor","vertexAttribDivisorANGLE"),this.drawArraysInstanced=this.getExtension("ANGLE_instanced_arrays","drawArraysInstanced","drawArraysInstancedANGLE"),this.drawElementsInstanced=this.getExtension("ANGLE_instanced_arrays","drawElementsInstanced","drawElementsInstancedANGLE"),this.createVertexArray=this.getExtension("OES_vertex_array_object","createVertexArray","createVertexArrayOES"),this.bindVertexArray=this.getExtension("OES_vertex_array_object","bindVertexArray","bindVertexArrayOES"),this.deleteVertexArray=this.getExtension("OES_vertex_array_object","deleteVertexArray","deleteVertexArrayOES"),this.drawBuffers=this.getExtension("WEBGL_draw_buffers","drawBuffers","drawBuffersWEBGL"),this.parameters={},this.parameters.maxTextureUnits=this.gl.getParameter(this.gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS),this.parameters.maxAnisotropy=this.getExtension("EXT_texture_filter_anisotropic")?this.gl.getParameter(this.getExtension("EXT_texture_filter_anisotropic").MAX_TEXTURE_MAX_ANISOTROPY_EXT):0}setSize(n,i){this.width=n,this.height=i,this.gl.canvas.width=n*this.dpr,this.gl.canvas.height=i*this.dpr,this.gl.canvas.style&&Object.assign(this.gl.canvas.style,{width:n+"px",height:i+"px"})}setViewport(n,i,r=0,o=0){this.state.viewport.width===n&&this.state.viewport.height===i||(this.state.viewport.width=n,this.state.viewport.height=i,this.state.viewport.x=r,this.state.viewport.y=o,this.gl.viewport(r,o,n,i))}setScissor(n,i,r=0,o=0){this.gl.scissor(r,o,n,i)}enable(n){this.state[n]!==!0&&(this.gl.enable(n),this.state[n]=!0)}disable(n){this.state[n]!==!1&&(this.gl.disable(n),this.state[n]=!1)}setBlendFunc(n,i,r,o){this.state.blendFunc.src===n&&this.state.blendFunc.dst===i&&this.state.blendFunc.srcAlpha===r&&this.state.blendFunc.dstAlpha===o||(this.state.blendFunc.src=n,this.state.blendFunc.dst=i,this.state.blendFunc.srcAlpha=r,this.state.blendFunc.dstAlpha=o,r!==void 0?this.gl.blendFuncSeparate(n,i,r,o):this.gl.blendFunc(n,i))}setBlendEquation(n,i){n=n||this.gl.FUNC_ADD,!(this.state.blendEquation.modeRGB===n&&this.state.blendEquation.modeAlpha===i)&&(this.state.blendEquation.modeRGB=n,this.state.blendEquation.modeAlpha=i,i!==void 0?this.gl.blendEquationSeparate(n,i):this.gl.blendEquation(n))}setCullFace(n){this.state.cullFace!==n&&(this.state.cullFace=n,this.gl.cullFace(n))}setFrontFace(n){this.state.frontFace!==n&&(this.state.frontFace=n,this.gl.frontFace(n))}setDepthMask(n){this.state.depthMask!==n&&(this.state.depthMask=n,this.gl.depthMask(n))}setDepthFunc(n){this.state.depthFunc!==n&&(this.state.depthFunc=n,this.gl.depthFunc(n))}setStencilMask(n){this.state.stencilMask!==n&&(this.state.stencilMask=n,this.gl.stencilMask(n))}setStencilFunc(n,i,r){this.state.stencilFunc===n&&this.state.stencilRef===i&&this.state.stencilFuncMask===r||(this.state.stencilFunc=n||this.gl.ALWAYS,this.state.stencilRef=i||0,this.state.stencilFuncMask=r||0,this.gl.stencilFunc(n||this.gl.ALWAYS,i||0,r||0))}setStencilOp(n,i,r){this.state.stencilFail===n&&this.state.stencilDepthFail===i&&this.state.stencilDepthPass===r||(this.state.stencilFail=n,this.state.stencilDepthFail=i,this.state.stencilDepthPass=r,this.gl.stencilOp(n,i,r))}activeTexture(n){this.state.activeTextureUnit!==n&&(this.state.activeTextureUnit=n,this.gl.activeTexture(this.gl.TEXTURE0+n))}bindFramebuffer({target:n=this.gl.FRAMEBUFFER,buffer:i=null}={}){this.state.framebuffer!==i&&(this.state.framebuffer=i,this.gl.bindFramebuffer(n,i))}getExtension(n,i,r){return i&&this.gl[i]?this.gl[i].bind(this.gl):(this.extensions[n]||(this.extensions[n]=this.gl.getExtension(n)),i?this.extensions[n]?this.extensions[n][r].bind(this.extensions[n]):null:this.extensions[n])}sortOpaque(n,i){return n.renderOrder!==i.renderOrder?n.renderOrder-i.renderOrder:n.program.id!==i.program.id?n.program.id-i.program.id:n.zDepth!==i.zDepth?n.zDepth-i.zDepth:i.id-n.id}
427sortTransparent(n,i){return n.renderOrder!==i.renderOrder?n.renderOrder-i.renderOrder:n.zDepth!==i.zDepth?i.zDepth-n.zDepth:i.id-n.id}sortUI(n,i){return n.renderOrder!==i.renderOrder?n.renderOrder-i.renderOrder:n.program.id!==i.program.id?n.program.id-i.program.id:i.id-n.id}getRenderList({scene:n,camera:i,frustumCull:r,sort:o}){let s=[];if(i&&r&&i.updateFrustum(),n.traverse(a=>{if(!a.visible)return!0;a.draw&&(r&&a.frustumCulled&&i&&!i.frustumIntersectsMesh(a)||s.push(a))}),o){const a=[],c=[],u=[];s.forEach(m=>{m.program.transparent?m.program.depthTest?c.push(m):u.push(m):a.push(m),m.zDepth=0,!(m.renderOrder!==0||!m.program.depthTest||!i)&&(m.worldMatrix.getTranslation(ZN),ZN.applyMatrix4(i.projectionViewMatrix),m.zDepth=ZN.z)}),a.sort(this.sortOpaque),c.sort(this.sortTransparent),u.sort(this.sortUI),s=a.concat(c,u)}return s}render({scene:n,camera:i,target:r=null,update:o=!0,sort:s=!0,frustumCull:a=!0,clear:c}){r===null?(this.bindFramebuffer(),this.setViewport(this.width*this.dpr,this.height*this.dpr)):(this.bindFramebuffer(r),this.setViewport(r.width,r.height)),(c||this.autoClear&&c!==!1)&&(this.depth&&(!r||r.depth)&&(this.enable(this.gl.DEPTH_TEST),this.setDepthMask(!0)),(this.stencil||!r||r.stencil)&&(this.enable(this.gl.STENCIL_TEST),this.setStencilMask(255)),this.gl.clear((this.color?this.gl.COLOR_BUFFER_BIT:0)|(this.depth?this.gl.DEPTH_BUFFER_BIT:0)|(this.stencil?this.gl.STENCIL_BUFFER_BIT:0))),o&&n.updateMatrixWorld(),i&&i.updateMatrixWorld(),this.getRenderList({scene:n,camera:i,frustumCull:a,sort:s}).forEach(m=>{m.draw({camera:i})})}}function b1e(e,n){return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e}function v1e(e,n,i,r,o){return e[0]=n,e[1]=i,e[2]=r,e[3]=o,e}function w1e(e,n){let i=n[0],r=n[1],o=n[2],s=n[3],a=i*i+r*r+o*o+s*s;return a>0&&(a=1/Math.sqrt(a)),e[0]=i*a,e[1]=r*a,e[2]=o*a,e[3]=s*a,e}function j1e(e,n){return e[0]*n[0]+e[1]*n[1]+e[2]*n[2]+e[3]*n[3]}function _1e(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function C1e(e,n,i){i=i*.5;let r=Math.sin(i);return e[0]=r*n[0],e[1]=r*n[1],e[2]=r*n[2],e[3]=Math.cos(i),e}function q9(e,n,i){let r=n[0],o=n[1],s=n[2],a=n[3],c=i[0],u=i[1],m=i[2],h=i[3];return e[0]=r*h+a*c+o*m-s*u,e[1]=o*h+a*u+s*c-r*m,e[2]=s*h+a*m+r*u-o*c,e[3]=a*h-r*c-o*u-s*m,e}function S1e(e,n,i){i*=.5;let r=n[0],o=n[1],s=n[2],a=n[3],c=Math.sin(i),u=Math.cos(i);return e[0]=r*u+a*c,e[1]=o*u+s*c,e[2]=s*u-o*c,e[3]=a*u-r*c,e}function k1e(e,n,i){i*=.5;let r=n[0],o=n[1],s=n[2],a=n[3],c=Math.sin(i),u=Math.cos(i);return e[0]=r*u-s*c,e[1]=o*u+a*c,e[2]=s*u+r*c,e[3]=a*u-o*c,e}function $1e(e,n,i){i*=.5;let r=n[0],o=n[1],s=n[2],a=n[3],c=Math.sin(i),u=Math.cos(i);return e[0]=r*u+o*c,e[1]=o*u-r*c,e[2]=s*u+a*c,e[3]=a*u-s*c,e}function I1e(e,n,i,r){let o=n[0],s=n[1],a=n[2],c=n[3],u=i[0],m=i[1],h=i[2],g=i[3],x,y,w,j,v;return y=o*u+s*m+a*h+c*g,y<0&&(y=-y,u=-u,m=-m,h=-h,g=-g),1-y>1e-6?(x=Math.acos(y),w=Math.sin(x),j=Math.sin((1-r)*x)/w,v=Math.sin(r*x)/w):(j=1-r,v=r),e[0]=j*o+v*u,e[1]=j*s+v*m,e[2]=j*a+v*h,e[3]=j*c+v*g,e}function P1e(e,n){let i=n[0],r=n[1],o=n[2],s=n[3],a=i*i+r*r+o*o+s*s,c=a?1/a:0;return e[0]=-i*c,e[1]=-r*c,e[2]=-o*c,e[3]=s*c,e}function A1e(e,n){return e[0]=-n[0],e[1]=-n[1],e[2]=-n[2],e[3]=n[3],e}function N1e(e,n){let i=n[0]+n[4]+n[8],r;if(i>0)r=Math.sqrt(i+1),e[3]=.5*r,r=.5/r,e[0]=(n[5]-n[7])*r,e[1]=(n[6]-n[2])*r,e[2]=(n[1]-n[3])*r;else{let o=0;n[4]>n[0]&&(o=1),n[8]>n[o*3+o]&&(o=2);let s=(o+1)%3,a=(o+2)%3;r=Math.sqrt(n[o*3+o]-n[s*3+s]-n[a*3+a]+1),e[o]=.5*r,r=.5/r,e[3]=(n[s*3+a]-n[a*3+s])*r,e[s]=(n[s*3+o]+n[o*3+s])*r,e[a]=(n[a*3+o]+n[o*3+a])*r}return e}function z1e(e,n,i="YXZ"){let r=Math.sin(n[0]*.5),o=Math.cos(n[0]*.5),s=Math.sin(n[1]*.5),a=Math.cos(n[1]*.5),c=Math.sin(n[2]*.5),u=Math.cos(n[2]*.5);return i==="XYZ"?(e[0]=r*a*u+o*s*c,e[1]=o*s*u-r*a*c,e[2]=o*a*c+r*s*u,e[3]=o*a*u-r*s*c):i==="YXZ"?(e[0]=r*a*u+o*s*c,e[1]=o*s*u-r*a*c,e[2]=o*a*c-r*s*u,e[3]=o*a*u+r*s*c):i==="ZXY"?(e[0]=r*a*u-o*s*c,e[1]=o*s*u+r*a*c,e[2]=o*a*c+r*s*u,e[3]=o*a*u-r*s*c):i==="ZYX"?(e[0]=r*a*u-o*s*c,e[1]=o*s*u+r*a*c,e[2]=o*a*c-r*s*u,e[3]=o*a*u+r*s*c):i==="YZX"?(e[0]=r*a*u+o*s*c,e[1]=o*s*u+r*a*c,e[2]=o*a*c-r*s*u,e[3]=o*a*u-r*s*c):i==="XZY"&&(e[0]=r*a*u-o*s*c,e[1]=o*s*u-r*a*c,e[2]=o*a*c+r*s*u,e[3]=o*a*u+r*s*c),e}const T1e=b1e,E1e=v1e,M1e=j1e,R1e=w1e;class O1e extends Array{constructor(n=0,i=0,r=0,o=1){super(n,i,r,o),this.onChange=()=>{},this._target=this;const s=["0","1","2","3"];return new Proxy(this,{set(a,c){const u=Reflect.set(...arguments);return u&&s.includes(c)&&a.onChange(),u}})}get x(){return this[0]}get y(){return this[1]}get z(){return this[2]}get w(){return this[3]}set x(n){this._target[0]=n,this.onChange()}set y(n){this._target[1]=n,this.onChange()}set z(n){this._target[2]=n,this.onChange()}set w(n){this._target[3]=n,this.onChange()}identity(){return _1e(this._target),this.onChange(),this}set(n,i,r,o){return n.length?this.copy(n):(E1e(this._target,n,i,r,o),this.onChange(),this)}rotateX(n){return S1e(this._target,this._target,n),this.onChange(),this}rotateY(n){return k1e(this._target,this._target,n),this.onChange(),this}rotateZ(n){return $1e(this._target,this._target,n),this.onChange(),this}inverse(n=this._target){return P1e(this._target,n),this.onChange(),this}conjugate(n=this._target){return A1e(this._target,n),this.onChange(),this}copy(n){return T1e(this._target,n),this.onChange(),this}normalize(n=this._target){return R1e(this._target,n),this.onChange(),this}multiply(n,i){return i?q9(this._target,n,i):q9(this._target,this._target,n),this.onChange(),this}dot(n){return M1e(this._target,n)}fromMatrix3(n){return N1e(this._target,n),this.onChange(),this}fromEuler(n,i){return z1e(this._target,n,n.order),i||this.onChange(),this}fromAxisAngle(n,i){return C1e(this._target,n,i),this.onChange(),this}slerp(n,i){return I1e(this._target,this._target,n,i),this.onChange(),this}fromArray(n,i=0){return this._target[0]=n[i],this._target[1]=n[i+1],this._target[2]=n[i+2],this._target[3]=n[i+3],this.onChange(),this}toArray(n=[],i=0){return n[i]=this[0],n[i+1]=this[1],n[i+2]=this[2],n[i+3]=this[3],n}}const D1e=1e-6;function L1e(e,n){return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],e}function B1e(e,n,i,r,o,s,a,c,u,m,h,g,x,y,w,j,v){return e[0]=n,e[1]=i,e[2]=r,e[3]=o,e[4]=s,e[5]=a,e[6]=c,e[7]=u,e[8]=m,e[9]=h,e[10]=g,e[11
427]=x,e[12]=y,e[13]=w,e[14]=j,e[15]=v,e}function F1e(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function W1e(e,n){let i=n[0],r=n[1],o=n[2],s=n[3],a=n[4],c=n[5],u=n[6],m=n[7],h=n[8],g=n[9],x=n[10],y=n[11],w=n[12],j=n[13],v=n[14],_=n[15],$=i*c-r*a,k=i*u-o*a,P=i*m-s*a,S=r*u-o*c,I=r*m-s*c,A=o*m-s*u,E=h*j-g*w,B=h*v-x*w,T=h*_-y*w,M=g*v-x*j,R=g*_-y*j,F=x*_-y*v,Y=$*F-k*R+P*M+S*T-I*B+A*E;return Y?(Y=1/Y,e[0]=(c*F-u*R+m*M)*Y,e[1]=(o*R-r*F-s*M)*Y,e[2]=(j*A-v*I+_*S)*Y,e[3]=(x*I-g*A-y*S)*Y,e[4]=(u*T-a*F-m*B)*Y,e[5]=(i*F-o*T+s*B)*Y,e[6]=(v*P-w*A-_*k)*Y,e[7]=(h*A-x*P+y*k)*Y,e[8]=(a*R-c*T+m*E)*Y,e[9]=(r*T-i*R-s*E)*Y,e[10]=(w*I-j*P+_*$)*Y,e[11]=(g*P-h*I-y*$)*Y,e[12]=(c*B-a*M-u*E)*Y,e[13]=(i*M-r*B+o*E)*Y,e[14]=(j*k-w*S-v*$)*Y,e[15]=(h*S-g*k+x*$)*Y,e):null}function nie(e){let n=e[0],i=e[1],r=e[2],o=e[3],s=e[4],a=e[5],c=e[6],u=e[7],m=e[8],h=e[9],g=e[10],x=e[11],y=e[12],w=e[13],j=e[14],v=e[15],_=n*a-i*s,$=n*c-r*s,k=n*u-o*s,P=i*c-r*a,S=i*u-o*a,I=r*u-o*c,A=m*w-h*y,E=m*j-g*y,B=m*v-x*y,T=h*j-g*w,M=h*v-x*w,R=g*v-x*j;return _*R-$*M+k*T+P*B-S*E+I*A}function G9(e,n,i){let r=n[0],o=n[1],s=n[2],a=n[3],c=n[4],u=n[5],m=n[6],h=n[7],g=n[8],x=n[9],y=n[10],w=n[11],j=n[12],v=n[13],_=n[14],$=n[15],k=i[0],P=i[1],S=i[2],I=i[3];return e[0]=k*r+P*c+S*g+I*j,e[1]=k*o+P*u+S*x+I*v,e[2]=k*s+P*m+S*y+I*_,e[3]=k*a+P*h+S*w+I*$,k=i[4],P=i[5],S=i[6],I=i[7],e[4]=k*r+P*c+S*g+I*j,e[5]=k*o+P*u+S*x+I*v,e[6]=k*s+P*m+S*y+I*_,e[7]=k*a+P*h+S*w+I*$,k=i[8],P=i[9],S=i[10],I=i[11],e[8]=k*r+P*c+S*g+I*j,e[9]=k*o+P*u+S*x+I*v,e[10]=k*s+P*m+S*y+I*_,e[11]=k*a+P*h+S*w+I*$,k=i[12],P=i[13],S=i[14],I=i[15],e[12]=k*r+P*c+S*g+I*j,e[13]=k*o+P*u+S*x+I*v,e[14]=k*s+P*m+S*y+I*_,e[15]=k*a+P*h+S*w+I*$,e}function U1e(e,n,i){let r=i[0],o=i[1],s=i[2],a,c,u,m,h,g,x,y,w,j,v,_;return n===e?(e[12]=n[0]*r+n[4]*o+n[8]*s+n[12],e[13]=n[1]*r+n[5]*o+n[9]*s+n[13],e[14]=n[2]*r+n[6]*o+n[10]*s+n[14],e[15]=n[3]*r+n[7]*o+n[11]*s+n[15]):(a=n[0],c=n[1],u=n[2],m=n[3],h=n[4],g=n[5],x=n[6],y=n[7],w=n[8],j=n[9],v=n[10],_=n[11],e[0]=a,e[1]=c,e[2]=u,e[3]=m,e[4]=h,e[5]=g,e[6]=x,e[7]=y,e[8]=w,e[9]=j,e[10]=v,e[11]=_,e[12]=a*r+h*o+w*s+n[12],e[13]=c*r+g*o+j*s+n[13],e[14]=u*r+x*o+v*s+n[14],e[15]=m*r+y*o+_*s+n[15]),e}function H1e(e,n,i){let r=i[0],o=i[1],s=i[2];return e[0]=n[0]*r,e[1]=n[1]*r,e[2]=n[2]*r,e[3]=n[3]*r,e[4]=n[4]*o,e[5]=n[5]*o,e[6]=n[6]*o,e[7]=n[7]*o,e[8]=n[8]*s,e[9]=n[9]*s,e[10]=n[10]*s,e[11]=n[11]*s,e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],e}function q1e(e,n,i,r){let o=r[0],s=r[1],a=r[2],c=Math.hypot(o,s,a),u,m,h,g,x,y,w,j,v,_,$,k,P,S,I,A,E,B,T,M,R,F,Y,H;return Math.abs(c)<D1e?null:(c=1/c,o*=c,s*=c,a*=c,u=Math.sin(i),m=Math.cos(i),h=1-m,g=n[0],x=n[1],y=n[2],w=n[3],j=n[4],v=n[5],_=n[6],$=n[7],k=n[8],P=n[9],S=n[10],I=n[11],A=o*o*h+m,E=s*o*h+a*u,B=a*o*h-s*u,T=o*s*h-a*u,M=s*s*h+m,R=a*s*h+o*u,F=o*a*h+s*u,Y=s*a*h-o*u,H=a*a*h+m,e[0]=g*A+j*E+k*B,e[1]=x*A+v*E+P*B,e[2]=y*A+_*E+S*B,e[3]=w*A+$*E+I*B,e[4]=g*T+j*M+k*R,e[5]=x*T+v*M+P*R,e[6]=y*T+_*M+S*R,e[7]=w*T+$*M+I*R,e[8]=g*F+j*Y+k*H,e[9]=x*F+v*Y+P*H,e[10]=y*F+_*Y+S*H,e[11]=w*F+$*Y+I*H,n!==e&&(e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15]),e)}function G1e(e,n){return e[0]=n[12],e[1]=n[13],e[2]=n[14],e}function iie(e,n){let i=n[0],r=n[1],o=n[2],s=n[4],a=n[5],c=n[6],u=n[8],m=n[9],h=n[10];return e[0]=Math.hypot(i,r,o),e[1]=Math.hypot(s,a,c),e[2]=Math.hypot(u,m,h),e}function V1e(e){let n=e[0],i=e[1],r=e[2],o=e[4],s=e[5],a=e[6],c=e[8],u=e[9],m=e[10];const h=n*n+i*i+r*r,g=o*o+s*s+a*a,x=c*c+u*u+m*m;return Math.sqrt(Math.max(h,g,x))}const rie=(function(){const e=[1,1,1];return function(n,i){let r=e;iie(r,i);let o=1/r[0],s=1/r[1],a=1/r[2],c=i[0]*o,u=i[1]*s,m=i[2]*a,h=i[4]*o,g=i[5]*s,x=i[6]*a,y=i[8]*o,w=i[9]*s,j=i[10]*a,v=c+g+j,_=0;return v>0?(_=Math.sqrt(v+1)*2,n[3]=.25*_,n[0]=(x-w)/_,n[1]=(y-m)/_,n[2]=(u-h)/_):c>g&&c>j?(_=Math.sqrt(1+c-g-j)*2,n[3]=(x-w)/_,n[0]=.25*_,n[1]=(u+h)/_,n[2]=(y+m)/_):g>j?(_=Math.sqrt(1+g-c-j)*2,n[3]=(y-m)/_,n[0]=(u+h)/_,n[1]=.25*_,n[2]=(x+w)/_):(_=Math.sqrt(1+j-c-g)*2,n[3]=(u-h)/_,n[0]=(y+m)/_,n[1]=(x+w)/_,n[2]=.25*_),n}})();function K1e(e,n,i,r){let o=i_([e[0],e[1],e[2]]);const s=i_([e[4],e[5],e[6]]),a=i_([e[8],e[9],e[10]]);nie(e)<0&&(o=-o),i[0]=e[12],i[1]=e[13],i[2]=e[14];const u=e.slice(),m=1/o,h=1/s,g=1/a;u[0]*=m,u[1]*=m,u[2]*=m,u[4]*=h,u[5]*=h,u[6]*=h,u[8]*=g,u[9]*=g,u[10]*=g,rie(n,u),r[0]=o,r[1]=s,r[2]=a}function Y1e(e,n,i,r){const o=e,s=n[0],a=n[1],c=n[2],u=n[3],m=s+s,h=a+a,g=c+c,x=s*m,y=s*h,w=s*g,j=a*h,v=a*g,_=c*g,$=u*m,k=u*h,P=u*g,S=r[0],I=r[1],A=r[2];return o[0]=(1-(j+_))*S,o[1]=(y+P)*S,o[2]=(w-k)*S,o[3]=0,o[4]=(y-P)*I,o[5]=(1-(x+_))*I,o[6]=(v+$)*I,o[7]=0,o[8]=(w+k)*A,o[9]=(v-$)*A,o[10]=(1-(x+j))*A,o[11]=0,o[12]=i[0],o[13]=i[1],o[14]=i[2],o[15]=1,o}function X1e(e,n){let i=n[0],r=n[1],o=n[2],s=n[3],a=i+i,c=r+r,u=o+o,m=i*a,h=r*a,g=r*c,x=o*a,y=o*c,w=o*u,j=s*a,v=s*c,_=s*u;return e[0]=1-g-w,e[1]=h+_,e[2]=x-v,e[3]=0,e[4]=h-_,e[5]=1-m-w,e[6]=y+j,e[7]=0,e[8]=x+v,e[9]=y-j,e[10]=1-m-g,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Q1e(e,n,i,r,o){let s=1/Math.tan(n/2),a=1/(r-o);return e[0]=s/i,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=s,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10
427]=(o+r)*a,e[11]=-1,e[12]=0,e[13]=0,e[14]=2*o*r*a,e[15]=0,e}function Z1e(e,n,i,r,o,s,a){let c=1/(n-i),u=1/(r-o),m=1/(s-a);return e[0]=-2*c,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*u,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*m,e[11]=0,e[12]=(n+i)*c,e[13]=(o+r)*u,e[14]=(a+s)*m,e[15]=1,e}function J1e(e,n,i,r){let o=n[0],s=n[1],a=n[2],c=r[0],u=r[1],m=r[2],h=o-i[0],g=s-i[1],x=a-i[2],y=h*h+g*g+x*x;y===0?x=1:(y=1/Math.sqrt(y),h*=y,g*=y,x*=y);let w=u*x-m*g,j=m*h-c*x,v=c*g-u*h;return y=w*w+j*j+v*v,y===0&&(m?c+=1e-6:u?m+=1e-6:u+=1e-6,w=u*x-m*g,j=m*h-c*x,v=c*g-u*h,y=w*w+j*j+v*v),y=1/Math.sqrt(y),w*=y,j*=y,v*=y,e[0]=w,e[1]=j,e[2]=v,e[3]=0,e[4]=g*v-x*j,e[5]=x*w-h*v,e[6]=h*j-g*w,e[7]=0,e[8]=h,e[9]=g,e[10]=x,e[11]=0,e[12]=o,e[13]=s,e[14]=a,e[15]=1,e}function V9(e,n,i){return e[0]=n[0]+i[0],e[1]=n[1]+i[1],e[2]=n[2]+i[2],e[3]=n[3]+i[3],e[4]=n[4]+i[4],e[5]=n[5]+i[5],e[6]=n[6]+i[6],e[7]=n[7]+i[7],e[8]=n[8]+i[8],e[9]=n[9]+i[9],e[10]=n[10]+i[10],e[11]=n[11]+i[11],e[12]=n[12]+i[12],e[13]=n[13]+i[13],e[14]=n[14]+i[14],e[15]=n[15]+i[15],e}function K9(e,n,i){return e[0]=n[0]-i[0],e[1]=n[1]-i[1],e[2]=n[2]-i[2],e[3]=n[3]-i[3],e[4]=n[4]-i[4],e[5]=n[5]-i[5],e[6]=n[6]-i[6],e[7]=n[7]-i[7],e[8]=n[8]-i[8],e[9]=n[9]-i[9],e[10]=n[10]-i[10],e[11]=n[11]-i[11],e[12]=n[12]-i[12],e[13]=n[13]-i[13],e[14]=n[14]-i[14],e[15]=n[15]-i[15],e}function eve(e,n,i){return e[0]=n[0]*i,e[1]=n[1]*i,e[2]=n[2]*i,e[3]=n[3]*i,e[4]=n[4]*i,e[5]=n[5]*i,e[6]=n[6]*i,e[7]=n[7]*i,e[8]=n[8]*i,e[9]=n[9]*i,e[10]=n[10]*i,e[11]=n[11]*i,e[12]=n[12]*i,e[13]=n[13]*i,e[14]=n[14]*i,e[15]=n[15]*i,e}class H5 extends Array{constructor(n=1,i=0,r=0,o=0,s=0,a=1,c=0,u=0,m=0,h=0,g=1,x=0,y=0,w=0,j=0,v=1){return super(n,i,r,o,s,a,c,u,m,h,g,x,y,w,j,v),this}get x(){return this[12]}get y(){return this[13]}get z(){return this[14]}get w(){return this[15]}set x(n){this[12]=n}set y(n){this[13]=n}set z(n){this[14]=n}set w(n){this[15]=n}set(n,i,r,o,s,a,c,u,m,h,g,x,y,w,j,v){return n.length?this.copy(n):(B1e(this,n,i,r,o,s,a,c,u,m,h,g,x,y,w,j,v),this)}translate(n,i=this){return U1e(this,i,n),this}rotate(n,i,r=this){return q1e(this,r,n,i),this}scale(n,i=this){return H1e(this,i,typeof n=="number"?[n,n,n]:n),this}add(n,i){return i?V9(this,n,i):V9(this,this,n),this}sub(n,i){return i?K9(this,n,i):K9(this,this,n),this}multiply(n,i){return n.length?i?G9(this,n,i):G9(this,this,n):eve(this,this,n),this}identity(){return F1e(this),this}copy(n){return L1e(this,n),this}fromPerspective({fov:n,aspect:i,near:r,far:o}={}){return Q1e(this,n,i,r,o),this}fromOrthogonal({left:n,right:i,bottom:r,top:o,near:s,far:a}){return Z1e(this,n,i,r,o,s,a),this}fromQuaternion(n){return X1e(this,n),this}setPosition(n){return this.x=n[0],this.y=n[1],this.z=n[2],this}inverse(n=this){return W1e(this,n),this}compose(n,i,r){return Y1e(this,n,i,r),this}decompose(n,i,r){return K1e(this,n,i,r),this}getRotation(n){return rie(n,this),this}getTranslation(n){return G1e(n,this),this}getScaling(n){return iie(n,this),this}getMaxScaleOnAxis(){return V1e(this)}lookAt(n,i,r){return J1e(this,n,i,r),this}determinant(){return nie(this)}fromArray(n,i=0){return this[0]=n[i],this[1]=n[i+1],this[2]=n[i+2],this[3]=n[i+3],this[4]=n[i+4],this[5]=n[i+5],this[6]=n[i+6],this[7]=n[i+7],this[8]=n[i+8],this[9]=n[i+9],this[10]=n[i+10],this[11]=n[i+11],this[12]=n[i+12],this[13]=n[i+13],this[14]=n[i+14],this[15]=n[i+15],this}toArray(n=[],i=0){return n[i]=this[0],n[i+1]=this[1],n[i+2]=this[2],n[i+3]=this[3],n[i+4]=this[4],n[i+5]=this[5],n[i+6]=this[6],n[i+7]=this[7],n[i+8]=this[8],n[i+9]=this[9],n[i+10]=this[10],n[i+11]=this[11],n[i+12]=this[12],n[i+13]=this[13],n[i+14]=this[14],n[i+15]=this[15],n}}function tve(e,n,i="YXZ"){return i==="XYZ"?(e[1]=Math.asin(Math.min(Math.max(n[8],-1),1)),Math.abs(n[8])<.99999?(e[0]=Math.atan2(-n[9],n[10]),e[2]=Math.atan2(-n[4],n[0])):(e[0]=Math.atan2(n[6],n[5]),e[2]=0)):i==="YXZ"?(e[0]=Math.asin(-Math.min(Math.max(n[9],-1),1)),Math.abs(n[9])<.99999?(e[1]=Math.atan2(n[8],n[10]),e[2]=Math.atan2(n[1],n[5])):(e[1]=Math.atan2(-n[2],n[0]),e[2]=0)):i==="ZXY"?(e[0]=Math.asin(Math.min(Math.max(n[6],-1),1)),Math.abs(n[6])<.99999?(e[1]=Math.atan2(-n[2],n[10]),e[2]=Math.atan2(-n[4],n[5])):(e[1]=0,e[2]=Math.atan2(n[1],n[0]))):i==="ZYX"?(e[1]=Math.asin(-Math.min(Math.max(n[2],-1),1)),Math.abs(n[2])<.99999?(e[0]=Math.atan2(n[6],n[10]),e[2]=Math.atan2(n[1],n[0])):(e[0]=0,e[2]=Math.atan2(-n[4],n[5]))):i==="YZX"?(e[2]=Math.asin(Math.min(Math.max(n[1],-1),1)),Math.abs(n[1])<.99999?(e[0]=Math.atan2(-n[9],n[5]),e[1]=Math.atan2(-n[2],n[0])):(e[0]=0,e[1]=Math.atan2(n[8],n[10]))):i==="XZY"&&(e[2]=Math.asin(-Math.min(Math.max(n[4],-1),1)),Math.abs(n[4])<.99999?(e[0]=Math.atan2(n[6],n[5]),e[1]=Math.atan2(n[8],n[0])):(e[0]=Math.atan2(-n[9],n[10]),e[1]=0)),e}const Y9=new H5;
427class nve extends Array{constructor(n=0,i=n,r=n,o="YXZ"){super(n,i,r),this.order=o,this.onChange=()=>{},this._target=this;const s=["0","1","2"];return new Proxy(this,{set(a,c){const u=Reflect.set(...arguments);return u&&s.includes(c)&&a.onChange(),u}})}get x(){return this[0]}get y(){return this[1]}get z(){return this[2]}set x(n){this._target[0]=n,this.onChange()}set y(n){this._target[1]=n,this.onChange()}set z(n){this._target[2]=n,this.onChange()}set(n,i=n,r=n){return n.length?this.copy(n):(this._target[0]=n,this._target[1]=i,this._target[2]=r,this.onChange(),this)}copy(n){return this._target[0]=n[0],this._target[1]=n[1],this._target[2]=n[2],this.onChange(),this}reorder(n){return this._target.order=n,this.onChange(),this}fromRotationMatrix(n,i=this.order){return tve(this._target,n,i),this.onChange(),this}fromQuaternion(n,i=this.order,r){return Y9.fromQuaternion(n),this._target.fromRotationMatrix(Y9,i),r||this.onChange(),this}fromArray(n,i=0){return this._target[0]=n[i],this._target[1]=n[i+1],this._target[2]=n[i+2],this}toArray(n=[],i=0){return n[i]=this[0],n[i+1]=this[1],n[i+2]=this[2],n}}class ive{constructor(){this.parent=null,this.children=[],this.visible=!0,this.matrix=new H5,this.worldMatrix=new H5,this.matrixAutoUpdate=!0,this.worldMatrixNeedsUpdate=!1,this.position=new Pd,this.quaternion=new O1e,this.scale=new Pd(1),this.rotation=new nve,this.up=new Pd(0,1,0),this.rotation._target.onChange=()=>this.quaternion.fromEuler(this.rotation,!0),this.quaternion._target.onChange=()=>this.rotation.fromQuaternion(this.quaternion,void 0,!0)}setParent(n,i=!0){this.parent&&n!==this.parent&&this.parent.removeChild(this,!1),this.parent=n,i&&n&&n.addChild(this,!1)}addChild(n,i=!0){~this.children.indexOf(n)||this.children.push(n),i&&n.setParent(this,!1)}removeChild(n,i=!0){~this.children.indexOf(n)&&this.children.splice(this.children.indexOf(n),1),i&&n.setParent(null,!1)}updateMatrixWorld(n){this.matrixAutoUpdate&&this.updateMatrix(),(this.worldMatrixNeedsUpdate||n)&&(this.parent===null?this.worldMatrix.copy(this.matrix):this.worldMatrix.multiply(this.parent.worldMatrix,this.matrix),this.worldMatrixNeedsUpdate=!1,n=!0);for(let i=0,r=this.children.length;i<r;i++)this.children[i].updateMatrixWorld(n)}updateMatrix(){this.matrix.compose(this.quaternion,this.position,this.scale),this.worldMatrixNeedsUpdate=!0}traverse(n){if(!n(this))for(let i=0,r=this.children.length;i<r;i++)this.children[i].traverse(n)}decompose(){this.matrix.decompose(this.quaternion._target,this.position,this.scale),this.rotation.fromQuaternion(this.quaternion)}lookAt(n,i=!1){i?this.matrix.lookAt(this.position,n,this.up):this.matrix.lookAt(n,this.position,this.up),this.matrix.getRotation(this.quaternion._target),this.rotation.fromQuaternion(this.quaternion)}}function rve(e,n){return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[4],e[4]=n[5],e[5]=n[6],e[6]=n[8],e[7]=n[9],e[8]=n[10],e}function ove(e,n){let i=n[0],r=n[1],o=n[2],s=n[3],a=i+i,c=r+r,u=o+o,m=i*a,h=r*a,g=r*c,x=o*a,y=o*c,w=o*u,j=s*a,v=s*c,_=s*u;return e[0]=1-g-w,e[3]=h-_,e[6]=x+v,e[1]=h+_,e[4]=1-m-w,e[7]=y-j,e[2]=x-v,e[5]=y+j,e[8]=1-m-g,e}function sve(e,n){return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e}function ave(e,n,i,r,o,s,a,c,u,m){return e[0]=n,e[1]=i,e[2]=r,e[3]=o,e[4]=s,e[5]=a,e[6]=c,e[7]=u,e[8]=m,e}function lve(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function cve(e,n){let i=n[0],r=n[1],o=n[2],s=n[3],a=n[4],c=n[5],u=n[6],m=n[7],h=n[8],g=h*a-c*m,x=-h*s+c*u,y=m*s-a*u,w=i*g+r*x+o*y;return w?(w=1/w,e[0]=g*w,e[1]=(-h*r+o*m)*w,e[2]=(c*r-o*a)*w,e[3]=x*w,e[4]=(h*i-o*u)*w,e[5]=(-c*i+o*s)*w,e[6]=y*w,e[7]=(-m*i+r*u)*w,e[8]=(a*i-r*s)*w,e):null}function X9(e,n,i){let r=n[0],o=n[1],s=n[2],a=n[3],c=n[4],u=n[5],m=n[6],h=n[7],g=n[8],x=i[0],y=i[1],w=i[2],j=i[3],v=i[4],_=i[5],$=i[6],k=i[7],P=i[8];return e[0]=x*r+y*a+w*m,e[1]=x*o+y*c+w*h,e[2]=x*s+y*u+w*g,e[3]=j*r+v*a+_*m,e[4]=j*o+v*c+_*h,e[5]=j*s+v*u+_*g,e[6]=$*r+k*a+P*m,e[7]=$*o+k*c+P*h,e[8]=$*s+k*u+P*g,e}function dve(e,n,i){let r=n[0],o=n[1],s=n[2],a=n[3],c=n[4],u=n[5],m=n[6],h=n[7],g=n[8],x=i[0],y=i[1];return e[0]=r,e[1]=o,e[2]=s,e[3]=a,e[4]=c,e[5]=u,e[6]=x*r+y*a+m,e[7]=x*o+y*c+h,e[8]=x*s+y*u+g,e}function uve(e,n,i){let r=n[0],o=n[1],s=n[2],a=n[3],c=n[4],u=n[5],m=n[6],h=n[7],g=n[8],x=Math.sin(i),y=Math.cos(i);
427return e[0]=y*r+x*a,e[1]=y*o+x*c,e[2]=y*s+x*u,e[3]=y*a-x*r,e[4]=y*c-x*o,e[5]=y*u-x*s,e[6]=m,e[7]=h,e[8]=g,e}function pve(e,n,i){let r=i[0],o=i[1];return e[0]=r*n[0],e[1]=r*n[1],e[2]=r*n[2],e[3]=o*n[3],e[4]=o*n[4],e[5]=o*n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e}function mve(e,n){let i=n[0],r=n[1],o=n[2],s=n[3],a=n[4],c=n[5],u=n[6],m=n[7],h=n[8],g=n[9],x=n[10],y=n[11],w=n[12],j=n[13],v=n[14],_=n[15],$=i*c-r*a,k=i*u-o*a,P=i*m-s*a,S=r*u-o*c,I=r*m-s*c,A=o*m-s*u,E=h*j-g*w,B=h*v-x*w,T=h*_-y*w,M=g*v-x*j,R=g*_-y*j,F=x*_-y*v,Y=$*F-k*R+P*M+S*T-I*B+A*E;return Y?(Y=1/Y,e[0]=(c*F-u*R+m*M)*Y,e[1]=(u*T-a*F-m*B)*Y,e[2]=(a*R-c*T+m*E)*Y,e[3]=(o*R-r*F-s*M)*Y,e[4]=(i*F-o*T+s*B)*Y,e[5]=(r*T-i*R-s*E)*Y,e[6]=(j*A-v*I+_*S)*Y,e[7]=(v*P-w*A-_*k)*Y,e[8]=(w*I-j*P+_*$)*Y,e):null}class hve extends Array{constructor(n=1,i=0,r=0,o=0,s=1,a=0,c=0,u=0,m=1){return super(n,i,r,o,s,a,c,u,m),this}set(n,i,r,o,s,a,c,u,m){return n.length?this.copy(n):(ave(this,n,i,r,o,s,a,c,u,m),this)}translate(n,i=this){return dve(this,i,n),this}rotate(n,i=this){return uve(this,i,n),this}scale(n,i=this){return pve(this,i,n),this}multiply(n,i){return i?X9(this,n,i):X9(this,this,n),this}identity(){return lve(this),this}copy(n){return sve(this,n),this}fromMatrix4(n){return rve(this,n),this}fromQuaternion(n){return ove(this,n),this}fromBasis(n,i,r){return this.set(n[0],n[1],n[2],i[0],i[1],i[2],r[0],r[1],r[2]),this}inverse(n=this){return cve(this,n),this}getNormalMatrix(n){return mve(this,n),this}}let fve=0;class gve extends ive{constructor(n,{geometry:i,program:r,mode:o=n.TRIANGLES,frustumCulled:s=!0,renderOrder:a=0}={}){super(),n.canvas||console.error("gl not passed as first argument to Mesh"),this.gl=n,this.id=fve++,this.geometry=i,this.program=r,this.mode=o,this.frustumCulled=s,this.renderOrder=a,this.modelViewMatrix=new H5,this.normalMatrix=new hve,this.beforeRenderCallbacks=[],this.afterRenderCallbacks=[]}onBeforeRender(n){return this.beforeRenderCallbacks.push(n),this}onAfterRender(n){return this.afterRenderCallbacks.push(n),this}draw({camera:n}={}){n&&(this.program.uniforms.modelMatrix||Object.assign(this.program.uniforms,{modelMatrix:{value:null},viewMatrix:{value:null},modelViewMatrix:{value:null},normalMatrix:{value:null},projectionMatrix:{value:null},cameraPosition:{value:null}}),this.program.uniforms.projectionMatrix.value=n.projectionMatrix,this.program.uniforms.cameraPosition.value=n.worldPosition,this.program.uniforms.viewMatrix.value=n.viewMatrix,this.modelViewMatrix.multiply(n.viewMatrix,this.worldMatrix),this.normalMatrix.getNormalMatrix(this.modelViewMatrix),this.program.uniforms.modelMatrix.value=this.worldMatrix,this.program.uniforms.modelViewMatrix.value=this.modelViewMatrix,this.program.uniforms.normalMatrix.value=this.normalMatrix),this.beforeRenderCallbacks.forEach(r=>r&&r({mesh:this,camera:n}));let i=this.program.cullFace&&this.worldMatrix.determinant()<0;this.program.use({flipFaces:i}),this.geometry.draw({mode:this.mode,program:this.program}),this.afterRenderCallbacks.forEach(r=>r&&r({mesh:this,camera:n}))}}class yve extends u1e{constructor(n,{attributes:i={}}={}){Object.assign(i,{position:{size:2,data:new Float32Array([-1,-1,3,-1,-1,3])},uv:{size:2,data:new Float32Array([0,0,2,0,0,2])}}),super(n,i)}}const xve={r:129,g:140,b:248},bve={r:79,g:70,b:229},vve={r:0,g:0,b:0},aM=e=>`vec3(${(e.r/255).toFixed(6)}, ${(e.g/255).toFixed(6)}, ${(e.b/255).toFixed(6)})`,wve=aM(xve),jve=aM(bve),_ve=aM(vve),Cve=.6,Sve=.65,kve=p.div.withConfig({displayName:"Orb__OrbContainer",componentId:"sc-1f3f2un-0"})` 428 width: 100%; 429 height: 100%; 430`;function $ve({hue:e=0,hoverIntensity:n=.2,rotateOnHover:i=!0,forceHoverState:r=!1}){const o=l.useRef(null),s=` 431 precision highp float; 432 attribute vec2 position; 433 attribute vec2 uv; 434 varying vec2 vUv; 435 void main() { 436 vUv = uv; 437 gl_Position = vec4(position, 0.0, 1.0); 438 } 439 `,a=` 440 precision highp float; 441 442 uniform float iTime; 443 uniform vec3 iResolution; 444 uniform float hue; 445 uniform float hover; 446 uniform float rot; 447 uniform float hoverIntensity; 448 varying vec2 vUv; 449 450 vec3 rgb2yiq(vec3 c) {
451 float y = dot(c, vec3(0.299, 0.587, 0.114)); 452 float i = dot(c, vec3(0.596, -0.274, -0.322)); 453 float q = dot(c, vec3(0.211, -0.523, 0.312)); 454 return vec3(y, i, q); 455 } 456 457 vec3 yiq2rgb(vec3 c) { 458 float r = c.x + 0.956 * c.y + 0.621 * c.z; 459 float g = c.x - 0.272 * c.y - 0.647 * c.z; 460 float b = c.x - 1.106 * c.y + 1.703 * c.z; 461 return vec3(r, g, b); 462 } 463 464 vec3 adjustHue(vec3 color, float hueDeg) { 465 float hueRad = hueDeg * 3.14159265 / 180.0; 466 vec3 yiq = rgb2yiq(color); 467 float cosA = cos(hueRad); 468 float sinA = sin(hueRad); 469 float i = yiq.y * cosA - yiq.z * sinA; 470 float q = yiq.y * sinA + yiq.z * cosA; 471 yiq.y = i; 472 yiq.z = q; 473 return yiq2rgb(yiq); 474 } 475 476 vec3 hash33(vec3 p3) { 477 p3 = fract(p3 * vec3(0.1031, 0.11369, 0.13787)); 478 p3 += dot(p3, p3.yxz + 19.19); 479 return -1.0 + 2.0 * fract(vec3( 480 p3.x + p3.y, 481 p3.x + p3.z, 482 p3.y + p3.z 483 ) * p3.zyx); 484 } 485 486 float snoise3(vec3 p) { 487 const float K1 = 0.333333333; 488 const float K2 = 0.166666667; 489 vec3 i = floor(p + (p.x + p.y + p.z) * K1); 490 vec3 d0 = p - (i - (i.x + i.y + i.z) * K2); 491 vec3 e = step(vec3(0.0), d0 - d0.yzx); 492 vec3 i1 = e * (1.0 - e.zxy); 493 vec3 i2 = 1.0 - e.zxy * (1.0 - e); 494 vec3 d1 = d0 - (i1 - K2); 495 vec3 d2 = d0 - (i2 - K1); 496 vec3 d3 = d0 - 0.5; 497 vec4 h = max(0.6 - vec4( 498 dot(d0, d0), 499 dot(d1, d1), 500 dot(d2, d2), 501 dot(d3, d3) 502 ), 0.0); 503 vec4 n = h * h * h * h * vec4( 504 dot(d0, hash33(i)), 505 dot(d1, hash33(i + i1)), 506 dot(d2, hash33(i + i2)), 507 dot(d3, hash33(i + 1.0)) 508 ); 509 return dot(vec4(31.316), n); 510 } 511 512 vec4 extractAlpha(vec3 colorIn) { 513 float a = max(max(colorIn.r, colorIn.g), colorIn.b); 514 return vec4(colorIn.rgb / (a + 1e-5), a); 515 } 516 517 const vec3 baseColor1 = ${wve}; 518 const vec3 baseColor2 = ${jve}; 519 const vec3 baseColor3 = ${_ve}; 520 const float innerRadius = ${Cve}; 521 const float noiseScale = ${Sve}; 522 523 float light1(float intensity, float attenuation, float dist) { 524 return intensity / (1.0 + dist * attenuation); 525 } 526 527 float light2(float intensity, float attenuation, float dist) { 528 return intensity / (1.0 + dist * dist * attenuation); 529 } 530 531 vec4 draw(vec2 uv) { 532 vec3 color1 = adjustHue(baseColor1, hue); 533 vec3 color2 = adjustHue(baseColor2, hue); 534 vec3 color3 = adjustHue(baseColor3, hue); 535 536 float ang = atan(uv.y, uv.x); 537 float len = length(uv); 538 float invLen = len > 0.0 ? 1.0 / len : 0.0; 539 540 float n0 = snoise3(vec3(uv * noiseScale, iTime * 0.5)) * 0.5 + 0.5; 541 float r0 = mix(mix(innerRadius, 1.0, 0.4), mix(innerRadius, 1.0, 0.6), n0); 542 float d0 = distance(uv, (r0 * invLen) * uv); 543 float v0 = light1(1.0, 10.0, d0); 544 v0 *= smoothstep(r0 * 1.05, r0, len); 545 float cl = cos(ang + iTime * 2.0) * 0.5 + 0.5; 546 547 float a = iTime * -1.0; 548 vec2 pos = vec2(cos(a), sin(a)) * r0; 549 float d = distance(uv, pos); 550 float v1 = light2(1.25, 5.0, d); 551 v1 *= light1(1.0, 50.0, d0); 552 553 float v2 = smoothstep(1.0, mix(innerRadius, 1.0, n0 * 0.5), len); 554 float v3 = smoothstep(innerRadius, mix(innerRadius, 1.0, 0.5), len); 555 556 vec3 col = mix(color1, color2, cl); 557 col = mix(color3, col, v0); 558 col = (col + v1) * v2 * v3; 559 col = clamp(col, 0.0, 1.0); 560 561 return extractAlpha(col); 562 } 563 564 vec4 mainImage(vec2 fragCoord) { 565 vec2 center = iResolution.xy * 0.5; 566 float size = min(iResolution.x, iResolution.y); 567 vec2 uv = (fragCoord - center) / size * 2.0; 568 569 float angle = rot; 570 float s = sin(angle); 571 float c = cos(angle); 572 uv = vec2(c * uv.x - s * uv.y, s * uv.x + c * uv.y); 573 574 uv.x += hover * hoverIntensity * 0.1 * sin(uv.y * 10.0 + iTime); 575 uv.y += hover * hoverIntensity * 0.1 * sin(uv.x * 10.0 + iTime); 576 577 return draw(uv); 578 } 579 580 void main() { 581 vec2 fragCoord = vUv * iResolution.xy; 582 vec4 col = mainImage(fragCoord); 583 gl_FragColor = vec4(col.rgb * col.a, col.a); 584 } 585 `;return l.useEffect(()=>{const c=o.current;if(!c||c.clientWidth===0||c.clientHeight===0)return;const u=new x1e({alpha:!0,premultipliedAlpha:!1}),m=u.gl;m.clearColor(0,0,0,0),c.appendChild(m.canvas);const h=new yve(m),g=new m1e(m,{vertex:s,fragment:a,uniforms:{iTime:{value:0},iResolution:{value:new Pd(m.canvas.width,m.canvas.height,m.canvas.width/m.canvas.height)},hue:{value:e},hover:{value:0},rot:{value:0},hoverIntensity:{value:n}}}),x=new gve(m,{geometry:h,program:g});function y(){if(!c)return;
585const I=window.devicePixelRatio||1,A=c.clientWidth,E=c.clientHeight;A===0||E===0||(u.setSize(A*I,E*I),m.canvas.style.width=A+"px",m.canvas.style.height=E+"px",g.uniforms.iResolution.value.set(m.canvas.width,m.canvas.height,m.canvas.width/m.canvas.height))}window.addEventListener("resize",y),y();let w=0,j=0,v=0;const _=.3,$=I=>{const A=c.getBoundingClientRect(),E=I.clientX-A.left,B=I.clientY-A.top,T=A.width,M=A.height,R=Math.min(T,M),F=T/2,Y=M/2,H=(E-F)/R*2,U=(B-Y)/R*2;Math.sqrt(H*H+U*U)<.8?w=1:w=0},k=()=>{w=0};c.addEventListener("mousemove",$),c.addEventListener("mouseleave",k);let P;const S=I=>{P=requestAnimationFrame(S);const A=(I-j)*.001;j=I,g.uniforms.iTime.value=I*.001,g.uniforms.hue.value=e,g.uniforms.hoverIntensity.value=n;const E=r?1:w;g.uniforms.hover.value+=(E-g.uniforms.hover.value)*.1,i&&E>.5&&(v+=A*_),g.uniforms.rot.value=v,u.render({scene:x})};return P=requestAnimationFrame(S),()=>{cancelAnimationFrame(P),window.removeEventListener("resize",y),c.removeEventListener("mousemove",$),c.removeEventListener("mouseleave",k),c.removeChild(m.canvas),m.getExtension("WEBGL_lose_context")?.loseContext()}},[e,n,i,r]),t.jsx(kve,{ref:o})}const Ive="0 4px 6px rgba(0, 0, 0, 0.4)",Pve="0 10px 15px rgba(0, 0, 0, 0.4)",Ave=p.div.withConfig({displayName:"StackedLLMAvatars__Container",componentId:"sc-1i2ilgp-0"})` 586 display: flex; 587 align-items: center; 588`,Nve=p.div.withConfig({displayName:"StackedLLMAvatars__AvatarWrapper",componentId:"sc-1i2ilgp-1"})` 589 position: relative; 590 width: ${e=>e.$size==="small"?"1.5rem":"2rem"}; 591 height: ${e=>e.$size==="small"?"1.5rem":"2rem"}; 592 border-radius: 50%; 593 background-color: ${$e}; 594 box-shadow: ${Ive}; 595 display: flex; 596 align-items: center; 597 justify-content: center; 598 padding: ${e=>e.$size==="small"?"0.25rem":"0.375rem"}; 599 border: 1px solid ${Rt}; 600 margin-left: ${e=>e.$size==="small"?"-0.375rem":"-0.5rem"}; 601 602 @media (min-width: 768px) { 603 width: ${e=>e.$size==="small"?"1.75rem":"2.5rem"}; 604 height: ${e=>e.$size==="small"?"1.75rem":"2.5rem"}; 605 padding: ${e=>e.$size==="small"?"0.375rem":"0.5rem"}; 606 margin-left: ${e=>e.$size==="small"?"-0.5rem":"-0.75rem"}; 607 box-shadow: ${Pve}; 608 } 609 610 &:first-child { 611 margin-left: 0; 612 } 613`,zve=p.div.withConfig({displayName:"StackedLLMAvatars__IconWrapper",componentId:"sc-1i2ilgp-2"})` 614 width: 100%; 615 height: 100%; 616 display: flex; 617 align-items: center; 618 justify-content: center; 619 color: ${O}; 620 621 svg { 622 width: 100%; 623 height: 100%; 624 max-width: ${e=>e.$size==="small"?"0.875rem":"1.25rem"}; 625 max-height: ${e=>e.$size==="small"?"0.875rem":"1.25rem"}; 626 627 @media (min-width: 768px) { 628 max-width: ${e=>e.$size==="small"?"1rem":"1.5rem"}; 629 max-height: ${e=>e.$size==="small"?"1rem":"1.5rem"}; 630 } 631 } 632`,Tve=[{icon:ju,alt:"OpenAI"},{icon:nh,alt:"Claude"},{icon:wu,alt:"Gemini"},{icon:ih,alt:"Perplexity"}];function Eve({size:e="default"}){return t.jsx(Ave,{children:Tve.map((n,i)=>t.jsx(Nve,{title:n.alt,$size:e,children:t.jsx(zve,{$size:e,children:t.jsx(n.icon,{})})},i))})}const Mve=Z,Rve=O,Q9=Cf,Ove=p.div.withConfig({displayName:"OrbPanel__GradientSection",componentId:"sc-1xvuurb-0"})` 633 display: flex; 634 width: 100%; 635 flex: 0 0 auto; 636 min-height: 40vh; 637 position: relative; 638 align-items: center; 639 justify-content: center; 640 overflow: hidden; 641 background-color: ${Mve}; 642 order: 1; /* Appears first on mobile */ 643 644 @media (min-width: 1024px) { 645 width: 50%; 646 flex: 0 0 50%; 647 min-height: 100vh; 648 order: 2; /* Appears second on desktop */ 649 } 650 651 /* Dashed Bottom Full Width Fade Grid */ 652 &::before { 653 content: ''; 654 position: absolute; 655 inset: 0; 656 z-index: 0; 657 background-image: 658 linear-gradient(to right, ${Q9} 1px, ${hn} 1px), 659 linear-gradient(to bottom, ${Q9} 1px, ${hn} 1px); 660 background-size: 20px 20px; 661 background-position: 0 0, 0 0; 662 mask-image: 663 repeating-linear-gradient( 664 to right, 665 ${mn} 0px, 666 ${mn} 3px, 667 ${hn} 3px, 668 ${hn} 8px 669 ), 670 repeating-linear-gradient( 671 to bottom, 672 ${mn} 0px, 673 ${mn} 3px, 674 ${hn} 3px, 675 ${hn} 8px 676 ), 677 linear-gradient(to top, ${mn} 0%, ${mn} 40%, ${hn} 70%); 678 -webkit-mask-image: 679 repeating-linear-gradient( 680 to right, 681 ${mn} 0px, 682 ${mn} 3px, 683 ${hn} 3px, 684 ${hn} 8px 685 ), 686 repeating-linear-gradient( 687 to bottom, 688 ${mn} 0px, 689 ${mn} 3px, 690 ${hn} 3px, 691 ${hn} 8px 692 ), 693 linear-gradient(to top, ${mn} 0%, ${mn} 40%, ${hn} 70%); 694 mask-composite: intersect; 695 -webkit-mask-composite: source-in; 696 pointer-events: none; 697 } 698`,Dve=p.div.withConfig({displayName:"OrbPanel__OrbContainer",componentId:"sc-1xvuurb-1"})` 699 position: absolute; 700 top: 0; 701 right: 0; 702 bottom: 0; 703 left: 0; 704 width: 100%; 705 height: 100%; 706 z-index: 1; 707 min-height: 100%; 708 709 @media (max-width: 1023px) { 710 /* Ensure orb is visible and properly sized on mobile */ 711 min-height: 40vh; 712 } 713`,Lve=p.div.withConfig({displayName:"OrbPanel__ContentWrapper",componentId:"sc-1xvuurb-2"})` 714 position: relative; 715 z-index: 10; 716 display: flex; 717 flex-direction: column; 718 align-items: center; 719 gap: 1rem; 720 text-align: center; 721 padding: 2rem 1.5rem; 722 723 @media (min-width: 1024px) { 724 gap: 1.5rem; 725 padding-left: 1.5rem; 726 padding-right: 1.5rem; 727 } 728`,Bve=p.div.withConfig({displayName:"OrbPanel__BottomLeftSlot",componentId:"sc-1xvuurb-3"})` 729 position: absolute; 730 left: 1.25rem; 731 bottom: 1.25rem; 732 z-index: 20; 733 max-width: 18rem; 734 735 @media (max-width: 1023px) { 736 left: 1rem; 737 bottom: 1rem; 738 max-width: calc(100% - 2rem); 739 } 740`,Fve=p.div.withConfig({displayName:"OrbPanel__TopRightSlot",componentId:"sc-1xvuurb-4"})` 741 position: absolute; 742 right: 1.25rem; 743 top: 1.25rem; 744 z-index: 20; 745 max-width: 18rem; 746 747 @media (max-width: 1023px) { 748 right: 1rem; 749 top: 1rem; 750 max-width: calc(100% - 2rem); 751 } 752`,Wve=p.div.withConfig({displayName:"OrbPanel__TopLeftSlot",componentId:"sc-1xvuurb-5"})` 753 position: absolute; 754 left: 1.25rem; 755 top: 1.25rem; 756 z-index: 20; 757 max-width: 18rem; 758 759 @media (max-width: 1023px) { 760 left: 1rem; 761 top: 1rem; 762 max-width: calc(100% - 2rem); 763 } 764`,Uve=p.h1.withConfig({displayName:"OrbPanel__Heading",componentId:"sc-1xvuurb-6"})` 765 text-transform: capitalize; 766 font-size: ${e=>e.$size==="small"?"1.25rem":"1.5rem"}; 767 font-weight: 600; 768 letter-spacing: -0.025em; 769 color: ${Rve}; 770 margin: 0; 771 772 @media (min-width: 768px) { 773 font-size: ${e=>e.$size==="small"?"1.5rem":"1.875rem"}; 774 } 775 776 @media (min-width: 1024px) { 777 font-size: ${e=>e.$size==="small"?"2rem":"3rem"}; 778 } 779`,Hve=p(Dve).withConfig({displayName:"OrbPanel__StyledOrbContainer",componentId:"sc-1xvuurb-7"})` 780 transform: ${e=>e.$size==="small"?"scale(0.7)":"scale(1)"}; 781 transform-origin: center; 782 transition: transform 0.3s ease; 783`;function xa({size:e="default",bottomLeft:n,topLeft:i,topRight:r}){return t.jsxs(Ove,{children:[t.jsx(Hve,{$size:e,children:t.jsx($ve,{hoverIntensity:.5,rotateOnHover:!0,hue:0,forceHoverState:!1})}),t.jsxs(Lve,{children:[t.jsx(Uve,{$size:e,children:"Be the answer in AI"}),t.jsx(Eve,{size:e})]}),n?t.jsx(Bve,{children:n}):null,i?t.jsx(Wve,{children:i}):null,r?t.jsx(Fve,{children:r}):null]})}const qve=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,Fb=e=>qve.test(e),Gve=(e="")=>{try{return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}catch{return e}},Qg=e=>e.replace(/\b\w/g,n=>n.toUpperCase()),q5="8 minimum length, 1 uppercase, 1 lowercase, 1 number.",Vve=/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d).{8,}$/;function v_(e){return Vve.test(String(e||""))}function Kve(e){return String(e||"").length>0}function Yve(e){const n=String(e||"");return[{key:"minLength",label:"8 minimun length",ok:n.length>=8},{key:"upper",label:"1 uppercase",ok:/[A-Z]/.test(n)},{key:"lower",label:"1 lowercase",ok:/[a-z]/.test(n)},{key:"number",label:"1 number",ok:/\d/.test(n)}]}const Xve={},Qve="open".trim().toLowerCase(),Zve="open",oie=Qve||Zve,Jve=String(Xve?.VITE_DISABLE_SIGNUP||"").trim().toLowerCase()==="true",xf=oie==="disabled"||Jve,w_=oie==="invite_only",ewe=!1,Z9=p.span.withConfig({displayName:"Sign
783In__LastUsedPill",componentId:"sc-1tqjaxu-0"})` 784 position: absolute; 785 top: -8px; 786 right: -6px; 787 z-index: 1; 788 display: inline-flex; 789 align-items: center; 790 font-size: 0.55rem; 791 font-weight: 700; 792 letter-spacing: 0.04em; 793 text-transform: uppercase; 794 color: ${z}; 795 background: ${V}; 796 border-radius: 999px; 797 padding: 2px 7px; 798 line-height: 1.3; 799 white-space: nowrap; 800`,twe=p.div.withConfig({displayName:"SignIn__GoogleBtnRow",componentId:"sc-1tqjaxu-1"})` 801 position: relative; 802`,nwe=p.div.withConfig({displayName:"SignIn__EmailGroupWrap",componentId:"sc-1tqjaxu-2"})` 803 position: relative; 804`;function iwe(){const{login:e}=yn(),{handleGoogleSignIn:n,isGoogleLoading:i,googleError:r}=Kne(),[o]=yr(),[s,a]=l.useState(!1),[c,u]=l.useState(""),[m,h]=l.useState(""),[g,x]=l.useState({}),y=localStorage.getItem("X_last_auth");l.useEffect(()=>{const P=o.get("invite_token");P&&oM(P)},[o]);const w=o.get("invite_token")||wb(),j=w?`/signup?invite_token=${encodeURIComponent(w)}`:"/signup",v=!xf&&(!w_||!!w),_=()=>{const P={};return c.trim()?Fb(c)||(P.email="Please enter a valid email address"):P.email="Email is required",m||(P.password="Password is required"),x(P),Object.keys(P).length===0},$=()=>c.trim()!==""&&Fb(c)&&Kve(m),k=async P=>{if(P.preventDefault(),x({}),!!_()){a(!0);try{const S=await ue("/api/v1/auth/signin",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:c.trim().toLowerCase(),password:m})});if(S.ok){const I=await S.json();I.access_token&&I.refresh_token&&I.user?(localStorage.setItem("X_last_auth","email"),e(I.access_token,I.refresh_token,I.user)):x({general:"Invalid response from server. Please try again."})}else{const I=await S.json();I.error?x({general:I.error}):x({general:"Invalid email or password"})}}catch(S){console.error("Signin error:",S),x({general:"Network error. Please check your connection and try again."})}finally{a(!1)}}};return t.jsxs(Bm,{children:[t.jsx(xa,{}),t.jsx(Fm,{children:t.jsx(Wm,{children:t.jsxs(Um,{children:[t.jsxs(Hm,{children:[t.jsx(kf,{children:"Sign In"}),t.jsx($f,{children:"Enter your credentials to access your account"})]}),t.jsxs(Z_,{onSubmit:k,children:[g.general&&t.jsx(Mm,{children:g.general}),r&&t.jsx(Mm,{children:r}),t.jsxs(twe,{children:[y==="google"&&t.jsx(Z9,{children:"Last used"}),t.jsxs(Jne,{type:"button",disabled:i,onClick:n,children:[t.jsx(Zne,{children:t.jsx(ya,{})}),i?"Signing in...":"Continue with Google"]})]}),t.jsxs(Xne,{children:[t.jsx(U5,{}),t.jsx(Qne,{children:"Or continue with email"}),t.jsx(U5,{})]}),t.jsxs(Cy,{children:[t.jsxs(nwe,{children:[y==="email"&&t.jsx(Z9,{children:"Last used"}),t.jsx(Xt,{id:"email",type:"email",placeholder:"Enter your email",value:c,onChange:P=>{u(P.target.value),g.email&&x({...g,email:void 0})},variant:g.email?"error":"default"})]}),g.email&&t.jsx(_p,{children:g.email})]}),t.jsxs(Cy,{children:[t.jsx(Em,{id:"password",placeholder:"Enter your password",value:m,onChange:P=>{h(P.target.value),g.password&&x({...g,password:void 0})},variant:g.password?"error":"default"}),t.jsx("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:"0.5rem"},children:t.jsx(Tbe,{as:Dn,to:"/forgot-password",children:"Forgot password?"})}),g.password&&t.jsx(_p,{children:g.password})]}),t.jsx(he,{type:"submit",variant:"outline",fullWidth:!0,size:"md",disabled:!$()||s,children:s?"Signing In...":"Sign In"}),v?t.jsxs(Ebe,{children:["Don't have an account?"," ",t.jsx(Dn,{to:j,children:"Sign up"})]}):null]})]})})})]})}const rwe=z,owe=Pe,sie=ot,J9=p.div.withConfig({displayName:"SignUpstyle__FormRow",componentId:"sc-1xcue65-0"})` 805 display: flex; 806 gap: 1rem; 807 width: 100%; 808`,mk=p.div.withConfig({displayName:"SignUpstyle__FormRowItem",componentId:"sc-1xcue65-1"})` 809 flex: 1; 810 display: flex; 811 flex-direction: column; 812 gap: 0.5rem; 813`,swe=p.p.withConfig({displayName:"SignUpstyle__AgreementText",componentId:"sc-1xcue65-2"})` 814 font-size: 0.75rem; 815 color: ${rwe}; 816 text-align: center; 817 margin: 0; 818 819 a { 820 color: ${sie}; 821 text-decoration: none; 822 font-weight: 500; 823 transition: text-decoration 0.2s; 824 825 &:hover { 826 text-decoration: underline; 827 } 828 } 829`,awe=p.p.withConfig({displayName:"SignUpstyle__SignInLink",componentId:"sc-1xcue65-3"})` 830 text-align: center; 831 font-size: 0.875rem; 832 color: ${owe}; 833 margin-top: 1rem; 834 835 a { 836 color: ${sie}; 837 text-decoration: none; 838 font-weight: 500; 839 transition: text-decoration 0.2s; 840 841 &:hover { 842 text-decoration: underline; 843 } 844 } 845`,lwe=p.div.withConfig({displayName:"PasswordRequirements__Wrap",componentId:"sc-q7ssys-0"})` 846 margin-top: 6px; 847 display: grid; 848 gap: 4px; 849 color: ${z}; 850 font-size: 0.7rem; 851 font-weight: 600; 852 line-height: 1.2; 853`,cwe=p.div.withConfig({displayName:"PasswordRequirements__Item",componentId:"sc-q7ssys-1"})` 854 display: inline-flex; 855 align-items: center; 856 gap: 6px; 857 color: ${e=>e.$ok?Vt:Ut}; 858`,dwe=p.span.withConfig({displayName:"PasswordRequirements__IconWrap",componentId:"sc-q7ssys-2"})` 859 display: inline-flex; 860 align-items: center; 861 justify-content: center; 862`;function lM({password:e}){const n=String(e||"");if(n.length===0)return null;const i=Yve(n);return t.jsx(lwe,{"aria-live":"polite",children:i.map(r=>
862t.jsxs(cwe,{$ok:r.ok,children:[t.jsx(dwe,{"aria-hidden":"true",children:r.ok?t.jsx(co,{size:14}):t.jsx(Hc,{size:14})}),t.jsx("span",{children:r.label})]},r.key))})}const uwe=p.span.withConfig({displayName:"SignUp__LastUsedPill",componentId:"sc-bf6eag-0"})` 863 position: absolute; 864 top: -8px; 865 right: -6px; 866 z-index: 1; 867 display: inline-flex; 868 align-items: center; 869 font-size: 0.55rem; 870 font-weight: 700; 871 letter-spacing: 0.04em; 872 text-transform: uppercase; 873 color: ${z}; 874 background: ${V}; 875 border-radius: 999px; 876 padding: 2px 7px; 877 line-height: 1.3; 878 white-space: nowrap; 879`,pwe=p.div.withConfig({displayName:"SignUp__GoogleBtnRow",componentId:"sc-bf6eag-1"})` 880 position: relative; 881`;function mwe(){const e=zn(),{login:n}=yn(),{handleGoogleSignIn:i,isGoogleLoading:r,googleError:o}=Kne(),[s]=yr(),[a,c]=l.useState(!1),[u,m]=l.useState(""),[h,g]=l.useState(""),[x,y]=l.useState(""),[w,j]=l.useState(""),[v,_]=l.useState(""),[$,k]=l.useState({}),[P,S]=l.useState(null),I=localStorage.getItem("X_last_auth"),A=s.get("invite_token")||wb();l.useEffect(()=>{const R=s.get("invite_token");R&&oM(R)},[s]);const E=A?`/signin?invite_token=${encodeURIComponent(A)}`:"/signin";l.useEffect(()=>{let R=!1;const F=A?.toString().trim();if(!F){S(null);return}return ue(`/api/v1/invitations/${encodeURIComponent(F)}`,{method:"GET"}).then(async Y=>{const H=await Y.json().catch(()=>({}));if(!Y.ok)throw Cp(),new Error(H?.error||"This invitation link is invalid or has expired. Please request a new one.");const U=H?.invitation||{},X=U?.revoked_at?String(U.revoked_at):"",Q=U?.accepted_at?String(U.accepted_at):"",K=Date.parse(U?.expires_at?String(U.expires_at):""),G=Number.isFinite(K)?K<=Date.now():!1;if(X||Q||G){Cp(),R||S(X?"This invitation link was revoked. Please request a new invitation.":Q?"This invitation link was already used. Please request a new invitation.":"This invitation link expired. Please request a new invitation.");return}R||S(null)}).catch(Y=>{R||S(Y?.message||"This invitation link is invalid or has expired. Please request a new one.")}),()=>{R=!0}},[A]),l.useEffect(()=>{if(xf){e(`/signup-disabled${A?`?invite_token=${encodeURIComponent(A)}`:""}`,{replace:!0});return}w_&&!A&&e("/signup-disabled",{replace:!0})},[xf,w_,A,e]);const B=()=>{const R={};return u.trim()||(R.firstName="First name is required"),h.trim()||(R.lastName="Last name is required"),x.trim()?Fb(x)||(R.email="Please enter a valid email address"):R.email="Email is required",w?v_(w)||(R.password=q5):R.password="Password is required",v?w!==v&&(R.confirmPassword="Passwords do not match"):R.confirmPassword="Please confirm your password",k(R),Object.keys(R).length===0},T=()=>u.trim()!==""&&h.trim()!==""&&x.trim()!==""&&Fb(x)&&w!==""&&v_(w)&&v!==""&&w===v,M=async R=>{if(R.preventDefault(),k({}),!!B()){c(!0);try{const F=s.get("invite_token")||wb(),Y=await ue("/api/v1/auth/signup",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({user:{first_name:u.trim().toLowerCase(),last_name:h.trim().toLowerCase(),email:x.trim().toLowerCase(),password:w,password_confirmation:v},...F?{invite_token:F}:{}})});if(Y.ok){const H=await Y.json();H.access_token&&H.refresh_token?(n(H.access_token,H.refresh_token,H.user),F?e(`/invite?token=${encodeURIComponent(F)}`,{replace:!0}):e("/verify-email",{replace:!0})):(Im(),e("/signup",{replace:!0}))}else{const H=await Y.json(),U=H?.errors?.error_code?String(H.errors.error_code):null;if(!!(s.get("invite_token")||wb())&&(U==="invite_invalid"||U==="invite_inactive"||U==="invite_email_mismatch")){Cp(),k({general:U==="invite_email_mismatch"?"This invitation link is for a different email address. Please sign up with the invited email, or request a new invitation.":"This invitation link is invalid or has expired. Please request a new invitation."});return}if(H.errors&&Array.isArray(H.errors)){const K={};H.errors.forEach(L=>{const q=L.toLowerCase();q.includes("first name")?K.firstName=L:q.includes("last name")?K.lastName=L:q.includes("email")?K.email=L:q.includes("password")?q.includes("confirmation")||q.includes("match")?K.confirmPassword=L:K.password=L:K.general=L}),k(K)}else H.error?k({general:H.error}):k({general:"An error occurred. Please try again."})}}catch{k({general:"Network error. Please check your connection and try again."})}finally{c(!1)}}};return t.jsxs(Bm,{children:[t.jsx(xa,{}),t.jsx(Fm,{children:t.jsx(Wm,{children:t.jsxs(Um,{children:[t.jsxs(Hm,{children:[t.jsx(kf,{children:"Sign Up"}),t.jsx($f,{children:"Create an account to get started"})]}),t.jsxs(Z_,{onSubmit:M,children:[P?t.jsx(Mm,{children:P}):null,$.general&&t.jsx(Mm,{children:$.general}),o&&t.jsx(Mm,{children:o}),t.jsxs(pwe,{children:[I==="google"&&t.jsx(uwe,{children:"Last used"}),t.jsxs(Jne,{type:"button",disabled:r,onClick:i,children:[t.jsx(Zne,{children:t.jsx(ya,{})}),r?"Signing up...":"Continue with Google"]})]}),t.jsxs(swe,{children:["By proceeding, you are agreeing to the"," ",t.jsx("a",{href:"https://www.ceyo.ai/terms",target:"_blank",rel:"noopener noreferrer",children:"Terms of Service"})," ","and"," ",t.jsx("a",{href:"https://www.ceyo.ai/privacy",target:"_blank",rel:"noopener noreferrer",children:"Privacy Policy"})]}),t.jsxs(Xne,{children:[t.jsx(U5,{}),t.jsx(Qne,{children:"Or continue with email"}),t.jsx(U5,{})]}),t.jsxs(J9,{children:[t.jsxs(mk,{children:[t.jsx(Xt,{id:"firstName",type:"text",placeholder:"First name",value:u,onChange:R=>{m(R.target.value),$.firstName&&k({...$,firstName:void 0})},variant:$.firstName?"error":"default",fullWidth:!0}),$.firstName&&t.jsx(_p,{children:$.firstName})]}),t.jsxs(mk,{children:[t.jsx(Xt,{id:"lastName",type:"text",placeholder:"Last name",value:h,onChange:R=>{g(R.target.value),$.lastName&&k({...$,lastName:void 0})},variant:$.lastName?"error":"default",fullWidth:!0}),$.lastName&&t.jsx(_p,{children:$.lastName})]})]}),t.jsxs(Cy,{children:[t.jsx(Xt,{id:"email",type:"email",placeholder:"Enter your email",value:x,onChange:R=>{y(R.target.value),$.email&&k({...$,email:void 0})},variant:$.email?"error":"default"}),$.email&&t.jsx(_p,{children:$.email})]}),t.jsxs(J9,{children:[t.jsxs(mk,{children:[t.jsx(Em,{id:"password",placeholder:"Enter your password",value:w,onChange:R=>{j(R.target.value),$.password&&k({...$,password:void 0})},variant:$.password?"error":"default",fullWidth:!0}),t.jsx(lM,{password:w}),$.password&&t.jsx(_p,{children:$.password})]}),t.jsxs(mk,{children:[t.jsx(Em,{id:"confirmPassword",placeholder:"Confirm your password",value:v,onCh
881ange:R=>{_(R.target.value),$.confirmPassword&&k({...$,confirmPassword:void 0})},variant:$.confirmPassword?"error":"default",fullWidth:!0}),$.confirmPassword&&t.jsx(_p,{children:$.confirmPassword})]})]}),t.jsx(he,{type:"submit",variant:"outline",fullWidth:!0,size:"md",disabled:!T()||a,children:a?"Creating Account...":"Create Account"}),t.jsxs(awe,{children:["Already have an account?"," ",t.jsx(Dn,{to:E,children:"Sign in"})]})]})]})})})]})}function hwe(){const[e]=yr(),n=e.get("invite_token"),i=zn();return t.jsxs(Bm,{children:[t.jsx(xa,{}),t.jsx(Fm,{children:t.jsx(Wm,{children:t.jsxs(Um,{children:[t.jsxs(Hm,{children:[t.jsx(kf,{children:w_&&!xf?"Sign up is invite-only":"Sign up is disabled"}),t.jsxs($f,{children:[w_&&!xf?"This environment only allows new accounts via an invitation link.":"Sign up is not available in this environment right now.",n?" (This invite link requires sign up.)":""]})]}),t.jsx(he,{type:"button",fullWidth:!0,size:"md",onClick:()=>i("/signin"),children:"Go to sign in"})]})})})]})}const Vg=e=>{switch(e){case"primary":return{bg:ot,color:Z,border:"1px solid transparent",hoverBg:Ft,activeBg:Kl,hoverBorder:"transparent",caretColor:Z};case"outline":return{bg:Z,color:O,border:`1px solid ${Rt}`,hoverBg:At,activeBg:V,hoverBorder:Pe,caretColor:Pe};case"ghost":return{bg:"transparent",color:O,border:"1px solid transparent",hoverBg:$e,activeBg:V,hoverBorder:"transparent",caretColor:Pe};case"danger":return{bg:Ut,color:Z,border:"1px solid transparent",hoverBg:oi,activeBg:sr,hoverBorder:"transparent",caretColor:Z};default:return{bg:ot,color:Z,border:"1px solid transparent",hoverBg:Ft,activeBg:Kl,hoverBorder:"transparent",caretColor:Z}}},cM="'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif",v5={sm:{height:"2rem",fontSize:"0.75rem",padding:"0.5rem 0.75rem",iconSize:12},md:{height:"2.75rem",fontSize:"0.875rem",padding:"0.75rem 1rem",iconSize:14},lg:{height:"3.5rem",fontSize:"1rem",padding:"1rem 1.25rem",iconSize:16}},fwe=p.button.withConfig({displayName:"SelectButton__Trigger",componentId:"sc-1wc11bd-0"})` 882 display: inline-flex; 883 align-items: center; 884 justify-content: center; 885 gap: 0.4rem; 886 width: ${e=>e.$fullWidth?"100%":"auto"}; 887 height: ${e=>v5[e.$size].height}; 888 padding: ${e=>v5[e.$size].padding}; 889 font-size: ${e=>v5[e.$size].fontSize}; 890 font-weight: 500; 891 font-family: ${cM}; 892 line-height: 1.5; 893 white-space: nowrap; 894 cursor: pointer; 895 border-radius: 0.375rem; 896 box-sizing: border-box; 897 transition: background-color 0.2s, border-color 0.2s, color 0.2s; 898 899 background-color: ${e=>Vg(e.$variant).bg}; 900 color: ${e=>Vg(e.$variant).color}; 901 border: ${e=>Vg(e.$variant).border}; 902 903 &:hover:not(:disabled) { 904 background-color: ${e=>Vg(e.$variant).hoverBg}; 905 border-color: ${e=>Vg(e.$variant).hoverBorder}; 906 } 907 908 &:active:not(:disabled) { 909 background-color: ${e=>Vg(e.$variant).activeBg}; 910 } 911 912 &:disabled { 913 opacity: 0.6; 914 cursor: not-allowed; 915 } 916 917 &:focus { 918 outline: none; 919 box-shadow: 0 0 0 3px ${En}; 920 } 921`,gwe=p.span.withConfig({displayName:"SelectButton__IconWrap",componentId:"sc-1wc11bd-1"})` 922 display: inline-flex; 923 align-items: center; 924 justify-content: center; 925 flex-shrink: 0; 926 line-height: 1; 927`,ywe=p.div.withConfig({displayName:"SelectButton__Dropdown",componentId:"sc-1wc11bd-2"})` 928 position: fixed; 929 background: ${Z}; 930 border: 1px solid ${Rt}; 931 border-radius: 0.375rem; 932 max-height: 220px; 933 overflow-y: auto; 934 z-index: 10001; 935 box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12); 936 font-family: ${cM}; 937`,xwe=p.button.withConfig({displayName:"SelectButton__OptionRow",componentId:"sc-1wc11bd-3"})` 938 width: 100%; 939 padding: 0.5rem 0.75rem; 940 text-align: left; 941 border: none; 942 background: ${e=>e.$highlighted?$e:Z}; 943 color: ${O}; 944 font-size: 0.8rem; 945 font-weight: 600; 946 cursor: pointer; 947 transition: background-color 0.15s; 948 font-family: ${cM}; 949 950 &:hover { 951 background: ${$e}; 952 } 953 954 &:disabled { 955 cursor: not-allowed; 956 opacity: 0.6; 957 } 958`;function ly({options:e,value:n,onChange:i,placeholder:r="Selectâ¦",leftIcon:o,variant:s="outline",size:a="sm",fullWidth:c=!1,disabled:u=!1,iconOnly:m=!1}){const h=l.useRef(null),g=l.useRef(null),[x,y]=l.useState(!1),[w,j]=l.useState(-1),[v,_]=l.useState({}),k=l.useMemo(()=>e.find(A=>A.value===n)||null,[e,n])?.label||r;l.useEffect(()=>{if(!x)return;const A=E=>{const B=E.target;h.current?.contains(B)||g.current?.contains(B)||(y(!1),j(-1))};return document.addEventListener("mousedown",A,!0),document.addEventListener("touchstart",A,!0),()=>{document.removeEventListener("mousedown",A,!0),document.removeEventListener("touchstart",A,!0)}},[x]),l.useEffect(()=>{if(!x)return;const A=()=>{const E=h.current;if(!E)return;const B=E.getBoundingClientRect(),T=4,M=window.innerHeight,R=window.innerWidth,F=M-B.bottom,Y=F<240&&B.top>
958F,H=Math.max(B.width,140),U=Math.max(8,Math.min(B.left,R-H-8));_(Y?{left:U,width:H,bottom:M-B.top+T,maxHeight:Math.min(220,B.top-16)}:{left:U,width:H,top:B.bottom+T,maxHeight:Math.min(220,F-16)})};return A(),window.addEventListener("scroll",A,!0),window.addEventListener("resize",A),()=>{window.removeEventListener("scroll",A,!0),window.removeEventListener("resize",A)}},[x]);const P=A=>{const E=e[A];!E||E.disabled||(i(E.value),y(!1),j(-1))},S=A=>{if(!u){if(!x){if(A.key==="ArrowDown"||A.key==="Enter"||A.key===" "){A.preventDefault(),y(!0);const E=e.findIndex(B=>B.value===n);j(E>=0?E:0)}return}switch(A.key){case"Escape":A.preventDefault(),y(!1),j(-1);break;case"ArrowDown":A.preventDefault(),j(E=>Math.min(e.length-1,E+1));break;case"ArrowUp":A.preventDefault(),j(E=>Math.max(0,E-1));break;case"Enter":case" ":A.preventDefault(),w>=0&&P(w);break}}},I=v5[a].iconSize;return t.jsxs(t.Fragment,{children:[t.jsxs(fwe,{ref:h,$variant:s,$size:a,$fullWidth:c,type:"button",disabled:u,onClick:()=>{if(!u&&(y(A=>!A),!x)){const A=e.findIndex(E=>E.value===n);j(A>=0?A:0)}},onKeyDown:S,"aria-haspopup":"listbox","aria-expanded":x,style:m?{padding:"0.35rem",gap:0}:void 0,children:[o&&t.jsx(gwe,{children:o}),!m&&k,!m&&t.jsx(qn,{size:I,style:{color:Vg(s).caretColor,transition:"transform 150ms ease",transform:x?"rotate(180deg)":"none",flexShrink:0}})]}),x&&jr.createPortal(t.jsx(ywe,{ref:g,style:v,role:"listbox",children:e.map((A,E)=>t.jsx(xwe,{type:"button",$highlighted:E===w,onMouseEnter:()=>j(E),onClick:()=>P(E),disabled:!!A.disabled,children:A.label},A.value))}),document.body)]})}const bwe=Tn` 959 0% { transform: rotate(0deg); } 960 100% { transform: rotate(360deg); } 961`,vwe=p.div.withConfig({displayName:"LoadingScreen__Wrapper",componentId:"sc-a00axe-0"})` 962 display: flex; 963 justify-content: center; 964 align-items: center; 965 height: ${e=>e.$height}; 966 font-family: Manrope, sans-serif; 967 background-color: ${Z}; 968`,wwe=p.div.withConfig({displayName:"LoadingScreen__Center",componentId:"sc-a00axe-1"})` 969 text-align: center; 970`,jwe=p.div.withConfig({displayName:"LoadingScreen__Spinner",componentId:"sc-a00axe-2"})` 971 width: ${e=>e.$sizePx}px; 972 height: ${e=>e.$sizePx}px; 973 border: ${e=>e.$borderWidthPx}px solid ${e=>e.$trackColor}; 974 border-top: ${e=>e.$borderWidthPx}px solid ${e=>e.$accentColor}; 975 border-radius: 50%; 976 animation: ${bwe} 1s linear infinite; 977 margin: 0 auto 1rem; 978`,_we=p.p.withConfig({displayName:"LoadingScreen__Message",componentId:"sc-a00axe-3"})` 979 margin: 0; 980 color: ${e=>e.$color}; 981 font-size: 0.875rem; 982`;function IP({message:e="Loading...",height:n="100vh",sizePx:i=40,borderWidthPx:r=3,trackColor:o=Rt,accentColor:s=ot,messageColor:a=z}){return t.jsx(vwe,{$height:n,children:t.jsxs(wwe,{children:[t.jsx(jwe,{$sizePx:i,$borderWidthPx:r,$trackColor:o,$accentColor:s}),t.jsx(_we,{$color:a,children:e})]})})}const Cwe=p.div.withConfig({displayName:"StepIndicator__StepContainer",componentId:"sc-u5tepo-0"})` 983 margin-bottom: 2rem; 984`,Swe=p.div.withConfig({displayName:"StepIndicator__ProgressBarContainer",componentId:"sc-u5tepo-1"})` 985 width: 100%; 986 height: 4px; 987 background-color: ${Rt}; 988 border-radius: 2px; 989 overflow: hidden; 990 position: relative; 991`,kwe=p.div.withConfig({displayName:"StepIndicator__ProgressBarFill",componentId:"sc-u5tepo-2"})` 992 height: 100%; 993 background-color: ${ot}; 994 border-radius: 2px; 995 width: ${e=>e.$percentage}%; 996 transition: width 0.3s ease; 997`;function Vc({currentStep:e,totalSteps:n}){const i=e/n*100;return t.jsx(Cwe,{children:t.jsx(Swe,{children:t.jsx(kwe,{$percentage:i})})})}const $we=p.div.withConfig({displayName:"Autocomplete__AutocompleteWrapper",componentId:"sc-uhpl42-0"})` 998 position: relative; 999 width: 100%; 1000`,Iwe=p.div.withConfig({displayName:"Autocomplete__Dropdown",componentId:"sc-uhpl42-1"})` 1001 position: absolute; 1002 top: 100%; 1003 left: 0; 1004 right: 0; 1005 background: ${Z}; 1006 border: 1px solid ${Rt}; 1007 border-radius: 0.375rem; 1008 margin-top: 0.25rem; 1009 max-height: 220px; 1010 overflow-y: auto; 1011 z-index: 1000; 1012 box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); 1013 display: ${e=>e.$isOpen?"block":"none"}; 1014`,Pwe=p.div.withConfig({displayName:"Autocomplete__PortalDropdown",componentId:"sc-uhpl42-2"})` 1015 position: fixed; 1016 background: ${Z}; 1017 border: 1px solid ${Rt}; 1018 border-radius: 0.375rem; 1019 max-height: 220px; 1020 overflow-y: auto; 1021 z-index: 10001; /* above Modal (10000) */ 1022 box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12); 1023 display: block; 1024`,eB=p.div.withConfig({displayName:"Autocomplete__Option",componentId:"sc-uhpl42-3"})` 1025 padding: 0.75rem 1rem; 1026 cursor: pointer; 1027 background-color: ${e=>e.$isSelected?$e:Z}; 1028 color: ${O}; 1029 transition: background-color 0.15s; 1030 1031 &:hover { 1032 background-color: ${$e}; 1033 } 1034 1035 &:first-child { 1036 border-top-left-radius: 0.375rem; 1037 border-top-right-radius: 0.375rem; 1038 } 1039 1040 &:last-child { 1041 border-bottom-left-radius: 0.375rem; 1042 border-bottom-right-radius: 0.375rem; 1043 } 1044`,tB=p.div.withConfig({displayName:"Autocomplete__LoadingOption",componentId:"sc-uhpl42-4"})` 1045 padding: 0.75rem 1rem; 1046 text-align: center; 1047 color: ${z}; 1048 font-size: 0.875rem; 1049`;
1049function _u({value:e,onChange:n,onSelect:i,placeholder:r,leftIcon:o,options:s,isLoading:a=!1,disabled:c=!1,inputSize:u,inputStyle:m,dropdownPortal:h=!1}){const[g,x]=l.useState(!1),[y,w]=l.useState(-1),j=l.useRef(null),v=l.useRef(null),_=l.useRef(null),[$,k]=l.useState({}),P=g&&(s.length>0||a);l.useEffect(()=>{const A=E=>{const B=E.target,T=j.current&&j.current.contains(B),M=_.current&&_.current.contains(B);!T&&!M&&(x(!1),w(-1))};return document.addEventListener("mousedown",A),document.addEventListener("touchstart",A),()=>{document.removeEventListener("mousedown",A),document.removeEventListener("touchstart",A)}},[]),l.useEffect(()=>{if(!h||!g||typeof window>"u")return;const A=()=>{const E=v.current;if(!E)return;const B=E.getBoundingClientRect(),T=4,M=220,R=window.innerWidth,F=window.innerHeight,Y=F-B.bottom,H=B.top,U=Y<240&&H>Y,X=Math.min(B.width,R-16),Q=Math.max(8,Math.min(B.left,R-X-8));if(U){const K=Math.min(M,Math.max(120,H-16));k({left:Q,width:X,top:void 0,bottom:Math.max(8,F-B.top+T),maxHeight:K})}else{const K=Math.min(M,Math.max(120,Y-16));k({left:Q,width:X,bottom:void 0,top:Math.min(F-8,B.bottom+T),maxHeight:K})}};return A(),window.addEventListener("scroll",A,!0),window.addEventListener("resize",A),()=>{window.removeEventListener("scroll",A,!0),window.removeEventListener("resize",A)}},[h,g,a,s.length,e]);const S=A=>{i(A),x(!1),w(-1)},I=A=>{if(!(!g||s.length===0))switch(A.key){case"ArrowDown":A.preventDefault(),w(E=>E<s.length-1?E+1:E);break;case"ArrowUp":A.preventDefault(),w(E=>E>0?E-1:-1);break;case"Enter":A.preventDefault(),y>=0&&y<s.length&&S(s[y]);break;case"Escape":x(!1),w(-1);break}};return t.jsxs($we,{ref:j,children:[t.jsx(Xt,{ref:v,type:"text",value:e,size:u,style:m,onChange:A=>{n(A.target.value),x(!0),w(-1)},onFocus:()=>x(!0),onKeyDown:I,placeholder:r,leftIcon:o,disabled:c}),h&&P?jr.createPortal(t.jsx(Pwe,{ref:_,style:$,role:"listbox",children:a?t.jsx(tB,{children:"Loading..."}):s.map((A,E)=>t.jsx(eB,{$isSelected:E===y,onClick:()=>S(A),onMouseEnter:()=>w(E),children:A.renderLabel||A.label},`${A.value}-${E}`))}),document.body):t.jsx(Iwe,{$isOpen:P,role:"listbox",children:a?t.jsx(tB,{children:"Loading..."}):s.map((A,E)=>t.jsx(eB,{$isSelected:E===y,onClick:()=>S(A),onMouseEnter:()=>w(E),children:A.renderLabel||A.label},`${A.value}-${E}`))})]})}const Awe=p.div.withConfig({displayName:"Tooltip__TooltipBox",componentId:"sc-1htxstm-0"})` 1050 position: fixed; 1051 z-index: 100000; 1052 pointer-events: none; 1053 display: inline-flex; 1054 flex-direction: column; 1055 align-items: flex-start; 1056 justify-content: flex-start; 1057 1058 max-width: ${e=>typeof e.$maxWidth=="number"?`${e.$maxWidth}px`:e.$maxWidth}; 1059 background: ${e=>e.$bg}; 1060 color: ${e=>e.$color}; 1061 border-radius: 0.5rem; 1062 white-space: normal; 1063 word-break: break-word; 1064 1065 ${e=>{switch(e.$size){case"sm":return` 1066 padding: 0.375rem 0.5rem; 1067 font-size: 0.75rem; 1068 line-height: 1.3; 1069 `;case"lg":return` 1070 padding: 0.625rem 0.75rem; 1071 font-size: 0.875rem; 1072 line-height: 1.4; 1073 `;case"md":default:return` 1074 padding: 0.5rem 0.625rem; 1075 font-size: 0.8125rem; 1076 line-height: 1.35; 1077 `}}} 1078 1079 box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12); 1080`,Nwe=p.div.withConfig({displayName:"Tooltip__TooltipArrow",componentId:"sc-1htxstm-1"})` 1081 position: absolute; 1082 width: 10px; 1083 height: 10px; 1084 background: ${e=>e.$bg}; 1085 transform: rotate(45deg); 1086 border-radius: 2px; 1087`;function zwe(...e){return n=>{e.forEach(i=>{i&&(typeof i=="function"?i(n):i.current=n)})}}function at({content:e,children:n,backgroundColor:i=O,textColor:r=Z,size:o="sm",maxWidth:s=320,placement:a="top",offset:c=10,onlyIfTruncated:u=!1,disabled:m=!1}){const h=l.useRef(null),g=l.useRef(null),[x,y]=l.useState(!1),[w,j]=l.useState(!1),[v,_]=l.useState({top:0,left:0,arrowLeft:0,placement:a}),$=i,k=r,P=l.useCallback(()=>{if(m)return!1;const T=h.current;return T?u?T.scrollWidth>T.clientWidth+1||T.scrollHeight>T.clientHeight+1:!0:!1},[m,u]),S=l.useCallback(()=>{const T=h.current;if(!T)return;const M=T.getBoundingClientRect(),R=window.innerWidth,F=window.innerHeight,Y=8,U=g.current?.getBoundingClientRect(),X=Math.max(0,Number(U?.width||0)),Q=Math.max(0,Number(U?.height||0));if(!X||!Q)return;const K=M.left+M.width/2,G=(de,le,me)=>Math.min(me,Math.max(le,de)),L=de=>{const le=G(K-X/2,Y,Math.max(Y,R-Y-X)),me=de==="top"?M.top-c-Q:M.bottom+c,ee=G(me,Y,Math.max(Y,F-Y-Q)
1087),ne=G(K-le,12,Math.max(12,X-12));return{left:le,top:ee,arrowLeft:ne,placement:de}},q=L(a),W=q.placement==="top"&&M.top-c-Q<Y,oe=q.placement==="bottom"&&M.bottom+c+Q>F-Y,se=a==="top"?W?L("bottom"):q:oe?L("top"):q;_(se),j(!0)},[c,a]),I=l.useCallback(()=>{P()&&(y(!0),j(!1),requestAnimationFrame(()=>requestAnimationFrame(S)))},[P,S]),A=l.useCallback(()=>{y(!1),j(!1)},[]);l.useEffect(()=>{if(!x)return;requestAnimationFrame(()=>requestAnimationFrame(S));const T=()=>S(),M=()=>S();return window.addEventListener("scroll",T,!0),window.addEventListener("resize",M),()=>{window.removeEventListener("scroll",T,!0),window.removeEventListener("resize",M)}},[x,S]);const E=l.useMemo(()=>{const T=n,M=T.props,R=T.ref;return{element:{...M,onMouseEnter:F=>{M?.onMouseEnter?.(F),I()},onMouseLeave:F=>{M?.onMouseLeave?.(F),A()},onFocus:F=>{M?.onFocus?.(F),I()},onBlur:F=>{M?.onBlur?.(F),A()},ref:zwe(R,F=>{h.current=F})}}},[n,A,I]),B=x?jr.createPortal(t.jsxs(Awe,{ref:g,$bg:$,$color:k,$size:o,$maxWidth:s,style:{left:v.left,top:v.top,visibility:w?"visible":"hidden"},role:"tooltip",children:[e,t.jsx(Nwe,{$bg:$,style:v.placement==="top"?{left:v.arrowLeft,bottom:-5,transform:"translateX(-50%) rotate(45deg)"}:{left:v.arrowLeft,top:-5,transform:"translateX(-50%) rotate(45deg)"}})]}),document.body):null;return t.jsxs(t.Fragment,{children:[l.cloneElement(n,E.element),B]})}const Twe=Tn` 1088 from { opacity: 0; } 1089 to { opacity: 1; } 1090`,Ewe=Tn` 1091 from { opacity: 0; transform: translateY(6px) scale(0.985); } 1092 to { opacity: 1; transform: translateY(0) scale(1); } 1093`,Mwe=p.div.withConfig({displayName:"Modal__Overlay",componentId:"sc-2v0n5t-0"})` 1094 position: fixed; 1095 inset: 0; 1096 z-index: 10000; 1097 display: flex; 1098 align-items: center; 1099 justify-content: center; 1100 padding: 1rem; 1101 background: rgba(17, 24, 39, 0.55); 1102 backdrop-filter: blur(3px); 1103 -webkit-backdrop-filter: blur(3px); 1104 animation: ${Twe} 140ms ease-out; 1105`,Rwe=p.div.withConfig({displayName:"Modal__Dialog",componentId:"sc-2v0n5t-1"})` 1106 width: 100%; 1107 max-width: ${e=>e.$maxWidth?e.$maxWidth:(()=>{switch(e.$size){case"sm":return"28rem";case"lg":return"52rem";case"md":default:return"40rem"}})()}; 1108 height: ${e=>e.$height?e.$height:"auto"}; 1109 min-height: ${e=>{if(e.$minHeight)return e.$minHeight;switch(e.$size){case"sm":return"18rem";case"lg":return"22rem";case"md":default:return"20rem"}}}; 1110 max-height: calc(100vh - 2rem); 1111 display: flex; 1112 flex-direction: column; 1113 background: ${Z}; 1114 border-radius: 1rem; 1115 border: 1px solid ${Rt}; 1116 box-shadow: 0 28px 60px rgba(0, 0, 0, 0.22); 1117 overflow: hidden; 1118 animation: ${Ewe} 160ms ease-out; 1119`,Owe=p.div.withConfig({displayName:"Modal__Header",componentId:"sc-2v0n5t-2"})` 1120 display: flex; 1121 align-items: flex-start; 1122 justify-content: space-between; 1123 gap: 1rem; 1124 padding: 1rem 1rem 0.75rem 1rem; 1125 background: linear-gradient(to bottom, ${At}, ${Z}); 1126 border-bottom: 1px solid ${V}; 1127`,Dwe=p.div.withConfig({displayName:"Modal__TitleBlock",componentId:"sc-2v0n5t-3"})` 1128 min-width: 0; 1129 display: flex; 1130 flex-direction: column; 1131 gap: 0.25rem; 1132`,Lwe=p.div.withConfig({displayName:"Modal__Title",componentId:"sc-2v0n5t-4"})` 1133 font-size: 1rem; 1134 font-weight: 750; 1135 color: ${O}; 1136 line-height: 1.2; 1137 overflow: hidden; 1138 text-overflow: ellipsis; 1139 white-space: nowrap; 1140`,Bwe=p.div.withConfig({displayName:"Modal__Description",componentId:"sc-2v0n5t-5"})` 1141 font-size: 0.8125rem; 1142 color: ${z}; 1143 line-height: 1.4; 1144`,Fwe=p.button.withConfig({displayName:"Modal__CloseButton",componentId:"sc-2v0n5t-6"})` 1145 width: 36px; 1146 height: 36px; 1147 border-radius: 0.75rem; 1148 border: 1px solid ${Rt}; 1149 background: ${Z}; 1150 color: ${O}; 1151 cursor: pointer; 1152 display: inline-flex; 1153 align-items: center; 1154 justify-content: center; 1155 flex-shrink: 0; 1156 transition: border-color 0.15s ease, color 0.15s ease, transform 0.15s ease; 1157 1158 &:hover { 1159 border-color: ${ot}; 1160 color: ${ot}; 1161 transform: translateY(-1px); 1162 } 1163 1164 &:active { 1165 transform: translateY(0); 1166 } 1167 1168 &:focus-visible { 1169 outline: none; 1170 box-shadow: 0 0 0 3px ${En}; 1171 } 1172`,Wwe=p.div.withConfig({displayName:"Modal__Body",componentId:"sc-2v0n5t-7"})` 1173 padding: 1rem; 1174 flex: 1; 1175 overflow: auto; 1176`,Uwe=p.div.withConfig({displayName:"Modal__Footer",componentId:"sc-2v0n5t-8"})` 1177 padding: 0.875rem 1rem; 1178 border-top: 1px solid ${V}; 1179 background: ${Z}; 1180`;function Hn({isOpen:e,onClose:n,title:i,description:r,children:o,footer:s,size:a="md",height:c,minHeight:u,maxWidth:m,closeOnOverlayClick:h=!0,closeOnEscape:g=!0,showCloseButton:x=!0}){return l.useEffect(()=>{if(!e)return;const y=document.body.style.overflow;document.body.style.overflow="hidden";const w=j=>{g&&j.key==="Escape"&&n()};return window.addEventListener("keydown",w),()=>{document.body.style.overflow=y,window.removeEventListener("keydown",w)}},[e,g,n]),e?jr.createPortal(t.jsx(Mwe,{role:"dialog","aria-modal":"true",onMouseDown:()=>{h&&n()},children:t.jsxs(Rwe,{$size:a,$height:c,$minHeight:u,$maxWidth:m,onMouseDown:y=>{y.stopPropagation()},children:[(i||r||x)&&t.jsxs(Owe,{children:[t.jsxs(Dwe,{children:[i&&t.jsx(Lwe,{title:i,children:i}),r&&t.jsx(Bwe,{children:r})]}),x&&t.jsx(Fwe,{type:"button","aria-label":"Close",onClick:n,children:t.jsx(Ei,{size:18})})]}),t.jsx(Wwe,{children:o}),s?t.jsx(Uwe,{children:s}):null]})}),document.body):null}const Hwe=p.label.withConfig({displayName:"Checkbox__CheckRow",componentId:"sc-1j2uuzn-0"})` 1181 display: flex; 1182 align-items: flex-start; 1183 gap: ${e=>e.$compact?"0.5rem":"0.6rem"}; 1184 padding: ${e=>e.$compact?"0.45rem 0.65rem":"0.65rem 0.85rem"}; 1185 border: 1px solid ${V}; 1186 border-radius: 0.5rem; 1187 cursor: ${e=>e.$disabled?"default":"pointer"}; 1188 transition: border-color 0.15s; 1189 text-align: left; 1190 &:hover { border-color: ${e=>e.$disabled?V:Pe}; } 1191`,qwe=p.input.withConfig({displayName:"Checkbox__CheckInput",componentId:"sc-1j2uuzn-1"})` 1192 width: 15px; 1193 height: 15px; 1194 accent-color: ${Ft}; 1195 flex-shrink: 0; 1196 margin-top: 3px; 1197 &:disabled { opacity: 0.45;
1197 cursor: not-allowed; } 1198`,Gwe=p.div.withConfig({displayName:"Checkbox__CheckLabel",componentId:"sc-1j2uuzn-2"})` 1199 display: flex; 1200 flex-direction: column; 1201 gap: 0.1rem; 1202 min-width: 0; 1203`,Vwe=p.span.withConfig({displayName:"Checkbox__CheckTitle",componentId:"sc-1j2uuzn-3"})` 1204 font-size: ${e=>e.$compact?"0.72rem":"0.875rem"}; 1205 font-weight: 600; 1206 color: ${O}; 1207`,Kwe=p.span.withConfig({displayName:"Checkbox__CheckSub",componentId:"sc-1j2uuzn-4"})` 1208 font-size: ${e=>e.$compact?"0.62rem":"0.75rem"}; 1209 color: ${z}; 1210 line-height: 1.4; 1211`;function dM({checked:e,onChange:n,label:i,description:r,disabled:o,compact:s}){return t.jsxs(Hwe,{$disabled:o,$compact:s,children:[t.jsx(qwe,{type:"checkbox",checked:e,disabled:o,onChange:a=>n(a.target.checked)}),t.jsxs(Gwe,{children:[t.jsx(Vwe,{$compact:s,children:i}),r&&t.jsx(Kwe,{$compact:s,children:r})]})]})}const bf=["#111827","#1e293b","#1a365d","#312e81","#4c1d95","#7c2d12","#064e3b","#701a75","#3f3f46","#0c4a6e"],Ywe=p.div.withConfig({displayName:"BrandingPicker__BrandingWrap",componentId:"sc-1hhnmyq-0"})` 1212 display: flex; 1213 flex-direction: column; 1214 gap: 0.75rem; 1215 ${e=>e.$compact?"max-width: 320px;":"flex: 1; min-width: 0;"} 1216`,Xwe=p.button.withConfig({displayName:"BrandingPicker__UpgradeBtn",componentId:"sc-1hhnmyq-1"})` 1217 background: none; 1218 border: none; 1219 padding: 0; 1220 font: inherit; 1221 font-weight: 800; 1222 color: ${Ft}; 1223 cursor: pointer; 1224 text-decoration: underline; 1225 text-underline-offset: 2px; 1226 &:hover { color: ${Kl}; } 1227`,Qwe=p.div.withConfig({displayName:"BrandingPicker__HintRow",componentId:"sc-1hhnmyq-2"})` 1228 display: flex; 1229 align-items: center; 1230 gap: 0.3rem; 1231 font-size: 0.68rem; 1232 color: ${Pe}; 1233`,Zwe=p.div.withConfig({displayName:"BrandingPicker__ColorWrap",componentId:"sc-1hhnmyq-3"})` 1234 display: flex; 1235 flex-direction: column; 1236 gap: ${e=>e.$compact?"0.25rem":"0.5rem"}; 1237 padding-left: ${e=>e.$compact?"0.35rem":"0.5rem"}; 1238 text-align: left; 1239`,Jwe=p.span.withConfig({displayName:"BrandingPicker__ColorLabel",componentId:"sc-1hhnmyq-4"})` 1240 font-size: ${e=>e.$compact?"0.68rem":"0.75rem"}; 1241 font-weight: 600; 1242 color: ${z}; 1243`,eje=p.div.withConfig({displayName:"BrandingPicker__ColorGrid",componentId:"sc-1hhnmyq-5"})` 1244 display: flex; 1245 flex-wrap: wrap; 1246 gap: 0.35rem; 1247`,tje=p.button.withConfig({displayName:"BrandingPicker__ColorSwatch",componentId:"sc-1hhnmyq-6"})` 1248 width: ${e=>e.$compact?"24px":"28px"}; 1249 height: ${e=>e.$compact?"24px":"28px"}; 1250 border-radius: 0.3rem; 1251 border: 2px solid ${e=>e.$active?Z:V}; 1252 box-shadow: ${e=>e.$active?`0 0 0 2px ${Ft}`:"none"}; 1253 background: ${e=>e.$color}; 1254 cursor: pointer; 1255 transition: transform 0.12s, border-color 0.12s, box-shadow 0.12s; 1256 &:hover { transform: scale(1.12); box-shadow: 0 0 0 2px ${Pe}; } 1257`,nje=p.div.withConfig({displayName:"BrandingPicker__LogoRow",componentId:"sc-1hhnmyq-7"})` 1258 display: flex; 1259 align-items: center; 1260 gap: 0.6rem; 1261 padding: 0.5rem 0.65rem; 1262 border: 1px solid ${V}; 1263 border-radius: 0.5rem; 1264 background: ${$e}; 1265 text-align: left; 1266`,ije=p.img.withConfig({displayName:"BrandingPicker__LogoImg",componentId:"sc-1hhnmyq-8"})` 1267 display: block; 1268 height: 22px; 1269 border-radius: 3px; 1270`,rje=p.div.withConfig({displayName:"BrandingPicker__LogoPlaceholder",componentId:"sc-1hhnmyq-9"})` 1271 width: 22px; 1272 height: 22px; 1273 border-radius: 3px; 1274 background: ${V}; 1275 display: flex; 1276 align-items: center; 1277 justify-content: center; 1278 font-size: 0.6rem; 1279 font-weight: 800; 1280 color: ${z}; 1281 flex-shrink: 0; 1282`,oje=p.div.withConfig({displayName:"BrandingPicker__LogoMeta",componentId:"sc-1hhnmyq-10"})` 1283 flex: 1; 1284 min-width: 0; 1285`,sje=p.div.withConfig({displayName:"BrandingPicker__LogoTitle",componentId:"sc-1hhnmyq-11"})` 1286 font-size: 0.7rem; 1287 font-weight: 650; 1288 color: ${O}; 1289 white-space: nowrap; 1290 overflow: hidden; 1291 text-overflow: ellipsis; 1292`,aje=p.div.withConfig({displayName:"BrandingPicker__LogoHint",componentId:"sc-1hhnmyq-12"})` 1293 font-size: 0.62rem; 1294 color: ${Pe}; 1295`,lje=p(Dn).withConfig({displayName:"BrandingPicker__SettingsLink",componentId:"sc-1hhnmyq-13"})` 1296 display: inline-flex; 1297 align-items: center; 1298 gap: 0.2rem; 1299 font-size: 0.62rem; 1300 font-weight: 650; 1301 color: ${Ft}; 1302 text-decoration: none; 1303 flex-shrink: 0; 1304 &:hover { text-decoration: underline; } 1305`;function uM({whiteLabelEnabled:e,isOwner:n,workspaceId:i,orgLogoUrl:r,whiteLabel:o,onWhiteLabelChange:s,footerColor:a,onFooterColorChange:c,onUpgrade:u,onSettingsClick:m,compact:h}){const g=o&&e;return t.jsxs(Ywe,{$compact:h,children:[t.jsx(dM,{checked:g,onChange:s,disabled:!e,compact:h,label:"Use custom branding",description:e?"Replace Ceyo branding with your own.":n&&u?t.jsxs(t.Fragment,{children:[t.jsx(Xwe,{onClick:x=>{x.preventDefault(),u()},children:"Upgrade your plan"})," to use your own branding."]}):"Ask your workspace owner to upgrade the plan."}),!e&&!h&&t.jsxs(Qwe,{children:[t.jsx(ku,{size:10}),n?"Custom branding requires a plan upgrade.":"Ask your workspace owner to upgrade the plan."]}),g&&t.jsxs(Zwe,{$compact:h,children:[t.jsx(Jwe,{$compact:h,children:"Footer color"}),t.jsx(eje,{children:bf.map(x=>t.jsx(tje,{type:"button",$color:x,$active:a===x,$compact:h,title:x,onClick:()=>c(x)},x))})]}),g&&t.jsxs(nje,{children:[r?t.jsx(ije,{src:r,alt:"Workspace logo"}):t.jsx(rje,{children:"?"}),t.jsxs(oje,{children:[t.jsx(sje,{children:r?"Workspace logo":"No logo uploaded"}),t.jsx(aje,{children:r?"This logo will appear in the report footer.":"Upload a logo in workspace settings."})]}
1305),n&&t.jsxs(lje,{to:`/workspaces/${i}/settings`,onClick:m,children:["Change ",t.jsx(as,{size:10})]})]})]})}const cje=Z,aie=O,pM=Pe,dje=Rt,nB=Ut,iB=Vt,uje=ot,pje=$e,mje=En,hje="rgba(239, 68, 68, 0.1)",fje="rgba(16, 185, 129, 0.1)",J_="'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif",gje=p.div.withConfig({displayName:"Select__Wrapper",componentId:"sc-b40kg-0"})` 1306 position: relative; 1307 width: ${e=>e.$fullWidth?"100%":"auto"}; 1308`,yje=p.div.withConfig({displayName:"Select__IconWrapper",componentId:"sc-b40kg-1"})` 1309 position: absolute; 1310 left: 0.75rem; 1311 top: 50%; 1312 transform: translateY(-50%); 1313 color: ${pM}; 1314 pointer-events: none; 1315 display: flex; 1316 align-items: center; 1317 justify-content: center; 1318 z-index: 1; 1319`,xje=p.button.withConfig({displayName:"Select__Trigger",componentId:"sc-b40kg-2"})` 1320 width: ${e=>e.$fullWidth?"100%":"auto"}; 1321 height: ${e=>({sm:"2rem",md:"2.75rem",lg:"3.5rem"})[e.$size]}; 1322 display: flex; 1323 align-items: center; 1324 justify-content: space-between; 1325 gap: 0.75rem; 1326 text-align: left; 1327 border: 1px solid ${e=>e.$variant==="error"?nB:e.$variant==="success"?iB:dje}; 1328 border-radius: 0.375rem; 1329 background-color: ${cje}; 1330 color: ${aie}; 1331 transition: border-color 0.2s, box-shadow 0.2s; 1332 cursor: pointer; 1333 font-family: ${J_}; 1334 1335 padding: ${e=>{const i={sm:"0.5rem",md:"0.75rem",lg:"1rem"}[e.$size],r=e.$hasLeftIcon?`calc(${i} + 1.75rem)`:i;return`${i} ${i} ${i} ${r}`}}; 1336 1337 font-size: ${e=>({sm:"0.75rem",md:"0.875rem",lg:"1rem"})[e.$size]}; 1338 1339 &:focus { 1340 outline: none; 1341 border-color: ${e=>e.$variant==="error"?nB:e.$variant==="success"?iB:uje}; 1342 box-shadow: 0 0 0 3px ${e=>e.$variant==="error"?hje:e.$variant==="success"?fje:mje}; 1343 } 1344 1345 &:disabled { 1346 background-color: ${pje}; 1347 cursor: not-allowed; 1348 opacity: 0.6; 1349 } 1350`,bje=p.span.withConfig({displayName:"Select__TriggerText",componentId:"sc-b40kg-3"})` 1351 flex: 1; 1352 min-width: 0; 1353 overflow: hidden; 1354 text-overflow: ellipsis; 1355 white-space: nowrap; 1356 color: ${e=>e.$placeholder?pM:aie}; 1357 font-family: ${J_}; 1358`,vje=p.span.withConfig({displayName:"Select__Caret",componentId:"sc-b40kg-4"})` 1359 width: 0; 1360 height: 0; 1361 border-left: 5px solid transparent; 1362 border-right: 5px solid transparent; 1363 border-top: 6px solid ${pM}; 1364 flex-shrink: 0; 1365`,wje=p.div.withConfig({displayName:"Select__Dropdown",componentId:"sc-b40kg-5"})` 1366 position: absolute; 1367 top: calc(100% + 0.25rem); 1368 left: 0; 1369 right: 0; 1370 display: ${e=>e.$open?"block":"none"}; 1371 background: ${Z}; 1372 border: 1px solid ${Rt}; 1373 border-radius: 0.375rem; 1374 max-height: 220px; 1375 overflow-y: auto; 1376 z-index: 10001; 1377 box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12); 1378 font-family: ${J_}; 1379`,jje=p.div.withConfig({displayName:"Select__PortalDropdown",componentId:"sc-b40kg-6"})` 1380 position: fixed; 1381 background: ${Z}; 1382 border: 1px solid ${Rt}; 1383 border-radius: 0.375rem; 1384 max-height: 220px; 1385 overflow-y: auto; 1386 z-index: 10001; 1387 box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12); 1388 font-family: ${J_}; 1389`,_je=p.button.withConfig({displayName:"Select__OptionRow",componentId:"sc-b40kg-7"})` 1390 width: 100%; 1391 padding: 0.75rem 1rem; 1392 text-align: left; 1393 border: none; 1394 background: ${e=>e.$highlighted?$e:Z}; 1395 color: ${O}; 1396 cursor: pointer; 1397 transition: background-color 0.15s; 1398 font-family: ${J_}; 1399 1400 &:hover { 1401 background: ${$e}; 1402 } 1403 1404 &:disabled { 1405 cursor: not-allowed; 1406 opacity: 0.6; 1407 } 1408`,Fn=l.forwardRef(function({options:n,value:i,onChange:r,placeholder:o,leftIcon:s,size:a="md",variant:c="default",fullWidth:u=!0,disabled:m,dropdownPortal:h=!1,...g},x){const y=l.useRef(null),w=l.useRef(null),j=l.useRef(null),[v,_]=l.useState(!1),[$,k]=l.useState(-1),[P,S]=l.useState({}),I=l.useMemo(()=>n.find(F=>F.value===i)||null,[n,i]),A=I?.label||o||"",E=!I&&!!o,B=l.useMemo(()=>n.filter(F=>!F.hiddenInDropdown),[n]);l.useEffect(()=>{const F=Y=>{const H=Y.target,U=y.current&&y.current.contains(H),X=j.current&&j.current.contains(H);!U&&!X&&(_(!1),k(-1))};return document.addEventListener("mousedown",F,!0),document.addEventListener("touchstart",F,!0),()=>{document.removeEventListener("mousedown",F,!0),document.removeEventListener("touchstart",F,!0)}},[]),l.useEffect(()=>{if(!h||!v||typeof window>"u")return;const F=()=>{const Y=w.current;if(!Y)return;const H=Y.getBoundingClientRect(),U=4,X=220,Q=window.innerWidth,K=window.innerHeight,G=K-H.bottom,L=H.top,q=G<260&&L>G,W=Math.min(H.width,Q-16),oe=Math.max(8,Math.min(H.left,Q-W-8));if(q){const se=Math.min(X,Math.max(120,L-16));S({left:oe,width:W,bottom:Math.max(8,K-H.top+U),maxHeight:se})}else{const se=Math.min(X,Math.max(120,G-16));S({left:oe,width:W,top:Math.min(K-8,H.bottom+U),maxHeight:se})}};return F(),window.addEventListener("scroll",F,!0),window.addEventListener("resize",F),()=>{window.removeEventListener("scroll",F,!0),window.removeEventListener("resize",F)}},[h,v]);const T=l.useCallback((F,Y)=>{const H=t.jsx(_je,{type:"button",$highlighted:Y===$,onMouseEnter:()=>k(Y),onClick:()=>M(Y),disabled:!!F.disabled,style:F.color?{color:F.color}:void 0,children:F.label},F.value);return F.disabled&&F.disabledHint?t.jsx(at,{content:F.disabledHint,size:"sm",placement:"top",children:t.jsx("span",{style:{display:"block"},children:H})},F.value):H},[$]),M=F=>{const Y=B[F];!Y||Y.disabled||(r(Y.value),_(!1),k(-1))},R=F=>{if(!m){if(!v){if(F.key==="ArrowDown"||F.key==="Enter"||F.key===" "){F.preventDefault(),_(!0);const Y=B.findIndex(H=>H.value===i);k(Y>=0?Y:0)}return}switch(F.key){case"Escape":F.preventDefault(),_(!1),k(-1);break;case"ArrowDown":F.preventDefault(),k(Y=>Math.min(B.length-1,Y+1));break;case"ArrowUp":F.preventDefault(),k(Y=>Math.max(0,Y-1));break;case"Enter":case" ":F.preventDefault(),$>=0&&M($);break}}};return t.jsxs(gje,{ref:F=>{y.current=F,typeof x=="function"?x(F):x&&(x.current=F)},$fullWidth:u,...g,children:[s?t.jsx(yje,{children:s}):null,t.jsxs(xje,{ref:w,$hasLeftIcon:!!s,$size:a,$variant:c,$fullWidth:u,type:"button",onClick:()=>
1408{if(!m&&(_(F=>!F),!v)){const F=B.findIndex(Y=>Y.value===i);k(F>=0?F:0)}},onKeyDown:R,disabled:m,"aria-haspopup":"listbox","aria-expanded":v,children:[t.jsx(bje,{$placeholder:E,children:A}),t.jsx(vje,{})]}),h&&v?jr.createPortal(t.jsx(jje,{ref:j,style:P,role:"listbox",children:B.map((F,Y)=>T(F,Y))}),document.body):t.jsx(wje,{$open:v,role:"listbox",children:B.map((F,Y)=>T(F,Y))})]})}),Cje=p.div.withConfig({displayName:"MonthPicker__Wrap",componentId:"sc-1uh3ggb-0"})` 1409 display: flex; 1410 flex-direction: column; 1411 gap: ${e=>e.$compact?"0.3rem":"0.4rem"}; 1412`,Sje=p.label.withConfig({displayName:"MonthPicker__Label",componentId:"sc-1uh3ggb-1"})` 1413 display: flex; 1414 align-items: center; 1415 gap: 0.35rem; 1416 font-size: ${e=>e.$compact?"0.68rem":"0.72rem"}; 1417 font-weight: 700; 1418 color: ${z}; 1419`,kje=p.span.withConfig({displayName:"MonthPicker__HelperText",componentId:"sc-1uh3ggb-2"})` 1420 font-size: ${e=>e.$compact?"0.62rem":"0.68rem"}; 1421 color: ${Pe}; 1422`;function GE(){const e=new Date,n=e.getFullYear(),i=String(e.getMonth()+1).padStart(2,"0");return`${n}-${i}`}function $je(e){const n=[],i=new Date,r=new Intl.DateTimeFormat(void 0,{month:"short",year:"numeric"});for(let o=0;o<e;o++){const s=new Date(i.getFullYear(),i.getMonth()-o,1),a=s.getFullYear(),c=String(s.getMonth()+1).padStart(2,"0"),u=`${a}-${c}`,m=o===0?`${r.format(s)} (current)`:r.format(s);n.push({value:u,label:m})}return n}function lie({value:e,onChange:n,monthsBack:i=12,compact:r,label:o="Report month",helperText:s,dropdownPortal:a=!0}){const c=l.useMemo(()=>$je(i),[i]);return t.jsxs(Cje,{$compact:r,children:[t.jsx(Sje,{$compact:r,children:o}),t.jsx(Fn,{options:c,value:e,onChange:n,size:r?"sm":"md",leftIcon:t.jsx(a1,{size:r?14:16}),dropdownPortal:a,fullWidth:!0}),s&&t.jsx(kje,{$compact:r,children:s})]})}const Ije=p.div.withConfig({displayName:"ReportShareManager__Wrap",componentId:"sc-1ms23ns-0"})` 1423 display: flex; 1424 flex-direction: column; 1425 gap: 0; 1426`,Pje=p.button.withConfig({displayName:"ReportShareManager__CollapseHeader",componentId:"sc-1ms23ns-1"})` 1427 display: flex; 1428 align-items: center; 1429 gap: 0.4rem; 1430 padding: 0.55rem 0; 1431 background: none; 1432 border: none; 1433 cursor: pointer; 1434 font-family: inherit; 1435`,Aje=p.span.withConfig({displayName:"ReportShareManager__CollapseTitle",componentId:"sc-1ms23ns-2"})` 1436 font-size: 0.82rem; 1437 font-weight: 850; 1438 color: ${O}; 1439`,Nje=p.span.withConfig({displayName:"ReportShareManager__CollapseIcon",componentId:"sc-1ms23ns-3"})` 1440 color: ${Pe}; 1441 display: inline-flex; 1442`,zje=p.span.withConfig({displayName:"ReportShareManager__TitleIcon",componentId:"sc-1ms23ns-4"})` 1443 color: ${Pe}; 1444 display: inline-flex; 1445`,Tje=p.div.withConfig({displayName:"ReportShareManager__Inner",componentId:"sc-1ms23ns-5"})` 1446 display: flex; 1447 flex-direction: column; 1448 gap: 0; 1449 padding-top: 0.25rem; 1450`,rB=p.div.withConfig({displayName:"ReportShareManager__TabContent",componentId:"sc-1ms23ns-6"})` 1451 min-height: 260px; 1452 max-height: 340px; 1453 overflow-y: auto; 1454 display: flex; 1455 flex-direction: column; 1456 gap: 1rem; 1457 padding: 1rem 0 0.25rem; 1458`,Eje=p.div.withConfig({displayName:"ReportShareManager__Tabs",componentId:"sc-1ms23ns-7"})` 1459 display: flex; 1460 gap: 0; 1461 border-bottom: 1px solid ${V}; 1462`,oB=p.button.withConfig({displayName:"ReportShareManager__Tab",componentId:"sc-1ms23ns-8"})` 1463 flex: 1; 1464 padding: 0.5rem 0; 1465 font-size: 0.75rem; 1466 font-weight: 750; 1467 font-family: inherit; 1468 color: ${e=>e.$active?Ft:Pe}; 1469 background: none; 1470 border: none; 1471 border-bottom: 2px solid ${e=>e.$active?Ft:"transparent"}; 1472 cursor: pointer; 1473 transition: color 0.15s, border-color 0.15s; 1474 &:hover { color: ${e=>e.$active?Ft:O}; } 1475`,JN=p.label.withConfig({displayName:"ReportShareManager__Label",componentId:"sc-1ms23ns-9"})` 1476 font-size: 0.72rem; 1477 font-weight: 700; 1478 color: ${z}; 1479 display: flex; 1480 flex-direction: column; 1481 gap: 0.3rem; 1482`,Mje=p.div.withConfig({displayName:"ReportShareManager__RadioRow",componentId:"sc-1ms23ns-10"})` 1483 display: flex; 1484 gap: 0.75rem; 1485`,sB=p.label.withConfig({displayName:"ReportShareManager__RadioLabel",componentId:"sc-1ms23ns-11"})` 1486 display: flex; 1487 align-items: center; 1488 gap: 0.4rem; 1489 padding: 0.4rem 0.75rem; 1490 border: 1px solid ${e=>e.$active?Ft:V}; 1491 border-radius: 0.375rem; 1492 font-size: 0.75rem; 1493 font-weight: 650; 1494 color: ${e=>e.$active?Ft:z}; 1495 cursor: pointer; 1496 transition: border-color 0.15s, color 0.15s; 1497 &:hover { border-color: ${Pe}; } 1498`,aB=p.input.withConfig({displayName:"ReportShareManager__RadioInput",componentId:"sc-1ms23ns-12"})` 1499 accent-color: ${Ft}; 1500 width: 14px; 1501 height: 14px; 1502`,Rje=p.div.withConfig({displayName:"ReportShareManager__PillRow",componentId:"sc-1ms23ns-13"})` 1503 display: flex; 1504 gap: 0.4rem; 1505`,Oje=p.button.withConfig({displayName:"ReportShareManager__Pill",componentId:"sc-1ms23ns-14"})` 1506 padding: 0.3rem 0.65rem; 1507 border-radius: 0.375rem; 1508 font-size: 0.72rem; 1509 font-weight: 750; 1510 font-family: inherit; 1511 color: ${e=>e.$active?Z:z}; 1512 background: ${e=>e.$active?Ft:"transparent"}; 1513 border: 1px solid ${e=>e.$active?Ft:V}; 1514 cursor: pointer; 1515 transition: all 0.15s; 1516 &:hover { border-color: ${Pe}; } 1517`,Dje=p.input.withConfig({displayName:"ReportShareManager__EmailInput",componentId:"sc-1ms23ns-15"})` 1518 width: 100%; 1519 padding: 0.4rem 0.6rem; 1520 font-size: 0.78rem; 1521 font-family: inherit; 1522 background: ${Z}; 1523 border: 1px solid ${V}; 1524 border-radius: 0.375rem; 1525 outline: none; 1526 color: ${O}; 1527 &:focus { border-color: ${Ft}; } 1528 &::placeholder { color: ${Pe}; } 1529`,Lje=p.button.withConfig({displayName:"ReportShareManager__Btn",componentId:"sc-1ms23ns-16"})` 1530 display: inline-flex; 1531 align-items: center; 1532 gap: 0.35rem; 1533 padding: ${e=>e.$small?"0.3rem 0.6rem":"0.45rem 0.85rem"}; 1534 font-size: ${e=>e.$small?"0.72rem":"0.78rem"}; 1535 font-weight: 750; 1536 font-family: inherit; 1537 color: ${Z}; 1538 background: ${Ft}; 1539 border: none; 1540 border-radius: 0.375rem; 1541 cursor: pointer; 1542 transition: background 0.15s; 1543 &:hover { background: ${Kl}; } 1544 &:disabled { opacity: 0.5;
1544 cursor: not-allowed; } 1545`,Bje=p.div.withConfig({displayName:"ReportShareManager__CopyBanner",componentId:"sc-1ms23ns-17"})` 1546 display: flex; 1547 align-items: center; 1548 gap: 0.5rem; 1549 padding: 0.6rem 0.75rem; 1550 background: #f0fdf4; 1551 border: 1px solid #bbf7d0; 1552 border-radius: 0.5rem; 1553 font-size: 0.75rem; 1554 font-weight: 650; 1555 color: #166534; 1556`,Fje=p.span.withConfig({displayName:"ReportShareManager__CopyUrlText",componentId:"sc-1ms23ns-18"})` 1557 flex: 1; 1558 overflow: hidden; 1559 text-overflow: ellipsis; 1560 white-space: nowrap; 1561 font-size: 0.7rem; 1562 font-family: monospace; 1563 color: #166534; 1564`,Wje=p.button.withConfig({displayName:"ReportShareManager__CopyBtn",componentId:"sc-1ms23ns-19"})` 1565 display: inline-flex; 1566 align-items: center; 1567 gap: 0.25rem; 1568 padding: 0.25rem 0.5rem; 1569 font-size: 0.7rem; 1570 font-weight: 750; 1571 font-family: inherit; 1572 color: #166534; 1573 background: #dcfce7; 1574 border: 1px solid #bbf7d0; 1575 border-radius: 0.25rem; 1576 cursor: pointer; 1577 flex-shrink: 0; 1578 &:hover { background: #bbf7d0; } 1579`,lB=p.div.withConfig({displayName:"ReportShareManager__ShareRow",componentId:"sc-1ms23ns-20"})` 1580 display: flex; 1581 align-items: center; 1582 gap: 0.5rem; 1583 padding: 0.5rem 0.65rem; 1584 border: 1px solid ${V}; 1585 border-radius: 0.5rem; 1586 opacity: ${e=>e.$expired?.5:1}; 1587`,cB=p.div.withConfig({displayName:"ReportShareManager__ShareInfo",componentId:"sc-1ms23ns-21"})` 1588 flex: 1; 1589 min-width: 0; 1590`,dB=p.div.withConfig({displayName:"ReportShareManager__ShareLabel",componentId:"sc-1ms23ns-22"})` 1591 font-size: 0.72rem; 1592 font-weight: 750; 1593 color: ${O}; 1594 display: flex; 1595 align-items: center; 1596 gap: 0.35rem; 1597`,uB=p.div.withConfig({displayName:"ReportShareManager__ShareMeta",componentId:"sc-1ms23ns-23"})` 1598 font-size: 0.65rem; 1599 color: ${Pe}; 1600 margin-top: 0.1rem; 1601`,Uje=p.span.withConfig({displayName:"ReportShareManager__ViewedBadge",componentId:"sc-1ms23ns-24"})` 1602 display: inline-flex; 1603 align-items: center; 1604 gap: 0.2rem; 1605 font-size: 0.62rem; 1606 font-weight: 700; 1607 color: ${e=>e.$viewed?"#059669":Pe}; 1608`,Hje=p.button.withConfig({displayName:"ReportShareManager__RevokeBtn",componentId:"sc-1ms23ns-25"})` 1609 display: inline-flex; 1610 align-items: center; 1611 justify-content: center; 1612 width: 28px; 1613 height: 28px; 1614 border-radius: 0.375rem; 1615 border: 1px solid ${V}; 1616 background: ${Z}; 1617 color: ${Pe}; 1618 cursor: pointer; 1619 flex-shrink: 0; 1620 &:hover { color: #dc2626; border-color: #fca5a5; background: #fef2f2; } 1621`,qje=p.div.withConfig({displayName:"ReportShareManager__EmptyMsg",componentId:"sc-1ms23ns-26"})` 1622 font-size: 0.75rem; 1623 color: ${Pe}; 1624 text-align: center; 1625 padding: 1.5rem 0; 1626`;function pB(e){try{return new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",year:"numeric"}).format(new Date(e))}catch{return e}}function Gje(e){const n=new Date(e).getTime()-Date.now();if(n<=0)return"Expired";const i=Math.ceil(n/864e5);return i===1?"1 day left":`${i} days left`}function PP({workspaceId:e,projectId:n,whiteLabelEnabled:i,isOwner:r,orgLogoUrl:o,defaultOpen:s,collapsible:a=!0,defaultMonth:c,reportType:u="geo"}){const{showToast:m}=Uo(),[h,g]=l.useState(!!s||!a),[x,y]=l.useState("create"),[w,j]=l.useState([]),[v,_]=l.useState(!1),[$,k]=l.useState("link"),[P,S]=l.useState(""),[I,A]=l.useState(7),[E,B]=l.useState(!1),[T,M]=l.useState(bf[0]),[R,F]=l.useState(c||GE()),[Y,H]=l.useState(!1),[U,X]=l.useState(null),[Q,K]=l.useState(!1);l.useEffect(()=>{c&&F(c)},[c]);const G=`/api/v1/organizations/${e}/projects/${n}/report_shares`,L=async()=>{_(!0);try{const le=u!=="geo"?`?report_type=${u}`:"",me=await ue(`${G}${le}`),ee=await me.json().catch(()=>({}));me.ok&&ee.shares&&j(ee.shares)}catch{}_(!1)};l.useEffect(()=>{L()},[e,n]);const q=async()=>{if(!Y){H(!0),X(null);try{const le={share_type:$,expires_in_days:I,white_label:E&&i,footer_color:E&&i?T:null,selected_month:u==="geo"&&R||null,report_type:u};$==="email"&&(le.recipient_email=P);const me=await ue(G,{method:"POST",body:JSON.stringify(le)}),ee=await me.json().catch(()=>({}));me.ok&&ee.report_url&&(X(ee.report_url),S(""),L(),m($==="email"?"Report link sent!":"Share link created!",{tone:"success",durationMs:3e3}))}catch{}H(!1)}},W=async le=>{try{await ue(`${G}/${le}`,{method:"DELETE"}),L()}catch{}},oe=()=>{U&&navigator.clipboard.writeText(U).then(()=>{K(!0),setTimeout(()=>K(!1),2e3)})},se=w.filter(le=>le.active),de=w.filter(le=>!le.active);return t.jsxs(Ije,{children:[t.jsxs(Pje,{type:"button",onClick:a?()=>g(le=>!le):void 0,style:a?void 0:{cursor:"default"},children:[t.jsx(zje,{children:t.jsx(Z8,{size:14})}),t.jsx(Aje,{children:"Share Report"}),a&&t.jsx(Nje,{children:h?t.jsx(yu,{size:14}):t.jsx(qn,{size:14})})]}),h&&t.jsxs(Tje,{children:[t.jsxs(Eje,{children:[t.jsx(oB,{$active:x==="create",onClick:()=>{y("create"),X(null)},children:"Create Link"}),t.jsxs(oB,{$active:x==="manage",onClick:()=>y("manage"),children:["Manage (",se.length,")"]})]}),x==="create"&&t.jsxs(rB,{children:[t.jsxs(JN,{children:["Share via",t.jsxs(Mje,{children:[t.jsxs(sB,{$active:$==="link",children:[t.jsx(aB,{type:"radio",name:"shareType",checked:$==="link",onChange:()=>k("link")}),t.jsx(xu,{size:13})," Link"]}),t.jsxs(sB,{$active:$==="email",children:[t.jsx(aB,{type:"radio",name:"shareType",checked:$==="email",onChange:()=>k("email")}),t.jsx(bu,{size:13})," Email"]})]})]}),$==="email"&&t.jsxs(JN,{children:["Recipient email",t.jsx(Dje,{type:"email",placeholder:"[email protected]",value:P,onChange:le=>S(le.target.value)})]}),t.jsxs(JN,{children:["Expires in",t.jsx(Rje,{children:[7,14,30].map(le=>t.jsxs(Oje,{$active:I===le,onClick:()=>A(le),children:[le," days"]},le))})]}),u==="geo"&&t.jsx(lie,{value:R,onChange:F,compact:!0,helperText:"The shared link
1626will always show this month."}),t.jsx(uM,{whiteLabelEnabled:i,isOwner:r,workspaceId:e,orgLogoUrl:o,whiteLabel:E,onWhiteLabelChange:B,footerColor:T,onFooterColorChange:M,compact:!0}),t.jsxs(Lje,{onClick:q,disabled:Y||$==="email"&&!P.trim(),children:[$==="email"?t.jsx(bu,{size:13}):t.jsx(xu,{size:13}),Y?"Creating...":$==="email"?"Send & Create Link":"Create Share Link"]}),U&&$==="link"&&t.jsxs(Bje,{children:[t.jsx(Fje,{children:U}),t.jsxs(Wje,{onClick:oe,children:[Q?t.jsx(Zn,{size:12}):t.jsx(so,{size:12}),Q?"Copied":"Copy"]})]})]}),x==="manage"&&t.jsxs(rB,{children:[se.length===0&&!v&&t.jsx(qje,{children:"No active share links."}),se.map(le=>t.jsxs(lB,{children:[le.share_type==="email"?t.jsx(bu,{size:14,color:Pe}):t.jsx(xu,{size:14,color:Pe}),t.jsxs(cB,{children:[t.jsxs(dB,{children:[le.share_type==="email"?le.recipient_email:`Link ····${le.last4}`,t.jsxs(Uje,{$viewed:le.viewed,children:[le.viewed?t.jsx(Dc,{size:10}):t.jsx(jP,{size:10}),le.viewed?"Viewed":"Not viewed"]})]}),t.jsxs(uB,{children:[Gje(le.expires_at)," · Created ",pB(le.created_at),le.selected_month_label&&` · ${le.selected_month_label}`,le.white_label&&" · Branded"]})]}),t.jsx(Hje,{title:"Revoke",onClick:()=>W(le.id),children:t.jsx(Fi,{size:13})})]},le.id)),de.length>0&&t.jsxs(t.Fragment,{children:[t.jsx("div",{style:{fontSize:"0.68rem",fontWeight:700,color:Pe,marginTop:"0.5rem"},children:"Expired / Revoked"}),de.map(le=>t.jsxs(lB,{$expired:!0,children:[le.share_type==="email"?t.jsx(bu,{size:14,color:Pe}):t.jsx(xu,{size:14,color:Pe}),t.jsxs(cB,{children:[t.jsx(dB,{children:le.share_type==="email"?le.recipient_email:`Link ····${le.last4}`}),t.jsxs(uB,{children:[le.revoked_at?"Revoked":"Expired"," · Created ",pB(le.created_at)]})]})]},le.id))]})]})]})]})}const Vje=p.div.withConfig({displayName:"ReportModal__Body",componentId:"sc-1m3n6qd-0"})` 1627 display: flex; 1628 flex-direction: column; 1629 gap: 1.25rem; 1630 overflow-x: hidden; 1631`,Kje=p.span.withConfig({displayName:"ReportModal__Desc",componentId:"sc-1m3n6qd-1"})` 1632 font-size: 0.8rem; 1633 color: ${Pe}; 1634 line-height: 1.45; 1635`,Yje=p.div.withConfig({displayName:"ReportModal__TopRow",componentId:"sc-1m3n6qd-2"})` 1636 display: flex; 1637 align-items: flex-start; 1638 gap: 0.75rem; 1639`,Xje=p.button.withConfig({displayName:"ReportModal__ActionBtn",componentId:"sc-1m3n6qd-3"})` 1640 display: inline-flex; 1641 align-items: center; 1642 gap: 0.35rem; 1643 padding: 0.4rem 0.85rem; 1644 margin-top: 0.75rem; 1645 font-size: 0.8rem; 1646 font-weight: 750; 1647 font-family: inherit; 1648 color: ${Z}; 1649 background: ${e=>e.$disabled?Pe:Ft}; 1650 border: none; 1651 border-radius: 0.375rem; 1652 cursor: ${e=>e.$disabled?"not-allowed":"pointer"}; 1653 transition: background 0.15s; 1654 white-space: nowrap; 1655 flex-shrink: 0; 1656 &:hover { background: ${e=>e.$disabled?Pe:Kl}; } 1657`,Qje=p.div.withConfig({displayName:"ReportModal__Hint",componentId:"sc-1m3n6qd-4"})` 1658 display: flex; 1659 align-items: center; 1660 gap: 0.35rem; 1661 font-size: 0.75rem; 1662 color: ${Pe}; 1663`,Zje=p.button.withConfig({displayName:"ReportModal__UpgradeLink",componentId:"sc-1m3n6qd-5"})` 1664 background: none; 1665 border: none; 1666 padding: 0; 1667 font: inherit; 1668 font-weight: 800; 1669 color: ${Ft}; 1670 cursor: pointer; 1671 text-decoration: underline; 1672 text-underline-offset: 2px; 1673 &:hover { color: ${Kl}; } 1674`,Jje=p.div.withConfig({displayName:"ReportModal__ShareDivider",componentId:"sc-1m3n6qd-6"})` 1675 height: 1px; 1676 background: ${V}; 1677 margin: 0.25rem -1.25rem; 1678`;function cie({isOpen:e,onClose:n,workspaceId:i,projectId:r,reportEnabled:o,whiteLabelEnabled:s,isOwner:a,onUpgrade:c,orgLogoUrl:u}){const m=zn(),[h,g]=l.useState(!1),[x,y]=l.useState(bf[0]),[w,j]=l.useState(GE()),v=()=>{n(),g(!1),y(bf[0]),j(GE())},_=()=>{v(),c()};return t.jsx(Hn,{isOpen:e,onClose:v,title:"Visibility Report",description:"Generate and view your project report.",size:"md",minHeight:"18rem",showCloseButton:!0,children:t.jsxs(Vje,{children:[t.jsx(Kje,{children:"A comprehensive slide-by-slide report covering your brand's visibility scores, LLM model performance, top citations, competitive rankings, sentiment analysis, and actionable recommendations."}),o&&t.jsx(lie,{value:w,onChange:j,helperText:"Comparisons (vs. prior month, 6-month trend) are anchored to this selection."}),t.jsxs(Yje,{children:[o?t.jsx(uM,{whiteLabelEnabled:s,isOwner:a,workspaceId:i,orgLogoUrl:u,whiteLabel:h,onWhiteLabelChange:g,footerColor:x,onFooterColorChange:y,onUpgrade:_,onSettingsClick:n}):t.jsxs(Qje,{children:[t.jsx(ku,{size:11}),a?t.jsxs(t.Fragment,{children:[t.jsx(Zje,{onClick:_,children:"Upgrade your plan"})," to unlock reports."]}):"Ask your workspace owner to upgrade the plan."]}),t.jsxs(Xje,{$disabled:!o,onClick:()=>
1678{if(!o)return;v();const $=h&&s?"1":"0",k=$==="1"&&x!==bf[0]?`&footer_color=${encodeURIComponent(x)}`:"",P=w?`&month=${encodeURIComponent(w)}`:"";m(`/workspaces/${i}/projects/${r}/report?white_label=${$}${k}${P}`)},children:[o?t.jsx(Dc,{size:14}):t.jsx(ku,{size:14}),o?"View Report":"Report Locked"]})]}),o&&t.jsx(Jje,{}),o&&t.jsx(PP,{workspaceId:String(i),projectId:String(r),whiteLabelEnabled:s,isOwner:a,orgLogoUrl:u,defaultMonth:w})]})})}const e_e=p.div.withConfig({displayName:"SiteAuditReportModal__Body",componentId:"sc-1j2stj9-0"})` 1679 display: flex; 1680 flex-direction: column; 1681 gap: 1.25rem; 1682 overflow-x: hidden; 1683`,t_e=p.span.withConfig({displayName:"SiteAuditReportModal__Desc",componentId:"sc-1j2stj9-1"})` 1684 font-size: 0.8rem; 1685 color: ${Pe}; 1686 line-height: 1.45; 1687`,n_e=p.div.withConfig({displayName:"SiteAuditReportModal__TopRow",componentId:"sc-1j2stj9-2"})` 1688 display: flex; 1689 align-items: flex-start; 1690 gap: 0.75rem; 1691`,i_e=p.button.withConfig({displayName:"SiteAuditReportModal__ActionBtn",componentId:"sc-1j2stj9-3"})` 1692 display: inline-flex; 1693 align-items: center; 1694 gap: 0.35rem; 1695 padding: 0.4rem 0.85rem; 1696 margin-top: 0.75rem; 1697 font-size: 0.8rem; 1698 font-weight: 750; 1699 font-family: inherit; 1700 color: ${Z}; 1701 background: ${e=>e.$disabled?Pe:Ft}; 1702 border: none; 1703 border-radius: 0.375rem; 1704 cursor: ${e=>e.$disabled?"not-allowed":"pointer"}; 1705 transition: background 0.15s; 1706 white-space: nowrap; 1707 flex-shrink: 0; 1708 &:hover { background: ${e=>e.$disabled?Pe:Kl}; } 1709`,r_e=p.div.withConfig({displayName:"SiteAuditReportModal__Hint",componentId:"sc-1j2stj9-4"})` 1710 display: flex; 1711 align-items: center; 1712 gap: 0.35rem; 1713 font-size: 0.75rem; 1714 color: ${Pe}; 1715`,o_e=p.button.withConfig({displayName:"SiteAuditReportModal__UpgradeLink",componentId:"sc-1j2stj9-5"})` 1716 background: none; 1717 border: none; 1718 padding: 0; 1719 font: inherit; 1720 font-weight: 800; 1721 color: ${Ft}; 1722 cursor: pointer; 1723 text-decoration: underline; 1724 text-underline-offset: 2px; 1725 &:hover { color: ${Kl}; } 1726`,s_e=p.div.withConfig({displayName:"SiteAuditReportModal__ShareDivider",componentId:"sc-1j2stj9-6"})` 1727 height: 1px; 1728 background: ${V}; 1729 margin: 0.25rem -1.25rem; 1730`;function die({isOpen:e,onClose:n,workspaceId:i,projectId:r,reportEnabled:o,whiteLabelEnabled:s,isOwner:a,onUpgrade:c,orgLogoUrl:u}){const m=zn(),[h,g]=l.useState(!1),[x,y]=l.useState(bf[0]),w=()=>{n(),g(!1),y(bf[0])},j=()=>{w(),c()};return t.jsx(Hn,{isOpen:e,onClose:w,title:"Site Audit Report",description:"Generate and share your site audit report.",size:"md",minHeight:"18rem",showCloseButton:!0,children:t.jsxs(e_e,{children:[t.jsx(t_e,{children:"A comprehensive slide-by-slide report covering your site's AI Readiness Score, category breakdowns, top issues, crawlability, structured data, performance, metadata quality, and priorities."}),t.jsxs(n_e,{children:[o?t.jsx(uM,{whiteLabelEnabled:s,isOwner:a,workspaceId:i,orgLogoUrl:u,whiteLabel:h,onWhiteLabelChange:g,footerColor:x,onFooterColorChange:y,onUpgrade:j,onSettingsClick:n}):t.jsxs(r_e,{children:[t.jsx(ku,{size:11}),a?t.jsxs(t.Fragment,{children:[t.jsx(o_e,{onClick:j,children:"Upgrade your plan"})," to unlock reports."]}):"Ask your workspace owner to upgrade the plan."]}),t.jsxs(i_e,{$disabled:!o,onClick:()=>{if(!o)return;w();const v=h&&s?"1":"0",_=v==="1"&&x!==bf[0]?`&footer_color=${encodeURIComponent(x)}`:"";m(`/workspaces/${i}/projects/${r}/site-audit-report?white_label=${v}${_}`)},children:[o?t.jsx(Dc,{size:14}):t.jsx(ku,{size:14}),o?"View Report":"Report Locked"]})]}),o&&t.jsx(s_e,{}),o&&t.jsx(PP,{workspaceId:String(i),projectId:String(r),whiteLabelEnabled:s,isOwner:a,orgLogoUrl:u,reportType:"site_audit"})]})})}const VE="ceyo:credit-spend";function Fo(){window.dispatchEvent(new CustomEvent(VE))}const uie=l.createContext(null);function Mr(){const e=l.useContext(uie);if(!e)throw new Error("useProjects must be used within a ProjectsProvider");return e}const If=[{key:"chatgpt",label:"ChatGPT",Icon:ju},{key:"perplexity",label:"Perplexity",Icon:ih},{key:"gemini",label:"Gemini",Icon:wu},{key:"google_ai_mode",label:"Google AI Mode",Icon:ya},{key:"google_ai_overview",label:"Google AI Overview",Icon:ya},{key:"grok",label:"Grok",Icon:Mf},{key:"copilot",label:"Copilot",Icon:Rf},{key:"claude",label:"Claude",Icon:nh}],a_e=If.map(e=>e.key),pie=If.reduce((e,n)=>(e[n.key]=n,e),{});function l_e(e){const n=e&&typeof e=="object"?e:{};return a_e.filter(i=>!!n[i])}function eC(){const{organizationLlmModels:e}=Mr(),n=e,i=l.useMemo(()=>l_e(n),[n]),r=l.useMemo(()=>{const o=new Set(i);return If.map(s=>({key:s.key,label:s.label,Icon:s.Icon,disabled:!o.has(s.key)}
1730))},[i]);return{llmModelsMap:n,modelDefs:If,modelByKey:pie,allModelOptions:r,enabledModelKeys:i}}const c_e={grow:{perplexity:900,google_ai_mode:900,copilot:900,grok:900,claude:3600},pro_plus:{google_ai_mode:2800,copilot:2800,grok:2800,claude:11200}},w5={perplexity:7,google_ai_mode:7,copilot:7,grok:7,claude:28},j5=20,jc={core:["gemini","chatgpt"],grow:["gemini","chatgpt","google_ai_overview"],pro_plus:["gemini","chatgpt","google_ai_overview","perplexity"]},d_e=["chatgpt","gemini","google_ai_overview","perplexity","google_ai_mode","grok","copilot","claude"],ib={core:0,grow:50,pro_plus:100},hk={core:30,grow:125,pro_plus:500};function rx(e,n){return(c_e[e]||{})[n]||0}function cw(e,n,i){if(n<=0)return 0;const r=i.reduce((s,a)=>s+(w5[a]||0),0),o=j5+r;return Math.ceil(n*(ib[e]||50)*o)}function r_(e,n){return e?n==="yearly"?e.yearly_price_cents!=null?e.yearly_price_cents:e.monthly_price_cents!=null?Math.round(e.monthly_price_cents*12*.8):0:e.monthly_price_cents??0:0}function mf(e,n){if(e==null)return"â";const i=e/100;try{return i.toLocaleString("en-US",{style:"currency",currency:n||"USD",minimumFractionDigits:0,maximumFractionDigits:2})}catch{return`$${i}`}}function pa(e,n="â"){return e||n}const u_e=p.div.withConfig({displayName:"PlanConfigurator__ConfigCard",componentId:"sc-ycrzkk-0"})` 1731 background: ${Z}; 1732 border: 1px solid ${V}; 1733 border-radius: 0.85rem; 1734`,p_e=p.div.withConfig({displayName:"PlanConfigurator__ConfigBody",componentId:"sc-ycrzkk-1"})` 1735 padding: 1.25rem 1.5rem; 1736 display: flex; 1737 flex-direction: column; 1738 gap: 1.25rem; 1739`,m_e=p.div.withConfig({displayName:"PlanConfigurator__ConfigCardHeader",componentId:"sc-ycrzkk-2"})` 1740 display: flex; 1741 align-items: center; 1742 justify-content: space-between; 1743 padding: 1rem 1.25rem; 1744 border-bottom: 1px solid ${V}; 1745 gap: 0.75rem; 1746`,h_e=p.div.withConfig({displayName:"PlanConfigurator__ConfigCardHeaderLeft",componentId:"sc-ycrzkk-3"})` 1747 min-width: 0; 1748 h3 { font-size: 0.85rem; font-weight: 750; color: ${O}; margin: 0; } 1749 p { font-size: 0.68rem; font-weight: 600; color: ${z}; margin: 0.15rem 0 0; } 1750`,f_e=p.span.withConfig({displayName:"PlanConfigurator__AllocBadge",componentId:"sc-ycrzkk-4"})` 1751 font-size: 0.68rem; 1752 font-weight: 700; 1753 padding: 0.2rem 0.55rem; 1754 border-radius: 0.4rem; 1755 white-space: nowrap; 1756 background: ${e=>e.$over?kn:cn}; 1757 color: ${e=>e.$over?Ut:ot}; 1758 border: 1px solid ${e=>e.$over?Er:V}; 1759`,g_e=p.div.withConfig({displayName:"PlanConfigurator__AllocFooter",componentId:"sc-ycrzkk-5"})` 1760 border-top: 1px solid ${V}; 1761 padding: 1rem 1.25rem; 1762 display: flex; 1763 flex-direction: column; 1764 gap: 0.45rem; 1765`,mB=p.div.withConfig({displayName:"PlanConfigurator__AllocRow",componentId:"sc-ycrzkk-6"})` 1766 display: flex; 1767 justify-content: space-between; 1768 align-items: center; 1769 font-size: 0.75rem; 1770 gap: 0.35rem; 1771`,y_e=p.div.withConfig({displayName:"PlanConfigurator__AllocTotalRow",componentId:"sc-ycrzkk-7"})` 1772 display: flex; 1773 justify-content: space-between; 1774 align-items: center; 1775 font-size: 0.78rem; 1776 font-weight: 700; 1777 color: ${e=>e.$over?Ut:O}; 1778 padding-top: 0.45rem; 1779 border-top: 1px solid ${V}; 1780 margin-top: 0.2rem; 1781`,x_e=p.div.withConfig({displayName:"PlanConfigurator__FooterBtnRow",componentId:"sc-ycrzkk-8"})` 1782 display: flex; 1783 justify-content: flex-end; 1784 gap: 0.5rem; 1785 margin-top: 0.5rem; 1786`,b_e=p.button.withConfig({displayName:"PlanConfigurator__LlmToggleBtn",componentId:"sc-ycrzkk-9"})` 1787 width: 100%; 1788 display: flex; 1789 align-items: center; 1790 justify-content: space-between; 1791 padding: 0.7rem 0.85rem; 1792 border: 1px solid ${V}; 1793 border-radius: ${e=>e.$open?"0.55rem 0.55rem 0 0":"0.55rem"}; 1794 background: ${Z}; 1795 cursor: pointer; 1796 transition: border-color 0.15s; 1797 &:hover { border-color: ${ot}; } 1798 ${e=>e.$open?`border-color: ${ot};`:""} 1799`,v_e=p.div.withConfig({displayName:"PlanConfigurator__LlmToggleLeft",componentId:"sc-ycrzkk-10"})` 1800 display: flex; 1801 align-items: center; 1802 gap: 0.4rem; 1803 font-size: 0.8rem; 1804 font-weight: 700; 1805 color: ${O}; 1806`,w_e=p.span.withConfig({displayName:"PlanConfigurator__LlmToggleMeta",componentId:"sc-ycrzkk-11"})` 1807 font-weight: 500; 1808 color: ${Pe}; 1809 font-size: 0.72rem; 1810 margin-left: 0.35rem; 1811`,j_e=p.span.withConfig({displayName:"PlanConfigurator__LlmToggleChevron",componentId:"sc-ycrzkk-12"})` 1812 display: flex; 1813 align-items: center; 1814 color: ${Pe}; 1815 transition: transform 0.2s; 1816 ${e=>e.$open?"transform: rotate(180deg);
1816":""} 1817`,__e=p.div.withConfig({displayName:"PlanConfigurator__LlmDropdownPanel",componentId:"sc-ycrzkk-13"})` 1818 border: 1px solid ${ot}; 1819 border-top: none; 1820 border-radius: 0 0 0.55rem 0.55rem; 1821 background: ${Z}; 1822 padding: 0.4rem; 1823`,C_e=p.div.withConfig({displayName:"PlanConfigurator__LlmItemRow",componentId:"sc-ycrzkk-14"})` 1824 display: flex; 1825 align-items: center; 1826 justify-content: space-between; 1827 padding: 0.55rem 0.6rem; 1828 border: 1px solid ${e=>e.$enabled?ot:V}; 1829 border-radius: 0.4rem; 1830 background: ${e=>e.$enabled?cn:Z}; 1831 cursor: ${e=>e.$isDefault?"default":"pointer"}; 1832 transition: all 0.12s; 1833 &:hover { background: ${e=>e.$isDefault?e.$enabled?cn:Z:At}; } 1834 &:not(:last-child) { margin-bottom: 0.35rem; } 1835`,S_e=p.div.withConfig({displayName:"PlanConfigurator__LlmItemLeft",componentId:"sc-ycrzkk-15"})` 1836 display: flex; 1837 align-items: center; 1838 gap: 0.5rem; 1839 min-width: 0; 1840`,k_e=p.div.withConfig({displayName:"PlanConfigurator__LlmCheckbox",componentId:"sc-ycrzkk-16"})` 1841 width: 18px; 1842 height: 18px; 1843 border-radius: 4px; 1844 border: 2px solid ${e=>e.$checked?ot:V}; 1845 background: ${e=>e.$checked?ot:Z}; 1846 display: flex; 1847 align-items: center; 1848 justify-content: center; 1849 flex-shrink: 0; 1850 opacity: ${e=>e.$disabled?.6:1}; 1851`,$_e=p.span.withConfig({displayName:"PlanConfigurator__LlmItemIcon",componentId:"sc-ycrzkk-17"})` 1852 width: 20px; 1853 height: 20px; 1854 display: inline-flex; 1855 align-items: center; 1856 justify-content: center; 1857 flex-shrink: 0; 1858 color: ${O}; 1859 1860 svg { 1861 width: 18px; 1862 height: 18px; 1863 } 1864`,I_e=p.span.withConfig({displayName:"PlanConfigurator__LlmItemName",componentId:"sc-ycrzkk-18"})` 1865 font-size: 0.8rem; 1866 font-weight: 700; 1867 color: ${O}; 1868`,ez=p.span.withConfig({displayName:"PlanConfigurator__LlmBadge",componentId:"sc-ycrzkk-19"})` 1869 font-size: 0.6rem; 1870 font-weight: 700; 1871 padding: 0.15rem 0.4rem; 1872 border-radius: 4px; 1873 white-space: nowrap; 1874 ${e=>e.$variant==="included"?`background: ${At}; color: ${z}; border: 1px solid ${V};`:e.$variant==="active"?`background: ${si}; color: ${Vt}; border: 1px solid ${Mo};`:`background: ${cn}; color: ${ot}; border: 1px solid ${V};`} 1875`,P_e=p.span.withConfig({displayName:"PlanConfigurator__LlmCreditsTag",componentId:"sc-ycrzkk-20"})` 1876 font-size: 0.72rem; 1877 font-weight: 700; 1878 color: ${e=>e.$active?ot:Pe}; 1879 white-space: nowrap; 1880`,A_e=p.div.withConfig({displayName:"PlanConfigurator__Stepper",componentId:"sc-ycrzkk-21"})` 1881 display: flex; 1882 align-items: center; 1883 gap: 0.5rem; 1884`,hB=p.button.withConfig({displayName:"PlanConfigurator__StepperBtn",componentId:"sc-ycrzkk-22"})` 1885 width: 28px; 1886 height: 28px; 1887 border: 1px solid ${V}; 1888 border-radius: 0.4rem; 1889 background: ${Z}; 1890 cursor: pointer; 1891 display: flex; 1892 align-items: center; 1893 justify-content: center; 1894 transition: all 0.12s ease; 1895 color: ${O}; 1896 &:hover { border-color: ${ot}; background: ${cn}; } 1897 &:disabled { opacity: 0.4; cursor: not-allowed; } 1898`,N_e=p.span.withConfig({displayName:"PlanConfigurator__StepperValue",componentId:"sc-ycrzkk-23"})` 1899 min-width: 32px; 1900 text-align: center; 1901 font-size: 0.875rem; 1902 font-weight: 800; 1903 color: ${O}; 1904`,fB=p.div.withConfig({displayName:"PlanConfigurator__Divider",componentId:"sc-ycrzkk-24"})` 1905 height: 1px; 1906 background: ${V}; 1907`,z_e=p.div.withConfig({displayName:"PlanConfigurator__IntervalToggle",componentId:"sc-ycrzkk-25"})` 1908 display: inline-flex; 1909 background: ${At}; 1910 border: 1px solid ${V}; 1911 border-radius: 0.5rem; 1912 overflow: hidden; 1913`,gB=p.button.withConfig({displayName:"PlanConfigurator__IntervalBtn",componentId:"sc-ycrzkk-26"})` 1914 appearance: none; 1915 border: none; 1916 padding: 0.35rem 0.85rem; 1917 font-size: 0.72rem; 1918 font-weight: 700; 1919 cursor: pointer; 1920 display: flex; 1921 align-items: center; 1922 transition: background 0.15s, color 0.15s; 1923 background: ${e=>e.$active?Z:"transparent"}; 1924 color: ${e=>e.$active?O:z}; 1925 box-shadow: ${e=>e.$active?"0 1px 3px rgba(0,0,0,0.08)":"none"}; 1926 &:hover { background: ${e=>e.$active?Z:V}; } 1927`,yB=p.div.withConfig({displayName:"PlanConfigurator__CoreBanner",componentId:"sc-ycrzkk-27"})` 1928 display: flex; 1929 align-items: center; 1930 gap: 1.25rem; 1931 background: ${cn}; 1932 border: 1px solid ${V}; 1933 border-radius: 0.75rem; 1934 padding: 1rem 1.25rem; 1935`,xB=p.div.withConfig({displayName:"PlanConfigurator__FamilyNotice",componentId:"sc-ycrzkk-28"})` 1936 background: ${cn}; 1937 border: 1px solid ${V}; 1938 border-radius: 0.5rem; 1939 padding: 0.5rem 0.85rem; 1940 font-size: 0.72rem; 1941 font-weight: 650; 1942 color: ${ot}; 1943`,T_e=p.div.withConfig({displayName:"PlanConfigurator__AutoNotice",componentId:"sc-ycrzkk-29"})` 1944 display: ${e=>e.$show?"flex":"none"}; 1945 align-items: center; 1946 gap: 0.5rem; 1947 background: ${cn}; 1948 border: 1px solid ${V}; 1949 border-radius: 0.5rem; 1950 padding: 0.6rem 1rem; 1951 font-size: 0.75rem; 1952 font-weight: 600; 1953 color: ${ot}; 1954`,E_e=p.div.withConfig({displayName:"PlanConfigurator__DowngradeWarning",componentId:"sc-ycrzkk-30"})` 1955 background: ${kn}; 1956 border: 1px solid ${Er}; 1957 border-radius: 0.6rem; 1958 padding: 0.85rem 1rem; 1959`,M_e=p.div.withConfig({displayName:"PlanConfigurator__OverBudgetBanner",componentId:"sc-ycrzkk-31"})` 1960 display: flex; 1961 align-items: flex-start; 1962 gap: 0.65rem; 1963 padding: 0.75rem 1rem; 1964 border-radius: 0.6rem; 1965 background: ${kn}; 1966 border: 1px solid ${Er}; 1967`;function mie({plans:e,subscription:n,orgId:i,isCore:r,currentPlanFamily:o,billingLocked:s,onSaved:a,onIntervalChange:c,onDirtyChange:u,showToast:m,creditsAvailable:h}){const[g,x]=l.useState(""),[y,w]=l.useState([]),[j,v]=l.useState(0),[_,$]=l.useState(null),[k,P]=l.useState("monthly"),[S,I]=l.useState(!1),[A,E]=l.useState(!1),[B,T]=l.useState(!1),[M,R]=l.useState(null),F=(!r||S)&&!s,Y=l.useMemo(()=>e.filter(ce=>ce.plan_family==="grow"||ce.plan_family==="pro_plus").sort((ce,ie)=>{const Re=ce.plan_family===o?0:1,Be=ie.plan_family===o?0:1;return Re!==Be?Re-Be:(ce.monthly_credits_allowance??0)-(ie.monthly_credits_allowance??0)}),[e,o]),H=l.useMemo(()=>Y.find(ce=>ce.code===g),[Y,g]),U=H?.plan_family||(n?n?.plan?.plan_family:null)||"grow",X=jc[U]||jc.grow,Q=ib[U]||50;l.useEffect(()=>{if(!n||Y.length===0)return;const ce=n.entitlements_override;if(r)x(Y[0]?.code||""),w([...jc.grow||[]]);else{const Re=n.plan?.code||"",Be=Y.find(tt=>tt.code===Re);x(Be?.code||Y[0]?.code||""),ce?.models&&ce.models.length>0?w([...ce.models]):w([...jc[o]||jc.grow])}v(ce?._prompt_packs??0),I(!1);const ie=n.billing_interval==="yearly"?"yearly":"monthly";P(ie)},[n?.plan?.id,Y.length]),l.useEffect(()=>{c?.(k)},[k]);const K=l.useMemo(()=>y.filter(ce=>!X.includes(ce)),[y,X]),G=l.useMemo(()=>K.reduce((ce,ie)=>ce+rx(U,ie),0),[K,U]),L=l.useMemo(()=>cw(U,j,K),[j,U,K]),q=G+L,W=H?.monthly_credits_allowance??0,oe=q>W,se=l.useRef(null);l.useEffect(()=>{if(!F||Y.length===0)return;if(q<=W){if(_){const dt=n?.plan?.code||"",je=Y.find(Me=>Me.code===dt);if(je){const Me=je.plan_family||"grow",Se=jc[Me]||[],it=y.filter(ge=>!Se.includes(ge)),De=se.current??j,te=it.reduce((ge,Je)=>ge+rx(Me,Je),0)+cw(Me,De,it);(je.monthly_credits_allowance??0)>=te&&(x(dt),se.current!=null&&(v(se.current),se.current=null),$(null))}}return}const ce=dt=>{if(j<=0)return 0;const je=ib[U]??50,Me=ib[dt]??50;if(Me<=0)return 0;const Se=hk[U]??125,it=hk[dt]??125,te=Se+j*je-it;return te<=0?0:Math.floor(te/Me)},ie=dt=>{const je=dt.plan_family||"grow",Me=jc[je]||[],Se=y.filter(ge=>!Me.includes(ge)),it=Se.reduce((ge,Je)=>ge+rx(je,Je),0),De=ce(je),te=cw(je,De,Se);return(dt.monthly_credits_allowance??0)>=it+te};let Be=Y.filter(dt=>dt.plan_family===U).find(ie)||Y.find(ie);if(!Be||Be.code===g)return;const tt=Be.plan_family||"grow";if(tt!==U&&j>0){const dt=ce(tt);dt!==j&&(se.current==null&&(se.current=j),v(dt))}x(Be.code),$(pa(Be.name))},[q,y,j,Y,U,W,F]),l.useEffect(()=>{const ce=jc[U]||[];w(ie=>{const Re=new Set(ie);for(const Be of ce)Re.add(Be);return[...Re]})},[U]);const de=l.useMemo(()=>
1967{if(r&&!S)return!1;if(r&&S)return!0;if(!n)return!1;const ce=n.plan?.code||"";if(g!==ce)return!0;const ie=n.entitlements_override,Re=ie?.models&&ie.models.length>0?[...ie.models].sort():[...jc[o]||[]].sort();return JSON.stringify([...y].sort())!==JSON.stringify(Re)||j!==(ie?._prompt_packs??0)||k!==(n.billing_interval==="yearly"?"yearly":"monthly")},[r,S,g,y,j,k,n]);l.useEffect(()=>{u?.(de)},[de,u]);const le=l.useMemo(()=>r&&S?!0:n?g!==(n.plan?.code||""):!1,[r,S,n,g]),me=l.useMemo(()=>n?k!==(n.billing_interval==="yearly"?"yearly":"monthly"):!1,[k,n]),ee=l.useMemo(()=>n?n.billing_interval==="yearly"&&k==="monthly":!1,[k,n]),ne=l.useMemo(()=>{if(le||me)return 0;const ce=n?.entitlements_override,ie=ce?.models&&ce.models.length>0?ce.models:[...jc[o]||[]],Re=ce?._prompt_packs??0,Be=ie.filter(je=>!X.includes(je)),tt=Be.reduce((je,Me)=>je+rx(U,Me),0),dt=cw(U,Re,Be);return q-(tt+dt)},[q,n,X,U,o,le,me]),Ae=l.useMemo(()=>{const ce={},ie=ib[U]??50,Re=hk[U]??125;for(const dt of["grow","pro_plus"]){const je=jc[dt]||[],Me=y.filter(te=>!je.includes(te)),Se=ib[dt]??50,it=hk[dt]??125;let De=j;if(j>0&&Se>0){const ge=Re+j*ie-it;De=ge<=0?0:Math.floor(ge/Se)}else Se<=0&&(De=0);ce[dt]=Me.reduce((te,ge)=>te+rx(dt,ge),0)+cw(dt,De,Me)}const Be=[],tt=o==="pro_plus"?["pro_plus"]:["grow","pro_plus"];for(const dt of tt){const je=Y.filter(Se=>Se.plan_family===dt),Me=ce[dt]??0;for(const Se of je){const it=Se.monthly_credits_allowance??0,De=r_(Se,k),te=k==="yearly"?"/yr":"/mo",ge=it<Me;Be.push({value:Se.code,label:(Se.credit_tier??0)>0?`${pa(Se.name)} (${mf(De,Se.currency)}${te})`:`${pa(Se.name)} â ${it.toLocaleString()} credits (${mf(De,Se.currency)}${te})`,disabled:ge,disabledHint:ge?"Not enough credits for your current add-ons. Remove LLMs or prompt packs to unlock.":void 0})}}return Be},[Y,k,y,j,o,U]),_e=l.useCallback(ce=>{X.includes(ce)||w(ie=>ie.includes(ce)?ie.filter(Re=>Re!==ce):[...ie,ce])},[X]),we=l.useCallback(()=>{if(!n||Y.length===0)return;const ce=n.entitlements_override,ie=r?"grow":o;if(r)I(!1),x(Y[0]?.code||""),w([...jc.grow||[]]);else{const Re=Y.find(Be=>Be.code===n.plan?.code);x(Re?.code||Y[0]?.code||""),w(ce?.models&&ce.models.length>0?[...ce.models]:[...jc[ie]||[]])}v(ce?._prompt_packs??0),P(n.billing_interval==="yearly"?"yearly":"monthly")},[r,o,e,n,Y]),Ke=l.useCallback(async()=>{if(!(!i||!H)){T(!0),R(null);try{const ce=await ue(`/api/v1/organizations/${i}/billing/update_plan_config`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plan_code:H.code,selected_models:y,prompt_packs:j,billing_interval:k})}),ie=await ce.json().catch(()=>({}));if(!ce.ok){ie?.errors?.error_code==="plan_downgrade_over_limit"?(R(Array.isArray(ie.errors.details)?ie.errors.details:[]),m("Downgrade blocked â your current usage exceeds the target plan limits.",{tone:"error"})):m(ie?.error||"Failed to update configuration",{tone:"error"});return}if(ie?.scheduled_downgrade)m("Plan change scheduled for the end of your current billing period.",{tone:"info"});else if(ie?.addon_credits_stripped)m("Configuration saved but add-ons were stripped â insufficient credits.",{tone:"error"});else{const Re=ie?.addon_credits_consumed??0,Be=ie?.addon_credits_refunded??0;Re>0&&Fo(),Re>0&&Be===0?m(`Configuration updated â ${Re.toLocaleString()} credits charged (prorated).`,{tone:"success"}):Be>0&&Re===0?m(`Configuration updated â ${Be.toLocaleString()} credits refunded (prorated).`,{tone:"success"}):Re>0&&Be>0?m(`Configuration updated â ${Re.toLocaleString()} credits charged, ${Be.toLocaleString()} refunded (prorated).`,{tone:"success"}):m("Plan configuration updated.",{tone:"success"})}a()}catch(ce){m(ce instanceof Error?ce.message:"Failed to update configuration",{tone:"error"})}finally{T(!1)}}},[i,H,y,j,k]);return s?t.jsx(yB,{children:t.jsxs("div",{style:{flex:1},children:[t.jsx("div",{style:{fontSize:"0.85rem",fontWeight:750,color:O,marginBottom:"0.25rem"},children:"Plan configuration temporarily disabled"}),t.jsx("div",{style:{fontSize:"0.75rem",fontWeight:600,color:z,lineHeight:1.4},children:"This workspace is temporarily exempt from billing."})]})}):r&&!S?t.jsxs(yB,{children:[t.jsxs("div",{style:{flex:1},children:[t.jsx("div",{style:{fontSize:"0.85rem",fontWeight:750,color:O,marginBottom:"0.25rem"},children:"Upgrade to unlock AI configuration"}),t.jsx("div",{style:{fontSize:"0.75rem",fontWeight:600,color:z,lineHeight:1.4},children:"Your Core plan includes basic AI features. Upgrade to Grow or Pro+ to select additional LLMs, add prompt packs, and manage your monthly credit budget."})]}),t.jsx(he,{type:"button",size:"sm",variant:"primary",onClick:()=>I(!0),children:"Explore upgrades"})]}):F?t.jsxs(u_e,{children:[t.jsxs(m_e,{children:[t.jsxs(h_e,{children:[t.jsx("h3",{children:"LLMs & Prompts"}),t.jsx("p",{children:"Select LLMs and prompt packs â uses your available credits"})]}
1967),t.jsx(f_e,{$over:oe,children:oe?`${(q-W).toLocaleString()} cr over`:!de&&h!=null?`${h.toLocaleString()} cr available`:`${(W-q).toLocaleString()} cr left`})]}),t.jsxs(p_e,{children:[t.jsxs("div",{children:[t.jsxs(b_e,{type:"button",$open:A,onClick:()=>E(ce=>!ce),children:[t.jsxs(v_e,{children:[t.jsx("span",{children:"Select LLMs"}),t.jsxs(w_e,{children:[y.length," active",K.length>0?` · ${K.length} add-on${K.length>1?"s":""}`:"",G>0?t.jsx("span",{style:{color:ot},children:` · ${G.toLocaleString()} cr`}):null]})]}),t.jsx(j_e,{$open:A,children:t.jsx(qn,{size:16})})]}),A?t.jsx(__e,{children:d_e.map(ce=>{const ie=If.find(Me=>Me.key===ce);if(!ie)return null;const Re=ie.Icon,Be=X.includes(ce),tt=y.includes(ce),dt=Be?0:rx(U,ce),je=!Be&&dt>0;return t.jsxs(C_e,{$enabled:tt,$isDefault:Be,onClick:()=>{Be||_e(ce)},children:[t.jsxs(S_e,{children:[t.jsx(k_e,{$checked:tt,$disabled:Be,children:tt?t.jsx(Zn,{size:12,color:"#fff",strokeWidth:3}):null}),t.jsx($_e,{children:t.jsx(Re,{})}),t.jsx(I_e,{children:ie.label}),Be?t.jsx(ez,{$variant:"included",children:"Included"}):null,je&&!tt?t.jsx(ez,{$variant:"addon",children:"Add-on"}):null,je&&tt?t.jsx(ez,{$variant:"active",children:"Active"}):null]}),je?t.jsxs(P_e,{$active:tt,children:[dt.toLocaleString()," credits"]}):null]},ce)})}):null]}),t.jsx(fB,{}),t.jsxs("div",{children:[t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[t.jsxs("div",{children:[t.jsx("div",{style:{fontSize:"0.8rem",fontWeight:750,color:O},children:"Prompt Packs"}),t.jsxs("div",{style:{fontSize:"0.68rem",fontWeight:600,color:z,marginTop:"0.15rem"},children:[Q," prompts/pack · ",j5," cr/prompt base",K.length>0?` + ${K.reduce((ce,ie)=>ce+(w5[ie]||0),0)} cr add-ons`:""]})]}),t.jsxs(A_e,{children:[t.jsx(hB,{type:"button",disabled:j<=0,onClick:()=>v(ce=>Math.max(0,ce-1)),children:t.jsx(Bne,{size:14})}),t.jsx(N_e,{children:j}),t.jsx(hB,{type:"button",disabled:j>=10,onClick:()=>v(ce=>Math.min(10,ce+1)),children:t.jsx(gr,{size:14})})]})]}),j>0?t.jsxs("div",{style:{marginTop:"0.5rem"},children:[t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",fontSize:"0.72rem",fontWeight:700,padding:"0.35rem 0.65rem",borderRadius:"0.4rem",background:oe?kn:cn,color:oe?Ut:ot},children:[t.jsxs("span",{children:["+",(j*Q).toLocaleString()," prompts"]}),t.jsxs("span",{style:{fontWeight:800},children:["+",L.toLocaleString()," credits"]})]}),K.length>0?t.jsxs("div",{style:{fontSize:"0.65rem",fontWeight:600,color:Pe,marginTop:"0.3rem"},children:["Per prompt: ",j5," base + ",K.reduce((ce,ie)=>ce+(w5[ie]||0),0)," add-ons = ",j5+K.reduce((ce,ie)=>ce+(w5[ie]||0),0)," credits/prompt"]}):null]}):null]}),t.jsx(fB,{}),t.jsxs("div",{children:[t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"0.5rem"},children:[t.jsx("span",{style:{fontSize:"0.8rem",fontWeight:750,color:O},children:"Plan & Credits"}),t.jsxs(z_e,{children:[t.jsx(gB,{type:"button",$active:k==="monthly",onClick:()=>P("monthly"),children:"Monthly"}),t.jsxs(gB,{type:"button",$active:k==="yearly",onClick:()=>P("yearly"),children:["Yearly",t.jsx("span",{style:{fontSize:"0.6rem",fontWeight:700,color:Vt,marginLeft:"0.3rem"},children:"â20%"})]})]})]}),t.jsx(Fn,{options:Ae,value:g,onChange:ce=>{x(ce),$(null)},size:"md",fullWidth:!0}),_?t.jsxs(T_e,{$show:!0,style:{marginTop:"0.5rem"},children:[t.jsx(Ks,{size:14})," Plan automatically upgraded to ",t.jsx("strong",{children:_})," to cover your LLM & prompt configuration"]}):null,U!==o&&!r&&!_?t.jsx(xB,{style:{marginTop:"0.5rem"},children:U==="pro_plus"?"Switching to a Pro+ plan.":"Switching to a Grow plan."}):null,ee?t.jsx(xB,{style:{marginTop:"0.5rem"},children:"Annual-to-monthly changes are scheduled for the end of your current annual term. Choose yearly billing to upgrade immediately."}):null]})]}),q>0||de?t.jsxs(g_e,{children:[G>0?t.jsxs(mB,{children:[t.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"0.35rem",color:z},children:["Add-on LLMs",K.map(ce=>{const ie=If.find(Be=>Be.key===ce);if(!ie)return null;const Re=ie.Icon;return t.jsx("span",{style:{width:14,height:14,display:"inline-flex",alignItems:"center",justifyContent:"center",color:O},children:t.jsx(Re,{style:{width:12,height:12}})},ce)})]}),t.jsxs("span",{style:{fontWeight:700,color:O}
1967,children:[G.toLocaleString()," credits"]})]}):null,L>0?t.jsxs(mB,{children:[t.jsxs("span",{style:{color:z},children:["Prompt Packs (",j,")"]}),t.jsxs("span",{style:{fontWeight:700,color:O},children:[L.toLocaleString()," credits"]})]}):null,q>0?t.jsxs(y_e,{$over:oe,children:[t.jsx("span",{children:"Total allocated"}),t.jsxs("span",{children:[q.toLocaleString()," / ",W.toLocaleString(),"/mo"]})]}):null,oe?t.jsxs(M_e,{children:[t.jsx(ei,{size:18,style:{color:Ut,flexShrink:0,marginTop:1}}),t.jsxs("div",{children:[t.jsx("div",{style:{fontSize:"0.78rem",fontWeight:750,color:Ut,marginBottom:"0.15rem"},children:"Not enough credits"}),t.jsxs("div",{style:{fontSize:"0.72rem",fontWeight:600,color:z},children:["You need ",q.toLocaleString()," credits/mo but your plan only includes ",W.toLocaleString(),"/mo. Upgrade your credit package or remove some add-ons."]})]})]}):null,M&&M.length>0?t.jsxs(E_e,{children:[t.jsx("div",{style:{fontSize:"0.78rem",fontWeight:750,color:Ut,marginBottom:"0.4rem"},children:"Downgrade blocked â usage exceeds target plan limits"}),M.map((ce,ie)=>t.jsxs("div",{style:{fontSize:"0.72rem",fontWeight:600,color:z,marginBottom:"0.15rem"},children:["⢠",ce.message," (",ce.used," used / ",ce.limit," limit)"]},ie)),t.jsx("div",{style:{fontSize:"0.68rem",fontWeight:600,color:Pe,marginTop:"0.35rem"},children:"Reduce usage before switching to a lower plan."})]}):null,de?t.jsxs(t.Fragment,{children:[le||me?(()=>{const ce=r_(H,"yearly"),ie=k==="yearly"?Math.round(ce/12):r_(H,"monthly"),Re=n?.billing_interval==="yearly"?Math.round((n?.price_cents??0)/12):n?.price_cents??0;return t.jsxs("div",{style:{marginTop:"1rem",paddingTop:"0.75rem",borderTop:`1px solid ${V}`},children:[t.jsx("div",{style:{fontSize:"0.72rem",fontWeight:750,color:z,textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"0.4rem"},children:"Your new price"}),t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.4rem"},children:[t.jsxs("span",{style:{fontSize:"0.85rem",fontWeight:700,color:Pe,textDecoration:"line-through"},children:[mf(Re,n?.currency),"/mo"]}),t.jsx("span",{style:{fontSize:"0.8rem",color:Pe},children:"â"}),t.jsxs("span",{style:{fontSize:"1.1rem",fontWeight:900,color:O},children:[mf(ie,H?.currency),"/mo"]}),t.jsx("span",{style:{fontSize:"0.72rem",fontWeight:600,color:Pe,marginLeft:"0.15rem"},children:pa(H?.name,"New plan")})]}),k==="yearly"?t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.4rem",marginTop:"0.3rem"},children:[t.jsxs("span",{style:{fontSize:"0.82rem",fontWeight:700,color:O},children:[mf(ce,H?.currency),"/yr"]}),t.jsx("span",{style:{fontSize:"0.6rem",fontWeight:800,color:Vt,background:si,padding:"0.15rem 0.35rem",borderRadius:"0.25rem"},children:"â20%"})]}):null]})})():null,!(le||me)&&ne!==0?t.jsxs("div",{style:{marginTop:"1rem",paddingTop:"0.75rem",borderTop:`1px solid ${V}`},children:[t.jsx("div",{style:{fontSize:"0.72rem",fontWeight:750,color:z,textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"0.4rem"},children:"Credit impact"}),t.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:"0.35rem"},children:[t.jsxs("span",{style:{fontSize:"0.95rem",fontWeight:900,color:ne>0?Ut:Vt},children:[ne>0?`â${ne.toLocaleString()}`:`+${Math.abs(ne).toLocaleString()}`," credits"]}),t.jsx("span",{style:{fontSize:"0.72rem",fontWeight:600,color:Pe},children:ne>0?"charged (prorated)":"refunded (prorated)"})]})]}):null,t.jsx("div",{style:{fontSize:"0.72rem",fontWeight:600,color:z,marginTop:"0.35rem"},children:(()=>{if(le||me){const ce=Y.find(Be=>Be.code===(n?.plan?.code||""))?.monthly_credits_allowance??0,ie=H?.monthly_credits_allowance??0,Re=ie-ce;if(ee)return"This change will be scheduled for the end of your current annual term, so no credit or refund is issued now.";if(Re>0){const Be=Math.round(Re*.5);return t.jsxs(t.Fragment,{children:["Your billing will be adjusted accordingly. You'll receive approximately ",t.jsxs("strong",{style:{color:O},children:[Be.toLocaleString()," â ",Re.toLocaleString()," credits"]})," now, prorated to the remaining days in your current monthly credit cycle. From next month you'll get the full ",ie.toLocaleStr
1967ing()," credits."]})}return"Your billing will be adjusted accordingly."}return ne>0?"Credits will be deducted from your balance, prorated to the remaining days in your billing cycle.":ne<0?"Credits will be returned to your balance, prorated to the remaining days in your billing cycle.":"Update your LLM and prompt pack configuration."})()}),t.jsxs(x_e,{children:[t.jsx(he,{type:"button",size:"sm",variant:"outline",onClick:we,children:"Cancel"}),oe?t.jsx(he,{type:"button",size:"sm",variant:"primary",disabled:!0,children:"Upgrade Credits"}):le||me?t.jsx(he,{type:"button",size:"sm",variant:"primary",disabled:B,onClick:Ke,children:B?"Savingâ¦":ee?"Schedule Change":"Confirm Plan Change"}):t.jsx(he,{type:"button",size:"sm",variant:"primary",disabled:B,onClick:Ke,children:B?"Savingâ¦":"Save Configuration"})]})]}):null]}):null]}):null}const R_e=p(Tr).withConfig({displayName:"PlanConfiguratorOverlay__Spinner",componentId:"sc-10xz2q2-0"})` 1968 animation: spin 0.8s linear infinite; 1969 @keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } } 1970`,dw=p.div.withConfig({displayName:"PlanConfiguratorOverlay__CenterMsg",componentId:"sc-10xz2q2-1"})` 1971 display: flex; 1972 align-items: center; 1973 justify-content: center; 1974 padding: 2rem; 1975 font-size: 0.8rem; 1976 font-weight: 600; 1977 color: ${Pe}; 1978`,O_e=p.div.withConfig({displayName:"PlanConfiguratorOverlay__Footer",componentId:"sc-10xz2q2-2"})` 1979 display: flex; 1980 align-items: center; 1981 justify-content: flex-end; 1982 padding: 0.65rem 1.25rem; 1983 border-top: 1px solid ${Pe}20; 1984`,D_e=p(Dn).withConfig({displayName:"PlanConfiguratorOverlay__PlanLink",componentId:"sc-10xz2q2-3"})` 1985 display: inline-flex; 1986 align-items: center; 1987 gap: 0.3rem; 1988 font-size: 0.7rem; 1989 font-weight: 650; 1990 color: ${z}; 1991 text-decoration: none; 1992 &:hover { color: ${ot}; text-decoration: underline; } 1993`;function ec({isOpen:e,orgId:n,onClose:i,onSaved:r}){const{user:o,refreshUser:s}=yn(),{showToast:a}=Uo(),c=l.useMemo(()=>o?.organizations?.find(Q=>Q.id===n)||null,[n,o?.organizations]),u=String(c?.role||"").toLowerCase()==="owner",m=!!c?.partner_managed,h=String(c?.partner?.name||"").trim(),g=String(c?.partner?.return_url||"").trim(),[x,y]=l.useState([]),[w,j]=l.useState(null),[v,_]=l.useState(null),[$,k]=l.useState(!0),[P,S]=l.useState(null),[I,A]=l.useState(!1),[E,B]=l.useState(!1),T=l.useCallback(async()=>{try{const[Q,K]=await Promise.all([ue(`/api/v1/organizations/${n}/billing`,{method:"GET"}),ue(`/api/v1/organizations/${n}/billing/usage_limits`,{method:"GET"})]),G=await Q.json().catch(()=>({}));if(!Q.ok)throw new Error(G?.error||"Failed to load billing");y(G?.billing?.plans||[]),j(G?.billing?.subscription||null);const L=await K.json().catch(()=>({}));if(K.ok){const q=L?.usage_limits?.usage?.credits;if(q){const W=q.credits_total??0,oe=q.credits_used??0;_(Math.max(0,W-oe))}}S(null)}catch(Q){S(Q instanceof Error?Q.message:"Failed to load billing data")}finally{k(!1)}},[n]);l.useEffect(()=>{e&&T()},[e,T]);const M=w?.plan?.plan_family||"grow",R=M==="core",F=!!w?.billing_exempt,Y=l.useCallback(()=>{A(!1),T(),s().catch(()=>{}),r?.()},[T,s,r]),H=l.useCallback(()=>{I?B(!0):i()},[I,i]),U=l.useCallback(()=>{B(!1),A(!1),i()},[i]);let X;return u?m?X=t.jsxs(dw,{style:{color:z,flexDirection:"column",gap:"0.5rem",textAlign:"center"},children:[t.jsx("span",{children:"Your plan is managed by your partner."}),g?t.jsxs("a",{href:g,target:"_blank",rel:"noreferrer",style:{color:ot,textDecoration:"underline",fontSize:"0.75rem"},children:["Go to ",h||"your partner"," to manage your plan"]}):null]}):$?X=t.jsx(dw,{children:t.jsx(R_e,{size:20})}):P?X=t.jsx(dw,{style:{color:oi},children:P}):w?X=t.jsxs(t.Fragment,{children:[t.jsx(mie,{plans:x,subscription:w,orgId:n,isCore:R,currentPlanFamily:M,billingLocked:F,onSaved:Y,onDirtyChange:A,showToast:a,creditsAvailable:v}),t.jsx(O_e,{children:t.jsxs(D_e,{to:`/workspaces/${n}/settings/plan`,onClick:()=>i(),children:["Go to full plan settings ",t.jsx(as,{size:11})]})})]}):X=t.jsx(dw,{children:"No active subscription found."}):X=t.jsx(dw,{style:{color:z},children:"Only workspace owners can manage the plan configuration."}),t.jsxs(t.Fragment,{children:[t.jsx(Hn,{isOpen:e,onClose:H,title:"Plan Configuration",description:"Manage LLMs, prompt packs, and your credit plan.",size:"md",minHeight:!$&&(!u||m||w&&R)?"0":void 0,children:X}),t.jsx(Hn,{isOpen:E,onClose:()=>B(!1),title:"Unsaved changes",size:"sm",minHeight:"0",closeOnOverlayClick:!1,footer:t.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.5rem"},children:[t.jsx(he,{type:"button",size:"sm",variant:"outline",onClick:()=>B(!1),children:"Stay"}),t.jsx(he,{type:"button",size:"sm",variant:"danger",onClick:U,children:"Discard & close"})]}),children:t.jsx("div",{style:{fontSize:"0.85rem",fontWeight:600,color:z,lineHeight:1.5},children:"You have unsaved changes to your plan configuration. If you close now, your changes will be lost."})})]})}const L_e=p.div.withConfig({displayName:"LimitReachedOverlay__Body",componentId:"sc-1feivmr-0"})` 1994 display: flex; 1995 flex-direction: column; 1996 align-items: center; 1997 text-align: center; 1998 gap: 1rem; 1999 padding: 0.5rem 0; 2000`,B_e=p.div.withConfig({displayName:"LimitReachedOverlay__IconWrap",componentId:"sc-1feivmr-1"})` 2001 width: 48px; 2002 height: 48px; 2003 border-radius: 50%; 2004 background: ${cn}; 2005 display: flex; 2006 align-items: center; 2007 justify-content: center; 2008 color: ${Ut}; 2009`,F_e=p.div.withConfig({displayName:"LimitReachedOverlay__Title",componentId:"sc-1feivmr-2"})` 2010 font-size: 1.05rem; 2011 font-weight: 800; 2012 color: ${O}; 2013 line-height: 1.3; 2014`,W_e=p.div.withConfig({displayName:"LimitReachedOverlay__Message",componentId:"sc-1feivmr-3"})` 2015 font-size: 0.85rem; 2016 font-weight: 600; 2017 color: ${z}; 2018 line-height: 1.5; 2019 max-width: 26rem; 2020`,U_e=p.div.withConfig({displayName:"LimitReachedOverlay__UsageBadge",componentId:"sc-1feivmr-4"})` 2021 display: inline-flex; 2022 align-items: center; 2023 gap: 0.4rem; 2024 font-size: 0.78rem; 2025 font-weight: 750; 2026 color: ${O}; 2027 background: ${cn}; 2028 border: 1px solid ${V}; 2029 border-radius: 0.5rem; 2030 padding: 0.35rem 0.75rem; 2031`,H_e=p.button.withConfig({displayName:"LimitReachedOverlay__InlineLink",componentId:"sc-1feivmr-5"})` 2032 background: none; 2033 border: none; 2034 padding: 0; 2035 font: inherit; 2036 font-weight: 800; 2037 color: ${ot}; 2038 cursor: pointer; 2039 text-decoration: underline; 2040 2041 &:hover { 2042 opacity: 0.8; 2043 } 2044`,q_e=p.div.withConfig({displayName:"LimitReachedOverlay__OwnerHint",componentId:"sc-1feivmr-6"})` 2045 font-size: 0.78rem; 2046 font-weight: 650; 2047 color: ${Pe}; 2048 line-height: 1.45; 2049 max-width: 22rem; 2050`,G_e=p.div.withConfig({displayName:"LimitReachedOverlay__FooterRow",componentId:"sc-1feivmr-7"})` 2051 display: flex; 2052 justify-content: flex-end; 2053 gap: 0.5rem; 2054`;function l1({isOpen:e,onClose:n,title:i,message:r,limitName:o,limit:s,used:a,isOwner:c,partnerManaged:u,workspaceId:m}){const[h,g]=l.useState(!1),x=i||"Limit reached",y=r||(u?"Your workspace has run out of credits. Contact your partner to increase your plan.":o?`You've reached the ${o} limit for your current plan.`:"You've reached a plan limit."),w=()=>{n(),g(!0)};return t.jsxs(t.Fragment,{children:[t.jsx(Hn,{isOpen:e,onClose:n,size:"sm",minHeight:"0",footer
2054:t.jsxs(G_e,{children:[t.jsx(he,{type:"button",size:"sm",variant:"outline",onClick:n,children:"Dismiss"}),!u&&c&&t.jsxs(he,{type:"button",size:"sm",onClick:w,children:[t.jsx(Bc,{size:14,style:{marginRight:4}})," Manage Plan"]})]}),children:t.jsxs(L_e,{children:[t.jsx(B_e,{children:t.jsx(ei,{size:22})}),t.jsx(F_e,{children:x}),t.jsxs(W_e,{children:[y,!u&&c?t.jsxs(t.Fragment,{children:[" You can also ",t.jsx(H_e,{type:"button",onClick:w,children:"upgrade your plan"})," to increase limits."]}):u?null:t.jsx(t.Fragment,{children:" Ask your workspace owner to upgrade the plan."})]}),typeof s=="number"&&typeof a=="number"&&t.jsx(U_e,{children:o==="credits"?t.jsxs(t.Fragment,{children:[t.jsxs("span",{style:{color:ot},children:[a," needed"]}),t.jsx("span",{style:{color:Pe},children:"â¢"}),t.jsxs("span",{children:[s," remaining"]})]}):t.jsxs(t.Fragment,{children:[t.jsx("span",{style:{color:ot},children:a}),t.jsx("span",{style:{color:Pe},children:"/"}),t.jsx("span",{children:s}),o?t.jsx("span",{style:{color:Pe,fontWeight:600},children:o}):null]})}),u?t.jsx(q_e,{children:"This workspace is managed by your partner. Contact them to upgrade your plan or add more credits."}):null]})}),t.jsx(ec,{isOpen:h,orgId:Number(m),onClose:()=>g(!1)})]})}function qs(){const e=new Date,n=e.getFullYear(),i=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return`${n}-${i}-${r}`}function hl(e,n){const[i,r,o]=e.split("-").map(Number),s=new Date(i,(r||1)-1,(o||1)+n),a=s.getFullYear(),c=String(s.getMonth()+1).padStart(2,"0"),u=String(s.getDate()).padStart(2,"0");return`${a}-${c}-${u}`}const V_e=p.div.withConfig({displayName:"DateRangeSelector__Wrap",componentId:"sc-l58wgh-0"})` 2055 position: relative; 2056 display: inline-flex; 2057`,K_e=p(he).withConfig({displayName:"DateRangeSelector__TriggerButton",componentId:"sc-l58wgh-1"})` 2058 /* Mobile: icon-only trigger should shrink to a compact square (no forced width). */ 2059 @media (max-width: 640px) { 2060 padding: 0 0.5rem; 2061 } 2062`,Y_e=p.span.withConfig({displayName:"DateRangeSelector__TriggerLabel",componentId:"sc-l58wgh-2"})` 2063 overflow: hidden; 2064 text-overflow: ellipsis; 2065 white-space: nowrap; 2066 2067 @media (max-width: 640px) { 2068 display: none; 2069 } 2070`,X_e=p.div.withConfig({displayName:"DateRangeSelector__Popover",componentId:"sc-l58wgh-3"})` 2071 position: fixed; 2072 left: ${e=>e.$left}px; 2073 top: ${e=>e.$top}px; 2074 width: min(460px, calc(100vw - 2rem)); 2075 background: ${Z}; 2076 border: 1px solid ${V}; 2077 border-radius: 0.875rem; 2078 box-shadow: 0 18px 40px rgba(17, 24, 39, 0.14); 2079 padding: 0.75rem; 2080 z-index: 2000; 2081 display: ${e=>e.$open?"block":"none"}; 2082`,Q_e=p.div.withConfig({displayName:"DateRangeSelector__Title",componentId:"sc-l58wgh-4"})` 2083 font-size: 0.85rem; 2084 font-weight: 900; 2085 color: ${O}; 2086`,Z_e=p.div.withConfig({displayName:"DateRangeSelector__Sub",componentId:"sc-l58wgh-5"})` 2087 margin-top: 0.15rem; 2088 font-size: 0.75rem; 2089 font-weight: 700; 2090 color: ${z}; 2091`,tz=p.div.withConfig({displayName:"DateRangeSelector__Divider",componentId:"sc-l58wgh-6"})` 2092 height: 1px; 2093 background: ${$e}; 2094 margin: 0.65rem 0; 2095`,bB=p.div.withConfig({displayName:"DateRangeSelector__PresetsRow",componentId:"sc-l58wgh-7"})` 2096 display: flex; 2097 gap: 0.5rem; 2098 flex-wrap: nowrap; 2099 2100 /* Very small screens: allow wrapping so buttons don't overflow. */ 2101 @media (max-width: 420px) { 2102 flex-wrap: wrap; 2103 } 2104`,J_e=p.div.withConfig({displayName:"DateRangeSelector__PresetsTopRow",componentId:"sc-l58wgh-8"})` 2105 display: flex; 2106 align-items: center; 2107 justify-content: space-between; 2108 gap: 0.75rem; 2109`,fk=p.button.withConfig({displayName:"DateRangeSelector__PresetBtn",componentId:"sc-l58wgh-9"})` 2110 border: 1px solid ${Rt}; 2111 background: ${Z}; 2112 color: ${O}; 2113 font-weight: 850; 2114 font-size: 0.75rem; 2115 padding: 0.35rem 0.55rem; 2116 border-radius: 0.375rem; 2117 cursor: pointer; 2118 2119 &:hover { 2120 background: ${$e}; 2121 } 2122`,eCe=p.div.withConfig({displayName:"DateRangeSelector__MonthHeader",componentId:"sc-l58wgh-10"})` 2123 display: flex; 2124 align-items: center; 2125 justify-content: space-between; 2126 gap: 0.5rem; 2127`,tCe=p.div.withConfig({displayName:"DateRangeSelector__MonthLabel",componentId:"sc-l58wgh-11"})` 2128 font-size: 0.85rem; 2129 font-weight: 950; 2130 color: ${O}; 2131`,vB=p.button.withConfig({displayName:"DateRangeSelector__NavBtn",componentId:"sc-l58wgh-12"})` 2132 width: 2rem; 2133 height: 2rem; 2134 border-radius: 0.375rem; 2135 border: 1px solid ${V}; 2136 background: ${Z}; 2137 color: ${z}; 2138 display: inline-flex; 2139 align-items: center; 2140 justify-content: center; 2141 cursor: ${e=>e.$disabled?"not-allowed":"pointer"}; 2142 opacity: ${e=>e.$disabled?.5:1}; 2143 2144 &:hover { 2145 background: ${e=>e.$disabled?Z:$e}; 2146 } 2147`,nCe=p.div.withConfig({displayName:"DateRangeSelector__WeekdaysRow",componentId:"sc-l58wgh-13"})` 2148 margin-top: 0.6rem; 2149 display: grid; 2150 grid-template-columns: repeat(7, minmax(0, 1fr)); 2151 gap: 0.35rem; 2152`,iCe=p.div.withConfig({displayName:"DateRangeSelector__Weekday",componentId:"sc-l58wgh-14"})` 2153 font-size: 0.6875rem; 2154 font-weight: 900; 2155 color: ${z}; 2156 text-transform: uppercase; 2157 letter-spacing: 0.04em; 2158 text-align: center; 2159`,rCe=p.div.withConfig({displayName:"DateRangeSelector__DaysGrid",componentId:"sc-l58wgh-15"})` 2160 margin-top: 0.4rem; 2161 display: grid; 2162 grid-template-columns: repeat(7, minmax(0, 1fr)); 2163 gap: 0.35rem; 2164`,oCe=p.button.withConfig({displayName:"DateRangeSelector__DayBtn",componentId:"sc-l58wgh-16"})` 2165 width: 100%; 2166 height: 2rem; 2167 border-radius: 0.375rem; 2168 border: 1px solid ${V}; 2169 background: ${e=>e.$inRange?$e:Z}; 2170 color: ${e=>e.$muted?z:O}; 2171 font-weight: 850; 2172 font-size: 0.8125rem; 2173 cursor: ${e=>e.$disabled?"not-allowed":"pointer"}; 2174 opacity: ${e=>e.$disabled?.35:1}; 2175 2176 ${e=>e.$isStart||e.$isEnd?` 2177 background: ${O}; 2178 border-color: ${O}; 2179 color: ${Z}; 2180 `:""} 2181 2182 &:hover { 2183 background: ${e=>e.$disabled?Z:$e}; 2184 } 2185`,sCe=p.div.withConfig({displayName:"DateRangeSelector__Actions",componentId:"sc-l58wgh-17"})` 2186 margin-top: 0.75rem; 2187 display: flex; 2188 justify-content: flex-end; 2189 gap: 0.5rem; 2190`;function nz(e){const n=new Date(`${e}T00:00:00`);return Number.isNaN(n.getTime())?e:new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",year:"numeric"}).format(n)}function qj(e){const n=e.getFullYear(),i=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return`${n}-${i}-${r}`}function iz(e,n){const[i,r,o]=e.split("-").map(x=>Number(x)),s=i,a=(r||1)-1,c=o||1,u=new Date(s,a+n,1),m=new Date(u.getFullYear(),u.getMonth()+1,0).getDate(),h=Math.min(c,m),g=new Date(u.getFullYear(),u.getMonth(),h);return qj(g)}function gk(e){const[n,i,r]=e.split("-").map(o=>Number(o));
2190return new Date(n,(i||1)-1,r||1)}function yk(e){return new Date(e.getFullYear(),e.getMonth(),1)}function xk(e,n){return new Date(e.getFullYear(),e.getMonth()+n,1)}function aCe(e){return new Date(e.getFullYear(),e.getMonth()+1,0).getDate()}function rh({value:e,onChange:n,disabled:i,presets:r,singleDay:o,historyMonthsLimit:s,historyLimitMessage:a}){const[c,u]=l.useState(!1),m=l.useRef(null),h=l.useRef(null),[g,x]=l.useState({left:0,top:0}),y=l.useMemo(()=>qs(),[]),w=l.useMemo(()=>{const q=s==null?null:Number(s);return!q||!Number.isFinite(q)||q<=0?null:iz(y,-q)},[s,y]);l.useEffect(()=>{if(!w)return;const q=e.start,W=e.end;if(!(!q||!W)){if(W<w){if(q===w&&W===w)return;n({start:w,end:w});return}if(q<w){if(q===w)return;n({start:w,end:W})}}},[w,n,e.end,e.start]);const[j,v]=l.useState(e.start),[_,$]=l.useState(e.end),[k,P]=l.useState(!1),[S,I]=l.useState(!1),[A,E]=l.useState(()=>yk(gk(e.end||qs())));l.useEffect(()=>{if(!c)return;const q=()=>{const de=h.current;if(!de)return;const le=de.getBoundingClientRect(),me=8,ee=le.left,ne=le.bottom+me,Ae=Math.max(me,window.innerWidth-460-me),_e=Math.min(Math.max(ee,me),Ae),we=m.current?.getBoundingClientRect().height||0,Ke=we>50?we:720,ce=Math.max(me,window.innerHeight-Ke-me),ie=window.innerHeight-le.bottom-me,Re=le.top-me;let Be=ne;ie<Ke&&Re>Ke&&(Be=le.top-me-Ke),Be=Math.min(Math.max(Be,me),ce),x({left:_e,top:Be})};q();const W=window.requestAnimationFrame(q),oe=window.requestAnimationFrame(q),se=window.setTimeout(q,40);return window.addEventListener("resize",q),window.addEventListener("scroll",q,!0),v(e.start),$(e.end),P(!1),I(!1),E(yk(gk(e.end||qs()))),()=>{window.cancelAnimationFrame(W),window.cancelAnimationFrame(oe),window.clearTimeout(se),window.removeEventListener("resize",q),window.removeEventListener("scroll",q,!0)}},[c,e.end,e.start]),l.useEffect(()=>{if(!c)return;const q=oe=>{const se=oe.target;m.current?.contains(se)||h.current?.contains(se)||u(!1)},W=oe=>
2190{oe.key==="Escape"&&u(!1)};return document.addEventListener("mousedown",q),document.addEventListener("keydown",W),()=>{document.removeEventListener("mousedown",q),document.removeEventListener("keydown",W)}},[c]);const B=l.useMemo(()=>!e.start||!e.end?o?"Select date":"Select dates":o||e.start===e.end?nz(e.start):`${nz(e.start)} â ${nz(e.end)}`,[o,e.end,e.start]),T=l.useMemo(()=>{if(!j||!_)return"Select a start and end date.";if(j>_)return"Start date must be before end date.";if(_>y)return"End date cannot be in the future.";if(w&&(j<w||_<w))return"Date range is outside your planâs history window.";const q=iz(j,6);return _>q?"Date range cannot exceed 6 months.":null},[_,j,y,w]),M=()=>{T||(n({start:j,end:_}),u(!1))},R=q=>{const W=y,oe=hl(W,-(q-1)),se=w&&oe<w?w:oe;v(se),$(W),n({start:se,end:W}),u(!1)},F=()=>{const q=y;v(q),$(q),n({start:q,end:q}),u(!1)},Y=l.useMemo(()=>new Intl.DateTimeFormat(void 0,{month:"long",year:"numeric"}).format(A),[A]),H=l.useMemo(()=>{const q=xk(A,1);return qj(q)<=y},[y,A]),U=l.useMemo(()=>{if(!w)return!0;const q=xk(A,-1),W=yk(gk(w));return q>=W},[w,A]),X=l.useMemo(()=>{if(!j)return y;const q=iz(j,6);return q<y?q:y},[j,y]),Q=l.useMemo(()=>{const q=yk(A),W=q.getDay(),oe=aCe(A),se=[];for(let de=0;de<W;de++){const le=new Date(q);le.setDate(le.getDate()-(W-de));const me=qj(le),ee=me>y||(w?me<w:!1)||(k&&j?me>X:!1);se.push({iso:me,day:le.getDate(),inMonth:!1,disabled:ee})}for(let de=1;de<=oe;de++){const le=new Date(q.getFullYear(),q.getMonth(),de),me=qj(le),ee=me>y||(w?me<w:!1)||(k&&j?me>X:!1);se.push({iso:me,day:de,inMonth:!0,disabled:ee})}for(;se.length<42;){const de=gk(se[se.length-1].iso);de.setDate(de.getDate()+1);const le=qj(de),me=le>y||(w?le<w:!1)||(k&&j?le>X:!1);se.push({iso:le,day:de.getDate(),inMonth:!1,disabled:me})}return se},[j,y,X,w,k,A]),K=(q,W)=>{if(!W){if(o){v(q),$(q),n({start:q,end:q}),u(!1);return}if(!j||!k){v(q),$(q),P(!0);return}if(q<j){v(q),$(q),P(!0);return}$(q),P(!1)}},G=q=>!j||!_?!1:q>=j&&q<=_,L=l.useMemo(()=>{const W=(Array.isArray(r)?r:[7,30,90]).map(de=>Number(de)).filter(de=>Number.isFinite(de)&&de>0),oe=new Set,se=[];return W.forEach(de=>{oe.has(de)||(oe.add(de),se.push(de))}),se.length>0?se:[7,30,90]},[r]);return t.jsxs(V_e,{children:[t.jsx("span",{ref:h,children:t.jsx(K_e,{type:"button",size:"sm",variant:"outline",disabled:i,onClick:()=>u(q=>!q),leftIcon:t.jsx(a1,{size:16}),"aria-label":B,children:t.jsx(Y_e,{children:B})})}),jr.createPortal(t.jsxs(X_e,{ref:m,$open:c,$left:g.left,$top:g.top,role:"dialog","aria-label":o?"Select date":"Select date range",children:[t.jsx(Q_e,{children:o?"Select a day":"Date range"}),!o&&t.jsxs(Z_e,{children:["Select a range, up to six months.",w?t.jsxs(t.Fragment,{children:[" ",t.jsxs("span",{style:{color:"var(--color-red-600)",fontWeight:850},children:["Limited to your planâs last ",Number(s)," months."]}),a?t.jsx("span",{style:{marginLeft:6},children:a}):null]}):null]}),t.jsx(tz,{}),o?t.jsxs(bB,{children:[t.jsx(fk,{type:"button",onClick:F,children:"Today"}),t.jsx(fk,{type:"button",onClick:()=>{const q=hl(qs(),-1);n({start:q,end:q}),u(!1)},children:"Yesterday"})]}):t.jsxs(t.Fragment,{children:[t.jsxs(J_e,{children:[t.jsxs(bB,{children:[t.jsx(fk,{type:"button",onClick:F,children:"Today"}),L.map(q=>t.jsxs(fk,{type:"button",onClick:()=>R(q),children:["Last ",q]},q))]}),t.jsx(he,{type:"button",size:"sm",variant:"outline",onClick:()=>I(q=>!q),children:S?"Hide range":"Select range"})]}),t.jsx(tz,{}),t.jsxs(sCe,{children:[t.jsx(he,{type:"button",size:"sm",variant:"ghost",onClick:()=>u(!1),children:"Cancel"}),t.jsx(he,{type:"button",size:"sm",variant:"outline",disabled:!!T,onClick:M,children:"Apply"})]}),T?t.jsx("div",{style:{marginTop:8,fontSize:12,fontWeight:800,color:"var(--color-red-600)"},children:T}):null]}),o||S?t.jsxs(t.Fragment,{children:[t.jsx(tz,{}),t.jsxs(eCe,{children:[t.jsx(vB,{type:"button",onClick:()=>{U&&E(q=>xk(q,-1))},"aria-label":"Previous month",$disabled:!U,children:t.jsx(Bd,{size:16})}),t.jsx(tCe,{children:Y}),t.jsx(vB,{type:"button",onClick:()=>{H&&E(q=>xk(q,1))},"aria-label":"Next month",$disabled:!H,children:t.jsx(Gi,{size:16})})]}),t.jsx(nCe,{children:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"].map(q=>t.jsx(iCe,{children:q},q))}),t.jsx(rCe,{children:Q.map(q=>t.jsx(oCe,{type:"button",onClick:()=>K(q.iso,q.disabled),$muted:!q.inMonth,$disabled:q.disabled,$inRange:G(q.iso),$isStart:j===q.iso,$isEnd:_===q.iso,"aria-label":q.iso,children:q.day},q.iso))})]}):null]}),document.body)]})}function lCe(e){return/^\d{4}-\d{2}-\d{2}$/.test(e)}function cCe(e,n){if(e==null)return null;if(e instanceof Date)return Number.isNaN(e.getTime())?null:e;if(typeof e=="number"){const o=new Date(e);return Number.isNaN(o.getTime())?null:o}const i=String(e).trim();if(!i)return null;if(lCe(i)){const o=new Date(n==="utc"?`${i}T00:00:00Z`:`${i}T00:00:00`);return Number.isNaN(o.getTime())?null:o}const r=new Date(i);return Number.isNaN(r.getTime())?null:r}function j_(e){const{value:n,format:i="date",showTimeZone:r=!1,timeZoneMode:o="viewer",locale:s,options:a,placeholder:c="â"}=e||{},u=cCe(n,o);if(!u)return c;const m=i==="time"?{hour:"2-digit",minute:"2-digit"}:i==="datetime"?{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"}:{month:"short",day:"numeric",year:"numeric"},h={};o==="utc"&&(h.timeZone="UTC"),r&&(h.timeZoneName="short");try{const g=a?{...h,...a}:{...m,...h};return new Intl.DateTimeFormat(s,g).format(u)}catch{return c}}function rr({value:e,format:n="date",showTimeZone:i=!1,timeZoneMode:r="viewer",locale:o,options:s,placeholder:a="â",as:c="span",className:u,style:m,color:h,fontSize:g,fontWeight:x}){const y=l.useMemo(()=>j_({value:e,format:n,showTimeZone:i,timeZoneMode:r,locale:o,options:s,placeholder:a}
vendor: 4,543 bytes, line 2190
2190),[e,n,i,r,o,s,a]),w=c,j={...m||{},...h?{color:h}:null,...g?{fontSize:g}:null,...x?{fontWeight:x}:null};return t.jsx(w,{className:u,style:j,children:y})}function dCe(e,n){const i={};return(e[e.length-1]===""?[...e,""]:e).join((i.padRight?" ":"")+","+(i.padLeft===!1?"":" ")).trim()}const uCe=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,pCe=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,mCe={};function wB(e,n){return(mCe.jsx?pCe:uCe).test(e)}const hCe=/[ \t\n\f\r]/g;function fCe(e){return typeof e=="object"?e.type==="text"?jB(e.value):!1:jB(e)}function jB(e){return e.replace(hCe,"")===""}class tC{constructor(n,i,r){this.normal=i,this.property=n,r&&(this.space=r)}}tC.prototype.normal={};tC.prototype.property={};tC.prototype.space=void 0;function hie(e,n){const i={},r={};for(const o of e)Object.assign(i,o.property),Object.assign(r,o.normal);return new tC(i,r,n)}function KE(e){return e.toLowerCase()}let tc=class{constructor(n,i){this.attribute=i,this.property=n}};tc.prototype.attribute="";tc.prototype.booleanish=!1;tc.prototype.boolean=!1;tc.prototype.commaOrSpaceSeparated=!1;tc.prototype.commaSeparated=!1;tc.prototype.defined=!1;tc.prototype.mustUseProperty=!1;tc.prototype.number=!1;tc.prototype.overloadedBoolean=!1;tc.prototype.property="";tc.prototype.spaceSeparated=!1;tc.prototype.space=void 0;let gCe=0;const ci=Ly(),Jo=Ly(),YE=Ly(),sn=Ly(),Br=Ly(),jb=Ly(),Ic=Ly();function Ly(){return 2**++gCe}const XE=Object.freeze(Object.defineProperty({__proto__:null,boolean:ci,booleanish:Jo,commaOrSpaceSeparated:Ic,commaSeparated:jb,number:sn,overloadedBoolean:YE,spaceSeparated:Br},Symbol.toStringTag,{value:"Module"})),rz=Object.keys(XE);class mM extends tc{constructor(n,i,r,o){let s=-1;if(super(n,i),_B(this,"space",o),typeof r=="number")for(;++s<rz.length;){const a=rz[s];_B(this,rz[s],(r&XE[a])===XE[a])}}}mM.prototype.defined=!0;function _B(e,n,i){i&&(e[n]=i)}function c1(e){const n={},i={};for(const[r,o]of Object.entries(e.properties)){const s=new mM(r,e.transform(e.attributes||{},r),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),n[r]=s,i[KE(r)]=r,i[KE(s.attribute)]=r}return new tC(n,i,e.space)}const fie=c1({properties:{ariaActiveDescendant:null,ariaAtomic:Jo,ariaAutoComplete:null,ariaBusy:Jo,ariaChecked:Jo,ariaColCount:sn,ariaColIndex:sn,ariaColSpan:sn,ariaControls:Br,ariaCurrent:null,ariaDescribedBy:Br,ariaDetails:null,ariaDisabled:Jo,ariaDropEffect:Br,ariaErrorMessage:null,ariaExpanded:Jo,ariaFlowTo:Br,ariaGrabbed:Jo,ariaHasPopup:null,ariaHidden:Jo,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Br,ariaLevel:sn,ariaLive:null,ariaModal:Jo,ariaMultiLine:Jo,ariaMultiSelectable:Jo,ariaOrientation:null,ariaOwns:Br,ariaPlaceholder:null,ariaPosInSet:sn,ariaPressed:Jo,ariaReadOnly:Jo,ariaRelevant:null,ariaRequired:Jo,ariaRoleDescription:Br,ariaRowCount:sn,ariaRowIndex:sn,ariaRowSpan:sn,ariaSelected:Jo,ariaSetSize:sn,ariaSort:null,ariaValueMax:sn,ariaValueMin:sn,ariaValueNow:sn,ariaValueText:null,role:null},transform(e,n){return n==="role"?n:"aria-"+n.slice(4).toLowerCase()}});function gie(e,n){return n in e?e[n]:n}function yie(e,n){return gie(e,n.toLowerCase())}const yCe=c1({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:jb,acceptCharset:Br,accessKey:Br,action:null,allow:null,allowFullScreen:ci,allowPaymentRequest:ci,allowUserMedia:ci,alt:null,as:null,async:ci,autoCapitalize:null,autoComplete:Br,autoFocus:ci,autoPlay:ci,blocking:Br,capture:null,charSet:null,checked:ci,cite:null,className:Br,cols:sn,colSpan:null,content:null,contentEditable:Jo,controls:ci,controlsList:Br,coords:sn|jb,crossOrigin:null,data:null,dateTime:null,decoding:null,default:ci,defer:ci,dir:null,dirName:null,disabled:ci,download:YE,draggable:Jo,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:ci,formTarget:null,headers:Br,height:sn,hidden:YE,high:sn,href:null,hrefLang:null,htmlFor:Br,httpEquiv:Br,id:null,imageSizes:null,imageSrcSet:null,inert:ci,inputMode:null,integrity:null,is:null,isMap:ci,itemId:null,itemProp:Br,itemRef:Br,itemScope:ci,itemType:Br,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:ci,low:sn,manifest:null,max:null,maxLength:sn,media:null,method:null,min:null,minLength:sn,multiple:ci,muted:ci,name:null,nonce:null,noModule:ci,noValidate:ci,onAbort:null,onAfterPrint:null,onAuxCl
2190ick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:ci,optimum:sn,pattern:null,ping:Br,placeholder:null,playsInline:ci,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:ci,referrerPolicy:null,rel:Br,required:ci,reversed:ci,rows:sn,rowSpan:sn,sandbox:Br,scope:null,scoped:ci,seamless:ci,selected:ci,shadowRootClonable:ci,shadowRootDelegatesFocus:ci,shadowRootMode:null,shape:null,size:sn,sizes:null,slot:null,span:sn,spellCheck:Jo,src:null,srcDoc:null,srcLang:null,srcSet:null,start:sn,step:null,style:null,tabIndex:sn,target:null,title:null,translate:null,type:null,typeMustMatch:ci,useMap:null,value:Jo,width:sn,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Br,axis:null,background:null,bgColor:null,border:sn,borderColor:null,bottomMargin:sn,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:ci,declare:ci,event:null,face:null,frame:null,frameBorder:null,hSpace:sn,leftMargin:sn,link:null,longDesc:null,lowSrc:null,marginHeight:sn,marginWidth:sn,noResize:ci,noHref:ci,noShade:ci,noWrap:ci,object:null,profile:null,prompt:null,rev:null,rightMargin:sn,rules:null,scheme:null,scrolling:Jo,standby:null,summary:null,text:null,topMargin:sn,valueType:null,version:null,vAlign:null,vLink:null,vSpace:sn,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:ci,disableRemotePlayback:ci,prefix:null,property:null,results:sn,security:null,unselectable:null},space:"html",transform:yie}),xCe=c1({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",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",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav
2190-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",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",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",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",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Ic,accentHeight:sn,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:sn,amplitude:sn,arabicForm:null,ascent:sn,attributeName:null,attributeType:null,azimuth:sn,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:sn,by:null,calcMode:null,capHeight:sn,className:Br,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:sn,diffuseConstant:sn,direction:null,display:null,dur:null,divisor:sn,dominantBaseline:null,download:ci,dx:null,dy:null,edgeMode:null,editable:null,elevation:sn,enableBackground:null,end:null,event:null,exponent:sn,externalResourcesRequired:null,fill:null,fillOpacity:sn,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:jb,g2:jb,glyphName:jb,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:sn,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:sn,horizOriginX:sn,horizOriginY:sn,id:null,ideographic:sn,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:sn,k:sn,k1:sn,k2:sn,k3:sn,k4:sn,kernelMatrix:Ic,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:sn,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:sn,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,on
vendor: 4,983 bytes, lines 2190-2191
2190Zoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:sn,overlineThickness:sn,paintOrder:null,panose1:null,path:null,pathLength:sn,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Br,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:sn,pointsAtY:sn,pointsAtZ:sn,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Ic,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Ic,rev:Ic,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Ic,requiredFeatures:Ic,requiredFonts:Ic,requiredFormats:Ic,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:sn,specularExponent:sn,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:sn,strikethroughThickness:sn,string:null,stroke:null,strokeDashArray:Ic,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:sn,strokeOpacity:sn,strokeWidth:null,style:null,surfaceScale:sn,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Ic,tabIndex:sn,tableValues:null,target:null,targetX:sn,targetY:sn,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Ic,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:sn,underlineThickness:sn,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:sn,values:null,vAlphabetic:sn,vMathematical:sn,vectorEffect:null,vHanging:sn,vIdeographic:sn,version:null,vertAdvY:sn,vertOriginX:sn,vertOriginY:sn,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:sn,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:gie}),xie=c1({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,n){return"xlink:"+n.slice(5).toLowerCase()}}),bie=c1({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:yie}),vie=c1({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,n){return"xml:"+n.slice(3).toLowerCase()}}),bCe={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},vCe=/[A-Z]/g,CB=/-[a-z]/g,wCe=/^data[-\w.:]+$/i;function jCe(e,n){const i=KE(n);let r=n,o=tc;if(i in e.normal)return e.property[e.normal[i]];if(i.length>4&&i.slice(0,4)==="data"&&wCe.test(n)){if(n.charAt(4)==="-"){const s=n.slice(5).replace(CB,CCe);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=n.slice(4);if(!CB.test(s)){let a=s.replace(vCe,_Ce);a.charAt(0)!=="-"&&(a="-"+a),n="data"+a}}o=mM}return new o(r,n)}function _Ce(e){return"-"+e.toLowerCase()}function CCe(e){return e.charAt(1).toUpperCase()}const SCe=hie([fie,yCe,xie,bie,vie],"html"),hM=hie([fie,xCe,xie,bie,vie],"svg");function kCe(e){return e.join(" ").trim()}var ox={},oz,SB;function $Ce(){if(SB)return oz;SB=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,n=/\n/g,i=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,a=/^[;\s]*/,c=/^\s+|\s+$/g,u=` 2191`,m="/",h="*",g="",x="comment",y="declaration";function w(v,_){if(typeof v!="string")throw new TypeError("First argument must be a string");if(!v)return[];_=_||{};var $=1,k=1;function P(Y){var H=Y.match(n);H&&($+=H.length);var U=Y.lastIndexOf(u);k=~U?Y.length-U:k+Y.length}function S(){var Y={line:$,column:k};return function(H){return H.position=new I(Y),B(),H}}function I(Y){this.start=Y,this.end={line:$,column:k},this.source=_.source}I.prototype.content=v;function A(Y){var H=new Error(_.source+":"+$+":"+k+": "+Y);if(H.reason=Y,H.filename=_.source,H.line=$,H.column=k,H.source=v,!_.silent)throw H}function E(Y){var H=Y.exec(v);if(H){var U=H[0];return P(U),v=v.slice(U.length),H}}function B(){E(i)}function T(Y){var H;for(Y=Y||[];H=M();)H!==!1&&Y.push(H);return Y}function M(){var Y=S();if(!(m!=v.charAt(0)||h!=v.charAt(1))){for(var H=2;g!=v.charAt(H)&&(h!=v.charAt(H)||m!=v.charAt(H+1));)++H;if(H+=2,g===v.charAt(H-1))return A("End of comment missing");var U=v.slice(2,H-2);return k+=2,P(U),v=v.slice(H),k+=2,Y({type:x,comment:U})}}function R(){var Y=S(),H=E(r);
vendor: 4,160 bytes, line 2191
2191if(H){if(M(),!E(o))return A("property missing ':'");var U=E(s),X=Y({type:y,property:j(H[0].replace(e,g)),value:U?j(U[0].replace(e,g)):g});return E(a),X}}function F(){var Y=[];T(Y);for(var H;H=R();)H!==!1&&(Y.push(H),T(Y));return Y}return B(),F()}function j(v){return v?v.replace(c,g):g}return oz=w,oz}var kB;function ICe(){if(kB)return ox;kB=1;var e=ox&&ox.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(ox,"__esModule",{value:!0}),ox.default=i;const n=e($Ce());function i(r,o){let s=null;if(!r||typeof r!="string")return s;const a=(0,n.default)(r),c=typeof o=="function";return a.forEach(u=>{if(u.type!=="declaration")return;const{property:m,value:h}=u;c?o(m,h,u):h&&(s=s||{},s[m]=h)}),s}return ox}var uw={},$B;function PCe(){if($B)return uw;$B=1,Object.defineProperty(uw,"__esModule",{value:!0}),uw.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,i=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,o=/^-(ms)-/,s=function(m){return!m||i.test(m)||e.test(m)},a=function(m,h){return h.toUpperCase()},c=function(m,h){return"".concat(h,"-")},u=function(m,h){return h===void 0&&(h={}),s(m)?m:(m=m.toLowerCase(),h.reactCompat?m=m.replace(o,c):m=m.replace(r,c),m.replace(n,a))};return uw.camelCase=u,uw}var pw,IB;function ACe(){if(IB)return pw;IB=1;var e=pw&&pw.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},n=e(ICe()),i=PCe();function r(o,s){var a={};return!o||typeof o!="string"||(0,n.default)(o,function(c,u){c&&u&&(a[(0,i.camelCase)(c,s)]=u)}),a}return r.default=r,pw=r,pw}var NCe=ACe();const zCe=Tu(NCe),wie=jie("end"),fM=jie("start");function jie(e){return n;function n(i){const r=i&&i.position&&i.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function TCe(e){const n=fM(e),i=wie(e);if(n&&i)return{start:n,end:i}}function o_(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?PB(e.position):"start"in e||"end"in e?PB(e):"line"in e||"column"in e?QE(e):""}function QE(e){return AB(e&&e.line)+":"+AB(e&&e.column)}function PB(e){return QE(e&&e.start)+"-"+QE(e&&e.end)}function AB(e){return e&&typeof e=="number"?e:1}class Ua extends Error{constructor(n,i,r){super(),typeof i=="string"&&(r=i,i=void 0);let o="",s={},a=!1;if(i&&("line"in i&&"column"in i?s={place:i}:"start"in i&&"end"in i?s={place:i}:"type"in i?s={ancestors:[i],place:i.position}:s={...i}),typeof n=="string"?o=n:!s.cause&&n&&(a=!0,o=n.message,s.cause=n),!s.ruleId&&!s.source&&typeof r=="string"){const u=r.indexOf(":");u===-1?s.ruleId=r:(s.source=r.slice(0,u),s.ruleId=r.slice(u+1))}if(!s.place&&s.ancestors&&s.ancestors){const u=s.ancestors[s.ancestors.length-1];u&&(s.place=u.position)}const c=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=c?c.column:void 0,this.fatal=void 0,this.file="",this.message=o,this.line=c?c.line:void 0,this.name=o_(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=a&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Ua.prototype.file="";Ua.prototype.name="";Ua.prototype.reason="";Ua.prototype.message="";Ua.prototype.stack="";Ua.prototype.column=void 0;Ua.prototype.line=void 0;Ua.prototype.ancestors=void 0;Ua.prototype.cause=void 0;Ua.prototype.fatal=void 0;Ua.prototype.place=void 0;Ua.prototype.ruleId=void 0;Ua.prototype.source=void 0;const gM={}.hasOwnProperty,ECe=new Map,MCe=/[A-Z]/g,RCe=new Set(["table","tbody","thead","tfoot","tr"]),OCe=new Set(["td","th"]),_ie="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function DCe(e,n){if(!n||n.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const i=n.filePath||void 0;let r;if(n.development){if(typeof n.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=GCe(i,n.jsxDEV)}else{if(typeof n.jsx!="function")throw new TypeError("Expected `jsx` in production options");
vendor: 10,603 bytes, line 2191
2191if(typeof n.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=qCe(i,n.jsx,n.jsxs)}const o={Fragment:n.Fragment,ancestors:[],components:n.components||{},create:r,elementAttributeNameCase:n.elementAttributeNameCase||"react",evaluater:n.createEvaluater?n.createEvaluater():void 0,filePath:i,ignoreInvalidStyle:n.ignoreInvalidStyle||!1,passKeys:n.passKeys!==!1,passNode:n.passNode||!1,schema:n.space==="svg"?hM:SCe,stylePropertyNameCase:n.stylePropertyNameCase||"dom",tableCellAlignToStyle:n.tableCellAlignToStyle!==!1},s=Cie(o,e,void 0);return s&&typeof s!="string"?s:o.create(e,o.Fragment,{children:s||void 0},void 0)}function Cie(e,n,i){if(n.type==="element")return LCe(e,n,i);if(n.type==="mdxFlowExpression"||n.type==="mdxTextExpression")return BCe(e,n);if(n.type==="mdxJsxFlowElement"||n.type==="mdxJsxTextElement")return WCe(e,n,i);if(n.type==="mdxjsEsm")return FCe(e,n);if(n.type==="root")return UCe(e,n,i);if(n.type==="text")return HCe(e,n)}function LCe(e,n,i){const r=e.schema;let o=r;n.tagName.toLowerCase()==="svg"&&r.space==="html"&&(o=hM,e.schema=o),e.ancestors.push(n);const s=kie(e,n.tagName,!1),a=VCe(e,n);let c=xM(e,n);return RCe.has(n.tagName)&&(c=c.filter(function(u){return typeof u=="string"?!fCe(u):!0})),Sie(e,a,s,n),yM(a,c),e.ancestors.pop(),e.schema=r,e.create(n,s,a,i)}function BCe(e,n){if(n.data&&n.data.estree&&e.evaluater){const r=n.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}__(e,n.position)}function FCe(e,n){if(n.data&&n.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(n.data.estree);__(e,n.position)}function WCe(e,n,i){const r=e.schema;let o=r;n.name==="svg"&&r.space==="html"&&(o=hM,e.schema=o),e.ancestors.push(n);const s=n.name===null?e.Fragment:kie(e,n.name,!0),a=KCe(e,n),c=xM(e,n);return Sie(e,a,s,n),yM(a,c),e.ancestors.pop(),e.schema=r,e.create(n,s,a,i)}function UCe(e,n,i){const r={};return yM(r,xM(e,n)),e.create(n,e.Fragment,r,i)}function HCe(e,n){return n.value}function Sie(e,n,i,r){typeof i!="string"&&i!==e.Fragment&&e.passNode&&(n.node=r)}function yM(e,n){if(n.length>0){const i=n.length>1?n:n[0];i&&(e.children=i)}}function qCe(e,n,i){return r;function r(o,s,a,c){const m=Array.isArray(a.children)?i:n;return c?m(s,a,c):m(s,a)}}function GCe(e,n){return i;function i(r,o,s,a){const c=Array.isArray(s.children),u=fM(r);return n(o,s,a,c,{columnNumber:u?u.column-1:void 0,fileName:e,lineNumber:u?u.line:void 0},void 0)}}function VCe(e,n){const i={};let r,o;for(o in n.properties)if(o!=="children"&&gM.call(n.properties,o)){const s=YCe(e,o,n.properties[o]);if(s){const[a,c]=s;e.tableCellAlignToStyle&&a==="align"&&typeof c=="string"&&OCe.has(n.tagName)?r=c:i[a]=c}}if(r){const s=i.style||(i.style={});s[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return i}function KCe(e,n){const i={};for(const r of n.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const s=r.data.estree.body[0];s.type;const a=s.expression;a.type;const c=a.properties[0];c.type,Object.assign(i,e.evaluater.evaluateExpression(c.argument))}else __(e,n.position);else{const o=r.name;let s;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const c=r.value.data.estree.body[0];c.type,s=e.evaluater.evaluateExpression(c.expression)}else __(e,n.position);else s=r.value===null?!0:r.value;i[o]=s}return i}function xM(e,n){const i=[];let r=-1;const o=e.passKeys?new Map:ECe;for(;++r<n.children.length;){const s=n.children[r];let a;if(e.passKeys){const u=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(u){const m=o.get(u)||0;a=u+"-"+m,o.set(u,m+1)}}const c=Cie(e,s,a);c!==void 0&&i.push(c)}return i}function YCe(e,n,i){const r=jCe(e.schema,n);if(!(i==null||typeof i=="number"&&Number.isNaN(i))){if(Array.isArray(i)&&(i=r.commaSeparated?dCe(i):kCe(i)),r.property==="style"){let o=typeof i=="object"?i:XCe(e,String(i));return e.stylePropertyNameCase==="css"&&(o=QCe(o)),["style",o]}return[e.elementAttributeNameCase==="react"&&r.space?bCe[r.property]||r.property:r.attribute,i]}}function XCe(e,n){try{return zCe(n,{reactCompat:!0})}catch(i){if(e.ignoreInvalidStyle)return{};const r=i,o=new Ua("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw o.file=e.filePath||void 0,o.url=_ie+"#cannot-parse-style-attribute",o}}function kie(e,n,i){let r;if(!i)r={type:"Literal",value:n};else if(n.includes(".")){const o=n.split(".");let s=-1,a;for(;++s<o.length;){const c=wB(o[s])?{type:"Identifier",name:o[s]}:{type:"Literal",value:o[s]};a=a?{type:"MemberExpression",object:a,property:c,computed:!!(s&&c.type==="Literal"),optional:!1}:c}r=a}else r=wB(n)&&!/^[a-z]/.test(n)?{type:"Identifier",name:n}:{type:"Literal",value:n};if(r.type==="Literal"){const o=r.value;return gM.call(e.components,o)?e.components[o]:o}if(e.evaluater)return e.evaluater.evaluateExpression(r);__(e)}function __(e,n){const i=new Ua("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:n,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=_ie+"#cannot-handle-mdx-estrees-without-createevaluater",i}function QCe(e){const n={};let i;for(i in e)gM.call(e,i)&&(n[ZCe(i)]=e[i]);return n}function ZCe(e){let n=e.replace(MCe,JCe);return n.slice(0,3)==="ms-"&&(n="-"+n),n}function JCe(e){return"-"+e.toLowerCase()}const sz={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},eSe={};function bM(e,n){const i=eSe,r=typeof i.includeImageAlt=="boolean"?i.includeImageAlt:!0,o=typeof i.includeHtml=="boolean"?i.includeHtml:!0;return $ie(e,r,o)}function $ie(e,n,i){if(tSe(e)){if("value"in e)return e.type==="html"&&!i?"":e.value;if(n&&"alt"in e&&e.alt)return e.alt;if("children"in e)return NB(e.children,n,i)}return Array.isArray(e)?NB(e,n,i):""}function NB(e,n,i){const r=[];let o=-1;for(;++o<e.length;)r[o]=$ie(e[o],n,i);return r.join("")}function tSe(e){return!!(e&&typeof e=="object")}const zB=document.createElement("i");function vM(e){const n="&"+e+";";zB.innerHTML=n;const i=zB.textContent;return i.charCodeAt(i.length-1)===59&&e!=="semi"||i===n?!1:i}function Fc(e,n,i,r){const o=e.length;let s=0,a;if(n<0?n=-n>o?0:o+n:n=n>o?o:n,i=i>0?i:0,r.length<1e4)a=Array.from(r),a.unshift(n,i),e.splice(...a);else for(i&&e.splice(n,i);s<r.length;)a=r.slice(s,s+1e4),a.unshift(n,0),e.splice(...a),s+=1e4,n+=1e4}function Id(e,n){return e.length>0?(Fc(e,e.length,0,n),e):n}const TB={}.hasOwnProperty;function Iie(e){const n={};let i=-1;for(;++i<e.length;)nSe(n,e[i]);return n}function nSe(e,n){let i;for(i in n){const o=(TB.call(e,i)?e[i]:void 0)||(e[i]={}),s=n[i];let a;if(s)for(a in s){TB.call(o,a)||(o[a]=[]);const c=s[a];iSe(o[a],Array.isArray(c)?c:c?[c]:[])}}}function iSe(e,n){let i=-1;const r=[];for(;++i<n.length;)(n[i].add==="after"?e:r).push(n[i]);Fc(e,0,0,r)}function Pie(e,n){const i=Number.parseInt(e,n);return i<9||i===11||i>13&&i<32||i>126&&i<160||i>55295&&i<57344||i>64975&&i<65008||(i&65535)===65535||(i&65535)===65534||i>1114111?"�":String.fromCodePoint(i)}function Cu(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ml=Of(/[A-Za-z]/),Fa=Of(/[\dA-Za-z]/),rSe=Of(/[#-'*+\--9=?A-Z^-~]/);function G5(e){return e!==null&&(e<32||e===127)}const ZE=Of(/\d/),oSe=Of(/[\dA-Fa-f]/),sSe=Of(/[!-/:-@[-`{-~]/);function Wn(e){return e!==null&&e<-2}function zr(e){return e!==null&&(e<0||e===32)}function wi(e){return e===-2||e===-1||e===32}const AP=Of(new RegExp("\\p{P}|\\p{S}","u")),Sy=Of(/\s/);function Of(e){return n;function n(i){return i!==null&&i>-1&&e.test(String.fromCharCode(i))}}function d1(e){const n=[];let i=-1,r=0,o=0;for(;++i<e.length;){const s=e.charCodeAt(i);let a="";if(s===37&&Fa(e.charCodeAt(i+1))&&Fa(e.charCodeAt(i+2)))o=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(a=String.fromCharCode(s));else if(s>55295&&s<57344){const c=e.charCodeAt(i+1);s<56320&&c>56319&&c<57344?(a=String.fromCharCode(s,c),o=1):a="�"}else a=String.fromCharCode(s);a&&(n.push(e.slice(r,i),encodeURIComponent(a)),r=i+o+1,a=""),o&&(i+=o,o=0)}return n.join("")+e.slice(r)}function Mi(e,n,i,r){const o=r?r-1:Number.POSITIVE_INFINITY;let s=0;return a;function a(u){return wi(u)?(e.enter(i),c(u)):n(u)}function c(u){return wi(u)&&s++<o?(e.consume(u),c):(e.exit(i),n(u))}}const aSe={tokenize:lSe};function lSe(e){const n=e.attempt(this.parser.constructs.contentInitial,r,o);let i;return n;function r(c){if(c===null){e.consume(c);return}return e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),Mi(e,n,"linePrefix")}function o(c){return e.enter("paragraph"),s(c)}function s(c){const u=e.enter("chunkText",{contentType:"text",previous:i});return i&&(i.next=u),i=u,a(c)}function a(c){if(c===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(c);return}return Wn(c)?(e.consume(c),e.exit("chunkText"),s):(e.consume(c),a)}}const cSe={tokenize:dSe},EB={tokenize:uSe};function dSe(e){const n=this,i=[];let r=0,o,s,a;return c;function c(k){if(r<i.length){const P=i[r];return n.containerState=P[1],e.attempt(P[0].continuation,u,m)(k)}return m(k)}function u(k){if(r++,n.containerState._closeFlow){n.containerState._closeFlow=void 0,o&&$();const P=n.events.length;let S=P,I;for(;S--;)if(n.events[S][0]==="exit"&&n.events[S][1].type==="chunkFlow"){I=n.events[S][1].end;break}_(r);let A=P;for(;A<n.events.length;)n.events[A][1].end={...I},A++;return Fc(n.events,S+1,0,n.events.slice(P)),n.events.length=A,m(k)}return c(k)}function m(k){if(r===i.length){if(!o)return x(k);if(o.currentConstruct&&o.currentConstruct.concrete)return w(k);n.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return n.containerState={},e.check(EB,h,g)(k)}function h(k){return o&&$(),_(r),x(k)}function g(k){return n.parser.lazy[n.now().line]=r!==i.length,a=n.now().offset,w(k)}function x(k){return n.containerState={},e.attempt(EB,y,w)(k)}function y(k){return r++,i.push([n.currentConstruct,n.containerState]),x(k)}function w(k){if(k===null){o&&$(),_(0),e.consume(k);return}return o=o||n.parser.flow(n.now()),e.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:s}),j(k)}function j(k){if(k===null){v(e.exit("chunkFlow"),!0),_(0),e.consume(k);return}return Wn(k)?(e.consume(k),v(e.exit("chunkFlow")),r=0,n.interrupt=void 0,c):(e.consume(k),j)}function v(k,P){const S=n.sliceStream(k);
vendor: 6,683 bytes, line 2191
2191if(P&&S.push(null),k.previous=s,s&&(s.next=k),s=k,o.defineSkip(k.start),o.write(S),n.parser.lazy[k.start.line]){let I=o.events.length;for(;I--;)if(o.events[I][1].start.offset<a&&(!o.events[I][1].end||o.events[I][1].end.offset>a))return;const A=n.events.length;let E=A,B,T;for(;E--;)if(n.events[E][0]==="exit"&&n.events[E][1].type==="chunkFlow"){if(B){T=n.events[E][1].end;break}B=!0}for(_(r),I=A;I<n.events.length;)n.events[I][1].end={...T},I++;Fc(n.events,E+1,0,n.events.slice(A)),n.events.length=I}}function _(k){let P=i.length;for(;P-- >k;){const S=i[P];n.containerState=S[1],S[0].exit.call(n,e)}i.length=k}function $(){o.write([null]),s=void 0,o=void 0,n.containerState._closeFlow=void 0}}function uSe(e,n,i){return Mi(e,e.attempt(this.parser.constructs.document,n,i),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Wb(e){if(e===null||zr(e)||Sy(e))return 1;if(AP(e))return 2}function NP(e,n,i){const r=[];let o=-1;for(;++o<e.length;){const s=e[o].resolveAll;s&&!r.includes(s)&&(n=s(n,i),r.push(s))}return n}const JE={name:"attention",resolveAll:pSe,tokenize:mSe};function pSe(e,n){let i=-1,r,o,s,a,c,u,m,h;for(;++i<e.length;)if(e[i][0]==="enter"&&e[i][1].type==="attentionSequence"&&e[i][1]._close){for(r=i;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&n.sliceSerialize(e[r][1]).charCodeAt(0)===n.sliceSerialize(e[i][1]).charCodeAt(0)){if((e[r][1]._close||e[i][1]._open)&&(e[i][1].end.offset-e[i][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[i][1].end.offset-e[i][1].start.offset)%3))continue;u=e[r][1].end.offset-e[r][1].start.offset>1&&e[i][1].end.offset-e[i][1].start.offset>1?2:1;const g={...e[r][1].end},x={...e[i][1].start};MB(g,-u),MB(x,u),a={type:u>1?"strongSequence":"emphasisSequence",start:g,end:{...e[r][1].end}},c={type:u>1?"strongSequence":"emphasisSequence",start:{...e[i][1].start},end:x},s={type:u>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[i][1].start}},o={type:u>1?"strong":"emphasis",start:{...a.start},end:{...c.end}},e[r][1].end={...a.start},e[i][1].start={...c.end},m=[],e[r][1].end.offset-e[r][1].start.offset&&(m=Id(m,[["enter",e[r][1],n],["exit",e[r][1],n]])),m=Id(m,[["enter",o,n],["enter",a,n],["exit",a,n],["enter",s,n]]),m=Id(m,NP(n.parser.constructs.insideSpan.null,e.slice(r+1,i),n)),m=Id(m,[["exit",s,n],["enter",c,n],["exit",c,n],["exit",o,n]]),e[i][1].end.offset-e[i][1].start.offset?(h=2,m=Id(m,[["enter",e[i][1],n],["exit",e[i][1],n]])):h=0,Fc(e,r-1,i-r+3,m),i=r+m.length-h-2;break}}for(i=-1;++i<e.length;)e[i][1].type==="attentionSequence"&&(e[i][1].type="data");return e}function mSe(e,n){const i=this.parser.constructs.attentionMarkers.null,r=this.previous,o=Wb(r);let s;return a;function a(u){return s=u,e.enter("attentionSequence"),c(u)}function c(u){if(u===s)return e.consume(u),c;const m=e.exit("attentionSequence"),h=Wb(u),g=!h||h===2&&o||i.includes(u),x=!o||o===2&&h||i.includes(r);return m._open=!!(s===42?g:g&&(o||!x)),m._close=!!(s===42?x:x&&(h||!g)),n(u)}}function MB(e,n){e.column+=n,e.offset+=n,e._bufferIndex+=n}const hSe={name:"autolink",tokenize:fSe};function fSe(e,n,i){let r=0;return o;function o(y){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),s}function s(y){return ml(y)?(e.consume(y),a):y===64?i(y):m(y)}function a(y){return y===43||y===45||y===46||Fa(y)?(r=1,c(y)):m(y)}function c(y){return y===58?(e.consume(y),r=0,u):(y===43||y===45||y===46||Fa(y))&&r++<32?(e.consume(y),c):(r=0,m(y))}function u(y){return y===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),n):y===null||y===32||y===60||G5(y)?i(y):(e.consume(y),u)}function m(y){return y===64?(e.consume(y),h):rSe(y)?(e.consume(y),m):i(y)}function h(y){return Fa(y)?g(y):i(y)}function g(y){return y===46?(e.consume(y),r=0,h):y===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),n):x(y)}function x(y){if((y===45||Fa(y))&&r++<63){const w=y===45?x:g;return e.consume(y),w}return i(y)}}const nC={partial:!0,tokenize:gSe};function gSe(e,n,i){return r;function r(s){return wi(s)?Mi(e,o,"linePrefix")(s):o(s)}function o(s){return s===null||Wn(s)?n(s):i(s)}}const Aie={continuation:{tokenize:xSe},exit:bSe,name:"blockQuote",tokenize:ySe};function ySe(e,n,i){const r=this;return o;function o(a){if(a===62){const c=r.containerState;return c.open||(e.enter("blockQuote",{_container:!0}),c.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(a),e.exit("blockQuoteMarker"),s}return i(a)}function s(a){return wi(a)?(e.enter("blockQuotePrefixWhitespace"),e.consume(a),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),n):(e.exit("blockQuotePrefix"),n(a))}}function xSe(e,n,i){const r=this;return o;function o(a){return wi(a)?Mi(e,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a):s(a)}function s(a){return e.attempt(Aie,n,i)(a)}}function bSe(e){e.exit("blockQuote")}const Nie={name:"characterEscape",tokenize:vSe};function vSe(e,n,i){return r;function r(s){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(s),e.exit("escapeMarker"),o}function o(s){return sSe(s)?(e.enter("characterEscapeValue"),e.consume(s),e.exit("characterEscapeValue"),e.exit("characterEscape"),n):i(s)}}const zie={name:"characterReference",tokenize:wSe};function wSe(e,n,i){const r=this;let o=0,s,a;return c;function c(g){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),u}function u(g){return g===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(g),e.exit("characterReferenceMarkerNumeric"),m):(e.enter("characterReferenceValue"),s=31,a=Fa,h(g))}function m(g){return g===88||g===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(g),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),s=6,a=oSe,h):(e.enter("characterReferenceValue"),s=7,a=ZE,h(g))}function h(g){if(g===59&&o){const x=e.exit("characterReferenceValue");return a===Fa&&!vM(r.sliceSerialize(x))?i(g):(e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),e.exit("characterReference"),n)}return a(g)&&o++<s?(e.consume(g),h):i(g)}}const RB={partial:!0,tokenize:_Se},OB={concrete:!0,name:"codeFenced",tokenize:jSe};function jSe(e,n,i){const r=this,o={partial:!0,tokenize:S};let s=0,a=0,c;return u;function u(I){return m(I)}function m(I){const A=r.events[r.events.length-1];return s=A&&A[1].type==="linePrefix"?A[2].sliceSerialize(A[1],!0).length:0,c=I,e.enter("co
2191deFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),h(I)}function h(I){return I===c?(a++,e.consume(I),h):a<3?i(I):(e.exit("codeFencedFenceSequence"),wi(I)?Mi(e,g,"whitespace")(I):g(I))}function g(I){return I===null||Wn(I)?(e.exit("codeFencedFence"),r.interrupt?n(I):e.check(RB,j,P)(I)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),x(I))}function x(I){return I===null||Wn(I)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),g(I)):wi(I)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Mi(e,y,"whitespace")(I)):I===96&&I===c?i(I):(e.consume(I),x)}function y(I){return I===null||Wn(I)?g(I):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),w(I))}function w(I){return I===null||Wn(I)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),g(I)):I===96&&I===c?i(I):(e.consume(I),w)}function j(I){return e.attempt(o,P,v)(I)}function v(I){return e.enter("lineEnding"),e.consume(I),e.exit("lineEnding"),_}function _(I){return s>0&&wi(I)?Mi(e,$,"linePrefix",s+1)(I):$(I)}function $(I){return I===null||Wn(I)?e.check(RB,j,P)(I):(e.enter("codeFlowValue"),k(I))}function k(I){return I===null||Wn(I)?(e.exit("codeFlowValue"),$(I)):(e.consume(I),k)}function P(I){return e.exit("codeFenced"),n(I)}function S(I,A,E){let B=0;return T;function T(H){return I.enter("lineEnding"),I.consume(H),I.exit("lineEnding"),M}function M(H){return I.enter("codeFencedFence"),wi(H)?Mi(I,R,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(H):R(H)}function R(H){return H===c?(I.enter("codeFencedFenceSequence"),F(H)):E(H)}function F(H){return H===c?(B++,I.consume(H),F):B>=a?(I.exit("codeFencedFenceSequence"),wi(H)?Mi(I,Y,"whitespace")(H):Y(H)):E(H)}function Y(H){return H===null||Wn(H)?(I.exit("codeFencedFence"),A(H)):E(H)}}}function _Se(e,n,i){const r=this;return o;function o(a){return a===null?i(a):(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),s)}function s(a){return r.parser.lazy[r.now().line]?i(a):n(a)}}const az={name:"codeIndented",tokenize:SSe},CSe={partial:!0,tokenize:kSe};function SSe(e,n,i){const r=this;return o;function o(m){return e.enter("codeIndented"),Mi(e,s,"linePrefix",5)(m)}function s(m){const h=r.events[r.events.length-1];return h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?a(m):i(m)}function a(m){return m===null?u(m):Wn(m)?e.attempt(CSe,a,u)(m):(e.enter("codeFlowValue"),c(m))}function c(m){return m===null||Wn(m)?(e.exit("codeFlowValue"),a(m)):(e.consume(m),c)}function u(m){return e.exit("codeIndented"),n(m)}}function kSe(e,n,i){const r=this;return o;function o(a){return r.parser.lazy[r.now().line]?i(a):Wn(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),o):Mi(e,s,"linePrefix",5)(a)}function s(a){const c=r.events[r.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?n(a):Wn(a)?o(a):i(a)}}const $Se={name:"codeText",previous:PSe,resolve:ISe,tokenize:ASe};function ISe(e){let n=e.length-4,i=3,r,o;if((e[i][1].type==="lineEnding"||e[i][1].type==="space")&&(e[n][1].type==="lineEnding"||e[n][1].type==="space")){for(r=i;++r<n;)if(e[r][1].type==="codeTextData"){e[i][1].type="codeTextPadding",e[n][1].type="codeTextPadding",i+=2,n-=2;break}}for(r=i-1,n++;++r<=n;)o===void 0?r!==n&&e[r][1].type!=="lineEnding"&&(o=r):(r===n||e[r][1].type==="lineEnding")&&(e[o][1].type="codeTextData",r!==o+2&&(e[o][1].end=e[r-1][1].end,e.splice(o+2,r-o-2),n-=r-o-2,r=o+2),o=void 0);return e}function PSe(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function ASe(e,n,i){let r=0,o,s;return a;function a(g){return e.enter("codeText"),e.enter("codeTextSequence"),c(g)}function c(g){return g===96?(e.consume(g),r++,c):(e.exit("codeTextSequence"),u(g))}function u(g){return g===null?i(g):g===32?(e.enter("space"),e.consume(g),e.exit("space"),u):g===96?(s=e.enter("codeTextSequence"),o=0,h(g)):Wn(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),u):(e.enter("codeTextData"),m(g))}function m(g){return g===null||g===32||g===96||Wn(g)?(e.exit("codeTextData"),u(g)):(e.consume(g),m)}function h(g){return g===96?(e.consume(g),o++,h):o===r?(e.exit("codeTextSequence"),e.exit("codeText"),n(g)):(s.type="codeTextData",m(g))}}class NSe{constructor(n){this.left=n?[...n]:[],this.right=[]}get(n){if(n<0||n>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+n+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return n<this.left.length?this.left[n]:this.right[this.right.length-n+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(n,i){const r=i??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(n,r):n>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-n+this.left.length).reverse():this.left.slice(n).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(n,i,r){const o=i||0;this.setCursor(Math.trunc(n));const s=this.right.splice(this.right.length-o,Number.POSITIVE_INFINITY);return r&&mw(this.left,r),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(n){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(n)}pushMany(n){this.setCursor(Number.POSITIVE_INFINITY),mw(this.left,n)}unshift(n){this.setCursor(0),this.right.push(n)}unshiftMany(n){this.setCursor(0),mw(this.right,n.reverse())}setCursor(n){if(!(n===this.left.length||n>this.left.length&&this.right.length===0||n<0&&this.left.length===0))if(n<this.left.length){const i=this.left.splice(n,Number.POSITIVE_INFINITY);mw(this.right,i.reverse())}else{const i=this.right.splice(this.left.length+this.right.length-n,Number.POSITIVE_INFINITY);mw(this.left,i.reverse())}}}function mw(e,n){let i=0;if(n.length<1e4)e.push(...n);else for(;i<n.length;)e.push(...n.slice(i,i+1e4)),i+=1e4}function Tie(e){const n={};let i=-1,r,o,s,a,c,u,m;const h=new NSe(e);for(;++i<h.length;){for(;i in n;)i=n[i];if(r=h.get(i),i&&r[1].type==="chunkFlow"&&h.get(i-1)[1].type==="listItemPrefix"&&(u=r[1]._tokenizer.events,s=0,s<u.length&&u[s][1].type==="lineEndingBlank"&&(s+=2),s<u.length&&u[s][1].type==="content"))for(;++s<u.length&&u[s][1].type!=="content";)u[s][1].type==="chunkText"&&(u[s][1]._isInFirstContentOfListItem=!0,s++);if(r[0]==="enter")r[1].contentType&&(Object.assign(n,zSe(h,i)),i=n[i],m=!0);else if(r[1]._container){for(s=i,o=void 0;s--;)if(a=h.get(s),a[1].type==="lineEnding"||a[1].type==="lineEndingBlank")a[0]==="enter"&&(o&&(h.get(o)[1].type="lineEndingBlank"),a[1].type="lineEnding",o=s);else if(!(a[1].type==="linePrefix"||a[1].type==="listItemIndent"))break;o&&(r[1].end={...h.get(o)[1].start},c=h.slice(o,i),c.unshift(r),h.splice(o,i-o+1,c))}}return Fc(e,0,Number.POSITIVE_INFINITY,h.slice(0)),!m}function zSe(e,n){const i=e.get(n)[1],r=e.get(n)[2];let o=n-1;const s=[];let a=i._tokenizer;a||(a=r.parser[i.contentType](i.start),i._contentTypeTextTrailing&&(a._contentTypeTextTrailing=!0));const c=a.events,u=[],m={};let h,g,x=-1,y=i,w=0,j=0;const v=[j];for(;y;){for(;e.get(++o)[1]!==y;);s.push(o),y._tokenizer||(h=r.sliceStream(y),y.next||h.push(null),g&&a.defineSki
vendor: 23,002 bytes, line 2191
2191p(y.start),y._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=!0),a.write(h),y._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=void 0)),g=y,y=y.next}for(y=i;++x<c.length;)c[x][0]==="exit"&&c[x-1][0]==="enter"&&c[x][1].type===c[x-1][1].type&&c[x][1].start.line!==c[x][1].end.line&&(j=x+1,v.push(j),y._tokenizer=void 0,y.previous=void 0,y=y.next);for(a.events=[],y?(y._tokenizer=void 0,y.previous=void 0):v.pop(),x=v.length;x--;){const _=c.slice(v[x],v[x+1]),$=s.pop();u.push([$,$+_.length-1]),e.splice($,2,_)}for(u.reverse(),x=-1;++x<u.length;)m[w+u[x][0]]=w+u[x][1],w+=u[x][1]-u[x][0]-1;return m}const TSe={resolve:MSe,tokenize:RSe},ESe={partial:!0,tokenize:OSe};function MSe(e){return Tie(e),e}function RSe(e,n){let i;return r;function r(c){return e.enter("content"),i=e.enter("chunkContent",{contentType:"content"}),o(c)}function o(c){return c===null?s(c):Wn(c)?e.check(ESe,a,s)(c):(e.consume(c),o)}function s(c){return e.exit("chunkContent"),e.exit("content"),n(c)}function a(c){return e.consume(c),e.exit("chunkContent"),i.next=e.enter("chunkContent",{contentType:"content",previous:i}),i=i.next,o}}function OSe(e,n,i){const r=this;return o;function o(a){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),Mi(e,s,"linePrefix")}function s(a){if(a===null||Wn(a))return i(a);const c=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?n(a):e.interrupt(r.parser.constructs.flow,i,n)(a)}}function Eie(e,n,i,r,o,s,a,c,u){const m=u||Number.POSITIVE_INFINITY;let h=0;return g;function g(_){return _===60?(e.enter(r),e.enter(o),e.enter(s),e.consume(_),e.exit(s),x):_===null||_===32||_===41||G5(_)?i(_):(e.enter(r),e.enter(a),e.enter(c),e.enter("chunkString",{contentType:"string"}),j(_))}function x(_){return _===62?(e.enter(s),e.consume(_),e.exit(s),e.exit(o),e.exit(r),n):(e.enter(c),e.enter("chunkString",{contentType:"string"}),y(_))}function y(_){return _===62?(e.exit("chunkString"),e.exit(c),x(_)):_===null||_===60||Wn(_)?i(_):(e.consume(_),_===92?w:y)}function w(_){return _===60||_===62||_===92?(e.consume(_),y):y(_)}function j(_){return!h&&(_===null||_===41||zr(_))?(e.exit("chunkString"),e.exit(c),e.exit(a),e.exit(r),n(_)):h<m&&_===40?(e.consume(_),h++,j):_===41?(e.consume(_),h--,j):_===null||_===32||_===40||G5(_)?i(_):(e.consume(_),_===92?v:j)}function v(_){return _===40||_===41||_===92?(e.consume(_),j):j(_)}}function Mie(e,n,i,r,o,s){const a=this;let c=0,u;return m;function m(y){return e.enter(r),e.enter(o),e.consume(y),e.exit(o),e.enter(s),h}function h(y){return c>999||y===null||y===91||y===93&&!u||y===94&&!c&&"_hiddenFootnoteSupport"in a.parser.constructs?i(y):y===93?(e.exit(s),e.enter(o),e.consume(y),e.exit(o),e.exit(r),n):Wn(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),h):(e.enter("chunkString",{contentType:"string"}),g(y))}function g(y){return y===null||y===91||y===93||Wn(y)||c++>999?(e.exit("chunkString"),h(y)):(e.consume(y),u||(u=!wi(y)),y===92?x:g)}function x(y){return y===91||y===92||y===93?(e.consume(y),c++,g):g(y)}}function Rie(e,n,i,r,o,s){let a;return c;function c(x){return x===34||x===39||x===40?(e.enter(r),e.enter(o),e.consume(x),e.exit(o),a=x===40?41:x,u):i(x)}function u(x){return x===a?(e.enter(o),e.consume(x),e.exit(o),e.exit(r),n):(e.enter(s),m(x))}function m(x){return x===a?(e.exit(s),u(a)):x===null?i(x):Wn(x)?(e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),Mi(e,m,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),h(x))}function h(x){return x===a||x===null||Wn(x)?(e.exit("chunkString"),m(x)):(e.consume(x),x===92?g:h)}function g(x){return x===a||x===92?(e.consume(x),h):h(x)}}function s_(e,n){let i;return r;function r(o){return Wn(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i=!0,r):wi(o)?Mi(e,r,i?"linePrefix":"lineSuffix")(o):n(o)}}const DSe={name:"definition",tokenize:BSe},LSe={partial:!0,tokenize:FSe};function BSe(e,n,i){const r=this;let o;return s;function s(y){return e.enter("definition"),a(y)}function a(y){return Mie.call(r,e,c,i,"definitionLabel","definitionLabelMarker","definitionLabelString")(y)}function c(y){return o=Cu(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),y===58?(e.enter("definitionMarker"),e.consume(y),e.exit("definitionMarker"),u):i(y)}function u(y){return zr(y)?s_(e,m)(y):m(y)}function m(y){return Eie(e,h,i,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(y)}function h(y){return e.attempt(LSe,g,g)(y)}function g(y){return wi(y)?Mi(e,x,"whitespace")(y):x(y)}function x(y){return y===null||Wn(y)?(e.exit("definition"),r.parser.defined.push(o),n(y)):i(y)}}function FSe(e,n,i){return r;function r(c){return zr(c)?s_(e,o)(c):i(c)}function o(c){return Rie(e,s,i,"definitionTitle","definitionTitleMarker","definitionTitleString")(c)}function s(c){return wi(c)?Mi(e,a,"whitespace")(c):a(c)}function a(c){return c===null||Wn(c)?n(c):i(c)}}const WSe={name:"hardBreakEscape",tokenize:USe};function USe(e,n,i){return r;function r(s){return e.enter("hardBreakEscape"),e.consume(s),o}function o(s){return Wn(s)?(e.exit("hardBreakEscape"),n(s)):i(s)}}const HSe={name:"headingAtx",resolve:qSe,tokenize:GSe};function qSe(e,n){let i=e.length-2,r=3,o,s;return e[r][1].type==="whitespace"&&(r+=2),i-2>r&&e[i][1].type==="whitespace"&&(i-=2),e[i][1].type==="atxHeadingSequence"&&(r===i-1||i-4>r&&e[i-2][1].type==="whitespace")&&(i-=r+1===i?2:4),i>r&&(o={type:"atxHeadingText",start:e[r][1].start,end:e[i][1].end},s={type:"chunkText",start:e[r][1].start,end:e[i][1].end,contentType:"text"},Fc(e,r,i-r+1,[["enter",o,n],["enter",s,n],["exit",s,n],["exit",o,n]])),e}function GSe(e,n,i){let r=0;return o;function o(h){return e.enter("atxHeading"),s(h)}function s(h){return e.enter("atxHeadingSequence"),a(h)}function a(h){return h===35&&r++<6?(e.consume(h),a):h===null||zr(h)?(e.exit("atxHeadingSequence"),c(h)):i(h)}function c(h){return h===35?(e.enter("atxHeadingSequence"),u(h)):h===null||Wn(h)?(e.exit("atxHeading"),n(h)):wi(h)?Mi(e,c,"whitespace")(h):(e.enter("atxHeadingText"),m(h))}function u(h){return h===35?(e.consume(h),u):(e.exit("atxHeadingSequence"),c(h))}function m(h){return h===null||h===35||zr(h)?(e.exit("atxHeadingText"),c(h)):(e.consume(h),m)}}const VSe=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],DB=["pre","script","style","textarea"],KSe={concrete:!0,name:"htmlFlow",resolveTo:QSe,tokenize:ZSe},YSe={partial:!0,tokenize:eke},XSe={partial:!0,tokenize:JSe};function QSe(e){let n=e.length;for(;n--&&!(e[n][0]==="enter"&&e[n][1].type==="htmlFlow"););return n>1&&e[n-2][1].type==="linePrefix"&&(e[n][1].start=e[n-2][1].start,e[n+1][1].start=e[n-2][1].start,e.splice(n-2,2)),e}function ZSe(e,n,i){const r=this;let o,s,a,c,u;return m;function m(W){return h(W)}function h(W){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(W),g}function g(W){return W===33?(e.consume(W),x):W===47?(e.consume(W),s=!0,j):W===63?(e.consume(W),o=3,r.interrupt?n:G):ml(W)?(e.consume(W),a=String.fromCharCode(W),v):i(W)}function x(W){return W===45?(e.consume(W),o=2,y):W===91?(e.consume(W),o=5,c=0,w):ml(W)?(e.consume(W),o=4,r.interrupt?n:G):i(W)}function y(W){return W===45?(e.consume(W),r.interrupt?n:G):i(W)}function w(W){const oe="CDATA[";return W===oe.charCodeAt(c++)?(e.consume(W),c===oe.length?r.interrupt?n:R:w):i(W)}function j(W){return ml(W)?(e.consume(W),a=String.fromCharCode(W),v):i(W)}function v(W){if(W===null||W===47||W===62||zr(W)){const oe=W===47,se=a.toLowerCase();return!oe&&!s&&DB.includes(se)?(o=1,r.interrupt?n(W):R(W)):VSe.includes(a.toLowerCase())?(o=6,oe?(e.consume(W),_):r.interrupt?n(W):R(W)):(o=7,r.interrupt&&!r.parser.lazy[r.now().line]?i(W):s?$(W):k(W))}return W===45||Fa(W)?(e.consume(W),a+=String.fromCharCode(W),v):i(W)}function _(W){return W===62?(e.consume(W),r.interrupt?n:R):i(W)}function $(W){return wi(W)?(e.consume(W),$):T(W)}function k(W){return W===47?(e.consume(W),T):W===58||W===95||ml(W)?(e.consume(W),P):wi(W)?(e.consume(W),k):T(W)}function P(W){return W===45||W===46||W===58||W===95||Fa(W)?(e.consume(W),P):S(W)}function S(W){return W===61?(e.consume(W),I):wi(W)?(e.consume(W),S):k(W)}function I(W){return W===null||W===60||W===61||W===62||W===96?i(W):W===34||W===39?(e.consume(W),u=W,A):wi(W)?(e.consume(W),I):E(W)}function A(W){return W===u?(e.consume(W),u=null,B):W===null||Wn(W)?i(W):(e.consume(W),A)}function E(W){return W===null||W===34||W===39||W===47||W===60||W===61||W===62||W===96||zr(W)?S(W):(e.consume(W),E)}function B(W){return W===47||W===62||wi(W)?k(W):i(W)}function T(W){return W===62?(e.consume(W),M):i(W)}function M(W){return W===null||Wn(W)?R(W):wi(W)?(e.consume(W),M):i(W)}function R(W){return W===45&&o===2?(e.consume(W),U):W===60&&o===1?(e.consume(W),X):W===62&&o===4?(e.consume(W),L):W===63&&o===3?(e.consume(W),G):W===93&&o===5?(e.consume(W),K):Wn(W)&&(o===6||o===7)?(e.exit("htmlFlowData"),e.check(YSe,q,F)(W)):W===null||Wn(W)?(e.exit("htmlFlowData"),F(W)):(e.consume(W),R)}function F(W){return e.check(XSe,Y,q)(W)}function Y(W){return e.enter("lineEnding"),e.consume(W),e.exit("lineEnding"),H}function H(W){return W===null||Wn(W)?F(W):(e.enter("htmlFlowData"),R(W))}function U(W){return W===45?(e.consume(W),G):R(W)}function X(W){return W===47?(e.consume(W),a="",Q):R(W)}function Q(W){if(W===62){const oe=a.toLowerCase();return DB.includes(oe)?(e.consume(W),L):R(W)}return ml(W)&&a.length<8?(e.consume(W),a+=String.fromCharCode(W),Q):R(W)}function K(W){return W===93?(e.consume(W),G):R(W)}function G(W){return W===62?(e.consume(W),L):W===45&&o===2?(e.consume(W),G):R(W)}function L(W){return W===null||Wn(W)?(e.exit("htmlFlowData"),q(W)):(e.consume(W),L)}function q(W){return e.exit("htmlFlow"),n(W)}}function JSe(e,n,i){const r=this;return o;function o(a){return Wn(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),s):i(a)}function s(a){return r.parser.lazy[r.now().line]?i(a):n(a)}}function eke(e,n,i){return r;function r(o){return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),e.attempt(nC,n,i)}}const tke={name:"htmlText",tokenize:nke};function nke(e,n,i){const r=this;let o,s,a;return c;function c(G){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(G),u}function u(G){return G===33?(e.consume(G),m):G===47?(e.consume(G),S):G===63?(e.consume(G),k):ml(G)?(e.consume(G),E):i(G)}function m(G){return G===45?(e.consume(G),h):G===91?(e.consume(G),s=0,w):ml(G)?(e.consume(G),$):i(G)}function h(G){return G===45?(e.consume(G),y):i(G)}function g(G){return G===null?i(G):G===45?(e.consume(G),x):Wn(G)?(a=g,X(G)):(e.consume(G),g)}function x(G){return G===45?(e.consume(G),y):g(G)}function y(G){return G===62?U(G):G===45?x(G):g(G)}function w(G){const L="CDATA[";return G===L.charCodeAt(s++)?(e.consume(G),s===L.length?j:w):i(G)}function j(G){return G===null?i(G):G===93?(e.consume(G),v):Wn(G)?(a=j,X(G)):(e.consume(G),j)}function v(G){return G===93?(e.consume(G),_):j(G)}function _(G){return G===62?U(G):G===93?(e.consume(G),_):j(G)}function $(G){return G===null||G===62?U(G):Wn(G)?(a=$,X(G)):(e.consume(G),$)}function k(G){return G===null?i(G):G===63?(e.consume(G),P):Wn(G)?(a=k,X(G)):(e.consume(G),k)}function P(G){return G===62?U(G):k(G)}function S(G){return ml(G)?(e.consume(G),I):i(G)}function I(G){return G===45||Fa(G)?(e.consume(G),I):A(G)}function A(G){return Wn(G)?(a=A,X(G)):wi(G)?(e.consume(G),A):U(G)}function E(G){return G===45||Fa(G)?(e.consume(G),E):G===47||G===62||zr(G)?B(G):i(G)}function B(G){return G===47?(e.consume(G),U):G===58||G===95||ml(G)?(e.consume(G),T):Wn(G)?(a=B,X(G)):wi(G)?(e.consume(G),B):U(G)}function T(G){return G===45||G===46||G===58||G===95||Fa(G)?(e.consume(G),T):M(G)}function M(G){return G===61?(e.consume(G),R):Wn(G)?(a=M,X(G)):wi(G)?(e.consume(G),M):B(G)}function R(G){return G===null||G===60||G===61||G===62||G===96?i(G):G===34||G===39?(e.consume(G),o=G,F):Wn(G)?(a=R,X(G)):wi(G)?(e.consume(G),R):(e.consume(G),Y)}function F(G){return G===o?(e.consume(G),o=void 0,H):G===null?i(G):Wn(G)?(a=F,X(G)):(e.consume(G),F)}function Y(G){return G===null||G===34||G===39||G===60||G===61||G===96?i(G):G===47||G===62||zr(G)?B(G):(e.consume(G),Y)}function H(G){return G===47||G===62||zr(G)?B(G):i(G)}function U(G){return G===62?(e.consume(G),e.exit("htmlTextData"),e.exit("htmlText"),n):i(G)}function X(G){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(G),e.exit("lineEnding"),Q}function Q(G){return wi(G)?Mi(e,K,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(G):K(G)}function K(G){return e.enter("htmlTextData"),a(G)}}const wM={name:"labelEnd",resolveAll:ske,resolveTo:ake,tokenize:lke},ike={tokenize:cke},rke={tokenize:dke},oke={tokenize:uke};function ske(e){let n=-1;const i=[];for(;++n<e.length;){const r=e[n][1];if(i.push(e[n]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const o=r.type==="labelImage"?4:2;r.type="data",n+=o}}return e.length!==i.length&&Fc(e,0,e.length,i),e}function ake(e,n){let i=e.length,r=0,o,s,a,c;for(;i--;)if(o=e[i][1],s){if(o.type==="link"||o.type==="labelLink"&&o._inactive)break;e[i][0]==="enter"&&o.type==="labelLink"&&(o._inactive=!0)}else if(a){if(e[i][0]==="enter"&&(o.type==="labelImage"||o.type==="labelLink")&&!o._balanced&&(s=i,o.type!=="labelLink")){r=2;break}}else o.type==="labelEnd"&&(a=i);const u={type:e[s][1].type==="labelLink"?"link":"image",start:{...e[s][1].start},end:{...e[e.length-1][1].end}},m={type:"label",start:{...e[s][1].start},end:{...e[a][1].end}},h={type:"labelText",start:{...e[s+r+2][1].end},end:{...e[a-2][1].start}};return c=[["enter",u,n],["enter",m,n]],c=Id(c,e.slice(s+1,s+r+3)),c=Id(c,[["enter",h,n]]),c=Id(c,NP(n.parser.constructs.insideSpan.null,e.slice(s+r+4,a-3),n)),c=Id(c,[["exit",h,n],e[a-2],e[a-1],["exit",m,n]]),c=Id(c,e.slice(a+1)),c=Id(c,[["exit",u,n]]),Fc(e,s,e.length,c),e}function lke(e,n,i){const r=this;let o=r.events.length,s,a;for(;o--;)if((r.events[o][1].type==="labelImage"||r.events[o][1].type==="labelLink")&&!r.events[o][1]._balanced){s=r.events[o][1];break}return c;function c(x){return s?s._inactive?g(x):(a=r.parser.defined.includes(Cu(r.sliceSerialize({start:s.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(x),e.exit("labelMarker"),e.exit("labelEnd"),u):i(x)}function u(x){return x===40?e.attempt(ike,h,a?h:g)(x):x===91?e.attempt(rke,h,a?m:g)(x):a?h(x):g(x)}function m(x){return e.attempt(oke,h,g)(x)}function h(x){return n(x)}function g(x){return s._balanced=!0,i(x)}}function cke(e,n,i){return r;function r(g){return e.enter("resource"),e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),o}function o(g){return zr(g)?s_(e,s)(g):s(g)}function s(g){return g===41?h(g):Eie(e,a,c,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function a(g){return zr(g)?s_(e,u)(g):h(g)}function c(g){return i(g)}function u(g){return g===34||g===39||g===40?Rie(e,m,i,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):h(g)}function m(g){return zr(g)?s_(e,h)(g):h(g)}function h(g){return g===41?(e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),e.exit("resource"),n):i(g)}}function dke(e,n,i){const r=this;return o;function o(c){return Mie.call(r,e,s,a,"reference","referenceMarker","referenceString")(c)}function s(c){return r.parser.defined.includes(Cu(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?n(c):i(c)}function a(c){return i(c)}}function uke(e,n,i){return r;function r(s){return e.enter("reference"),e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),o}function o(s){return s===93?(e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),e.exit("reference"),n):i(s)}}const pke={name:"labelStartImage",resolveAll:wM.resolveAll,tokenize:mke};function mke(e,n,i){const r=this;return o;function o(c){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(c),e.exit("labelImageMarker"),s}function s(c){return c===91?(e.enter("labelMarker"),e.consume(c),e.exit("labelMarker"),e.exit("labelImage"),a):i(c)}function a(c){return c===94&&"_hiddenFootnoteSupport"in r.parser.constructs?i(c):n(c)}}const hke={name:"labelStartLink",resolveAll:wM.resolveAll,tokenize:fke};function fke(e,n,i){const r=this;return o;function o(a){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelLink"),s}function s(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?i(a):n(a)}}const lz={name:"lineEnding",tokenize:gke};function gke(e,n){return i;function i(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Mi(e,n,"linePrefix")}}const _5={name:"thematicBreak",tokenize:yke};function yke(e,n,i){let r=0,o;return s;function s(m){return e.enter("thematicBreak"),a(m)}function a(m){return o=m,c(m)}function c(m){return m===o?(e.enter("thematicBreakSequence"),u(m)):r>=3&&(m===null||Wn(m))?(e.exit("thematicBreak"),n(m)):i(m)}function u(m){return m===o?(e.consume(m),r++,u):(e.exit("thematicBreakSequence"),wi(m)?Mi(e,c,"whitespace")(m):c(m))}}const Ol={continuation:{tokenize:wke},exit:_ke,name:"list",tokenize:vke},xke={partial:!0,tokenize:Cke},bke={partial:!0,tokenize:jke};function vke(e,n,i){const r=this,o=r.events[r.events.length-1];let s=o&&o[1].type==="linePrefix"?o[2].sliceSerialize(o[1],!0).length:0,a=0;return c;function c(y){const w=r.containerState.type||(y===42||y===43||y===45?"listUnordered":"listOrdered");if(w==="listUnordered"?!r.containerState.marker||y===r.containerState.marker:ZE(y)){if(r.containerState.type||(r.containerState.type=w,e.enter(w,{_container:!0})),w==="listUnordered")return e.enter("listItemPrefix"),y===42||y===45?e.check(_5,i,m)(y):m(y);if(!r.interrupt||y===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),u(y)}return i(y)}function u(y){return ZE(y)&&++a<10?(e.consume(y),u):(!r.interrupt||a<2)&&(r.containerState.marker?y===r.containerState.marker:y===41||y===46)?(e.exit("listItemValue"),m(y)):i(y)}function m(y){return e.enter("listItemMarker"),e.consume(y),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||y,e.check(nC,r.interrupt?i:h,e.attempt(xke,x,g))}function h(y){return r.containerState.initialBlankLine=!0,s++,x(y)}function g(y){return wi(y)?(e.enter("listItemPrefixWhitespace"),e.consume(y),e.exit("listItemPrefixWhitespace"),x):i(y)}function x(y){return r.containerState.size=s+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,n(y)}}function wke(e,n,i){const r=this;return r.containerState._closeFlow=void 0,e.check(nC,o,s);function o(c){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Mi(e,n,"listItemIndent",r.containerState.size+1)(c)}function s(c){return r.containerState.furtherBlankLines||!wi(c)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(c)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(bke,n,a)(c))}function a(c){return r.containerState._closeFlow=!0,r.interrupt=void 0,Mi(e,e.attempt(Ol,n,i),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c)}}function jke(e,n,i){const r=this;return Mi(e,o,"listItemIndent",r.containerState.size+1);function o(s){const a=r.events[r.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===r.containerState.size?n(s):i(s)}}function _ke(e){e.exit(this.containerState.type)}function Cke(e,n,i){const r=this;return Mi(e,o,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function o(s){const a=r.events[r.events.length-1];return!wi(s)&&a&&a[1].type==="listItemPrefixWhitespace"?n(s):i(s)}}const LB={name:"setextUnderline",resolveTo:Ske,tokenize:kke};function Ske(e,n){let i=e.length,r,o,s;for(;i--;)if(e[i][0]==="enter"){if(e[i][1].type==="content"){r=i;break}e[i][1].type==="paragraph"&&(o=i)}else e[i][1].type==="content"&&e.splice(i,1),!s&&e[i][1].type==="definition"&&(s=i);const a={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[o][1].type="setextHeadingText",s?(e.splice(o,0,["enter",a,n]),e.splice(s+1,0,["exit",e[r][1],n]),e[r][1].end={...e[s][1].end}):e[r][1]=a,e.push(["exit",a,n]),e}function kke(e,n,i){const r=this;let o;return s;function s(m){let h=r.events.length,g;for(;h--;)if(r.events[h][1].type!=="lineEnding"&&r.events[h][1].type!=="linePrefix"&&r.events[h][1].type!=="content"){g=r.events[h][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||g)?(e.enter("setextHeadingLine"),o=m,a(m)):i(m)}function a(m){return e.enter("setextHeadingLineSequence"),c(m)}function c(m){return m===o?(e.consume(m),c):(e.exit("setextHeadingLineSequence"),wi(m)?Mi(e,u,"lineSuffix")(m):u(m))}function u(m){return m===null||Wn(m)?(e.exit("setextHeadingLine"),n(m)):i(m)}}const $ke={tokenize:Ike};function Ike(e){const n=this,i=e.attempt(nC,r,e.attempt(this.parser.constructs.flowInitial,o,Mi(e,e.attempt(this.parser.constructs.flow,o,e.attempt(TSe,o)),"linePrefix")));return i;function r(s){if(s===null){e.consume(s);return}return e.enter("lineEndingBlank"),e.consume(s),e.exit("lineEndingBlank"),n.currentConstruct=void 0,i}function o(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n.currentConstruct=void 0,i}}const Pke={resolveAll:Die()},Ake=Oie("string"),Nke=Oie("text");function Oie(e){return{resolveAll:Die(e==="text"?zke:void 0),tokenize:n};function n(i){const r=this,o=this.parser.constructs[e],s=i.attempt(o,a,c);return a;function a(h){return m(h)?s(h):c(h)}function c(h){if(h===null){i.consume(h);return}return i.enter("data"),i.consume(h),u}function u(h){return m(h)?(i.exit("data"),s(h)):(i.consume(h),u)}function m(h){if(h===null)return!0;const g=o[h];let x=-1;if(g)for(;++x<g.length;){const y=g[x];if(!y.previous||y.previous.call(r,r.previous))return!0}return!1}}}function Die(e){return n;function n(i,r){let o=-1,s;for(;++o<=i.length;)s===void 0?i[o]&&i[o][1].type==="data"&&(s=o,o++):(!i[o]||i[o][1].type!=="data")&&(o!==s+2&&(i[s][1].end=i[o-1][1].end,i.splice(s+2,o-s-2),o=s+2),s=void 0);return e?e(i,r):i}}function zke(e,n){let i=0;for(;++i<=e.length;)if((i===e.length||e[i][1].type==="lineEnding")&&e[i-1][1].type==="data"){const r=e[i-1][1],o=n.sliceStream(r);let s=o.length,a=-1,c=0,u;for(;s--;){const m=o[s];if(typeof m=="string"){for(a=m.length;m.charCodeAt(a-1)===32;)c++,a--;if(a)break;a=-1}else if(m===-2)u=!0,c++;else if(m!==-1){s++;break}}
vendor: 5,407 bytes, lines 2191-2193
2191if(n._contentTypeTextTrailing&&i===e.length&&(c=0),c){const m={type:i===e.length||u||c<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?a:r.start._bufferIndex+a,_index:r.start._index+s,line:r.end.line,column:r.end.column-c,offset:r.end.offset-c},end:{...r.end}};r.end={...m.start},r.start.offset===r.end.offset?Object.assign(r,m):(e.splice(i,0,["enter",m,n],["exit",m,n]),i+=2)}i++}return e}const Tke={42:Ol,43:Ol,45:Ol,48:Ol,49:Ol,50:Ol,51:Ol,52:Ol,53:Ol,54:Ol,55:Ol,56:Ol,57:Ol,62:Aie},Eke={91:DSe},Mke={[-2]:az,[-1]:az,32:az},Rke={35:HSe,42:_5,45:[LB,_5],60:KSe,61:LB,95:_5,96:OB,126:OB},Oke={38:zie,92:Nie},Dke={[-5]:lz,[-4]:lz,[-3]:lz,33:pke,38:zie,42:JE,60:[hSe,tke],91:hke,92:[WSe,Nie],93:wM,95:JE,96:$Se},Lke={null:[JE,Pke]},Bke={null:[42,95]},Fke={null:[]},Wke=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:Bke,contentInitial:Eke,disable:Fke,document:Tke,flow:Rke,flowInitial:Mke,insideSpan:Lke,string:Oke,text:Dke},Symbol.toStringTag,{value:"Module"}));function Uke(e,n,i){let r={_bufferIndex:-1,_index:0,line:i&&i.line||1,column:i&&i.column||1,offset:i&&i.offset||0};const o={},s=[];let a=[],c=[];const u={attempt:A(S),check:A(I),consume:$,enter:k,exit:P,interrupt:A(I,{interrupt:!0})},m={code:null,containerState:{},defineSkip:j,events:[],now:w,parser:e,previous:null,sliceSerialize:x,sliceStream:y,write:g};let h=n.tokenize.call(m,u);return n.resolveAll&&s.push(n),m;function g(M){return a=Id(a,M),v(),a[a.length-1]!==null?[]:(E(n,0),m.events=NP(s,m.events,m),m.events)}function x(M,R){return qke(y(M),R)}function y(M){return Hke(a,M)}function w(){const{_bufferIndex:M,_index:R,line:F,column:Y,offset:H}=r;return{_bufferIndex:M,_index:R,line:F,column:Y,offset:H}}function j(M){o[M.line]=M.column,T()}function v(){let M;for(;r._index<a.length;){const R=a[r._index];if(typeof R=="string")for(M=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===M&&r._bufferIndex<R.length;)_(R.charCodeAt(r._bufferIndex));else _(R)}}function _(M){h=h(M)}function $(M){Wn(M)?(r.line++,r.column=1,r.offset+=M===-3?2:1,T()):M!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===a[r._index].length&&(r._bufferIndex=-1,r._index++)),m.previous=M}function k(M,R){const F=R||{};return F.type=M,F.start=w(),m.events.push(["enter",F,m]),c.push(F),F}function P(M){const R=c.pop();return R.end=w(),m.events.push(["exit",R,m]),R}function S(M,R){E(M,R.from)}function I(M,R){R.restore()}function A(M,R){return F;function F(Y,H,U){let X,Q,K,G;return Array.isArray(Y)?q(Y):"tokenize"in Y?q([Y]):L(Y);function L(de){return le;function le(me){const ee=me!==null&&de[me],ne=me!==null&&de.null,Ae=[...Array.isArray(ee)?ee:ee?[ee]:[],...Array.isArray(ne)?ne:ne?[ne]:[]];return q(Ae)(me)}}function q(de){return X=de,Q=0,de.length===0?U:W(de[Q])}function W(de){return le;function le(me){return G=B(),K=de,de.partial||(m.currentConstruct=de),de.name&&m.parser.constructs.disable.null.includes(de.name)?se():de.tokenize.call(R?Object.assign(Object.create(m),R):m,u,oe,se)(me)}}function oe(de){return M(K,G),H}function se(de){return G.restore(),++Q<X.length?W(X[Q]):U}}}function E(M,R){M.resolveAll&&!s.includes(M)&&s.push(M),M.resolve&&Fc(m.events,R,m.events.length-R,M.resolve(m.events.slice(R),m)),M.resolveTo&&(m.events=M.resolveTo(m.events,m))}function B(){const M=w(),R=m.previous,F=m.currentConstruct,Y=m.events.length,H=Array.from(c);return{from:Y,restore:U};function U(){r=M,m.previous=R,m.currentConstruct=F,m.events.length=Y,c=H,T()}}function T(){r.line in o&&r.column<2&&(r.column=o[r.line],r.offset+=o[r.line]-1)}}function Hke(e,n){const i=n.start._index,r=n.start._bufferIndex,o=n.end._index,s=n.end._bufferIndex;let a;if(i===o)a=[e[i].slice(r,s)];else{if(a=e.slice(i,o),r>-1){const c=a[0];typeof c=="string"?a[0]=c.slice(r):a.shift()}s>0&&a.push(e[o].slice(0,s))}return a}function qke(e,n){let i=-1;const r=[];let o;for(;++i<e.length;){const s=e[i];let a;if(typeof s=="string")a=s;else switch(s){case-5:{a="\r";break}case-4:{a=` 2192`;break}case-3:{a=`\r 2193`;break}case-2:{a=n?" ":" ";break}case-1:{if(!n&&o)continue;a=" ";break}default:a=String.fromCharCode(s)}o=s===-2,r.push(a)}return r.join("")}function Gke(e){const r={constructs:Iie([Wke,...(e||{}).extensions||[]]),content:o(aSe),defined:[],document:o(cSe),flow:o($ke),lazy:{},string:o(Ake),text:o(Nke)};return r;function o(s){return a;function a(c){return Uke(r,s,c)}}}function Vke(e){for(;!Tie(e););return e}const BB=/[\0\t\n\r]/g;function Kke(){let e=1,n="",i=!0,r;return o;function o(s,a,c){const u=[];let m,h,g,x,y;for(s=n+(typeof s=="string"?s.toString():new TextDecoder(a||void 0).decode(s)),g=0,n="",i&&(s.charCodeAt(0)===65279&&g++,i=void 0);g<s.length;){if(BB.lastIndex=g,m=BB.exec(s),x=m&&m.index!==void 0?m.index:s.length,y=s.charCodeAt(x),!m){n=s.slice(g);break}if(y===10&&g===x&&r)u.push(-3),r=void 0;else switch(r&&(u.push(-5),r=void 0),g<x&&(u.push(s.slice(g,x)),e+=x-g),y){case 0:{u.push(65533),e++;break}case 9:{for(h=Math.ceil(e/4)*4,u.push(-2);e++<h;)u.push(-1);break}case 10:{u.push(-4),e=1;break}default:r=!0,e=1}g=x+1}return c&&(r&&u.push(-5),n&&u.push(n),u.push(null)),u}}const Yke=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Xke(e){return e.replace(Yke,Qke)}function Qke(e,n,i){if(n)return n;if(i.charCodeAt(0)===35){const o=i.charCodeAt(1),s=o===120||o===88;return Pie(i.slice(s?2:1),s?16:10)}return vM(i)||e}const Lie={}.hasOwnProperty;
vendor: 1,511 bytes, line 2193
2193function Zke(e,n,i){return typeof n!="string"&&(i=n,n=void 0),Jke(i)(Vke(Gke(i).document().write(Kke()(e,n,!0))))}function Jke(e){const n={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(tt),autolinkProtocol:B,autolinkEmail:B,atxHeading:s(ce),blockQuote:s(ne),characterEscape:B,characterReference:B,codeFenced:s(Ae),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:s(Ae,a),codeText:s(_e,a),codeTextData:B,data:B,codeFlowValue:B,definition:s(we),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:s(Ke),hardBreakEscape:s(ie),hardBreakTrailing:s(ie),htmlFlow:s(Re,a),htmlFlowData:B,htmlText:s(Re,a),htmlTextData:B,image:s(Be),label:a,link:s(tt),listItem:s(je),listItemValue:x,listOrdered:s(dt,g),listUnordered:s(dt),paragraph:s(Me),reference:W,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:s(ce),strong:s(Se),thematicBreak:s(De)},exit:{atxHeading:u(),atxHeadingSequence:S,autolink:u(),autolinkEmail:ee,autolinkProtocol:me,blockQuote:u(),characterEscapeValue:T,characterReferenceMarkerHexadecimal:se,characterReferenceMarkerNumeric:se,characterReferenceValue:de,characterReference:le,codeFenced:u(v),codeFencedFence:j,codeFencedFenceInfo:y,codeFencedFenceMeta:w,codeFlowValue:T,codeIndented:u(_),codeText:u(H),codeTextData:T,data:T,definition:u(),definitionDestinationString:P,definitionLabelString:$,definitionTitleString:k,emphasis:u(),hardBreakEscape:u(R),hardBreakTrailing:u(R
vendor: 8,994 bytes, line 2193
2193),htmlFlow:u(F),htmlFlowData:T,htmlText:u(Y),htmlTextData:T,image:u(X),label:K,labelText:Q,lineEnding:M,link:u(U),listItem:u(),listOrdered:u(),listUnordered:u(),paragraph:u(),referenceString:oe,resourceDestinationString:G,resourceTitleString:L,resource:q,setextHeading:u(E),setextHeadingLineSequence:A,setextHeadingText:I,strong:u(),thematicBreak:u()}};Bie(n,(e||{}).mdastExtensions||[]);const i={};return r;function r(te){let ge={type:"root",children:[]};const Je={stack:[ge],tokenStack:[],config:n,enter:c,exit:m,buffer:a,resume:h,data:i},Ee=[];let Xe=-1;for(;++Xe<te.length;)if(te[Xe][1].type==="listOrdered"||te[Xe][1].type==="listUnordered")if(te[Xe][0]==="enter")Ee.push(Xe);else{const yt=Ee.pop();Xe=o(te,yt,Xe)}for(Xe=-1;++Xe<te.length;){const yt=n[te[Xe][0]];Lie.call(yt,te[Xe][1].type)&&yt[te[Xe][1].type].call(Object.assign({sliceSerialize:te[Xe][2].sliceSerialize},Je),te[Xe][1])}if(Je.tokenStack.length>0){const yt=Je.tokenStack[Je.tokenStack.length-1];(yt[1]||FB).call(Je,void 0,yt[0])}for(ge.position={start:Uh(te.length>0?te[0][1].start:{line:1,column:1,offset:0}),end:Uh(te.length>0?te[te.length-2][1].end:{line:1,column:1,offset:0})},Xe=-1;++Xe<n.transforms.length;)ge=n.transforms[Xe](ge)||ge;return ge}function o(te,ge,Je){let Ee=ge-1,Xe=-1,yt=!1,Ne,Le,Ue,We;for(;++Ee<=Je;){const Qe=te[Ee];switch(Qe[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Qe[0]==="enter"?Xe++:Xe--,We=void 0;break}case"lineEndingBlank":{Qe[0]==="enter"&&(Ne&&!We&&!Xe&&!Ue&&(Ue=Ee),We=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:We=void 0}if(!Xe&&Qe[0]==="enter"&&Qe[1].type==="listItemPrefix"||Xe===-1&&Qe[0]==="exit"&&(Qe[1].type==="listUnordered"||Qe[1].type==="listOrdered")){if(Ne){let ht=Ee;for(Le=void 0;ht--;){const pe=te[ht];if(pe[1].type==="lineEnding"||pe[1].type==="lineEndingBlank"){if(pe[0]==="exit")continue;Le&&(te[Le][1].type="lineEndingBlank",yt=!0),pe[1].type="lineEnding",Le=ht}else if(!(pe[1].type==="linePrefix"||pe[1].type==="blockQuotePrefix"||pe[1].type==="blockQuotePrefixWhitespace"||pe[1].type==="blockQuoteMarker"||pe[1].type==="listItemIndent"))break}Ue&&(!Le||Ue<Le)&&(Ne._spread=!0),Ne.end=Object.assign({},Le?te[Le][1].start:Qe[1].end),te.splice(Le||Ee,0,["exit",Ne,Qe[2]]),Ee++,Je++}if(Qe[1].type==="listItemPrefix"){const ht={type:"listItem",_spread:!1,start:Object.assign({},Qe[1].start),end:void 0};Ne=ht,te.splice(Ee,0,["enter",ht,Qe[2]]),Ee++,Je++,Ue=void 0,We=!0}}}return te[ge][1]._spread=yt,Je}function s(te,ge){return Je;function Je(Ee){c.call(this,te(Ee),Ee),ge&&ge.call(this,Ee)}}function a(){this.stack.push({type:"fragment",children:[]})}function c(te,ge,Je){this.stack[this.stack.length-1].children.push(te),this.stack.push(te),this.tokenStack.push([ge,Je||void 0]),te.position={start:Uh(ge.start),end:void 0}}function u(te){return ge;function ge(Je){te&&te.call(this,Je),m.call(this,Je)}}function m(te,ge){const Je=this.stack.pop(),Ee=this.tokenStack.pop();if(Ee)Ee[0].type!==te.type&&(ge?ge.call(this,te,Ee[0]):(Ee[1]||FB).call(this,te,Ee[0]));else throw new Error("Cannot close `"+te.type+"` ("+o_({start:te.start,end:te.end})+"): itâs not open");Je.position.end=Uh(te.end)}function h(){return bM(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function x(te){if(this.data.expectingFirstListItemValue){const ge=this.stack[this.stack.length-2];ge.start=Number.parseInt(this.sliceSerialize(te),10),this.data.expectingFirstListItemValue=void 0}}function y(){const te=this.resume(),ge=this.stack[this.stack.length-1];ge.lang=te}function w(){const te=this.resume(),ge=this.stack[this.stack.length-1];ge.meta=te}function j(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function v(){const te=this.resume(),ge=this.stack[this.stack.length-1];ge.value=te.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function _(){const te=this.resume(),ge=this.stack[this.stack.length-1];ge.value=te.replace(/(\r?\n|\r)$/g,"")}function $(te){const ge=this.resume(),Je=this.stack[this.stack.length-1];Je.label=ge,Je.identifier=Cu(this.sliceSerialize(te)).toLowerCase()}function k(){const te=this.resume(),ge=this.stack[this.stack.length-1];ge.title=te}function P(){const te=this.resume(),ge=this.stack[this.stack.length-1];ge.url=te}function S(te){const ge=this.stack[this.stack.length-1];if(!ge.depth){const Je=this.sliceSerialize(te).length;ge.depth=Je}}function I(){this.data.setextHeadingSlurpLineEnding=!0}function A(te){const ge=this.stack[this.stack.length-1];ge.depth=this.sliceSerialize(te).codePointAt(0)===61?1:2}function E(){this.data.setextHeadingSlurpLineEnding=void 0}function B(te){const Je=this.stack[this.stack.length-1].children;let Ee=Je[Je.length-1];(!Ee||Ee.type!=="text")&&(Ee=it(),Ee.position={start:Uh(te.start),end:void 0},Je.push(Ee)),this.stack.push(Ee)}function T(te){const ge=this.stack.pop();ge.value+=this.sliceSerialize(te),ge.position.end=Uh(te.end)}function M(te){const ge=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Je=ge.children[ge.children.length-1];Je.position.end=Uh(te.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&n.canContainEols.includes(ge.type)&&(B.call(this,te),T.call(this,te))}function R(){this.data.atHardBreak=!0}function F(){const te=this.resume(),ge=this.stack[this.stack.length-1];ge.value=te}function Y(){const te=this.resume(),ge=this.stack[this.stack.length-1];ge.value=te}function H(){const te=this.resume(),ge=this.stack[this.stack.length-1];ge.value=te}function U(){const te=this.stack[this.stack.length-1];if(this.data.inReference){const ge=this.data.referenceType||"shortcut";te.type+="Reference",te.referenceType=ge,delete te.url,delete te.title}else delete te.identifier,delete te.label;this.data.referenceType=void 0}function X(){const te=this.stack[this.stack.length-1];if(this.data.inReference){const ge=this.data.referenceType||"shortcut";te.type+="Reference",te.referenceType=ge,delete te.url,delete te.title}else delete te.identifier,delete te.label;this.data.referenceType=void 0}function Q(te){const ge=this.sliceSerialize(te),Je=this.stack[this.stack.length-2];Je.label=Xke(ge),Je.identifier=Cu(ge).toLowerCase()}function K(){const te=this.stack[this.stack.length-1],ge=this.resume(),Je=this.stack[this.stack.length-1];if(this.data.inReference=!0,Je.type==="link"){const Ee=te.children;Je.children=Ee}else Je.alt=ge}function G(){const te=this.resume(),ge=this.stack[this.stack.length-1];ge.url=te}function L(){const te=this.resume(),ge=this.stack[this.stack.length-1];ge.title=te}function q(){this.data.inReference=void 0}function W(){this.data.referenceType="collapsed"}function oe(te){const ge=this.resume(),Je=this.stack[this.stack.length-1];Je.label=ge,Je.identifier=Cu(this.sliceSerialize(te)).toLowerCase(),this.data.referenceType="full"}function se(te){this.data.characterReferenceType=te.type}function de(te){const ge=this.sliceSerialize(te),Je=this.data.characterReferenceType;let Ee;Je?(Ee=Pie(ge,Je==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ee=vM(ge);const Xe=this.stack[this.stack.length-1];Xe.value+=Ee}function le(te){const ge=this.stack.pop();ge.position.end=Uh(te.end)}function me(te){T.call(this,te);const ge=this.stack[this.stack.length-1];ge.url=this.sliceSerialize(te)}function ee(te){T.call(this,te);const ge=this.stack[this.stack.length-1];ge.url="mailto:"+this.sliceSerialize(te)}function ne(){return{type:"blockquote",children:[]}}function Ae(){return{type:"code",lang:null,meta:null,value:""}}function _e(){return{type:"inlineCode",value:""}}function we(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ke(){return{type:"emphasis",children:[]}}function ce(){return{type:"heading",depth:0,children:[]}}function ie(){return{type:"break"}}function Re(){return{type:"html",value:""}}function Be(){return{type:"image",title:null,url:"",alt:null}}function tt(){return{type:"link",title:null,url:"",children:[]}}function dt(te){return{type:"list",ordered:te.type==="listOrdered",start:null,spread:te._spread,children:[]}}function je(te){return{type:"listItem",spread:te._spread,checked:null,children:[]}}function Me(){return{type:"paragraph",children:[]}}function Se(){return{type:"strong",children:[]}}function it(){return{type:"text",value:""}}function De(){return{type:"thematicBreak"}}}function Uh(e){return{line:e.line,column:e.column,offset:e.offset}}function Bie(e,n){let i=-1;for(;++i<n.length;){const r=n[i];Array.isArray(r)?Bie(e,r):e$e(e,r)}}function e$e(e,n){let i;for(i in n)if(Lie.call(n,i))switch(i){case"canContainEols":{const r=n[i];r&&e[i].push(...r);break}case"transforms":{const r=n[i];r&&e[i].push(...r);break}case"enter":case"exit":{const r=n[i];r&&Object.assign(e[i],r);break}}}function FB(e,n){throw e?new Error("Cannot close `"+e.type+"` ("+o_({start:e.start,end:e.end})+"): a different token (`"+n.type+"`, "+o_({start:n.start,end:n.end}
vendor: 4,302 bytes, lines 2193-2196
2193)+") is open"):new Error("Cannot close document, a token (`"+n.type+"`, "+o_({start:n.start,end:n.end})+") is still open")}function t$e(e){const n=this;n.parser=i;function i(r){return Zke(r,{...n.data("settings"),...e,extensions:n.data("micromarkExtensions")||[],mdastExtensions:n.data("fromMarkdownExtensions")||[]})}}function n$e(e,n){const i={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(n),!0)};return e.patch(n,i),e.applyData(n,i)}function i$e(e,n){const i={type:"element",tagName:"br",properties:{},children:[]};return e.patch(n,i),[e.applyData(n,i),{type:"text",value:` 2194`}]}function r$e(e,n){const i=n.value?n.value+` 2195`:"",r={},o=n.lang?n.lang.split(/\s+/):[];o.length>0&&(r.className=["language-"+o[0]]);let s={type:"element",tagName:"code",properties:r,children:[{type:"text",value:i}]};return n.meta&&(s.data={meta:n.meta}),e.patch(n,s),s=e.applyData(n,s),s={type:"element",tagName:"pre",properties:{},children:[s]},e.patch(n,s),s}function o$e(e,n){const i={type:"element",tagName:"del",properties:{},children:e.all(n)};return e.patch(n,i),e.applyData(n,i)}function s$e(e,n){const i={type:"element",tagName:"em",properties:{},children:e.all(n)};return e.patch(n,i),e.applyData(n,i)}function a$e(e,n){const i=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(n.identifier).toUpperCase(),o=d1(r.toLowerCase()),s=e.footnoteOrder.indexOf(r);let a,c=e.footnoteCounts.get(r);c===void 0?(c=0,e.footnoteOrder.push(r),a=e.footnoteOrder.length):a=s+1,c+=1,e.footnoteCounts.set(r,c);const u={type:"element",tagName:"a",properties:{href:"#"+i+"fn-"+o,id:i+"fnref-"+o+(c>1?"-"+c:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};e.patch(n,u);const m={type:"element",tagName:"sup",properties:{},children:[u]};return e.patch(n,m),e.applyData(n,m)}function l$e(e,n){const i={type:"element",tagName:"h"+n.depth,properties:{},children:e.all(n)};return e.patch(n,i),e.applyData(n,i)}function c$e(e,n){if(e.options.allowDangerousHtml){const i={type:"raw",value:n.value};return e.patch(n,i),e.applyData(n,i)}}function Fie(e,n){const i=n.referenceType;let r="]";if(i==="collapsed"?r+="[]":i==="full"&&(r+="["+(n.label||n.identifier)+"]"),n.type==="imageReference")return[{type:"text",value:"!["+n.alt+r}];const o=e.all(n),s=o[0];s&&s.type==="text"?s.value="["+s.value:o.unshift({type:"text",value:"["});const a=o[o.length-1];return a&&a.type==="text"?a.value+=r:o.push({type:"text",value:r}),o}function d$e(e,n){const i=String(n.identifier).toUpperCase(),r=e.definitionById.get(i);if(!r)return Fie(e,n);const o={src:d1(r.url||""),alt:n.alt};r.title!==null&&r.title!==void 0&&(o.title=r.title);const s={type:"element",tagName:"img",properties:o,children:[]};return e.patch(n,s),e.applyData(n,s)}function u$e(e,n){const i={src:d1(n.url)};n.alt!==null&&n.alt!==void 0&&(i.alt=n.alt),n.title!==null&&n.title!==void 0&&(i.title=n.title);const r={type:"element",tagName:"img",properties:i,children:[]};return e.patch(n,r),e.applyData(n,r)}function p$e(e,n){const i={type:"text",value:n.value.replace(/\r?\n|\r/g," ")};e.patch(n,i);const r={type:"element",tagName:"code",properties:{},children:[i]};return e.patch(n,r),e.applyData(n,r)}function m$e(e,n){const i=String(n.identifier).toUpperCase(),r=e.definitionById.get(i);if(!r)return Fie(e,n);const o={href:d1(r.url||"")};r.title!==null&&r.title!==void 0&&(o.title=r.title);const s={type:"element",tagName:"a",properties:o,children:e.all(n)};return e.patch(n,s),e.applyData(n,s)}function h$e(e,n){const i={href:d1(n.url)};n.title!==null&&n.title!==void 0&&(i.title=n.title);const r={type:"element",tagName:"a",properties:i,children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function f$e(e,n,i){const r=e.all(n),o=i?g$e(i):Wie(n),s={},a=[];if(typeof n.checked=="boolean"){const h=r[0];let g;h&&h.type==="element"&&h.tagName==="p"?g=h:(g={type:"element",tagName:"p",properties:{},children:[]},r.unshift(g)),g.children.length>0&&g.children.unshift({type:"text",value:" "}),g.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:n.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let c=-1;for(;++c<r.length;){const h=r[c];(o||c!==0||h.type!=="element"||h.tagName!=="p")&&a.push({type:"text",value:` 2196`}
vendor: 4,090 bytes, lines 2196-2197
2196),h.type==="element"&&h.tagName==="p"&&!o?a.push(...h.children):a.push(h)}const u=r[r.length-1];u&&(o||u.type!=="element"||u.tagName!=="p")&&a.push({type:"text",value:` 2197`});const m={type:"element",tagName:"li",properties:s,children:a};return e.patch(n,m),e.applyData(n,m)}function g$e(e){let n=!1;if(e.type==="list"){n=e.spread||!1;const i=e.children;let r=-1;for(;!n&&++r<i.length;)n=Wie(i[r])}return n}function Wie(e){const n=e.spread;return n??e.children.length>1}function y$e(e,n){const i={},r=e.all(n);let o=-1;for(typeof n.start=="number"&&n.start!==1&&(i.start=n.start);++o<r.length;){const a=r[o];if(a.type==="element"&&a.tagName==="li"&&a.properties&&Array.isArray(a.properties.className)&&a.properties.className.includes("task-list-item")){i.className=["contains-task-list"];break}}const s={type:"element",tagName:n.ordered?"ol":"ul",properties:i,children:e.wrap(r,!0)};return e.patch(n,s),e.applyData(n,s)}function x$e(e,n){const i={type:"element",tagName:"p",properties:{},children:e.all(n)};return e.patch(n,i),e.applyData(n,i)}function b$e(e,n){const i={type:"root",children:e.wrap(e.all(n))};return e.patch(n,i),e.applyData(n,i)}function v$e(e,n){const i={type:"element",tagName:"strong",properties:{},children:e.all(n)};return e.patch(n,i),e.applyData(n,i)}function w$e(e,n){const i=e.all(n),r=i.shift(),o=[];if(r){const a={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(n.children[0],a),o.push(a)}if(i.length>0){const a={type:"element",tagName:"tbody",properties:{},children:e.wrap(i,!0)},c=fM(n.children[1]),u=wie(n.children[n.children.length-1]);c&&u&&(a.position={start:c,end:u}),o.push(a)}const s={type:"element",tagName:"table",properties:{},children:e.wrap(o,!0)};return e.patch(n,s),e.applyData(n,s)}function j$e(e,n,i){const r=i?i.children:void 0,s=(r?r.indexOf(n):1)===0?"th":"td",a=i&&i.type==="table"?i.align:void 0,c=a?a.length:n.children.length;let u=-1;const m=[];for(;++u<c;){const g=n.children[u],x={},y=a?a[u]:void 0;y&&(x.align=y);let w={type:"element",tagName:s,properties:x,children:[]};g&&(w.children=e.all(g),e.patch(g,w),w=e.applyData(g,w)),m.push(w)}const h={type:"element",tagName:"tr",properties:{},children:e.wrap(m,!0)};return e.patch(n,h),e.applyData(n,h)}function _$e(e,n){const i={type:"element",tagName:"td",properties:{},children:e.all(n)};return e.patch(n,i),e.applyData(n,i)}const WB=9,UB=32;function C$e(e){const n=String(e),i=/\r?\n|\r/g;let r=i.exec(n),o=0;const s=[];for(;r;)s.push(HB(n.slice(o,r.index),o>0,!0),r[0]),o=r.index+r[0].length,r=i.exec(n);return s.push(HB(n.slice(o),o>0,!1)),s.join("")}function HB(e,n,i){let r=0,o=e.length;if(n){let s=e.codePointAt(r);for(;s===WB||s===UB;)r++,s=e.codePointAt(r)}if(i){let s=e.codePointAt(o-1);for(;s===WB||s===UB;)o--,s=e.codePointAt(o-1)}return o>r?e.slice(r,o):""}function S$e(e,n){const i={type:"text",value:C$e(String(n.value))};return e.patch(n,i),e.applyData(n,i)}function k$e(e,n){const i={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(n,i),e.applyData(n,i)}const $$e={blockquote:n$e,break:i$e,code:r$e,delete:o$e,emphasis:s$e,footnoteReference:a$e,heading:l$e,html:c$e,imageReference:d$e,image:u$e,inlineCode:p$e,linkReference:m$e,link:h$e,listItem:f$e,list:y$e,paragraph:x$e,root:b$e,strong:v$e,table:w$e,tableCell:_$e,tableRow:j$e,text:S$e,thematicBreak:k$e,toml:bk,yaml:bk,definition:bk,footnoteDefinition:bk};function bk(){}const Uie=-1,zP=0,a_=1,V5=2,jM=3,_M=4,CM=5,SM=6,Hie=7,qie=8,qB=typeof self=="object"?self:globalThis,I$e=(e,n)=>{const i=(o,s)=>(e.set(s,o),o),r=o=>{if(e.has(o))return e.get(o);const[s,a]=n[o];switch(s){case zP:case Uie:return i(a,o);case a_:{const c=i([],o);for(const u of a)c.push(r(u));return c}case V5:{const c=i({},o);for(const[u,m]of a)c[r(u)]=r(m);return c}case jM:return i(new Date(a),o);case _M:{const{source:c,flags:u}=a;return i(new RegExp(c,u),o)}case CM:{const c=i(new Map,o);for(const[u,m]of a)c.set(r(u),r(m));return c}case SM:{const c=i(new Set,o);for(const u of a)c.add(r(u));return c}case Hie:{const{name:c,message:u}=a;return i(new qB[c](u),o)}case qie:return i(BigInt(a),o);
vendor: 4,787 bytes, lines 2197-2199
2197case"BigInt":return i(Object(BigInt(a)),o);case"ArrayBuffer":return i(new Uint8Array(a).buffer,a);case"DataView":{const{buffer:c}=new Uint8Array(a);return i(new DataView(c),a)}}return i(new qB[s](a),o)};return r},GB=e=>I$e(new Map,e)(0),sx="",{toString:P$e}={},{keys:A$e}=Object,hw=e=>{const n=typeof e;if(n!=="object"||!e)return[zP,n];const i=P$e.call(e).slice(8,-1);switch(i){case"Array":return[a_,sx];case"Object":return[V5,sx];case"Date":return[jM,sx];case"RegExp":return[_M,sx];case"Map":return[CM,sx];case"Set":return[SM,sx];case"DataView":return[a_,i]}return i.includes("Array")?[a_,i]:i.includes("Error")?[Hie,i]:[V5,i]},vk=([e,n])=>e===zP&&(n==="function"||n==="symbol"),N$e=(e,n,i,r)=>{const o=(a,c)=>{const u=r.push(a)-1;return i.set(c,u),u},s=a=>{if(i.has(a))return i.get(a);let[c,u]=hw(a);switch(c){case zP:{let h=a;switch(u){case"bigint":c=qie,h=a.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+u);h=null;break;case"undefined":return o([Uie],a)}return o([c,h],a)}case a_:{if(u){let x=a;return u==="DataView"?x=new Uint8Array(a.buffer):u==="ArrayBuffer"&&(x=new Uint8Array(a)),o([u,[...x]],a)}const h=[],g=o([c,h],a);for(const x of a)h.push(s(x));return g}case V5:{if(u)switch(u){case"BigInt":return o([u,a.toString()],a);case"Boolean":case"Number":case"String":return o([u,a.valueOf()],a)}if(n&&"toJSON"in a)return s(a.toJSON());const h=[],g=o([c,h],a);for(const x of A$e(a))(e||!vk(hw(a[x])))&&h.push([s(x),s(a[x])]);return g}case jM:return o([c,a.toISOString()],a);case _M:{const{source:h,flags:g}=a;return o([c,{source:h,flags:g}],a)}case CM:{const h=[],g=o([c,h],a);for(const[x,y]of a)(e||!(vk(hw(x))||vk(hw(y))))&&h.push([s(x),s(y)]);return g}case SM:{const h=[],g=o([c,h],a);for(const x of a)(e||!vk(hw(x)))&&h.push(s(x));return g}}const{message:m}=a;return o([c,{name:u,message:m}],a)};return s},VB=(e,{json:n,lossy:i}={})=>{const r=[];return N$e(!(n||i),!!n,new Map,r)(e),r},K5=typeof structuredClone=="function"?(e,n)=>n&&("json"in n||"lossy"in n)?GB(VB(e,n)):structuredClone(e):(e,n)=>GB(VB(e,n));function z$e(e,n){const i=[{type:"text",value:"â©"}];return n>1&&i.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(n)}]}),i}function T$e(e,n){return"Back to reference "+(e+1)+(n>1?"-"+n:"")}function E$e(e){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",i=e.options.footnoteBackContent||z$e,r=e.options.footnoteBackLabel||T$e,o=e.options.footnoteLabel||"Footnotes",s=e.options.footnoteLabelTagName||"h2",a=e.options.footnoteLabelProperties||{className:["sr-only"]},c=[];let u=-1;for(;++u<e.footnoteOrder.length;){const m=e.footnoteById.get(e.footnoteOrder[u]);if(!m)continue;const h=e.all(m),g=String(m.identifier).toUpperCase(),x=d1(g.toLowerCase());let y=0;const w=[],j=e.footnoteCounts.get(g);for(;j!==void 0&&++y<=j;){w.length>0&&w.push({type:"text",value:" "});let $=typeof i=="string"?i:i(u,y);typeof $=="string"&&($={type:"text",value:$}),w.push({type:"element",tagName:"a",properties:{href:"#"+n+"fnref-"+x+(y>1?"-"+y:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(u,y),className:["data-footnote-backref"]},children:Array.isArray($)?$:[$]})}const v=h[h.length-1];if(v&&v.type==="element"&&v.tagName==="p"){const $=v.children[v.children.length-1];$&&$.type==="text"?$.value+=" ":v.children.push({type:"text",value:" "}),v.children.push(...w)}else h.push(...w);const _={type:"element",tagName:"li",properties:{id:n+"fn-"+x},children:e.wrap(h,!0)};e.patch(m,_),c.push(_)}if(c.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...K5(a),id:"footnote-label"},children:[{type:"text",value:o}]},{type:"text",value:` 2198`},{type:"element",tagName:"ol",properties:{},children:e.wrap(c,!0)},{type:"text",value:` 2199`}]}}const TP=(function(e){if(e==null)return D$e;if(typeof e=="function")return EP(e);if(typeof e=="object")return Array.isArray(e)?M$e(e):R$e(e);if(typeof e=="string")return O$e(e);throw new Error("Expected function, string, or object as test")});function M$e(e){const n=[];let i=-1;for(;++i<e.length;)n[i]=TP(e[i]);return EP(r);function r(...o){let s=-1;for(;++s<n.length;)if(n[s].apply(this,o))return!0;return!1}}function R$e(e){const n=e;return EP(i);function i(r){const o=r;let s;for(s in e)if(o[s]!==n[s])return!1;return!0}}function O$e(e){return EP(n);function n(i){return i&&i.type===e}}function EP(e){return n;function n(i,r,o){return!!(L$e(i)&&e.call(this,i,typeof r=="number"?r:void 0,o||void 0))}}function D$e(){return!0}function L$e(e){return e!==null&&typeof e=="object"&&"type"in e}const Gie=[],B$e=!0,e3=!1,F$e="skip";function Vie(e,n,i,r){let o;typeof n=="function"&&typeof i!="function"?(r=i,i=n):o=n;
vendor: 4,661 bytes, lines 2199-2203
2199const s=TP(o),a=r?-1:1;c(e,void 0,[])();function c(u,m,h){const g=u&&typeof u=="object"?u:{};if(typeof g.type=="string"){const y=typeof g.tagName=="string"?g.tagName:typeof g.name=="string"?g.name:void 0;Object.defineProperty(x,"name",{value:"node ("+(u.type+(y?"<"+y+">":""))+")"})}return x;function x(){let y=Gie,w,j,v;if((!n||s(u,m,h[h.length-1]||void 0))&&(y=W$e(i(u,h)),y[0]===e3))return y;if("children"in u&&u.children){const _=u;if(_.children&&y[0]!==F$e)for(j=(r?_.children.length:-1)+a,v=h.concat(_);j>-1&&j<_.children.length;){const $=_.children[j];if(w=c($,j,v)(),w[0]===e3)return w;j=typeof w[1]=="number"?w[1]:j+a}}return y}}}function W$e(e){return Array.isArray(e)?e:typeof e=="number"?[B$e,e]:e==null?Gie:[e]}function kM(e,n,i,r){let o,s,a;typeof n=="function"&&typeof i!="function"?(s=void 0,a=n,o=i):(s=n,a=i,o=r),Vie(e,s,c,o);function c(u,m){const h=m[m.length-1],g=h?h.children.indexOf(u):void 0;return a(u,g,h)}}const t3={}.hasOwnProperty,U$e={};function H$e(e,n){const i=n||U$e,r=new Map,o=new Map,s=new Map,a={...$$e,...i.handlers},c={all:m,applyData:G$e,definitionById:r,footnoteById:o,footnoteCounts:s,footnoteOrder:[],handlers:a,one:u,options:i,patch:q$e,wrap:K$e};return kM(e,function(h){if(h.type==="definition"||h.type==="footnoteDefinition"){const g=h.type==="definition"?r:o,x=String(h.identifier).toUpperCase();g.has(x)||g.set(x,h)}}),c;function u(h,g){const x=h.type,y=c.handlers[x];if(t3.call(c.handlers,x)&&y)return y(c,h,g);if(c.options.passThrough&&c.options.passThrough.includes(x)){if("children"in h){const{children:j,...v}=h,_=K5(v);return _.children=c.all(h),_}return K5(h)}return(c.options.unknownHandler||V$e)(c,h,g)}function m(h){const g=[];if("children"in h){const x=h.children;let y=-1;for(;++y<x.length;){const w=c.one(x[y],h);if(w){if(y&&x[y-1].type==="break"&&(!Array.isArray(w)&&w.type==="text"&&(w.value=KB(w.value)),!Array.isArray(w)&&w.type==="element")){const j=w.children[0];j&&j.type==="text"&&(j.value=KB(j.value))}Array.isArray(w)?g.push(...w):g.push(w)}}}return g}}function q$e(e,n){e.position&&(n.position=TCe(e))}function G$e(e,n){let i=n;if(e&&e.data){const r=e.data.hName,o=e.data.hChildren,s=e.data.hProperties;if(typeof r=="string")if(i.type==="element")i.tagName=r;else{const a="children"in i?i.children:[i];i={type:"element",tagName:r,properties:{},children:a}}i.type==="element"&&s&&Object.assign(i.properties,K5(s)),"children"in i&&i.children&&o!==null&&o!==void 0&&(i.children=o)}return i}function V$e(e,n){const i=n.data||{},r="value"in n&&!(t3.call(i,"hProperties")||t3.call(i,"hChildren"))?{type:"text",value:n.value}:{type:"element",tagName:"div",properties:{},children:e.all(n)};return e.patch(n,r),e.applyData(n,r)}function K$e(e,n){const i=[];let r=-1;for(n&&i.push({type:"text",value:` 2200`});++r<e.length;)r&&i.push({type:"text",value:` 2201`}),i.push(e[r]);return n&&e.length>0&&i.push({type:"text",value:` 2202`}),i}function KB(e){let n=0,i=e.charCodeAt(n);for(;i===9||i===32;)n++,i=e.charCodeAt(n);return e.slice(n)}function YB(e,n){const i=H$e(e,n),r=i.one(e,void 0),o=E$e(i),s=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return o&&s.children.push({type:"text",value:` 2203`},o),s}function Y$e(e,n){return e&&"run"in e?async function(i,r){const o=YB(i,{file:r,...n});await e.run(o,r)}:function(i,r){return YB(i,{file:r,...e||n})}}function XB(e){if(e)throw e}var cz,QB;function X$e(){if(QB)return cz;QB=1;var e=Object.prototype.hasOwnProperty,n=Object.prototype.toString,i=Object.defineProperty,r=Object.getOwnPropertyDescriptor,o=function(m){return typeof Array.isArray=="function"?Array.isArray(m):n.call(m)==="[object Array]"},s=function(m){if(!m||n.call(m)!=="[object Object]")return!1;var h=e.call(m,"constructor"),g=m.constructor&&m.constructor.prototype&&e.call(m.constructor.prototype,"isPrototypeOf");if(m.constructor&&!h&&!g)return!1;var x;for(x in m);return typeof x>"u"||e.call(m,x)},a=function(m,h){i&&h.name==="__proto__"?i(m,h.name,{enumerable:!0,configurable:!0,value:h.newValue,writable:!0}):m[h.name]=h.newValue},c=function(m,h){if(h==="__proto__")if(e.call(m,h)){if(r)return r(m,h).value}else return;return m[h]};return cz=function u(){var m,h,g,x,y,w,j=arguments[0],v=1,_=arguments.length,$=!1;for(typeof j=="boolean"&&($=j,j=arguments[1]||{},v=2),(j==null||typeof j!="object"&&typeof j!="function")&&(j={});v<_;++v)if(m=arguments[v],m!=null)for(h in m)g=c(j,h),x=c(m,h),j!==x&&($&&x&&(s(x)||(y=o(x)))?(y?(y=!1,w=g&&o(g)?g:[]):w=g&&s(g)?g:{},a(j,{name:h,newValue:u($,w,x)})):typeof x<"u"&&a(j,{name:h,newValue:x}));return j},cz}var Q$e=X$e();const dz=Tu(Q$e);function n3(e){if(typeof e!="object"||e===null)return!1;const n=Object.getPrototypeOf(e);
vendor: 4,106 bytes, line 2203
2203return(n===null||n===Object.prototype||Object.getPrototypeOf(n)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function Z$e(){const e=[],n={run:i,use:r};return n;function i(...o){let s=-1;const a=o.pop();if(typeof a!="function")throw new TypeError("Expected function as last argument, not "+a);c(null,...o);function c(u,...m){const h=e[++s];let g=-1;if(u){a(u);return}for(;++g<o.length;)(m[g]===null||m[g]===void 0)&&(m[g]=o[g]);o=m,h?J$e(h,c)(...m):a(null,...m)}}function r(o){if(typeof o!="function")throw new TypeError("Expected `middelware` to be a function, not "+o);return e.push(o),n}}function J$e(e,n){let i;return r;function r(...a){const c=e.length>a.length;let u;c&&a.push(o);try{u=e.apply(this,a)}catch(m){const h=m;if(c&&i)throw h;return o(h)}c||(u&&u.then&&typeof u.then=="function"?u.then(s,o):u instanceof Error?o(u):s(u))}function o(a,...c){i||(i=!0,n(a,...c))}function s(a){o(null,a)}}const bp={basename:e2e,dirname:t2e,extname:n2e,join:i2e,sep:"/"};function e2e(e,n){if(n!==void 0&&typeof n!="string")throw new TypeError('"ext" argument must be a string');iC(e);let i=0,r=-1,o=e.length,s;if(n===void 0||n.length===0||n.length>e.length){for(;o--;)if(e.codePointAt(o)===47){if(s){i=o+1;break}}else r<0&&(s=!0,r=o+1);return r<0?"":e.slice(i,r)}if(n===e)return"";let a=-1,c=n.length-1;for(;o--;)if(e.codePointAt(o)===47){if(s){i=o+1;break}}else a<0&&(s=!0,a=o+1),c>-1&&(e.codePointAt(o)===n.codePointAt(c--)?c<0&&(r=o):(c=-1,r=a));return i===r?r=a:r<0&&(r=e.length),e.slice(i,r)}function t2e(e){if(iC(e),e.length===0)return".";let n=-1,i=e.length,r;for(;--i;)if(e.codePointAt(i)===47){if(r){n=i;break}}else r||(r=!0);return n<0?e.codePointAt(0)===47?"/":".":n===1&&e.codePointAt(0)===47?"//":e.slice(0,n)}function n2e(e){iC(e);let n=e.length,i=-1,r=0,o=-1,s=0,a;for(;n--;){const c=e.codePointAt(n);if(c===47){if(a){r=n+1;break}continue}i<0&&(a=!0,i=n+1),c===46?o<0?o=n:s!==1&&(s=1):o>-1&&(s=-1)}return o<0||i<0||s===0||s===1&&o===i-1&&o===r+1?"":e.slice(o,i)}function i2e(...e){let n=-1,i;for(;++n<e.length;)iC(e[n]),e[n]&&(i=i===void 0?e[n]:i+"/"+e[n]);return i===void 0?".":r2e(i)}function r2e(e){iC(e);const n=e.codePointAt(0)===47;let i=o2e(e,!n);return i.length===0&&!n&&(i="."),i.length>0&&e.codePointAt(e.length-1)===47&&(i+="/"),n?"/"+i:i}function o2e(e,n){let i="",r=0,o=-1,s=0,a=-1,c,u;for(;++a<=e.length;){if(a<e.length)c=e.codePointAt(a);else{if(c===47)break;c=47}if(c===47){if(!(o===a-1||s===1))if(o!==a-1&&s===2){if(i.length<2||r!==2||i.codePointAt(i.length-1)!==46||i.codePointAt(i.length-2)!==46){if(i.length>2){if(u=i.lastIndexOf("/"),u!==i.length-1){u<0?(i="",r=0):(i=i.slice(0,u),r=i.length-1-i.lastIndexOf("/")),o=a,s=0;continue}}else if(i.length>0){i="",r=0,o=a,s=0;continue}}n&&(i=i.length>0?i+"/..":"..",r=2)}else i.length>0?i+="/"+e.slice(o+1,a):i=e.slice(o+1,a),r=a-o-1;o=a,s=0}else c===46&&s>-1?s++:s=-1}return i}function iC(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const s2e={cwd:a2e};function a2e(){return"/"}function i3(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function l2e(e){if(typeof e=="string")e=new URL(e);else if(!i3(e)){const n=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw n.code="ERR_INVALID_ARG_TYPE",n}if(e.protocol!=="file:"){const n=new TypeError("The URL must be of scheme file");throw n.code="ERR_INVALID_URL_SCHEME",n}return c2e(e)}function c2e(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const n=e.pathname;let i=-1;for(;++i<n.length;)if(n.codePointAt(i)===37&&n.codePointAt(i+1)===50){const r=n.codePointAt(i+2);if(r===70||r===102){const o=new TypeError("File URL path must not include encoded / characters");throw o.code="ERR_INVALID_FILE_URL_PATH",o}}return decodeURIComponent(n)}const uz=["history","path","basename","stem","extname","dirname"];class Kie{constructor(n){let i;n?i3(n)?i={path:n}:typeof n=="string"||d2e(n)?i={value:n}:i=n:i={}
vendor: 14,503 bytes, lines 2203-2204
2203,this.cwd="cwd"in i?"":s2e.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<uz.length;){const s=uz[r];s in i&&i[s]!==void 0&&i[s]!==null&&(this[s]=s==="history"?[...i[s]]:i[s])}let o;for(o in i)uz.includes(o)||(this[o]=i[o])}get basename(){return typeof this.path=="string"?bp.basename(this.path):void 0}set basename(n){mz(n,"basename"),pz(n,"basename"),this.path=bp.join(this.dirname||"",n)}get dirname(){return typeof this.path=="string"?bp.dirname(this.path):void 0}set dirname(n){ZB(this.basename,"dirname"),this.path=bp.join(n||"",this.basename)}get extname(){return typeof this.path=="string"?bp.extname(this.path):void 0}set extname(n){if(pz(n,"extname"),ZB(this.dirname,"extname"),n){if(n.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(n.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=bp.join(this.dirname,this.stem+(n||""))}get path(){return this.history[this.history.length-1]}set path(n){i3(n)&&(n=l2e(n)),mz(n,"path"),this.path!==n&&this.history.push(n)}get stem(){return typeof this.path=="string"?bp.basename(this.path,this.extname):void 0}set stem(n){mz(n,"stem"),pz(n,"stem"),this.path=bp.join(this.dirname||"",n+(this.extname||""))}fail(n,i,r){const o=this.message(n,i,r);throw o.fatal=!0,o}info(n,i,r){const o=this.message(n,i,r);return o.fatal=void 0,o}message(n,i,r){const o=new Ua(n,i,r);return this.path&&(o.name=this.path+":"+o.name,o.file=this.path),o.fatal=!1,this.messages.push(o),o}toString(n){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(n||void 0).decode(this.value)}}function pz(e,n){if(e&&e.includes(bp.sep))throw new Error("`"+n+"` cannot be a path: did not expect `"+bp.sep+"`")}function mz(e,n){if(!e)throw new Error("`"+n+"` cannot be empty")}function ZB(e,n){if(!e)throw new Error("Setting `"+n+"` requires `path` to be set too")}function d2e(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const u2e=(function(e){const r=this.constructor.prototype,o=r[e],s=function(){return o.apply(s,arguments)};return Object.setPrototypeOf(s,r),s}),p2e={}.hasOwnProperty;class $M extends u2e{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=Z$e()}copy(){const n=new $M;let i=-1;for(;++i<this.attachers.length;){const r=this.attachers[i];n.use(...r)}return n.data(dz(!0,{},this.namespace)),n}data(n,i){return typeof n=="string"?arguments.length===2?(gz("data",this.frozen),this.namespace[n]=i,this):p2e.call(this.namespace,n)&&this.namespace[n]||void 0:n?(gz("data",this.frozen),this.namespace=n,this):this.namespace}freeze(){if(this.frozen)return this;const n=this;for(;++this.freezeIndex<this.attachers.length;){const[i,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const o=i.call(n,...r);typeof o=="function"&&this.transformers.use(o)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(n){this.freeze();const i=wk(n),r=this.parser||this.Parser;return hz("parse",r),r(String(i),i)}process(n,i){const r=this;return this.freeze(),hz("process",this.parser||this.Parser),fz("process",this.compiler||this.Compiler),i?o(void 0,i):new Promise(o);function o(s,a){const c=wk(n),u=r.parse(c);r.run(u,c,function(h,g,x){if(h||!g||!x)return m(h);const y=g,w=r.stringify(y,x);f2e(w)?x.value=w:x.result=w,m(h,x)});function m(h,g){h||!g?a(h):s?s(g):i(void 0,g)}}}processSync(n){let i=!1,r;return this.freeze(),hz("processSync",this.parser||this.Parser),fz("processSync",this.compiler||this.Compiler),this.process(n,o),eF("processSync","process",i),r;function o(s,a){i=!0,XB(s),r=a}}run(n,i,r){JB(n),this.freeze();const o=this.transformers;return!r&&typeof i=="function"&&(r=i,i=void 0),r?s(void 0,r):new Promise(s);function s(a,c){const u=wk(i);o.run(n,u,m);function m(h,g,x){const y=g||n;h?c(h):a?a(y):r(void 0,y,x)}}}runSync(n,i){let r=!1,o;return this.run(n,i,s),eF("runSync","run",r),o;function s(a,c){XB(a),o=c,r=!0}}stringify(n,i){this.freeze();const r=wk(i),o=this.compiler||this.Compiler;return fz("stringify",o),JB(n),o(n,r)}use(n,...i){const r=this.attachers,o=this.namespace;if(gz("use",this.frozen),n!=null)if(typeof n=="function")u(n,i);else if(typeof n=="object")Array.isArray(n)?c(n):a(n);else throw new TypeError("Expected usable value, not `"+n+"`");return this;function s(m){if(typeof m=="function")u(m,[]);else if(typeof m=="object")if(Array.isArray(m)){const[h,...g]=m;u(h,g)}else a(m);else throw new TypeError("Expected usable value, not `"+m+"`")}function a(m){if(!("plugins"in m)&&!("settings"in m))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");c(m.plugins),m.settings&&(o.settings=dz(!0,o.settings,m.settings))}function c(m){let h=-1;if(m!=null)if(Array.isArray(m))for(;++h<m.length;){const g=m[h];s(g)}else throw new TypeError("Expected a list of plugins, not `"+m+"`")}function u(m,h){let g=-1,x=-1;for(;++g<r.length;)if(r[g][0]===m){x=g;break}if(x===-1)r.push([m,...h]);else if(h.length>0){let[y,...w]=h;const j=r[x][1];n3(j)&&n3(y)&&(y=dz(!0,j,y)),r[x]=[m,y,...w]}}}}const m2e=new $M().freeze();function hz(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function fz(e,n){if(typeof n!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function gz(e,n){if(n)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function JB(e){if(!n3(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function eF(e,n,i){if(!i)throw new Error("`"+e+"` finished async. Use `"+n+"` instead")}function wk(e){return h2e(e)?e:new Kie(e)}function h2e(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function f2e(e){return typeof e=="string"||g2e(e)}function g2e(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const y2e="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",tF=[],nF={allowDangerousHtml:!0},x2e=/^(https?|ircs?|mailto|xmpp)$/i,b2e=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function rb(e){const n=v2e(e),i=w2e(e);return j2e(n.runSync(n.parse(i),i),e)}function v2e(e){const n=e.rehypePlugins||tF,i=e.remarkPlugins||tF,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...nF}:nF;return m2e().use(t$e).use(i).use(Y$e,r).use(n)}function w2e(e){const n=e.children||"",i=new Kie;return typeof n=="string"&&(i.value=n),i}function j2e(e,n){const i=n.allowedElements,r=n.allowElement,o=n.components,s=n.disallowedElements,a=n.skipHtml,c=n.unwrapDisallowed,u=n.urlTransform||_2e;for(const h of b2e)Object.hasOwn(n,h.from)&&(""+h.from+(h.to?"use `"+h.to+"` instead":"remove it")+y2e+h.id,void 0);return kM(e,m),DCe(e,{Fragment:t.Fragment,components:o,ignoreInvalidStyle:!0,jsx:t.jsx,jsxs:t.jsxs,passKeys:!0,passNode:!0});function m(h,g,x){if(h.type==="raw"&&x&&typeof g=="number")return a?x.children.splice(g,1):x.children[g]={type:"text",value:h.value},g;if(h.type==="element"){let y;for(y in sz)if(Object.hasOwn(sz,y)&&Object.hasOwn(h.properties,y)){const w=h.properties[y],j=sz[y];(j===null||j.includes(h.tagName))&&(h.properties[y]=u(String(w||""),y,h))}}if(h.type==="element"){let y=i?!i.includes(h.tagName):s?s.includes(h.tagName):!1;if(!y&&r&&typeof g=="number"&&(y=!r(h,g,x)),y&&x&&typeof g=="number")return c&&h.children?x.children.splice(g,1,...h.children):x.children.splice(g,1),g}}}function _2e(e){const n=e.indexOf(":"),i=e.indexOf("?"),r=e.indexOf("#"),o=e.indexOf("/");return n===-1||o!==-1&&n>o||i!==-1&&n>i||r!==-1&&n>r||x2e.test(e.slice(0,n))?e:""}function iF(e,n){const i=String(e);if(typeof n!="string")throw new TypeError("Expected character");let r=0,o=i.indexOf(n);for(;o!==-1;)r++,o=i.indexOf(n,o+n.length);return r}function C2e(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function S2e(e,n,i){const o=TP((i||{}).ignore||[]),s=k2e(n);let a=-1;for(;++a<s.length;)Vie(e,"text",c);function c(m,h){let g=-1,x;for(;++g<h.length;){const y=h[g],w=x?x.children:void 0;if(o(y,w?w.indexOf(y):void 0,x))return;x=y}if(x)return u(m,h)}function u(m,h){const g=h[h.length-1],x=s[a][0],y=s[a][1];let w=0;const v=g.children.indexOf(m);let _=!1,$=[];x.lastIndex=0;let k=x.exec(m.value);for(;k;){const P=k.index,S={index:k.index,input:k.input,stack:[...h,m]};let I=y(...k,S);if(typeof I=="string"&&(I=I.length>0?{type:"text",value:I}:void 0),I===!1?x.lastIndex=P+1:(w!==P&&$.push({type:"text",value:m.value.slice(w,P)}),Array.isArray(I)?$.push(...I):I&&$.push(I),w=P+k[0].length,_=!0),!x.global)break;k=x.exec(m.value)}return _?(w<m.value.length&&$.push({type:"text",value:m.value.slice(w)}),g.children.splice(v,1,...$)):$=[m],v+$.length}}function k2e(e){const n=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const i=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<i.length;){const o=i[r];n.push([$2e(o[0]),I2e(o[1])])}return n}function $2e(e){return typeof e=="string"?new RegExp(C2e(e),"g"):e}function I2e(e){return typeof e=="function"?e:function(){return e}}const yz="phrasing",xz=["autolink","link","image","label"];function P2e(){return{transforms:[R2e],enter:{literalAutolink:N2e,literalAutolinkEmail:bz,literalAutolinkHttp:bz,literalAutolinkWww:bz},exit:{literalAutolink:M2e,literalAutolinkEmail:E2e,literalAutolinkHttp:z2e,literalAutolinkWww:T2e}}}function A2e(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:yz,notInConstruct:xz},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:yz,notInConstruct:xz},{character:":",before:"[ps]",after:"\\/",inConstruct:yz,notInConstruct:xz}]}}function N2e(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function bz(e){this.config.enter.autolinkProtocol.call(this,e)}function z2e(e){this.config.exit.autolinkProtocol.call(this,e)}function T2e(e){this.config.exit.data.call(this,e);const n=this.stack[this.stack.length-1];n.type,n.url="http://"+this.sliceSerialize(e)}function E2e(e){this.config.exit.autolinkEmail.call(this,e)}function M2e(e){this.exit(e)}function R2e(e){S2e(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,O2e],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),D2e]],{ignore:["link","linkReference"]})}function O2e(e,n,i,r,o){let s="";if(!Yie(o)||(/^w/i.test(n)&&(i=n+i,n="",s="http://"),!L2e(i)))return!1;const a=B2e(i+r);if(!a[0])return!1;const c={type:"link",title:null,url:s+n+a[0],children:[{type:"text",value:n+a[0]}]};return a[1]?[c,{type:"text",value:a[1]}]:c}function D2e(e,n,i,r){return!Yie(r,!0)||/[-\d_]$/.test(i)?!1:{type:"link",title:null,url:"mailto:"+n+"@"+i,children:[{type:"text",value:n+"@"+i}]}}function L2e(e){const n=e.split(".");return!(n.length<2||n[n.length-1]&&(/_/.test(n[n.length-1])||!/[a-zA-Z\d]/.test(n[n.length-1]))||n[n.length-2]&&(/_/.test(n[n.length-2])||!/[a-zA-Z\d]/.test(n[n.length-2])))}function B2e(e){const n=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!n)return[e,void 0];e=e.slice(0,n.index);let i=n[0],r=i.indexOf(")");const o=iF(e,"(");let s=iF(e,")");for(;r!==-1&&o>s;)e+=i.slice(0,r+1),i=i.slice(r+1),r=i.indexOf(")"),s++;return[e,i]}function Yie(e,n){const i=e.input.charCodeAt(e.index-1);return(e.index===0||Sy(i)||AP(i))&&(!n||i!==47)}Xie.peek=Y2e;function F2e(){this.buffer()}function W2e(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function U2e(){this.buffer()}function H2e(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function q2e(e){const n=this.resume(),i=this.stack[this.stack.length-1];i.type,i.identifier=Cu(this.sliceSerialize(e)).toLowerCase(),i.label=n}function G2e(e){this.exit(e)}function V2e(e){const n=this.resume(),i=this.stack[this.stack.length-1];i.type,i.identifier=Cu(this.sliceSerialize(e)).toLowerCase(),i.label=n}function K2e(e){this.exit(e)}function Y2e(){return"["}function Xie(e,n,i,r){const o=i.createTracker(r);let s=o.move("[^");const a=i.enter("footnoteReference"),c=i.enter("reference");return s+=o.move(i.safe(i.associationId(e),{after:"]",before:s})),c(),a(),s+=o.move("]"),s}function X2e(){return{enter:{gfmFootnoteCallString:F2e,gfmFootnoteCall:W2e,gfmFootnoteDefinitionLabelString:U2e,gfmFootnoteDefinition:H2e},exit:{gfmFootnoteCallString:q2e,gfmFootnoteCall:G2e,gfmFootnoteDefinitionLabelString:V2e,gfmFootnoteDefinition:K2e}}}function Q2e(e){let n=!1;return e&&e.firstLineBlank&&(n=!0),{handlers:{footnoteDefinition:i,footnoteReference:Xie},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function i(r,o,s,a){const c=s.createTracker(a);let u=c.move("[^");const m=s.enter("footnoteDefinition"),h=s.enter("label");return u+=c.move(s.safe(s.associationId(r),{before:u,after:"]"})),h(),u+=c.move("]:"),r.children&&r.children.length>0&&(c.shift(4),u+=c.move((n?` 2204`:" ")+s.indentLines(s.containerFlow(r,c.current()),n?Qie:Z2e))),m(),u}}function Z2e(e,n,i){return n===0?e:Qie(e,n,i)}function Qie(e,n,i){return(i?"":" ")+e}const J2e=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Zie.peek=r5e;
vendor: 14,315 bytes, lines 2204-2216
2204function e5e(){return{canContainEols:["delete"],enter:{strikethrough:n5e},exit:{strikethrough:i5e}}}function t5e(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:J2e}],handlers:{delete:Zie}}}function n5e(e){this.enter({type:"delete",children:[]},e)}function i5e(e){this.exit(e)}function Zie(e,n,i,r){const o=i.createTracker(r),s=i.enter("strikethrough");let a=o.move("~~");return a+=i.containerPhrasing(e,{...o.current(),before:a,after:"~"}),a+=o.move("~~"),s(),a}function r5e(){return"~"}function o5e(e){return e.length}function s5e(e,n){const i=n||{},r=(i.align||[]).concat(),o=i.stringLength||o5e,s=[],a=[],c=[],u=[];let m=0,h=-1;for(;++h<e.length;){const j=[],v=[];let _=-1;for(e[h].length>m&&(m=e[h].length);++_<e[h].length;){const $=a5e(e[h][_]);if(i.alignDelimiters!==!1){const k=o($);v[_]=k,(u[_]===void 0||k>u[_])&&(u[_]=k)}j.push($)}a[h]=j,c[h]=v}let g=-1;if(typeof r=="object"&&"length"in r)for(;++g<m;)s[g]=rF(r[g]);else{const j=rF(r);for(;++g<m;)s[g]=j}g=-1;const x=[],y=[];for(;++g<m;){const j=s[g];let v="",_="";j===99?(v=":",_=":"):j===108?v=":":j===114&&(_=":");let $=i.alignDelimiters===!1?1:Math.max(1,u[g]-v.length-_.length);const k=v+"-".repeat($)+_;i.alignDelimiters!==!1&&($=v.length+$+_.length,$>u[g]&&(u[g]=$),y[g]=$),x[g]=k}a.splice(1,0,x),c.splice(1,0,y),h=-1;const w=[];for(;++h<a.length;){const j=a[h],v=c[h];g=-1;const _=[];for(;++g<m;){const $=j[g]||"";let k="",P="";if(i.alignDelimiters!==!1){const S=u[g]-(v[g]||0),I=s[g];I===114?k=" ".repeat(S):I===99?S%2?(k=" ".repeat(S/2+.5),P=" ".repeat(S/2-.5)):(k=" ".repeat(S/2),P=k):P=" ".repeat(S)}i.delimiterStart!==!1&&!g&&_.push("|"),i.padding!==!1&&!(i.alignDelimiters===!1&&$==="")&&(i.delimiterStart!==!1||g)&&_.push(" "),i.alignDelimiters!==!1&&_.push(k),_.push($),i.alignDelimiters!==!1&&_.push(P),i.padding!==!1&&_.push(" "),(i.delimiterEnd!==!1||g!==m-1)&&_.push("|")}w.push(i.delimiterEnd===!1?_.join("").replace(/ +$/,""):_.join(""))}return w.join(` 2205`)}function a5e(e){return e==null?"":String(e)}function rF(e){const n=typeof e=="string"?e.codePointAt(0):0;return n===67||n===99?99:n===76||n===108?108:n===82||n===114?114:0}function l5e(e,n,i,r){const o=i.enter("blockquote"),s=i.createTracker(r);s.move("> "),s.shift(2);const a=i.indentLines(i.containerFlow(e,s.current()),c5e);return o(),a}function c5e(e,n,i){return">"+(i?"":" ")+e}function d5e(e,n){return oF(e,n.inConstruct,!0)&&!oF(e,n.notInConstruct,!1)}function oF(e,n,i){if(typeof n=="string"&&(n=[n]),!n||n.length===0)return i;let r=-1;for(;++r<n.length;)if(e.includes(n[r]))return!0;return!1}function sF(e,n,i,r){let o=-1;for(;++o<i.unsafe.length;)if(i.unsafe[o].character===` 2206`&&d5e(i.stack,i.unsafe[o]))return/[ \t]/.test(r.before)?"":" ";return`\\ 2207`}function u5e(e,n){const i=String(e);let r=i.indexOf(n),o=r,s=0,a=0;if(typeof n!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===o?++s>a&&(a=s):s=1,o=r+n.length,r=i.indexOf(n,o);return a}function p5e(e,n){return!!(n.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function m5e(e){const n=e.options.fence||"`";if(n!=="`"&&n!=="~")throw new Error("Cannot serialize code with `"+n+"` for `options.fence`, expected `` ` `` or `~`");return n}function h5e(e,n,i,r){const o=m5e(i),s=e.value||"",a=o==="`"?"GraveAccent":"Tilde";if(p5e(e,i)){const g=i.enter("codeIndented"),x=i.indentLines(s,f5e);return g(),x}const c=i.createTracker(r),u=o.repeat(Math.max(u5e(s,o)+1,3)),m=i.enter("codeFenced");let h=c.move(u);if(e.lang){const g=i.enter(`codeFencedLang${a}`);h+=c.move(i.safe(e.lang,{before:h,after:" ",encode:["`"],...c.current()})),g()}if(e.lang&&e.meta){const g=i.enter(`codeFencedMeta${a}`);h+=c.move(" "),h+=c.move(i.safe(e.meta,{before:h,after:` 2208`,encode:["`"],...c.current()})),g()}return h+=c.move(` 2209`),s&&(h+=c.move(s+` 2210`)),h+=c.move(u),m(),h}function f5e(e,n,i){return(i?"":" ")+e}function IM(e){const n=e.options.quote||'"';if(n!=='"'&&n!=="'")throw new Error("Cannot serialize title with `"+n+"` for `options.quote`, expected `\"`, or `'`");return n}function g5e(e,n,i,r){const o=IM(i),s=o==='"'?"Quote":"Apostrophe",a=i.enter("definition");let c=i.enter("label");const u=i.createTracker(r);let m=u.move("[");return m+=u.move(i.safe(i.associationId(e),{before:m,after:"]",...u.current()})),m+=u.move("]: "),c(),!e.url||/[\0- \u007F]/.test(e.url)?(c=i.enter("destinationLiteral"),m+=u.move("<"),m+=u.move(i.safe(e.url,{before:m,after:">",...u.current()})),m+=u.move(">")):(c=i.enter("destinationRaw"),m+=u.move(i.safe(e.url,{before:m,after:e.title?" ":` 2211`,...u.current()}))),c(),e.title&&(c=i.enter(`title${s}`),m+=u.move(" "+o),m+=u.move(i.safe(e.title,{before:m,after:o,...u.current()})),m+=u.move(o),c()),a(),m}function y5e(e){const n=e.options.emphasis||"*";if(n!=="*"&&n!=="_")throw new Error("Cannot serialize emphasis with `"+n+"` for `options.emphasis`, expected `*`, or `_`");return n}function C_(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Y5(e,n,i){const r=Wb(e),o=Wb(n);return r===void 0?o===void 0?i==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:o===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?o===void 0?{inside:!1,outside:!1}:o===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:o===void 0?{inside:!1,outside:!1}:o===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}Jie.peek=x5e;function Jie(e,n,i,r){const o=y5e(i),s=i.enter("emphasis"),a=i.createTracker(r),c=a.move(o);let u=a.move(i.containerPhrasing(e,{after:o,before:c,...a.current()}));const m=u.charCodeAt(0),h=Y5(r.before.charCodeAt(r.before.length-1),m,o);h.inside&&(u=C_(m)+u.slice(1));const g=u.charCodeAt(u.length-1),x=Y5(r.after.charCodeAt(0),g,o);x.inside&&(u=u.slice(0,-1)+C_(g));const y=a.move(o);return s(),i.attentionEncodeSurroundingInfo={after:x.outside,before:h.outside},c+u+y}function x5e(e,n,i){return i.options.emphasis||"*"}function b5e(e,n){let i=!1;return kM(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return i=!0,e3}),!!((!e.depth||e.depth<3)&&bM(e)&&(n.options.setext||i))}function v5e(e,n,i,r){const o=Math.max(Math.min(6,e.depth||1),1),s=i.createTracker(r);if(b5e(e,i)){const h=i.enter("headingSetext"),g=i.enter("phrasing"),x=i.containerPhrasing(e,{...s.current(),before:` 2212`,after:` 2213`});return g(),h(),x+` 2214`+(o===1?"=":"-").repeat(x.length-(Math.max(x.lastIndexOf("\r"),x.lastIndexOf(` 2215`))+1))}const a="#".repeat(o),c=i.enter("headingAtx"),u=i.enter("phrasing");s.move(a+" ");let m=i.containerPhrasing(e,{before:"# ",after:` 2216`,...s.current()});return/^[\t ]/.test(m)&&(m=C_(m.charCodeAt(0))+m.slice(1)),m=m?a+" "+m:a,i.options.closeAtx&&(m+=" "+a),u(),c(),m}ere.peek=w5e;function ere(e){return e.value||""}function w5e(){return"<"}tre.peek=j5e;function tre(e,n,i,r){const o=IM(i),s=o==='"'?"Quote":"Apostrophe",a=i.enter("image");let c=i.enter("label");const u=i.createTracker(r);let m=u.move("![");return m+=u.move(i.safe(e.alt,{before:m,after:"]",...u.current()})),m+=u.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=i.enter("destinationLiteral"),m+=u.move("<"),m+=u.move(i.safe(e.url,{before:m,after:">",...u.current()})),m+=u.move(">")):(c=i.enter("destinationRaw"),m+=u.move(i.safe(e.url,{before:m,after:e.title?" ":")",...u.current()}))),c(),e.title&&(c=i.enter(`title${s}`),m+=u.move(" "+o),m+=u.move(i.safe(e.title,{before:m,after:o,...u.current()})),m+=u.move(o),c()),m+=u.move(")"),a(),m}function j5e(){return"!"}nre.peek=_5e;function nre(e,n,i,r){const o=e.referenceType,s=i.enter("imageReference");let a=i.enter("label");const c=i.createTracker(r);let u=c.move("![");const m=i.safe(e.alt,{before:u,after:"]",...c.current()});u+=c.move(m+"]["),a();const h=i.stack;i.stack=[],a=i.enter("reference");const g=i.safe(i.associationId(e),{before:u,after:"]",...c.current()});return a(),i.stack=h,s(),o==="full"||!m||m!==g?u+=c.move(g+"]"):o==="shortcut"?u=u.slice(0,-1):u+=c.move("]"),u}function _5e(){return"!"}ire.peek=C5e;function ire(e,n,i){let r=e.value||"",o="`",s=-1;for(;new RegExp("(^|[^`])"+o+"([^`]|$)").test(r);)o+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++s<i.unsafe.length;){const a=i.unsafe[s],c=i.compilePattern(a);let u;if(a.atBreak)for(;u=c.exec(r);){let m=u.index;r.charCodeAt(m)===10&&r.charCodeAt(m-1)===13&&m--,r=r.slice(0,m)+" "+r.slice(u.index+1)}}return o+r+o}function C5e(){return"`"}function rre(e,n){const i=bM(e);return!!(!n.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(i===e.url||"mailto:"+i===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}ore.peek=S5e;function ore(e,n,i,r){const o=IM(i),s=o==='"'?"Quote":"Apostrophe",a=i.createTracker(r);let c,u;if(rre(e,i)){const h=i.stack;i.stack=[],c=i.enter("autolink");let g=a.move("<");return g+=a.move(i.containerPhrasing(e,{before:g,after:">",...a.current()})),g+=a.move(">"),c(),i.stack=h,g}c=i.enter("link"),u=i.enter("label");let m=a.move("[");return m+=a.move(i.containerPhrasing(e,{before:m,after:"](",...a.current()})),m+=a.move("]("),u(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(u=i.enter("destinationLiteral"),m+=a.move("<"),m+=a.move(i.safe(e.url,{before:m,after:">",...a.current()})),m+=a.move(">")):(u=i.enter("destinationRaw"),m+=a.move(i.safe(e.url,{before:m,after:e.title?" ":")",...a.current()}))),u(),e.title&&(u=i.enter(`title${s}`),m+=a.move(" "+o),m+=a.move(i.safe(e.title,{before:m,after:o,...a.current()})),m+=a.move(o),u()),m+=a.move(")"),c(),m}function S5e(e,n,i){return rre(e,i)?"<":"["}sre.peek=k5e;function sre(e,n,i,r){const o=e.referenceType,s=i.enter("linkReference");let a=i.enter("label");const c=i.createTracker(r);let u=c.move("[");const m=i.containerPhrasing(e,{before:u,after:"]",...c.current()});u+=c.move(m+"]["),a();const h=i.stack;i.stack=[],a=i.enter("reference");const g=i.safe(i.associationId(e),{before:u,after:"]",...c.current()});return a(),i.stack=h,s(),o==="full"||!m||m!==g?u+=c.move(g+"]"):o==="shortcut"?u=u.slice(0,-1):u+=c.move("]"),u}function k5e(){return"["}function PM(e){const n=e.options.bullet||"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bullet`, expected `*`, `+`, or `-`");return n}function $5e(e){const n=PM(e),i=e.options.bulletOther;if(!i)return n==="*"?"-":"*";if(i!=="*"&&i!=="+"&&i!=="-")throw new Error("Cannot serialize items with `"+i+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(i===n)throw new Error("Expected `bullet` (`"+n+"`) and `bulletOther` (`"+i+"`) to be different");return i}function I5e(e){const n=e.options.bulletOrdered||".";if(n!=="."&&n!==")")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOrdered`, expected `.` or `)`");return n}function are(e){const n=e.options.rule||"*";if(n!=="*"&&n!=="-"&&n!=="_")throw new Error("Cannot serialize rules with `"+n+"` for `options.rule`, expected `*`, `-`, or `_`");return n}function P5e(e,n,i,r){const o=i.enter("list"),s=i.bulletCurrent;let a=e.ordered?I5e(i):PM(i);const c=e.ordered?a==="."?")":".":$5e(i);let u=n&&i.bulletLastUsed?a===i.bulletLastUsed:!1;if(!e.ordered){const h=e.children?e.children[0]:void 0;if((a==="*"||a==="-")&&h&&(!h.children||!h.children[0])&&i.stack[i.stack.length-1]==="list"&&i.stack[i.stack.length-2]==="listItem"&&i.stack[i.stack.length-3]==="list"&&i.stack[i.stack.length-4]==="listItem"&&i.indexStack[i.indexStack.length-1]===0&&i.indexStack[i.indexStack.length-2]===0&&i.indexStack[i.indexStack.length-3]===0&&(u=!0),are(i)===a&&h){let g=-1;for(;++g<e.children.length;){const x=e.children[g];if(x&&x.type==="listItem"&&x.children&&x.children[0]&&x.children[0].type==="thematicBreak"){u=!0;break}}}}u&&(a=c),i.bulletCurrent=a;const m=i.containerFlow(e,r);return i.bulletLastUsed=a,i.bulletCurrent=s,o(),m}function A5e(e){const n=e.options.listItemIndent||"one";if(n!=="tab"&&n!=="one"&&n!=="mixed")throw new Error("Cannot serialize items with `"+n+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return n}function N5e(e,n,i,r){const o=A5e(i);let s=i.bulletCurrent||PM(i);n&&n.type==="list"&&n.ordered&&(s=(typeof n.start=="number"&&n.start>-1?n.start:1)+(i.options.incrementListMarker===!1?0:n.children.indexOf(e))+s);let a=s.length+1;(o==="tab"||o==="mixed"&&(n&&n.type==="list"&&n.spread||e.spread))&&(a=Math.ceil(a/4)*4);const c=i.createTracker(r);c.move(s+" ".repeat(a-s.length)),c.shift(a);const u=i.enter("listItem"),m=i.indentLines(i.containerFlow(e,c.current()),h);return u(),m;function h(g,x,y){return x?(y?"":" ".repeat(a))+g:(y?s:s+" ".repeat(a-s.length))+g}}function z5e(e,n,i,r){const o=i.enter("paragraph"),s=i.enter("phrasing"),a=i.containerPhrasing(e,r);return s(),o(),a}const T5e=TP(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function E5e(e,n,i,r){return(e.children.some(function(a){return T5e(a)})?i.containerPhrasing:i.containerFlow).call(i,e,r)}function M5e(e){const n=e.options.strong||"*";if(n!=="*"&&n!=="_")throw new Error("Cannot serialize strong with `"+n+"` for `options.strong`, expected `*`, or `_`");return n}lre.peek=R5e;function lre(e,n,i,r){const o=M5e(i),s=i.enter("strong"),a=i.createTracker(r),c=a.move(o+o);let u=a.move(i.containerPhrasing(e,{after:o,before:c,...a.current()}));const m=u.charCodeAt(0),h=Y5(r.before.charCodeAt(r.before.length-1),m,o);h.inside&&(u=C_(m)+u.slice(1));const g=u.charCodeAt(u.length-1),x=Y5(r.after.charCodeAt(0),g,o);x.inside&&(u=u.slice(0,-1)+C_(g));const y=a.move(o+o);return s(),i.attentionEncodeSurroundingInfo={after:x.outside,before:h.outside},c+u+y}function R5e(e,n,i){return i.options.strong||"*"}function O5e(e,n,i,r){return i.safe(e.value,r)}function D5e(e){const n=e.options.ruleRepetition||3;if(n<3)throw new Error("Cannot serialize rules with repetition `"+n+"` for `options.ruleRepetition`, expected `3` or more");return n}function L5e(e,n,i){const r=(are(i)+(i.options.ruleSpaces?" ":"")).repeat(D5e(i));return i.options.ruleSpaces?r.slice(0,-1):r}const cre={blockquote:l5e,break:sF,code:h5e,definition:g5e,emphasis:Jie,hardBreak:sF,heading:v5e,html:ere,image:tre,imageReference:nre,inlineCode:ire,link:ore,linkReference:sre,list:P5e,listItem:N5e,paragraph:z5e,root:E
vendor: 12,453 bytes, lines 2216-2218
22165e,strong:lre,text:O5e,thematicBreak:L5e};function B5e(){return{enter:{table:F5e,tableData:aF,tableHeader:aF,tableRow:U5e},exit:{codeText:H5e,table:W5e,tableData:vz,tableHeader:vz,tableRow:vz}}}function F5e(e){const n=e._align;this.enter({type:"table",align:n.map(function(i){return i==="none"?null:i}),children:[]},e),this.data.inTable=!0}function W5e(e){this.exit(e),this.data.inTable=void 0}function U5e(e){this.enter({type:"tableRow",children:[]},e)}function vz(e){this.exit(e)}function aF(e){this.enter({type:"tableCell",children:[]},e)}function H5e(e){let n=this.resume();this.data.inTable&&(n=n.replace(/\\([\\|])/g,q5e));const i=this.stack[this.stack.length-1];i.type,i.value=n,this.exit(e)}function q5e(e,n){return n==="|"?n:e}function G5e(e){const n=e||{},i=n.tableCellPadding,r=n.tablePipeAlign,o=n.stringLength,s=i?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:` 2217`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:x,table:a,tableCell:u,tableRow:c}};function a(y,w,j,v){return m(h(y,j,v),y.align)}function c(y,w,j,v){const _=g(y,j,v),$=m([_]);return $.slice(0,$.indexOf(` 2218`))}function u(y,w,j,v){const _=j.enter("tableCell"),$=j.enter("phrasing"),k=j.containerPhrasing(y,{...v,before:s,after:s});return $(),_(),k}function m(y,w){return s5e(y,{align:w,alignDelimiters:r,padding:i,stringLength:o})}function h(y,w,j){const v=y.children;let _=-1;const $=[],k=w.enter("table");for(;++_<v.length;)$[_]=g(v[_],w,j);return k(),$}function g(y,w,j){const v=y.children;let _=-1;const $=[],k=w.enter("tableRow");for(;++_<v.length;)$[_]=u(v[_],y,w,j);return k(),$}function x(y,w,j){let v=cre.inlineCode(y,w,j);return j.stack.includes("tableCell")&&(v=v.replace(/\|/g,"\\$&")),v}}function V5e(){return{exit:{taskListCheckValueChecked:lF,taskListCheckValueUnchecked:lF,paragraph:Y5e}}}function K5e(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:X5e}}}function lF(e){const n=this.stack[this.stack.length-2];n.type,n.checked=e.type==="taskListCheckValueChecked"}function Y5e(e){const n=this.stack[this.stack.length-2];if(n&&n.type==="listItem"&&typeof n.checked=="boolean"){const i=this.stack[this.stack.length-1];i.type;const r=i.children[0];if(r&&r.type==="text"){const o=n.children;let s=-1,a;for(;++s<o.length;){const c=o[s];if(c.type==="paragraph"){a=c;break}}a===i&&(r.value=r.value.slice(1),r.value.length===0?i.children.shift():i.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,i.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function X5e(e,n,i,r){const o=e.children[0],s=typeof e.checked=="boolean"&&o&&o.type==="paragraph",a="["+(e.checked?"x":" ")+"] ",c=i.createTracker(r);s&&c.move(a);let u=cre.listItem(e,n,i,{...r,...c.current()});return s&&(u=u.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,m)),u;function m(h){return h+a}}function Q5e(){return[P2e(),X2e(),e5e(),B5e(),V5e()]}function Z5e(e){return{extensions:[A2e(),Q2e(e),t5e(),G5e(e),K5e()]}}const J5e={tokenize:oIe,partial:!0},dre={tokenize:sIe,partial:!0},ure={tokenize:aIe,partial:!0},pre={tokenize:lIe,partial:!0},eIe={tokenize:cIe,partial:!0},mre={name:"wwwAutolink",tokenize:iIe,previous:fre},hre={name:"protocolAutolink",tokenize:rIe,previous:gre},oh={name:"emailAutolink",tokenize:nIe,previous:yre},Mp={};function tIe(){return{text:Mp}}let kg=48;for(;kg<123;)Mp[kg]=oh,kg++,kg===58?kg=65:kg===91&&(kg=97);Mp[43]=oh;Mp[45]=oh;Mp[46]=oh;Mp[95]=oh;Mp[72]=[oh,hre];Mp[104]=[oh,hre];Mp[87]=[oh,mre];Mp[119]=[oh,mre];function nIe(e,n,i){const r=this;let o,s;return a;function a(g){return!r3(g)||!yre.call(r,r.previous)||AM(r.events)?i(g):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),c(g))}function c(g){return r3(g)?(e.consume(g),c):g===64?(e.consume(g),u):i(g)}function u(g){return g===46?e.check(eIe,h,m)(g):g===45||g===95||Fa(g)?(s=!0,e.consume(g),u):h(g)}function m(g){return e.consume(g),o=!0,u}function h(g){return s&&o&&ml(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),n(g)):i(g)}}function iIe(e,n,i){const r=this;return o;function o(a){return a!==87&&a!==119||!fre.call(r,r.previous)||AM(r.events)?i(a):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(J5e,e.attempt(dre,e.attempt(ure,s),i),i)(a))}function s(a){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),n(a)}}function rIe(e,n,i){const r=this;let o="",s=!1;return a;function a(g){return(g===72||g===104)&&gre.call(r,r.previous)&&!AM(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),o+=String.fromCodePoint(g),e.consume(g),c):i(g)}function c(g){if(ml(g)&&o.length<5)return o+=String.fromCodePoint(g),e.consume(g),c;if(g===58){const x=o.toLowerCase();if(x==="http"||x==="https")return e.consume(g),u}return i(g)}function u(g){return g===47?(e.consume(g),s?m:(s=!0,u)):i(g)}function m(g){return g===null||G5(g)||zr(g)||Sy(g)||AP(g)?i(g):e.attempt(dre,e.attempt(ure,h),i)(g)}function h(g){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),n(g)}}function oIe(e,n,i){let r=0;return o;function o(a){return(a===87||a===119)&&r<3?(r++,e.consume(a),o):a===46&&r===3?(e.consume(a),s):i(a)}function s(a){return a===null?i(a):n(a)}}function sIe(e,n,i){let r,o,s;return a;function a(m){return m===46||m===95?e.check(pre,u,c)(m):m===null||zr(m)||Sy(m)||m!==45&&AP(m)?u(m):(s=!0,e.consume(m),a)}function c(m){return m===95?r=!0:(o=r,r=void 0),e.consume(m),a}function u(m){return o||r||!s?i(m):n(m)}}function aIe(e,n){let i=0,r=0;return o;function o(a){return a===40?(i++,e.consume(a),o):a===41&&r<i?s(a):a===33||a===34||a===38||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===60||a===63||a===93||a===95||a===126?e.check(pre,n,s)(a):a===null||zr(a)||Sy(a)?n(a):(e.consume(a),o)}function s(a){return a===41&&r++,e.consume(a),o}}function lIe(e,n,i){return r;function r(c){return c===33||c===34||c===39||c===41||c===42||c===44||c===46||c===58||c===59||c===63||c===95||c===126?(e.consume(c),r):c===38?(e.consume(c),s):c===93?(e.consume(c),o):c===60||c===null||zr(c)||Sy(c)?n(c):i(c)}function o(c){return c===null||c===40||c===91||zr(c)||Sy(c)?n(c):r(c)}function s(c){return ml(c)?a(c):i(c)}function a(c){return c===59?(e.consume(c),r):ml(c)?(e.consume(c),a):i(c)}}function cIe(e,n,i){return r;function r(s){return e.consume(s),o}function o(s){return Fa(s)?i(s):n(s)}}function fre(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||zr(e)}function gre(e){return!ml(e)}function yre(e){return!(e===47||r3(e))}function r3(e){return e===43||e===45||e===46||e===95||Fa(e)}function AM(e){let n=e.length,i=!1;for(;n--;){const r=e[n][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){i=!0;break}if(r._gfmAutolinkLiteralWalkedInto){i=!1;break}}return e.length>0&&!i&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),i}const dIe={tokenize:xIe,partial:!0};function uIe(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:fIe,continuation:{tokenize:gIe},exit:yIe}},text:{91:{name:"gfmFootnoteCall",tokenize:hIe},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:pIe,resolveTo:mIe}}}}function pIe(e,n,i){const r=this;let o=r.events.length;const s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a;for(;o--;){const u=r.events[o][1];if(u.type==="labelImage"){a=u;break}if(u.type==="gfmFootnoteCall"||u.type==="labelLink"||u.type==="label"||u.type==="image"||u.type==="link")break}return c;function c(u){if(!a||!a._balanced)return i(u);const m=Cu(r.sliceSerialize({start:a.end,end:r.now()}));return m.codePointAt(0)!==94||!s.includes(m.slice(1))?i(u):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(u),e.exit("gfmFootnoteCallLabelMarker"),n(u))}}function mIe(e,n){let i=e.length;for(;i--;)if(e[i][1].type==="labelImage"&&e[i][0]==="enter"){e[i][1];break}e[i+1][1].type="data",e[i+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[i+3][1].start),end:Object.assign({},e[e.length-1][1].end)},o={type:"gfmFootnoteCallMarker",start:Object.assign({},e[i+3][1].end),end:Object.assign({},e[i+3][1].end)};o.end.column++,o.end.offset++,o.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},o.end),end:Object.assign({},e[e.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},c=[e[i+1],e[i+2],["enter",r,n],e[i+3],e[i+4],["enter",o,n],["exit",o,n],["enter",s,n],["enter",a,n],["exit",a,n],["exit",s,n],e[e.length-2],e[e.length-1],["exit",r,n]];return e.splice(i,e.length-i+1,...c),e}function hIe(e,n,i){const r=this,o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s=0,a;return c;function c(g){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),u}function u(g){return g!==94?i(g):(e.enter("gfmFootnoteCallMarker"),e.consume(g),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",m)}function m(g){if(s>999||g===93&&!a||g===null||g===91||zr(g))return i(g);if(g===93){e.exit("chunkString");const x=e.exit("gfmFootnoteCallString");return o.includes(Cu(r.sliceSerialize(x)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),n):i(g)}return zr(g)||(a=!0),s++,e.consume(g),g===92?h:m}function h(g){return g===91||g===92||g===93?(e.consume(g),s++,m):m(g)}}function fIe(e,n,i){const r=this,o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s,a=0,c;return u;function u(w){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionLabelMarker"),m}function m(w){return w===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",h):i(w)}function h(w){if(a>999||w===93&&!c||w===null||w===91||zr(w))return i(w);if(w===93){e.exit("chunkString");const j=e.exit("gfmFootnoteDefinitionLabelString");return s=Cu(r.sliceSerialize(j)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(w),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),x}return zr(w)||(c=!0),a++,e.consume(w),w===92?g:h}function g(w){return w===91||w===92||w===93?(e.consume(w),a++,h):h(w)}function x(w){return w===58?(e.enter("definitionMarker"),e.consume(w),e.exit("definitionMarker"),o.includes(s)||o.push(s),Mi(e,y,"gfmFootnoteDefinitionWhitespace")):i(w)}function y(w){return n(w)}}function gIe(e,n,i){return e.check(nC,n,e.attempt(dIe,n,i))}function yIe(e){e.exit("gfmFootnoteDefinition")}function xIe(e,n,i){const r=this;return Mi(e,o,"gfmFootnoteDefinitionIndent",5);function o(s){const a=r.events[r.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?n(s):i(s)}}function bIe(e){let i=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:s,resolveAll:o};return i==null&&(i=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function o(a,c){let u=-1;for(;++u<a.length;)if(a[u][0]==="enter"&&a[u][1].type==="strikethroughSequenceTemporary"&&a[u][1]._close){let m=u;for(;m--;)if(a[m][0]==="exit"&&a[m][1].type==="strikethroughSequenceTemporary"&&a[m][1]._open&&a[u][1].end.offset-a[u][1].start.offset===a[m][1].end.offset-a[m][1].start.offset){a[u][1].type="strikethroughSequence",a[m][1].type="strikethroughSequence";const h={type:"strikethrough",start:Object.assign({},a[m][1].start),end:Object.assign({},a[u][1].end)},g={type:"strikethroughText",start:Object.assign({},a[m][1].end),end:Object.assign({},a[u][1].start)},x=[["enter",h,c],["enter",a[m][1],c],["exit",a[m][1],c],["enter",g,c]],y=c.parser.constructs.insideSpan.null;y&&Fc(x,x.length,0,NP(y,a.slice(m+1,u),c)),Fc(x,x.length,0,[["exit",g,c],["enter",a[u][1],c],["exit",a[u][1],c],["exit",h,c]]),Fc(a,m-1,u-m+3,x),u=m+x.length-2;break}}for(u=-1;++u<a.length;)a[u][1].type==="strikethroughSequenceTemporary"&&(a[u][1].type="data");return a}function s(a,c,u){const m=this.previous,h=this.events;let g=0;return x;function x(w){return m===126&&h[h.length-1][1].type!=="characterEscape"?u(w):(a.enter("strikethroughSequenceTemporary"),y(w))}function y(w){const j=Wb(m);
vendor: 4,785 bytes, line 2218
2218if(w===126)return g>1?u(w):(a.consume(w),g++,y);if(g<2&&!i)return u(w);const v=a.exit("strikethroughSequenceTemporary"),_=Wb(w);return v._open=!_||_===2&&!!j,v._close=!j||j===2&&!!_,c(w)}}}class vIe{constructor(){this.map=[]}add(n,i,r){wIe(this,n,i,r)}consume(n){if(this.map.sort(function(s,a){return s[0]-a[0]}),this.map.length===0)return;let i=this.map.length;const r=[];for(;i>0;)i-=1,r.push(n.slice(this.map[i][0]+this.map[i][1]),this.map[i][2]),n.length=this.map[i][0];r.push(n.slice()),n.length=0;let o=r.pop();for(;o;){for(const s of o)n.push(s);o=r.pop()}this.map.length=0}}function wIe(e,n,i,r){let o=0;if(!(i===0&&r.length===0)){for(;o<e.map.length;){if(e.map[o][0]===n){e.map[o][1]+=i,e.map[o][2].push(...r);return}o+=1}e.map.push([n,i,r])}}function jIe(e,n){let i=!1;const r=[];for(;n<e.length;){const o=e[n];if(i){if(o[0]==="enter")o[1].type==="tableContent"&&r.push(e[n+1][1].type==="tableDelimiterMarker"?"left":"none");else if(o[1].type==="tableContent"){if(e[n-1][1].type==="tableDelimiterMarker"){const s=r.length-1;r[s]=r[s]==="left"?"center":"right"}}else if(o[1].type==="tableDelimiterRow")break}else o[0]==="enter"&&o[1].type==="tableDelimiterRow"&&(i=!0);n+=1}return r}function _Ie(){return{flow:{null:{name:"table",tokenize:CIe,resolveAll:SIe}}}}function CIe(e,n,i){const r=this;let o=0,s=0,a;return c;function c(T){let M=r.events.length-1;for(;M>-1;){const Y=r.events[M][1].type;if(Y==="lineEnding"||Y==="linePrefix")M--;else break}const R=M>-1?r.events[M][1].type:null,F=R==="tableHead"||R==="tableRow"?I:u;return F===I&&r.parser.lazy[r.now().line]?i(T):F(T)}function u(T){return e.enter("tableHead"),e.enter("tableRow"),m(T)}function m(T){return T===124||(a=!0,s+=1),h(T)}function h(T){return T===null?i(T):Wn(T)?s>1?(s=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),y):i(T):wi(T)?Mi(e,h,"whitespace")(T):(s+=1,a&&(a=!1,o+=1),T===124?(e.enter("tableCellDivider"),e.consume(T),e.exit("tableCellDivider"),a=!0,h):(e.enter("data"),g(T)))}function g(T){return T===null||T===124||zr(T)?(e.exit("data"),h(T)):(e.consume(T),T===92?x:g)}function x(T){return T===92||T===124?(e.consume(T),g):g(T)}function y(T){return r.interrupt=!1,r.parser.lazy[r.now().line]?i(T):(e.enter("tableDelimiterRow"),a=!1,wi(T)?Mi(e,w,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(T):w(T))}function w(T){return T===45||T===58?v(T):T===124?(a=!0,e.enter("tableCellDivider"),e.consume(T),e.exit("tableCellDivider"),j):S(T)}function j(T){return wi(T)?Mi(e,v,"whitespace")(T):v(T)}function v(T){return T===58?(s+=1,a=!0,e.enter("tableDelimiterMarker"),e.consume(T),e.exit("tableDelimiterMarker"),_):T===45?(s+=1,_(T)):T===null||Wn(T)?P(T):S(T)}function _(T){return T===45?(e.enter("tableDelimiterFiller"),$(T)):S(T)}function $(T){return T===45?(e.consume(T),$):T===58?(a=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(T),e.exit("tableDelimiterMarker"),k):(e.exit("tableDelimiterFiller"),k(T))}function k(T){return wi(T)?Mi(e,P,"whitespace")(T):P(T)}function P(T){return T===124?w(T):T===null||Wn(T)?!a||o!==s?S(T):(e.exit("tableDelimiterRow"),e.exit("tableHead"),n(T)):S(T)}function S(T){return i(T)}function I(T){return e.enter("tableRow"),A(T)}function A(T){return T===124?(e.enter("tableCellDivider"),e.consume(T),e.exit("tableCellDivider"),A):T===null||Wn(T)?(e.exit("tableRow"),n(T)):wi(T)?Mi(e,A,"whitespace")(T):(e.enter("data"),E(T))}function E(T){return T===null||T===124||zr(T)?(e.exit("data"),A(T)):(e.consume(T),T===92?B:E)}function B(T){return T===92||T===124?(e.consume(T),E):E(T)}}function SIe(e,n){let i=-1,r=!0,o=0,s=[0,0,0,0],a=[0,0,0,0],c=!1,u=0,m,h,g;const x=new vIe;for(;++i<e.length;){const y=e[i],w=y[1];y[0]==="enter"?w.type==="tableHead"?(c=!1,u!==0&&(cF(x,n,u,m,h),h=void 0,u=0),m={type:"table",start:Object.assign({},w.start),end:Object.assign({},w.end)},x.add(i,0,[["enter",m,n]])):w.type==="tableRow"||w.type==="tableDelimiterRow"?(r=!0,g=void 0,s=[0,0,0,0],a=[0,i+1,0,0],c&&(c=!1,h={type:"tableBody",start:Object.assign({},w.start),end:Object.assign({},w.end)},x.add(i,0,[["enter",h,n]])),o=w.type==="tableDelimiterRow"?2:h?3:1):o&&(w.type==="data"||w.type==="tableDelimiterMarker"||w.type==="tableDelimiterFiller")?(r=!1,a[2]===0&&(s[1]!==0&&(a[0]=a[1],g=jk(x,n,s,o,void 0,g),s=[0,0,0,0]),a[2]=i)):w.type==="tableCellDivider"&&(r?r=!1:(s[1]!==0&&(a[0]=a[1],g=jk(x,n,s,o,void 0,g)),s=a,a=[s[1],i,0,0])):w.type==="tableHead"?(c=!0,u=i):w.type==="tableRow"||w.type==="tableDelimiterRow"?(u=i,s[1]!==0?(a[0]=a[1],g=jk(x,n,s,o,i,g)):a[1]!==0&&(g=jk(x,n,a,o,i,g)),o=0):o&&(w.type==="data"||w.type==="tableDelimiterMarker"||w.type==="tableDelimiterFiller")&&(a[3]=i)}for(u!==0&&cF(x,n,u,m,h),x.consume(n.events),i=-1;++i<n.events.length;){const y=n.events[i];
vendor: 6,023 bytes, lines 2218-2352
2218y[0]==="enter"&&y[1].type==="table"&&(y[1]._align=jIe(n.events,i))}return e}function jk(e,n,i,r,o,s){const a=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",c="tableContent";i[0]!==0&&(s.end=Object.assign({},ob(n.events,i[0])),e.add(i[0],0,[["exit",s,n]]));const u=ob(n.events,i[1]);if(s={type:a,start:Object.assign({},u),end:Object.assign({},u)},e.add(i[1],0,[["enter",s,n]]),i[2]!==0){const m=ob(n.events,i[2]),h=ob(n.events,i[3]),g={type:c,start:Object.assign({},m),end:Object.assign({},h)};if(e.add(i[2],0,[["enter",g,n]]),r!==2){const x=n.events[i[2]],y=n.events[i[3]];if(x[1].end=Object.assign({},y[1].end),x[1].type="chunkText",x[1].contentType="text",i[3]>i[2]+1){const w=i[2]+1,j=i[3]-i[2]-1;e.add(w,j,[])}}e.add(i[3]+1,0,[["exit",g,n]])}return o!==void 0&&(s.end=Object.assign({},ob(n.events,o)),e.add(o,0,[["exit",s,n]]),s=void 0),s}function cF(e,n,i,r,o){const s=[],a=ob(n.events,i);o&&(o.end=Object.assign({},a),s.push(["exit",o,n])),r.end=Object.assign({},a),s.push(["exit",r,n]),e.add(i+1,0,s)}function ob(e,n){const i=e[n],r=i[0]==="enter"?"start":"end";return i[1][r]}const kIe={name:"tasklistCheck",tokenize:IIe};function $Ie(){return{text:{91:kIe}}}function IIe(e,n,i){const r=this;return o;function o(u){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?i(u):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(u),e.exit("taskListCheckMarker"),s)}function s(u){return zr(u)?(e.enter("taskListCheckValueUnchecked"),e.consume(u),e.exit("taskListCheckValueUnchecked"),a):u===88||u===120?(e.enter("taskListCheckValueChecked"),e.consume(u),e.exit("taskListCheckValueChecked"),a):i(u)}function a(u){return u===93?(e.enter("taskListCheckMarker"),e.consume(u),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),c):i(u)}function c(u){return Wn(u)?n(u):wi(u)?e.check({tokenize:PIe},n,i)(u):i(u)}}function PIe(e,n,i){return Mi(e,r,"whitespace");function r(o){return o===null?i(o):n(o)}}function AIe(e){return Iie([tIe(),uIe(),bIe(e),_Ie(),$Ie()])}const NIe={};function sb(e){const n=this,i=e||NIe,r=n.data(),o=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);o.push(AIe(i)),s.push(Q5e()),a.push(Z5e(i))}const zIe=p.div.withConfig({displayName:"MarkdownRenderer__WrapCard",componentId:"sc-12x610t-0"})` 2219 border: 1px solid transparent; 2220 border-radius: 14px; 2221 padding: 14px; 2222 background: ${Z}; 2223 max-height: 70vh; 2224 overflow-y: auto; 2225 color: ${O}; 2226 font-size: 0.875rem; 2227 line-height: 1.55; 2228`,TIe=p.div.withConfig({displayName:"MarkdownRenderer__Body",componentId:"sc-12x610t-1"})` 2229 color: ${O}; 2230 overflow-wrap: anywhere; 2231 font-size: inherit; 2232 line-height: 1.55; 2233 2234 /* Comfortable rhythm for prose-like rendering (especially in chat). */ 2235 & > * + * { 2236 margin-top: 0.65rem; 2237 } 2238 2239 /* Avoid extra space at the very top/bottom. */ 2240 & > :first-child { 2241 margin-top: 0 !important; 2242 } 2243 & > :last-child { 2244 margin-bottom: 0 !important; 2245 } 2246 2247 /* Lists */ 2248 ul, 2249 ol { 2250 margin: 0.4rem 0; 2251 } 2252 2253 li > p { 2254 margin: 0.25rem 0; 2255 } 2256 2257 /* Code blocks */ 2258 pre { 2259 margin: 0.6rem 0; 2260 } 2261`,EIe=p.p.withConfig({displayName:"MarkdownRenderer__MarkdownP",componentId:"sc-12x610t-2"})` 2262 margin: 0; 2263 line-height: inherit; 2264 color: ${O}; 2265 font-size: inherit; 2266`,MIe=p.ul.withConfig({displayName:"MarkdownRenderer__MarkdownUl",componentId:"sc-12x610t-3"})` 2267 margin: 0; 2268 padding-left: 18px; 2269 color: ${O}; 2270 font-size: inherit; 2271 line-height: inherit; 2272`,RIe=p.ol.withConfig({displayName:"MarkdownRenderer__MarkdownOl",componentId:"sc-12x610t-4"})` 2273 margin: 0; 2274 padding-left: 18px; 2275 color: ${O}; 2276 font-size: inherit; 2277 line-height: inherit; 2278`,OIe=p.li.withConfig({displayName:"MarkdownRenderer__MarkdownLi",componentId:"sc-12x610t-5"})` 2279 margin: 0.2rem 0; 2280 2281 & > ul, 2282 & > ol { 2283 margin-top: 0.35rem; 2284 } 2285`,DIe=p.h1.withConfig({displayName:"MarkdownRenderer__MarkdownH1",componentId:"sc-12x610t-6"})` 2286 margin: 0; 2287 line-height: 1.2; 2288 color: ${O}; 2289 font-size: 1.15rem; 2290 font-weight: 950; 2291`,LIe=p.h2.withConfig({displayName:"MarkdownRenderer__MarkdownH2",componentId:"sc-12x610t-7"})` 2292 margin: 0; 2293 line-height: 1.25; 2294 color: ${O}; 2295 font-size: 1.05rem; 2296 font-weight: 950; 2297`,BIe=p.h3.withConfig({displayName:"MarkdownRenderer__MarkdownH3",componentId:"sc-12x610t-8"})` 2298 margin: 0; 2299 line-height: 1.3; 2300 color: ${O}; 2301 font-size: 0.98rem; 2302 font-weight: 900; 2303`,FIe=p.h4.withConfig({displayName:"MarkdownRenderer__MarkdownH4",componentId:"sc-12x610t-9"})` 2304 margin: 0; 2305 line-height: 1.3; 2306 color: ${O}; 2307 font-size: 0.92rem; 2308 font-weight: 900; 2309`,WIe=p.h5.withConfig({displayName:"MarkdownRenderer__MarkdownH5",componentId:"sc-12x610t-10"})` 2310 margin: 0; 2311 line-height: 1.3; 2312 color: ${O}; 2313 font-size: 0.88rem; 2314 font-weight: 900; 2315`,UIe=p.h6.withConfig({displayName:"MarkdownRenderer__MarkdownH6",componentId:"sc-12x610t-11"})` 2316 margin: 0; 2317 line-height: 1.3; 2318 color: ${O}; 2319 font-size: 0.88rem; 2320 font-weight: 900; 2321`,HIe=p.a.withConfig({displayName:"MarkdownRenderer__MarkdownLink",componentId:"sc-12x610t-12"})` 2322 color: ${Ft}; 2323 font-weight: 850; 2324 text-decoration: underline; 2325 text-decoration-thickness: 2px; 2326 text-underline-offset: 3px; 2327 2328 &:hover { 2329 filter: brightness(0.95); 2330 } 2331`,qIe=p.code.withConfig({displayName:"MarkdownRenderer__InlineCode",componentId:"sc-12x610t-13"})` 2332 font-size: 0.85em; 2333 font-weight: 700; 2334 color: ${O}; 2335 background: ${jne}; 2336 border: 1px solid ${V}; 2337 border-radius: 8px; 2338 padding: 2px 6px; 2339 font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; 2340`,GIe=p.pre.withConfig({displayName:"MarkdownRenderer__Pre",componentId:"sc-12x610t-14"})` 2341 margin: 0; 2342 padding: 0.75rem; 2343 border-radius: 12px; 2344 border: 1px solid ${V}; 2345 background: ${_ne}; 2346 overflow: auto; 2347 2348 code { 2349 font-size: 0.85em; 2350 line-height: 1.45; 2351 font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; 2352 }
2353`,VIe=p.code.withConfig({displayName:"MarkdownRenderer__CodeBlock",componentId:"sc-12x610t-15"})` 2354 display: block; 2355 white-space: pre; 2356`,KIe=p.blockquote.withConfig({displayName:"MarkdownRenderer__BlockQuote",componentId:"sc-12x610t-16"})` 2357 margin: 0; 2358 padding: 0.55rem 0.75rem; 2359 border-left: 4px solid ${V}; 2360 background: ${$e}; 2361 border-radius: 10px; 2362 color: ${O}; 2363 2364 & > * + * { 2365 margin-top: 0.5rem; 2366 } 2367`,YIe=p.hr.withConfig({displayName:"MarkdownRenderer__Hr",componentId:"sc-12x610t-17"})` 2368 border: 0; 2369 border-top: 1px solid ${V}; 2370 margin: 0.85rem 0; 2371`,XIe=p.div.withConfig({displayName:"MarkdownRenderer__TableWrap",componentId:"sc-12x610t-18"})` 2372 width: 100%; 2373 overflow: auto; 2374 border: 1px solid ${V}; 2375 border-radius: 12px; 2376 background: ${Z}; 2377`,QIe=p.table.withConfig({displayName:"MarkdownRenderer__Table",componentId:"sc-12x610t-19"})` 2378 width: 100%; 2379 border-collapse: collapse; 2380 font-size: 0.92em; 2381`,ZIe=p.th.withConfig({displayName:"MarkdownRenderer__Th",componentId:"sc-12x610t-20"})` 2382 text-align: left; 2383 font-weight: 900; 2384 color: ${O}; 2385 background: ${$e}; 2386 padding: 0.55rem 0.65rem; 2387 border-bottom: 1px solid ${V}; 2388 white-space: nowrap; 2389`,xre=p.td.withConfig({displayName:"MarkdownRenderer__Td",componentId:"sc-12x610t-21"})` 2390 padding: 0.55rem 0.65rem; 2391 border-bottom: 1px solid ${V}; 2392 color: ${O}; 2393 vertical-align: top; 2394`,JIe=p.tr.withConfig({displayName:"MarkdownRenderer__Tr",componentId:"sc-12x610t-22"})` 2395 &:last-child ${xre} { 2396 border-bottom: 0; 2397 } 2398`,ePe=p.kbd.withConfig({displayName:"MarkdownRenderer__Kbd",componentId:"sc-12x610t-23"})` 2399 font-size: 0.8em; 2400 font-weight: 850; 2401 padding: 2px 6px; 2402 border-radius: 8px; 2403 border: 1px solid ${V}; 2404 background: ${Z}; 2405 box-shadow: 0 1px 0 rgba(0, 0, 0, 0.05); 2406 color: ${O}; 2407`,tPe=p.small.withConfig({displayName:"MarkdownRenderer__Small",componentId:"sc-12x610t-24"})` 2408 color: ${Pe}; 2409`;function X5({markdown:e,transformChildren:n,wrap:i="none",empty:r=t.jsx("span",{style:{opacity:.75},children:"No content."})}){const o=String(e||""),s=o.trim().length>0,a=n||(u=>u),c=s?t.jsx(rb,{remarkPlugins:[sb],components:{h1:({children:u})=>t.jsx(DIe,{children:a(u)}),h2:({children:u})=>t.jsx(LIe,{children:a(u)}),h3:({children:u})=>t.jsx(BIe,{children:a(u)}),h4:({children:u})=>t.jsx(FIe,{children:a(u)}),h5:({children:u})=>t.jsx(WIe,{children:a(u)}),h6:({children:u})=>t.jsx(UIe,{children:a(u)}),p:({children:u})=>t.jsx(EIe,{children:a(u)}),ul:({children:u})=>t.jsx(MIe,{children:u}),ol:({children:u})=>t.jsx(RIe,{children:u}),li:({children:u})=>t.jsx(OIe,{children:a(u)}),a:({href:u,children:m})=>t.jsx(HIe,{href:u,target:"_blank",rel:"noreferrer",children:a(m)}),strong:({children:u})=>t.jsx("strong",{children:a(u)}),em:({children:u})=>t.jsx("em",{children:a(u)}),blockquote:({children:u})=>t.jsx(KIe,{children:a(u)}),hr:()=>t.jsx(YIe,{}),table:({children:u})=>t.jsx(XIe,{children:t.jsx(QIe,{children:u})}),tr:({children:u})=>t.jsx(JIe,{children:u}),th:({children:u})=>t.jsx(ZIe,{children:a(u)}),td:({children:u})=>t.jsx(xre,{children:a(u)}),kbd:({children:u})=>t.jsx(ePe,{children:a(u)}),small:({children:u})=>t.jsx(tPe,{children:a(u)}),code:({children:u,className:m})=>m?t.jsx(VIe,{className:m,children:u}):t.jsx(qIe,{children:u}),pre:({children:u})=>t.jsx(GIe,{children:u})},children:o}):r;return i==="card"?t.jsx(zIe,{children:c}):t.jsx(TIe,{children:c})}const nPe=p.div.withConfig({displayName:"ModelsMultiSelect__Wrap",componentId:"sc-ieda0l-0"})` 2410 position: relative; 2411 display: inline-flex; 2412`,iPe=p(he).withConfig({displayName:"ModelsMultiSelect__TriggerButton",componentId:"sc-ieda0l-1"})` 2413 width: 6.5rem; 2414 min-width: 0; 2415 max-width: 6.5rem; 2416 padding: 0 0.6rem; 2417 gap: 0.35rem; 2418 2419 /* Mobile: icon-only trigger should shrink to content (no fixed width). */ 2420 @media (max-width: 640px) { 2421 width: auto; 2422 max-width: none; 2423 padding: 0 0.5rem; /* make it ~square: 16px icon + 8px+8px padding = 32px */ 2424 } 2425`,rPe=p.span.withConfig({displayName:"ModelsMultiSelect__TriggerLabel",componentId:"sc-ieda0l-2"})` 2426 flex: 1 1 auto; 2427 min-width: 0; 2428 overflow: hidden; 2429 text-overflow: ellipsis; 2430 white-space: nowrap; 2431 2432 @media (max-width: 640px) { 2433 display: none; 2434 } 2435`,oPe=p.div.withConfig({displayName:"ModelsMultiSelect__Popover",componentId:"sc-ieda0l-3"})` 2436 position: fixed; 2437 background: ${Z}; 2438 border: 1px solid ${V}; 2439 border-radius: 0.875rem; 2440 box-shadow: 0 18px 40px rgba(17, 24, 39, 0.14); 2441 padding: 0.6rem; 2442 z-index: 2000; 2443 display: ${e=>e.$open?"block":"none"}; 2444 overflow: auto; 2445`,dF=p.button.withConfig({displayName:"ModelsMultiSelect__Row",componentId:"sc-ieda0l-4"})` 2446 width: 100%; 2447 border: 1px solid ${Rt}; 2448 background: ${e=>e.$checked?$e:Z}; 2449 border-radius: 0.375rem; 2450 padding: 0.55rem 0.6rem; 2451 display: flex; 2452 align-items: center; 2453 justify-content: space-between; 2454 gap: 0.75rem; 2455 cursor: ${e=>e.$disabled?"not-allowed":"pointer"}; 2456 opacity: ${e=>e.$disabled?.5:1}; 2457 color: ${O}; 2458 text-align: left; 2459 2460 &:hover { 2461 background: ${e=>e.$disabled?Z:$e}; 2462 } 2463 2464 &:not(:last-of-type) { 2465 margin-bottom: 0.5rem; 2466 } 2467`,uF=p.div.withConfig({displayName:"ModelsMultiSelect__Left",componentId:"sc-ieda0l-5"})` 2468 min-width: 0; 2469 display: flex; 2470 flex-direction: column; 2471 gap: 0.15rem; 2472`,pF=p.div.withConfig({displayName:"ModelsMultiSelect__NameRow",componentId:"sc-ieda0l-6"})` 2473 display: inline-flex; 2474 align-items: center; 2475 gap: 0.5rem; 2476 min-width: 0; 2477`,mF=p.span.withConfig({displayName:"ModelsMultiSelect__ModelIcon",componentId:"sc-ieda0l-7"})` 2478 width: 1rem; 2479 height: 1rem; 2480 display: inline-flex; 2481 align-items: center; 2482 justify-content: center; 2483 flex: 0 0 auto; 2484 opacity: 0.9; 2485 2486 svg { 2487 width: 1rem; 2488 height: 1rem; 2489 } 2490`,hF=p.div.withConfig({displayName:"ModelsMultiSelect__Name",componentId:"sc-ieda0l-8"})` 2491 font-size: 0.875rem; 2492 font-weight: 900; 2493 color: ${O}; 2494`,sPe=p.span.withConfig({displayName:"ModelsMultiSelect__UpgradeTag",componentId:"sc-ieda0l-9"})` 2495 display: inline-flex; 2496 align-items: center; 2497 gap: 0.25rem; 2498 font-size: 0.625rem; 2499 font-weight: 800; 2500 letter-spacing: 0.02em; 2501 line-height: 1; 2502 padding: 0.2rem 0.4rem; 2503 border-radius: 0.25rem; 2504 white-space: nowrap; 2505 flex-shrink: 0; 2506 background: ${cn}; 2507 color: ${ot}; 2508`,aPe=p.div.withConfig({displayName:"ModelsMultiSelect__SectionDivider",componentId:"sc-ieda0l-10"})` 2509 display: flex; 2510 align-items: center; 2511 gap: 0.5rem; 2512 margin: 0.65rem 0 0.5rem; 2513 padding: 0 0.15rem; 2514 color: ${Pe}; 2515 font-size: 0.675rem; 2516 font-weight: 750; 2517 text-transform: uppercase; 2518 letter-spacing: 0.04em; 2519`,lPe=p.span.withConfig({displayName:"ModelsMultiSelect__DividerLine",componentId:"sc-ieda0l-11"})` 2520 flex: 1; 2521 height: 1px; 2522 background: ${V}; 2523`,cPe=p(Dn).withConfig({displayName:"ModelsMultiSelect__DividerLink",componentId:"sc-ieda0l-12"})` 2524 flex-shrink: 0; 2525 font-size: 0.675rem; 2526 font-weight: 800; 2527 text-transform: none; 2528 letter-spacing: 0; 2529 color: ${ot}; 2530 text-decoration: none; 2531 2532 &:hover { 2533 text-decoration: underline; 2534 } 2535`,dPe=p.button.withConfig({displayName:"ModelsMultiSelect__DividerButton",componentId:"sc-ieda0l-13"})` 2536 flex-shrink: 0; 2537 font-size: 0.675rem; 2538 font-weight: 800; 2539 text-transform: none; 2540 letter-spacing: 0; 2541 color: ${ot}; 2542 text-decoration: none; 2543 background: none; 2544 border: none; 2545 padding: 0; 2546 cursor: pointer; 2547 font: inherit; 2548 2549 &:hover { 2550 text-decoration: underline; 2551 } 2552`,uPe=p.span.withConfig({displayName:"ModelsMultiSelect__DividerHint",componentId:"sc-ieda0l-14"})` 2553 flex-shrink: 0; 2554 font-size: 0.675rem; 2555 font-weight: 700; 2556 text-transform: none; 2557 letter-spacing: 0; 2558 font-style: italic; 2559`,pPe=p.div.withConfig({displayName:"ModelsMultiSelect__Footer",componentId:"sc-ieda0l-15"})` 2560 margin-top: 0.6rem; 2561 border-top: 1px solid ${$e}; 2562 padding-top: 0.6rem; 2563 display: flex; 2564 justify-content: space-between; 2565 gap: 0.5rem; 2566`,fF=p.button.withConfig({displayName:"ModelsMultiSelect__SmallBtn",componentId:"sc-ieda0l-16"})` 2567 border: 1px solid ${Rt}; 2568 background: ${Z}; 2569 color: ${O}; 2570 font-weight: medium; 2571 font-size: 0.75rem; 2572 padding: 0.35rem 0.55rem; 2573 border-radius: 0.375rem; 2574 cursor: pointer; 2575 2576 &:hover { 2577 background: ${$e}; 2578 } 2579`;function rC({options:e,value:n,onChange:i,disabled:r,settingsHref:o,onUpgradeClick:s,isOwner:a,hideUnavailableOptions:c}){const[u,m]=l.useState(!1),h=l.useRef(null),g=l.useRef(null),[x,y]=l.useState({}),w=l.useMemo(()=>e.filter(E=>!E.disabled),[e]),j=l.useMemo(()=>e.filter(E=>E.disabled),[e]),v=l.useMemo(()=>w.map(E=>E.key),[w]);j.length>0;const _=l.useMemo(()=>
2579{if(!Array.isArray(n)||n.length===0)return v;const E=new Set(n.map(String));return v.filter(B=>E.has(B))},[v,n]),$=l.useMemo(()=>v.length>0&&_.length===v.length,[v.length,_.length]),k=l.useMemo(()=>{if(v.length<=0)return"Models";if($)return"All models";if(_.length===1){const E=e.find(B=>B.key===_[0]);return E?E.label:"1 model"}return`${_.length} models`},[$,v.length,e,_]);l.useEffect(()=>{if(!u)return;const E=T=>{const M=T.target;h.current?.contains(M)||g.current?.contains(M)||m(!1)},B=T=>{T.key==="Escape"&&m(!1)};return document.addEventListener("mousedown",E),document.addEventListener("keydown",B),()=>{document.removeEventListener("mousedown",E),document.removeEventListener("keydown",B)}},[u]),l.useEffect(()=>{if(!u||typeof window>"u")return;const E=()=>{const B=g.current;if(!B)return;const T=B.getBoundingClientRect(),M=8,R=320,F=520,Y=window.innerWidth,H=window.innerHeight,U=H-T.bottom,X=T.top,Q=U<260&&X>U,K=Math.min(R,Y-16),G=Math.max(8,Math.min(T.left,Y-K-8));if(Q){const L=Math.min(F,Math.max(160,X-16));y({left:G,width:K,bottom:Math.max(8,H-T.top+M),maxHeight:L})}else{const L=Math.min(F,Math.max(160,U-16));y({left:G,width:K,top:Math.min(H-8,T.bottom+M),maxHeight:L})}};return E(),window.addEventListener("scroll",E,!0),window.addEventListener("resize",E),()=>{window.removeEventListener("scroll",E,!0),window.removeEventListener("resize",E)}},[u]);const P=E=>{const B=e.find(R=>R.key===E);if(!B||B.disabled)return;const T=new Set(_);T.has(E)?T.delete(E):T.add(E);const M=v.filter(R=>T.has(R));if(M.length===0||M.length===v.length){i([]);return}i(M)},S=()=>i([]),I=v.length>1,A=()=>{v.length<=0||i([v[0]])};return t.jsxs(nPe,{children:[t.jsx("span",{ref:g,style:{display:"inline-flex"},children:t.jsx(iPe,{type:"button",size:"sm",variant:"outline",disabled:r,onClick:()=>m(E=>!E),leftIcon:t.jsx(Dy,{size:16}),"aria-label":k,children:t.jsx(rPe,{children:k})})}),t.jsxs(oPe,{ref:h,$open:u,style:x,role:"dialog","aria-label":"Select models",children:[w.map(E=>{const B=_.includes(E.key),T=E.Icon;return t.jsxs(dF,{type:"button",$disabled:!1,$checked:B,onClick:()=>P(E.key),children:[t.jsx(uF,{children:t.jsxs(pF,{children:[T?t.jsx(mF,{"aria-hidden":!0,children:t.jsx(T,{})}):null,t.jsx(hF,{children:E.label})]})}),B?t.jsx(Zn,{size:18,color:"var(--color-brand-700)"}):t.jsx("span",{style:{width:18}})]},E.key)}),!c&&j.length>0&&t.jsxs(t.Fragment,{children:[t.jsxs(aPe,{children:[a?"Upgrade to unlock":"Not in your plan",t.jsx(lPe,{}),a&&s?t.jsx(dPe,{type:"button",onClick:()=>{m(!1),s()},children:"View plans â"}):a&&o?t.jsx(cPe,{to:o,children:"View plans â"}):a?null:t.jsx(uPe,{children:"Ask your workspace owner"})]}),j.map(E=>{const B=E.Icon,T=a&&(s||o);return t.jsxs(dF,{type:"button",$disabled:!T,$checked:!1,onClick:T?()=>{m(!1),s?.()}:void 0,tabIndex:T?0:-1,children:[t.jsx(uF,{children:t.jsxs(pF,{children:[B?t.jsx(mF,{"aria-hidden":!0,children:t.jsx(B,{})}):null,t.jsx(hF,{children:E.label}),t.jsxs(sPe,{children:[t.jsx(ku,{size:9})," Upgrade"]})]})}),t.jsx("span",{style:{width:18}})]},E.key)})]}),I?t.jsxs(pPe,{children:[t.jsx(fF,{type:"button",onClick:S,children:"All models"}),t.jsx(fF,{type:"button",onClick:A,children:"Deselect all"})]}):null]})]})}const mPe=p.div.withConfig({displayName:"CompetitorsMultiSelect__Wrap",componentId:"sc-1exdwxe-0"})` 2580 position: relative; 2581 display: inline-flex; 2582`,hPe=p(he).withConfig({displayName:"CompetitorsMultiSelect__TriggerButton",componentId:"sc-1exdwxe-1"})` 2583 width: 9.5rem; 2584 min-width: 0; 2585 max-width: 9.5rem; 2586 2587 /* Mobile: icon-only trigger should shrink to content (no fixed width). */ 2588 @media (max-width: 640px) { 2589 width: auto; 2590 max-width: none; 2591 padding: 0 0.5rem; 2592 } 2593`,fPe=p.span.withConfig({displayName:"CompetitorsMultiSelect__TriggerLabel",componentId:"sc-1exdwxe-2"})` 2594 flex: 1 1 auto; 2595 min-width: 0; 2596 overflow: hidden; 2597 text-overflow: ellipsis; 2598 white-space: nowrap; 2599 2600 @media (max-width: 640px) { 2601 display: none; 2602 } 2603`,gPe=p.div.withConfig({displayName:"CompetitorsMultiSelect__Popover",componentId:"sc-1exdwxe-3"})` 2604 position: fixed; 2605 background: ${Z}; 2606 border: 1px solid ${V}; 2607 border-radius: 0.875rem; 2608 box-shadow: 0 18px 40px rgba(17, 24, 39, 0.14); 2609 padding: 0.6rem; 2610 z-index: 2000; 2611 display: ${e=>e.$open?"flex":"none"}; 2612 flex-direction: column; 2613 min-height: 0; 2614`,yPe=p.div.withConfig({displayName:"CompetitorsMultiSelect__SearchWra
2614p",componentId:"sc-1exdwxe-4"})` 2615 position: relative; 2616`,xPe=p(Cs).withConfig({displayName:"CompetitorsMultiSelect__SearchIcon",componentId:"sc-1exdwxe-5"})` 2617 position: absolute; 2618 left: 0.6rem; 2619 top: 1.125rem; /* half of input height */ 2620 transform: translateY(-50%); 2621 width: 0.95rem; 2622 height: 0.95rem; 2623 color: ${z}; 2624 pointer-events: none; 2625`,bPe=p.input.withConfig({displayName:"CompetitorsMultiSelect__SearchInput",componentId:"sc-1exdwxe-6"})` 2626 width: 100%; 2627 height: 2.25rem; 2628 border: 1px solid ${Rt}; 2629 background: ${Z}; 2630 border-radius: 0.375rem; 2631 padding: 0.5rem 0.6rem 0.5rem 2.05rem; 2632 font-size: 0.8125rem; 2633 font-weight: 750; 2634 line-height: 1; 2635 color: ${O}; 2636 outline: none; 2637 margin-bottom: 0.6rem; 2638 2639 &::placeholder { 2640 color: ${z}; 2641 font-weight: 700; 2642 } 2643 2644 &:focus { 2645 border-color: ${V}; 2646 box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.06); 2647 } 2648`,vPe=p.div.withConfig({displayName:"CompetitorsMultiSelect__ItemsWrap",componentId:"sc-1exdwxe-7"})` 2649 flex: 1; 2650 min-height: 0; 2651 overflow: auto; 2652 padding-right: 0.1rem; /* avoid scrollbar overlap */ 2653`,wPe=p.button.withConfig({displayName:"CompetitorsMultiSelect__Row",componentId:"sc-1exdwxe-8"})` 2654 width: 100%; 2655 border: 1px solid ${Rt}; 2656 background: ${e=>e.$checked?$e:Z}; 2657 border-radius: 0.375rem; 2658 padding: 0.55rem 0.6rem; 2659 display: flex; 2660 align-items: center; 2661 justify-content: space-between; 2662 gap: 0.75rem; 2663 cursor: pointer; 2664 color: ${O}; 2665 text-align: left; 2666 2667 &:hover { 2668 background: ${$e}; 2669 } 2670 2671 &:not(:last-of-type) { 2672 margin-bottom: 0.5rem; 2673 } 2674`,jPe=p.div.withConfig({displayName:"CompetitorsMultiSelect__RowLeft",componentId:"sc-1exdwxe-9"})` 2675 display: inline-flex; 2676 align-items: center; 2677 gap: 0.5rem; 2678 min-width: 0; 2679`,_Pe=p.div.withConfig({displayName:"CompetitorsMultiSelect__Name",componentId:"sc-1exdwxe-10"})` 2680 font-size: 0.875rem; 2681 font-weight: 900; 2682 color: ${O}; 2683 min-width: 0; 2684 overflow: hidden; 2685 text-overflow: ellipsis; 2686 white-space: nowrap; 2687`,CPe=p.div.withConfig({displayName:"CompetitorsMultiSelect__Footer",componentId:"sc-1exdwxe-11"})` 2688 margin-top: 0.6rem; 2689 border-top: 1px solid ${$e}; 2690 padding-top: 0.6rem; 2691 display: flex; 2692 justify-content: space-between; 2693 gap: 0.5rem; 2694`,gF=p.button.withConfig({displayName:"CompetitorsMultiSelect__SmallBtn",componentId:"sc-1exdwxe-12"})` 2695 border: 1px solid ${Rt}; 2696 background: ${Z}; 2697 color: ${O}; 2698 font-weight: medium; 2699 font-size: 0.75rem; 2700 padding: 0.35rem 0.55rem; 2701 border-radius: 0.375rem; 2702 cursor: pointer; 2703 2704 &:hover { 2705 background: ${$e}; 2706 } 2707`;function SPe({options:e,value:n,onChange:i,disabled:r}){const[o,s]=l.useState(!1),[a,c]=l.useState(""),u=l.useRef(null),m=l.useRef(null),[h,g]=l.useState({}),x=l.useMemo(()=>e.map(S=>S.id).filter(S=>Number.isFinite(S)&&S>0),[e]),y=l.useMemo(()=>{const S=a.trim().toLowerCase();return S?e.filter(I=>String(I.label||"").toLowerCase().includes(S)):e},[e,a]),w=l.useMemo(()=>{if(!Array.isArray(n)||n.length===0)return x;const S=new Set(n.map(I=>Number(I)));return x.filter(I=>S.has(I))},[x,n]),j=l.useMemo(()=>x.length>0&&w.length===x.length,[x.length,w.length]),v=l.useMemo(()=>{if(x.length===0)return"Competitors";if(j)return"All competitors";if(w.length===1){const S=e.find(I=>I.id===w[0]);return S?S.label:"1 competitor"}return`${w.length} competitors`},[j,x.length,e,w]);l.useEffect(()=>{if(!o)return;const S=A=>{const E=A.target;u.current?.contains(E)||m.current?.contains(E)||s(!1)},I=A=>{A.key==="Escape"&&s(!1)};return document.addEventListener("mousedown",S),document.addEventListener("keydown",I),()=>{document.removeEventListener("mousedown",S),document.removeEventListener("keydown",I)}},[o]),l.useEffect(()=>{o||c("")},[o]),l.useEffect(()=>{if(!o||typeof window>"u")return;const S=()=>{const I=m.current;if(!I)return;const A=I.getBoundingClientRect(),E=8,B=360,T=420,M=window.innerWidth,R=window.innerHeight,F=R-A.bottom,Y=A.top,H=F<260&&Y>F,U=Math.min(B,M-16),X=Math.max(8,Math.min(A.left,M-U-8));if(H){const Q=Math.min(T,Math.max(160,Y-16));g({left:X,width:U,bottom:Math.max(8,R-A.top+E),maxHeight:Q})}else{const Q=Math.min(T,Math.max(160,F-16));g({left:X,width:U,top:Math.min(R-8,A.bottom+E),maxHeight:Q})}};return S(),window.addEventListener("scroll",S,!0),window.addEventListener("resize",S),()=>{window.removeEventListener("scroll",S,!0),window.removeEventListener("resize",S)}},[o]);const _=S=>{const I=new Set(w);I.has(S)?I.delete(S):I.add(S);const A=x.filter(E=>I.has(E));A.length===0||A.length===x.length?i([]):i(A)},$=()=>i([]),k=x.length>1,P=()=>{x.length<=0||i([x[0]])};return t.jsxs(mPe,{children:[t.jsx("span",{ref:m,style:{display:"inline-flex"},children:t.jsx(hPe,{type:"button",size:"sm",variant:"outline",disabled:r||x.length===0,onClick:()=>s(S=>!S),leftIcon:t.jsx(Ap,{size:16}),"aria-label":v,children:t.jsx(fPe,{children:v})})}),t.jsxs(gPe,{ref:u,$open:o,style:h,role:"dialog","aria-label":"Select competitors",children:[t.jsxs(yPe,{children:[t.jsx(xPe,{"aria-hidden":!0}),t.jsx(bPe,{value:a,onChange:S=>c(S.target.value),placeholder:"Search competitorsâ¦"})]}),t.jsx(vPe,{children:y.map(S=>{const I=w.includes(S.id);return t.jsxs(wPe,{type:"button",$checked:I,onClick:()=>_(S.id),children:[t.jsxs(jPe,{children:[t.jsx(xo,{record:{name:S.label,website:S.website,logo_url:S.logo_url},size:18}),t.jsx(_Pe,{title:S.label,children:S.label})]}),I?t.jsx(Zn,{size:18,color:"var(--color-brand-700)"}):t.jsx("span",{style:{width:18}})]},S.id)})}),k?t.jsxs(CPe,{children:[t.jsx(gF,{type:"button",onClick:$,children:"All competitors"}),t.jsx(gF,{type:"button",onClick:P,children:"Deselect all"})]}):null]})]})}const yF="pk_eOyLh-37TqSd1_-2bGUeIQ".trim(),kPe="true".trim().toLowerCase()==="true";function Ub(e){return typeof e=="string"?e.trim():""}function bre(e){const n=Ub(e);if(!n)return null;try{const i=n.includes("://")?n:`https://${n}`,r=new URL(i),o=Ub(r.hostname).replace(/^www\./i,"");return o||null}catch{return null}}function vre(e){if(!yF)return null;const n=Ub(e);return n?`https://img.logo.dev/${n}?token=${encodeURIComponent(yF)}`:null}const $Pe=p.span.withConfig({displayName:"CompetitorLogo__Wrap",componentId:"sc-1wz6rrr-0"})` 2708 width: ${e=>e.$size}px; 2709 height: ${e=>e.$size}px; 2710 border-radius: ${e=>e.$shape==="circle"?"9999px":"0.6rem"}; 2711 border: 1px solid ${V}; 2712 background: ${$e}; 2713 overflow: hidden; 2714 position: relative; 2715 display: inline-flex; 2716 align-items: center; 2717 justify-content: center; 2718 flex: 0 0 auto; 2719`,IPe=p.img.withConfig({displayName:"CompetitorLogo__Img",componentId:"sc-1wz6rrr-1"})` 2720 position: absolute; 2721 inset: 0; 2722 width: 100%; 2723 height: 100%; 2724 object-fit: cover; 2725 display: block; 2726`;function PPe(e){const n=bre(String(e||""));return n?vre(n):null}function xo({record:e,size:n=18,shape:i="circle",className:r,style:o,alt:s,forceLogoDev:a,fallback:c}){const u=a??kPe,m=l.useMemo(()=>Ub(e?.logo_url)||null,[e?.logo_url]),h=l.useMemo(()=>PPe(e?.website),[e?.website]),[g,x]=l.useState("primary"),y=l.useMemo(()=>{const v=u?h:m,_=u?null:h;return g==="primary"?v:g==="fallback"?_:null},[m,u,h,g]);l.useEffect(()=>{x("primary")},[m,h,u]);const w=c??t.jsx(To,{size:Math.max(12,Math.floor(n*.65)),color:z}),j=s??(e?.name?`${e.name} logo`:"Logo");return t.jsxs($Pe,{className:r,style:o,$size:n,$shape:i,"aria-hidden":!s,children:[w,y?t.jsx(IPe,{src:y,alt:j,loading:"lazy",referrerPolicy:"no-referrer",onError:()=>{x(g==="primary"&&!u&&h?"fallback":"none")}}):null]})}const APe=p.div.withConfig({displayName:"KebabMenu__Wrap",componentId:"sc-u1iedr-0"})` 2727 position: relative; 2728 display: inline-flex; 2729 align-items: center; 2730`,NPe=p.button.withConfig({displayName:"KebabMenu__Button",componentId:"sc-u1iedr-1"})` 2731 width: ${e=>e.$px}px; 2732 height: ${e=>e.$px}px; 2733 border-radius: 0.8rem; 2734 border: 1px solid ${e=>e.$variant==="ghost"?"transparent":V}; 2735 background: ${e=>e.$variant==="ghost"?"transparent":Z}; 2736 color: ${z}; 2737 cursor: pointer; 2738 display: inline-flex; 2739 align-items: center; 2740 justify-content: center; 2741 transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease; 2742 2743 &:hover:not(:disabled) { 2744 background: ${$e}; 2745 border-color: ${e=>e.$variant==="ghost"?"transparent":Rt}; 2746 color: ${O}; 2747 } 2748 2749 &:disabled { 2750 opacity: 0.6;
2751 cursor: not-allowed; 2752 } 2753 2754 &:focus-visible { 2755 outline: none; 2756 box-shadow: 0 0 0 3px ${En}; 2757 } 2758`,zPe=p.div.withConfig({displayName:"KebabMenu__Menu",componentId:"sc-u1iedr-2"})` 2759 position: fixed; 2760 top: ${e=>e.$top}px; 2761 ${e=>typeof e.$left=="number"?`left: ${e.$left}px;`:""} 2762 ${e=>typeof e.$right=="number"?`right: ${e.$right}px;`:""} 2763 z-index: 1000; 2764 min-width: ${e=>e.$minWidth}px; 2765 max-width: calc(100vw - 24px); 2766 max-height: calc(100vh - 16px); 2767 overflow: auto; 2768 background: ${Z}; 2769 border: 1px solid ${V}; 2770 border-radius: 0.9rem; 2771 box-shadow: 0 18px 60px rgba(0, 0, 0, 0.14); 2772 padding: 0.35rem; 2773`,TPe=p.button.withConfig({displayName:"KebabMenu__Item",componentId:"sc-u1iedr-3"})` 2774 width: 100%; 2775 border: 0; 2776 background: transparent; 2777 cursor: pointer; 2778 padding: 0.55rem 0.65rem; 2779 border-radius: 0.7rem; 2780 display: flex; 2781 align-items: center; 2782 gap: 0.6rem; 2783 font-size: 0.85rem; 2784 font-weight: 850; 2785 text-align: left; 2786 color: ${e=>e.$danger?"rgb(220, 38, 38)":O}; 2787 2788 &:hover:not(:disabled) { 2789 background: ${$e}; 2790 } 2791 2792 &:disabled { 2793 cursor: not-allowed; 2794 opacity: 0.55; 2795 } 2796 2797 &:focus-visible { 2798 outline: none; 2799 box-shadow: 0 0 0 3px ${En}; 2800 } 2801`;function wre({buttonLabel:e,buttonTitle:n,icon:i,items:r,disabled:o,align:s="left",buttonVariant:a="default",buttonPx:c=34,menuMinWidthPx:u=180}){const[m,h]=l.useState(!1),[g,x]=l.useState(null),y=l.useRef(null),w=l.useRef(null),j=l.useRef(null),v=(r||[]).length>0,_=()=>{const k=y.current;if(!k)return;const P=k.getBoundingClientRect();j.current=P;const S=8,A=Math.round(P.bottom+8),E=s==="right"?P.right-u:P.left,B=Math.round(Math.max(S,E));x({top:A,left:B})};l.useEffect(()=>{m&&_()},[m,s]),l.useEffect(()=>{if(!m||!g)return;const k=window.requestAnimationFrame(()=>{const P=j.current,S=w.current;if(!P||!S)return;const I=S.getBoundingClientRect(),A=8,E=8,B=window.innerWidth,T=window.innerHeight,M=(K,G,L)=>Math.max(G,Math.min(L,K)),R=s==="right"?P.right-I.width:P.left,F=Math.round(M(R,A,Math.max(A,B-A-I.width))),Y=P.bottom+E,H=P.top-E-I.height;let U;const X=Y+I.height<=T-A,Q=H>=A;X?U=Y:Q?U=H:U=M(Y,A,Math.max(A,T-A-I.height)),U=Math.round(U),x(K=>K?K.top===U&&K.left===F?K:{top:U,left:F}:{top:U,left:F})});return()=>window.cancelAnimationFrame(k)},[s,m,g]),l.useEffect(()=>{if(!m)return;const k=I=>{const A=I.target;A&&(y.current?.contains(A)||w.current?.contains(A)||h(!1))},P=I=>{I.key==="Escape"&&h(!1)},S=()=>h(!1);return document.addEventListener("mousedown",k),window.addEventListener("keydown",P),window.addEventListener("scroll",S,!0),window.addEventListener("resize",S),()=>{document.removeEventListener("mousedown",k),window.removeEventListener("keydown",P),window.removeEventListener("scroll",S,!0),window.removeEventListener("resize",S)}},[m]);const $=l.useMemo(()=>!m||!g?null:t.jsx(zPe,{ref:w,role:"menu","aria-label":e,$top:g.top,$left:g.left,$minWidth:u,children:r.map(k=>t.jsxs(TPe,{type:"button",$danger:k.danger,disabled:!!k.disabled,title:k.title,onClick:()=>{k.disabled||(h(!1),k.onClick?.())},children:[k.icon?t.jsx("span",{style:{display:"inline-flex",alignItems:"center"},children:k.icon}):null,k.label]},k.key))}),[e,r,u,m,g]);return t.jsxs(APe,{ref:y,children:[t.jsx(NPe,{type:"button",$px:c,$variant:a,"aria-label":e,title:n,"aria-haspopup":v?"menu":void 0,"aria-expanded":v?m:void 0,disabled:o||!v,onClick:()=>{o||!v||h(k=>!k)},children:i}),m&&g?jr.createPortal($,document.body):null]})}const EPe=p.div.withConfig({displayName:"CompetitorsTwoBoxes__Columns",componentId:"sc-k9l9uw-0"})` 2802 display: grid; 2803 grid-template-columns: 1fr; 2804 gap: 1.25rem; 2805 2806 @media (min-width: 900px) { 2807 grid-template-columns: 1fr 1fr; 2808 } 2809`,xF=p.div.withConfig({displayName:"CompetitorsTwoBoxes__Column",componentId:"sc-k9l9uw-1"})` 2810 min-width: 0; 2811`,bF=p.div.withConfig({displayName:"CompetitorsTwoBoxes__DropZone",componentId:"sc-k9l9uw-2"})` 2812 margin-top: 0.5rem; 2813 border: 1px solid transparent; 2814 ${e=>e.$scrollMode==="inner"?` 2815 /* Keep the overall component height stable while dragging between columns. */ 2816 height: 360px; 2817 overflow-y: auto; 2818 overscroll-behavior: contain; 2819 `:` 2820 /* Parent scroll container handles scrolling. */ 2821 /* Keep an empty column as a reasonable drop target. */ 2822 min-height: 220px; 2823 height: auto; 2824 overflow-y: visible; 2825 overscroll-behavior: auto; 2826 2827 @media (max-width: 640px) { 2828 min-height: 160px; 2829 } 2830 `} 2831 padding: 0.25rem; 2832 border-radius: 0.875rem; 2833 transition: background-color 140ms ease, box-shadow 140ms ease; 2834 2835 ${e=>e.$active?` 2836 background: ${At}; 2837 `:""} 2838 2839 ${e=>e.$hovered?` 2840 box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.06); 2841 `:""} 2842`,vF=p.div.withConfig({displayName:"CompetitorsTwoBoxes__ZoneShell",componentId:"sc-k9l9uw-3"})` 2843 border-radius: 0.875rem; 2844 padding: 0.75rem; 2845 border: 1px solid ${e=>e.$tone==="direct"?Er:Mo}; 2846 background: ${e=>e.$tone==="direct"?kn:si}; 2847 transition: box-shadow 140ms ease, border-color 140ms ease; 2848 2849 ${e=>e.$hovered?` 2850 box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.06); 2851 `:""} 2852`,MPe=p.span.withConfig({displayName:"CompetitorsTwoBoxes__CounterPill",componentId:"sc-k9l9uw-4"})` 2853 font-size: 0.75rem; 2854 font-weight: 700; 2855 color: ${z}; 2856 background: ${$e}; 2857 border: 1px solid ${V}; 2858 padding: 0.125rem 0.5rem; 2859 border-radius: 9999px; 2860 white-space: nowrap; 2861`,wF=p.div.withConfig({displayName:"CompetitorsTwoBoxes__TitleWithCounter",componentId:"sc-k9l9uw-5"})` 2862 display: inline-flex; 2863 align-items: center; 2864 gap: 0.5rem; 2865`,jF=p.div.withConfig({displayName:"CompetitorsTwoBoxes__SubTitle",componentId:"sc-k9l9uw-6"})` 2866 font-size: 0.875rem; 2867 font-weight: 800; 2868 color: ${O}; 2869`,_F=p.div.withConfig({displayName:"CompetitorsTwoBoxes__SubHint",componentId:"sc-k9l9uw-7"})` 2870 margin-top: 0.25rem; 2871 font-size: 0.75rem; 2872 font-weight: 700; 2873 color: ${z}; 2874 min-height: 2.25rem; 2875`,CF=p.button.withConfig({displayName:"CompetitorsTwoBoxes__InfoIconButton",componentId:"sc-k9l9uw-8"})` 2876 border: 0; 2877 background: transparent; 2878 padding: 0; 2879 display: inline-flex; 2880 align-items: center; 2881 justify-content: center; 2882 color: ${z}; 2883 cursor: pointer; 2884 2885 &:hover { 2886 color: ${O}; 2887 } 2888 2889 &:focus-visible { 2890 outline: none; 2891 box-shadow: 0 0 0 3px ${En}; 2892 border-radius: 0.5rem; 2893 } 2894`,SF=p.div.withConfig({displayName:"CompetitorsTwoBoxes__List",componentId:"sc-k9l9uw-9"})` 2895 display: flex; 2896 flex-direction: column; 2897 gap: 0.5rem; 2898`,kF=p.div.withConfig({displayName:"CompetitorsTwoBoxes__Row",componentId:"sc-k9l9uw-10"})` 2899 display: flex; 2900 align-items: center; 2901 justify-content: space-between; 2902 gap: 0.65rem; 2903 padding: 0.55rem 0.75rem; 2904 border: 1px solid ${Rt}; 2905 background: ${Z}; 2906 border-radius: 0.75rem; 2907 min-height: 56px; 2908 box-sizing: border-box; 2909 /* Allow the actions popover to escape the row bounds. */ 2910 overflow: visible; 2911 transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
2912 cursor: ${e=>e.$disabled?"default":"grab"}; 2913 2914 &:hover { 2915 border-color: ${z}; 2916 background: ${At}; 2917 box-shadow: 0 10px 24px rgba(17, 24, 39, 0.06); 2918 } 2919 2920 &:active { 2921 cursor: ${e=>e.$disabled?"default":"grabbing"}; 2922 } 2923`,$F=p.div.withConfig({displayName:"CompetitorsTwoBoxes__DragHandle",componentId:"sc-k9l9uw-11"})` 2924 width: 18px; 2925 height: 18px; 2926 display: inline-flex; 2927 align-items: center; 2928 justify-content: center; 2929 color: ${z}; 2930 flex: 0 0 auto; 2931`,IF=p.div.withConfig({displayName:"CompetitorsTwoBoxes__Left",componentId:"sc-k9l9uw-12"})` 2932 display: flex; 2933 align-items: center; 2934 gap: 0.6rem; 2935 min-width: 0; 2936 flex: 1 1 auto; 2937`,PF=p.div.withConfig({displayName:"CompetitorsTwoBoxes__TextCol",componentId:"sc-k9l9uw-13"})` 2938 display: flex; 2939 flex-direction: column; 2940 gap: 0.125rem; 2941 min-width: 0; 2942 flex: 1 1 0%; 2943`,AF=p.div.withConfig({displayName:"CompetitorsTwoBoxes__Name",componentId:"sc-k9l9uw-14"})` 2944 font-size: 0.875rem; 2945 font-weight: 800; 2946 color: ${O}; 2947 min-width: 0; 2948 overflow: hidden; 2949 text-overflow: ellipsis; 2950 white-space: nowrap; 2951`,NF=p.div.withConfig({displayName:"CompetitorsTwoBoxes__Website",componentId:"sc-k9l9uw-15"})` 2952 font-size: 0.75rem; 2953 color: ${z}; 2954 min-width: 0; 2955 overflow: hidden; 2956 text-overflow: ellipsis; 2957 white-space: nowrap; 2958`,zF=p.div.withConfig({displayName:"CompetitorsTwoBoxes__Right",componentId:"sc-k9l9uw-16"})` 2959 display: inline-flex; 2960 align-items: center; 2961 gap: 0.35rem; 2962 flex: 0 0 auto; 2963`,RPe=p.button.withConfig({displayName:"CompetitorsTwoBoxes__RemoveButton",componentId:"sc-k9l9uw-17"})` 2964 width: 26px; 2965 height: 26px; 2966 border-radius: 0.75rem; 2967 border: 0; 2968 background: transparent; 2969 color: ${O}; 2970 cursor: pointer; 2971 display: inline-flex; 2972 align-items: center; 2973 justify-content: center; 2974 transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease; 2975 2976 &:hover:not(:disabled) { 2977 color: ${z}; 2978 background: ${At}; 2979 } 2980 2981 &:disabled { 2982 opacity: 0.6; 2983 cursor: not-allowed; 2984 } 2985 2986 &:focus-visible { 2987 outline: none; 2988 background: ${At}; 2989 box-shadow: 0 0 0 3px ${En}; 2990 } 2991`,OPe=p.button.withConfig({displayName:"CompetitorsTwoBoxes__RemovePillButton",componentId:"sc-k9l9uw-18"})` 2992 height: 30px; 2993 padding: 0 0.6rem; 2994 border-radius: 9999px; 2995 border: 1px solid ${Er}; 2996 background: ${kn}; 2997 color: ${oi}; 2998 cursor: pointer; 2999 display: inline-flex; 3000 align-items: center; 3001 gap: 0.35rem; 3002 font-weight: 900; 3003 font-size: 0.75rem; 3004 3005 &:hover:not(:disabled) { 3006 filter: brightness(0.98); 3007 } 3008 3009 &:disabled { 3010 opacity: 0.6; 3011 cursor: not-allowed; 3012 } 3013 3014 &:focus-visible { 3015 outline: none; 3016 box-shadow: 0 0 0 3px ${En}; 3017 } 3018`,DPe=p.button.withConfig({displayName:"CompetitorsTwoBoxes__AddPillButton",componentId:"sc-k9l9uw-19"})` 3019 height: 30px; 3020 padding: 0 0.6rem; 3021 border-radius: 9999px; 3022 border: 1px solid ${Mo}; 3023 background: ${si}; 3024 color: ${Ft}; 3025 cursor: pointer; 3026 display: inline-flex; 3027 align-items: center; 3028 gap: 0.35rem; 3029 font-weight: 950; 3030 font-size: 0.75rem; 3031 3032 &:hover:not(:disabled) { 3033 filter: brightness(0.98); 3034 } 3035 3036 &:disabled { 3037 opacity: 0.55; 3038 cursor: not-allowed; 3039 } 3040 3041 &:focus-visible { 3042 outline: none; 3043 box-shadow: 0 0 0 3px ${En}; 3044 } 3045`,LPe=p.span.withConfig({displayName:"CompetitorsTwoBoxes__VisibilityBadge",componentId:"sc-k9l9uw-20"})` 3046 font-size: 0.675rem; 3047 font-weight: 800; 3048 color: ${z}; 3049 background: ${$e}; 3050 border: 1px solid ${V}; 3051 padding: 0.0625rem 0.375rem; 3052 border-radius: 9999px; 3053 white-space: nowrap; 3054 flex: 0 0 auto; 3055`,_k=p.div.withConfig({displayName:"CompetitorsTwoBoxes__EmptyText",componentId:"sc-k9l9uw-21"})` 3056 margin-top: 0.5rem; 3057 color: ${z}; 3058 font-size: 0.875rem; 3059`;function jre({direct:e,suggested:n,effectiveMax:i,isLoading:r,isSaving:o,forceLogoDev:s,scrollMode:a="inner",onSetType:c,onRemove:u,onManageAliases:m,directActions:h="trash"}){const[g,x]=l.useState(null),[y,w]=l.useState(null),j=e.length>=i,v=l.useMemo(()=>new Map(e.map(E=>[E.id,E])),[e]),_=l.useMemo(()=>new Map(n.map(E=>[E.id,E])),[n]),$=E=>JSON.stringify(E),k=E=>{try{const B=JSON.parse(E),T=Number(B?.id),M=B?.from;return!Number.isFinite(T)||T<=0||M!=="direct"&&M!=="suggested"?null:{id:T,from:M}}catch{return null}},P=E=>{const B=E.dataTransfer,T=B.getData("application/x-competitor")||B.getData("text/plain")||"";return k(T)},S=(E,B)=>
3059{if(o){E.preventDefault();return}E.dataTransfer.effectAllowed="move",E.dataTransfer.setData("application/x-competitor",$(B)),E.dataTransfer.setData("text/plain",$(B)),x(B)},I=()=>{x(null),w(null)},A=async(E,B)=>{E.preventDefault();const T=P(E);if(w(null),!T||T.from===B)return;const M=T.from==="direct"?v.get(T.id):_.get(T.id);M&&await c(M,B)};return t.jsxs(EPe,{children:[t.jsxs(xF,{children:[t.jsxs(wF,{children:[t.jsx(jF,{children:"Direct competitors"}),t.jsx(at,{content:"These competitors will be actively tracked and compared to your brandâs metrics and visibility.",size:"sm",maxWidth:360,children:t.jsx(CF,{type:"button","aria-label":"Info: direct competitors",children:t.jsx(wn,{size:14})})}),t.jsxs(MPe,{children:[e.length,"/",i]})]}),t.jsx(_F,{children:"Drag competitors here, or use the buttons to add/remove."}),t.jsx(bF,{$active:!!g,$hovered:y==="direct",$scrollMode:a,onDragOver:E=>{o||(E.preventDefault(),E.dataTransfer.dropEffect="move",w("direct"))},onDragLeave:()=>w(E=>E==="direct"?null:E),onDrop:E=>void A(E,"direct"),children:t.jsx(vF,{$tone:"direct",$hovered:y==="direct",children:r?t.jsx(_k,{children:"Loading competitorsâ¦"}):e.length===0?t.jsx(_k,{children:"No direct competitors yet."}):t.jsx(SF,{children:e.map(E=>t.jsxs(kF,{$disabled:o,draggable:!o,onDragStart:B=>{if(B.target?.closest("button")){B.preventDefault();return}S(B,{id:E.id,from:"direct"})},onDragEnd:I,children:[t.jsxs(IF,{children:[t.jsx($F,{title:"Drag to move",children:t.jsx(b9,{size:16})}),t.jsx(xo,{record:E,size:32,shape:"rounded",forceLogoDev:s}),t.jsxs(PF,{children:[t.jsx(at,{content:E.name,onlyIfTruncated:!0,size:"sm",maxWidth:420,children:t.jsx(AF,{children:E.name})}),t.jsx(at,{content:E.website,onlyIfTruncated:!0,size:"sm",maxWidth:720,children:t.jsx(NF,{children:E.website})})]})]}),t.jsx(zF,{children:h==="menu"?t.jsx(wre,{buttonLabel:`Actions for ${E.name}`,buttonTitle:"Actions",icon:t.jsx(zne,{size:16}),buttonPx:26,align:"right",buttonVariant:"ghost",items:[{key:"aliases",label:"Aliases",icon:t.jsx(X_,{size:16}),disabled:!m,title:m?"Manage aliases":"Coming soon",onClick:()=>m?.(E)},{key:"delete",label:"Delete",icon:t.jsx(Fi,{size:16}),danger:!0,onClick:()=>void u(E.id)}]}):t.jsxs(OPe,{type:"button",draggable:!1,onDragStart:B=>B.preventDefault(),onClick:()=>void u(E.id),disabled:o,"aria-label":"Remove",title:"Remove",children:[t.jsx(Fi,{size:16}),"Remove"]})})]},E.id))})})})]}),t.jsxs(xF,{children:[t.jsxs(wF,{children:[t.jsx(jF,{children:"Suggested competitors"}),t.jsx(at,{content:"These competitors wonât be tracked yet, but will be suggested to you. You can choose to track them later.",size:"sm",maxWidth:380,children:t.jsx(CF,{type:"button","aria-label":"Info: suggested competitors",children:t.jsx(wn,{size:14})})})]}),t.jsx(_F,{children:"Click âAddâ to start tracking, or drag them into the Direct column."}),t.jsx(bF,{$active:!!g,$hovered:y==="suggested",$scrollMode:a,onDragOver:E=>{o||(E.preventDefault(),E.dataTransfer.dropEffect="move",w("suggested"))},onDragLeave:()=>w(E=>E==="suggested"?null:E),onDrop:E=>void A(E,"suggested"),children:t.jsx(vF,{$tone:"suggested",$hovered:y==="suggested",children:r?t.jsx(_k,{children:"Loading competitorsâ¦"}):n.length===0?t.jsx(_k,{children:"No suggested competitors yet."}):t.jsx(SF,{children:n.map(E=>t.jsxs(kF,{$disabled:o,draggable:!o,onDragStart:B=>{if(B.target?.closest("button")){B.preventDefault();return}S(B,{id:E.id,from:"suggested"})},onDragEnd:I,children:[t.jsxs(IF,{children:[t.jsx($F,{title:"Drag to move",children:t.jsx(b9,{size:16})}),t.jsx(xo,{record:E,size:32,shape:"rounded",forceLogoDev:s}),t.jsxs(PF,{children:[t.jsx(at,{content:E.name,onlyIfTruncated:!0,size:"sm",maxWidth:420,children:t.jsx(AF,{children:E.name})}),t.jsx(at,{content:E.website,onlyIfTruncated:!0,size:"sm",maxWidth:720,children:t.jsx(NF,{children:E.website})})]})]}),t.jsxs(zF,{children:[typeof E.visibility_score=="number"&&E.visibility_score>0&&t.jsx(at,{content:`Mentioned in ${Math.round(E.visibility_score)}% of AI responses`,size:"sm",maxWidth:280,children:t.jsxs(LPe,{children:[Math.round(E.visibility_score),"%"]})}),t.jsx(at,{content:j?`You can track up to ${i} direct competitors.`:"Add to direct competitors",onlyIfTruncated:!1,size:"sm",maxWidth:320,children:t.jsx("span",{children:t.jsxs(DPe,{type:"button",draggable:!1,onDragStart:B=>B.preventDefault(),onClick:()=>void c(E,"direct"),disabled:o||j,"aria-label":"Add",title:"Add",children:[t.jsx(gr,{size:16}),"Add"]})})}),t.jsx(RPe,{type:"button",draggable:!1,onDragStart:B=>B.preventDefault(),onClick:()=>void u(E.id),disabled:o,"aria-label":"Dismiss",title:"Dismiss",children:t.jsx(Fi,{size:16})})]})]},E.id))})})})]})]})}function NM(e){const n=String(e?.start||"").slice(0,10),i=String(e?.end||"").slice(0,10);return!!n&&!!i&&n===i}const BPe=p.div.withConfig({displayName:"SingleDayChartFallback__Wrap",componentId:"sc-dd8ix9-0"})` 3060 height: 100%; 3061 width: 100%; 3062 display: flex; 3063 flex-direction: column; 3064 justify-content: flex-start; 3065 flex: 1 1 auto; 3066 box-sizing: border-box; 3067 overflow: ${e=>e.$scroll?"auto":"hidden"}; 3068 border: 0; 3069 border-radius: 0; 3070 background: transparent; 3071 padding: ${e=>e.$compact?"10px 10px 8px 10px":"14px 14px 12px 14px"}; 3072 min-height: 0; 3073`,FPe=p.div.withConfig({displayName:"SingleDayChartFallback__Title",componentId:"sc-dd8ix9-1"})` 3074 font-size: 12px; 3075 font-weight: 950; 3076 color: ${z}; 3077 text-transform: uppercase; 3078 letter-spacing: 0.06em; 3079`,WPe=p.div.withConfig({displayName:"SingleDayChartFallback__Day",componentId:"sc-dd8ix9-2"})` 3080 margin-top: ${e=>e.$compact?"4px":"6px"}; 3081 font-size: 14px; 3082 font-weight: 950; 3083 color: ${O}; 3084`,UPe=p.div.withConfig({displayName:"SingleDayChartFallback__Primary",componentId:"sc-dd8ix9-3"})` 3085 margin-top: ${e=>e.$compact?"8px":"10px"}; 3086 display: flex; 3087 align-items: baseline; 3088 justify-content: space-between; 3089 gap: 10px; 3090`,HPe=p.div.withConfig({displayName:"SingleDayChartFallback__PrimaryLabel",componentId:"sc-dd8ix9-4"})` 3091 font-size: 12px; 3092 font-weight: 850; 3093 color: ${z}; 3094`,qPe=p.div.withConfig({displayName:"SingleDayChartFallback__PrimaryValue",componentId:"sc-dd8ix9-5"})` 3095 font-size: 18px; 3096 font-weight: 950; 3097 color: ${O}; 3098`,GPe=p.div.withConfig({displayName:"SingleDayChartFallback__Rows",componentId:"sc-dd8ix9-6"})` 3099 margin-top: ${e=>e.$compact?"8px":"10px"}; 3100 display: grid; 3101 gap: 6px; 3102`,VPe=p.div.withConfig({displayName:"SingleDayChartFallback__Row",componentId:"sc-dd8ix9-7"})` 3103 display: flex; 3104 align-items: center; 3105 justify-content: space-between; 3106 gap: 10px; 3107`,KPe=p.div.withConfig({displayName:"SingleDayChartFallback__RowLeft",componentId:"sc-dd8ix9-8"})` 3108 display: inline-flex; 3109 align-items: center; 3110 gap: 8px; 3111 min-width: 0; 3112`,YPe=p.span.withConfig({displayName:"SingleDayChartFallback__Dot",componentId:"sc-dd8ix9-9"})` 3113 width: 10px; 3114 height: 10px; 3115 border-radius: 999px; 3116 background: ${e=>e.$color||$e}; 3117 border: 1px solid ${V}; 3118 flex: 0 0 auto; 3119`,XPe=p.div.withConfig({displayName:"SingleDayChartFallback__RowLabel",componentId:"sc-dd8ix9-10"})` 3120 font-size: 12px; 3121 font-weight: 850; 3122 color: ${z}; 3123 min-width: 0; 3124 overflow: hidden; 3125 text-overflow: ellipsis; 3126 white-space: nowrap; 3127`,QPe=p.div.withConfig({displayName:"SingleDayChartFallback__RowValue",componentId:"sc-dd8ix9-11"})` 3128 font-size: 12px; 3129 font-weight: 950; 3130 color: ${O}; 3131 flex: 0 0 auto; 3132`,ZPe=p.div.withConfig({displayName:"SingleDayChartFallback__Hint",componentId:"sc-dd8ix9-12"})` 3133 margin-top: ${e=>e.$compact?"8px":"10px"}; 3134 font-size: 12px; 3135 font-weight: 750; 3136 color: ${z}; 3137`;function ky(e){const n=l.useMemo(()=>{const a=String(e.dayISO||"").slice(0,10);return a?j_({value:a,format:"date",timeZoneMode:"viewer",placeholder:a}):"â"},[e.dayISO]),i=Array.isArray(e.rows)?e.rows:[],r=e.scroll!==!1,o=e.compact===!0,s=e.hideHint===!0;return t.jsxs(BPe,{$scroll:r,$compact:o,children:[t.jsx(FPe,{children:e.title||"Single day"}),t.jsx(WPe,{$compact:o,children:n}),t.jsxs(UPe,{$compact:o,children:[t.jsx(HPe,{children:e.primaryLabel}),t.jsx(qPe,{children:e.primaryValue})]}),i.length>0?t.jsx(GPe,{$compact:o,children:i.map(a=>t.jsxs(VPe,{children:[t.jsxs(KPe,{children:[t.jsx(YPe,{$color:a.color}),t.jsx(XPe,{title:a.label,children:a.label})]}),t.jsx(QPe,{children:a.value})]},`${a.label}-${a.value}`))}
3137):null,s?null:t.jsx(ZPe,{$compact:o,children:e.hint||"Select multiple days to see a trend."})]})}function Hb({src:e,alt:n="",Img:i,className:r,style:o,loading:s="lazy",referrerPolicy:a="no-referrer",fallback:c}){const u=l.useMemo(()=>Ub(e),[e]),[m,h]=l.useState(!1);l.useEffect(()=>{h(!1)},[u]);const g=c??t.jsx(To,{size:16,color:z});if(!u||m)return t.jsx(t.Fragment,{children:g});const x=i||"img";return t.jsx(x,{className:r,style:o,src:u,alt:n,loading:s,referrerPolicy:a,onError:()=>h(!0)})}const TF=new Set,JPe=p.img.withConfig({displayName:"LogoDevLogo__DefaultImg",componentId:"sc-12cdrew-0"})` 3138 width: ${e=>e.$size}px; 3139 height: ${e=>e.$size}px; 3140 border-radius: 0.25rem; 3141 background: ${$e}; 3142 border: 1px solid ${V}; 3143 flex: 0 0 auto; 3144 object-fit: contain; 3145 display: block; 3146`;function $u({domain:e,alt:n="",size:i=16,Img:r,className:o,style:s,fallback:a}){const c=l.useMemo(()=>bre(Ub(e)),[e]),u=l.useMemo(()=>c?vre(c):null,[c]),[m,h]=l.useState(!1);l.useEffect(()=>{h(!!(c&&TF.has(c)))},[c]);const g=a??t.jsx(To,{size:Math.max(12,Math.floor(i*.9)),color:z});if(!u||!c||m)return t.jsx(t.Fragment,{children:g});const x=r||JPe,y=r?{}:{$size:i};return t.jsx(x,{...y,className:o,style:s,src:u,alt:n,loading:"lazy",referrerPolicy:"no-referrer",onError:()=>{TF.add(c),h(!0)}})}const eAe=p.div.withConfig({displayName:"ProjectMark__Mark",componentId:"sc-18t76ym-0"})` 3147 width: ${e=>e.$size}px; 3148 height: ${e=>e.$size}px; 3149 border-radius: 0.5rem; 3150 border: 0; 3151 background: transparent; 3152 color: ${z}; 3153 display: inline-flex; 3154 align-items: center; 3155 justify-content: center; 3156 overflow: hidden; 3157 flex-shrink: 0; 3158`,tAe=p.img.withConfig({displayName:"ProjectMark__MarkImg",componentId:"sc-18t76ym-1"})` 3159 width: 100%; 3160 height: 100%; 3161 object-fit: cover; 3162 display: block; 3163`;function By({logoUrl:e,size:n=22,fallback:i}){return t.jsx(eAe,{$size:n,"aria-hidden":"true",children:t.jsx(Hb,{src:e,alt:"",Img:tAe,fallback:i??t.jsx(_P,{size:Math.max(14,Math.round(n*.82))})})})}const nAe=Tn` 3164 0% { background-position: 200% 0; } 3165 100% { background-position: -200% 0; } 3166`,wz=e=>typeof e=="number"?`${e}px`:e,nt=p.div.withConfig({displayName:"Skeleton",componentId:"sc-h01ihy-0"})` 3167 width: ${e=>wz(e.width)||"100%"}; 3168 height: ${e=>wz(e.height)||"1rem"}; 3169 border-radius: ${e=>wz(e.radius)||"0.375rem"}; 3170 background: linear-gradient(90deg, ${$e} 0%, ${V} 50%, ${$e} 100%); 3171 background-size: 200% 100%; 3172 animation: ${nAe} 1.15s ease-in-out infinite; 3173 3174 @media (prefers-reduced-motion: reduce) { 3175 animation: none; 3176 background: ${$e}; 3177 } 3178`,tr=p.div.withConfig({displayName:"Table__TableWrap",componentId:"sc-juyth3-0"})` 3179 width: 100%; 3180 overflow-x: auto; 3181 border: 1px solid ${V}; 3182 border-radius: 0.875rem; 3183 background: ${Z}; 3184`,nr=p.table.withConfig({displayName:"Table",componentId:"sc-juyth3-1"})` 3185 width: 100%; 3186 /* iOS Safari: sticky table headers can fail when border-collapse is "collapse". */ 3187 border-collapse: separate; 3188 border-spacing: 0; 3189 min-width: ${e=>e.$minWidth||"auto"}; 3190`,pr=p.thead.withConfig({displayName:"Table__THead",componentId:"sc-juyth3-2"})` 3191 background: ${At}; 3192 border-bottom: 1px solid ${V}; 3193 position: sticky; 3194 top: 0; 3195 z-index: 2; 3196`,mr=p.tbody.withConfig({displayName:"Table__TBody",componentId:"sc-juyth3-3"})``,Cn=p.tr.withConfig({displayName:"Table__TR",componentId:"sc-juyth3-4"})` 3197 background: ${Z}; 3198 border-bottom: 1px solid ${$e}; 3199 3200 &:last-child { 3201 border-bottom: 0; 3202 } 3203`,Et=p.th.withConfig({displayName:"Table__TH",componentId:"sc-juyth3-5"})` 3204 position: sticky; 3205 top: 0; 3206 z-index: 3; 3207 background: ${At}; 3208 text-align: ${e=>e.$align||"left"}; 3209 font-size: 0.75rem; 3210 font-weight: 700; 3211 letter-spacing: 0.02em; 3212 color: ${z}; 3213 padding: 0.75rem 0.875rem; 3214 white-space: nowrap; 3215`,bt=p.td.withConfig({displayName:"Table__TD",componentId:"sc-juyth3-6"})` 3216 text-align: ${e=>e.$align||"left"}; 3217 padding: 0.75rem 0.875rem; 3218 color: ${e=>e.$muted?z:O}; 3219 font-size: 0.875rem; 3220 font-weight: ${e=>e.$muted?650:750}; 3221 vertical-align: middle; 3222`,Iu=p.div.withConfig({displayName:"Table__TableEmpty",componentId:"sc-juyth3-7"})` 3223 padding: 1rem; 3224 color: ${z}; 3225 font-size: 0.875rem; 3226 border: 1px dashed ${V}; 3227 border-radius: 0.875rem; 3228 background: ${At}; 3229`;function iAe(e){return typeof e=="number"?`${e}px`:e}const rAe=p.div.withConfig({displayName:"Table__TableSkeletonRoot",componentId:"sc-juyth3-8"})` 3230 padding: 0.75rem; 3231 display: flex; 3232 flex-direction: column; 3233 gap: 0.6rem; 3234`,EF=p.div.withConfig({displayName:"Table__TableSkeletonRow",componentId:"sc-juyth3-9"})` 3235 display: grid; 3236 grid-template-columns: ${e=>e.$cols}; 3237 gap: 0.75rem; 3238 align-items: center; 3239`;function $p(e){const n=e.columns&&e.columns.length>0?e.columns:[{},{},{},{}],i=Math.max(1,Number(e.rows??6)||6),r=e.showHeader!==!1,o=n.map(s=>s?.width?iAe(s.width):"minmax(0, 1fr)").join(" ");return t.jsx(tr,{children:t.jsxs(rAe,{style:e.minWidth?{minWidth:e.minWidth}:void 0,children:[r?t.jsx(EF,{$cols:o,children:n.map((s,a)=>t.jsx(nt,{height:12,width:`${40+a*13%35}
3239%`,radius:8},`h-${a}`))}):null,Array.from({length:i}).map((s,a)=>t.jsx(EF,{$cols:o,children:n.map((c,u)=>t.jsx(nt,{height:14,width:`${55+(a*11+u*9)%35}%`,radius:10},`c-${a}-${u}`))},`r-${a}`))]})})}function Ai(e){const{children:n,align:i="left",tooltip:r,tooltipMaxWidth:o,style:s,className:a}=e;return t.jsx(Et,{$align:i,style:s,className:a,children:t.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[t.jsx("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis"},children:n}),r?t.jsx(at,{maxWidth:o||360,content:r,children:t.jsx("span",{style:{display:"inline-flex",color:z},"aria-label":"Info",children:t.jsx(wn,{size:14})})}):null]})})}const oAe=p.div.withConfig({displayName:"WorkspaceLoadingSkeletons__CardsGrid",componentId:"sc-p3dvdz-0"})` 3240 margin-top: 1.25rem; 3241 display: grid; 3242 grid-template-columns: 1fr; 3243 gap: 0.75rem; 3244 align-content: start; 3245 min-height: 0; 3246 3247 @media (min-width: 640px) { 3248 grid-template-columns: repeat(2, minmax(0, 1fr)); 3249 } 3250 3251 @media (min-width: 1024px) { 3252 grid-template-columns: repeat(3, minmax(0, 1fr)); 3253 } 3254`,sAe=p.div.withConfig({displayName:"WorkspaceLoadingSkeletons__Card",componentId:"sc-p3dvdz-1"})` 3255 border: 1px solid ${V}; 3256 background: ${Z}; 3257 border-radius: 0.875rem; 3258 padding: 0.875rem; 3259 display: flex; 3260 gap: 0.75rem; 3261 align-items: flex-start; 3262`,aAe=p.div.withConfig({displayName:"WorkspaceLoadingSkeletons__LogoSlot",componentId:"sc-p3dvdz-2"})` 3263 width: 38px; 3264 height: 38px; 3265 border-radius: 0.875rem; 3266 border: 1px solid ${V}; 3267 background: ${$e}; 3268 overflow: hidden; 3269 display: flex; 3270 align-items: center; 3271 justify-content: center; 3272 flex-shrink: 0; 3273`,lAe=p.div.withConfig({displayName:"WorkspaceLoadingSkeletons__CardText",componentId:"sc-p3dvdz-3"})` 3274 min-width: 0; 3275 display: flex; 3276 flex-direction: column; 3277 gap: 0.4rem; 3278 flex: 1; 3279`,cAe=p.div.withConfig({displayName:"WorkspaceLoadingSkeletons__TableSkeletonWrap",componentId:"sc-p3dvdz-4"})` 3280 margin-top: 1.25rem; 3281`;function dAe(e){const n=Math.max(3,Math.min(18,Number(e.cards??9)||9)),i=l.useMemo(()=>Array.from({length:n}).map((r,o)=>62+o%4*8),[n]);return t.jsx(oAe,{"aria-label":"Loading projects",children:Array.from({length:n}).map((r,o)=>t.jsxs(sAe,{"aria-hidden":"true",children:[t.jsx(aAe,{children:t.jsx(nt,{width:38,height:38,radius:"0.875rem"})}),t.jsxs(lAe,{children:[t.jsx(nt,{height:14,width:`${Math.min(92,i[o])}%`,radius:10}),t.jsx(nt,{height:12,width:`${Math.max(40,i[o]-18)}%`,radius:10})]})]},o))})}function uAe(){return t.jsx(cAe,{"aria-label":"Loading overview",children:t.jsx($p,{minWidth:"1120px",rows:10,columns:[{width:"15.5rem"},{width:"10rem"},{width:"10rem"},{},{},{width:"7rem"},{}]})})}const pAe=p.div.withConfig({displayName:"TopicsMultiSelect__Wrap",componentId:"sc-10o7fzm-0"})` 3282 position: relative; 3283 display: inline-flex; 3284`,mAe=p(he).withConfig({displayName:"TopicsMultiSelect__TriggerButton",componentId:"sc-10o7fzm-1"})` 3285 width: ${e=>e.$iconOnly?"auto":"6.5rem"}; 3286 min-width: 0; 3287 max-width: ${e=>e.$iconOnly?"none":"6.5rem"}; 3288 padding: 0 ${e=>e.$iconOnly?"0.5rem":"0.6rem"}; 3289 gap: 0.35rem; 3290 3291 /* Mobile: icon-only trigger should shrink to content (no fixed width). */ 3292 @media (max-width: 640px) { 3293 width: auto; 3294 max-width: none; 3295 padding: 0 0.5rem; 3296 } 3297`,hAe=p.span.withConfig({displayName:"TopicsMultiSelect__TriggerLabel",componentId:"sc-10o7fzm-2"})` 3298 flex: 1 1 auto; 3299 min-width: 0; 3300 overflow: hidden; 3301 text-overflow: ellipsis; 3302 white-space: nowrap; 3303 3304 @media (max-width: 640px) { 3305 display: none; 3306 } 3307 3308 ${e=>e.$hidden?"display: none;":""} 3309`,fAe=p.div.withConfig({displayName:"TopicsMultiSelect__Popover",componentId:"sc-10o7fzm-3"})` 3310 position: fixed; 3311 background: ${Z}; 3312 border: 1px solid ${V}; 3313 border-radius: 0.875rem; 3314 box-shadow: 0 18px 40px rgba(17, 24, 39, 0.14); 3315 padding: 0.6rem; 3316 z-index: 2000; 3317 display: ${e=>e.$open?"flex":"none"}; 3318 flex-direction: column; 3319 min-height: 0; 3320`,gAe=p.div.withConfig({displayName:"TopicsMultiSelect__SearchWrap",componentId:"sc-10o7fzm-4"})` 3321 position: relative; 3322`,yAe=p(Cs).withConfig({displayName:"TopicsMultiSelect__SearchIcon",componentId:"sc-10o7fzm-5"})` 3323 position: absolute; 3324 left: 0.6rem; 3325 top: 1.125rem; /* half of input height */ 3326 transform: translateY(-50%); 3327 width: 0.95rem; 3328 height: 0.95rem; 3329 color: ${z}; 3330 pointer-events: none; 3331`,xAe=p.input.withConfig({displayName:"TopicsMultiSelect__SearchInput",componentId:"sc-10o7fzm-6"})` 3332 width: 100%; 3333 height: 2.25rem; 3334 border: 1px solid ${Rt}; 3335 background: ${Z}; 3336 border-radius: 0.375rem; 3337 padding: 0.5rem 0.6rem 0.5rem 2.05rem; 3338 font-size: 0.8125rem; 3339 font-weight: 750; 3340 line-height: 1; 3341 color: ${O}; 3342 outline: none; 3343 margin-bottom: 0.6rem; 3344 3345 &::placeholder { 3346 color: ${z}; 3347 font-weight: 700; 3348 } 3349 3350 &:focus { 3351 border-color: ${V}; 3352 box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.06); 3353 } 3354`,bAe=p.div.withConfig({displayName:"TopicsMultiSelect__ItemsWrap",componentId:"sc-10o7fzm-7"})` 3355 flex: 1; 3356 min-height: 0; 3357 overflow: auto; 3358 padding-right: 0.1rem; /* avoid scrollbar overlap */ 3359`,vAe=p.button.withConfig({displayName:"TopicsMultiSelect__Row",componentId:"sc-10o7fzm-8"})` 3360 width: 100%; 3361 border: 1px solid ${Rt}; 3362 background: ${e=>e.$checked?$e:Z}; 3363 border-radius: 0.375rem; 3364 padding: 0.55rem 0.6rem; 3365 display: flex; 3366 align-items: center; 3367 justify-content: space-between; 3368 gap: 0.75rem; 3369 cursor: pointer;
3370 color: ${O}; 3371 text-align: left; 3372 3373 &:hover { 3374 background: ${$e}; 3375 } 3376 3377 &:not(:last-of-type) { 3378 margin-bottom: 0.5rem; 3379 } 3380`,wAe=p.div.withConfig({displayName:"TopicsMultiSelect__Name",componentId:"sc-10o7fzm-9"})` 3381 font-size: 0.875rem; 3382 font-weight: 900; 3383 color: ${O}; 3384 min-width: 0; 3385 overflow: hidden; 3386 text-overflow: ellipsis; 3387 white-space: nowrap; 3388`,jAe=p.div.withConfig({displayName:"TopicsMultiSelect__Footer",componentId:"sc-10o7fzm-10"})` 3389 margin-top: 0.6rem; 3390 border-top: 1px solid ${$e}; 3391 padding-top: 0.6rem; 3392 display: flex; 3393 justify-content: space-between; 3394 gap: 0.5rem; 3395`,MF=p.button.withConfig({displayName:"TopicsMultiSelect__SmallBtn",componentId:"sc-10o7fzm-11"})` 3396 border: 1px solid ${Rt}; 3397 background: ${Z}; 3398 color: ${O}; 3399 font-weight: medium; 3400 font-size: 0.75rem; 3401 padding: 0.35rem 0.55rem; 3402 border-radius: 0.375rem; 3403 cursor: pointer; 3404 3405 &:hover { 3406 background: ${$e}; 3407 } 3408`;function u1({options:e,value:n,onChange:i,disabled:r,iconOnly:o}){const[s,a]=l.useState(!1),[c,u]=l.useState(""),m=l.useRef(null),h=l.useRef(null),[g,x]=l.useState({}),y=l.useMemo(()=>e.map(I=>I.id).filter(I=>Number.isFinite(I)&&I>0),[e]),w=l.useMemo(()=>{const I=c.trim().toLowerCase();return I?e.filter(A=>String(A.label||"").toLowerCase().includes(I)):e},[e,c]),j=l.useMemo(()=>{if(!Array.isArray(n)||n.length===0)return y;const I=new Set(n);return y.filter(A=>I.has(A))},[y,n]),v=l.useMemo(()=>y.length>0&&j.length===y.length,[y.length,j.length]),_=l.useMemo(()=>{if(v)return"All topics";if(j.length===1){const I=e.find(A=>A.id===j[0]);return I?I.label:"1 topic"}return`${j.length} topics`},[v,e,j]);l.useEffect(()=>{if(!s)return;const I=E=>{const B=E.target;m.current?.contains(B)||h.current?.contains(B)||a(!1)},A=E=>{E.key==="Escape"&&a(!1)};return document.addEventListener("mousedown",I),document.addEventListener("keydown",A),()=>{document.removeEventListener("mousedown",I),document.removeEventListener("keydown",A)}},[s]),l.useEffect(()=>{s||u("")},[s]),l.useEffect(()=>{if(!s||typeof window>"u")return;const I=()=>{const A=h.current;if(!A)return;const E=A.getBoundingClientRect(),B=8,T=360,M=420,R=window.innerWidth,F=window.innerHeight,Y=F-E.bottom,H=E.top,U=Y<260&&H>Y,X=Math.min(T,R-16),Q=Math.max(8,Math.min(E.left,R-X-8));if(U){const K=Math.min(M,Math.max(160,H-16));x({left:Q,width:X,bottom:Math.max(8,F-E.top+B),maxHeight:K})}else{const K=Math.min(M,Math.max(160,Y-16));x({left:Q,width:X,top:Math.min(F-8,E.bottom+B),maxHeight:K})}};return I(),window.addEventListener("scroll",I,!0),window.addEventListener("resize",I),()=>{window.removeEventListener("scroll",I,!0),window.removeEventListener("resize",I)}},[s]);const $=I=>{const A=new Set(j);A.has(I)?A.delete(I):A.add(I);const E=y.filter(B=>A.has(B));E.length===y.length?i([]):i(E)},k=()=>i([]),P=y.length>1,S=()=>{y.length<=0||i([y[0]])};return t.jsxs(pAe,{children:[t.jsx("span",{ref:h,style:{display:"inline-flex"},children:t.jsx(mAe,{type:"button",size:"sm",variant:"outline",disabled:r,onClick:()=>a(I=>!I),leftIcon:t.jsx(Dge,{size:16}),"aria-label":_,$iconOnly:!!o,children:t.jsx(hAe,{$hidden:!!o,children:_})})}),t.jsxs(fAe,{ref:m,$open:s,style:g,role:"dialog","aria-label":"Select topics",children:[t.jsxs(gAe,{children:[t.jsx(yAe,{"aria-hidden":!0}),t.jsx(xAe,{value:c,onChange:I=>u(I.target.value),placeholder:"Search topicsâ¦"})]}),t.jsx(bAe,{children:w.map(I=>{const A=j.includes(I.id);return t.jsxs(vAe,{type:"button",$checked:A,onClick:()=>$(I.id),children:[t.jsx(wAe,{children:I.label}),A?t.jsx(Zn,{size:18,color:"var(--color-brand-700)"}):t.jsx("span",{style:{width:18}})]},I.id)})}),P?t.jsxs(jAe,{children:[t.jsx(MF,{type:"button",onClick:k,children:"All topics"}),t.jsx(MF,{type:"button",onClick:S,children:"Deselect all"})]}):null]})]})}const _Ae=p.div.withConfig({displayName:"StringMultiSelect__Wrap",componentId:"sc-uos439-0"})` 3409 position: relative; 3410 display: inline-flex; 3411`,CAe=p(he).withConfig({displayName:"StringMultiSelect__TriggerButton",componentId:"sc-uos439-1"})` 3412 width: ${e=>(e.$iconOnly,"auto")}; 3413 min-width: 0; 3414 max-width: ${e=>e.$iconOnly?"none":"14rem"}; 3415 padding: 0 ${e=>e.$iconOnly?"0.5rem":"0.6rem"}; 3416 gap: 0.35rem; 3417 3418 @media (max-width: 640px) { 3419 width: auto; 3420 max-width: none; 3421 padding: 0 0.5rem; 3422 } 3423`,SAe=p.span.withConfig({displayName:"StringMultiSelect__TriggerLabel",componentId:"sc-uos439-2"})` 3424 flex: 1 1 auto; 3425 min-width: 0; 3426 overflow: hidden; 3427 text-overflow: ellipsis; 3428 white-space: nowrap; 3429 3430 @media (max-width: 640px) { 3431 display: none; 3432 } 3433 3434 ${e=>e.$hidden?"display: none;":""} 3435`,kAe=p.div.withConfig({displayName:"StringMultiSelect__Popover",componentId:"sc-uos439-3"})` 3436 position: fixed; 3437 background: ${Z}; 3438 border: 1px solid ${V}; 3439 border-radius: 0.875rem; 3440 box-shadow: 0 18px 40px rgba(17, 24, 39, 0.14); 3441 padding: 0.6rem; 3442 z-index: 2000; 3443 display: ${e=>e.$open?"flex":"none"}; 3444 flex-direction: column; 3445 min-height: 0; 3446`,$Ae=p.div.withConfig({displayName:"StringMultiSelect__SearchWra
3446p",componentId:"sc-uos439-4"})` 3447 position: relative; 3448`,IAe=p(Cs).withConfig({displayName:"StringMultiSelect__SearchIcon",componentId:"sc-uos439-5"})` 3449 position: absolute; 3450 left: 0.6rem; 3451 top: 1.125rem; 3452 transform: translateY(-50%); 3453 width: 0.95rem; 3454 height: 0.95rem; 3455 color: ${z}; 3456 pointer-events: none; 3457`,PAe=p.input.withConfig({displayName:"StringMultiSelect__SearchInput",componentId:"sc-uos439-6"})` 3458 width: 100%; 3459 height: 2.25rem; 3460 border: 1px solid ${Rt}; 3461 background: ${Z}; 3462 border-radius: 0.375rem; 3463 padding: 0.5rem 0.6rem 0.5rem 2.05rem; 3464 font-size: 0.8125rem; 3465 font-weight: 750; 3466 line-height: 1; 3467 color: ${O}; 3468 outline: none; 3469 margin-bottom: 0.6rem; 3470 3471 &::placeholder { 3472 color: ${z}; 3473 font-weight: 700; 3474 } 3475 3476 &:focus { 3477 border-color: ${V}; 3478 box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.06); 3479 } 3480`,AAe=p.div.withConfig({displayName:"StringMultiSelect__ItemsWrap",componentId:"sc-uos439-7"})` 3481 flex: 1; 3482 min-height: 0; 3483 overflow: auto; 3484 padding-right: 0.1rem; 3485`,NAe=p.button.withConfig({displayName:"StringMultiSelect__Row",componentId:"sc-uos439-8"})` 3486 width: 100%; 3487 border: 1px solid ${Rt}; 3488 background: ${e=>e.$checked?$e:Z}; 3489 border-radius: 0.375rem; 3490 padding: 0.55rem 0.6rem; 3491 display: flex; 3492 align-items: center; 3493 justify-content: space-between; 3494 gap: 0.75rem; 3495 cursor: pointer; 3496 color: ${O}; 3497 text-align: left; 3498 3499 &:hover { 3500 background: ${$e}; 3501 } 3502 3503 &:not(:last-of-type) { 3504 margin-bottom: 0.5rem; 3505 } 3506`,zAe=p.div.withConfig({displayName:"StringMultiSelect__Name",componentId:"sc-uos439-9"})` 3507 font-size: 0.875rem; 3508 font-weight: 900; 3509 color: ${O}; 3510 min-width: 0; 3511 overflow: hidden; 3512 text-overflow: ellipsis; 3513 white-space: nowrap; 3514`,TAe=p.div.withConfig({displayName:"StringMultiSelect__Footer",componentId:"sc-uos439-10"})` 3515 margin-top: 0.6rem; 3516 border-top: 1px solid ${$e}; 3517 padding-top: 0.6rem; 3518 display: flex; 3519 justify-content: space-between; 3520 gap: 0.5rem; 3521`,RF=p.button.withConfig({displayName:"StringMultiSelect__SmallBtn",componentId:"sc-uos439-11"})` 3522 border: 1px solid ${Rt}; 3523 background: ${Z}; 3524 color: ${O}; 3525 font-weight: medium; 3526 font-size: 0.75rem; 3527 padding: 0.35rem 0.55rem; 3528 border-radius: 0.375rem; 3529 cursor: pointer; 3530 3531 &:hover { 3532 background: ${$e}; 3533 } 3534`;function _re({options:e,value:n,onChange:i,disabled:r,allLabel:o="All",noun:s="item",icon:a,searchPlaceholder:c="Searchâ¦",iconOnly:u}){const[m,h]=l.useState(!1),[g,x]=l.useState(""),y=l.useRef(null),w=l.useRef(null),[j,v]=l.useState({}),_=l.useMemo(()=>e.map(T=>T.id),[e]),$=l.useMemo(()=>{const T=g.trim().toLowerCase();return T?e.filter(M=>String(M.label||"").toLowerCase().includes(T)):e},[e,g]),k=l.useMemo(()=>{if(!Array.isArray(n)||n.length===0)return _;const T=new Set(n);return _.filter(M=>T.has(M))},[_,n]),P=l.useMemo(()=>_.length>0&&k.length===_.length,[_.length,k.length]),S=l.useMemo(()=>{if(P)return o;if(k.length===1){const T=e.find(M=>M.id===k[0]);return T?T.label:`1 ${s}`}return`${k.length} ${s}s`},[P,o,e,k,s]);l.useEffect(()=>{if(!m)return;const T=R=>{const F=R.target;y.current?.contains(F)||w.current?.contains(F)||h(!1)},M=R=>{R.key==="Escape"&&h(!1)};return document.addEventListener("mousedown",T),document.addEventListener("keydown",M),()=>{document.removeEventListener("mousedown",T),document.removeEventListener("keydown",M)}},[m]),l.useEffect(()=>{m||x("")},[m]),l.useEffect(()=>{if(!m||typeof window>"u")return;const T=()=>{const M=w.current;if(!M)return;const R=M.getBoundingClientRect(),F=8,Y=360,H=420,U=window.innerWidth,X=window.innerHeight,Q=X-R.bottom,K=R.top,G=Q<260&&K>Q,L=Math.min(Y,U-16),q=Math.max(8,Math.min(R.left,U-L-8));if(G){const W=Math.min(H,Math.max(160,K-16));v({left:q,width:L,bottom:Math.max(8,X-R.top+F),maxHeight:W})}else{const W=Math.min(H,Math.max(160,Q-16));v({left:q,width:L,top:Math.min(X-8,R.bottom+F),maxHeight:W})}};return T(),window.addEventListener("scroll",T,!0),window.addEventListener("resize",T),()=>{window.removeEventListener("scroll",T,!0),window.removeEventListener("resize",T)}},[m]);const I=T=>{const M=new Set(k);M.has(T)?M.delete(T):M.add(T);const R=_.filter(F=>M.has(F));
3534R.length===_.length?i([]):i(R)},A=()=>i([]),E=_.length>1,B=()=>{_.length<=0||i([_[0]])};return t.jsxs(_Ae,{children:[t.jsx("span",{ref:w,style:{display:"inline-flex"},children:t.jsx(CAe,{type:"button",size:"sm",variant:"outline",disabled:r,onClick:()=>h(T=>!T),leftIcon:a,"aria-label":S,$iconOnly:!!u,children:t.jsx(SAe,{$hidden:!!u,children:S})})}),t.jsxs(kAe,{ref:y,$open:m,style:j,role:"dialog","aria-label":"Select items",children:[e.length>5&&t.jsxs($Ae,{children:[t.jsx(IAe,{"aria-hidden":!0}),t.jsx(PAe,{value:g,onChange:T=>x(T.target.value),placeholder:c})]}),t.jsx(AAe,{children:$.map(T=>{const M=k.includes(T.id);return t.jsxs(NAe,{type:"button",$checked:M,onClick:()=>I(T.id),children:[t.jsx(zAe,{children:T.label}),M?t.jsx(Zn,{size:18,color:"var(--color-brand-700)"}):t.jsx("span",{style:{width:18}})]},T.id)})}),E?t.jsxs(TAe,{children:[t.jsx(RF,{type:"button",onClick:A,children:o}),t.jsx(RF,{type:"button",onClick:B,children:"Deselect all"})]}):null]})]})}const EAe=p.button.withConfig({displayName:"FilterToggle__Btn",componentId:"sc-1jd51g8-0"})` 3535 border: 1px solid ${V}; 3536 background: ${e=>e.$active?V:Z}; 3537 color: ${O}; 3538 font-weight: 850; 3539 font-size: 0.75rem; 3540 height: 2rem; 3541 line-height: 1; 3542 padding: 0 0.75rem; 3543 border-radius: 0.375rem; 3544 cursor: pointer; 3545 display: inline-flex; 3546 align-items: center; 3547 gap: 0.5rem; 3548 user-select: none; 3549 white-space: nowrap; 3550 box-sizing: border-box; 3551 3552 &:hover { 3553 background: ${$e}; 3554 } 3555 3556 &:disabled { 3557 opacity: 0.6; 3558 cursor: not-allowed; 3559 } 3560`;function vf({label:e,active:n,onClick:i,disabled:r,title:o}){return t.jsx(EAe,{type:"button",$active:!!n,"aria-pressed":!!n,onClick:i,disabled:r,title:o,children:e})}function Ed({value:e,onChange:n,placeholder:i="Searchâ¦",size:r="sm",containerStyle:o,inputStyle:s}){return t.jsx("div",{style:o,children:t.jsx(Xt,{value:e,onChange:a=>n(a.target.value),placeholder:i,leftIcon:t.jsx(Cs,{size:16}),size:r,style:s})})}const MAe=p.div.withConfig({displayName:"MultiSelectFilter__Wrap",componentId:"sc-fafitk-0"})` 3561 position: relative; 3562 display: inline-flex; 3563`,RAe=p.div.withConfig({displayName:"MultiSelectFilter__Popover",componentId:"sc-fafitk-1"})` 3564 position: fixed; 3565 background: ${Z}; 3566 border: 1px solid ${V}; 3567 border-radius: 0.875rem; 3568 box-shadow: 0 18px 40px rgba(17, 24, 39, 0.14); 3569 padding: 0.6rem; 3570 z-index: 2000; 3571 display: ${e=>e.$open?"block":"none"}; 3572 overflow: auto; 3573`,OAe=p.button.withConfig({displayName:"MultiSelectFilter__Row",componentId:"sc-fafitk-2"})` 3574 width: 100%; 3575 border: 1px solid ${Rt}; 3576 background: ${e=>e.$checked?$e:Z}; 3577 border-radius: 0.375rem; 3578 padding: 0.55rem 0.6rem; 3579 display: flex; 3580 align-items: center; 3581 justify-content: space-between; 3582 gap: 0.75rem; 3583 cursor: ${e=>e.$disabled?"not-allowed":"pointer"}; 3584 opacity: ${e=>e.$disabled?.5:1}; 3585 color: ${O}; 3586 text-align: left; 3587 3588 &:hover { 3589 background: ${e=>e.$disabled?Z:$e}; 3590 } 3591 3592 &:not(:last-of-type) { 3593 margin-bottom: 0.5rem; 3594 } 3595`,DAe=p.div.withConfig({displayName:"MultiSelectFilter__Left",componentId:"sc-fafitk-3"})` 3596 min-width: 0; 3597 display: inline-flex; 3598 align-items: center; 3599 gap: 0.5rem; 3600`,LAe=p.div.withConfig({displayName:"MultiSelectFilter__Name",componentId:"sc-fafitk-4"})` 3601 color: ${O}; 3602 font-weight: 850; 3603 font-size: 0.8125rem; 3604 min-width: 0; 3605 overflow: hidden; 3606 text-overflow: ellipsis; 3607 white-space: nowrap; 3608`,BAe=p.button.withConfig({displayName:"MultiSelectFilter__IconTrigger",componentId:"sc-fafitk-5"})` 3609 appearance: none; 3610 border: 0; 3611 background: transparent; 3612 padding: 1px; 3613 margin: 0; 3614 display: inline-flex; 3615 align-items: center; 3616 justify-content: center; 3617 border-radius: 0.25rem; 3618 cursor: pointer; 3619 color: ${e=>e.$active?Ft:z}; 3620 line-height: 0; 3621 3622 &:hover { 3623 background: rgba(17, 24, 39, 0.04); 3624 color: ${e=>e.$active?Ft:O}; 3625 } 3626 3627 &:focus-visible { 3628 outline: none; 3629 box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.08); 3630 } 3631 3632 &:disabled { 3633 cursor: not-allowed; 3634 opacity: 0.5; 3635 } 3636`;function _b({label:e,options:n,value:i,onChange:r,disabled:o,triggerMode:s="button",active:a}){const[c,u]=l.useState(!1),m=l.useRef(null),h=l.useRef(null),[g,x]=l.useState({}),y=l.useMemo(()=>n.filter(P=>!P.disabled).map(P=>P.key),[n]),w=l.useMemo(()=>Array.isArray(i)?i.map(String):[],[i]),j=l.useMemo(()=>{const P=new Set(w);return y.filter(S=>P.has(S)).length},[y,w]),v=l.useMemo(()=>y.length>0&&j===y.length,[y.length,j]),_=l.useMemo(()=>
3636{if(j<=0)return e;if(j===1){const P=y.find(I=>w.includes(I)),S=P?n.find(I=>I.key===P):null;return S?`${e}: ${S.label}`:`${e}: 1`}return`${e}: ${j}`},[y,e,n,w,j]);l.useEffect(()=>{if(!c)return;const P=I=>{const A=I.target;m.current?.contains(A)||h.current?.contains(A)||u(!1)},S=I=>{I.key==="Escape"&&u(!1)};return document.addEventListener("mousedown",P),document.addEventListener("keydown",S),()=>{document.removeEventListener("mousedown",P),document.removeEventListener("keydown",S)}},[c]),l.useEffect(()=>{if(!c||typeof window>"u")return;const P=()=>{const S=h.current;if(!S)return;const I=S.getBoundingClientRect(),A=8,E=320,B=420,T=window.innerWidth,M=window.innerHeight,R=M-I.bottom,F=I.top,Y=R<260&&F>R,H=Math.min(E,T-16),U=Math.max(8,Math.min(I.left,T-H-8));if(Y){const X=Math.min(B,Math.max(160,F-16));x({left:U,width:H,bottom:Math.max(8,M-I.top+A),maxHeight:X})}else{const X=Math.min(B,Math.max(160,R-16));x({left:U,width:H,top:Math.min(M-8,I.bottom+A),maxHeight:X})}};return P(),window.addEventListener("scroll",P,!0),window.addEventListener("resize",P),()=>{window.removeEventListener("scroll",P,!0),window.removeEventListener("resize",P)}},[c]);const $=P=>{const S=n.find(E=>E.key===P);if(!S||S.disabled)return;const I=new Set(w);I.has(P)?I.delete(P):I.add(P);const A=y.filter(E=>I.has(E));r(A)},k=()=>r([]);return t.jsxs(MAe,{children:[t.jsx("span",{ref:h,style:{display:"inline-flex"},children:s==="icon"?t.jsx(BAe,{type:"button","aria-label":_,title:_,disabled:o,$active:a,onClick:()=>u(P=>!P),children:t.jsx(UE,{size:12})}):t.jsx(he,{type:"button",size:"sm",variant:"outline",disabled:o,onClick:()=>u(P=>!P),leftIcon:t.jsx(UE,{size:16}),children:_})}),t.jsxs(RAe,{ref:m,$open:c,style:g,role:"dialog","aria-label":e,children:[n.filter(P=>!P.disabled).map(P=>{const S=w.includes(P.key);return t.jsxs(OAe,{type:"button",$disabled:!1,$checked:S,onClick:()=>$(P.key),children:[t.jsx(DAe,{children:t.jsx(LAe,{children:P.label})}),S?t.jsx(Zn,{size:18,color:"var(--color-brand-700)"}):t.jsx("span",{style:{width:18}})]},P.key)}),!v&&j>0?t.jsx("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:6},children:t.jsx("button",{type:"button",onClick:k,style:{border:`1px solid ${Rt}`,background:Z,color:O,fontWeight:800,fontSize:"0.75rem",padding:"0.35rem 0.55rem",borderRadius:"0.375rem",cursor:"pointer"},children:"All"})}):null]})]})}const FAe=p.nav.withConfig({displayName:"Breadcrumbs__Wrap",componentId:"sc-vyd96m-0"})` 3637 display: inline-flex; 3638 align-items: center; 3639 gap: 0.35rem; 3640 flex-wrap: wrap; 3641 justify-content: flex-end; 3642 color: ${z}; 3643 font-size: 0.75rem; 3644 font-weight: 800; 3645 3646 /* Hide breadcrumbs on small mobile screens to reduce header clutter. */ 3647 @media (max-width: 640px) { 3648 display: none; 3649 } 3650`,WAe=p.span.withConfig({displayName:"Breadcrumbs__Sep",componentId:"sc-vyd96m-1"})` 3651 color: ${Pe}; 3652 font-weight: 900; 3653`,UAe=p.span.withConfig({displayName:"Breadcrumbs__CrumbText",componentId:"sc-vyd96m-2"})` 3654 white-space: nowrap; 3655`,HAe=p(Dn).withConfig({displayName:"Breadcrumbs__CrumbLink",componentId:"sc-vyd96m-3"})` 3656 white-space: nowrap; 3657 color: ${z}; 3658 text-decoration: none; 3659 3660 &:hover { 3661 color: ${O}; 3662 text-decoration: underline; 3663 } 3664`;function qAe(e){const n=String(e||"").trim();return n?n[0].toUpperCase()+n.slice(1):""}function qr({items:e,separator:n="/",ariaLabel:i="Breadcrumbs"}){const r=Array.isArray(e)?e.filter(o=>o&&String(o.label||"").trim()!==""):[];return r.length===0?null:t.jsx(FAe,{"aria-label":i,children:r.map((o,s)=>{const a=s===r.length-1,c=qAe(o.label),u=!a&&o.to?t.jsx(HAe,{to:o.to,children:c}):t.jsx(UAe,{children:c});return t.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"0.35rem"},children:[u,a?null:t.jsx(WAe,{children:n})]},`${o.label}-${s}`)})})}const GAe=p.div.withConfig({displayName:"PageTitle__Wrap",componentId:"sc-fihlk9-0"})` 3665 min-width: 0; 3666`,VAe=p.h1.withConfig({displayName:"PageTitle__Title",componentId:"sc-fihlk9-1"})` 3667 margin: 0; 3668 font-size: 1.2rem; 3669 font-weight: 950; 3670 color: ${O}; 3671`,KAe=p.div.withConfig({displayName:"PageTitle__Subtitle",componentId:"sc-fihlk9-2"})` 3672 margin-top: 0.35rem; 3673 color: ${z}; 3674 font-size: 0.75rem; 3675 font-weight: 650; 3676`;function YAe(e){const n=String(e||"").trim();return n?n.split(/\s+/).map(i=>i?i[0].toUpperCase()+i.slice(1):"").join(" "):""}
3676function Fy({title:e,subtitle:n}){return t.jsxs(GAe,{children:[t.jsx(VAe,{children:YAe(e)}),n?t.jsx(KAe,{children:n}):null]})}const Cre=l.createContext(null);function oC(){const e=l.useContext(Cre);if(!e)throw new Error("useAddProjectLeaveGuard must be used within AddProjectProvider");return e}const XAe=p.section.withConfig({displayName:"DangerZone__Card",componentId:"sc-yomtz5-0"})` 3677 background: ${kn}; 3678 border: 1px solid ${Er}; 3679 border-radius: 1rem; 3680 padding: 1.25rem; 3681`,QAe=p.div.withConfig({displayName:"DangerZone__Header",componentId:"sc-yomtz5-1"})` 3682 display: flex; 3683 align-items: flex-start; 3684 justify-content: space-between; 3685 gap: 1rem; 3686 margin-bottom: 0.75rem; 3687`,ZAe=p.div.withConfig({displayName:"DangerZone__TitleRow",componentId:"sc-yomtz5-2"})` 3688 display: flex; 3689 align-items: center; 3690 gap: 0.5rem; 3691 min-width: 0; 3692`,JAe=p.div.withConfig({displayName:"DangerZone__Title",componentId:"sc-yomtz5-3"})` 3693 font-size: 1rem; 3694 font-weight: 750; 3695 color: ${O}; 3696 line-height: 1.2; 3697`,eNe=p.div.withConfig({displayName:"DangerZone__Description",componentId:"sc-yomtz5-4"})` 3698 margin-top: 0.35rem; 3699 font-size: 0.8125rem; 3700 color: ${z}; 3701 line-height: 1.4; 3702`,tNe=p.div.withConfig({displayName:"DangerZone__Body",componentId:"sc-yomtz5-5"})` 3703 display: flex; 3704 align-items: center; 3705 justify-content: space-between; 3706 gap: 1rem; 3707 3708 @media (max-width: 640px) { 3709 flex-direction: column; 3710 align-items: stretch; 3711 } 3712`,nNe=p.div.withConfig({displayName:"DangerZone__Warning",componentId:"sc-yomtz5-6"})` 3713 font-size: 0.8125rem; 3714 color: ${O}; 3715 line-height: 1.4; 3716 /* Use theme tokens so this adapts in dark mode */ 3717 background: ${At}; 3718 border: 1px solid ${V}; 3719 border-radius: 0.75rem; 3720 padding: 0.75rem; 3721`,iNe=p.div.withConfig({displayName:"DangerZone__ConfirmHint",componentId:"sc-yomtz5-7"})` 3722 font-size: 0.75rem; 3723 color: ${z}; 3724 margin-top: 0.5rem; 3725`,rNe=p.div.withConfig({displayName:"DangerZone__ErrorText",componentId:"sc-yomtz5-8"})` 3726 margin-top: 0.5rem; 3727 font-size: 0.8125rem; 3728 color: ${oi}; 3729`,oNe=p(Xt).withConfig({displayName:"DangerZone__ConfirmInput",componentId:"sc-yomtz5-9"})` 3730 &:focus { 3731 box-shadow: 0 0 0 3px ${U8}; 3732 } 3733`;function zM({title:e="Danger zone",description:n,warningText:i="Deleting this will permanently remove your data and access. This cannot be undone.",actionLabel:r="Delete account",confirmTitle:o="Delete account",confirmDescription:s="This action cannot be undone.",confirmKeyword:a="DELETE",contactSupport:c="If youâre having trouble accessing your account, contact support before deleting.",disabled:u=!1,buttonSize:m="md",onConfirm:h}){const[g,x]=l.useState(!1),[y,w]=l.useState(""),[j,v]=l.useState(!1),[_,$]=l.useState(null),k=l.useMemo(()=>y.trim().toUpperCase()===a.toUpperCase(),[y,a]),P=t.jsxs("div",{style:{display:"flex",gap:"0.75rem",justifyContent:"flex-end"},children:[t.jsx(he,{type:"button",variant:"outline",size:m,onClick:()=>{x(!1)},disabled:j,children:"Cancel"}),t.jsx(he,{type:"button",variant:"danger",size:m,leftIcon:t.jsx(Fi,{size:16}),onClick:async()=>{if(k){v(!0),$(null);try{await h(),x(!1),w("")}catch(S){$(S instanceof Error?S.message:"Something went wrong")}finally{v(!1)}}},disabled:j||!k,children:r})]});return t.jsxs(t.Fragment,{children:[t.jsxs(XAe,{children:[t.jsx(QAe,{children:t.jsxs("div",{style:{minWidth:0},children:[t.jsxs(ZAe,{children:[t.jsx(ei,{size:18,color:oi}),t.jsx(JAe,{children:e})]}),t.jsx(eNe,{children:n})]})}),t.jsxs(tNe,{children:[t.jsx(nNe,{children:i}),t.jsx(he,{type:"button",variant:"danger",size:m,leftIcon:t.jsx(Fi,{size:16}),disabled:u,onClick:()=>{x(!0),$(null),w("")},children:r})]})]}),t.jsx(Hn,{isOpen:g,onClose:()=>{j||x(!1)},title:o,description:s,size:"sm",footer:P,children:t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"0.75rem"},children:[t.jsxs("div",{style:{fontSize:"0.875rem",color:O},children:["To confirm, type ",t.jsx("b",{children:a})," below."]}),t.jsx(oNe,{value:y,onChange:S=>w(S.target.value),placeholder:a,disabled:j,"aria-label":`Type ${a} to confirm`}),t.jsx(iNe,{children:"This is a safety step to prevent accidental deletion."}),_?t.jsx(rNe,{children:_}):null,t.jsx("div",{style:{height:"1px",background:Rt,margin:"0.25rem 0"}}),t.jsx("div",{style:{fontSize:"0.75rem",color:z,background:At,border:`1px solid ${V}`,borderRadius:"0.75rem",padding:"0.75rem"},children:c})]})})]})}const sNe=Tn` 3734 0% { background-position: 200% 0; } 3735 100% { background-position: -200% 0; } 3736`,aNe=p.div.withConfig({displayName:"AccountSettings__ProfileHeaderRow",componentId:"sc-xqmk7h-0"})` 3737 width: 100%; 3738 display: flex; 3739 align-items: flex-start; 3740 justify-content: space-between; 3741 gap: 1rem; 3742`,lNe=p.div.withConfig({displayName:"AccountSettings__AvatarPickerWrap",componentId:"sc-xqmk7h-1"})` 3743 position: relative; 3744 flex: 0 0 auto; 3745`,cNe=p.div.withConfig({displayName:"AccountSettings__AvatarBadge",componentId:"sc-xqmk7h-2"})` 3746 width: 2.25rem; 3747 height: 2.25rem; 3748 border-radius: 0.75rem; 3749 border: 1px solid ${Rt}; 3750 background: ${e=>e.$bg}; 3751 color: ${Z}; 3752 font-weight: 800; 3753 font-size: 0.75rem; 3754 letter-spacing: 0.02em; 3755 display: inline-flex; 3756 align-items: center; 3757 justify-content: center; 3758 box-shadow: 0 10px 24px rgba(0, 0, 0, 0.06); 3759`,dNe=p.button.withConfig({displayName:"AccountSettings__ChangeAvatarButton",componentId:"sc-xqmk7h-3"})` 3760 width: 2.25rem; 3761 height: 2.25rem; 3762 padding: 0; 3763 border-radius: 0.75rem; 3764 border: none; 3765 background: transparent; 3766 color: ${O}; 3767 cursor: pointer; 3768 display: inline-flex; 3769 align-items: center; 3770 justify-content: center; 3771 transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease; 3772 3773 &:hover { 3774 background: ${At}; 3775 transform: translateY(-1px); 3776 } 3777 3778 &:active { 3779 transform: translateY(0); 3780 } 3781 3782 &:focus-visible { 3783 outline: none; 3784 box-shadow: 0 0 0 3px ${En}; 3785 } 3786`,uNe=p.div.withConfig({displayName:"AccountSettings__AvatarPopover",componentId:"sc-xqmk7h-4"})` 3787 position: absolute; 3788 top: calc(100% + 0.5rem); 3789 right: 0; 3790 width: 18rem; 3791 background: ${Z}; 3792 border: 1px solid ${Rt}; 3793 border-radius: 0.75rem; 3794 box-shadow: 0 18px 40px rgba(0, 0, 0, 0.14); 3795 padding: 0.75rem; 3796 z-index: 2000; 3797`,pNe=p.div.withConfig({displayName:"AccountSettings__SessionsScroller",componentId:"sc-xqmk7h-5"})` 3798 overflow-x: auto; 3799 overflow-y: hidden; 3800 padding-bottom: 0.25rem; 3801 -webkit-overflow-scrolling: touch; 3802`,mNe=p.div.withConfig({displayName:"AccountSettings__ForgotPasswordRow",componentId:"sc-xqmk7h-6"})` 3803 margin-top: 0.35rem; 3804 font-size: 0.75rem; 3805 font-weight: 650; 3806 color: ${z}; 3807`,hNe=p.button.withConfig({displayName:"AccountSettings__ForgotPasswordBtn",componentId:"sc-xqmk7h-7"})` 3808 appearance: none; 3809 border: 0; 3810 background: transparent; 3811 padding: 0; 3812 color: ${O}; 3813 font-weight: 800; 3814 font-size: 0.75rem; 3815 text-decoration: underline; 3816 text-underline-offset: 3px; 3817 cursor: pointer; 3818 3819 &:hover { 3820 text-decoration-thickness: 2px; 3821 } 3822 3823 &:disabled {
3824 cursor: not-allowed; 3825 opacity: 0.6; 3826 text-decoration-thickness: 1px; 3827 } 3828`,fNe=p.div.withConfig({displayName:"AccountSettings__SessionsRow",componentId:"sc-xqmk7h-8"})` 3829 display: flex; 3830 gap: 0.75rem; 3831 min-width: min-content; 3832`,jz=p.div.withConfig({displayName:"AccountSettings__SessionCard",componentId:"sc-xqmk7h-9"})` 3833 flex: 0 0 22rem; 3834 max-width: 22rem; 3835 border: 1px solid ${V}; 3836 background: ${Z}; 3837 border-radius: 1rem; 3838 padding: 0.9rem; 3839 box-shadow: 0 10px 24px rgba(0, 0, 0, 0.06); 3840 display: flex; 3841 flex-direction: column; 3842 gap: 0.75rem; 3843`,Zo=p.div.withConfig({displayName:"AccountSettings__SkeletonLine",componentId:"sc-xqmk7h-10"})` 3844 width: ${e=>e.$w||"100%"}; 3845 height: ${e=>e.$h||"0.85rem"}; 3846 border-radius: 999px; 3847 background: linear-gradient( 3848 90deg, 3849 rgba(148, 163, 184, 0.18) 25%, 3850 rgba(148, 163, 184, 0.32) 37%, 3851 rgba(148, 163, 184, 0.18) 63% 3852 ); 3853 background-size: 400% 100%; 3854 animation: ${sNe} 1.2s ease-in-out infinite; 3855`,gNe=p.div.withConfig({displayName:"AccountSettings__Swatches",componentId:"sc-xqmk7h-11"})` 3856 display: inline-grid; 3857 grid-template-columns: repeat(7, 32px); 3858 grid-template-rows: repeat(2, 32px); 3859 gap: 6px; 3860 align-items: start; 3861 justify-content: start; 3862`,yNe=p.button.withConfig({displayName:"AccountSettings__SwatchButton",componentId:"sc-xqmk7h-12"})` 3863 width: 32px; 3864 height: 32px; 3865 border-radius: 0; 3866 border: none; 3867 background: ${e=>e.$color}; 3868 padding: 0; 3869 cursor: pointer; 3870 display: inline-flex; 3871 align-items: center; 3872 justify-content: center; 3873 transition: box-shadow 0.12s ease, outline-color 0.12s ease, filter 0.12s ease; 3874 position: relative; 3875 3876 /* subtle inner stroke without creating spacing between tiles */ 3877 outline: 1px solid rgba(17, 24, 39, 0.08); 3878 outline-offset: -1px; 3879 3880 ${e=>e.$selected?` 3881 outline: 2px solid ${ot}; 3882 outline-offset: -2px; 3883 `:""} 3884 3885 &:hover { 3886 filter: brightness(0.98); 3887 outline-color: rgba(17, 24, 39, 0.18); 3888 } 3889 3890 &:focus-visible { 3891 outline: none; 3892 box-shadow: 0 0 0 3px ${En}; 3893 } 3894`,xNe=p.span.withConfig({displayName:"AccountSettings__SwatchCheck",componentId:"sc-xqmk7h-13"})` 3895 position: absolute; 3896 top: 2px; 3897 right: 2px; 3898 width: 14px; 3899 height: 14px; 3900 border-radius: 999px; 3901 background: rgba(17, 24, 39, 0.7); 3902 display: inline-flex; 3903 align-items: center; 3904 justify-content: center; 3905`,bNe=["#334155","#0F766E","#499167","#1D4ED8","#1E40AF","#4338CA","#8797AF","#6D28D9","#7C3AED","#9F1239","#991B1B","#92400E","#166534","#3F3F46"];function vNe({embedded:e=!1}){const{user:n,setUser:i,logout:r}=yn(),[o,s]=l.useState(n?.first_name||""),[a,c]=l.useState(n?.last_name||""),[u,m]=l.useState(n?.color||ot),h=l.useRef(null),g=l.useRef(null),x=l.useRef(null);l.useEffect(()=>{n&&h.current!==n.id&&(h.current=n.id,s(n.first_name||""),c(n.last_name||""),m(n.color||ot))},[n]);const[y,w]=l.useState(""),[j,v]=l.useState(""),[_,$]=l.useState(""),[k,P]=l.useState(null),[S,I]=l.useState(null),[A,E]=l.useState(null),[B,T]=l.useState(null),[M,R]=l.useState(!1),[F,Y]=l.useState(!1),[H,U]=l.useState(!1),[X,Q]=l.useState(null),[K,G]=l.useState(null),[L,q]=l.useState([]),[W,oe]=l.useState(!1),[se,de]=l.useState(null),[le,me]=l.useState(null),[ee,ne]=l.useState(!1),[Ae,_e]=l.useState({}),[we,Ke]=l.useState(!1),[ce,ie]=l.useState(!1),[Re,Be]=l.useState(!1);l.useEffect(()=>{if(!k)return;const Ee=window.setTimeout(()=>P(null),5e3);return()=>window.clearTimeout(Ee)},[k]),l.useEffect(()=>{if(!A)return;const Ee=window.setTimeout(()=>E(null),5e3);return()=>window.clearTimeout(Ee)},[A]),l.useEffect(()=>{if(!X)return;const Ee=window.setTimeout(()=>Q(null),7e3);return()=>window.clearTimeout(Ee)},[X]),l.useEffect(()=>{if(!le)return;const Ee=window.setTimeout(()=>me(null),5e3);return()=>window.clearTimeout(Ee)},[le]);const tt=n?.auth_provider==="google",dt=l.useMemo(()=>n?.email||"",[n?.email]),je=l.useMemo(()=>o.trim().length>0&&a.trim().length>0,[o,a]),Me=l.useMemo(()=>{const Ee=o.trim(),Xe=a.trim(),Le=(`${Ee} ${Xe}`.trim()||n?.full_name?.trim()||n?.email?.trim()||"?").split(/\s+/).filter(Boolean);return Le.length===0?"?":Le.length===1?Le[0].slice(0,2).toUpperCase():`${Le[0][0]}${Le[1][0]}`.toUpperCase()},[o,a,n?.email,n?.full_name]);l.useEffect(()=>{if(!Re)return;const Ee=yt=>{const Ne=yt.target;Ne&&(g.current?.contains(Ne)||x.current?.contains(Ne)||Be(!1))},Xe=yt=>{yt.key==="Escape"&&Be(!1)};return document.addEventListener("mousedown",Ee,!0),window.addEventListener("keydown",Xe),
3905()=>{document.removeEventListener("mousedown",Ee,!0),window.removeEventListener("keydown",Xe)}},[Re]);const Se=e?"div":ma,it=e?"div":Kc;if(!n)return t.jsx(Se,{children:t.jsx(it,{children:t.jsxs(Ar,{children:[t.jsxs(Wr,{children:[t.jsx(Hj,{size:18}),t.jsx(Ur,{children:"Account settings"})]}),t.jsx(Hr,{children:"Youâre not signed in."})]})})});const De=async()=>{if(n){oe(!0),de(null);try{const Ee=await ue("/api/v1/users/sessions",{method:"GET"}),Xe=await Ee.json().catch(()=>({}));if(!Ee.ok)throw new Error(Xe?.error||Xe?.errors?.[0]||"Failed to load sessions");const Ne=(Array.isArray(Xe?.sessions)?Xe.sessions:[]).map(Le=>({id:Number(Le?.id),ip:Le?.ip!=null?String(Le.ip):null,user_agent:Le?.user_agent!=null?String(Le.user_agent):null,geo_city:Le?.geo_city!=null?String(Le.geo_city):null,geo_region:Le?.geo_region!=null?String(Le.geo_region):null,geo_country:Le?.geo_country!=null?String(Le.geo_country):null,geo_timezone:Le?.geo_timezone!=null?String(Le.geo_timezone):null,created_at:Le?.created_at!=null?String(Le.created_at):null,last_used_at:Le?.last_used_at!=null?String(Le.last_used_at):null,expires_at:Le?.expires_at!=null?String(Le.expires_at):null})).filter(Le=>Number.isFinite(Le.id)&&Le.id>0);q(Ne)}catch(Ee){de(Ee instanceof Error?Ee.message:"Failed to load sessions")}finally{oe(!1)}}},te=async Ee=>{const Xe=Number(Ee);if(!(!Number.isFinite(Xe)||Xe<=0)&&!Ae[Xe]){_e(yt=>({...yt,[Xe]:!0})),de(null),me(null);try{const yt=await ue(`/api/v1/users/sessions/${Xe}`,{method:"DELETE"}),Ne=await yt.json().catch(()=>({}));if(!yt.ok)throw new Error(Ne?.error||Ne?.errors?.[0]||"Failed to revoke session");me("Session revoked."),q(Le=>Le.filter(Ue=>Ue.id!==Xe))}catch(yt){de(yt instanceof Error?yt.message:"Failed to revoke session")}finally{_e(yt=>{const Ne={...yt};return delete Ne[Xe],Ne})}}},ge=async()=>{if(!ee){ne(!0),de(null),me(null);try{const Ee=await ue("/api/v1/users/sessions",{method:"DELETE"}),Xe=await Ee.json().catch(()=>({}));if(!Ee.ok)throw new Error(Xe?.error||Xe?.errors?.[0]||"Failed to revoke sessions");await r()}catch(Ee){de(Ee instanceof Error?Ee.message:"Failed to revoke sessions")}finally{ne(!1)}}};l.useEffect(()=>{q([]),de(null),me(null),oe(!1),ne(!1),_e({}),Ke(!1),ie(!1)},[n?.id]);const Je=Ee=>{if(!Ee)return"â";const Xe=new Date(Ee);return Number.isNaN(Xe.getTime())?"â":Xe.toLocaleString()};return t.jsx(Se,{children:t.jsxs(it,{children:[e?null:t.jsxs(Ys,{children:[t.jsxs(ha,{children:[t.jsx(fa,{children:"Account settings"}),t.jsx("div",{style:{paddingRight:8,minWidth:0},children:t.jsx(qr,{items:[{label:"Home",to:"/"},{label:"Account"}]})})]}),t.jsx(ga,{children:"Manage your profile, security, and sessions."})]}),t.jsxs(Ar,{children:[t.jsx(Zr,{children:t.jsxs(aNe,{children:[t.jsxs("div",{style:{minWidth:0},children:[t.jsxs(Wr,{children:[t.jsx(Hj,{size:18}),t.jsx(Ur,{children:"Profile"})]}),t.jsx(Hr,{children:"Update how your name appears across the app."})]}),t.jsxs(lNe,{children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem"},children:[t.jsx(cNe,{$bg:u,"aria-label":"Avatar color",children:Me}),t.jsx(at,{content:"Change avatar color",children:t.jsx(dNe,{ref:g,type:"button",onClick:()=>{Be(Ee=>!Ee)},"aria-label":"Change avatar color",children:t.jsx(Y0e,{size:16})})})]}),Re?t.jsxs(uNe,{ref:x,children:[t.jsx("div",{style:{fontSize:"0.8125rem",fontWeight:750,color:O},children:"Avatar color"}),t.jsxs("div",{style:{marginTop:"0.25rem",fontSize:"0.75rem",color:z,lineHeight:1.4},children:["Pick a color. It will be saved when you click ",t.jsx("b",{children:"Save profile"}),"."]}),t.jsx("div",{style:{marginTop:"0.75rem"},children:t.jsx(gNe,{children:bNe.map(Ee=>t.jsx(at,{content:Ee,children:t.jsx(yNe,{type:"button",$color:Ee,$selected:u.toLowerCase()===Ee.toLowerCase(),onClick:()=>{m(Ee),Be(!1)},"aria-label":`Select color ${Ee}`,title:Ee,children:u.toLowerCase()===Ee.toLowerCase()?t.jsx(xNe,{"aria-hidden":"true",children:t.jsx(Zn,{size:12,color:Z})}):null})},Ee))})})]}):null]})]})}),k?t.jsx(hr,{$variant:"success",children:k}):null,S?t.jsx(hr,{$variant:"error",children:S}):null,t.jsxs(Bl,{children:[t.jsxs(Bn,{children:[t.jsx(ii,{htmlFor:"firstName",children:"First name"}),t.jsx(Xt,{id:"firstName",value:o,onChange:Ee=>s(Ee.target.value),placeholder:"First name",leftIcon:t.jsx(Hj,{size:16})})]}),t.jsxs(Bn,{children:[t.jsx(ii,{htmlFor:"lastName",children:"Last name"}),t.jsx(Xt,{id:"lastName",value:a,onChange:Ee=>c(Ee.target.value),placeholder:"Last name",leftIcon:t.jsx(Hj,{size:16})})]})]}),t.jsx(Z5,{}),t.jsxs(Bn,{children:[t.jsx(ii,{children:"Email"}),t.jsx(RM,{children:t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem"},children:[t.jsx(bu,{size:16,color:z}),t.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:dt})]})})]}),t.jsx(ey,{children:t.jsx(he,{type:"button",size:"sm",disabled:!je,onClick:()=>{(async()=>
3905{if(M)return;R(!0),I(null),P(null);const Ee=o.trim(),Xe=a.trim();if(!(!Ee||!Xe))try{const yt=await ue("/api/v1/users/me",{method:"PATCH",body:JSON.stringify({first_name:Ee,last_name:Xe,color:u})});if(!yt.ok){const Le=await yt.json().catch(()=>({}));throw new Error(Le?.error||Le?.errors?.[0]||"Failed to update profile")}const Ne=await yt.json().catch(()=>({}));Ne?.user&&(i(Ne.user),s(Ne.user.first_name||""),c(Ne.user.last_name||""),m(Ne.user.color||u)),P("Profile updated.")}catch(yt){I(yt instanceof Error?yt.message:"Failed to update profile")}finally{R(!1)}})()},children:M?"Saving...":"Save profile"})})]}),t.jsxs(Ar,{children:[t.jsx(Zr,{children:t.jsxs("div",{style:{minWidth:0},children:[t.jsxs(Wr,{children:[t.jsx(Rc,{size:18}),t.jsx(Ur,{children:"Security"})]}),t.jsx(Hr,{children:"Update your password."})]})}),A?t.jsx(hr,{$variant:"success",children:A}):null,B?t.jsx(hr,{$variant:"error",children:B}):null,X?t.jsx(hr,{$variant:"success",children:X}):null,K?t.jsx(hr,{$variant:"error",children:K}):null,tt?t.jsx("div",{style:{border:`1px solid ${V}`,background:At,borderRadius:"0.75rem",padding:"0.875rem",color:O,fontSize:"0.875rem",lineHeight:1.4},children:"Your account is managed via Google. To change your password, update it in your Google account."}):t.jsxs(t.Fragment,{children:[t.jsxs(Bn,{children:[t.jsx(ii,{htmlFor:"currentPassword",children:"Current password"}),t.jsx(Em,{id:"currentPassword",value:y,onChange:Ee=>w(Ee.target.value),placeholder:"Current password"}),t.jsxs(mNe,{children:["Forgot your password? You'll be signed out if you continue."," ",t.jsx(hNe,{type:"button",disabled:H||!dt.trim(),onClick:()=>{(async()=>{if(H)return;const Ee=dt.trim().toLowerCase();if(!Ee)return;U(!0),G(null),Q(null);let Xe=!1;try{Xe=!0;const yt=await ue("/api/v1/auth/forgot_password",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:Ee})}),Ne=await yt.json().catch(()=>({}));if(!yt.ok)throw new Error(Ne?.error||"Failed to send reset email");Q("If an account exists with that email, a password reset code has been sent.")}catch(yt){G(yt instanceof Error?yt.message:"Failed to send reset email")}finally{U(!1)}Xe&&await r()})()},children:H?"Sendingâ¦":"Send reset email (sign out)"})]})]}),t.jsx("div",{style:{marginTop:"0.75rem"},children:t.jsxs(Bl,{children:[t.jsxs(Bn,{children:[t.jsx(ii,{htmlFor:"newPassword",children:"New password"}),t.jsx(Em,{id:"newPassword",value:j,onChange:Ee=>v(Ee.target.value),placeholder:"New password"}),t.jsx(lM,{password:j})]}),t.jsxs(Bn,{children:[t.jsx(ii,{htmlFor:"confirmPassword",children:"Confirm new password"}),t.jsx(Em,{id:"confirmPassword",value:_,onChange:Ee=>$(Ee.target.value),placeholder:"Confirm new password"})]})]})}),t.jsx(ey,{children:t.jsx(he,{type:"button",size:"sm",disabled:F,onClick:()=>{(async()=>{if(!F){if(Y(!0),T(null),E(null),!y.trim()){T("Please enter your current password."),Y(!1);return}if(j.length<8){T(q5),Y(!1);return}if(!v_(j)){T(q5),Y(!1);return}if(j!==_){T("New passwords do not match."),Y(!1);return}try{const Ee=await ue("/api/v1/users/me",{method:"PATCH",body:JSON.stringify({current_password:y,password:j,password_confirmation:_})});if(!Ee.ok){const yt=await Ee.json().catch(()=>({}));throw new Error(yt?.error||yt?.errors?.[0]||"Failed to update password")}const Xe=await Ee.json().catch(()=>({}));Xe?.user&&i(Xe.user),w(""),v(""),$(""),E("Password updated.")}catch(Ee){T(Ee instanceof Error?Ee.message:"Failed to update password")}finally{Y(!1)}}})()},children:F?"Updating...":"Update password"})})]})]}),t.jsxs(Ar,{children:[t.jsx(Zr,{children:t.jsxs("div",{style:{width:"100%",display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"1rem"},children:[t.jsxs("div",{style:{minWidth:0},children:[t.jsxs(Wr,{children:[t.jsx(Lb,{size:18}),t.jsx(Ur,{children:"Sessions"})]}),t.jsx(Hr,{children:"Manage active sign-in sessions across devices."})]}),t.jsx(he,{type:"button",size:"sm",variant:"outline",rightIcon:we?t.jsx(yu,{size:16}):t.jsx(qn,{size:16}),onClick:()=>{Ke(Ee=>{const Xe=!Ee;return Xe&&!ce&&(ie(!0),De()),Xe})},children:we?"Hide":"Show"})]})}),we?t.jsxs(t.Fragment,{children:[le?t.jsx(hr,{$variant:"success",children:le}):null,se?t.jsx(hr,{$variant:"error",children:se}):null,t.jsx("div",{style:{border:`1px solid ${V}`,background:At,borderRadius:"0.75rem",padding:"0.875rem",color:O,fontSize:"0.875rem",lineHeight:1.4},children:"Active sessions are based on refresh tokens. You can revoke any session to force it to sign in again."}),t.jsxs("div",{style:{marginTop:"0.75rem",display:"flex",gap:"0.75rem",flexWrap:"wrap"},children:[t.jsx(he,{type:"button",size:"sm",variant:"outline",disabled:W,onClick:De,children:W?"Refreshing...":"Refresh list"}),t.jsx(he,{type:"button",size:"sm",variant:"danger",leftIcon:t.jsx(Fi,{size:16}),disabled:ee||W,onClick:()=>{window.confirm("Revoke all sessions? This will sign you out everywhere.")&&ge()},children:ee?"Revoking...":"Revoke all sessions"})]}),t.jsx("div",{style:{marginTop:"0.75rem"},children:t.jsx(pNe,{children:t.jsx(fNe,{children:W?Array.from({length:Math.min(Math.max(L.length,3),6)}).map((Ee,Xe)=>t.jsxs(jz,{children:[t.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"0.75rem"},children:[t.jsxs("div",{style:{minWidth:0,flex:1},children:[t.jsx(Zo,{$w:"70%",$h:"0.95rem"}),t.jsxs("div",{style:{marginTop:"0.5rem",display:"flex",gap:"0.5rem",flexWrap:"wrap"},children:[t.jsx(Zo,{$w:"7rem",$h:"0.75rem"}),t.jsx(Zo,{$w:"10rem",$h:"0.75rem"})]})]}),t.jsx(Zo,{$w:"4.75rem",$h:"2rem"})]}),t.jsx("div",{style:{height:"1px",background:V}}),t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"0.55rem"},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"0.75rem"},children:[t.jsx(Zo,{$w:"6rem",$h:"0.75rem"}),t.jsx(Zo,{$w:"9rem",$h:"0.75rem"})]}),t.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"0.75rem"},children:[t.jsx(Zo,{$w:"4.5rem",$h:"0.75rem"}),t.jsx(Zo,{$w:"9rem",$h:"0.75rem"})]}),t.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"0.75rem"},children:[t.jsx(Zo,{$w:"4.5rem",$h:"0.75rem"}),t.jsx(Zo,{$w:"9rem",$h:"0.75rem"})]}),t.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"0.75rem"},children:[t.jsx(Zo,{$w:"2.25rem",$h:"0.75rem"}),t.jsx(Zo,{$w:"7rem",$h:"0.75rem"})]})]})]},`skeleton-${Xe}`)):L.length===0?t.jsx("div",{style:{color:z,fontSize:"0.875rem",padding:"0.25rem 0"}
3905,children:"No active sessions found."}):L.map(Ee=>{const Xe=!!Ae[Ee.id],yt=Ee.user_agent?.trim()||"Unknown device",Ne=Ee.ip?.trim()||"â",Le=[Ee.geo_city,Ee.geo_region,Ee.geo_country].map(Qe=>Qe?.trim()).filter(Boolean),Ue=Le.length?Le.join(", "):"â",We=Ee.geo_timezone?.trim()||"â";return Xe?t.jsxs(jz,{children:[t.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"0.75rem"},children:[t.jsxs("div",{style:{minWidth:0,flex:1},children:[t.jsx(Zo,{$w:"70%",$h:"0.95rem"}),t.jsxs("div",{style:{marginTop:"0.5rem",display:"flex",gap:"0.5rem",flexWrap:"wrap"},children:[t.jsx(Zo,{$w:"7rem",$h:"0.75rem"}),t.jsx(Zo,{$w:"10rem",$h:"0.75rem"})]})]}),t.jsx(Zo,{$w:"4.75rem",$h:"2rem"})]}),t.jsx("div",{style:{height:"1px",background:V}}),t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"0.55rem"},children:[t.jsx(Zo,{$w:"100%",$h:"0.75rem"}),t.jsx(Zo,{$w:"100%",$h:"0.75rem"}),t.jsx(Zo,{$w:"100%",$h:"0.75rem"}),t.jsx(Zo,{$w:"100%",$h:"0.75rem"})]})]},Ee.id):t.jsxs(jz,{children:[t.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"0.75rem"},children:[t.jsxs("div",{style:{minWidth:0},children:[t.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:"0.5rem",color:O},children:[t.jsx(Lb,{size:16}),t.jsx("div",{title:yt,style:{fontWeight:750,fontSize:"0.9rem",lineHeight:1.25,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:"16rem"},children:yt})]}),t.jsxs("div",{style:{marginTop:"0.35rem",color:z,fontSize:"0.75rem",display:"flex",gap:"0.75rem",flexWrap:"wrap"},children:[t.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"0.35rem"},children:[t.jsx(_y,{size:14}),Ne]}),t.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"0.35rem"},title:Ue,children:[t.jsx(_y,{size:14}),Ue]})]})]}),t.jsx(he,{type:"button",size:"sm",variant:"outline",onClick:()=>void te(Ee.id),children:"Revoke"})]}),t.jsx("div",{style:{height:"1px",background:V}}),t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"0.4rem",color:z,fontSize:"0.75rem"},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"0.75rem"},children:[t.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"0.35rem"},children:[t.jsx(qc,{size:14}),"Last active"]}),t.jsx("span",{style:{color:O,fontWeight:650},children:Je(Ee.last_used_at||Ee.created_at)})]}),t.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"0.75rem"},children:[t.jsx("span",{children:"Created"}),t.jsx("span",{style:{color:O,fontWeight:650},children:Je(Ee.created_at)})]}),t.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"0.75rem"},children:[t.jsx("span",{children:"Expires"}),t.jsx("span",{style:{color:O,fontWeight:650},children:Je(Ee.expires_at)})]}),t.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"0.75rem"},children:[t.jsx("span",{children:"TZ"}),t.jsx("span",{style:{color:O,fontWeight:650},children:We})]})]})]},Ee.id)})})})})]}):null]}),t.jsx("div",{style:{marginTop:"1.25rem"},children:t.jsx(zM,{description:"Once you delete your account, there is no going back. Please be certain.",buttonSize:"sm",onConfirm:async()=>{const Ee=await ue("/api/v1/users/me",{method:"DELETE"});if(!Ee.ok){const Xe=await Ee.json().catch(()=>({}));throw new Error(Xe?.error||"Failed to delete account")}await r()}})}),t.jsx("div",{style:{height:"2rem"}})]})})}const Sre="'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif",wNe=p.div.withConfig({displayName:"UserMenu__BottomArea",componentId:"sc-1t638bk-0"})` 3906 border-top: 1px solid ${V}; 3907 position: relative; 3908 background: ${Z}; 3909 3910 @media (max-width: 768px) { 3911 border-top: none; 3912 border-left: 1px solid ${V}; 3913 height: 100%; 3914 display: flex; 3915 align-items: center; 3916 } 3917`,jNe=p.button.withConfig({displayName:"UserMenu__AccountButton",componentId:"sc-1t638bk-1"})` 3918 width: 100%; 3919 border: none; 3920 background: ${Z}; 3921 border-radius: 0; 3922 padding: ${e=>e.$collapsed?"0.625rem 0":"0.75rem"}; 3923 display: grid; 3924 grid-template-columns: ${e=>e.$collapsed?"1fr":"2.25rem 1fr 1.25rem"}; 3925 align-items: center; 3926 justify-items: ${e=>e.$collapsed?"center":"stretch"}; 3927 gap: ${e=>e.$collapsed?"0":"0.625rem"}; 3928 cursor: pointer; 3929 transition: background-color 0.15s ease; 3930 font-family: ${Sre}; 3931 3932 &:hover { 3933 background: ${At}; 3934 } 3935 3936 &:focus-visible { 3937 outline: none; 3938 box-shadow: 0 0 0 3px ${En}; 3939 } 3940 3941 @media (max-width: 768px) { 3942 width: auto; 3943 height: 100%; 3944 padding: 0 0.75rem; 3945 grid-template-columns: 1fr; 3946 } 3947`,_Ne=p.div.withConfig({displayName:"UserMenu__Avatar",componentId:"sc-1t638bk-2"})` 3948 width: ${e=>e.$size==="sm"?"1.75rem":e.$size==="lg"?"2.75rem":"2.25rem"}; 3949 height: ${e=>e.$size==="sm"?"1.75rem":e.$size==="lg"?"2.75rem":"2.25rem"}; 3950 border-radius: ${e=>e.$size==="sm"?"0.625rem":e.$size==="lg"?"0.875rem":"0.75rem"}; 3951 background: ${e=>e.$bg}; 3952 display: flex; 3953 align-items: center; 3954 justify-content: center; 3955 color: ${Z}; 3956 font-weight: 800; 3957 font-size: ${e=>e.$size==="sm"?"0.6875rem":e.$size==="lg"?"0.875rem":"0.75rem"}; 3958 flex-shrink: 0; 3959`,CNe=Tn` 3960 from { 3961 opacity: 0; 3962 transform: translateY(1px); 3963 } 3964 to { 3965 opacity: 1; 3966 transform: translateY(0); 3967 } 3968`,SNe=Tn` 3969 from { 3970 opacity: 0; 3971 } 3972 to { 3973 opacity: 1; 3974 } 3975`,kNe=p.div.withConfig({displayName:"UserMenu__AccountText",componentId:"sc-1t638bk-3"})` 3976 min-width: 0; 3977 width: 100%; 3978 display: flex; 3979 flex-direction: column; 3980 gap: 0.125rem; 3981 align-items: stretch; 3982 animation: ${CNe} 140ms ease both; 3983`,$Ne=p.div.withConfig({displayName:"UserMenu__AccountName",componentId:"sc-1t638bk-4"})` 3984 width: 100%; 3985 color: ${O}; 3986 font-size: 0.875rem; 3987 font-weight: 600; 3988 line-height: 1.1; 3989 white-space: nowrap; 3990 overflow: hidden; 3991 text-overflow: ellipsis; 3992 text-align: left; 3993`,INe=p.div.withConfig({displayName:"UserMenu__AccountMeta",componentId:"sc-1t638bk-5"})` 3994 width: 100%; 3995 color: ${z}; 3996 font-size: 0.75rem; 3997 line-height: 1.1; 3998 white-space: nowrap; 3999 overflow: hidden; 4000 text-overflow: ellipsis; 4001 text-align: left; 4002`,PNe=p.div.withConfig({displayName:"UserMenu__Caret",componentId:"sc-1t638bk-6"})` 4003 display: flex; 4004 align-items: center; 4005 justify-content: center; 4006 color: ${z}; 4007 transition: transform 0.15s ease; 4008 transform: ${e=>e.$open?"rotate(180deg)":"rotate(0deg)"}; 4009 animation: ${SNe} 140ms ease both; 4010`,OF="14rem",ANe=p.div.withConfig({displayName:"UserMenu__Popover",componentId:"sc-1t638bk-7"})` 4011 position: absolute; 4012 /* Start from bottom of page/sidebar */ 4013 bottom: 0; 4014 /* Always open outside (to the right) */ 4015 left: 100%; 4016 right: auto; 4017 width: ${OF}; 4018 4019 display: ${e=>e.$open?"flex":"none"}; 4020 flex-direction: column; 4021 4022 background: ${Z}; 4023 border: 1px solid ${Rt}; 4024 border-radius: 0; 4025 box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12); 4026 overflow: hidden; 4027 z-index: 1000; 4028
4029 /* Slightly taller popover; only org list scrolls */ 4030 height: 20rem; 4031 max-height: calc(100vh - 2rem); 4032 4033 /* Navbar mode (small screens): open downward, align to right edge */ 4034 @media (max-width: 768px) { 4035 top: 100%; 4036 bottom: auto; 4037 right: 0; 4038 left: auto; 4039 width: ${OF}; 4040 } 4041`,NNe=p.div.withConfig({displayName:"UserMenu__PopoverHeader",componentId:"sc-1t638bk-8"})` 4042 padding: 0.625rem 0.625rem; 4043 border-bottom: 1px solid ${V}; 4044 background: linear-gradient(to bottom, ${At}, ${Z}); 4045 display: flex; 4046 flex-direction: column; 4047 align-items: stretch; 4048 gap: 0.75rem; 4049`,zNe=p.div.withConfig({displayName:"UserMenu__ProfileRow",componentId:"sc-1t638bk-9"})` 4050 width: 100%; 4051 display: flex; 4052 align-items: center; 4053 gap: 0.75rem; 4054`,TNe=p.button.withConfig({displayName:"UserMenu__ThemeIconButton",componentId:"sc-1t638bk-10"})` 4055 width: 32px; 4056 height: 32px; 4057 border-radius: 0.625rem; 4058 border: 1px solid ${Rt}; 4059 background: ${Z}; 4060 color: ${O}; 4061 display: flex; 4062 align-items: center; 4063 justify-content: center; 4064 cursor: pointer; 4065 flex-shrink: 0; 4066 transition: background-color 0.15s ease, border-color 0.15s ease; 4067 4068 &:hover:not(:disabled) { 4069 background: rgba(17, 24, 39, 0.10); 4070 } 4071 4072 &:disabled { 4073 opacity: 0.6; 4074 cursor: not-allowed; 4075 } 4076 4077 &:focus-visible { 4078 outline: none; 4079 box-shadow: 0 0 0 3px ${En}; 4080 } 4081`,ENe=p.div.withConfig({displayName:"UserMenu__PopoverHeaderLeft",componentId:"sc-1t638bk-11"})` 4082 flex: 1; 4083 min-width: 0; 4084 display: flex; 4085 align-items: center; 4086 overflow: hidden; 4087`,MNe=p.div.withConfig({displayName:"UserMenu__HeaderText",componentId:"sc-1t638bk-12"})` 4088 min-width: 0; 4089 width: 100%; 4090 display: flex; 4091 flex-direction: column; 4092 gap: 0.25rem; 4093 align-items: flex-start; 4094`,DF=p.div.withConfig({displayName:"UserMenu__HeaderMetaRow",componentId:"sc-1t638bk-13"})` 4095 width: 100%; 4096 display: flex; 4097 align-items: center; 4098 gap: 0.375rem; 4099 color: ${z}; 4100 font-size: 0.75rem; 4101 line-height: 1.15; 4102 min-width: 0; 4103 4104 svg { 4105 flex-shrink: 0; 4106 } 4107`,LF=p.span.withConfig({displayName:"UserMenu__HeaderMetaText",componentId:"sc-1t638bk-14"})` 4108 min-width: 0; 4109 overflow: hidden; 4110 text-overflow: ellipsis; 4111 white-space: nowrap; 4112 text-align: left; 4113`,RNe=p.div.withConfig({displayName:"UserMenu__PopoverTitle",componentId:"sc-1t638bk-15"})` 4114 width: 100%; 4115 font-size: 0.8125rem; 4116 font-weight: 700; 4117 color: ${O}; 4118 overflow: hidden; 4119 text-overflow: ellipsis; 4120 white-space: nowrap; 4121 text-align: left; 4122`,ONe=p.div.withConfig({displayName:"UserMenu__PopoverBody",componentId:"sc-1t638bk-16"})` 4123 flex: 1; 4124 min-height: 0; 4125 display: flex; 4126 flex-direction: column; 4127`,kre=p.div.withConfig({displayName:"UserMenu__MenuBlock",componentId:"sc-1t638bk-17"})` 4128 display: flex; 4129 flex-direction: column; 4130 padding: 0; 4131`,DNe=p(kre).withConfig({displayName:"UserMenu__MenuBlockBottom",componentId:"sc-1t638bk-18"})` 4132 margin-top: auto; 4133 padding: 0.25rem; 4134 padding-bottom: 0.25rem; 4135`,LNe=p.div.withConfig({displayName:"UserMenu__Divider",componentId:"sc-1t638bk-19"})` 4136 height: 1px; 4137 background: ${V}; 4138 margin: 0.25rem; 4139`,BNe=p.div.withConfig({displayName:"UserMenu__SectionHeaderRow",componentId:"sc-1t638bk-20"})` 4140 display: flex; 4141 align-items: center; 4142 justify-content: space-between; 4143 gap: 0.5rem; 4144 padding: 0.25rem 0.5rem; 4145`,FNe=p.div.withConfig({displayName:"UserMenu__SectionTitle",componentId:"sc-1t638bk-21"})` 4146 font-size: 0.6875rem; 4147 font-weight: 800; 4148 letter-spacing: 0.06em; 4149 text-transform: uppercase; 4150 color: ${z}; 4151`,WNe=p.button.withConfig({displayName:"UserMenu__IconButton",componentId:"sc-1t638bk-22"})` 4152 width: 30px; 4153 height: 30px; 4154 border-radius: 0.625rem; 4155 border: 1px solid ${Rt}; 4156 background: ${Z}; 4157 color: ${O}; 4158 display: inline-flex; 4159 align-items: center; 4160 justify-content: center; 4161 cursor: pointer; 4162 transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease; 4163 4164 &:hover:not(:disabled) { 4165 background: rgba(17, 24, 39, 0.10); 4166 border-color: ${Rt}; 4167 } 4168 4169 &:disabled { 4170 opacity: 0.6; 4171 cursor: not-allowed; 4172 } 4173 4174 &:focus-visible { 4175 outline: none; 4176 box-shadow: 0 0 0 3px ${En}; 4177 } 4178`,C5=p.button.withConfig({displayName:"UserMenu__MenuItem",componentId:"sc-1t638bk-23"})` 4179 width: 100%; 4180 border: none; 4181 background: ${e=>e.$active?$e:"transparent"}; 4182 color: ${e=>e.$danger?"#dc2626":O}; 4183 border-radius: 0.625rem; 4184 padding: 0.5rem 0.5rem; 4185 display: flex; 4186 align-items: center; 4187 justify-content: space-between; 4188 gap: 0.75rem; 4189 cursor: pointer; 4190 font-family: ${Sre}; 4191 font-size: 0.8125rem; 4192 transition: background-color 0.15s ease; 4193 4194 &:hover { 4195 background: ${$e}; 4196 } 4197 4198 &:focus-visible { 4199 outline: none; 4200 box-shadow: 0 0 0 3px ${En}; 4201 } 4202`,Ck=p.div.withConfig({displayName:"UserMenu__MenuItemLeft",componentId:"sc-1t638bk-24"})` 4203 display: inline-flex; 4204 align-items: center; 4205 gap: 0.5rem; 4206 min-width: 0; 4207`,Sk=p.span.withConfig({displayName:"UserMenu__MenuItemText",componentId:"sc-1t638bk-25"})` 4208 min-width: 0; 4209 overflow: hidden; 4210 text-overflow: ellipsis; 4211 white-space: nowrap; 4212`,UNe=p.div.withConfig({displayName:"UserMenu__OrgMark",componentId:"sc-1t638bk-26"})` 4213 width: 1.5rem; 4214 height: 1.5rem; 4215 border-radius: 0.5rem; 4216 border: 1px solid ${Rt}; 4217 background: ${At}; 4218 display: flex; 4219 align-items: center; 4220 justify-content: center; 4221 color: ${O}; 4222 font-weight: 800; 4223 font-size: 0.625rem; 4224 flex-shrink: 0; 4225`,HNe=p.img.withConfig({displayName:"UserMenu__OrgLogo",componentId:"sc-1t638bk-27"})` 4226 width: 1.5rem; 4227 height: 1.5rem; 4228 border-radius: 0.5rem; 4229 border: 1px solid ${Rt}; 4230 background: ${At}; 4231 object-fit: cover; 4232 display: block; 4233 flex-shrink: 0; 4234`,qNe=p.div.withConfig({displayName:"UserMenu__SidebarWorkspaceMark",componentId:"sc-1t638bk-28"})` 4235 width: 2.25rem; 4236 height: 2.25rem; 4237 border-radius: 0.75rem; 4238 border: 1px solid ${Rt}; 4239 background: ${At}; 4240 display: inline-flex; 4241 align-items: center; 4242 justify-content: center; 4243 color: ${O}; 4244 font-weight: 900; 4245 font-size: 0.75rem; 4246 flex-shrink: 0; 4247`,GNe=p.img.withConfig({displayName:"UserMenu__SidebarWorkspaceLogo",componentId:"sc-1t638bk-29"})` 4248 width: 2.25rem; 4249 height: 2.25rem; 4250 border-radius: 0.75rem; 4251 border: 1px solid ${Rt}; 4252 background: ${At}; 4253 object-fit: cover; 4254 display: block; 4255 flex-shrink: 0; 4256`,VNe="2.75rem",KNe=p.div.withConfig({displayName:"UserMenu__OrgRegion",componentId:"sc-1t638bk-30"})` 4257 flex: 1; 4258 min-height: 0; 4259 display: flex; 4260 flex-direction: column; 4261 position: relative; 4262 4263 &::after { 4264 content: ""; 4265 display: ${e=>e.$overflow?"block":"none"}; 4266 position: absolute; 4267 left: 0; 4268 right: 0; 4269 bottom: 0; 4270 height: 1.75rem; 4271 pointer-events: none; 4272 background: linear-gradient(to bottom, rgba(255, 255, 255, 0), ${Z}); 4273 }
4274`,YNe=p.div.withConfig({displayName:"UserMenu__MoreWorkspacesIndicator",componentId:"sc-1t638bk-31"})` 4275 position: absolute; 4276 left: 50%; 4277 bottom: -0.1rem; 4278 z-index: 1; 4279 width: 1.5rem; 4280 height: 1.5rem; 4281 margin-left: -0.75rem; 4282 border-radius: 999px; 4283 border: 1px solid ${V}; 4284 background: ${Z}; 4285 color: ${z}; 4286 display: flex; 4287 align-items: center; 4288 justify-content: center; 4289 pointer-events: none; 4290 box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08); 4291`,XNe=p.div.withConfig({displayName:"UserMenu__OrgList",componentId:"sc-1t638bk-32"})` 4292 flex: 1; 4293 min-height: 0; 4294 overflow-y: auto; 4295 scrollbar-gutter: stable; 4296 padding: 0.25rem; 4297 padding-bottom: ${e=>e.$scroll?"0.875rem":"0.25rem"}; 4298 display: flex; 4299 flex-direction: column; 4300 gap: 0.25rem; 4301 scrollbar-width: thin; 4302 scrollbar-color: ${Rt} transparent; 4303 4304 &::-webkit-scrollbar { 4305 width: 0.5rem; 4306 } 4307 4308 &::-webkit-scrollbar-thumb { 4309 background: ${Rt}; 4310 border-radius: 999px; 4311 border: 0.125rem solid ${Z}; 4312 } 4313`,QNe=p(C5).withConfig({displayName:"UserMenu__WorkspaceMenuItem",componentId:"sc-1t638bk-33"})` 4314 min-height: ${VNe}; 4315 background: ${e=>e.$active?$e:"transparent"}; 4316 4317 &:hover { 4318 background: ${$e}; 4319 } 4320`;function _z(e){const n=e.trim().split(/\s+/).filter(Boolean);return n.length===0?"?":n.length===1?n[0].slice(0,2).toUpperCase():`${n[0][0]}${n[1][0]}`.toUpperCase()}function lp(e){return(e.name||"").trim()||`Workspace ${e.id}`}function BF(e){return e.split(/\s+/).filter(Boolean).map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" ")}function ZNe(e){const n=e?.full_name?.trim();if(n)return BF(n);const i=e?.first_name?.trim(),r=e?.last_name?.trim(),o=[i,r].filter(Boolean).join(" ").trim();return o?BF(o):e?.email?.trim()||"Unknown user"}const JNe=({collapsed:e=!1})=>{const{user:n,logout:i,setUser:r}=yn(),{requestLeave:o}=oC(),{workspaceId:s}=Gn(),[a,c]=l.useState(!1),[u,m]=l.useState(!1),[h,g]=l.useState(!1),[x,y]=l.useState(!1),[w,j]=l.useState(!1),[v,_]=l.useState(!1),$=l.useRef(null),k=l.useRef(null),P=l.useRef(null),S=l.useMemo(()=>n?.organizations||[],[n?.organizations]),I=l.useMemo(()=>{const L=Number(s);return Number.isFinite(L)?L:null},[s]),A=l.useMemo(()=>I?!!S.find(L=>L.id===I)?.partner_managed:!1,[S,I]),E=l.useMemo(()=>I&&S.find(L=>L.id===I)||null,[S,I]),B=l.useMemo(()=>ZNe(n),[n]),T=l.useMemo(()=>n?.email?.trim()||"",[n]),M=n?.auth_provider==="google",R=!!n?.can?.admin,F=l.useMemo(()=>_z(B),[B]),Y=n?.color||ot,H=W8(n?.theme),U=S.length>3,X=H==="light"?"dark":"light",Q=()=>{const L=P.current;if(!L){_(!1);return}const q=L.scrollTop+L.clientHeight<L.scrollHeight-2;_(q)},K=()=>{h||(g(!0),ue("/api/v1/onboarding/restart",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({skip_destroy:!0})}).then(async L=>{const q=await L.json().catch(()=>({}));if(!L.ok)throw new Error(q?.error||"Failed to start new workspace onboarding");q?.user&&r(q.user),c(!1)}).catch(L=>{console.error(L)}).finally(()=>{g(!1)}))};l.useEffect(()=>{if(!a)return;const L=W=>{const oe=W.target;oe&&($.current?.contains(oe)||k.current?.contains(oe)||c(!1))},q=W=>{W.key==="Escape"&&c(!1)};return document.addEventListener("mousedown",L),window.addEventListener("keydown",q),()=>{document.removeEventListener("mousedown",L),window.removeEventListener("keydown",q)}},[a]),l.useEffect(()=>{if(!a){_(!1);return}requestAnimationFrame(Q)},[a,S.length]);const G=L=>{L!==H&&(x||(F5(L),BE(L),n&&r({...n,theme:L}),y(!0),ue("/api/v1/users/me",{method:"PATCH",body:JSON.stringify({theme:L})}).then(async q=>{const W=await q.json().catch(()=>({}));if(!q.ok)throw new Error(W?.error||W?.errors?.[0]||"Failed to update theme");W?.user&&r(W.user)}).catch(q=>{console.error(q),F5(H),BE(H),n&&r({...n,theme:H})}).finally(()=>{y(!1)})))};return t.jsxs(t.Fragment,{children:[t.jsxs(wNe,{children:[t.jsxs(ANe,{ref:k,$open:a,$collapsed:e,role:"menu","aria-label":"Account menu",children:[t.jsx(NNe,{children:t.jsxs(zNe,{children:[t.jsx(_Ne,{$bg:Y,$size:"lg","aria-hidden":"true",children:F}),t.jsx(ENe,{children:t.jsxs(MNe,{children:[t.jsx(at,{content:B,onlyIfTruncated:!0,children:t.jsx(RNe,{children:B})}),T?t.jsxs(DF,{children:[M?t.jsx(ya,{width:14,height:14}):t.jsx(bu,{size:14}
4320),t.jsx(at,{content:T,onlyIfTruncated:!0,children:t.jsx(LF,{children:T})})]}):null,E?t.jsxs(DF,{children:[t.jsx(by,{size:14}),t.jsx(at,{content:lp(E),onlyIfTruncated:!0,children:t.jsx(LF,{children:lp(E)})})]}):null]})}),t.jsx(TNe,{type:"button",disabled:x,onClick:()=>{G(X)},"aria-label":X==="dark"?"Switch to dark theme":"Switch to light theme",title:X==="dark"?"Switch to dark theme":"Switch to light theme",children:X==="dark"?t.jsx(H0e,{size:16}):t.jsx(Lxe,{size:16})})]})}),t.jsxs(ONe,{children:[t.jsx(kre,{children:t.jsxs(BNe,{children:[t.jsx(FNe,{children:"Workspaces"}),t.jsx(WNe,{type:"button",disabled:h||ewe,"aria-label":"Add new workspace",title:"Add new workspace",onClick:()=>{h||(c(!1),j(!0))},children:t.jsx(gr,{size:16})})]})}),t.jsxs(KNe,{$overflow:U,children:[t.jsx(XNe,{ref:P,$scroll:U,onScroll:Q,children:S.map(L=>t.jsx(QNe,{type:"button",$active:L.id===I,onClick:()=>{o(`/workspaces/${L.id}`),c(!1)},children:t.jsxs(Ck,{children:[t.jsx(Hb,{src:L.logo_url,alt:`${lp(L)} logo`,Img:HNe,fallback:t.jsx(UNe,{"aria-hidden":"true",children:_z(lp(L))})}),t.jsx(at,{content:lp(L),onlyIfTruncated:!0,children:t.jsx(Sk,{children:lp(L)})})]})},L.id))}),v?t.jsx(YNe,{"aria-hidden":"true",children:t.jsx(qn,{size:15})}):null]}),t.jsxs(DNe,{children:[t.jsx(LNe,{}),t.jsx(C5,{type:"button",onClick:()=>{c(!1),m(!0)},children:t.jsxs(Ck,{children:[t.jsx(Bc,{size:16}),t.jsx(Sk,{children:"Settings"})]})}),R?t.jsx(C5,{type:"button",onClick:()=>{o("/admin"),c(!1)},children:t.jsxs(Ck,{children:[t.jsx(Yl,{size:16}),t.jsx(Sk,{children:"Admin"})]})}):null,t.jsx(C5,{type:"button",$danger:!0,onClick:async()=>{await i(),c(!1)},children:t.jsxs(Ck,{children:[t.jsx(A0e,{size:16}),t.jsx(Sk,{children:"Logout"})]})})]})]})]}),t.jsxs(jNe,{ref:$,type:"button",onClick:()=>c(L=>!L),"aria-haspopup":"menu","aria-expanded":a,$collapsed:e,children:[t.jsx(Hb,{src:E?.logo_url,alt:E?`${lp(E)} logo`:"Workspace",Img:GNe,fallback:t.jsx(qNe,{"aria-hidden":"true",children:E?_z(lp(E)):t.jsx(by,{size:16})})}),e?null:t.jsxs(t.Fragment,{children:[t.jsxs(kNe,{children:[t.jsx($Ne,{title:B,children:B}),t.jsx(INe,{title:E?lp(E):"",children:E?lp(E):"No Workspace"})]}),t.jsx(PNe,{$open:a,"aria-hidden":"true",children:t.jsx(qn,{size:18})})]})]})]}),t.jsx(Hn,{isOpen:u,onClose:()=>m(!1),title:"Account settings",description:"Manage your profile, security, and appearance.",size:"lg",children:t.jsx(vNe,{embedded:!0})}),t.jsx(Hn,{isOpen:w,onClose:()=>{h||j(!1)},title:"Create a new workspace?",description:A?"Youâre currently in a vendor-managed workspace. Creating a new workspace starts the standard Ceyo onboarding and may require separate billing outside of your vendor.":"A new workspace is a separate organization. It may require its own subscription, billing setup, and payment details.",size:"sm",showCloseButton:!1,footer:t.jsxs("div",{style:{display:"flex",gap:"0.75rem",justifyContent:"space-between",flexWrap:"wrap"},children:[t.jsx(he,{type:"button",variant:"outline",size:"sm",disabled:h,onClick:()=>j(!1),children:"Cancel"}),t.jsx(he,{type:"button",variant:"primary",size:"sm",disabled:h,onClick:()=>{j(!1),K()},children:"Create workspace"})]}),children:t.jsxs("div",{style:{fontSize:"0.875rem",lineHeight:1.5,color:z},children:["Most users do not need a new workspace to add another brand or website. If you want to track something new inside this workspace, add a new project instead.",A?" You can always switch back to your vendor workspace from the workspace menu.":null]})})]})},eze=p.div.withConfig({displayName:"SidebarNavGroup__NavShell",componentId:"sc-evaybw-0"})` 4321 padding: ${e=>e.$collapsed?"0.5rem 0.5rem":"0.75rem"}; 4322 4323 /* Mobile navbar: groups should sit side-by-side (not stacked). */ 4324 @media (max-width: 768px) { 4325 padding: 0.25rem; 4326 height: 100%; 4327 display: inline-flex; 4328 align-items: center; 4329 flex: 0 0 auto; 4330 } 4331`,tze=p.div.withConfig({displayName:"SidebarNavGroup__NavTitle",componentId:"sc-evaybw-1"})` 4332 font-size: 0.75rem; 4333 font-weight: 700; 4334 color: ${z}; 4335 text-transform: uppercase; 4336 letter-spacing: 0.06em; 4337 margin-bottom: 0.5rem; 4338 padding: 0 ${e=>e.$collapsed?"0":"0.25rem"}; 4339 display: ${e=>e.$hide||e.$collapsed?"none":"block"}; 4340`,nze=p.div.withConfig({displayName:"SidebarNavGroup__Items",componentId:"sc-evaybw-2"})` 4341 display: flex; 4342 flex-direction: column; 4343 gap: 0.25rem; 4344 align-items: stretch; 4345 4346 @media (max-width: 768px) { 4347 flex-direction: row; 4348 align-items: center; 4349 gap: 0.375rem; 4350 } 4351`,FF=p.div.withConfig({displayName:"SidebarNavGroup__ItemBase",componentId:"sc-evaybw-3"})` 4352 /* Normalize button/link defaults so styles match regardless of element type */ 4353 font-family: inherit; 4354 font-size: inherit; 4355 line-height: inherit; 4356 background: transparent; 4357 appearance: none; 4358 -webkit-appearance: none; 4359 border: 1px solid transparent; 4360 text-align: left; 4361 margin: 0; 4362 4363 text-decoration: none; 4364 color: ${z}; 4365 border-radius: 0.75rem; 4366 padding: ${e=>e.$collapsed?"0.5rem":"0.5rem 0.625rem"}; 4367 display: inline-flex; 4368 align-items: center; 4369 gap: 0.5rem; 4370 justify-content: ${e=>e.$collapsed?"center":"flex-start"}; 4371 /* In narrow (mobile navbar) mode, keep icon buttons compact (no stretching) */ 4372 width: ${e=>e.$collapsed&&!e.$narrow?"100%":"auto"}; 4373 flex: 0 0 auto; 4374 transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
4375 cursor: ${e=>e.$disabled?"not-allowed":"pointer"}; 4376 opacity: ${e=>e.$disabled?.55:1}; 4377 user-select: none; 4378 4379 @media (max-width: 768px) { 4380 padding: 0.5rem; 4381 } 4382 4383 &:hover { 4384 background: ${e=>e.$disabled?"transparent":$e}; 4385 border-color: ${e=>e.$disabled?"transparent":V}; 4386 color: ${e=>e.$disabled?z:O}; 4387 } 4388 4389 &.active { 4390 background: ${$e}; 4391 border-color: ${Rt}; 4392 color: ${O}; 4393 box-shadow: inset 0 0 0 1px rgba(79, 70, 229, 0.18); 4394 } 4395 4396 &.active svg { 4397 color: ${ot}; 4398 } 4399`,WF=p.span.withConfig({displayName:"SidebarNavGroup__Label",componentId:"sc-evaybw-4"})` 4400 font-size: 0.8125rem; 4401 font-weight: 600; 4402 white-space: nowrap; 4403`;function ff({title:e,collapsed:n,isNarrow:i=!1,items:r,hideTitle:o=!1,mobileTriggerIcon:s,mobileOpen:a=!1,onMobileToggle:c}){const u=l.useMemo(()=>i?"bottom":"top",[i]),{requestLeave:m}=oC(),h=!!(i&&s&&typeof c=="function"),g=s;return t.jsxs(eze,{$collapsed:n,$narrow:i,"aria-label":`${e} navigation`,children:[t.jsx(tze,{$collapsed:n,$hide:o,children:e}),t.jsxs(nze,{children:[h?(()=>{const x=t.jsxs(FF,{as:"button",type:"button",onClick:c,$collapsed:n,$disabled:!1,$narrow:i,"aria-label":a?`Close ${e}`:`Open ${e}`,title:e,className:a?"active":"",children:[t.jsx(g,{size:18}),n?null:t.jsx(WF,{children:e})]});return n?t.jsx(at,{content:e,placement:u,children:x},`trigger-${e}`):x})():null,(h?a?r:[]:r).map(x=>{const y=x.icon,w=x.end??!0,j=l.createElement(FF,{as:x.to?Gte:"button",...x.to?{to:x.to,end:w}:{},...x.to?{}:{type:"button",onClick:x.disabled?void 0:x.onClick},...x.to?{onClick:v=>{if(x.disabled){v.preventDefault();return}v.preventDefault(),m(x.to)}}:{},key:x.key,$collapsed:n,$disabled:x.disabled,$narrow:i},t.jsx(y,{size:18}),n?null:t.jsx(WF,{children:x.label}));return n?t.jsx(at,{content:x.label,placement:u,children:j},x.key):j})]})]})}function ize({collapsed:e,isNarrow:n=!1,mobileOpen:i,onMobileToggle:r}){const{workspaceId:o,projectId:s}=Gn(),{user:a}=yn(),c=l.useMemo(()=>{const g=Number(o);return Number.isFinite(g)&&a?.organizations?.find(x=>x.id===g)||null},[a?.organizations,o]);if(!l.useMemo(()=>!(s||!o||c?.role!=="owner"),[c?.role,s,o]))return null;const m=`/workspaces/${o}/settings`,h=[{to:m,label:"General",icon:Une},{to:`${m}/users`,label:"Users",icon:Ap},{to:`${m}/api-keys`,label:"API keys",icon:Rc},{to:`${m}/plan`,label:"Plan",icon:gl},{to:`${m}/billing`,label:"Billing",icon:wp}];return t.jsx(ff,{title:"Settings",collapsed:e,isNarrow:n,mobileTriggerIcon:Bc,mobileOpen:i,onMobileToggle:r,items:h.map(g=>({key:g.to,label:g.label,icon:g.icon,to:g.to}))})}const rze=p.div.withConfig({displayName:"ProjectSwitcher__Wrap",componentId:"sc-od5cl3-0"})` 4404 position: relative; 4405 width: 100%; 4406 height: 100%; 4407 display: flex; 4408`,UF=p.button.withConfig({displayName:"ProjectSwitcher__Trigger",componentId:"sc-od5cl3-1"})` 4409 height: 100%; 4410 min-width: 0; 4411 width: 100%; 4412 flex: 1 1 auto; 4413 padding: ${e=>(e.$compact,"0 0.75rem")}; 4414 border-radius: 0; 4415 border: 0; 4416 background: transparent; 4417 color: ${O}; 4418 display: inline-flex; 4419 align-items: center; 4420 justify-content: ${e=>e.$compact?"center":"flex-start"}; 4421 gap: ${e=>e.$compact?"0":"0.5rem"}; 4422 cursor: pointer; 4423 transition: background-color 0.15s ease, color 0.15s ease; 4424 4425 &[aria-disabled="true"] { 4426 cursor: not-allowed; 4427 color: ${Pe}; 4428 } 4429 4430 &:hover { 4431 background: ${$e}; 4432 color: ${O}; 4433 } 4434 4435 &[aria-disabled="true"]:hover { 4436 background: transparent; 4437 color: ${Pe}; 4438 } 4439 4440 &:focus-visible { 4441 outline: none; 4442 box-shadow: 0 0 0 3px ${En}; 4443 } 4444`,HF=p.div.withConfig({displayName:"ProjectSwitcher__TriggerText",componentId:"sc-od5cl3-2"})` 4445 min-width: 0; 4446 flex: 1; 4447 overflow: hidden; 4448 text-overflow: ellipsis; 4449 white-space: nowrap; 4450 font-size: 0.8125rem; 4451 font-weight: 750; 4452 color: ${O}; 4453`,oze=p.div.withConfig({displayName:"ProjectSwitcher__List",componentId:"sc-od5cl3-3"})` 4454 max-height: 18rem; 4455 overflow: auto; 4456 padding: 0.25rem; 4457`,sze=p.div.withConfig({displayName:"ProjectSwitcher__Popover",componentId:"sc-od5cl3-4"})` 4458 position: absolute; 4459 ${e=>e.$narrow?` 4460 top: 100%; 4461 left: 0; 4462 right: auto; 4463 `:` 4464 top: 0; 4465 left: 100%; 4466 right: auto; 4467 `} 4468 4469 width: 16rem; 4470 display: ${e=>e.$open?"block":"none"}; 4471 background: ${Z}; 4472 border: 1px solid ${Rt}; 4473 border-radius: 0; 4474 box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12); 4475 overflow: hidden; 4476 z-index: 1000; 4477`,aze=p.div.withConfig({displayName:"ProjectSwitcher__PopoverHeader",componentId:"sc-od5cl3-5"})` 4478 padding: 0.625rem 0.75rem; 4479 border-bottom: 1px solid ${V}; 4480 background: linear-gradient(to bottom, ${At}, ${Z}); 4481 display: flex; 4482 align-items: center; 4483 gap: 0.5rem; 4484 color: ${O}; 4485 font-weight: 850; 4486 font-size: 0.8125rem; 4487`,lze=p.div.withConfig({displayName:"ProjectSwitcher__HeaderRight",componentId:"sc-od5cl3-6"})` 4488 margin-left: auto; 4489 display: inline-flex; 4490 align-items: center; 4491 gap: 0.25rem; 4492`,cze=p.button.withConfig({displayName:"ProjectSwitcher__AddButton",componentId:"sc-od5cl3-7"})` 4493 width: 28px; 4494 height: 28px; 4495 border-radius: 0.625rem; 4496 border: 1px solid ${V}; 4497 background: ${Z}; 4498 color: ${z}; 4499 display: inline-flex; 4500 align-items: center; 4501 justify-content: center; 4502 cursor: pointer; 4503 transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease; 4504 4505 &:disabled {
4506 cursor: not-allowed; 4507 opacity: 0.55; 4508 } 4509 4510 &:hover { 4511 background: ${At}; 4512 border-color: ${Pe}; 4513 color: ${O}; 4514 } 4515 4516 &:disabled:hover { 4517 background: ${Z}; 4518 border-color: ${V}; 4519 color: ${z}; 4520 } 4521 4522 &:focus-visible { 4523 outline: none; 4524 box-shadow: 0 0 0 3px ${En}; 4525 } 4526`,Cz=p.div.withConfig({displayName:"ProjectSwitcher__EmptyState",componentId:"sc-od5cl3-8"})` 4527 padding: 0.75rem; 4528 font-size: 0.8125rem; 4529 color: ${z}; 4530`,dze=p.button.withConfig({displayName:"ProjectSwitcher__Item",componentId:"sc-od5cl3-9"})` 4531 width: 100%; 4532 border: 0; 4533 background: ${e=>e.$active?At:"transparent"}; 4534 border-radius: 0.625rem; 4535 padding: 0.5rem 0.5rem; 4536 display: grid; 4537 grid-template-columns: 1.25rem 1fr 1.25rem; 4538 align-items: center; 4539 gap: 0.5rem; 4540 cursor: pointer; 4541 transition: background-color 0.12s ease; 4542 4543 &:hover { 4544 background: ${At}; 4545 } 4546 4547 &:focus-visible { 4548 outline: none; 4549 box-shadow: 0 0 0 3px ${En}; 4550 } 4551`,uze=p.div.withConfig({displayName:"ProjectSwitcher__ItemName",componentId:"sc-od5cl3-10"})` 4552 min-width: 0; 4553 overflow: hidden; 4554 text-overflow: ellipsis; 4555 white-space: nowrap; 4556 font-size: 0.875rem; 4557 font-weight: 650; 4558 color: ${O}; 4559 text-align: left; 4560`,pze=p.div.withConfig({displayName:"ProjectSwitcher__ItemRight",componentId:"sc-od5cl3-11"})` 4561 display: flex; 4562 align-items: center; 4563 justify-content: flex-end; 4564 color: ${z}; 4565`;function Sz({project:e,large:n=!1}){const i=n?22:18;return t.jsx(By,{logoUrl:e?.logo_url,size:i,fallback:t.jsx(_P,{size:18})})}function mze({collapsed:e,isNarrow:n}){const{projectId:i}=Gn(),{organizationId:r,projects:o,projectsLimit:s,projectsCount:a,isLoading:c,selectedProjectId:u,setSelectedProjectId:m}=Mr(),h=zn(),{user:g}=yn(),{requestLeave:x}=oC(),[y,w]=l.useState(!1),[j,v]=l.useState(!1),_=l.useRef(null),$=l.useMemo(()=>{if(!i)return;const T=Number(i);if(!(!Number.isFinite(T)||T<=0))return o.find(M=>M.id===T)||o.find(M=>M.id===u)},[i,o,u]),k=l.useMemo(()=>r,[r]),P=!!r,S=l.useMemo(()=>{const T=Number(r);if(!Number.isFinite(T)||T<=0)return!1;const M=g?.organizations?.find(R=>R.id===T)?.role;return M==="owner"||M==="editor"},[r,g?.organizations]),I=l.useMemo(()=>{const T=Number(r);return!Number.isFinite(T)||T<=0?!1:g?.organizations?.find(R=>R.id===T)?.role==="owner"},[r,g?.organizations]),A=l.useMemo(()=>s==null||a==null?!1:a>=s,[a,s]),E=l.useMemo(()=>r?i?$?.name||(c?"Loading projectâ¦":"Select a project"):"Projects":"No workspace",[r,i,$?.name,c]),B=()=>{P&&w(T=>!T)};return l.useEffect(()=>{if(!y)return;const T=M=>{const R=_.current;R&&(M.target instanceof Node&&R.contains(M.target)||w(!1))};return window.addEventListener("mousedown",T),()=>window.removeEventListener("mousedown",T)},[y]),l.useEffect(()=>{(e||n)&&w(!1)},[e,n]),l.useEffect(()=>{P||w(!1)},[P]),t.jsxs(rze,{ref:_,children:[e||n?t.jsx(at,{content:P?"Projects":"Select a workspace to view projects",placement:n?"bottom":"top",onlyIfTruncated:!1,children:t.jsxs(UF,{type:"button",$compact:e,"aria-label":y?"Close project list":"Open project list",title:"Projects","aria-disabled":!P,onClick:B,children:[t.jsx(Sz,{project:$,large:!e&&!n}),e?null:t.jsxs(t.Fragment,{children:[t.jsx(HF,{title:E,children:E}),P?t.jsx(qn,{size:16}):null]})]})}):t.jsxs(UF,{type:"button",$compact:e,"aria-label":y?"Close project list":"Open project list","aria-disabled":!P,onClick:B,children:[t.jsx(Sz,{project:$,large:!e&&!n}),e?null:t.jsxs(t.Fragment,{children:[t.jsx(HF,{title:E,children:E}),P?t.jsx(qn,{size:16}):null]})]}),t.jsxs(sze,{$open:y,$narrow:n,$collapsed:e,role:"menu","aria-label":"Projects",children:[t.jsxs(aze,{children:[t.jsx(_P,{size:16}),"Projects",t.jsx(lze,{children:S?t.jsx(at,{content:A?I?t.jsxs(t.Fragment,{children:["Project limit reached. ",t.jsx("button",{type:"button",onClick:()=>v(!0),style:{color:"inherit",fontWeight:850,textDecoration:"underline",background:"none",border:"none",padding:0,font:"inherit",cursor:"pointer"},children:"Upgrade your plan"})," to add more."]}):"Project limit reached. Ask your workspace owner to upgrade the plan.":"Add project",onlyIfTruncated:!1,children:t.jsx("span",{style:{display:"inline-flex"},children:t.jsx(cze,{type:"button","aria-label":"Add project",title:"Add project",disabled:A,onClick:async()=>
4565{if(!A){if(g?.add_project_active&&g.add_project_organization_id){h(`/workspaces/${g.add_project_organization_id}/projects/new?step=website`),w(!1);return}r&&(h(`/workspaces/${r}/projects/new?step=website`),w(!1))}},children:t.jsx(gr,{size:16})})})}):null})]}),r?c?t.jsx(Cz,{children:"Loading projectsâ¦"}):o.length===0?t.jsx(Cz,{children:"No projects yet."}):t.jsx(oze,{children:o.map(T=>{const M=T.id===u;return t.jsxs(dze,{type:"button",role:"menuitem",$active:M,onClick:()=>{m(T.id),k&&x(`/workspaces/${k}/projects/${T.id}`),w(!1)},children:[t.jsx(Sz,{project:T}),t.jsx(uze,{title:T.name,children:T.name}),t.jsx(pze,{children:M?t.jsx(Zn,{size:16}):null})]},T.id)})}):t.jsx(Cz,{children:"Select a workspace to view its projects."})]}),r?t.jsx(ec,{isOpen:j,orgId:Number(r),onClose:()=>v(!1)}):null]})}function hze({collapsed:e,isNarrow:n}){const{workspaceId:i,projectId:r}=Gn();if(!l.useMemo(()=>!!i&&!r,[r,i]))return null;const s=`/workspaces/${i}`,a=[{key:"workspace-projects",label:"Projects",icon:_P,to:s},{key:"workspace-overview",label:"Overview",icon:X8,to:`${s}/overview`}];return t.jsx(ff,{title:"Workspace",collapsed:e,isNarrow:n,items:a})}function fze({collapsed:e,isNarrow:n,mobileOpen:i,onMobileToggle:r}){const{workspaceId:o,projectId:s}=Gn(),{user:a}=yn(),c=l.useMemo(()=>!!o&&!!s,[s,o]),u=l.useMemo(()=>{const g=Number(o);return!!a?.organizations?.find(y=>Number(y.id)===g)?.agents_enabled},[a?.organizations,o]);if(!c)return null;const m=`/workspaces/${o}/projects/${s}`,h=[{key:"project-overview",label:"Overview",icon:X8,to:m},{key:"project-prompts",label:"Visibility",icon:Ss,to:`${m}/prompts`,end:!1},{key:"project-site-audit",label:"Site Audit",icon:To,to:`${m}/site-audit`},{key:"project-actions",label:"Actions",icon:bP,to:`${m}/actions`},{key:"project-analytics",label:"Analytics",icon:Eu,to:`${m}/analytics`},...u?[{key:"project-agents",label:"Agents",icon:Dy,to:`${m}/agents`}]:[],{key:"project-chat",label:"Chat",icon:t_,to:`${m}/chat`}];return t.jsx(ff,{title:"Project",collapsed:e,isNarrow:n,mobileTriggerIcon:wP,mobileOpen:i,onMobileToggle:r,items:h})}function gze({collapsed:e,isNarrow:n=!1,mobileOpen:i,onMobileToggle:r}){const{workspaceId:o,projectId:s}=Gn(),{projects:a,isLoading:c}=Mr();if(!l.useMemo(()=>{if(!o||!s||c)return!1;const g=Number(s);return!Number.isFinite(g)||g<=0?!1:!!a.find(y=>y.id===g)?.can?.settings},[c,s,a,o]))return null;const m=`/workspaces/${o}/projects/${s}/settings`,h=[{key:"project-settings-general",label:"General",icon:Une,to:m},{key:"project-settings-users",label:"Users",icon:Ap,to:`${m}/users`},{key:"project-settings-competitors",label:"Competitors",icon:$P,to:`${m}/competitors`},{key:"project-settings-integrations",label:"Integrations",icon:SP,to:`${m}/integrations`}];return t.jsx(ff,{title:"Settings",collapsed:e,isNarrow:n,mobileTriggerIcon:Bc,mobileOpen:i,onMobileToggle:r,items:h})}function yze({collapsed:e,isNarrow:n}){const{user:i}=yn(),r=vo();if(!l.useMemo(()=>i?.can?.admin?r.pathname==="/admin"||r.pathname.startsWith("/admin/"):!1,[r.pathname,i?.can?.admin]))return null;const a=String(i?.admin_role||"").toLowerCase()==="admin",c={key:"admin-sidekiq",label:"Sidekiq",icon:gl,onClick:async()=>{try{const m=await ue("/api/v1/admin/sidekiq_portal_token",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})}),h=await m.json().catch(()=>({}));if(!m.ok||!h?.portal_token)throw new Error(h?.error||"Failed to open Sidekiq");const g=`${Td()}/api/v1/admin/sidekiq?portal_token=${encodeURIComponent(h.portal_token)}`;window.open(g,"_blank","noopener,noreferrer")}catch(m){console.error(m)}}},u={key:"admin-performance",label:"Performance",icon:Eu,onClick:async()=>{try{const m=await ue("/api/v1/admin/performance_portal_token",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})}),h=await m.json().catch(()=>({}));if(!m.ok||!h?.portal_token)throw new Error(h?.error||"Failed to open Performance Dashboard");const g=`${Td()}/api/v1/admin/performance?portal_token=${encodeURIComponent(h.portal_token)}`;window.open(g,"_blank","noopener,noreferrer")}catch(m){console.error(m)}}};return t.jsxs(t.Fragment,{children:[t.jsx(ff,{title:"Core",collapsed:e,isNarrow:n,items:[{key:"admin-dashboard",label:"Dashboard",icon:Yl,to:"/admin"},{key:"admin-ui",label:"Resources",icon:Ef,to:"/admin/resources?resource=users"},{key:"admin-api-docs",label:"API & MCP",icon:vP,to:"/admin/api-docs"}]}),t.jsx(ff,{title:"Operations",collapsed:e,isNarrow:n,items:[{key:"admin-runs",label:"Run Monitor",icon:eh,to:"/admin/runs"},{key:"admin-costs",label:"Costs",icon:K8,to:"/admin/costs"}]}),a?t.jsxs(t.Fragment,{children:[t.jsx(ff,{title:"Security",collapsed:e,isNarrow:n,items:[{key:"admin-api-keys",label:"API Keys",icon:Rc,to:"/admin/api-keys"},{key:"admin-logs",label:"Logs",icon:Ss,to:"/admin/logs"}]}),t.jsx(ff,{title:"Platform",collapsed:e,isNarrow:n,items:[{key:"admin-health",label:"Health & sources",icon:Mne,to:"/admin/health"}
4565,{key:"admin-infra",label:"Infrastructure",icon:Lb,to:"/admin/infrastructure"},c,u]})]}):null]})}const xze=p.a.withConfig({displayName:"PartnerBadge__Shell",componentId:"sc-1lhlkj-0"})` 4566 margin: 0.5rem 0.6rem 0.25rem; 4567 padding: 0.6rem; 4568 border: 1px solid ${V}; 4569 border-radius: 0.875rem; 4570 background: ${Z}; 4571 display: grid; 4572 grid-template-columns: 2rem 1fr; 4573 align-items: center; 4574 gap: 0.65rem; 4575 color: inherit; 4576 text-decoration: none; 4577 cursor: pointer; 4578 4579 &:hover { 4580 background: ${At}; 4581 } 4582 4583 &:focus-visible { 4584 outline: none; 4585 box-shadow: 0 0 0 3px ${En}; 4586 } 4587`,bze=p.a.withConfig({displayName:"PartnerBadge__IconOnlyLink",componentId:"sc-1lhlkj-1"})` 4588 margin: ${e=>e.$inline?"0":"0.5rem 0 0.25rem"}; 4589 width: 34px; 4590 height: 34px; 4591 border-radius: 0.75rem; 4592 display: inline-flex; 4593 align-items: center; 4594 justify-content: center; 4595 color: inherit; 4596 text-decoration: none; 4597 cursor: pointer; 4598 4599 &:hover { 4600 background: ${e=>e.$inline?"transparent":At}; 4601 } 4602 4603 &:focus-visible { 4604 outline: none; 4605 box-shadow: 0 0 0 3px ${En}; 4606 } 4607`,qF=p.div.withConfig({displayName:"PartnerBadge__Mark",componentId:"sc-1lhlkj-2"})` 4608 width: 2rem; 4609 height: 2rem; 4610 border-radius: 0.75rem; 4611 border: 1px solid ${V}; 4612 background: ${At}; 4613 overflow: hidden; 4614 display: inline-flex; 4615 align-items: center; 4616 justify-content: center; 4617 flex-shrink: 0; 4618 font-weight: 900; 4619 font-size: 0.6875rem; 4620 color: ${O}; 4621`,GF=p.img.withConfig({displayName:"PartnerBadge__MarkImg",componentId:"sc-1lhlkj-3"})` 4622 width: 100%; 4623 height: 100%; 4624 object-fit: cover; 4625 display: block; 4626`,vze=p.div.withConfig({displayName:"PartnerBadge__Text",componentId:"sc-1lhlkj-4"})` 4627 min-width: 0; 4628 display: grid; 4629`,wze=p.div.withConfig({displayName:"PartnerBadge__TitleRow",componentId:"sc-1lhlkj-5"})` 4630 min-width: 0; 4631 display: inline-flex; 4632 align-items: center; 4633 gap: 0.35rem; 4634`,jze=p.div.withConfig({displayName:"PartnerBadge__Title",componentId:"sc-1lhlkj-6"})` 4635 font-size: 0.75rem; 4636 font-weight: 900; 4637 color: ${O}; 4638 line-height: 1.1; 4639 white-space: nowrap; 4640 overflow: hidden; 4641 text-overflow: ellipsis; 4642`;function VF({collapsed:e,iconOnly:n,inline:i}){const{workspaceId:r}=Gn(),{user:o}=yn(),s=l.useMemo(()=>{const x=Number(r);return Number.isFinite(x)&&o?.organizations?.find(y=>Number(y.id)===x)||null},[o?.organizations,r]),a=s?.partner||null,c=!!s?.partner_managed,u=a?.return_url?String(a.return_url):"",m=a?.name?String(a.name):"Partner",h=a?.logo_url?String(a.logo_url):"";if(!c||!a||!u)return null;if(!!n||e){const x=t.jsx(bze,{$inline:i,href:u,target:"_blank",rel:"noreferrer noopener","aria-label":`Open ${m}`,title:m,children:t.jsx(qF,{"aria-hidden":"true",children:t.jsx(Hb,{src:h,alt:`${m} logo`,Img:GF,fallback:t.jsx("span",{children:m.slice(0,2).toUpperCase()})})})});return n?x:t.jsx(at,{content:m,children:t.jsx("div",{style:{width:"100%",display:"flex",justifyContent:"center"},children:x})})}return t.jsxs(xze,{href:u,target:"_blank",rel:"noreferrer noopener",title:m,children:[t.jsx(qF,{"aria-hidden":"true",children:t.jsx(Hb,{src:h,alt:`${m} logo`,Img:GF,fallback:t.jsx("span",{children:m.slice(0,2).toUpperCase()})})}),t.jsx(vze,{children:t.jsxs(wze,{children:[t.jsx(jze,{children:m}),t.jsx("span",{style:{display:"inline-flex",alignItems:"center",color:z},"aria-hidden":"true",children:t.jsx(as,{size:14})})]})})]})}const _ze=p.div.withConfig({displayName:"NotificationBell__Wrapper",componentId:"sc-zowthx-0"})` 4643 position: relative; 4644 display: inline-flex; 4645 align-items: center; 4646 justify-content: center; 4647`,Cze=p.button.withConfig({displayName:"NotificationBell__BellButton",componentId:"sc-zowthx-1"})` 4648 appearance: none; 4649 border: 0; 4650 background: transparent; 4651 color: ${z}; 4652 cursor: pointer; 4653 display: inline-flex; 4654 align-items: center; 4655 justify-content: center; 4656 width: 34px; 4657 height: 34px; 4658 border-radius: 0.75rem; 4659 position: relative; 4660 transition: background-color 0.15s ease, color 0.15s ease; 4661 4662 &:hover { 4663 background: ${$e}; 4664 } 4665 4666 &:focus-visible { 4667 outline: none; 4668 box-shadow: 0 0 0 3px ${En}; 4669 } 4670`,Sze=p.span.withConfig({displayName:"NotificationBell__Badge",componentId:"sc-zowthx-2"})` 4671 position: absolute; 4672 top: 4px; 4673 right: 4px; 4674 min-width: 16px; 4675 height: 16px; 4676 border-radius: 999px; 4677 background: ${ot}; 4678 color: #fff; 4679 font-size: 0.625rem; 4680 font-weight: 700; 4681 display: flex; 4682 align-items: center; 4683 justify-content: center; 4684 padding: 0 4px; 4685 line-height: 1; 4686 pointer-events: none; 4687`,kze=Tn` 4688 from { opacity: 0; transform: translateY(-4px); } 4689 to { opacity: 1; transform: translateY(0); } 4690`,$ze=p.div.withConfig({displayName:"NotificationBell__Dropdown",componentId:"sc-zowthx-3"})` 4691 position: absolute; 4692 bottom: calc(100% + 6px); 4693 left: 0; 4694 width: 320px; 4695 max-height: 420px; 4696 background: ${Z}; 4697 border: 1px solid ${Rt}; 4698 border-radius: 0.75rem; 4699 box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12); 4700 z-index: 200; 4701 animation: ${kze} 0.12s ease; 4702 display: flex; 4703 flex-direction: column; 4704 overflow: hidden; 4705 4706 @media (max-width: 768px) { 4707 bottom: auto; 4708 top: calc(100% + 6px); 4709 left: auto; 4710 right: 0; 4711 } 4712`,Ize=p.div.withConfig({displayName:"NotificationBell__DropdownHeader",componentId:"sc-zowthx-4"})` 4713 display: flex; 4714 align-items: center; 4715 justify-content: space-between; 4716 padding: 0.625rem 0.875rem; 4717 border-bottom: 1px solid ${V}; 4718 flex-shrink: 0; 4719`,Pze=p.span.withConfig({displayName:"NotificationBell__DropdownTitle",componentId:"sc-zowthx-5"})` 4720 font-size: 0.8125rem; 4721 font-weight: 600; 4722 color: ${O}; 4723`,Aze=p.button.withConfig({displayName:"NotificationBell__MarkAllBtn",componentId:"sc-zowthx-6"})` 4724 appearance: none; 4725 border: none; 4726 background: none; 4727 font-size: 0.6875rem; 4728 font-weight: 500; 4729 color: ${ot}; 4730 cursor: pointer; 4731 padding: 2px 6px; 4732 border-radius: 4px; 4733 transition: background 0.12s ease; 4734 4735 &:hover { 4736 background: ${$e}; 4737 } 4738 4739 &:disabled { 4740 opacity: 0.4; 4741 cursor: default; 4742 } 4743`,Nze=p.div.withConfig({displayName:"NotificationBell__NotifList",componentId:"sc-zowthx-7"})` 4744 overflow-y: auto; 4745 flex: 1; 4746 min-height: 0; 4747`,KF=p.div.withConfig({displayName:"NotificationBell__EmptyState",componentId:"sc-zowthx-8"})` 4748 padding: 2rem 1rem; 4749 text-align: center; 4750 font-size: 0.8125rem; 4751 color: ${Pe}; 4752`,zze=p.button.withConfig({displayName:"NotificationBell__LoadMoreBtn",componentId:"sc-zowthx-9"})` 4753 appearance: none; 4754 border: none; 4755 background: none; 4756 width: 100%; 4757 padding: 0.625rem 0.875rem; 4758 font-size: 0.75rem; 4759 font-weight: 600; 4760 color: ${ot}; 4761 cursor: pointer; 4762 transition: background 0.12s ease; 4763 4764 &:hover { 4765 background: ${$e}; 4766 } 4767 4768 &:disabled { 4769 opacity: 0.5; 4770 cursor: default; 4771 } 4772`,Tze=p.button.withConfig({displayName:"NotificationBell__NotifRow",componentId:"sc-zowthx-10"})` 4773 appearance: none; 4774 border: none; 4775 background: ${e=>e.$read?"transparent":$e}; 4776 display: flex; 4777 align-items: flex-start; 4778 gap: 0.5rem; 4779 width: 100%; 4780 text-align: left; 4781 padding: 0.625rem 0.875rem; 4782 cursor: pointer; 4783 transition: background 0.12s ease; 4784 border-bottom: 1px solid ${V}; 4785 4786 &:last-child { 4787 border-bottom: none; 4788 } 4789 4790 &:hover { 4791 background: ${$e}; 4792 } 4793`,Eze=p.span.withConfig({displayName:"NotificationBell__UnreadDot",componentId:"sc-zowthx-11"})` 4794 width: 7px; 4795 height: 7px; 4796 border-radius: 50%; 4797 background: ${ot}; 4798 flex-shrink: 0; 4799 margin-top: 5px; 4800`,Mze=p.span.withConfig({displayName:"NotificationBell__ReadDot",componentId:"sc-zowthx-12"})` 4801 width: 7px; 4802 height: 7px; 4803 flex-shrink: 0; 4804 margin-top: 5px; 4805`,Rze=p.div.withConfig({displayName:"NotificationBell__NotifContent",componentId:"sc-zowthx-13"})` 4806 flex: 1; 4807 min-width: 0; 4808`,Oze=p.div.withConfig({displayName:"NotificationBell__NotifTitle",componentId:"sc-zowthx-14"})` 4809 font-size: 0.8125rem; 4810 font-weight: 600; 4811 color: ${O}; 4812 line-height: 1.3; 4813`,Dze=p.div.withConfig({displayName:"NotificationBell__NotifBody",componentId:"sc-zowthx-15"})` 4814 font-size: 0.75rem; 4815 color: ${z};
4816 margin-top: 1px; 4817 line-height: 1.3; 4818`,Lze=p.div.withConfig({displayName:"NotificationBell__NotifTime",componentId:"sc-zowthx-16"})` 4819 font-size: 0.625rem; 4820 color: ${Pe}; 4821 margin-top: 3px; 4822`,Bze=p.span.withConfig({displayName:"NotificationBell__ActionIcon",componentId:"sc-zowthx-17"})` 4823 flex-shrink: 0; 4824 margin-top: 2px; 4825 color: ${Pe}; 4826`;function Fze(e){const n=Date.now()-new Date(e).getTime(),i=Math.floor(n/6e4);if(i<1)return"just now";if(i<60)return`${i}m ago`;const r=Math.floor(i/60);if(r<24)return`${r}h ago`;const o=Math.floor(r/24);return o<7?`${o}d ago`:new Date(e).toLocaleDateString()}const YF=({unreadCount:e,notifications:n,loading:i,loadingMore:r,hasMore:o,fetchNotifications:s,fetchMore:a,markRead:c,markAllRead:u})=>{const m=zn(),[h,g]=l.useState(!1),x=l.useRef(null),y=l.useRef(!1),w=l.useCallback(()=>{g(v=>{const _=!v;return _&&!y.current&&(y.current=!0,s()),_})},[s]);l.useEffect(()=>{if(!h)return;const v=_=>{x.current&&!x.current.contains(_.target)&&g(!1)};return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[h]);const j=v=>{v.read||c(v.id),v.action_url&&(g(!1),m(v.action_url))};return t.jsxs(_ze,{ref:x,children:[t.jsx(at,{content:"Notifications",size:"sm",disabled:h,children:t.jsxs(Cze,{type:"button","aria-label":"Notifications",onClick:w,children:[t.jsx(zge,{size:18}),e>0&&t.jsx(Sze,{children:e>99?"99+":e})]})}),h&&t.jsxs($ze,{children:[t.jsxs(Ize,{children:[t.jsx(Pze,{children:"Notifications"}),e>0&&t.jsxs(Aze,{onClick:()=>void u(),children:[t.jsx(Zn,{size:12,style:{marginRight:3,verticalAlign:-1}}),"Mark all read"]})]}),t.jsx(Nze,{children:i&&n.length===0?t.jsx(KF,{children:"Loading..."}):n.length===0?t.jsx(KF,{children:"No notifications yet"}):t.jsxs(t.Fragment,{children:[n.map(v=>t.jsxs(Tze,{$read:v.read,onClick:()=>j(v),children:[v.read?t.jsx(Mze,{}):t.jsx(Eze,{}),t.jsxs(Rze,{children:[t.jsx(Oze,{children:v.title}),v.body&&t.jsx(Dze,{children:v.body}),t.jsx(Lze,{children:Fze(v.created_at)})]}),v.action_url&&t.jsx(Bze,{children:t.jsx(as,{size:13})})]},v.id)),o&&t.jsx(zze,{type:"button",disabled:r,onClick:()=>void a(),children:r?"Loading...":"Load more"})]})})]})]})},$re=l.createContext(null);function wo(){const e=l.useContext($re);if(!e)throw new Error("useCable must be used within a CableProvider");return e}const TM=l.createContext(null);function kk(e,n){return`${e}:${n}`}function fw(e,n){return`/api/v1/organizations/${e}/projects/${n}/competitors`}function XF(e,n){return{project_id:Number(e?.project_id)||n,project_website:typeof e?.project_website=="string"?e.project_website:null,max_competitors:Number(e?.max_competitors)||0,direct:Array.isArray(e?.direct)?e.direct:[],suggested:Array.isArray(e?.suggested)?e.suggested:[],summary:e?.summary&&typeof e.summary=="object"?e.summary:void 0}}function Wze({children:e}){const[n,i]=l.useState({}),r=l.useRef({}),o=120*1e3,s=l.useCallback((j,v)=>{const _=kk(j,v);return n[_]||{data:null,loading:!1,error:null,lastFetchedAt:null}},[n]),a=l.useCallback((j,v)=>{i(_=>{const $=_[j]||{data:null,loading:!1,error:null,lastFetchedAt:null};return{..._,[j]:{...$,...v}}})},[]),c=l.useCallback(async(j,v,_)=>{if(!Number.isFinite(j)||j<=0||!Number.isFinite(v)||v<=0)return null;const $=kk(j,v),k=s(j,v),P=Date.now(),S=k.lastFetchedAt&&P-k.lastFetchedAt<o;if(!_?.force&&k.data&&S)return k.data;const I=r.current[$];if(I)return I;a($,{loading:!0,error:null});const A=(async()=>{try{const E=await ue(fw(j,v),{method:"GET"}),B=await E.json().catch(()=>({}));if(!E.ok)throw new Error(B?.error||B?.errors?.[0]||"Failed to load competitors");const T=XF(B,v);return a($,{data:T,loading:!1,error:null,lastFetchedAt:Date.now()}),T}catch(E){return a($,{data:null,loading:!1,error:E?.message||"Failed to load competitors",lastFetchedAt:Date.now()}),null}finally{delete r.current[$]}})();return r.current[$]=A,A},[s,a]),u=l.useCallback(async(j,v,_)=>{const $=kk(j,v);a($,{loading:!0,error:null});const k=await _(),P=await k.json().catch(()=>({}));if(!k.ok)throw a($,{loading:!1,error:P?.error||P?.errors?.[0]||"Request failed"}),new Error(P?.error||P?.errors?.[0]||"Request failed");const S=XF(P,v);return a($,{data:S,loading:!1,error:null,lastFetchedAt:Date.now()}),S},[a]),m=l.useCallback(async(j,v,_)=>u(j,v,()=>ue(fw(j,v),{method:"POST",headers:{"Content-Type":"application/json"}
4826,body:JSON.stringify({website:_.website,name:_.name,competitor_type:_.competitor_type||"direct"})})),[u]),h=l.useCallback(async(j,v,_,$)=>u(j,v,()=>ue(`${fw(j,v)}/${_}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({competitor_type:$})})),[u]),g=l.useCallback(async(j,v,_,$)=>u(j,v,()=>ue(`${fw(j,v)}/${_}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({aliases:$})})),[u]),x=l.useCallback(async(j,v,_)=>u(j,v,()=>ue(`${fw(j,v)}/${_}`,{method:"DELETE"})),[u]),y=l.useCallback((j,v)=>{const _=kk(j,v);i($=>{const k={...$};return delete k[_],k})},[i]),w=l.useMemo(()=>({getEntry:s,ensureLoaded:c,createCompetitor:m,updateCompetitor:h,updateCompetitorAliases:g,deleteCompetitor:x,invalidate:y}),[m,x,c,s,y,h,g]);return t.jsx(TM.Provider,{value:w,children:e})}const $k=20;function Uze(e=!0){const{user:n}=yn(),{lastEvent:i}=wo(),r=l.useContext(TM),o=l.useRef(r);o.current=r;const[s,a]=l.useState(0),[c,u]=l.useState([]),[m,h]=l.useState(!1),[g,x]=l.useState(!1),[y,w]=l.useState(!1),j=l.useRef(1),v=l.useRef(!1),_=l.useCallback(async()=>{if(!(!e||!n))try{const I=await ue("/api/v1/notifications/unread_count"),A=await I.json().catch(()=>({}));I.ok&&typeof A.unread_count=="number"&&a(A.unread_count)}catch{}},[e,n]),$=l.useCallback(async()=>{if(!(!e||!n)){h(!0),j.current=1;try{const I=await ue(`/api/v1/notifications?page=1&per_page=${$k}`),A=await I.json().catch(()=>({}));if(I.ok&&Array.isArray(A.notifications)){u(A.notifications),typeof A.unread_count=="number"&&a(A.unread_count);const E=typeof A.total=="number"?A.total:0;w($k<E)}}catch{}finally{h(!1)}}},[e,n]),k=l.useCallback(async()=>{if(!e||!n||g)return;const I=j.current+1;x(!0);try{const A=await ue(`/api/v1/notifications?page=${I}&per_page=${$k}`),E=await A.json().catch(()=>({}));if(A.ok&&Array.isArray(E.notifications)){j.current=I,u(T=>[...T,...E.notifications]),typeof E.unread_count=="number"&&a(E.unread_count);const B=typeof E.total=="number"?E.total:0;w(I*$k<B)}}catch{}finally{x(!1)}},[e,n,g]),P=l.useCallback(async I=>{try{(await ue(`/api/v1/notifications/${I}/read`,{method:"PATCH"})).ok&&(u(E=>E.map(B=>B.id===I?{...B,read:!0}:B)),a(E=>Math.max(0,E-1)))}catch{}},[]),S=l.useCallback(async()=>{try{(await ue("/api/v1/notifications/read_all",{method:"PATCH"})).ok&&(u(A=>A.map(E=>({...E,read:!0}))),a(0))}catch{}},[]);return l.useEffect(()=>{if(!e){v.current=!1,a(0),u([]),w(!1),h(!1),x(!1);return}!n||v.current||(v.current=!0,_())},[e,n,_]),l.useEffect(()=>{if(!e||!i||i.type!=="notification")return;const I=i.notification;if(I&&(a(A=>A+1),u(A=>[{id:I.id,notification_type:I.notification_type,title:I.title,body:I.body??null,action_url:I.action_url??null,metadata:I.metadata??{},read:!1,created_at:I.created_at},...A].slice(0,30)),I.notification_type==="new_suggested_competitors"&&I.action_url&&o.current)){const A=I.action_url.match(/\/workspaces\/(\d+)\/projects\/(\d+)/);A&&o.current.invalidate(Number(A[1]),Number(A[2]))}},[i]),{unreadCount:s,notifications:c,loading:m,loadingMore:g,hasMore:y,fetchNotifications:$,fetchMore:k,markRead:P,markAllRead:S}}const Hze=["generating_content","scanning","discovering_competitors","generating_actions","completed"];function QF(e){const n=Hze.indexOf(e);return n>=0?n:-1}function kz(e){switch(e){case"generating_content":return"Generating topics & promptsâ¦";case"scanning":return"Scanning prompts across AI enginesâ¦";case"discovering_competitors":return"Discovering competitorsâ¦";case"generating_actions":return"Generating actionsâ¦";case"completed":return"Setup complete";case"failed":return"Setup failed";default:return"Setting up projectâ¦"}}function qze(e){switch(e){case"generating_content":return 15;case"scanning":return 45;case"discovering_competitors":return 70;case"generating_actions":return 85;case"completed":return 100;case"failed":return 100;default:return 10}}const Gze=Tn` 4827 from { transform: rotate(0deg); } 4828 to { transform: rotate(360deg); } 4829`,Vze=Tn` 4830 from { opacity: 0; transform: translateY(-4px); } 4831 to { opacity: 1; transform: translateY(0); } 4832`,Kze=Tn` 4833 from { opacity: 1; transform: translateY(0); } 4834 to { opacity: 0; transform: translateY(-4px); } 4835`,ZF=p.div.withConfig({displayName:"OnboardProgressBanner__Banner",componentId:"sc-dobku8-0"})` 4836 animation: ${e=>e.$exiting?Kze:Vze} 0.3s ease forwards; 4837 padding: 0.5rem 0.75rem; 4838 border-bottom: 1px solid ${V}; 4839 display: flex; 4840 flex-direction: column; 4841 gap: 0.375rem; 4842 background: ${e=>e.$variant==="done"?si:e.$variant==="error"?kn:cn}; 4843`,JF=p.div.withConfig({displayName:"OnboardProgressBanner__Row",componentId:"sc-dobku8-1"})` 4844 display: flex; 4845 align-items: center; 4846 gap: 0.375rem; 4847`,eW=p(Tr).withConfig({displayName:"OnboardProgressBanner__SpinIcon",componentId:"sc-dobku8-2"})` 4848 animation: ${Gze} 1s linear infinite; 4849 flex-shrink: 0; 4850`,Yze=p.span.withConfig({displayName:"OnboardProgressBanner__Message",componentId:"sc-dobku8-3"})` 4851 font-size: 0.6875rem; 4852 font-weight: 600; 4853 line-height: 1.3; 4854 color: ${e=>
4854e.$variant==="done"?Vt:e.$variant==="error"?Ut:ot}; 4855`,Xze=p.div.withConfig({displayName:"OnboardProgressBanner__ProgressTrack",componentId:"sc-dobku8-4"})` 4856 width: 100%; 4857 height: 3px; 4858 background: ${Z}; 4859 border-radius: 2px; 4860 overflow: hidden; 4861`,Qze=Tn` 4862 0% { opacity: 1; } 4863 50% { opacity: 0.6; } 4864 100% { opacity: 1; } 4865`,Zze=p.div.withConfig({displayName:"OnboardProgressBanner__ProgressFill",componentId:"sc-dobku8-5"})` 4866 height: 100%; 4867 border-radius: 2px; 4868 width: ${e=>e.$pct}%; 4869 background: ${e=>e.$done?Vt:ot}; 4870 transition: width 0.6s ease; 4871 animation: ${e=>e.$done?"none":Qze} 2s ease-in-out infinite; 4872`;function Jze({project:e,collapsed:n,onDismiss:i}){const{subscribe:r}=wo(),{updateProject:o,refreshProjects:s}=Mr(),a=e.onboard_status,[c,u]=l.useState(()=>a==="running"?"generating_content":a==="project_ready"?"scanning":a==="completed"?"completed":a==="failed"?"failed":"generating_content"),[m,h]=l.useState(()=>kz(c)),[g,x]=l.useState(!1),y=l.useRef(void 0),w=l.useRef(!1),j=l.useRef(c);j.current=c;const v=l.useRef(e);v.current=e;const _=l.useRef(i);_.current=i;const $=l.useRef(e.id);if(l.useEffect(()=>{const S=r({channel:"ProjectPromptsChannel",project_id:$.current},{received:I=>{if(I?.type!=="onboard_progress"||w.current)return;const A=I.step,E=I.message;if(A==="completed"){w.current=!0,u("completed"),h("Setup complete");return}if(A==="failed"){w.current=!0,u("failed"),h(E||"Setup failed");return}const B=QF(j.current),T=QF(A);T>B?(u(A),h(E||kz(A))):T===B&&E&&h(E)}});return()=>{S?.unsubscribe()}},[]),l.useEffect(()=>{if(w.current)return;const S=e.onboard_status;S==="completed"?(w.current=!0,u("completed"),h("Setup complete")):S==="failed"&&(w.current=!0,u("failed"),h(kz("failed")))},[e.onboard_status]),l.useEffect(()=>{if(c!=="completed"&&c!=="failed")return;const S=c==="completed"?3e3:5e3;return y.current=setTimeout(()=>{x(!0),o({...v.current,onboard_status:c==="completed"?"completed":"failed",is_crunching:!1,initial_crunching:!1}),s(),_.current?.()},S),()=>{y.current&&clearTimeout(y.current)}},[c]),g)return null;if(n){const S=c==="completed"?"done":c==="failed"?"error":"active";return t.jsx(ZF,{$variant:S,$exiting:!1,children:t.jsx(JF,{style:{justifyContent:"center"},children:c==="completed"?t.jsx(co,{size:14,color:"var(--color-green-500, #22c55e)"}):c==="failed"?t.jsx(Hc,{size:14,color:"var(--color-red-500, #ef4444)"}):t.jsx(eW,{size:14,color:"var(--color-brand-600, #7c3aed)"})})})}const k=c==="completed"?"done":c==="failed"?"error":"active",P=qze(c);return t.jsxs(ZF,{$variant:k,$exiting:g,children:[t.jsxs(JF,{children:[c==="completed"?t.jsx(co,{size:13,style:{flexShrink:0},color:"var(--color-green-500, #22c55e)"}):c==="failed"?t.jsx(Hc,{size:13,style:{flexShrink:0},color:"var(--color-red-500, #ef4444)"}):t.jsx(eW,{size:13,color:"var(--color-brand-600, #7c3aed)"}),t.jsx(Yze,{$variant:k,children:m})]}),c!=="failed"&&t.jsx(Xze,{children:t.jsx(Zze,{$pct:P,$done:c==="completed"})})]})}const tW="12rem",nW="4rem",qm=768,eTe=p.aside.withConfig({displayName:"Sidebar__SidebarShell",componentId:"sc-p8njzr-0"})` 4873 width: ${e=>e.$collapsed?nW:tW}; 4874 flex: 0 0 auto; 4875 flex-basis: ${e=>e.$collapsed?nW:tW}; 4876 height: 100vh; 4877 background: ${Z}; 4878 border-right: 1px solid ${Rt}; 4879 display: flex; 4880 flex-direction: column; 4881 transition: width 180ms ease, flex-basis 180ms ease; 4882 position: relative; 4883 4884 /* Small screens: behave like a sticky top navbar, icons-only content */ 4885 @media (max-width: ${qm}px) { 4886 width: 100%; 4887 flex-basis: auto; 4888 height: 3.25rem; 4889 border-right: none; 4890 border-bottom: 1px solid ${Rt}; 4891 flex-direction: row; 4892 align-items: center; 4893 position: sticky; 4894 top: 0; 4895 z-index: 50; 4896 } 4897`,tTe=p.div.withConfig({displayName:"Sidebar__SidebarHeader",componentId:"sc-p8njzr-1"})` 4898 height: 3.25rem; 4899 border-bottom: 1px solid ${V}; 4900 display: flex; 4901 align-items: stretch; 4902 justify-content: flex-start; 4903 padding: 0; 4904 4905 @media (max-width: ${qm}px) { 4906 display: flex; 4907 flex: 0 0 auto; 4908 height: 100%; 4909 border-bottom: none; 4910 } 4911`,nTe=p.div.withConfig({displayName:"Sidebar__SidebarBody",componentId:"sc-p8njzr-2"})` 4912 flex: 1; 4913 min-height: 0; 4914 overflow: auto; 4915 4916 @media (max-width: ${qm}px) { 4917 display: flex; 4918 align-items: center; 4919 flex: 1 1 auto; 4920 min-width: 0; 4921 height: 100%; 4922 overflow-x: auto; 4923 overflow-y: hidden; 4924 -webkit-overflow-scrolling: touch; 4925 scrollbar-width: none; 4926 4927 &::-webkit-scrollbar {
4928 display: none; 4929 } 4930 } 4931`,iTe=p.div.withConfig({displayName:"Sidebar__DesktopBottomPartner",componentId:"sc-p8njzr-3"})` 4932 @media (max-width: ${qm}px) { 4933 display: none; 4934 } 4935`,rTe=p.div.withConfig({displayName:"Sidebar__SidebarToggleRow",componentId:"sc-p8njzr-4"})` 4936 display: ${e=>e.$hidden?"none":"flex"}; 4937 flex-direction: ${e=>e.$collapsed?"column":"row"}; 4938 align-items: center; 4939 justify-content: ${e=>e.$collapsed?"center":"flex-end"}; 4940 gap: ${e=>e.$collapsed?"0.15rem":"0"}; 4941 padding: 0.5rem 0.6rem 0.45rem; 4942 background: ${Z}; 4943`,oTe=p.button.withConfig({displayName:"Sidebar__SidebarIconToggle",componentId:"sc-p8njzr-5"})` 4944 appearance: none; 4945 border: 0; 4946 background: transparent; 4947 color: ${z}; 4948 cursor: pointer; 4949 display: inline-flex; 4950 align-items: center; 4951 justify-content: center; 4952 width: 34px; 4953 height: 34px; 4954 border-radius: 0.75rem; 4955 transition: background-color 0.15s ease, color 0.15s ease; 4956 4957 &:hover { 4958 background: ${$e}; 4959 color: ${z}; 4960 } 4961 4962 &:focus-visible { 4963 outline: none; 4964 box-shadow: 0 0 0 3px ${En}; 4965 } 4966`,sTe=p.div.withConfig({displayName:"Sidebar__SidebarTopNav",componentId:"sc-p8njzr-6"})` 4967 display: flex; 4968 flex-direction: column; 4969 4970 @media (max-width: ${qm}px) { 4971 height: 100%; 4972 flex-direction: row; 4973 align-items: center; 4974 gap: 0.25rem; 4975 width: max-content; 4976 min-width: max-content; 4977 padding: 0 0.25rem; 4978 } 4979`,aTe=p(Dn).withConfig({displayName:"Sidebar__WorkspaceLink",componentId:"sc-p8njzr-7"})` 4980 display: inline-flex; 4981 align-items: center; 4982 gap: 0.3rem; 4983 margin-left: 0.25rem; 4984 margin-right: auto; 4985 font-size: 0.8125rem; 4986 font-weight: 500; 4987 color: ${z}; 4988 text-decoration: none; 4989 white-space: nowrap; 4990 line-height: 1; 4991 transition: color 0.15s ease; 4992 4993 &:hover { 4994 color: ${z}; 4995 text-decoration: underline; 4996 } 4997`,lTe=p.div.withConfig({displayName:"Sidebar__MobilePartnerInline",componentId:"sc-p8njzr-8"})` 4998 display: none; 4999 5000 @media (max-width: ${qm}px) { 5001 display: inline-flex; 5002 align-items: center; 5003 justify-content: center; 5004 margin-left: auto; 5005 margin-right: 0.25rem; 5006 } 5007`,cTe=p.div.withConfig({displayName:"Sidebar__MobileBellInline",componentId:"sc-p8njzr-9"})` 5008 display: none; 5009 5010 @media (max-width: ${qm}px) { 5011 display: inline-flex; 5012 align-items: center; 5013 justify-content: center; 5014 margin-right: 0.125rem; 5015 } 5016`;function dTe(){const{workspaceId:e,projectId:n}=Gn(),{projects:i}=Mr(),r=Uze(!0),o=l.useMemo(()=>({unreadCount:r.unreadCount,notifications:r.notifications,loading:r.loading,loadingMore:r.loadingMore,hasMore:r.hasMore,fetchNotifications:r.fetchNotifications,fetchMore:r.fetchMore,markRead:r.markRead,markAllRead:r.markAllRead}),[r.unreadCount,r.notifications,r.loading,r.loadingMore,r.hasMore,r.fetchNotifications,r.fetchMore,r.markRead,r.markAllRead]),[s,a]=l.useState(!1),[c,u]=l.useState(()=>typeof window>"u"?!1:window.matchMedia(`(max-width: ${qm}px)`).matches);l.useEffect(()=>{const $=window.matchMedia(`(max-width: ${qm}px)`),k=S=>u(S.matches);if(u($.matches),typeof $.addEventListener=="function")return $.addEventListener("change",k),()=>$.removeEventListener("change",k);const P=$;return P.addListener(k),()=>P.removeListener(k)},[]);const m=c?!0:s,[h,g]=l.useState(null);l.useEffect(()=>{const $=n?Number(n):null;if(!$||!Number.isFinite($)){g(null);return}const k=i.find(P=>P.id===$);k&&(k.onboard_status==="running"||k.onboard_status==="project_ready")?g($):g(P=>P===$?P:null)},[n,i]);const x=l.useMemo(()=>h&&i.find($=>$.id===h)||null,[h,i]),y=l.useCallback(()=>g(null),[]),[w,j]=l.useState(null),v=$=>{j(k=>k===$?null:$)},_=l.useMemo(()=>!e||!n?null:{to:`/workspaces/${e}`,label:"Workspace"},[n,e]);return t.jsxs(eTe,{"aria-label":"Sidebar",$collapsed:m,children:[t.jsx(tTe,{$collapsed:m,children:t.jsx("div",{style:{width:"100%",height:"100%",minWidth:0},children:t.jsx(mze,{collapsed:m,isNarrow:c})})}),x&&!c&&t.jsx(Jze,{project:x,collapsed:m,onDismiss:y}),t.jsx(nTe,{children:t.jsxs(sTe,{children:[t.jsx(fze,{collapsed:m,isNarrow:c,mobileOpen:c?w==="project":!1,onMobileToggle:()=>v("project")}),t.jsx(gze,{collapsed:m,isNarrow:c,mobileOpen:c?w==="settings":!1,onMobileToggle:()=>v("settings")}),t.jsx(hze,{collapsed:m,isNarrow:c}),t.jsx(yze,{collapsed:m,isNarrow:c}),t.jsx(ize,{collapsed:m,isNarrow:c,mobileOpen:c?w==="settings":!1,onMobileToggle:()=>v("settings")})]})}),t.jsx(iTe,{children:t.jsx(VF,{collapsed:m})}),t.jsxs(rTe,{$collapsed:m,$hidden:c,children:[!m&&_&&t.jsxs(aTe,{to:_.to,children:[t.jsx(gye,{size:13}),_.label]}),t.jsx(YF,{...o}),t.jsx(oTe,{type:"button","aria-label":m?"Expand sidebar":"Collapse sidebar",title:m?"Expand":"Collapse",onClick:()=>a($=>
5016!$),children:m?t.jsx(J0e,{size:20}):t.jsx(Q0e,{size:20})})]}),t.jsx(lTe,{children:t.jsx(VF,{collapsed:!0,iconOnly:!0,inline:!0})}),t.jsx(cTe,{children:t.jsx(YF,{...o})}),t.jsx(JNe,{collapsed:m})]})}function EM({allow:e,redirectTo:n,loadingFallback:i=null,deniedFallback:r,children:o}){const s=vo();return e===null?t.jsx(t.Fragment,{children:i}):e?t.jsx(t.Fragment,{children:o}):r?t.jsx(t.Fragment,{children:r}):t.jsx(bhe,{to:n,replace:!0,state:{from:s.pathname}})}function Hh({allow:e,paramKey:n="workspaceId",redirectTo:i,children:r}){const{user:o}=yn(),s=Gn(),a=l.useMemo(()=>{const h=s[n],g=Number(h);return Number.isFinite(g)?g:null},[s,n]),c=l.useMemo(()=>{if(!o||!a)return null;const g=o.organizations?.find(x=>x.id===a)?.role;return g==="owner"||g==="editor"||g==="viewer"||g==="project"?g:null},[o,a]),u=l.useMemo(()=>o?!a||!c?!1:e.includes(c):null,[e,c,o,a]),m=l.useMemo(()=>i||(o&&a&&!c?"/":"/forbidden"),[i,c,o,a]);return t.jsx(EM,{allow:u,redirectTo:m,children:r})}function xs({require:e,redirectTo:n,children:i}){const r=Gn(),{projects:o,isLoading:s,loadKey:a,loadedKey:c,isProjectRecentlyDeleted:u}=Mr(),{user:m}=yn(),h=l.useMemo(()=>{const j=r?.workspaceId,v=Number(j);return Number.isFinite(v)&&v>0?v:null},[r]),g=l.useMemo(()=>{const j=r.projectId,v=Number(j);return Number.isFinite(v)?v:null},[r.projectId]),x=l.useMemo(()=>g&&o.find(j=>j.id===g)||null,[g,o]),y=l.useMemo(()=>{if(!m||c!==a||s)return null;if(!g||!x)return!1;const j=x.can;return j?!!j[e]:!1},[s,a,c,g,x,e,m]),w=l.useMemo(()=>
5016n||(y===!1&&g&&!x&&h&&u(g)?`/workspaces/${h}`:"/forbidden"),[y,u,g,x,n,h]);return t.jsx(EM,{allow:y,redirectTo:w,children:i})}function um({redirectTo:e="/forbidden",allowRoles:n,children:i}){const{user:r}=yn(),o=l.useMemo(()=>{if(!r)return null;if(!r.can?.admin)return!1;if(!n||n.length===0)return!0;const s=(r.admin_role||"").toString().toLowerCase();return n.includes(s)},[n,r]);return t.jsx(EM,{allow:o,redirectTo:e,children:i})}const MP=p.span.withConfig({displayName:"CountPill",componentId:"sc-1h3dwm4-0"})` 5017 font-size: 0.75rem; 5018 font-weight: 800; 5019 color: ${z}; 5020 background: ${At}; 5021 border: 1px solid ${V}; 5022 padding: 0.125rem 0.5rem; 5023 border-radius: 9999px; 5024 white-space: nowrap; 5025`;function uTe(e){if(typeof e!="number"||!Number.isFinite(e))return 0;const n=Math.max(0,e);return n<=0?0:n<5e5?1:n<2e6||n<3e6?2:n<7e6?3:n<1e7?4:5}const pTe=p(MP).withConfig({displayName:"VolumePill__Wrap",componentId:"sc-1p6sn11-0"})` 5026 display: inline-flex; 5027 align-items: center; 5028 justify-content: center; 5029 padding: 0.2rem 0.5rem; 5030 color: ${z}; 5031 background: ${At}; 5032 border: 1px solid ${V}; 5033 line-height: 1; 5034`,mTe=p.span.withConfig({displayName:"VolumePill__Bars",componentId:"sc-1p6sn11-1"})` 5035 display: inline-flex; 5036 align-items: flex-end; 5037 justify-content: center; 5038 gap: 2px; 5039`,hTe=p.span.withConfig({displayName:"VolumePill__Bar",componentId:"sc-1p6sn11-2"})` 5040 width: 3px; 5041 height: ${e=>e.$h}px; 5042 border-radius: 9999px; 5043 /* Match the table TrendPill positive hue, but keep it lighter for a subtle "signal" indicator. */ 5044 background: ${e=>e.$active?"rgba(16, 185, 129, 0.70)":"rgba(16, 185, 129, 0.18)"}; 5045`;function S5({value:e,className:n,title:i}){const r=uTe(e),o=r===0?"â":`${r}/5`,s=i??(typeof e=="number"&&Number.isFinite(e)?`Estimated monthly search volume: ${Math.round(e).toLocaleString()}`:"Estimated monthly search volume: â"),a=[4,6,8,10,12];return t.jsx(at,{content:s,size:"sm",onlyIfTruncated:!1,children:t.jsx(pTe,{className:n,"aria-label":`Volume: ${o}`,children:t.jsx(mTe,{"aria-hidden":"true",children:a.map((c,u)=>t.jsx(hTe,{$h:c,$active:r!==0&&u<r},u))})})})}function fTe(e){return typeof e!="number"||!Number.isFinite(e)?"unknown":e>=7.5?"positive":e>=5?"neutral":"negative"}const gTe=p(MP).withConfig({displayName:"SentimentPill__Pill",componentId:"sc-oyrhwc-0"})` 5046 display: inline-flex; 5047 align-items: center; 5048 justify-content: center; 5049 5050 ${e=>e.$tier==="positive"?` 5051 border: 1px solid rgba(16, 185, 129, 0.22); 5052 color: #065F46; 5053 background: rgba(16, 185, 129, 0.12); 5054 `:e.$tier==="neutral"?` 5055 border: 1px solid rgba(107, 114, 128, 0.25); 5056 color: ${z}; 5057 background: rgba(107, 114, 128, 0.08); 5058 `:e.$tier==="negative"?` 5059 border: 1px solid rgba(239, 68, 68, 0.22); 5060 color: #991B1B; 5061 background: rgba(239, 68, 68, 0.12); 5062 `:` 5063 color: ${z}; 5064 background: ${At}; 5065 border: 1px solid ${V}; 5066 `} 5067`;function l_({score:e,className:n,title:i}){const r=fTe(e),o=r==="positive"?"Positive":r==="neutral"?"Neutral":r==="negative"?"Negative":"â",s=i??(typeof e=="number"&&Number.isFinite(e)?`Sentiment score: ${e.toFixed(2)}`:"Sentiment score: â");return t.jsx(gTe,{className:n,$tier:r,title:s,"aria-label":`Sentiment: ${o}`,children:o})}const yTe=p.div.withConfig({displayName:"TabsSelector__Tabs",componentId:"sc-ijao21-0"})` 5068 display: flex; 5069 align-items: flex-end; 5070 gap: 1.5rem; 5071 border-bottom: ${e=>e.$showDivider?`1px solid ${V}`:"0"}; 5072 margin-top: ${e=>e.$marginTop}; 5073 min-width: 0; 5074 overflow-x: auto; 5075 -webkit-overflow-scrolling: touch; 5076 scrollbar-width: none; 5077 &::-webkit-scrollbar { display: none; } 5078`,xTe=p.button.withConfig({displayName:"TabsSelector__TabButton",componentId:"sc-ijao21-1"})` 5079 border: 0; 5080 background: transparent; 5081 padding: 0.35rem 0.15rem; 5082 font-size: 0.95rem; 5083 font-weight: ${e=>e.$active?950:850}; 5084 cursor: pointer; 5085 display: inline-flex; 5086 align-items: center; 5087 gap: 0.5rem; 5088 color: ${e=>e.$active?O:z}; 5089 border-bottom: 3px solid ${e=>e.$active?O:"transparent"}; 5090 transition: color 0.15s ease; 5091 user-select: none; 5092 white-space: nowrap; 5093 flex-shrink: 0; 5094 5095 &:hover { 5096 color: ${O}; 5097 } 5098 5099 &:focus-visible { 5100 outline: none; 5101 box-shadow: 5102 ${e=>e.$active?`inset 0 -2px 0 0 ${O}`:"none"}, 5103 0 0 0 3px ${En}; 5104 } 5105`;function RP({tabs:e,activeKey:n,onChange:i,ariaLabel:r,marginTop:o="0",showDivider:s=!0}
5105){return t.jsx(yTe,{role:"tablist","aria-label":r,$marginTop:o,$showDivider:s,children:e.map(a=>{const c=a.key===n;return t.jsxs(xTe,{type:"button",role:"tab","aria-selected":c,$active:c,onClick:()=>i(a.key),children:[a.icon,a.label]},a.key)})})}const bTe=p.div.withConfig({displayName:"InfoBox__Box",componentId:"sc-iz4uu2-0"})` 5106 width: 100%; 5107 border: 1px solid ${V}; 5108 border-radius: 0.875rem; 5109 background: ${At}; 5110 padding: 0.625rem 0.75rem 0.85rem; 5111 color: ${O}; 5112`,vTe=p.div.withConfig({displayName:"InfoBox__TitleRow",componentId:"sc-iz4uu2-1"})` 5113 display: flex; 5114 align-items: center; 5115 gap: 0.5rem; 5116 justify-content: space-between; 5117`,wTe=p.div.withConfig({displayName:"InfoBox__TitleLeft",componentId:"sc-iz4uu2-2"})` 5118 display: inline-flex; 5119 align-items: center; 5120 gap: 0.5rem; 5121 font-weight: 750; 5122 font-size: 0.8125rem; 5123 color: ${O}; 5124 min-width: 0; 5125`,jTe=p.button.withConfig({displayName:"InfoBox__Toggle",componentId:"sc-iz4uu2-3"})` 5126 border: 1px solid ${V}; 5127 background: ${Z}; 5128 color: ${z}; 5129 border-radius: 0.625rem; 5130 padding: 0.3rem 0.65rem; 5131 display: inline-flex; 5132 align-items: center; 5133 gap: 0.375rem; 5134 cursor: pointer; 5135 transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease; 5136 flex-shrink: 0; 5137 5138 &:hover { 5139 background: ${At}; 5140 border-color: ${Pe}; 5141 color: ${O}; 5142 } 5143 5144 &:focus-visible { 5145 outline: none; 5146 box-shadow: 0 0 0 3px ${En}; 5147 } 5148`,_Te=p.div.withConfig({displayName:"InfoBox__Collapse",componentId:"sc-iz4uu2-4"})` 5149 overflow: hidden; 5150 max-height: ${e=>e.$open?"520px":"0px"}; 5151 opacity: ${e=>e.$open?1:0}; 5152 transform: translateY(${e=>e.$open?"0px":"-4px"}); 5153 transition: max-height 220ms ease, opacity 160ms ease, transform 220ms ease; 5154 will-change: max-height, opacity, transform; 5155`,CTe=p.div.withConfig({displayName:"InfoBox__CollapseInner",componentId:"sc-iz4uu2-5"})` 5156 padding-top: 0.5rem; 5157`;function MM({title:e,icon:n,open:i,onToggle:r,children:o}){return t.jsxs(bTe,{children:[t.jsxs(vTe,{children:[t.jsxs(wTe,{children:[n,e]}),t.jsx(jTe,{type:"button",onClick:r,"aria-expanded":i,children:i?t.jsxs(t.Fragment,{children:[t.jsx(qn,{size:16}),"Hide"]}):t.jsxs(t.Fragment,{children:[t.jsx(Gi,{size:16}),"Read"]})})]}),t.jsx(_Te,{$open:i,"aria-hidden":!i,children:t.jsx(CTe,{children:o})})]})}const Ire=l.createContext(null),Q5={error:{bg:Z,border:"rgba(239,68,68,0.30)",accent:"#DC2626",iconBg:"rgba(239,68,68,0.08)"},success:{bg:Z,border:"rgba(22,163,74,0.30)",accent:"#16A34A",iconBg:"rgba(22,163,74,0.08)"},info:{bg:Z,border:"rgba(79,70,229,0.30)",accent:"#4F46E5",iconBg:"rgba(79,70,229,0.08)"}};function STe({tone:e,size:n=18}){const i=Q5[e].accent;return e==="error"?t.jsx(Sf,{size:n,color:i}):e==="success"?t.jsx(co,{size:n,color:i}):t.jsx(wn,{size:n,color:i})}const kTe=Tn` 5158 from { opacity: 0; transform: translateX(16px); } 5159 to { opacity: 1; transform: translateX(0); } 5160`,$Te=p.div.withConfig({displayName:"ToastProvider__Wrap",componentId:"sc-14i7ys9-0"})` 5161 position: fixed; 5162 right: 16px; 5163 top: 16px; 5164 z-index: 2147483000; 5165 display: flex; 5166 flex-direction: column; 5167 gap: 8px; 5168 width: min(400px, calc(100vw - 32px)); 5169`,ITe=p.div.withConfig({displayName:"ToastProvider__Card",componentId:"sc-14i7ys9-1"})` 5170 display: flex; 5171 align-items: flex-start; 5172 gap: 10px; 5173 border: 1px solid ${e=>Q5[e.$tone].border}; 5174 border-left: 3px solid ${e=>Q5[e.$tone].accent}; 5175 background: ${Z}; 5176 border-radius: 8px; 5177 padding: 12px 12px 12px 10px; 5178 box-shadow: 5179 0 4px 12px rgba(0, 0, 0, 0.08), 5180 0 1px 3px rgba(0, 0, 0, 0.06); 5181 animation: ${kTe} 0.2s ease-out; 5182`,PTe=p.span.withConfig({displayName:"ToastProvider__IconWrap",componentId:"sc-14i7ys9-2"})` 5183 flex-shrink: 0; 5184 width: 28px; height: 28px; 5185 border-radius: 6px; 5186 background: ${e=>Q5[e.$tone].iconBg}; 5187 display: flex; align-items: center; justify-content: center; 5188`,ATe=p.div.withConfig({displayName:"ToastProvider__Body",componentId:"sc-14i7ys9-3"})` 5189 flex: 1; min-width: 0; 5190`,NTe=p.div.withConfig({displayName:"ToastProvider__Msg",componentId:"sc-14i7ys9-4"})` 5191 color: ${O}; 5192 font-weight: 600; 5193 font-size: 0.825rem; 5194 line-height: 1.4;
5195 overflow-wrap: anywhere; 5196`,zTe=p.button.withConfig({displayName:"ToastProvider__Close",componentId:"sc-14i7ys9-5"})` 5197 border: 0; 5198 background: transparent; 5199 padding: 2px; 5200 margin: 0; 5201 cursor: pointer; 5202 color: ${z}; 5203 display: inline-flex; 5204 align-items: center; 5205 justify-content: center; 5206 border-radius: 4px; 5207 flex-shrink: 0; 5208 transition: background 0.15s, color 0.15s; 5209 5210 &:hover { 5211 color: ${O}; 5212 background: ${V}; 5213 } 5214`;function TTe(){return`${Date.now()}-${Math.random().toString(16).slice(2)}`}function ETe({children:e}){const[n,i]=l.useState([]),r=l.useRef({}),o=l.useCallback(u=>{i(h=>h.filter(g=>g.id!==u));const m=r.current[u];m&&window.clearTimeout(m),delete r.current[u]},[]),s=l.useCallback((u,m)=>{const h=String(u||"").trim();if(!h)return;const g=TTe(),x=m?.tone||"error",y=Math.max(1500,Number(m?.durationMs||4500));i(w=>[{id:g,message:h,tone:x},...w].slice(0,5)),r.current[g]=window.setTimeout(()=>o(g),y)},[o]),a=l.useMemo(()=>({showToast:s}),[s]),c=typeof document<"u"?jr.createPortal(t.jsx($Te,{"aria-live":"polite","aria-relevant":"additions removals",children:n.map(u=>t.jsxs(ITe,{$tone:u.tone,role:"status",children:[t.jsx(PTe,{$tone:u.tone,children:t.jsx(STe,{tone:u.tone,size:16})}),t.jsx(ATe,{children:t.jsx(NTe,{children:u.message})}),t.jsx(zTe,{type:"button","aria-label":"Close",onClick:()=>o(u.id),children:t.jsx(Ei,{size:16})})]},u.id))}),document.body):null;return t.jsxs(Ire.Provider,{value:a,children:[e,c]})}function Uo(){const e=l.useContext(Ire);if(!e)throw new Error("useToast must be used within a ToastProvider");return e}const MTe=p.div.withConfig({displayName:"Pagination__Bar",componentId:"sc-ed4nza-0"})` 5215 margin-top: ${e=>e.$compact?"0.35rem":"0.6rem"}; 5216 display: flex; 5217 align-items: center; 5218 justify-content: space-between; 5219 gap: 0.75rem; 5220 padding: ${e=>e.$compact?"0 0.9rem 0.35rem":"0 0.9rem 0.9rem"}; 5221 box-sizing: border-box; 5222`,RTe=p.div.withConfig({displayName:"Pagination__Meta",componentId:"sc-ed4nza-1"})` 5223 font-size: 0.75rem; 5224 font-weight: 800; 5225 color: ${z}; 5226 white-space: nowrap; 5227`,OTe=p.div.withConfig({displayName:"Pagination__Btns",componentId:"sc-ed4nza-2"})` 5228 display: inline-flex; 5229 align-items: center; 5230 gap: 0.5rem; 5231`,iW=p.button.withConfig({displayName:"Pagination__Btn",componentId:"sc-ed4nza-3"})` 5232 border: 1px solid ${V}; 5233 background: ${Z}; 5234 color: ${O}; 5235 font-weight: 850; 5236 font-size: 0.75rem; 5237 height: 2rem; 5238 line-height: 1; 5239 padding: 0 0.75rem; 5240 border-radius: 0.45rem; 5241 cursor: ${e=>e.$disabled?"not-allowed":"pointer"}; 5242 opacity: ${e=>e.$disabled?.5:1}; 5243 5244 &:hover { 5245 background: ${e=>e.$disabled?Z:$e}; 5246 } 5247`;function pi({page:e,totalPages:n,total:i,onPrev:r,onNext:o,compact:s=!1}){const a=Math.max(1,Number(n)||1),c=Math.min(Math.max(1,Number(e)||1),a),u=Number(i)||0,m=c<=1,h=c>=a;return t.jsxs(MTe,{$compact:s,children:[t.jsxs(RTe,{children:["Page ",c," of ",a," · ",u," result",u===1?"":"s"]}),t.jsxs(OTe,{children:[t.jsx(iW,{type:"button",$disabled:m,onClick:()=>m?null:r(),children:"Previous"}),t.jsx(iW,{type:"button",$disabled:h,onClick:()=>h?null:o(),children:"Next"})]})]})}const DTe=p.div.withConfig({displayName:"EmptyState__Wrap",componentId:"sc-dfftfe-0"})` 5248 width: 100%; 5249 height: ${e=>e.$embedded?"100%":"auto"}; 5250 min-height: ${e=>e.$embedded?"0":"220px"}; 5251 display: flex; 5252 align-items: center; 5253 justify-content: center; 5254 padding: 1rem; 5255 position: relative; 5256 overflow: hidden; 5257 border-radius: 14px; 5258 background: ${Z}; 5259`,LTe=p.div.withConfig({displayName:"EmptyState__Pattern",componentId:"sc-dfftfe-1"})` 5260 position: absolute; 5261 inset: 0; 5262 pointer-events: none; 5263 opacity: 0.22; 5264 background: 5265 radial-gradient(closest-side at 30% 35%, ${At}, transparent 72%), 5266 radial-gradient(closest-side at 70% 65%, ${At}, transparent 72%), 5267 repeating-linear-gradient(135deg, transparent 0 14px, ${$e} 14px 14.5px); 5268 mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.75), transparent 92%); 5269`,BTe=p.div.withConfig({displayName:"EmptyState__Content",componentId:"sc-dfftfe-2"})` 5270 position: relative; 5271 text-align: center; 5272 max-width: 34rem; 5273 padding: 0.5rem 0.75rem; 5274`,FTe=p.div.withConfig({displayName:"EmptyState__Title",componentId:"sc-dfftfe-3"})` 5275 font-size: 1rem; 5276 font-weight: 900; 5277 color: ${O}; 5278 line-height: 1.2; 5279`,WTe=p.div.withConfig({displayName:"EmptyState__Subtitle",componentId:"sc-dfftfe-4"})` 5280 margin-top: 6px; 5281 font-size: 0.875rem; 5282 font-weight: 750; 5283 color: ${z}; 5284 line-height: 1.35; 5285`;function Zg({subtitle:e,embedded:n=!1}
5285){return t.jsxs(DTe,{$embedded:n,role:"status","aria-live":"polite",children:[t.jsx(LTe,{}),t.jsxs(BTe,{children:[t.jsx(FTe,{children:"No data"}),t.jsx(WTe,{children:e||"Try adjusting your date range or filters."})]})]})}const rW=p.div.withConfig({displayName:"ProjectNoData__Wrap",componentId:"sc-1xo0ws0-0"})` 5286 width: 100%; 5287 height: ${e=>e.$embedded?"100%":"auto"}; 5288 min-height: ${e=>e.$embedded?"0":"220px"}; 5289 display: flex; 5290 align-items: center; 5291 justify-content: center; 5292 padding: 1rem; 5293 position: relative; 5294 overflow: hidden; 5295 border-radius: 14px; 5296 background: ${Z}; 5297`,oW=p.div.withConfig({displayName:"ProjectNoData__Pattern",componentId:"sc-1xo0ws0-1"})` 5298 position: absolute; 5299 inset: 0; 5300 pointer-events: none; 5301 opacity: 0.22; 5302 background: 5303 radial-gradient(closest-side at 30% 35%, ${At}, transparent 72%), 5304 radial-gradient(closest-side at 70% 65%, ${At}, transparent 72%), 5305 repeating-linear-gradient(135deg, transparent 0 14px, ${$e} 14px 14.5px); 5306 mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.75), transparent 92%); 5307`,sW=p.div.withConfig({displayName:"ProjectNoData__Content",componentId:"sc-1xo0ws0-2"})` 5308 position: relative; 5309 text-align: center; 5310 max-width: 34rem; 5311 padding: 0.5rem 0.75rem; 5312 display: flex; 5313 flex-direction: column; 5314 align-items: center; 5315 gap: 0.75rem; 5316`,aW=p.div.withConfig({displayName:"ProjectNoData__TitleRow",componentId:"sc-1xo0ws0-3"})` 5317 display: inline-flex; 5318 align-items: center; 5319 gap: 0.5rem; 5320 color: ${O}; 5321`,lW=p.div.withConfig({displayName:"ProjectNoData__Title",componentId:"sc-1xo0ws0-4"})` 5322 font-size: 1rem; 5323 font-weight: 900; 5324 color: ${O}; 5325 line-height: 1.2; 5326`,cW=p.div.withConfig({displayName:"ProjectNoData__Subtitle",componentId:"sc-1xo0ws0-5"})` 5327 margin-top: 6px; 5328 font-size: 0.875rem; 5329 font-weight: 750; 5330 color: ${z}; 5331 line-height: 1.35; 5332`,UTe=p.div.withConfig({displayName:"ProjectNoData__Divider",componentId:"sc-1xo0ws0-6"})` 5333 width: 100%; 5334 height: 1px; 5335 background: ${V}; 5336 opacity: 0.8; 5337 margin: 0.25rem 0; 5338`,HTe=p.div.withConfig({displayName:"ProjectNoData__SkeletonStack",componentId:"sc-1xo0ws0-7"})` 5339 width: min(520px, 100%); 5340 display: flex; 5341 flex-direction: column; 5342 gap: 0.55rem; 5343`;function Sp({initialCrunching:e=!1,failed:n=!1,subtitle:i,crunchingTitle:r,crunchingSubtitle:o,failedTitle:s,failedSubtitle:a,embedded:c=!1}){return!e&&!n?t.jsx(Zg,{subtitle:i,embedded:c}):n?t.jsxs(rW,{$embedded:c,role:"status","aria-live":"polite",children:[t.jsx(oW,{}),t.jsx(sW,{children:t.jsxs("div",{children:[t.jsxs(aW,{children:[t.jsx(Sn,{size:18,color:z}),t.jsx(lW,{children:s||"Something went wrong"})]}),t.jsx(cW,{children:a||"We couldnât process this yet. Please try again later."})]})})]}):t.jsxs(rW,{$embedded:c,role:"status","aria-live":"polite",children:[t.jsx(oW,{}),t.jsxs(sW,{children:[t.jsxs("div",{children:[t.jsxs(aW,{children:[t.jsx(Sn,{size:18,color:z}),t.jsx(lW,{children:r||"Crunching your numbers"})]}),t.jsx(cW,{children:o||"This is your first run. Data will appear here as soon as processing finishes."})]}),t.jsx(UTe,{}),t.jsxs(HTe,{"aria-hidden":"true",children:[t.jsx(nt,{height:12,width:"78%",radius:10}),t.jsx(nt,{height:12,width:"64%",radius:10}),t.jsx(nt,{height:12,width:"72%",radius:10})]})]})]})}const qTe=p.div.withConfig({displayName:"SeriesChipsRow__Row",componentId:"sc-1si7air-0"})` 5344 display: flex; 5345 align-items: center; 5346 gap: 0.45rem; 5347 flex-wrap: nowrap; 5348 overflow-x: auto; 5349 overflow-y: hidden; 5350 -webkit-overflow-scrolling: touch; 5351 max-width: 100%; 5352 min-width: 0; 5353 padding: 0.1rem 0.1rem 0.55rem; 5354`,GTe=p.button.withConfig({displayName:"SeriesChipsRow__Chip",componentId:"sc-1si7air-1"})` 5355 border: 1px solid ${V}; 5356 background: ${e=>e.$active?$e:Z}; 5357 color: ${O}; 5358 border-radius: 999px; 5359 padding: 0.18rem 0.45rem; 5360 display: inline-flex; 5361 align-items: center; 5362 gap: 0.35rem; 5363 cursor: pointer; 5364 user-select: none; 5365 max-width: 13rem; 5366 5367 &:hover { 5368 background: ${$e}; 5369 } 5370 5371 &:focus-visible { 5372 outline: none; 5373 box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2); 5374 } 5375`,VTe=p.span.withConfig({displayName:"SeriesChipsRow__Label",componentId:"sc-1si7air-2"})` 5376 font-size: 0.75rem; 5377 font-weight: 850; 5378 overflow: hidden; 5379 text-overflow: ellipsis; 5380 white-space: nowrap; 5381 max-width: 10rem; 5382`;function Pre({items:e,selectedKey:n,hoverKey:i,onSelectedKeyChange:r,onHoverKeyChange:o,inactiveOpacity:s=.35}){const a=n||i;return!e||e.length===0?null:t.jsx(qTe,{children:e.map(c=>{const u=!a||a===c.key,m=n===c.key,h=c.label;return t.jsxs(GTe,{type:"button",$active:m,title:h,"aria-label":m?"Show all":`Isolate ${h}`,onClick:()=>{r(n===c.key?null:c.key),o(null)},onMouseEnter:()=>{n||o(c.key)},onMouseLeave:()=>{n||o(null)},onFocus:()=>{n||o(c.key)},onBlur:()=>{n||o(null)},style:{opacity:u?1:s},children:[c.color?t.jsx("span",{style:{width:10,height:10,borderRadius:999,background:c.color,flex:"0 0 auto"}}):null,t.jsx(xo,{record:c.logoRecord,size:18}),t.jsx(VTe,{children:h})]},c.key)})})}const gw="#6366F1",KTe=p.div.withConfig({displayName:"SitePostureCard__Card",componentId:"sc-ekewyr-0"})` 5383 border: 1px solid ${V}; 5384 background: ${Z}; 5385 border-radius: 0.875rem; 5386 padding: 1rem; 5387 min-width: 0; 5388 display: flex; 5389 flex-direction: column; 5390`,YTe=p.div.withConfig({displayName:"SitePostureCard__CardHeader",componentId:"sc-ekewyr-1"})` 5391 display: flex; 5392 align-items: flex-start; 5393 justify-content: space-between; 5394 gap: 0.75rem; 5395`,XTe=p.div.withConfig({displayName:"SitePostureCard__CardTitle",componentId:"sc-ekewyr-2"})` 5396 font-size: 1.2rem; 5397 font-weight: 950; 5398 color: ${O}; 5399 line-height: 1.15; 5400`,QTe=p.div.withConfig({displayName:"SitePostureCard__ScoresArea",componentId:"sc-ekewyr-3"})` 5401 margin-top: 0.75rem; 5402 flex: 1 1 0; 5403 display: flex; 5404 align-items: center; 5405 justify-content: center; 5406 gap: 1.5rem; 5407 padding: 0.5rem 0; 5408`,ZTe=p.div.withConfig({displayName:"SitePostureCard__ScoreBlock",componentId:"sc-ekewyr-4"})` 5409 display: flex; 5410 flex-direction: column; 5411 align-items: center; 5412 gap: 6px; 5413`,$z=p.span.withConfig({displayName:"SitePostureCard__Pill",componentId:"sc-ekewyr-5"})` 5414 display: inline-flex; 5415 align-items: center; 5416 gap: 0.35rem; 5417 border-radius: 9999px; 5418 padding: 0.15rem 0.5rem; 5419 font-size: 0.7rem; 5420 font-weight: 900; 5421 border: 1px solid 5422 ${e=>e.$tone==="danger"?"rgba(239,68,68,0.35)":e.$tone==="warn"?"rgba(245,158,11,0.35)":"rgba(229,231,235,1)"}; 5423 background: ${e=>e.$tone==="danger"?"rgba(239,68,68,0.06)":e.$tone==="warn"?"rgba(245,158,11,0.06)":$e}; 5424 color: ${O}; 5425`,JTe=p.div.withConfig({displayName:"SitePostureCard__PillsRow",componentId:"sc-ekewyr-6"})` 5426 margin-top: auto; 5427 padding-top: 0.75rem; 5428 display: flex; 5429 align-items: center; 5430 gap: 0.5rem; 5431 flex-wrap: nowrap; 5432 min-height: 28px; 5433 overflow-x: auto; 5434 overflow-y: hidden; 5435 -webkit-overflow-scrolling: touch; 5436 scrollbar-width: thin; 5437`;function ax({value:e,size:n,strokeWidth:i,labelColor:r,label:o}){const s=(n-i)/2,a=2*Math.PI*s,c=e!=null?Math.max(0,Math.min(100,e))/100:0,u=a-a*c,m=e==null?z:e>=75?Vt:e>=50?"rgba(245,158,11,0.95)":Ut;return t.jsxs(ZTe,{children:[t.jsxs("div",{style:{position:"relative",width:n,height:n},children:[t.jsxs("svg",{viewBox:`0 0 ${n} ${n}`,style:{width:"100%",height:"100%"},children:[t.jsx("circle",{cx:n/2,cy:n/2,r:s,fill:"none",stroke:V,strokeWidth:i}),e!=null&&t.jsx("circle",{cx:n/2,cy:n/2,r:s,fill:"none",stroke:m,strokeWidth:i,strokeLinecap:"round",strokeDasharray:a,strokeDashoffset:u,transform:`rotate(-90 ${n/2} ${n/2})`,style:{transition:"stroke-dashoffset 0.5s ease"}})]}),t.jsx("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",fontWeight:950,fontSize:n>80?"1.6rem":"0.9rem",color:m},children:e!=null?Math.round(e):"â"})]}),t.jsx("div",{style:{fontSize:"0.68rem",fontWeight:800,color:r,textTransform:"uppercase",letterSpacing:"0.04em",textAlign:"center"},children:o})]})}function e6e({orgId:e,projectId:n,title:i="AI Readiness",refreshKey:r=0,overallScoreOverride:o,headerRight:s}){const[a,c]=l.useState(!1),[u,m]=l.useState(null),[h,g]=l.useState({high:0,medium:0,low:0}),[x,y]=l.useState(!1),[w,j]=l.useState(null),[v,_]=l.useState(null),[$,k]=l.useState(null),[P,S]=l.useState(null),[I,A]=l.useState(0),[E,B]=l.useState(!1),[T,M]=l.useState(!1);l.useEffect(()=>{if(!e||!n)return;let X=!1;return c(!0),m(null),ue(`/api/v1/organizations/${e}/projects/${n}/site_audit_actions/summary`).then(async Q=>{if(!Q.ok){const K=await Q.json().catch(()=>null);throw new Error(K?.error||K?.message||`Failed to load summary (HTTP ${Q.status})`)}return Q.json()}).then(Q=>{if(X)return;const K=Q?.counts||{};g({high:typeof K?.high=="number"?K.high:0,medium:typeof K?.medium=="number"?K.medium:0,low:typeof K?.low=="number"?K.low:0})}).catch(Q=>{X||(g({high:0,medium:0,low:0}),m(Q?.message||"Failed to load posture"))}).finally(()=>{X||c(!1)}),()=>{X=!0}},[e,n,r]),l.useEffect(()=>{if(typeof o=="number"||o===null){_(o);return}if(!e||!n)return;let X=!1;return y(!0),j(null),ue(`/api/v1/organizations/${e}/projects/${n}/site_audit_pages?page=1&per_page=1`).then(async Q=>{if(!Q.ok){const K=await Q.json().catch(()=>null);throw new Error(K?.error||K?.message||`Failed to load score (HTTP ${Q.status})`)}return Q.json()}).then(Q=>{if(X)return;const K=typeof Q?.site_score=="number"&&Number.isFinite(Q.site_score)?Q.site_score:typeof Q?.overall_score=="number"&&Number.isFinite(Q.overall_score)?Q.overall_score:null;_(K),k(typeof Q?.site_technical_score=="number"?Q.site_technical_score:null),S(typeof Q?.site_content_score=="number"?Q.site_content_score:null);const G=Q?.unfiltered_summary?.total??Q?.total??0;A(typeof G=="number"?G:0);const L=Q?.unfiltered_summary?.running??0;B(L>0),M(Q?.enumeration_status==="running")}).catch(Q=>{X||(_(null),k(null),S(null),A(0),B(!1),M(!1),j(Q?.message||"Failed to load score"))}).finally(()=>{X||y(!1)}),()=>{X=!0}},[e,n,r,o]),l.useMemo(()=>typeof v!="number"||!Number.isFinite(v)?"neutral":v>=75?"ok":v>=55?"warn":"danger",[v]);
5437const R=a||x,F=u||w,Y=!R&&!F&&I===0&&v==null&&!T,H=!R&&!F&&!Y&&(T||E||I>0&&v==null),U=!R&&!F&&v!=null;return t.jsxs(KTe,{children:[t.jsxs(YTe,{children:[t.jsx("div",{style:{minWidth:0},children:t.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[t.jsx(XTe,{children:i}),t.jsx(at,{content:"AI Readiness Score (0\\u2013100): Technical \\u00D7 0.45 + Content \\u00D7 0.55, measured across 8 sub-categories of audited pages.",placement:"top",onlyIfTruncated:!1,children:t.jsx("span",{style:{display:"inline-flex",alignItems:"center",color:"rgba(107,114,128,0.9)"},"aria-label":"Site posture info",children:t.jsx(wn,{size:16})})})]})}),s?t.jsx("div",{style:{display:"inline-flex",alignItems:"center",gap:8,flex:"0 0 auto"},children:s}):null]}),t.jsx(QTe,{children:R?t.jsxs("div",{style:{display:"flex",gap:24,alignItems:"center"},children:[t.jsx(nt,{height:56,width:56,radius:999}),t.jsx(nt,{height:96,width:96,radius:999}),t.jsx(nt,{height:56,width:56,radius:999})]}):F?t.jsx("div",{style:{color:Ut,fontWeight:800,fontSize:"0.85rem",textAlign:"center"},children:F}):Y?t.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:6,padding:"0.5rem 0"},children:[t.jsx("div",{style:{fontSize:"0.88rem",fontWeight:800,color:O},children:"No audit yet"}),t.jsx("div",{style:{fontSize:"0.78rem",color:z,textAlign:"center",lineHeight:1.5},children:"Run a site audit to get your AI Readiness Score."})]}):H?t.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:8,padding:"0.5rem 0"},children:[t.jsx(Tr,{size:28,style:{color:"#6366F1",animation:"spin 1s linear infinite"}}),t.jsx("div",{style:{fontSize:"0.88rem",fontWeight:800,color:O},children:"Audit in progress"}),t.jsx("div",{style:{fontSize:"0.75rem",color:z,textAlign:"center",lineHeight:1.5},children:T&&I===0?"Discovering pagesâ¦":T?`Found ${I} page${I!==1?"s":""}, still discoveringâ¦`:E?`Auditing ${I} page${I!==1?"s":""}â¦`:"Processing resultsâ¦"}),t.jsx("style",{children:"@keyframes spin { to { transform: rotate(360deg) } }"})]}):U?t.jsxs(t.Fragment,{children:[t.jsx(ax,{value:$,size:64,strokeWidth:5,labelColor:gw,label:"Technical"}),t.jsx(ax,{value:v,size:100,strokeWidth:7,labelColor:gw,label:"AI Score"}),t.jsx(ax,{value:P,size:64,strokeWidth:5,labelColor:gw,label:"Content"})]}):t.jsxs(t.Fragment,{children:[t.jsx(ax,{value:$,size:64,strokeWidth:5,labelColor:gw,label:"Technical"}),t.jsx(ax,{value:v,size:100,strokeWidth:7,labelColor:z,label:"AI Score"}),t.jsx(ax,{value:P,size:64,strokeWidth:5,labelColor:gw,label:"Content"})]})}),t.jsx(JTe,{children:R?t.jsxs(t.Fragment,{children:[t.jsx(nt,{height:28,width:96,radius:999}),t.jsx(nt,{height:28,width:110,radius:999}),t.jsx(nt,{height:28,width:84,radius:999})]}):Y||H?null:t.jsxs(t.Fragment,{children:[t.jsxs($z,{$tone:"danger",children:[t.jsx(ei,{size:14,color:Ut}),"High: ",h.high]}),t.jsxs($z,{$tone:"warn",children:[t.jsx(ei,{size:14,color:"rgba(245,158,11,0.85)"}),"Medium: ",h.medium]}),t.jsxs($z,{$tone:"neutral",children:["Low: ",h.low]})]})})]})}const ma=p.div.withConfig({displayName:"SettingsLayout__SettingsPage",componentId:"sc-19xtsi1-0"})` 5438 padding: 1.5rem; 5439 5440 @media (min-width: 768px) { 5441 padding: 2rem; 5442 } 5443`,Kc=p.div.withConfig({displayName:"SettingsLayout__SettingsMax",componentId:"sc-19xtsi1-1"})` 5444 max-width: 40rem; 5445 margin: 0 auto; 5446`,Ys=p.div.withConfig({displayName:"SettingsLayout__SettingsHeader",componentId:"sc-19xtsi1-2"})` 5447 display: flex; 5448 flex-direction: column; 5449 gap: 0.35rem; 5450 margin-bottom: 1.25rem; 5451`,ha=p.div.withConfig({displayName:"SettingsLayout__SettingsHeaderTop",componentId:"sc-19xtsi1-3"})` 5452 display: flex; 5453 align-items: center; 5454 justify-content: space-between; 5455 gap: 1rem; 5456 flex-wrap: wrap; 5457 min-width: 0; 5458 5459 & > h1 { 5460 flex: 1; 5461 min-width: 12rem; 5462 } 5463`;p.div.withConfig({displayName:"SettingsLayout__SettingsTitleBlock",componentId:"sc-19xtsi1-4"})` 5464 min-width: 0; 5465`;const fa=p.h1.withConfig({displayName:"SettingsLayout__SettingsTitle",componentId:"sc-19xtsi1-5"})` 5466 margin: 0; 5467 font-size: 1.375rem; 5468 font-weight: 750; 5469 color: ${O}; 5470 letter-spacing: -0.02em; 5471`,ga=p.p.withConfig({displayName:"SettingsLayout__SettingsSubtitle",componentId:"sc-19xtsi1-6"})` 5472 margin: 0; 5473 font-size: 0.875rem; 5474 color: ${z}; 5475 line-height: 1.5; 5476`,Ar=p.section.withConfig({displayName:"SettingsLayout__SettingsSection",componentId:"sc-19xtsi1-7"})` 5477 background: ${Z}; 5478 border: 1px solid ${V}; 5479 border-radius: 1rem; 5480 padding: 1.25rem; 5481 box-shadow: 0 1px 0 rgba(17, 24, 39, 0.02); 5482 5483 & + & { 5484 margin-top: 1rem; 5485 } 5486`,Zr=p.div.withConfig({displayName:"SettingsLayout__SettingsSectionHeader",componentId:"sc-19xtsi1-8"})` 5487 display: flex; 5488 align-items: flex-start; 5489 justify-content: space-between; 5490 gap: 1rem; 5491 margin-bottom: 1rem; 5492`,Wr=p.div.withConfig({displayName:"SettingsLayout__SettingsSectionTitleRow",componentId:"sc-19xtsi1-9"})` 5493 display: flex; 5494 align-items: center; 5495 gap: 0.5rem; 5496 min-width: 0; 5497 color: ${O}; 5498`,Ur=p.h2.withConfig({displayName:"SettingsLayout__SettingsSectionTitle",componentId:"sc-19xtsi1-10"})` 5499 margin: 0; 5500 font-size: 1rem; 5501 font-weight: 750; 5502 color: ${O}; 5503`,Hr=p.p.withConfig({displayName:"SettingsLayout__SettingsSectionDescription",componentId:"sc-19xtsi1-11"})` 5504 margin: 0.35rem 0 0 0; 5505 font-size: 0.8125rem; 5506 color: ${z}; 5507 line-height: 1.4; 5508`,Bl=p.div.withConfig({displayName:"SettingsLayout__SettingsFormGrid2",componentId:"sc-19xtsi1-12"})` 5509 display: grid; 5510 grid-template-columns: 1fr; 5511 gap: 0.875rem; 5512 5513 @media (min-width: 640px) { 5514 grid-template-columns: 1fr 1fr; 5515 } 5516`,Bn=p.div.withConfig({displayName:"SettingsLayout__SettingsFormGroup",componentId:"sc-19xtsi1-13"})` 5517 display: flex; 5518 flex-direction: column; 5519 gap: 0.5rem; 5520 min-width: 0; 5521 margin: 15px 0px; 5522`,ii=p.label.withConfig({displayName:"SettingsLayout__SettingsLabel",componentId:"sc-19xtsi1-14"})` 5523 font-size: 0.8125rem; 5524 font-weight: 600; 5525 color: ${O}; 5526`,Gs=p.div.withConfig({displayName:"SettingsLayout__SettingsHelper",componentId:"sc-19xtsi1-15"})` 5527 font-size: 0.75rem; 5528 color: ${z}; 5529 line-height: 1.4; 5530`,ey=p.div.withConfig({displayName:"SettingsLayout__SettingsActionsRow",componentId:"sc-19xtsi1-16"})` 5531 display: flex; 5532 align-items: center; 5533 justify-content: flex-end; 5534 gap: 0.75rem; 5535 margin-top: 1rem; 5536 flex-wrap: wrap; 5537`,hr=p.div.withConfig({displayName:"SettingsLayout__SettingsBanner",componentId:"sc-19xtsi1-17"})` 5538 font-size: 0.8125rem; 5539 padding: 0.75rem; 5540 border-radius: 0.75rem; 5541 border: 1px solid ${e=>e.$variant==="success"?Mo:Er}; 5542 background: ${e=>e.$variant==="success"?si:kn}; 5543 color: ${e=>e.$variant==="success"?Vt:Ut}; 5544 margin-bottom: 0.75rem; 5545`,Z5=p.div.withConfig({displayName:"SettingsLayout__SettingsDivider",componentId:"sc-19xtsi1-18"})` 5546 height: 1px; 5547 background: ${V}; 5548 margin: 1rem 0; 5549`,RM=p.div.withConfig({displayName:"SettingsLayout__SettingsReadOnly",componentId:"sc-19xtsi1-19"})` 5550 border: 1px solid ${Rt}; 5551 border-radius: 0.375rem; 5552 background: ${$e}; 5553 padding: 0.75rem; 5554 color: ${z}; 5555 font-size: 0.875rem; 5556`,t6e=10,n6e=p.div.withConfig({displayName:"AliasesModal__AliasRow",componentId:"sc-160hr9l-0"})` 5557 display: flex; 5558 gap: 0.5rem; 5559 flex-wrap: wrap; 5560 align-items: center; 5561`,i6e=p.span.withConfig({displayName:"AliasesModal__AliasChip",componentId:"sc-160hr9l-1"})` 5562 display: inline-flex; 5563 align-items: center; 5564 gap: 0.35rem; 5565 padding: 0.2rem 0.5rem; 5566 border-radius: 999px; 5567 border: 1px solid ${V}; 5568 background: ${$e}; 5569 color: ${O}; 5570 font-size: 0.75rem; 5571 font-weight: 850; 5572`,r6e=p.button.withConfig({displayName:"AliasesModal__AliasRemove",componentId:"sc-160hr9l-2"})` 5573 border: 0; 5574 background: transparent; 5575 padding: 0; 5576 margin: 0; 5577 display: inline-flex; 5578 align-items: center; 5579 justify-content: center; 5580 color: ${z}; 5581 cursor: pointer; 5582 5583 &:hover { 5584 color: ${O}; 5585 } 5586 5587 &:focus-visible { 5588 outline: none; 5589 box-shadow: 0 0 0 3px ${En}; 5590 border-radius: 0.5rem; 5591 } 5592`;function yw(e,n){return Array.from(new Set((e||[]).map(i=>
5592String(i||"").trim()).filter(Boolean))).slice(0,n)}function Are({isOpen:e,onClose:n,title:i,description:r,initialAliases:o,maxAliases:s=t6e,onSave:a,helperText:c}){const[u,m]=l.useState([]),[h,g]=l.useState(""),[x,y]=l.useState(!1),[w,j]=l.useState(null),v=l.useMemo(()=>yw(o||[],s).join("|"),[o,s]);l.useEffect(()=>{e&&(m(yw(o||[],s)),g(""),y(!1),j(null))},[v,e,s]);const _=u.length<s,$=()=>{if(!_){j(`You can add a maximum of ${s} aliases.`);return}const S=String(h||"").trim();S&&(m(I=>yw([...I,S],s)),g(""),j(null))},k=async()=>{if(!x){y(!0),j(null);try{await a(yw(u,s)),n()}catch(S){j(S?.message||"Failed to save")}finally{y(!1)}}},P=()=>{m(yw(o||[],s)),g(""),j(null),y(!1),n()};return t.jsx(Hn,{isOpen:e,onClose:P,title:i,description:r,size:"sm",footer:t.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:10},children:[t.jsx(he,{type:"button",size:"sm",variant:"outline",onClick:P,disabled:x,children:"Cancel"}),t.jsx(he,{type:"button",size:"sm",variant:"primary",onClick:()=>void k(),disabled:x,children:x?"Savingâ¦":"Save"})]}),children:t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[w?t.jsx(hr,{$variant:"error",children:w}):null,t.jsxs("div",{children:[t.jsxs("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:10},children:[t.jsx(ii,{children:"Current aliases"}),t.jsxs("span",{style:{fontSize:12,fontWeight:900,color:z},children:[u.length,"/",s]})]}),t.jsx("div",{style:{height:8}}),t.jsx(n6e,{children:u.length===0?t.jsx("span",{style:{color:z,fontWeight:800,fontSize:"0.875rem"},children:"No aliases."}):u.map(S=>t.jsxs(i6e,{children:[S,t.jsx(r6e,{type:"button","aria-label":`Remove alias ${S}`,title:"Remove",onClick:()=>m(I=>I.filter(A=>A!==S)),disabled:x,children:t.jsx(Ei,{size:14})})]},S))})]}),t.jsxs("div",{children:[t.jsx(ii,{children:"Add alias"}),t.jsx("div",{style:{height:8}}),t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,flexWrap:"wrap"},children:[t.jsx(Xt,{value:h,onChange:S=>g(S.target.value),placeholder:"Add an aliasâ¦",disabled:x||!_,onKeyDown:S=>{S.key==="Enter"&&(S.preventDefault(),$())}}),t.jsxs(he,{type:"button",size:"sm",variant:"outline",disabled:x||!_||!h.trim(),onClick:$,children:[t.jsx(gr,{size:16}),"Add"]})]}),t.jsxs(Gs,{children:[c||"Aliases are used only for mention detection and highlighting."," ",u.length>=s?`Maximum ${s} aliases.`:null]})]})]})})}const o6e=10;function s6e({isOpen:e,onClose:n,workspaceId:i,projectId:r,initialAliases:o,onSaved:s}){const[a,c]=l.useState(!1),u=l.useMemo(()=>Array.isArray(o)?o.map(h=>String(h||"").trim()).filter(Boolean).join("|"):"",[o]),m=async h=>{const g=Number(i),x=Number(r);if(!(!Number.isFinite(g)||g<=0)&&!(!Number.isFinite(x)||x<=0)&&!a){c(!0);try{const y=Array.isArray(h)?h:[],w=await ue(`/api/v1/organizations/${g}/projects/${x}`,{method:"PATCH",body:JSON.stringify({brand_aliases:y})}),j=await w.json().catch(()=>({}));if(!w.ok)throw new Error(j?.error||j?.errors?.[0]||"Failed to update brand aliases");s({aliases:y,project:j?.project})}catch(y){throw y}finally{c(!1)}}};return t.jsx(Are,{isOpen:e,onClose:n,title:"Brand aliases",description:"Aliases are used only for mention detection and highlighting; we wonât show them instead of your project name.",initialAliases:o,maxAliases:o6e,helperText:"Examples: âAcme Incâ, âAcmeâ, âAcme AIâ.",onSave:m},u)}function Nre({organizationId:e,projectId:n,enabled:i=!0}){const{subscribe:r}=wo(),[o,s]=l.useState(null),[a,c]=l.useState(!1),[u,m]=l.useState(null),[h,g]=l.useState(!1),[x,y]=l.useState(null),[w,j]=l.useState(null),v=l.useMemo(()=>{if(e==null)return null;const B=Number(e);return Number.isFinite(B)&&B>0?B:null},[e]),_=l.useMemo(()=>{if(n==null)return null;const B=Number(n);return Number.isFinite(B)&&B>0?B:null},[n]),$=l.useMemo(()=>!v||!_?null:`/api/v1/organizations/${v}/projects/${_}/wordpress_connection`,[v,_]),k=l.useCallback(async()=>{if(!(!$||!i)){c(!0),m(null);try{const B=await ue($),T=await B.json().catch(()=>({}));if(!B.ok){m(T?.error||T?.errors?.[0]||"Failed to load WordPress connection."),c(!1);return}s(T?.connection??null)}catch(B){m(B?.message||"Failed to load WordPress connection.")}finally{c(!1)}}},[$,i]);l.useEffect(()=>{i&&k()},[k,i]);const P=l.useRef(0);l.useEffect(()=>{if(!_||!i)return;const B=r({channel:"AgentsChannel",project_id:_},{received:T=>{if(!T)return;const M=String(T?.type||"");if(M==="connection_status_changed"||M==="snapshot_updated"){const R=Date.now();if(R-P.current<100)return;P.current=R;const F=T?.connection??null;s(F),j(null);return}if(M==="connector_throttled"){const R=T?.connection??null;R&&s(R);const F=String(T?.reason||""),Y=typeof T?.server_time=="string"?T.server_time:new Date().toISOString();(F==="circuit_open"||F==="rate_limited"||F==="no_connection")&&j({reason:F,since:Y});return}M==="operation_dispatched"&&j(R=>R&&null)}});return()=>{try{B?.unsubscribe?.()}catch{}}},[_,r,i]),l.useEffect(()=>{if(!w)return;const B=window.setTimeout(()=>j(null),300*1e3);return()=>window.clearTimeout(B)},[w]);const S=l.useCallback(async()=>
5592{if(!$)return{ok:!1,message:"Project not loaded yet."};g(!0),m(null);try{const B=await ue($,{method:"POST"}),T=await B.json().catch(()=>({}));if(B.status===409)return await k(),{ok:!1,alreadyConnected:!0,message:T?.error||"WordPress is already connected for this project."};if(!B.ok){const R=T?.error||T?.errors?.[0]||"Failed to generate plugin token.";return m(R),{ok:!1,message:R}}const M=T;return s(M.connection),y(M.plugin_token),{ok:!0}}catch(B){const T=B?.message||"Failed to generate plugin token.";return m(T),{ok:!1,message:T}}finally{g(!1)}},[$,k]),I=l.useCallback(async()=>{if(!$)return{ok:!1,message:"Project not loaded yet."};m(null);try{const B=await ue($,{method:"DELETE"});if(!B.ok&&B.status!==204){const M=(await B.json().catch(()=>({})))?.error||"Failed to disconnect WordPress.";return m(M),{ok:!1,message:M}}return s(null),y(null),{ok:!0}}catch(B){const T=B?.message||"Failed to disconnect WordPress.";return m(T),{ok:!1,message:T}}},[$]),A=l.useCallback(()=>y(null),[]),E=l.useCallback(async B=>{if(!$)return{ok:!1,message:"Project not loaded yet."};m(null);try{const T=await ue($,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({kill_switch:B})}),M=await T.json().catch(()=>({}));if(!T.ok){const F=M?.error||"Failed to update kill switch.";return m(F),{ok:!1,message:F}}const R=M?.connection??null;return R&&s(R),{ok:!0}}catch(T){const M=T?.message||"Failed to update kill switch.";return m(M),{ok:!1,message:M}}},[$]);return{connection:o,loading:a,error:u,generating:h,pluginToken:x,throttle:w,refetch:k,generateToken:S,disconnect:I,clearPluginToken:A,setKillSwitch:E}}const a6e={manifest:null,loading:!0,error:null};let Iz=null,Ik=null;async function l6e(){const n=`${Td().replace(/\/+$/,"")}/api/connectors/v1/wordpress/plugin/manifest`;try{const i=await fetch(n,{method:"GET"});if(!i.ok){const o=await i.json().catch(()=>({}));return{manifest:null,loading:!1,error:o&&(o.error||o.message)||`Failed to load plugin manifest (HTTP ${i.status})`}}return{manifest:await i.json(),loading:!1,error:null}}catch(i){return{manifest:null,loading:!1,error:i instanceof Error?i.message:"Network error"}}}function zre(){const[e,n]=l.useState(Iz??a6e);return l.useEffect(()=>{if(Iz)return;Ik||(Ik=l6e());let i=!0;return Ik.then(r=>{Iz=r,Ik=null,i&&n(r)}),()=>{i=!1}},[]),e}const dW=p.div.withConfig({displayName:"WordpressConnectionModal__Body",componentId:"sc-a8xkzk-0"})` 5593 display: flex; 5594 flex-direction: column; 5595 gap: 18px; 5596 padding: 4px 0; 5597`,Pz=p.div.withConfig({displayName:"WordpressConnectionModal__StepCard",componentId:"sc-a8xkzk-1"})` 5598 display: grid; 5599 gap: 10px; 5600 padding: 14px 16px; 5601 border: 1px solid ${V}; 5602 border-radius: 12px; 5603 background: ${Z}; 5604`,Az=p.div.withConfig({displayName:"WordpressConnectionModal__StepHeader",componentId:"sc-a8xkzk-2"})` 5605 display: flex; 5606 align-items: center; 5607 gap: 10px; 5608`,Nz=p.div.withConfig({displayName:"WordpressConnectionModal__StepIndex",componentId:"sc-a8xkzk-3"})` 5609 display: inline-flex; 5610 align-items: center; 5611 justify-content: center; 5612 width: 22px; 5613 height: 22px; 5614 border-radius: 999px; 5615 font-size: 0.75rem; 5616 font-weight: 800; 5617 border: 1px solid ${e=>e.$done?Vt:e.$active?O:V}; 5618 color: ${e=>e.$done?Z:e.$active?O:z}; 5619 background: ${e=>e.$done?Vt:Z}; 5620 flex-shrink: 0; 5621`,zz=p.div.withConfig({displayName:"WordpressConnectionModal__StepTitle",componentId:"sc-a8xkzk-4"})` 5622 font-size: 0.875rem; 5623 font-weight: 750; 5624 color: ${O}; 5625`,Pk=p.div.withConfig({displayName:"WordpressConnectionModal__HelpText",componentId:"sc-a8xkzk-5"})` 5626 color: ${z}; 5627 font-size: 0.8125rem; 5628 line-height: 1.55; 5629`,c6e=p.div.withConfig({displayName:"WordpressConnectionModal__TokenRow",componentId:"sc-a8xkzk-6"})` 5630 display: flex; 5631 align-items: center; 5632 gap: 8px; 5633 border: 1px solid ${V}; 5634 background: ${At}; 5635 padding: 8px 10px; 5636 border-radius: 8px; 5637 min-width: 0; 5638`,d6e=p.code.withConfig({displayName:"WordpressConnectionModal__TokenText",componentId:"sc-a8xkzk-7"})` 5639 flex: 1; 5640 font-size: 0.8125rem; 5641 font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, "Liberation Mono", monospace; 5642 color: ${O}; 5643 overflow: hidden; 5644 text-overflow: ellipsis; 5645 white-space: nowrap; 5646 min-width: 0; 5647`,u6e=p.button.withConfig({displayName:"WordpressConnectionModal__CopyButton",componentId:"sc-a8xkzk-8"})` 5648 display: inline-flex; 5649 align-items: center; 5650 gap: 6px; 5651 padding: 6px 10px; 5652 border-radius: 6px; 5653 border: 1px solid ${e=>e.$copied?Vt:V}; 5654 background: ${Z}; 5655 color: ${e=>e.$copied?Vt:O}; 5656 font-size: 0.75rem; 5657 font-weight: 700; 5658 cursor: pointer; 5659 flex-shrink: 0; 5660 5661 &:hover { background: ${At}; } 5662`,p6e=p.div.withConfig({displayName:"WordpressConnectionModal__TokenWarn",componentId:"sc-a8xkzk-9"})` 5663 display: flex; 5664 gap: 8px; 5665 align-items: flex-start; 5666 background: ${Oy}; 5667 border: 1px solid ${$i}; 5668 color: ${O}; 5669 border-radius: 8px; 5670 padding: 8px 10px; 5671 font-size: 0.75rem; 5672 line-height: 1.5; 5673 5674 svg { flex-shrink: 0; margin-top: 2px; } 5675`,m6e=p.ol.withConfig({displayName:"WordpressConnectionModal__Steps",componentId:"sc-a8xkzk-10"})` 5676 margin: 0; 5677 padding-left: 1.1rem; 5678 display: grid; 5679 gap: 6px; 5680 color: ${z}; 5681 font-size: 0.8125rem; 5682 line-height: 1.55; 5683`,h6e=p.div.withConfig({displayName:"WordpressConnectionModal__ListenRow",componentId:"sc-a8xkzk-11"})` 5684 display: flex; 5685 align-items: center; 5686 gap: 10px; 5687 padding: 10px 12px; 5688 border: 1px dashed ${V}; 5689 border-radius: 10px; 5690 background: ${At}; 5691 color: ${z}; 5692 font-size: 0.8125rem; 5693`,f6e=Tn` 5694 to { transform: rotate(360deg); } 5695`,g6e=p(Tr).withConfig({displayName:"WordpressConnectionModal__Spinner",componentId:"sc-a8xkzk-12"})` 5696 animation: ${f6e} 1s linear infinite; 5697 color: ${z}; 5698`,y6e=p.div.withConfig({displayName:"WordpressConnectionModal__SuccessRow",componentId:"sc-a8xkzk-13"})` 5699 display: flex; 5700 align-items: center; 5701 gap: 10px; 5702 padding: 10px 12px; 5703 border: 1px solid ${Vt}; 5704 border-radius: 10px; 5705 background: ${Z}; 5706 color: ${O}; 5707 font-size: 0.8125rem; 5708 font-weight: 650; 5709`,Tz=p.div.withConfig({displayName:"WordpressConnectionModal__ErrorBanner",componentId:"sc-a8xkzk-14"})` 5710 display: flex; 5711 gap: 10px; 5712 align-items: flex-start; 5713 padding: 10px 12px; 5714 border-radius: 8px; 5715 background: ${kn}; 5716 border: 1px solid ${Er}; 5717 color: ${sr}; 5718 font-size: 0.8125rem; 5719 line-height: 1.5; 5720 5721 svg { flex-shrink: 0; margin-top: 2px; } 5722`,uW=p.div.withConfig({displayName:"WordpressConnectionModal__Actions",componentId:"sc-a8xkzk-15"})` 5723 display: flex; 5724 gap: 8px; 5725 justify-content: space-between; 5726 padding-top: 12px; 5727 border-top: 1px solid ${$e}; 5728 flex-wrap: wrap; 5729`,x6e=p.div.withConfig({displayName:"WordpressConnectionModal__SiteMetaGrid",componentId:"sc-a8xkzk-16"})` 5730 display: grid; 5731 gap: 6px; 5732 font-size: 0.75rem; 5733 color: ${z}; 5734`,pm=p.div.withConfig({displayName:"WordpressConnectionModal__SiteMetaRow",componentId:"sc-a8xkzk-17"})` 5735 display: flex; 5736 gap: 6px; 5737 5738 span:first-child { 5739 min-width: 96px; 5740 color: ${z}; 5741 font-weight: 600; 5742 } 5743 5744 span:last-child { 5745 color: ${O};
5746 overflow-wrap: anywhere; 5747 } 5748`;function b6e(){return`${Td().replace(/\/+$/,"")}/api/connectors/v1/wordpress/plugin.zip`}function v6e(e,n){if(!e||!n)return!1;const i=a=>a.split(".").map(c=>parseInt(c,10)),r=i(e),o=i(n);if(r.some(isNaN)||o.some(isNaN))return e!==n;const s=Math.max(r.length,o.length);for(let a=0;a<s;a++){const c=r[a]??0,u=o[a]??0;if(c!==u)return c<u}return!1}function pW(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}const w6e=p.div.withConfig({displayName:"WordpressConnectionModal__ManifestRow",componentId:"sc-a8xkzk-18"})` 5749 display: flex; 5750 align-items: center; 5751 gap: 6px; 5752 flex-wrap: wrap; 5753 margin-top: 4px; 5754 font-size: 0.7rem; 5755 color: ${z}; 5756`,mW=p.span.withConfig({displayName:"WordpressConnectionModal__ManifestChip",componentId:"sc-a8xkzk-19"})` 5757 display: inline-flex; 5758 align-items: center; 5759 padding: 2px 6px; 5760 border-radius: 999px; 5761 background: ${$e}; 5762 color: ${O}; 5763 font-weight: 700; 5764`,j6e=p.span.withConfig({displayName:"WordpressConnectionModal__ManifestSha",componentId:"sc-a8xkzk-20"})` 5765 display: inline-flex; 5766 align-items: center; 5767 color: ${z}; 5768 code { 5769 background: ${At}; 5770 padding: 1px 5px; 5771 border-radius: 4px; 5772 color: ${O}; 5773 font-size: 0.65rem; 5774 } 5775`,_6e=p.div.withConfig({displayName:"WordpressConnectionModal__UpdateBanner",componentId:"sc-a8xkzk-21"})` 5776 display: grid; 5777 gap: 10px; 5778 padding: 12px 14px; 5779 border-radius: 12px; 5780 border: 1px solid ${ot}; 5781 background: ${cn}; 5782 color: ${O}; 5783`,C6e=p.div.withConfig({displayName:"WordpressConnectionModal__UpdateBannerTitle",componentId:"sc-a8xkzk-22"})` 5784 display: flex; 5785 align-items: center; 5786 gap: 8px; 5787 font-size: 0.875rem; 5788 font-weight: 800; 5789 color: ${Kl}; 5790`,S6e=p.span.withConfig({displayName:"WordpressConnectionModal__UpdateBannerVersionPill",componentId:"sc-a8xkzk-23"})` 5791 display: inline-flex; 5792 align-items: center; 5793 padding: 1px 8px; 5794 border-radius: 999px; 5795 background: ${Z}; 5796 border: 1px solid ${ot}; 5797 color: ${Ft}; 5798 font-size: 0.7rem; 5799 font-weight: 700; 5800 letter-spacing: 0.01em; 5801`,k6e=p.div.withConfig({displayName:"WordpressConnectionModal__UpdateBannerBody",componentId:"sc-a8xkzk-24"})` 5802 font-size: 0.8125rem; 5803 line-height: 1.55; 5804 color: ${O}; 5805`,$6e=p.ol.withConfig({displayName:"WordpressConnectionModal__UpdateBannerSteps",componentId:"sc-a8xkzk-25"})` 5806 margin: 0; 5807 padding-left: 1.1rem; 5808 display: grid; 5809 gap: 4px; 5810 font-size: 0.8125rem; 5811 line-height: 1.55; 5812 color: ${O}; 5813 5814 code { 5815 background: ${Z}; 5816 border: 1px solid ${V}; 5817 padding: 1px 5px; 5818 border-radius: 4px; 5819 font-size: 0.7rem; 5820 color: ${O}; 5821 } 5822`,I6e=p.div.withConfig({displayName:"WordpressConnectionModal__UpdateBannerActions",componentId:"sc-a8xkzk-26"})` 5823 display: flex; 5824 flex-wrap: wrap; 5825 gap: 8px; 5826 align-items: center; 5827`,hW=p.div.withConfig({displayName:"WordpressConnectionModal__UpdateBannerHint",componentId:"sc-a8xkzk-27"})` 5828 font-size: 0.75rem; 5829 color: ${z}; 5830 line-height: 1.45; 5831`;function P6e({isOpen:e,onClose:n,connection:i,pluginToken:r,generating:o,onGenerateToken:s,onDisconnect:a,onClearPluginToken:c}){const[u,m]=l.useState(!1),[h,g]=l.useState(null),[x,y]=l.useState(!1),w=i?.status==="connected",j=i?.status==="pending",v=l.useMemo(()=>b6e(),[]),{manifest:_}=zre(),$=i?.plugin_version??null,k=_?.version??null,P=w&&v6e($,k);l.useEffect(()=>{e&&(m(!1),g(null))},[e]);const S=l.useCallback(async()=>{g(null);const M=await s();!M.ok&&M.message&&g(M.message)},[s]),I=l.useCallback(async()=>{if(r)try{await navigator.clipboard.writeText(r),m(!0),setTimeout(()=>m(!1),1500)}catch{g("Could not copy token. Select it manually and copy.")}},[r]),A=l.useCallback(async()=>{y(!0),g(null);const M=await a();if(y(!1),!M.ok&&M.message){g(M.message);return}n()},[n,a]),E=l.useCallback(()=>{c(),n()},[c,n]);if(w){const M=i?.last_seen_at?new Date(i.last_seen_at).getTime():0,R=M?Math.floor((Date.now()-M)/6e4):null,F=i?.alive===!1&&R!==null&&R>=15;return t.jsx(Hn,{isOpen:e,onClose:E,title:"WordPress connection",size:"md",minHeight:"0",children:t.jsxs(dW,{children:[t.jsxs(y6e,{children:[t.jsx(co,{size:18,color:Vt}),"Connected to ",i?.site_name||i?.site_url||"your WordPress site","."]}),P?t.jsxs(_6e,{children:[t.jsxs(C6e,{children:[t.jsx(FE,{size:16,color:Ft}),t.jsx("span",{children:"Plugin update available"}),t.jsxs(S6e,{children:["v",$," â v",k]})]}),t.jsxs(k6e,{children:["A newer Ceyo GEO plugin is available for your site. ",t.jsx("strong",{children:"Your connection, plugin token, and schedules are preserved across the update â there's no need to reconnect or paste anything."})]}),t.jsxs($6e,{children:[t.jsxs("li",{children:[t.jsx("strong",{children:"One-click in WordPress (recommended):"})," open WP Admin â ",t.jsx("code",{children:"Plugins"})," (or",t.jsx("code",{children:"Dashboard â Updates"}),"). You'll see ",t.jsx("em",{children:'"There is a new version of Ceyo GEO available"'}),"next to the plugin. Click ",t.jsx("strong",{children:"Update Now"})," â done."]}),t.jsxs("li",{children:[t.jsx("strong",{children:"Or upload manually:"})," download the new ",t.jsx("code",{children:".zip"})," below, then in WP Admin go to ",t.jsx("code",{children:"Plugins â Add New â Upload Plugin"}),", choose the file, and ",t.jsx("em",{children:"Replace existing"}),"when prompted."]})]}),t.jsxs(I6e,{children:[t.jsxs(he,{size:"sm",variant:"outline",leftIcon:t.jsx(wy,{size:14}),rightIcon:t.jsx(as,{size:12}),onClick:()=>window.open(v,"_blank","noopener,noreferrer"),children:["Download v",k," (.zip)"]}),_?t.jsxs(hW,{children:[pW(_.size_bytes)," · sha256 ",t.jsxs("code",{style:{background:Z,border:`1px solid ${V}`,padding:"1px 5px",borderRadius:4,fontSize:"0.65rem"},children:[_.sha256.slice(0,12),"â¦"]})]}):null]}),t.jsx(hW,{children:"The one-click update only works on plugin v0.10.
58310 or later (the version that introduced the self-hosted updater). Older installs need the manual zip upload â once."})]}):null,F?t.jsxs(Tz,{style:{background:Oy,borderColor:$i,color:O},children:[t.jsx(ei,{size:16,color:$i}),t.jsxs("span",{children:["We haven't heard from your WordPress site in ",R," minutes. WP-Cron may not be running on this host (common on InstaWP, sandbox sites, or hosts with ",t.jsx("code",{children:"DISABLE_WP_CRON"}),"). Operations will still apply once the plugin checks in â visiting any WP Admin page triggers an immediate sync from plugin v0.9.0+."]})]}):null,t.jsxs(x6e,{children:[i?.site_url?t.jsxs(pm,{children:[t.jsx("span",{children:"Site URL"}),t.jsx("span",{children:i.site_url})]}):null,i?.wp_version?t.jsxs(pm,{children:[t.jsx("span",{children:"WordPress"}),t.jsx("span",{children:i.wp_version})]}):null,i?.php_version?t.jsxs(pm,{children:[t.jsx("span",{children:"PHP"}),t.jsx("span",{children:i.php_version})]}):null,i?.active_theme?t.jsxs(pm,{children:[t.jsx("span",{children:"Active theme"}),t.jsx("span",{children:i.active_theme})]}):null,i?.plugin_version?t.jsxs(pm,{children:[t.jsx("span",{children:"Plugin"}),t.jsxs("span",{children:["v",i.plugin_version,P&&k?t.jsxs("span",{style:{color:Ft,fontWeight:700},children:[" â v",k," available"]}):null]})]}):null,i?.seo_plugin?t.jsxs(pm,{children:[t.jsx("span",{children:"SEO plugin"}),t.jsx("span",{children:i.seo_plugin})]}):null,i?.plugin_token_last4?t.jsxs(pm,{children:[t.jsx("span",{children:"Token"}),t.jsxs("span",{children:["â¢â¢â¢â¢ ",i.plugin_token_last4]})]}):null,i?.last_seen_at?t.jsxs(pm,{children:[t.jsx("span",{children:"Last seen"}),t.jsx("span",{children:new Date(i.last_seen_at).toLocaleString()})]}):null,typeof i?.pages_count=="number"?t.jsxs(pm,{children:[t.jsx("span",{children:"Pages synced"}),t.jsx("span",{children:i.pages_count})]}):null]}),h?t.jsxs(Tz,{children:[t.jsx(ei,{size:16}),t.jsx("span",{children:h})]}):null,t.jsxs(uW,{children:[t.jsx(he,{variant:"danger",size:"sm",onClick:A,disabled:x,children:x?"Disconnectingâ¦":"Disconnect WordPress"}),t.jsx(he,{size:"sm",onClick:E,children:"Done"})]})]})})}const B=!!(r||j),T=j&&!r;return t.jsx(Hn,{isOpen:e,onClose:E,title:"Connect WordPress",size:"md",minHeight:"0",children:t.jsxs(dW,{children:[t.jsx(Pk,{children:"Install the Ceyo GEO plugin on your WordPress site and paste the connection token below. Once installed, this project will be able to auto-fix site audit issues and publish AI-generated content directly to your site."}),t.jsxs(Pz,{children:[t.jsxs(Az,{children:[t.jsx(Nz,{$done:B,$active:!B,children:"1"}),t.jsx(zz,{children:"Generate a plugin token"})]}),r?t.jsxs(t.Fragment,{children:[t.jsxs(c6e,{children:[t.jsx(d6e,{children:r}),t.jsxs(u6e,{type:"button",onClick:I,$copied:u,children:[u?t.jsx(Zn,{size:14}):t.jsx(so,{size:14}),u?"Copied":"Copy"]})]}),t.jsxs(p6e,{children:[t.jsx(ei,{size:14}),t.jsx("span",{children:"This is the only time the token will be shown. Copy it and paste it into the plugin settings on your WordPress site. If you lose it, generate a new one."})]})]}):t.jsxs(t.Fragment,{children:[t.jsx(Pk,{children:"A unique token authenticates this WordPress site with Ceyo. We never store the raw value â you'll only see it once below."}),t.jsx("div",{children:t.jsx(he,{size:"sm",variant:"primary",leftIcon:t.jsx(Rc,{size:14}),onClick:S,disabled:o,children:o?"Generatingâ¦":j?"Generate a new token":"Generate plugin token"})})]})]}),t.jsxs(Pz,{children:[t.jsxs(Az,{children:[t.jsx(Nz,{$active:B&&!w,children:"2"}),t.jsx(zz,{children:"Install the Ceyo GEO plugin"})]}),t.jsx(Pk,{children:"Download the plugin and install it on your WordPress site:"}),t.jsx("div",{children:t.jsx(he,{size:"sm",variant:"outline",leftIcon:t.jsx(wy,{size:14}),rightIcon:t.jsx(as,{size:12}),onClick:()=>window.open(v,"_blank","noopener,noreferrer"),children:_?.version?`Download plugin v${_.version} (.zip)`:"Download plugin (.zip)"})}),_&&t.jsxs(w6e,{children:[t.jsxs(mW,{title:"Plugin version",children:["v",_.version??"?"]}),t.jsx(mW,{title:"File size",children:pW(_.size_bytes)}),t.jsxs(j6e,{title:`SHA-256: ${_.sha256}`,children:["sha256: ",t.jsxs("code",{children:[_.sha256.slice(0,12),"â¦"]})]})]}),t.jsxs(m6e,{children:[t.jsxs("li",{children:["In WordPress admin, go to ",t.jsx("strong",{children:"Plugins â Add New â Upload Plugin"}),"."]}),t.jsxs("li",{children:["Select the downloaded ",t.jsx("code",{children:"ceyo-geo-*.zip"})," file and click Install Now."]}),t.jsxs("li",{children:["Click ",t.jsx("strong",{children:"Activate Plugin"}),"."]}),t.jsxs("li",{children:["Open ",t.jsx("strong",{children:"Settings â Ceyo GEO"}),", paste the token from step 1, and click Save."]})]})]}),t.jsxs(Pz,{children:[t.jsxs(Az,{children:[t.jsx(Nz,{$active:T,children:"3"}),t.jsx(zz,{children:"Wait for the handshake"})]}),T?t.jsxs(h6e,{children:[t.jsx(g6e,{size:16}),"Listening for your WordPress site to connectâ¦"]}
5831):t.jsx(Pk,{children:'Once the plugin sends its first ping, this dialog will flip to "Connected" automatically.'})]}),h?t.jsxs(Tz,{children:[t.jsx(ei,{size:16}),t.jsx("span",{children:h})]}):null,t.jsxs(uW,{children:[j?t.jsx(he,{variant:"danger",size:"sm",onClick:A,disabled:x,children:x?"Cancellingâ¦":"Cancel pending connection"}):t.jsx("span",{}),t.jsx(he,{size:"sm",variant:"outline",onClick:E,children:"Close"})]})]})})}function A6e(e,n){if(!e||!n)return!1;const i=a=>a.split(".").map(c=>parseInt(c,10)),r=i(e),o=i(n);if(r.some(isNaN)||o.some(isNaN))return e!==n;const s=Math.max(r.length,o.length);for(let a=0;a<s;a++){const c=r[a]??0,u=o[a]??0;if(c!==u)return c<u}return!1}const N6e=p.div.withConfig({displayName:"WordpressConnectionCard__IntegrationPanel",componentId:"sc-1devi53-0"})` 5832 border: 1px solid ${V}; 5833 border-radius: 1rem; 5834 background: ${Z}; 5835 overflow: hidden; 5836`,z6e=p.button.withConfig({displayName:"WordpressConnectionCard__IntegrationToggle",componentId:"sc-1devi53-1"})` 5837 width: 100%; 5838 border: none; 5839 background: transparent; 5840 padding: 1rem 1.1rem; 5841 display: flex; 5842 align-items: flex-start; 5843 justify-content: space-between; 5844 gap: 1rem; 5845 cursor: pointer; 5846 text-align: left; 5847 5848 &:hover { 5849 background: ${At}; 5850 } 5851 5852 &:focus-visible { 5853 outline: none; 5854 box-shadow: inset 0 0 0 2px ${V}; 5855 } 5856 5857 @media (max-width: 640px) { 5858 flex-wrap: wrap; 5859 } 5860`,T6e=p.div.withConfig({displayName:"WordpressConnectionCard__IntegrationToggleMain",componentId:"sc-1devi53-2"})` 5861 min-width: 0; 5862 display: grid; 5863 gap: 0.35rem; 5864`,E6e=p.div.withConfig({displayName:"WordpressConnectionCard__IntegrationToggleTitleRow",componentId:"sc-1devi53-3"})` 5865 display: flex; 5866 align-items: center; 5867 gap: 0.5rem; 5868 color: ${O}; 5869 font-weight: 750; 5870`,M6e=p.div.withConfig({displayName:"WordpressConnectionCard__IntegrationToggleTitle",componentId:"sc-1devi53-4"})` 5871 font-size: 0.95rem; 5872 font-weight: 800; 5873 color: ${O}; 5874`,R6e=p.div.withConfig({displayName:"WordpressConnectionCard__IntegrationToggleDescription",componentId:"sc-1devi53-5"})` 5875 color: ${z}; 5876 font-size: 0.8125rem; 5877 line-height: 1.45; 5878`,O6e=p.div.withConfig({displayName:"WordpressConnectionCard__StatusPillRow",componentId:"sc-1devi53-6"})` 5879 display: flex; 5880 align-items: center; 5881 gap: 0.65rem; 5882 flex-wrap: wrap; 5883 row-gap: 0.35rem; 5884`,D6e=p.span.withConfig({displayName:"WordpressConnectionCard__StatusGlyph",componentId:"sc-1devi53-7"})` 5885 display: inline-flex; 5886 align-items: center; 5887 justify-content: center; 5888 flex-shrink: 0; 5889 line-height: 0; 5890 height: calc(1em * var(--status-line-height, 1.25)); 5891 5892 & > svg { 5893 display: block; 5894 } 5895`,L6e=p.span.withConfig({displayName:"WordpressConnectionCard__StatusDotTrack",componentId:"sc-1devi53-8"})` 5896 display: inline-flex; 5897 align-items: center; 5898 justify-content: center; 5899 flex-shrink: 0; 5900 height: calc(1em * var(--status-line-height, 1.25)); 5901`,B6e=p.span.withConfig({displayName:"WordpressConnectionCard__StatusDot",componentId:"sc-1devi53-9"})` 5902 flex-shrink: 0; 5903 width: 7px; 5904 height: 7px; 5905 border-radius: 999px; 5906 background: ${e=>e.$color}; 5907`,fW=p.div.withConfig({displayName:"WordpressConnectionCard__StatusText",componentId:"sc-1devi53-10"})` 5908 --status-line-height: 1.25; 5909 color: ${z}; 5910 font-size: 0.75rem; 5911 line-height: var(--status-line-height); 5912 display: inline-flex; 5913 align-items: center; 5914 gap: 0.35rem; 5915`,F6e=p.div.withConfig({displayName:"WordpressConnectionCard__IntegrationToggleAffordance",componentId:"sc-1devi53-11"})` 5916 display: inline-flex; 5917 align-items: center; 5918 gap: 0.45rem; 5919 white-space: nowrap; 5920 color: ${z}; 5921 font-size: 0.75rem; 5922 font-weight: 800; 5923 border: 1px solid ${V}; 5924 border-radius: 999px; 5925 padding: 0.4rem 0.65rem; 5926 background: ${Z}; 5927 5928 @media (max-width: 640px) { 5929 margin-left: auto; 5930 } 5931`,W6e=p.div.withConfig({displayName:"WordpressConnectionCard__IntegrationCollapse",componentId:"sc-1devi53-12"})` 5932 display: grid; 5933 grid-template-rows: ${e=>e.$open?"1fr":"0fr"}; 5934 transition: grid-template-rows 0.18s ease; 5935`,U6e=p.div.withConfig({displayName:"WordpressConnectionCard__IntegrationCollapseInner",componentId:"sc-1devi53-13"})` 5936 overflow: hidden; 5937`,H6e=p.div.withConfig({displayName:"WordpressConnectionCard__CardBody",componentId:"sc-1devi53-14"})` 5938 border-top: 1px solid ${V}; 5939 display: grid; 5940 gap: 1rem; 5941 padding: 1rem 1.1rem 1.1rem; 5942 min-width: 0; 5943`,gW=p.div.withConfig({displayName:"WordpressConnectionCard__Callout",componentId:"sc-1devi53-15"})` 5944 border: 1px solid ${V}; 5945 background: ${At}; 5946 border-radius: 0.875rem; 5947 padding: 0.875rem; 5948 color: ${z}; 5949 font-size: 0.875rem; 5950 line-height: 1.55; 5951`,q6e=p.div.withConfig({displayName:"WordpressConnectionCard__ValueGrid",componentId:"sc-1devi53-16"})` 5952 display: grid; 5953 gap: 0.625rem; 5954 font-size: 0.8125rem; 5955`,cp=p.div.withConfig({displayName:"WordpressConnectionCard__ValueRow",componentId:"sc-1devi53-17"})` 5956 display: flex; 5957 gap: 0.625rem; 5958 5959 span:first-child { 5960 min-width: 7rem; 5961 color: ${z}; 5962 font-weight: 600; 5963 } 5964 5965 span:last-child { 5966 color: ${O};
5967 overflow-wrap: anywhere; 5968 } 5969`,G6e=p.div.withConfig({displayName:"WordpressConnectionCard__ActionsRow",componentId:"sc-1devi53-18"})` 5970 display: flex; 5971 flex-wrap: wrap; 5972 gap: 0.625rem; 5973`,V6e=p.span.withConfig({displayName:"WordpressConnectionCard__UpdatePill",componentId:"sc-1devi53-19"})` 5974 display: inline-flex; 5975 align-items: center; 5976 gap: 0.3rem; 5977 padding: 0.15rem 0.5rem 0.15rem 0.4rem; 5978 border-radius: 999px; 5979 background: ${cn}; 5980 border: 1px solid ${ot}; 5981 color: ${Ft}; 5982 font-size: 0.7rem; 5983 font-weight: 800; 5984 letter-spacing: 0.01em; 5985 white-space: nowrap; 5986`,K6e=p.div.withConfig({displayName:"WordpressConnectionCard__UpdateCallout",componentId:"sc-1devi53-20"})` 5987 display: flex; 5988 align-items: center; 5989 gap: 0.625rem; 5990 padding: 0.625rem 0.75rem; 5991 border-radius: 0.625rem; 5992 border: 1px solid ${ot}; 5993 background: ${cn}; 5994 color: ${O}; 5995 font-size: 0.8125rem; 5996 line-height: 1.45; 5997 5998 strong { color: ${Ft}; } 5999`;function Y6e(e){switch(e){case"connected":return{color:Vt,label:"Connected"};case"pending":return{color:$i,label:"Awaiting plugin handshake"};case"revoked":return{color:z,label:"Revoked"};case"error":return{color:Ut,label:"Error"};default:return{color:z,label:"Not connected"}}}function X6e({organizationId:e,projectId:n,enabled:i=!0,defaultOpen:r=!1}){const[o,s]=l.useState(r),[a,c]=l.useState(!1),u=Nre({organizationId:e,projectId:n,enabled:i}),m=u.connection?.status,h=l.useMemo(()=>Y6e(m),[m]),g=m==="connected",{manifest:x}=zre(),y=u.connection?.plugin_version??null,w=x?.version??null,j=g&&A6e(y,w);return i?t.jsxs(t.Fragment,{children:[t.jsxs(N6e,{children:[t.jsxs(z6e,{type:"button","aria-expanded":o,"aria-label":o?"Collapse WordPress integration":"Expand WordPress integration",onClick:()=>s(v=>!v),children:[t.jsxs(T6e,{children:[t.jsxs(E6e,{children:[t.jsx(SP,{size:18}),t.jsx(M6e,{children:"WordPress"}),j&&w?t.jsxs(V6e,{title:`Plugin update available: v${y} â v${w}`,children:[t.jsx(FE,{size:12,strokeWidth:2.5}),"Update v",w]}):null]}),t.jsx(R6e,{children:"Let Ceyo auto-fix site audit issues and publish AI-generated content directly to your WordPress site."}),t.jsxs(O6e,{children:[t.jsxs(fW,{children:[t.jsx(L6e,{"aria-hidden":!0,children:t.jsx(B6e,{$color:h.color})}),t.jsx("span",{children:u.loading?"Loadingâ¦":h.label})]}),u.connection?.site_url?t.jsxs(fW,{children:[t.jsx(D6e,{"aria-hidden":!0,children:t.jsx(To,{size:14,strokeWidth:2})}),t.jsx("span",{style:{overflowWrap:"anywhere"},children:u.connection.site_url})]}):null]})]}),t.jsxs(F6e,{"aria-hidden":"true",children:[o?"Hide details":"Show details",o?t.jsx(qn,{size:16}):t.jsx(Gi,{size:16})]})]}),t.jsx(W6e,{$open:o,children:t.jsx(U6e,{children:t.jsxs(H6e,{children:[t.jsx(gW,{children:"The Ceyo GEO plugin runs on your WordPress site and exchanges short-lived signed payloads with Ceyo. We never need your WordPress admin password. You can disconnect at any time and Ceyo will immediately stop reading from or writing to your site."}),g&&j&&w?t.jsxs(K6e,{children:[t.jsx(FE,{size:18,strokeWidth:2,color:Ft}),t.jsxs("span",{children:[t.jsx("strong",{children:"Plugin update available"})," â v",y," â v",w,"."," ","Open WordPress admin and click ",t.jsx("strong",{children:"Update Now"})," on the Plugins page (one click â your connection and settings are preserved). For details and the manual ",t.jsx("code",{children:".zip"})," ","download, click ",t.jsx("strong",{children:"Manage connection"})," below."]})]}):null,g?t.jsxs(q6e,{children:[u.connection?.site_name?t.jsxs(cp,{children:[t.jsx("span",{children:"Site name"}),t.jsx("span",{children:u.connection.site_name})]}):null,u.connection?.site_url?t.jsxs(cp,{children:[t.jsx("span",{children:"Site URL"}),t.jsx("span",{children:u.connection.site_url})]}):null,u.connection?.wp_version?t.jsxs(cp,{children:[t.jsx("span",{children:"WordPress"}),t.jsx("span",{children:u.connection.wp_version})]}):null,u.connection?.php_version?t.jsxs(cp,{children:[t.jsx("span",{children:"PHP"}),t.jsx("span",{children:u.connection.php_version})]}):null,u.connection?.active_theme?t.jsxs(cp,{children:[t.jsx("span",{children:"Active theme"}),t.jsx("span",{children:u.connection.active_theme})]}):null,u.connection?.plugin_version?t.jsxs(cp,{children:[t.jsx("span",{children:"Plugin"}),t.jsxs("span",{children:["v",u.connection.plugin_version,j&&w?t.jsxs("span",{style:{color:Ft,fontWeight:700},children:[" ","â v",w," available"]}):null]})]}):null,u.connection?.seo_plugin?t.jsxs(cp,{children:[t.jsx("span",{children:"SEO plugin"}),t.jsx("span",{children:u.connection.seo_plugin})]}):null,u.connection?.plugin_token_last4?t.jsxs(cp,{children:[t.jsx("span",{children:"Token"}),t.jsxs("span",{children:["â¢â¢â¢â¢ ",u.connection.plugin_token_last4]})]}):null,u.connection?.last_seen_at?t.jsxs(cp,{children:[t.jsx("span",{children:"Last seen"}),t.jsx("span",{children:new Date(u.connection.last_seen_at).toLocaleStr
5999ing()})]}):null,typeof u.connection?.pages_count=="number"?t.jsxs(cp,{children:[t.jsx("span",{children:"Pages synced"}),t.jsx("span",{children:u.connection.pages_count})]}):null]}):null,u.error?t.jsx(gW,{style:{borderColor:Ut,color:Ut},children:u.error}):null,t.jsx(G6e,{children:t.jsx(he,{size:"sm",variant:g?"outline":"primary",leftIcon:t.jsx(Bc,{size:14}),onClick:()=>c(!0),children:g?"Manage connection":"Connect WordPress"})})]})})})]}),t.jsx(P6e,{isOpen:a,onClose:()=>c(!1),connection:u.connection,pluginToken:u.pluginToken,generating:u.generating,onGenerateToken:u.generateToken,onDisconnect:u.disconnect,onClearPluginToken:u.clearPluginToken})]}):null}const Q6e=1,Ez={status:"idle",operationId:null,errorCode:null,errorMessage:null,optimistic:!1};function Z6e({organizationId:e,projectId:n,enabled:i=!0}){const{subscribe:r}=wo(),[o,s]=l.useState({}),a=l.useMemo(()=>yW(e),[e]),c=l.useMemo(()=>yW(n),[n]),u=l.useCallback((j,v)=>{if(j==null)return;const _=String(j);s($=>{const k=$[_]??Ez,P={...k,...v};return P.status===k.status&&P.operationId===k.operationId&&P.errorCode===k.errorCode&&P.errorMessage===k.errorMessage&&P.optimistic===k.optimistic?$:{...$,[_]:P}})},[]),m=l.useCallback(j=>{!Array.isArray(j)||j.length===0||s(v=>{let _=!1;const $={...v};for(const k of j){const P=k.self_healing;if(!P)continue;const S=String(k.id),I=$[S];if(I&&I.status!=="idle"&&!I.optimistic||I?.optimistic&&!P.in_flight&&!P.last_failed)continue;let A;P.in_flight?A={status:P.in_flight.status,operationId:P.in_flight.operation_id,errorCode:null,errorMessage:null,optimistic:!1}:P.last_failed?A={status:"failed",operationId:P.last_failed.operation_id,errorCode:P.last_failed.error_code,errorMessage:P.last_failed.error_message,optimistic:!1}:A=Ez,(!I||I.status!==A.status||I.operationId!==A.operationId||I.errorCode!==A.errorCode||I.errorMessage!==A.errorMessage)&&($[S]=A,_=!0)}return _?$:v})},[]),h=l.useRef(null);l.useEffect(()=>{if(!i||!c)return;const j=r({channel:"AgentsChannel",project_id:c},{received:v=>{if(!v||typeof v!="object"||!String(v.type||"").startsWith("operation_"))return;const $=v.operation;!$||!$.site_audit_action_id||u($.site_audit_action_id,{status:$.status,operationId:$.id,errorCode:$.error_code??null,errorMessage:$.error_message??null,optimistic:!1})}});return h.current=j,()=>{try{j?.unsubscribe?.()}catch{}h.current=null}},[c,r,i,u]);const g=l.useCallback(async j=>{if(!a||!c)return{ok:!1,status:0,message:"Project not loaded yet."};u(j,{status:"queued",operationId:null,errorCode:null,errorMessage:null,optimistic:!0});try{const v=await ue(`/api/v1/organizations/${a}/projects/${c}/site_audit_actions/${j}/self_heal`,{method:"POST"}),_=await v.json().catch(()=>({}));if(!v.ok){const k=J6e(v.status,_)??`http_${v.status}`,P=xW(_?.error)??xW(_?.errors?.[0])??e7e(v.status);return v.status===409?u(j,{status:"queued",optimistic:!1,errorCode:null,errorMessage:null}):u(j,{status:"failed",optimistic:!1,errorCode:k,errorMessage:P}),{ok:!1,status:v.status,errorCode:k,message:P}}const $=_?.operation??void 0;return $&&u(j,{status:$.status,operationId:$.id,errorCode:$.error_code??null,errorMessage:$.error_message??null,optimistic:!1}),Fo(),{ok:!0,status:v.status,operation:$}}catch(v){const _=v?.message||"Auto-fix failed.";return u(j,{status:"failed",optimistic:!1,errorCode:"network_error",errorMessage:_}),{ok:!1,status:0,errorCode:"network_error",message:_}}},[a,c,u]),x=l.useCallback(j=>o[String(j)]??Ez,[o]),y=l.useRef(o);l.useEffect(()=>{y.current=o},[o]);const w=l.useCallback(async j=>{const v=Array.from(new Set((j??[]).map(String)));if(v.length===0)return{attempted:0,ok:0,failed:0};const _=v.filter(A=>{const E=y.current[A];return E?!(E.status==="succeeded"||E.status==="queued"||E.status==="dispatched"):!0});if(_.length===0)return{attempted:0,ok:0,failed:0};let $=0,k=0,P,S,I=!1;return await Promise.all(_.map(async(A,E)=>{if(I&&E>0)return;const B=await g(A);if(B.ok||B.status===409){$+=1;return}k+=1,P||(P=B.errorCode,S=B.message),(B.status===402||B.status===503||B.status===504)&&(I=!0)})),{attempted:_.length,ok:$,failed:k,errorCode:P,errorMessage:S}
5999},[g]);return{byAction:o,stateFor:x,primeFromActions:m,triggerFix:g,triggerFixBatch:w}}function yW(e){if(e==null)return null;const n=Number(e);return Number.isFinite(n)&&n>0?n:null}function xW(e){return typeof e=="string"&&e.length>0?e:void 0}function J6e(e,n){switch(e){case 402:return"insufficient_credits";case 403:return"not_authorized";case 404:return"action_not_found";case 409:return"already_in_flight";case 422:return"not_supported";case 503:case 504:return"connector_offline"}}function e7e(e){switch(e){case 402:return"Not enough credits to dispatch this auto-fix.";case 403:return"You don't have permission to auto-fix this finding.";case 404:return"This finding no longer exists.";case 422:return"This finding isn't auto-fixable yet.";case 503:case 504:return"WordPress connector is offline."}return"Auto-fix failed."}function t7e({supported:e,connectorAlive:n,requiresReview:i,notFixableReason:r,state:o,onTrigger:s,disabled:a}){const c=l.useMemo(()=>n7e({supported:e,connectorAlive:n,notFixableReason:r,state:o}),[e,n,r,o]);if(c.kind==="hidden")return null;const u=i?t.jsx(at,{content:"This fix is potentially destructive â it won't be auto-accepted by any rule and a person has to OK it in the queue.",placement:"top",maxWidth:280,children:t.jsxs(a7e,{type:"button",tabIndex:-1,"aria-label":"Needs review",children:[t.jsx(g5,{size:10}),t.jsx("span",{children:"Review"})]})}):null;if(c.kind==="disabled_reason")return t.jsxs(xw,{children:[t.jsx(at,{content:c.reason,placement:"top",maxWidth:240,children:t.jsxs(bw,{type:"button",disabled:!0,$tone:"muted",children:[t.jsx(Lm,{size:11}),t.jsx("span",{children:"Auto-fix"})]})}),u]});if(c.kind==="in_flight")return t.jsxs(xw,{children:[t.jsxs(bw,{type:"button",disabled:!0,$tone:"active",children:[t.jsx(Tre,{size:11}),t.jsx("span",{children:c.label})]}),u]});if(c.kind==="succeeded")return t.jsx(xw,{children:t.jsxs(bw,{type:"button",disabled:!0,$tone:"success",children:[t.jsx(co,{size:11}),t.jsx("span",{children:"Fixed"})]})});if(c.kind==="failed"){const m=c.errorCode==="insufficient_credits",h=c.errorMessage||`Auto-fix failed${c.errorCode?` (${c.errorCode})`:""}`;return t.jsxs(xw,{children:[t.jsx(at,{content:h,placement:"top",maxWidth:280,children:t.jsxs(bw,{type:"button",$tone:"error",disabled:a,onClick:s,children:[t.jsx(Sf,{size:11}),t.jsx("span",{children:m?"Out of credits":"Retry auto-fix"})]})}),u]})}return t.jsxs(xw,{children:[t.jsxs(bw,{type:"button",$tone:"primary",disabled:a,onClick:s,children:[t.jsx(Lm,{size:11}),t.jsx("span",{children:"Auto-fix"})]}),u]})}function n7e({supported:e,connectorAlive:n,notFixableReason:i,state:r}){return e?r.status==="queued"?{kind:"in_flight",label:"Queued..."}:r.status==="dispatched"?{kind:"in_flight",label:"Fixing..."}:r.status==="succeeded"?{kind:"succeeded"}:r.status==="failed"?{kind:"failed",errorCode:r.errorCode,errorMessage:r.errorMessage}:i==="url_not_in_wordpress"?{kind:"disabled_reason",reason:"WordPress doesn't have an editable post for this URL â it's likely a category, author or archive page rather than a real post or page."}:n?{kind:"idle"}:{kind:"disabled_reason",reason:"Connect WordPress (or wait for the next heartbeat) to enable auto-fix."}:{kind:"hidden"}}function i7e({eligibleCount:e,totalAffected:n,connectorAlive:i,onTrigger:r,variant:o="subtle"}){const[s,a]=l.useState(!1),[c,u]=l.useState(null),m=e*Q6e,h=e<n,g=l.useMemo(()=>{const w=[];if(w.push(`Will queue ${e} auto-fix${e===1?"":"es"} (${m} credit${m===1?"":"s"}).`),h){const j=n-e;w.push(`${j} affected page${j===1?" is":"s are"} already in flight, fixed, or unsupported and will be skipped.`)}return i||w.push("WordPress is not currently connected â connect or wait for the next heartbeat."),w.join(" ")},[e,m,h,n,i]);if(e<2)return null;const x=async()=>{if(!s){a(!0),u(null);try{const w=await r();u(w)}finally{a(!1)}}},y=c&&(c.failed>0||c.attempted>0)?c.failed>0?`${c.ok}/${c.attempted} queued · ${c.failed} failed${c.errorCode?` (${c.errorCode})`:""}`:`${c.ok} queued`:null;return t.jsxs(r7e,{children:[t.jsx(at,{content:g,placement:"top",maxWidth:300,children:t.jsxs(s7e,{type:"button",$variant:o,disabled:s||!i,onClick:x,children:[s?t.jsx(Tre,{size:11}):t.jsx(Sn,{size:11}),t.jsx("span",{children:s?"Queueing...":`Fix all ${e}`})]})}
5999),y&&t.jsx(o7e,{$tone:c?.failed?"error":"ok",children:y})]})}const r7e=p.div.withConfig({displayName:"AutoFixButton__FixAllRow",componentId:"sc-1ghw2uv-0"})` 6000 display: inline-flex; align-items: center; gap: 6px; 6001`,o7e=p.span.withConfig({displayName:"AutoFixButton__FixAllSummary",componentId:"sc-1ghw2uv-1"})` 6002 font-size: 0.62rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; 6003 color: ${e=>e.$tone==="error"?Ut:Vt}; 6004`,s7e=p.button.withConfig({displayName:"AutoFixButton__FixAllBtn",componentId:"sc-1ghw2uv-2"})` 6005 display: inline-flex; align-items: center; gap: 4px; 6006 padding: 2px 8px; 6007 font-family: inherit; font-size: 0.62rem; font-weight: 700; 6008 line-height: 1.2; text-transform: uppercase; letter-spacing: 0.04em; 6009 border-radius: 4px; 6010 border: 1px solid ${e=>e.$variant==="primary"?"#4F46E5":V}; 6011 background: ${e=>e.$variant==="primary"?"#4F46E5":"#fff"}; 6012 color: ${e=>e.$variant==="primary"?"#fff":"#4F46E5"}; 6013 cursor: ${e=>e.disabled?"not-allowed":"pointer"}; 6014 opacity: ${e=>e.disabled?.65:1}; 6015 transition: filter 0.12s, transform 0.06s; 6016 &:hover:enabled { filter: brightness(0.95); } 6017 &:active:enabled { transform: translateY(1px); } 6018`,xw=p.span.withConfig({displayName:"AutoFixButton__Row",componentId:"sc-1ghw2uv-3"})` 6019 display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0; 6020`,a7e=p.button.withConfig({displayName:"AutoFixButton__ReviewPill",componentId:"sc-1ghw2uv-4"})` 6021 display: inline-flex; align-items: center; gap: 3px; 6022 padding: 1px 6px; 6023 font-family: inherit; font-size: 0.58rem; font-weight: 700; 6024 line-height: 1.2; text-transform: uppercase; letter-spacing: 0.04em; 6025 border-radius: 999px; 6026 border: 1px solid ${K_}; 6027 background: ${Jl}; 6028 color: ${$i}; 6029 cursor: help; 6030`,l7e=Tn`from { transform: rotate(0deg); } to { transform: rotate(360deg); }`,Tre=p(Tr).withConfig({displayName:"AutoFixButton__Spinner",componentId:"sc-1ghw2uv-5"})` 6031 animation: ${l7e} 0.9s linear infinite; 6032`,bw=p.button.withConfig({displayName:"AutoFixButton__Btn",componentId:"sc-1ghw2uv-6"})` 6033 display: inline-flex; align-items: center; gap: 4px; 6034 padding: 2px 7px; 6035 font-family: inherit; font-size: 0.62rem; font-weight: 700; 6036 line-height: 1.2; text-transform: uppercase; letter-spacing: 0.04em; 6037 border-radius: 4px; 6038 border: 1px solid ${e=>{switch(e.$tone){case"success":return Vt;case"error":return Ut;case"muted":return V;case"active":return"#4F46E5";default:return"#4F46E5"}}}; 6039 background: ${e=>{switch(e.$tone){case"success":return si;case"error":return kn;case"muted":return"#fff";case"active":return"#EEF2FF";default:return"#4F46E5"}}}; 6040 color: ${e=>{switch(e.$tone){case"success":return Vt;case"error":return Ut;case"muted":return z;case"active":return"#4F46E5";default:return"#fff"}}}; 6041 cursor: ${e=>e.disabled?"not-allowed":"pointer"}; 6042 opacity: ${e=>e.disabled&&e.$tone!=="active"&&e.$tone!=="success"&&e.$tone!=="error"?.7:1}; 6043 transition: filter 0.12s, transform 0.06s; 6044 flex-shrink: 0; 6045 &:hover:enabled { filter: brightness(0.95); } 6046 &:active:enabled { transform: translateY(1px); } 6047`;function c7e({proposal:e,estimatedCreditsPerOp:n,connectorAlive:i,onAccept:r,onDismiss:o,readonly:s,selectable:a,selected:c,onToggleSelect:u,preview:m,onRequestPreview:h,canManage:g=!0}){const[x,y]=l.useState(!1),[w,j]=l.useState(!1),[v,_]=l.useState(null),[$,k]=l.useState(!1),P=l.useCallback(async()=>{if(!(x||w)){y(!0),_(null);try{const A=await r(e);A.ok||_({code:A.errorCode,message:A.message})}finally{y(!1)}}},[x,w,r,e]),S=l.useCallback(async A=>{if(!(x||w)){k(!1),j(!0),_(null);try{const E=await o(e,A);E.ok||_({code:E.errorCode,message:E.message})}finally{j(!1)}}},[x,w,o,e]),I=e.audit_severity||"low";return t.jsxs(g7e,{$sev:I,$selected:!!c,children:[t.jsxs(x7e,{children:[a&&e.status==="pending"&&!s&&g&&t.jsx(y7e,{type:"checkbox",checked:!!c,onChange:A=>u?.(e,A.target.checked),"aria-label":`Select proposal ${e.id}`}),t.jsx(v7e,{$sev:I,children:I}),e.audit_category&&t.jsx(w7e,{children:e.audit_category}),t.jsx(b7e,{}),t.jsx(at,{content:`Accepting will spend ${n} credit${n===1?"":"s"}`,placement:"top",maxWidth:280,children:t.jsxs(j7e,{children:[t.jsx(Sn,{size:11})," ",n," credit",n===1?"":"s"]})})]}),t.jsx(_7e,{children:e.audit_message||e.audit_code||"Proposed fix"}),t.jsxs(C7e,{children:[e.audit_page_url&&t.jsxs(Mz,{children:[t.jsx(Rz,{children:"Page"}),t.jsxs(k7e,{href:e.audit_page_url,target:"_blank",rel:"noopener noreferrer",children:[t.jsx("span",{children:p7e(e.audit_page_url)}),t.jsx(as,{size:11})]})]}),e.audit_code&&t.jsxs(Mz,{children:[t.jsx(Rz,{children:"Code"}),t.jsx(S7e,{children:e.audit_code})]}),t.jsxs(Mz,{children:[t.jsx(Rz,{children:"Proposed"}),t.jsx("span",{children:o3(e.created_at)})]})]}),v&&t.jsxs($7e,{children:[t.jsx(ei,{size:12}),t.jsx("span",{children:v.message||`Could not act (${v.code||"error"})`})]}),m&&m.status!=="idle"&&t.jsx(O7e,{preview:m}),!s&&e.status==="pending"&&g&&t.jsxs(I7e,{children:[t.jsxs(N7e,{children:[t.jsxs(A7e,{type:"button",onClick:()=>k(A=>!A),disabled:x||w,"aria-haspopup":"menu","aria-expanded":$,children:[w?t.jsx(k5,{size:12}):t.jsx(Hc,{size:12}),t.jsx("span",{children:"Dismiss"}),t.jsx(qn,{size:11})]}),$&&t.jsx(u7e,{onSelect:S,onClose:()=>k(!1)})]}),h&&t.jsx(at,{content:i?"See exactly what this fix would change â no credits, no writes.":"Connect WordPress to preview this fix.",placement:"top",maxWidth:260,children:t.jsxs(V7e,{type:"button",onClick:()=>h(e),disabled:x||w||!i||m?.status==="requesting"||m?.status==="queued",children:[m?.status==="requesting"||m?.status==="queued"?t.jsx(k5,{size:12}):t.jsx(Dc,{size:12}),t.jsx("span",{children:m?.status==="requesting"?"Requestingâ¦":m?.status==="queued"?"Computingâ¦":m?.status==="succeeded"?"Refresh preview":"Preview"})]})}),t.jsx(at,{content:i?`Run the auto-fix now â costs ${n} credit${n===1?"":"s"}.`:"Connect WordPress (or wait for the next heartbeat) to accept this proposal.",placement:"top",maxWidth:260,children:t.jsxs(P7e,{type:"button",onClick:P,disabled:x||w||!i,children:[x?t.jsx(k5,{size:12}):t.jsx(Lm,{size:12}),t.jsx("span",{children:x?"Accepting...":"Accept & fix"})]})})]}),(s||e.status!=="pending")&&t.jsxs(E7e,{children:[t.jsxs(M7e,{$status:e.status,children:[m7e(e.status),t.jsx("span",{children:h7e(e.status,e.dismiss_reason)})]}),e.decided_at&&t.jsxs(R7e,{children:[t.jsx(qc,{size:11})," ",o3(e.decided_at)]})]})]})}const d7e=[{value:"wrong_fix",label:"Fix is wrong for this page"},{value:"manual_fix",label:"I'll fix this manually"},{value:"not_now",label:"Not now â ask again later"},{value:"dont_show_again",label:"Don't suggest this again"},{value:"other",label:"Other"}];function u7e({onSelect:e,onClose:n}){const i=l.useRef(null);return l.useEffect(()=>{const r=s=>{i.current&&s.target instanceof Node&&!i.current.contains(s.target)&&n()},o=s=>{s.key==="Escape"&&n()};return document.addEventListener("mousedown",r),document.addEventListener("keydown",o),()=>{document.removeEventListener("mousedown",r),document.removeEventListener("keydown",o)}},[n]),t.jsx(z7e,{ref:i,role:"menu",children:d7e.map(r=>
6047t.jsx(T7e,{type:"button",onClick:()=>e(r.value),children:r.label},r.value))})}function p7e(e){try{const n=new URL(e),i=n.pathname==="/"?"/":n.pathname.replace(/\/$/,"");return`${n.host}${i}`}catch{return e}}function o3(e){if(!e)return"";const n=new Date(e).getTime();if(!Number.isFinite(n))return"";const i=Date.now()-n,r=Math.floor(i/6e4);if(r<1)return"just now";if(r<60)return`${r}m ago`;const o=Math.floor(r/60);return o<24?`${o}h ago`:`${Math.floor(o/24)}d ago`}function m7e(e){switch(e){case"accepted":return t.jsx(co,{size:11});case"dismissed":return t.jsx(Hc,{size:11});case"stale":return t.jsx(qc,{size:11});case"expired":return t.jsx(qc,{size:11})}return null}function h7e(e,n){if(e==="accepted")return"Accepted â auto-fix queued";if(e==="stale")return"Archived â finding resolved itself";if(e==="expired")return"Expired";if(e==="dismissed"){switch(n){case"wrong_fix":return"Dismissed â wrong fix";case"manual_fix":return"Dismissed â fixing manually";case"not_now":return"Dismissed â snoozed";case"dont_show_again":return"Dismissed â muted"}return"Dismissed"}return e}const f7e=Tn` 6048 to { transform: rotate(360deg); } 6049`,k5=p(Tr).withConfig({displayName:"ProposalCard__Spinner",componentId:"sc-1438l42-0"})` 6050 animation: ${f7e} 0.8s linear infinite; 6051`,g7e=p.div.withConfig({displayName:"ProposalCard__Card",componentId:"sc-1438l42-1"})` 6052 border: 1px solid ${e=>e.$selected?Ft:V}; 6053 border-left: 3px solid ${e=>e.$sev==="high"?Ut:e.$sev==="medium"?$i:Rt}; 6054 background: ${e=>e.$selected?cn:Z}; 6055 border-radius: 0.75rem; 6056 padding: 0.85rem 1rem 0.95rem; 6057 display: grid; 6058 gap: 0.55rem; 6059 transition: background 120ms ease, border-color 120ms ease; 6060`,y7e=p.input.withConfig({displayName:"ProposalCard__SelectBox",componentId:"sc-1438l42-2"})` 6061 width: 1rem; 6062 height: 1rem; 6063 margin: 0 0.1rem 0 0; 6064 cursor: pointer; 6065 accent-color: ${Ft}; 6066`,x7e=p.div.withConfig({displayName:"ProposalCard__Header",componentId:"sc-1438l42-3"})` 6067 display: flex; 6068 align-items: center; 6069 gap: 0.4rem; 6070 flex-wrap: wrap; 6071`,b7e=p.div.withConfig({displayName:"ProposalCard__Spacer",componentId:"sc-1438l42-4"})` 6072 flex: 1; 6073`,OM=p.span.withConfig({displayName:"ProposalCard__Chip",componentId:"sc-1438l42-5"})` 6074 display: inline-flex; 6075 align-items: center; 6076 gap: 0.25rem; 6077 font-size: 0.62rem; 6078 font-weight: 800; 6079 text-transform: uppercase; 6080 letter-spacing: 0.04em; 6081 border-radius: 0.4rem; 6082 padding: 0.18rem 0.45rem; 6083`,v7e=p(OM).withConfig({displayName:"ProposalCard__SeverityChip",componentId:"sc-1438l42-6"})` 6084 background: ${e=>e.$sev==="high"?kn:e.$sev==="medium"?Jl:$e}; 6085 color: ${e=>e.$sev==="high"?sr:e.$sev==="medium"?$i:z}; 6086`,w7e=p(OM).withConfig({displayName:"ProposalCard__CategoryChip",componentId:"sc-1438l42-7"})` 6087 background: ${$e}; 6088 color: ${z}; 6089`,j7e=p(OM).withConfig({displayName:"ProposalCard__CostChip",componentId:"sc-1438l42-8"})` 6090 background: ${cn}; 6091 color: ${Ft}; 6092`,_7e=p.div.withConfig({displayName:"ProposalCard__Title",componentId:"sc-1438l42-9"})` 6093 color: ${O}; 6094 font-weight: 700; 6095 font-size: 0.875rem; 6096 line-height: 1.4; 6097`,C7e=p.div.withConfig({displayName:"ProposalCard__Meta",componentId:"sc-1438l42-10"})` 6098 display: grid; 6099 gap: 0.2rem; 6100`,Mz=p.div.withConfig({displayName:"ProposalCard__MetaRow",componentId:"sc-1438l42-11"})` 6101 display: flex; 6102 align-items: center; 6103 gap: 0.5rem; 6104 font-size: 0.7rem; 6105 color: ${z}; 6106 min-width: 0; 6107`,Rz=p.span.withConfig({displayName:"ProposalCard__MetaLabel",componentId:"sc-1438l42-12"})` 6108 text-transform: uppercase; 6109 letter-spacing: 0.04em; 6110 font-weight: 700; 6111 color: ${z}; 6112 flex-shrink: 0; 6113 width: 64px; 6114`,S7e=p.code.withConfig({displayName:"ProposalCard__Mono",componentId:"sc-1438l42-13"})` 6115 font-family: ui-monospace, SFMono-Regular, Menlo, monospace; 6116 font-size: 0.68rem; 6117 color: ${O}; 6118`,k7e=p.a.withConfig({displayName:"ProposalCard__PageLink",componentId:"sc-1438l42-14"})` 6119 display: inline-flex; 6120 align-items: center; 6121 gap: 0.3rem; 6122 color: ${Ft}; 6123 text-decoration: none; 6124 font-weight: 600; 6125 min-width: 0; 6126 & > span { 6127 overflow: hidden; 6128 text-overflow: ellipsis; 6129 white-space: nowrap; 6130 } 6131 &:hover { text-decoration: underline; } 6132`,$7e=p.div.withConfig({displayName:"ProposalCard__ErrorRow",componentId:"sc-1438l42-15"})` 6133 display: flex; 6134 align-items: center; 6135 gap: 0.35rem; 6136 font-size: 0.7rem; 6137 color: ${sr}; 6138 background: ${kn}; 6139 border-radius: 0.4rem; 6140 padding: 0.35rem 0.5rem; 6141`,I7e=p.div.withConfig({displayName:"ProposalCard__Actions",componentId:"sc-1438l42-16"})` 6142 display: flex; 6143 align-items: center; 6144 gap: 0.5rem; 6145 margin-top: 0.15rem; 6146`,DM=p.button.withConfig({displayName:"ProposalCard__BaseBtn",componentId:"sc-1438l42-17"})` 6147 display: inline-flex; 6148 align-items: center; 6149 gap: 0.35rem; 6150 padding: 0.4rem 0.7rem; 6151 font-family: inherit; 6152 font-size: 0.75rem; 6153 font-weight: 700; 6154 border-radius: 0.5rem; 6155 cursor: pointer; 6156 transition: filter 0.12s, transform 0.06s; 6157 &:active:enabled { transform: translateY(1px); }
6158 &:disabled { cursor: not-allowed; opacity: 0.6; } 6159`,P7e=p(DM).withConfig({displayName:"ProposalCard__AcceptBtn",componentId:"sc-1438l42-18"})` 6160 background: ${ot}; 6161 color: ${Z}; 6162 border: 1px solid ${ot}; 6163 &:hover:enabled { background: ${Ft}; border-color: ${Ft}; } 6164`,A7e=p(DM).withConfig({displayName:"ProposalCard__DismissBtn",componentId:"sc-1438l42-19"})` 6165 background: ${Z}; 6166 color: ${O}; 6167 border: 1px solid ${V}; 6168 &:hover:enabled { background: ${At}; } 6169`,N7e=p.div.withConfig({displayName:"ProposalCard__DismissWrap",componentId:"sc-1438l42-20"})` 6170 position: relative; 6171`,z7e=p.div.withConfig({displayName:"ProposalCard__Menu",componentId:"sc-1438l42-21"})` 6172 position: absolute; 6173 top: calc(100% + 4px); 6174 left: 0; 6175 z-index: 20; 6176 background: ${Z}; 6177 border: 1px solid ${V}; 6178 border-radius: 0.5rem; 6179 box-shadow: ${Y_}; 6180 padding: 0.25rem; 6181 min-width: 220px; 6182`,T7e=p.button.withConfig({displayName:"ProposalCard__MenuItem",componentId:"sc-1438l42-22"})` 6183 display: block; 6184 width: 100%; 6185 text-align: left; 6186 background: transparent; 6187 border: 0; 6188 padding: 0.45rem 0.55rem; 6189 border-radius: 0.35rem; 6190 font-size: 0.78rem; 6191 color: ${O}; 6192 cursor: pointer; 6193 &:hover { background: ${At}; } 6194`,E7e=p.div.withConfig({displayName:"ProposalCard__DecidedRow",componentId:"sc-1438l42-23"})` 6195 display: flex; 6196 align-items: center; 6197 gap: 0.5rem; 6198 margin-top: 0.1rem; 6199`,M7e=p.span.withConfig({displayName:"ProposalCard__DecidedBadge",componentId:"sc-1438l42-24"})` 6200 display: inline-flex; 6201 align-items: center; 6202 gap: 0.3rem; 6203 font-size: 0.68rem; 6204 font-weight: 700; 6205 text-transform: uppercase; 6206 letter-spacing: 0.03em; 6207 padding: 0.25rem 0.5rem; 6208 border-radius: 0.4rem; 6209 background: ${e=>e.$status==="accepted"?si:(e.$status==="dismissed",$e)}; 6210 color: ${e=>e.$status==="accepted"?Vt:(e.$status==="dismissed",z)}; 6211`,R7e=p.span.withConfig({displayName:"ProposalCard__DecidedWhen",componentId:"sc-1438l42-25"})` 6212 display: inline-flex; 6213 align-items: center; 6214 gap: 0.25rem; 6215 font-size: 0.68rem; 6216 color: ${z}; 6217`;function O7e({preview:e}){if(e.status==="requesting"||e.status==="queued")return t.jsxs(Oz,{$tone:"info",children:[t.jsxs(Dz,{children:[t.jsx(k5,{size:11}),t.jsx("span",{children:e.status==="requesting"?"Asking the pluginâ¦":"Computing previewâ¦"})]}),t.jsx(Lz,{children:"Free of credit charge. Result lands as soon as your WordPress site polls the next job (usually under a minute)."})]});if(e.status==="failed")return t.jsxs(Oz,{$tone:"error",children:[t.jsxs(Dz,{children:[t.jsx(ei,{size:11}),t.jsx("span",{children:"Preview failed"})]}),t.jsx(Lz,{children:e.errorMessage||e.errorCode||"Unknown error"})]});if(e.status==="succeeded"){const n=D7e(e.preview),i=e.generatedAt?o3(e.generatedAt):null;return t.jsxs(Oz,{$tone:"ok",children:[t.jsxs(Dz,{children:[t.jsx(co,{size:11}),t.jsx("span",{children:"Preview ready â nothing was changed yet"}),i&&t.jsxs(B7e,{children:["· generated ",i]})]}),n.length===0?t.jsx(Lz,{children:"The plugin returned no diff (already matches the proposed value)."}):t.jsx(F7e,{children:n.map(r=>t.jsxs(W7e,{children:[t.jsx(U7e,{children:r.label}),t.jsx(at,{content:r.prior||"(empty)",placement:"top",maxWidth:420,children:t.jsx(H7e,{children:r.prior?.length?r.prior:t.jsx("em",{children:"(empty)"})})}),t.jsx(q7e,{children:"â"}),t.jsx(at,{content:r.proposed||"(empty)",placement:"top",maxWidth:420,children:t.jsx(G7e,{children:r.proposed?.length?r.proposed:t.jsx("em",{children:"(empty)"})})})]},r.label))})]})}return null}function D7e(e){if(!e)return[];const n=e.prior??{},i=e.proposed??{},r=new Set([...Object.keys(n||{}),...Object.keys(i||{})]),o=new Set(["applied_via","word_count","has_image","card_type","card","fields"]);return Array.from(r).filter(s=>!o.has(s)).map(s=>({label:L7e(s),prior:bW(n[s]),proposed:bW(i[s])}))}function L7e(e){switch(e){case"value":return"Value";case"title":return"Title";case"description":return"Description";case"image":return"Image";case"card":return"Card type";default:return e.replace(/_/g," ").replace(/\b\w/g,n=>n.toUpperCase())}}function bW(e){if(e==null)return"";if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean")return String(e);try{return JSON.stringify(e)}catch{return""}}const Oz=p.div.withConfig({displayName:"ProposalCard__PreviewWrap",componentId:"sc-1438l42-26"})` 6218 display: grid; 6219 gap: 0.4rem; 6220 background: ${e=>
6220e.$tone==="ok"?si:e.$tone==="error"?kn:At}; 6221 border: 1px solid ${e=>e.$tone==="ok"?Vt:e.$tone==="error"?Ut:V}; 6222 border-radius: 0.5rem; 6223 padding: 0.55rem 0.7rem; 6224`,Dz=p.div.withConfig({displayName:"ProposalCard__PreviewHeader",componentId:"sc-1438l42-27"})` 6225 display: inline-flex; 6226 align-items: center; 6227 gap: 0.35rem; 6228 font-size: 0.7rem; 6229 font-weight: 700; 6230 text-transform: uppercase; 6231 letter-spacing: 0.04em; 6232 color: ${O}; 6233`,Lz=p.div.withConfig({displayName:"ProposalCard__PreviewHint",componentId:"sc-1438l42-28"})` 6234 font-size: 0.7rem; 6235 color: ${z}; 6236 line-height: 1.4; 6237`,B7e=p.span.withConfig({displayName:"ProposalCard__PreviewStamp",componentId:"sc-1438l42-29"})` 6238 font-size: 0.62rem; 6239 font-weight: 600; 6240 text-transform: none; 6241 letter-spacing: 0; 6242 color: ${z}; 6243 margin-left: 0.1rem; 6244`,F7e=p.div.withConfig({displayName:"ProposalCard__DiffGrid",componentId:"sc-1438l42-30"})` 6245 display: grid; 6246 gap: 0.35rem; 6247`,W7e=p.div.withConfig({displayName:"ProposalCard__DiffRow",componentId:"sc-1438l42-31"})` 6248 display: grid; 6249 grid-template-columns: 80px minmax(0, 1fr) 14px minmax(0, 1fr); 6250 gap: 0.4rem; 6251 align-items: start; 6252 font-size: 0.72rem; 6253`,U7e=p.span.withConfig({displayName:"ProposalCard__DiffLabel",componentId:"sc-1438l42-32"})` 6254 text-transform: uppercase; 6255 letter-spacing: 0.04em; 6256 font-weight: 700; 6257 color: ${z}; 6258 font-size: 0.62rem; 6259 padding-top: 0.18rem; 6260`,H7e=p.div.withConfig({displayName:"ProposalCard__DiffPrior",componentId:"sc-1438l42-33"})` 6261 background: ${Z}; 6262 border: 1px solid ${V}; 6263 border-radius: 0.35rem; 6264 padding: 0.3rem 0.4rem; 6265 color: ${z}; 6266 text-decoration: line-through; 6267 text-decoration-color: ${Rt}; 6268 word-break: break-word; 6269 white-space: pre-wrap; 6270`,q7e=p.div.withConfig({displayName:"ProposalCard__DiffArrow",componentId:"sc-1438l42-34"})` 6271 color: ${Rt}; 6272 text-align: center; 6273 padding-top: 0.2rem; 6274 font-weight: 700; 6275`,G7e=p.div.withConfig({displayName:"ProposalCard__DiffProposed",componentId:"sc-1438l42-35"})` 6276 background: ${Z}; 6277 border: 1px solid ${Vt}; 6278 border-radius: 0.35rem; 6279 padding: 0.3rem 0.4rem; 6280 color: ${O}; 6281 font-weight: 600; 6282 word-break: break-word; 6283 white-space: pre-wrap; 6284`,V7e=p(DM).withConfig({displayName:"ProposalCard__PreviewBtn",componentId:"sc-1438l42-36"})` 6285 background: ${Z}; 6286 color: ${Ft}; 6287 border: 1px solid ${cn}; 6288 &:hover:enabled { background: ${cn}; } 6289`;function K7e({draft:e,estimatedCreditsPerPublish:n,estimatedCreditsPerGeneration:i=0,connectorAlive:r,onFetchBody:o,onApprove:s,onDismiss:a,onRegenerate:c,readonly:u,selectable:m,selected:h,onToggleSelect:g,onRevertPublish:x,isRevertPending:y,canManage:w=!0}){const j=i>0?i:null,v=j?`${j} credit${j===1?"":"s"}`:null,_=!!e.mutation_kind,[$,k]=l.useState(!1),[P,S]=l.useState(!1),[I,A]=l.useState(e.body_html??null),[E,B]=l.useState(e.original_body_html??null),[T,M]=l.useState("after"),[R,F]=l.useState(!1),[Y,H]=l.useState(!1),[U,X]=l.useState(!1),[Q,K]=l.useState(!1),[G,L]=l.useState(e.wp_post_status||"draft"),[q,W]=l.useState(null),oe=l.useRef({id:e.id,updated_at:e.updated_at});l.useEffect(()=>{(oe.current.id!==e.id||oe.current.updated_at!==e.updated_at)&&(A(e.body_html??null),B(e.original_body_html??null),oe.current={id:e.id,updated_at:e.updated_at})},[e.id,e.updated_at,e.body_html,e.original_body_html]);const se=l.useCallback(async()=>{const ce=!$;if(k(ce),ce&&(!I||_&&!E)&&e.status!=="pending_generation"&&e.status!=="regenerating"){S(!0);const Re=await o(e.id);A(Re?.body??null),B(Re?.originalBody??null),S(!1)}},[$,I,E,_,e.id,e.status,o]),de=l.useCallback(async()=>{if(!(R||Y||U)){W(null),F(!0);try{const ce=await s(e.id,{wpPostStatus:G});ce.ok||W({code:ce.errorCode,message:ce.message})}finally{F(!1)}}},[R,Y,U,e.id,s,G]),le=l.useCallback(async ce=>{if(!(R||Y||U)){K(!1),W(null),H(!0);try{const ie=await a(e.id,ce);ie.ok||W({code:ie.errorCode,message:ie.message})}finally{H(!1)}}},[R,Y,U,e.id,a]),me=l.useCallback(async()=>{if(!(R||Y||U)){W(null),X(!0);try{const ce=await c(e.id);ce.ok||W({code:ce.errorCode,message:ce.message})}finally{X(!1)}}},[R,Y,U,e.id,c]),ee=e.status==="pending_generation"||e.status==="regenerating",ne=e.status==="approved"||e.status==="publishing",Ae=e.status==="pending_review",_e=e.status==="failed",we=!u&&(Ae||_e)&&w,Ke=l.useMemo(()=>e4e(e.status),[e.status]);return t.jsxs(r4e,{$sev:e.status,$selected:!!h,children:[t.jsxs(s4e,{children:[m&&Ae&&!u&&w&&t.jsx(o4e,{type:"checkbox",checked:!!h,onChange:ce=>g?.(e,ce.target.checked),"aria-label":`Select draft ${e.id}`}),t.jsxs(a4e,{$tone:Ke.tone,children:[Ke.icon,t.jsx("span",{children:Ke.label})]}),t.jsx(l4e,{children:e.post_type}),e.wp_post_status&&t.jsxs(c4e,{children:["WP: ",e.wp_post_status]}),t.jsx(wW,{}),!u&&Ae&&t.jsx(at,{content:`Approving will spend ${n} credit${n===1?"":"s"}`,placement:"top",maxWidth:280,children:t.jsxs(d4e,{children:[t.jsx(Sn,{size:11})," ",n," credit",n===1?"":"s"]})})]}),!_&&t.jsx(u4e,{children:e.title||(ee?"Draftingâ¦":"(untitled draft)")}),_&&t.jsxs(N4e,{children:[t.jsx(Lc,{size:14}),t.jsxs("span",{children:[t.jsx("strong",{children:"Rewrite proposed"})," â the Content Agent has drafted a revised body for an existing post to fix an audit finding."]})]}),e.excerpt&&t.jsx(p4e,{children:e.excerpt}),_&&e.audit_action&&t.jsxs(z4e,{$sev:e.audit_action.severity,children:[t.jsxs(T4e,{children:[t.jsx(E4e,{$s:e.audit_action.severity,children:e.audit_action.severity}),t.jsx(M4e,{children:e.audit_action.code}),t.jsx("span",{children:e.audit_action.category}),t.jsx(wW,{}),e.audit_action.page_url&&t.jsxs(R4e,{href:e.audit_action.page_url,target:"_blank",rel:"noopener noreferrer",title:e.audit_action.page_url,children:[t.jsx(as,{size:11}),t.jsx("span",{children:Z7e(e.audit_action.page_url)})]})]}),t.jsx(O4e,{children:e.audit_action.message}),e.audit_action.fix&&t.jsxs(D4e,{children:[t.jsx("strong",{children:"Fix:"})," ",e.audit_action.fix]}),vW(e.audit_action.evidence).length>0&&t.jsx(L4e,{children:vW(e.audit_action.evidence).map(({label:ce,value:ie})=>t.jsxs(B4e,{children:[t.jsx(F4e,{children:ce}),t.jsx(W4e,{children:ie})]},ce))})]}),_&&e.revision_summary&&t.jsxs(U4e,{children:[t.jsx(Sn,{size:11}),t.jsx("span",{children:e.revision_summary})]}),t.jsxs(m4e,{children:[e.slug&&!_&&t.jsxs(Ak,{children:[t.jsx(Nk,{children:"Slug"}),t.jsxs(h4e,{children:["/",e.slug]})]}),e.meta_description&&!_&&t.jsxs(Ak,{children:[t.jsx(Nk,{children:"Meta"}),t.jsx("span",{children:e.meta_description})]}),!_&&(e.suggested_categories?.length||e.suggested_tags?.length)?t.jsxs(Ak,{children:[t.jsx(Nk,{children:"Tags"}),t.jsxs(f4e,{children:[e.suggested_categories?.map(ce=>t.jsx(jW,{$tone:"brand",children:ce},`c-${ce}`)),e.suggested_tags?.map(ce=>t.jsxs(jW,{children:["#",ce]},`t-${ce}`))]})]}):null,t.jsxs(Ak,{children:[t.jsx(Nk,{children:"Generated"}),t.jsx("span",{children:Bz(e.generated_at)||Bz(e.created_at)})]})]}),!ee&&(e.title||I||_)&&t.jsxs(g4e,{type:"button",onClick:se,"aria-expanded":$,children:[$?t.jsx(yu,{size:13}):t.jsx(qn,{size:13}),t.jsx("span",{children:$?"Hide preview":_?"Compare body":"Preview body"}),P&&t.jsx($g,{size:12})]}),$&&t.jsxs(t.Fragment,{children:[_&&t.jsxs(H4e,{role:"tablist","aria-label":"Diff view",children:[t.jsx(Wz,{type:"button",role:"tab","aria-selected":T==="before",$active:T==="before",onClick:()=>M("before"),children:"Before"}),t.jsx(Wz,{type:"button",role:"tab","aria-selected":T==="after",$active:T==="after",onClick:()=>M("after"),children:"After"}),t.jsxs(Wz,{type:"button",role:"tab","aria-selected":T==="split",$active:T==="split",onClick:()=>M("split"),children:[t.jsx(Hye,{size:11})," Split"]}),(E||I)&&t.jsxs(q4e,{children:[lx(E)," â ",lx(I)," words",t.jsx(H8,{size:10}),t.jsx(G4e,{$delta:lx(I)-lx(E),children:Q7e(lx(I)-lx(E))})]})]}),_&&T==="split"?t.jsxs(V4e,{children:[t.jsxs(IW,{children:[t.jsx(PW,{children:"Before"}),t.jsx(Fz,{children:P?t.jsx(Ig,{children:"Loadingâ¦"}):E?t.jsx(zk,{dangerouslySetInnerHTML:{__html:E}}):t.jsx(Ig,{children:"No prior body available."})})]}),t.jsxs(IW,{children:[t.jsx(PW,{$accent:!0,children:"After"}),t.jsx(Fz,{children:P?t.jsx(Ig,{children:"Loadingâ¦"}):I?t.jsx(zk,{dangerouslySetInnerHTML:{__html:I}}):t.jsx(Ig,{children:"No body available yet."})})]})]}):t.jsx(Fz,{children:P?t.jsx(Ig,{children:"Loadingâ¦"}):_&&T==="before"?E?t.jsx(zk,{dangerouslySetInnerHTML:{__html:E}}):t.jsx(Ig,{children:"No prior body available."}):I?t.jsx(zk,{dangerouslySetInnerHTML:{__html:I}}):t.jsx(Ig,{children:"No body available yet."})})]}),ee&&t.jsxs(_W,{children:[t.jsx($g,{size:12}),t.jsx("span",{children:"Drafting with the Content Agent â this usually takes 20-60s."})]}),ne&&t.jsxs(_W,{children:[t.jsx($g,{size:12}
6289),t.jsx("span",{children:_?"Updating the live post in WordPress.":`Publishing to WordPress as â${e.wp_post_status}â.`})]}),e.status==="published"&&(e.wp_permalink||e.wp_edit_url)&&t.jsxs(y4e,{children:[e.wp_edit_url&&t.jsxs(CW,{href:e.wp_edit_url,target:"_blank",rel:"noopener noreferrer",children:[t.jsx(as,{size:11}),"Open in WordPress"]}),e.wp_permalink&&t.jsxs(CW,{href:e.wp_permalink,target:"_blank",rel:"noopener noreferrer",children:[t.jsx(as,{size:11}),"View live URL"]}),!u&&w&&e.publish_revertable&&e.publish_operation_id&&!e.publish_reverted_at&&x&&t.jsx(at,{content:"Move the published WordPress post back to draft / trash",placement:"top",maxWidth:280,disabled:!!(y&&y(e.publish_operation_id)),children:t.jsxs(x4e,{type:"button",onClick:()=>x?.(e.publish_operation_id),disabled:!!(y&&y(e.publish_operation_id)),children:[t.jsx(J8,{size:11}),y&&y(e.publish_operation_id)?"Unpublishingâ¦":"Unpublish"]})}),e.publish_reverted_at&&t.jsx(b4e,{children:"Reverted"})]}),_e&&e.generation_error&&t.jsxs(SW,{children:[t.jsx(ei,{size:12}),t.jsx("span",{children:e.generation_error})]}),q&&t.jsxs(SW,{children:[t.jsx(ei,{size:12}),t.jsx("span",{children:q.message||`Could not act (${q.code||"error"})`})]}),we&&t.jsxs(v4e,{children:[t.jsxs(S4e,{children:[t.jsxs(C4e,{type:"button",onClick:()=>K(ce=>!ce),disabled:R||Y||U,"aria-haspopup":"menu","aria-expanded":Q,children:[Y?t.jsx($g,{size:12}):t.jsx(Hc,{size:12}),t.jsx("span",{children:"Dismiss"}),t.jsx(qn,{size:11})]}),Q&&t.jsx(X7e,{onSelect:le,onClose:()=>K(!1)})]}),t.jsx(at,{content:v?`Generate a fresh draft (${v}). The current one becomes archived (visible in History).`:"Generate a fresh draft. The current one becomes archived (visible in History).",placement:"top",maxWidth:280,children:t.jsxs(j4e,{type:"button",onClick:me,disabled:R||Y||U,children:[U?t.jsx($g,{size:12}):t.jsx(No,{size:12}),t.jsx("span",{children:U?"Regeneratingâ¦":"Regenerate"}),v&&!U&&t.jsxs(_4e,{children:["· ",v]})]})}),Ae&&!_&&t.jsxs(kW,{children:[t.jsxs(w4e,{value:G,onChange:ce=>L(ce.target.value),disabled:R,"aria-label":"WordPress post status",children:[t.jsx("option",{value:"draft",children:"As Draft"}),t.jsx("option",{value:"pending",children:"For Review"}),t.jsx("option",{value:"publish",children:"Publish Live"})]}),t.jsx(at,{content:r?`Send to WordPress as ${G==="publish"?"a LIVE post":`"${G}"`} â costs ${n} credit${n===1?"":"s"}.`:"Connect WordPress (or wait for the next heartbeat) to approve this draft.",placement:"top",maxWidth:280,children:t.jsxs($W,{type:"button",onClick:de,disabled:R||Y||U||!r,$danger:G==="publish",children:[R?t.jsx($g,{size:12}):G==="publish"?t.jsx(_9,{size:12}):t.jsx(Lm,{size:12}),t.jsx("span",{children:R?"Sendingâ¦":G==="publish"?"Approve & publish live":"Approve & send"})]})})]}),Ae&&_&&t.jsx(kW,{children:t.jsx(at,{content:r?`Replace the live post body in WordPress â costs ${n} credit${n===1?"":"s"}. The existing post keeps its current status; you can revert from the activity feed.`:"Connect WordPress (or wait for the next heartbeat) to approve this rewrite.",placement:"top",maxWidth:320,children:t.jsxs($W,{type:"button",onClick:de,disabled:R||Y||U||!r,$danger:!0,$standalone:!0,children:[R?t.jsx($g,{size:12}):t.jsx(_9,{size:12}),t.jsx("span",{children:R?"Updatingâ¦":"Approve & update post"})]})})})]}),(u||e.terminal)&&t.jsxs(I4e,{children:[t.jsxs(P4e,{$status:e.status,children:[t4e(e.status),t.jsx("span",{children:n4e(e)})]}),(e.decided_at||e.approved_at)&&t.jsxs(A4e,{children:[t.jsx(qc,{size:11})," ",Bz(e.decided_at||e.approved_at)]})]})]})}const Y7e=[{value:"low_quality",label:"Quality is too low"},{value:"off_brand",label:"Doesn't match the brand voice"},{value:"wrong_topic",label:"Wrong topic / angle"},{value:"manual_fix",label:"I'll write this myself"},{value:"not_now",label:"Not now â try again later"},{value:"dont_show_again",label:"Don't suggest this again"},{value:"other",label:"Other"}];function X7e({onSelect:e,onClose:n}){const i=l.useRef(null);return l.useEffect(()=>{const r=s=>{i.current&&s.target instanceof Node&&!i.current.contains(s.target)&&n()},o=s=>{s.key==="Escape"&&n()};return document.addEventListener("mousedown",r),document.addEventListener("keydown",o),()=>{document.removeEventListener("mousedown",r),document.removeEventListener("keydown",o)}},[n]),t.jsx(k4e,{ref:i,role:"menu",children:Y7e.map(r=>
6289t.jsx($4e,{type:"button",onClick:()=>e(r.value),children:r.label},r.value))})}function lx(e){if(!e)return 0;const n=e.replace(/<[^>]+>/g," ").replace(/ /g," ").replace(/\s+/g," ").trim();return n?n.split(" ").length:0}function Q7e(e){return e===0?"±0":e>0?`+${e}`:`${e}`}function Z7e(e){try{const n=new URL(e),i=n.pathname.replace(/\/$/,"")||"/",r=i.length>60?`â¦${i.slice(-58)}`:i;return`${n.host}${r}`}catch{return e.length>80?`${e.slice(0,78)}â¦`:e}}const J7e=[{key:"word_count",label:"Words"},{key:"min_word_target",label:"Target"},{key:"flesch_score",label:"Readability",format:e=>Number.isFinite(Number(e))?Number(e).toFixed(1):String(e)},{key:"max_paragraph_len",label:"Longest ¶"},{key:"avg_paragraph_len",label:"Avg ¶"},{key:"paragraph_count",label:"Paragraphs"},{key:"list_count",label:"Lists"},{key:"heading_count",label:"Headings"},{key:"qa_pairs",label:"Q&A pairs"},{key:"weak_qa_pairs",label:"Weak Q&A"},{key:"definition_words",label:"Def. words"}];function vW(e){if(!e||typeof e!="object")return[];const n=[];for(const{key:i,label:r,format:o}of J7e){if(!(i in e))continue;const s=e[i];s==null||s===""||n.push({label:r,value:o?o(s):String(s)})}return n}function Bz(e){if(!e)return"";const n=new Date(e).getTime();if(!Number.isFinite(n))return"";const i=Date.now()-n,r=Math.floor(i/6e4);if(r<1)return"just now";if(r<60)return`${r}m ago`;const o=Math.floor(r/60);return o<24?`${o}h ago`:`${Math.floor(o/24)}d ago`}function e4e(e){switch(e){case"pending_generation":case"regenerating":return{label:e==="regenerating"?"Regenerating":"Drafting",tone:"brand",icon:t.jsx(Tr,{size:11})};case"pending_review":return{label:"Review needed",tone:"warning",icon:t.jsx(Ss,{size:11})};case"approved":return{label:"Approved",tone:"brand",icon:t.jsx(co,{size:11})};case"publishing":return{label:"Publishing",tone:"brand",icon:t.jsx(Tr,{size:11})};case"published":return{label:"Published",tone:"success",icon:t.jsx(co,{size:11})};case"failed":return{label:"Failed",tone:"danger",icon:t.jsx(ei,{size:11})};case"dismissed":return{label:"Dismissed",tone:"neutral",icon:t.jsx(Hc,{size:11})};case"superseded":return{label:"Superseded",tone:"neutral",icon:t.jsx(qc,{size:11})}}return{label:e,tone:"neutral",icon:null}}function t4e(e){switch(e){case"published":return t.jsx(co,{size:11});case"failed":return t.jsx(ei,{size:11});case"dismissed":return t.jsx(Hc,{size:11});case"superseded":return t.jsx(qc,{size:11})}return null}function n4e(e){switch(e.status){case"published":return e.wp_post_status==="publish"?"Published live in WordPress":`Sent to WordPress as ${e.wp_post_status}`;case"failed":return"Failed â see error above";case"dismissed":switch(e.dismiss_reason){case"low_quality":return"Dismissed â quality too low";case"off_brand":return"Dismissed â off-brand";case"wrong_topic":return"Dismissed â wrong angle";case"manual_fix":return"Dismissed â writing manually";case"not_now":return"Dismissed â snoozed";case"dont_show_again":return"Dismissed â muted"}return"Dismissed";case"superseded":return"Replaced by a newer draft"}return e.status}const i4e=Tn` 6290 to { transform: rotate(360deg); } 6291`,$g=p(Tr).withConfig({displayName:"ContentDraftCard__Spinner",componentId:"sc-1ucif4y-0"})` 6292 animation: ${i4e} 0.8s linear infinite; 6293`,r4e=p.div.withConfig({displayName:"ContentDraftCard__Card",componentId:"sc-1ucif4y-1"})` 6294 border: 1px solid ${e=>e.$selected?Ft:V}; 6295 border-left: 3px solid ${e=>e.$sev==="failed"?Ut:e.$sev==="published"?Vt:e.$sev==="pending_review"?$i:e.$sev==="publishing"||e.$sev==="approved"||e.$sev==="regenerating"||e.$sev==="pending_generation"?ot:Rt}; 6296 background: ${e=>e.$selected?cn:Z}; 6297 border-radius: 0.75rem; 6298 padding: 0.85rem 1rem 0.95rem; 6299 display: grid; 6300 gap: 0.55rem; 6301 transition: background 120ms ease, border-color 120ms ease; 6302`,o4e=p.input.withConfig({displayName:"ContentDraftCard__SelectBox",componentId:"sc-1ucif4y-2"})` 6303 width: 1rem; 6304 height: 1rem; 6305 margin: 0 0.1rem 0 0; 6306 cursor: pointer; 6307 accent-color: ${Ft}; 6308`,s4e=p.div.withConfig({displayName:"ContentDraftCard__Header",componentId:"sc-1ucif4y-3"})` 6309 display: flex; 6310 align-items: center; 6311 gap: 0.4rem; 6312 flex-wrap: wrap; 6313`,wW=p.div.withConfig({displayName:"ContentDraftCard__Spacer",componentId:"sc-1ucif4y-4"})` 6314 flex: 1; 6315`,OP=p.span.withConfig({displayName:"ContentDraftCard__Chip",componentId:"sc-1ucif4y-5"})` 6316 display: inline-flex; 6317 align-items: center; 6318 gap: 0.25rem; 6319 font-size: 0.62rem; 6320 font-weight: 800; 6321 text-transform: uppercase; 6322 letter-spacing: 0.04em; 6323 border-radius: 0.4rem; 6324 padding: 0.18rem 0.45rem; 6325`,a4e=p(OP).withConfig({displayName:"ContentDraftCard__StatusChip",componentId:"sc-1ucif4y-6"})` 6326 background: ${e=>
6326e.$tone==="warning"?Jl:e.$tone==="success"?si:e.$tone==="danger"?kn:e.$tone==="brand"?cn:$e}; 6327 color: ${e=>e.$tone==="warning"?$i:e.$tone==="success"?Vt:e.$tone==="danger"?sr:e.$tone==="brand"?Ft:z}; 6328`,l4e=p(OP).withConfig({displayName:"ContentDraftCard__PostTypeChip",componentId:"sc-1ucif4y-7"})` 6329 background: ${$e}; 6330 color: ${z}; 6331`,c4e=p(OP).withConfig({displayName:"ContentDraftCard__PostStatusChip",componentId:"sc-1ucif4y-8"})` 6332 background: ${$e}; 6333 color: ${z}; 6334`,d4e=p(OP).withConfig({displayName:"ContentDraftCard__CostChip",componentId:"sc-1ucif4y-9"})` 6335 background: ${cn}; 6336 color: ${Ft}; 6337`,u4e=p.div.withConfig({displayName:"ContentDraftCard__Title",componentId:"sc-1ucif4y-10"})` 6338 color: ${O}; 6339 font-weight: 700; 6340 font-size: 0.95rem; 6341 line-height: 1.4; 6342`,p4e=p.p.withConfig({displayName:"ContentDraftCard__Excerpt",componentId:"sc-1ucif4y-11"})` 6343 margin: 0; 6344 color: ${z}; 6345 font-size: 0.82rem; 6346 line-height: 1.5; 6347`,m4e=p.div.withConfig({displayName:"ContentDraftCard__Meta",componentId:"sc-1ucif4y-12"})` 6348 display: grid; 6349 gap: 0.2rem; 6350`,Ak=p.div.withConfig({displayName:"ContentDraftCard__MetaRow",componentId:"sc-1ucif4y-13"})` 6351 display: flex; 6352 align-items: center; 6353 gap: 0.5rem; 6354 font-size: 0.72rem; 6355 color: ${z}; 6356 min-width: 0; 6357`,Nk=p.span.withConfig({displayName:"ContentDraftCard__MetaLabel",componentId:"sc-1ucif4y-14"})` 6358 text-transform: uppercase; 6359 letter-spacing: 0.04em; 6360 font-weight: 700; 6361 color: ${z}; 6362 flex-shrink: 0; 6363 width: 64px; 6364`,h4e=p.code.withConfig({displayName:"ContentDraftCard__Mono",componentId:"sc-1ucif4y-15"})` 6365 font-family: ui-monospace, SFMono-Regular, Menlo, monospace; 6366 font-size: 0.72rem; 6367 color: ${O}; 6368`,f4e=p.div.withConfig({displayName:"ContentDraftCard__ChipRow",componentId:"sc-1ucif4y-16"})` 6369 display: flex; 6370 flex-wrap: wrap; 6371 gap: 0.25rem; 6372`,jW=p.span.withConfig({displayName:"ContentDraftCard__SmallChip",componentId:"sc-1ucif4y-17"})` 6373 display: inline-flex; 6374 align-items: center; 6375 font-size: 0.65rem; 6376 font-weight: 600; 6377 border-radius: 0.4rem; 6378 padding: 0.1rem 0.35rem; 6379 background: ${e=>e.$tone==="brand"?cn:$e}; 6380 color: ${e=>e.$tone==="brand"?Ft:z}; 6381`,g4e=p.button.withConfig({displayName:"ContentDraftCard__BodyToggle",componentId:"sc-1ucif4y-18"})` 6382 appearance: none; 6383 background: transparent; 6384 border: 0; 6385 color: ${Ft}; 6386 font-size: 0.78rem; 6387 font-weight: 700; 6388 cursor: pointer; 6389 display: inline-flex; 6390 align-items: center; 6391 gap: 0.3rem; 6392 padding: 0.15rem 0; 6393 align-self: flex-start; 6394 &:hover { text-decoration: underline; } 6395`,Fz=p.div.withConfig({displayName:"ContentDraftCard__BodyPreview",componentId:"sc-1ucif4y-19"})` 6396 border: 1px solid ${V}; 6397 border-radius: 0.5rem; 6398 padding: 0.85rem 1rem; 6399 max-height: 360px; 6400 overflow: auto; 6401 background: ${At}; 6402`,Ig=p.div.withConfig({displayName:"ContentDraftCard__BodyLoading",componentId:"sc-1ucif4y-20"})` 6403 color: ${z}; 6404 font-size: 0.8rem; 6405 text-align: center; 6406 padding: 1rem 0; 6407`,zk=p.div.withConfig({displayName:"ContentDraftCard__BodyHtml",componentId:"sc-1ucif4y-21"})` 6408 font-size: 0.85rem; 6409 line-height: 1.6; 6410 color: ${O}; 6411 & h2 { font-size: 1rem; margin: 1rem 0 0.4rem; font-weight: 800; } 6412 & h3 { font-size: 0.9rem; margin: 0.75rem 0 0.35rem; font-weight: 700; } 6413 & p { margin: 0.4rem 0; } 6414 & ul, & ol { margin: 0.4rem 0 0.4rem 1.25rem; } 6415 & a { color: ${Ft}; text-decoration: underline; } 6416`,_W=p.div.withConfig({displayName:"ContentDraftCard__InlineNote",componentId:"sc-1ucif4y-22"})` 6417 display: inline-flex; 6418 align-items: center; 6419 gap: 0.4rem; 6420 font-size: 0.75rem; 6421 color: ${z}; 6422 background: ${At}; 6423 border: 1px dashed ${V}; 6424 padding: 0.35rem 0.55rem; 6425 border-radius: 0.4rem; 6426`,y4e=p.div.withConfig({displayName:"ContentDraftCard__PermalinkRow",componentId:"sc-1ucif4y-23"})` 6427 display: flex; 6428 flex-wrap: wrap; 6429 gap: 0.5rem; 6430`,CW=p.a.withConfig({displayName:"ContentDraftCard__PermalinkLink",componentId:"sc-1ucif4y-24"})` 6431 display: inline-flex; 6432 align-items: center; 6433 gap: 0.3rem; 6434 background: ${si}; 6435 color: ${Vt}; 6436 font-size: 0.72rem; 6437 font-weight: 700; 6438 padding: 0.3rem 0.55rem; 6439 border-radius: 0.4rem; 6440 text-decoration: none; 6441 &:hover { filter: brightness(0.92); } 6442`,x4e=p.button.withConfig({displayName:"ContentDraftCard__PermalinkButton",componentId:"sc-1ucif4y-25"})` 6443 display: inline-flex; 6444 align-items: center; 6445 gap: 0.3rem; 6446 background: ${Z}; 6447 color: ${O}; 6448 border: 1px solid ${V}; 6449 font-size: 0.72rem; 6450 font-weight: 700; 6451 padding: 0.3rem 0.55rem; 6452 border-radius: 0.4rem; 6453 cursor: pointer; 6454 transition: background 120ms ease, border-color 120ms ease; 6455 &:hover:not(:disabled) { 6456 background: ${$e}; 6457 border-color: ${z}; 6458 } 6459 &:disabled { opacity: 0.55;
6459 cursor: not-allowed; } 6460`,b4e=p.span.withConfig({displayName:"ContentDraftCard__RevertedTag",componentId:"sc-1ucif4y-26"})` 6461 display: inline-flex; 6462 align-items: center; 6463 padding: 0.3rem 0.55rem; 6464 border-radius: 0.4rem; 6465 background: ${$e}; 6466 color: ${O}; 6467 font-size: 0.72rem; 6468 font-weight: 700; 6469 text-transform: uppercase; 6470 letter-spacing: 0.04em; 6471`,SW=p.div.withConfig({displayName:"ContentDraftCard__ErrorRow",componentId:"sc-1ucif4y-27"})` 6472 display: flex; 6473 align-items: center; 6474 gap: 0.35rem; 6475 font-size: 0.72rem; 6476 color: ${sr}; 6477 background: ${kn}; 6478 border-radius: 0.4rem; 6479 padding: 0.35rem 0.5rem; 6480`,v4e=p.div.withConfig({displayName:"ContentDraftCard__Actions",componentId:"sc-1ucif4y-28"})` 6481 display: flex; 6482 align-items: center; 6483 flex-wrap: wrap; 6484 gap: 0.5rem; 6485 margin-top: 0.15rem; 6486`,kW=p.div.withConfig({displayName:"ContentDraftCard__ApproveCluster",componentId:"sc-1ucif4y-29"})` 6487 display: inline-flex; 6488 align-items: stretch; 6489 gap: 0; 6490 margin-left: auto; 6491`,LM=p.button.withConfig({displayName:"ContentDraftCard__BaseBtn",componentId:"sc-1ucif4y-30"})` 6492 display: inline-flex; 6493 align-items: center; 6494 gap: 0.35rem; 6495 padding: 0.4rem 0.7rem; 6496 font-family: inherit; 6497 font-size: 0.75rem; 6498 font-weight: 700; 6499 border-radius: 0.5rem; 6500 cursor: pointer; 6501 transition: filter 0.12s, transform 0.06s; 6502 &:active:enabled { transform: translateY(1px); } 6503 &:disabled { cursor: not-allowed; opacity: 0.6; } 6504`,$W=p(LM).withConfig({displayName:"ContentDraftCard__ApproveBtn",componentId:"sc-1ucif4y-31"})` 6505 background: ${e=>e.$danger?Ut:ot}; 6506 color: ${Z}; 6507 border: 1px solid ${e=>e.$danger?Ut:ot}; 6508 ${e=>e.$standalone?"":"border-top-left-radius: 0; border-bottom-left-radius: 0;"} 6509 &:hover:enabled { filter: brightness(0.92); } 6510`,w4e=p.select.withConfig({displayName:"ContentDraftCard__PostStatusSelect",componentId:"sc-1ucif4y-32"})` 6511 appearance: none; 6512 font-family: inherit; 6513 font-size: 0.74rem; 6514 font-weight: 700; 6515 background: ${Z}; 6516 color: ${O}; 6517 border: 1px solid ${V}; 6518 border-right: 0; 6519 padding: 0 0.55rem; 6520 border-top-left-radius: 0.5rem; 6521 border-bottom-left-radius: 0.5rem; 6522 cursor: pointer; 6523 &:disabled { opacity: 0.6; cursor: not-allowed; } 6524`,j4e=p(LM).withConfig({displayName:"ContentDraftCard__RegenerateBtn",componentId:"sc-1ucif4y-33"})` 6525 background: ${Z}; 6526 color: ${O}; 6527 border: 1px solid ${V}; 6528 &:hover:enabled { background: ${At}; } 6529`,_4e=p.span.withConfig({displayName:"ContentDraftCard__CostHint",componentId:"sc-1ucif4y-34"})` 6530 font-weight: 600; 6531 opacity: 0.75; 6532 letter-spacing: 0.02em; 6533`,C4e=p(LM).withConfig({displayName:"ContentDraftCard__DismissBtn",componentId:"sc-1ucif4y-35"})` 6534 background: ${Z}; 6535 color: ${O}; 6536 border: 1px solid ${V}; 6537 &:hover:enabled { background: ${At}; } 6538`,S4e=p.div.withConfig({displayName:"ContentDraftCard__DismissWrap",componentId:"sc-1ucif4y-36"})` 6539 position: relative; 6540`,k4e=p.div.withConfig({displayName:"ContentDraftCard__Menu",componentId:"sc-1ucif4y-37"})` 6541 position: absolute; 6542 top: calc(100% + 4px); 6543 left: 0; 6544 z-index: 20; 6545 background: ${Z}; 6546 border: 1px solid ${V}; 6547 border-radius: 0.5rem; 6548 box-shadow: ${Y_}; 6549 padding: 0.25rem; 6550 min-width: 240px; 6551`,$4e=p.button.withConfig({displayName:"ContentDraftCard__MenuItem",componentId:"sc-1ucif4y-38"})` 6552 display: block; 6553 width: 100%; 6554 text-align: left; 6555 background: transparent; 6556 border: 0; 6557 padding: 0.45rem 0.55rem; 6558 border-radius: 0.35rem; 6559 font-size: 0.78rem; 6560 color: ${O}; 6561 cursor: pointer; 6562 &:hover { background: ${At}; } 6563`,I4e=p.div.withConfig({displayName:"ContentDraftCard__DecidedRow",componentId:"sc-1ucif4y-39"})` 6564 display: flex; 6565 align-items: center; 6566 gap: 0.5rem; 6567 margin-top: 0.1rem; 6568`,P4e=p.span.withConfig({displayName:"ContentDraftCard__DecidedBadge",componentId:"sc-1ucif4y-40"})` 6569 display: inline-flex; 6570 align-items: center; 6571 gap: 0.3rem; 6572 font-size: 0.68rem; 6573 font-weight: 700; 6574 text-transform: uppercase; 6575 letter-spacing: 0.03em; 6576 padding: 0.25rem 0.5rem; 6577 border-radius: 0.4rem; 6578 background: ${e=>e.$status==="published"?si:e.$status==="failed"?kn:$e}; 6579 color: ${e=>e.$status==="published"?Vt:e.$status==="failed"?sr:z}; 6580`,A4e=p.span.withConfig({displayName:"ContentDraftCard__DecidedWhen",componentId:"sc-1ucif4y-41"})` 6581 display: inline-flex; 6582 align-items: center; 6583 gap: 0.25rem; 6584 font-size: 0.68rem; 6585 color: ${z}; 6586`,N4e=p.div.withConfig({displayName:"ContentDraftCard__MutationHeader",componentId:"sc-1ucif4y-42"})` 6587 display: inline-flex; 6588 align-items: flex-start; 6589 gap: 0.45rem; 6590 font-size: 0.82rem; 6591 line-height: 1.45; 6592 color: ${z}; 6593 & strong { color: ${O}; font-weight: 800; } 6594 & svg { color: ${$i}; flex-shrink: 0; margin-top: 2px; } 6595`,z4e=p.div.withConfig({displayName:"ContentDraftCard__AuditCard",componentId:"sc-1ucif4y-43"})` 6596 border: 1px solid ${V}; 6597 border-left: 3px solid ${e=>e.$sev==="high"?Ut:e.$sev==="medium"?$i:Rt}; 6598 background: ${At}; 6599 border-radius: 0.55rem; 6600 padding: 0.65rem 0.75rem; 6601 display: grid; 6602 gap: 0.45rem; 6603`,T4e=p.div.withConfig({displayName:"ContentDraftCard__AuditHeader",componentId:"sc-1ucif4y-44"})` 6604 display: flex; 6605 align-items: center; 6606 gap: 0.4rem; 6607 flex-wrap: wrap; 6608 font-size: 0.7rem; 6609 text-transform: uppercase; 6610 letter-spacing: 0.04em; 6611 color: ${z}; 6612 font-weight: 700; 6613`,E4e=p.span.withConfig({displayName:"ContentDraftCard__AuditSeverity",componentId:"sc-1ucif4y-45"})` 6614 display: inline-flex; 6615 align-items: center; 6616 font-size: 0.6rem; 6617 font-weight: 800; 6618 border-radius: 0.35rem; 6619 padding: 0.12rem 0.4rem; 6620 background: ${e=>
6620e.$s==="high"?kn:e.$s==="medium"?Jl:$e}; 6621 color: ${e=>e.$s==="high"?sr:e.$s==="medium"?$i:z}; 6622`,M4e=p.span.withConfig({displayName:"ContentDraftCard__AuditCode",componentId:"sc-1ucif4y-46"})` 6623 font-family: ui-monospace, SFMono-Regular, Menlo, monospace; 6624 font-size: 0.7rem; 6625 text-transform: none; 6626 letter-spacing: 0; 6627 color: ${O}; 6628 background: ${Z}; 6629 border: 1px solid ${V}; 6630 padding: 0.1rem 0.4rem; 6631 border-radius: 0.3rem; 6632`,R4e=p.a.withConfig({displayName:"ContentDraftCard__AuditUrl",componentId:"sc-1ucif4y-47"})` 6633 display: inline-flex; 6634 align-items: center; 6635 gap: 0.25rem; 6636 font-size: 0.7rem; 6637 color: ${z}; 6638 text-decoration: none; 6639 text-transform: none; 6640 letter-spacing: 0; 6641 font-weight: 600; 6642 &:hover { color: ${Ft}; text-decoration: underline; } 6643 & svg { flex-shrink: 0; } 6644 & span { 6645 overflow: hidden; 6646 text-overflow: ellipsis; 6647 white-space: nowrap; 6648 max-width: 320px; 6649 } 6650`,O4e=p.div.withConfig({displayName:"ContentDraftCard__AuditMessage",componentId:"sc-1ucif4y-48"})` 6651 font-size: 0.82rem; 6652 font-weight: 700; 6653 color: ${O}; 6654 line-height: 1.4; 6655`,D4e=p.div.withConfig({displayName:"ContentDraftCard__AuditFix",componentId:"sc-1ucif4y-49"})` 6656 font-size: 0.78rem; 6657 color: ${z}; 6658 line-height: 1.5; 6659 & strong { color: ${O}; font-weight: 700; margin-right: 0.25rem; } 6660`,L4e=p.div.withConfig({displayName:"ContentDraftCard__EvidenceGrid",componentId:"sc-1ucif4y-50"})` 6661 display: grid; 6662 grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); 6663 gap: 0.4rem; 6664`,B4e=p.div.withConfig({displayName:"ContentDraftCard__EvidenceCell",componentId:"sc-1ucif4y-51"})` 6665 display: grid; 6666 gap: 0.1rem; 6667 background: ${Z}; 6668 border: 1px solid ${V}; 6669 border-radius: 0.4rem; 6670 padding: 0.35rem 0.5rem; 6671`,F4e=p.div.withConfig({displayName:"ContentDraftCard__EvidenceLabel",componentId:"sc-1ucif4y-52"})` 6672 font-size: 0.6rem; 6673 font-weight: 700; 6674 color: ${z}; 6675 text-transform: uppercase; 6676 letter-spacing: 0.04em; 6677`,W4e=p.div.withConfig({displayName:"ContentDraftCard__EvidenceValue",componentId:"sc-1ucif4y-53"})` 6678 font-size: 0.85rem; 6679 font-weight: 800; 6680 color: ${O}; 6681 font-variant-numeric: tabular-nums; 6682`,U4e=p.div.withConfig({displayName:"ContentDraftCard__RevisionSummary",componentId:"sc-1ucif4y-54"})` 6683 display: inline-flex; 6684 align-items: flex-start; 6685 gap: 0.4rem; 6686 font-size: 0.78rem; 6687 line-height: 1.5; 6688 color: ${O}; 6689 background: ${cn}; 6690 border: 1px dashed ${ot}; 6691 border-radius: 0.45rem; 6692 padding: 0.45rem 0.6rem; 6693 & svg { color: ${Ft}; flex-shrink: 0; margin-top: 3px; } 6694`,H4e=p.div.withConfig({displayName:"ContentDraftCard__DiffTabs",componentId:"sc-1ucif4y-55"})` 6695 display: inline-flex; 6696 align-items: center; 6697 gap: 0.25rem; 6698 flex-wrap: wrap; 6699 background: ${$e}; 6700 padding: 0.2rem; 6701 border-radius: 0.45rem; 6702 width: fit-content; 6703`,Wz=p.button.withConfig({displayName:"ContentDraftCard__DiffTab",componentId:"sc-1ucif4y-56"})` 6704 display: inline-flex; 6705 align-items: center; 6706 gap: 0.25rem; 6707 appearance: none; 6708 background: ${e=>e.$active?Z:"transparent"}; 6709 border: 1px solid ${e=>e.$active?V:"transparent"}; 6710 color: ${e=>e.$active?O:z}; 6711 font-size: 0.72rem; 6712 font-weight: 700; 6713 padding: 0.2rem 0.5rem; 6714 border-radius: 0.35rem; 6715 cursor: pointer; 6716 transition: background 120ms ease, color 120ms ease; 6717 &:hover { color: ${O}; } 6718 & svg { color: inherit; } 6719`,q4e=p.div.withConfig({displayName:"ContentDraftCard__DiffStat",componentId:"sc-1ucif4y-57"})` 6720 display: inline-flex; 6721 align-items: center; 6722 gap: 0.3rem; 6723 margin-left: 0.4rem; 6724 font-size: 0.7rem; 6725 font-weight: 600; 6726 color: ${z}; 6727 font-variant-numeric: tabular-nums; 6728`,G4e=p.span.withConfig({displayName:"ContentDraftCard__DiffDelta",componentId:"sc-1ucif4y-58"})` 6729 display: inline-flex; 6730 align-items: center; 6731 font-weight: 800; 6732 color: ${e=>e.$delta>0?Vt:e.$delta<0?sr:z}; 6733`,V4e=p.div.withConfig({displayName:"ContentDraftCard__DiffSplit",componentId:"sc-1ucif4y-59"})` 6734 display: grid; 6735 grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); 6736 gap: 0.5rem; 6737 @media (max-width: 760px) { 6738 grid-template-columns: minmax(0, 1fr); 6739 } 6740`,IW=p.div.withConfig({displayName:"ContentDraftCard__DiffPane",componentId:"sc-1ucif4y-60"})` 6741 display: grid; 6742 gap: 0.3rem; 6743 min-width: 0; 6744`,PW=p.div.withConfig({displayName:"ContentDraftCard__DiffPaneLabel",componentId:"sc-1ucif4y-61"})` 6745 font-size: 0.65rem; 6746 font-weight: 800; 6747 text-transform: uppercase; 6748 letter-spacing: 0.06em; 6749 color: ${e=>e.$accent?Ft:z}; 6750`;function K4e({actions:e,auditActions:n=[],loading:i,error:r,onGenerate:o,onGenerateFromAuditAction:s,estimatedCreditsPerGeneration:a=0,estimatedCreditsPerMutation:c=0,canManage:u=!0}){const[m,h]=l.useState(new Set),[g,x]=l.useState({}),[y,w]=l.useState("all"),j=a>0?a:null,v=j?`${j} credit${j===1?"":"s"}`:null,_=c>0?c:null,$=_?`${_} credit${_===1?"":"s"}`:null,k=e.length>0,P=n.length>0,S=k&&P,I=y==="rewrite"?[]:e,A=y==="new"?[]:n,E=I.length+A.length,B=l.useCallback(async R=>{const F=`new:${R}`;if(m.has(F))return;h(H=>new Set(H).add(F)),x(H=>({...H,[F]:void 0}));const Y=await o(R);Y.ok||x(H=>({...H,[F]:Y.message||Y.errorCode||"Failed to start draft"})),h(H=>{const U=new Set(H);return U.delete(F),U})},[m,o]),T=l.useCallback(async R=>{if(!s)return;const F=`rewrite:${R}`;if(m.has(F))return;h(H=>new Set(H).add(F)),x(H=>({...H,[F]:void 0}));const Y=await s(R);Y.ok||x(H=>({...H,[F]:Y.message||Y.errorCode||"Failed to start rewrite"})),h(H=>{const U=new Set(H);return U.delete(F),U})},[m,s]),M=l.useMemo(()=>{const R=[];return k&&v&&R.push(t.jsx(at,{content:`Each new-post draft spends ${v}
6750.`,placement:"top",maxWidth:280,children:t.jsxs(AW,{$tone:"brand",children:[t.jsx(gr,{size:11})," New post · ",v]})},"new")),P&&$&&R.push(t.jsx(at,{content:`Each rewrite spends ${$} (more than a fresh draft because the LLM has to read the full prior body).`,placement:"top",maxWidth:320,children:t.jsxs(AW,{$tone:"warning",children:[t.jsx(Lc,{size:11})," Rewrite · ",$]})},"mut")),R},[k,P,v,$]);return t.jsxs(X4e,{children:[t.jsxs(Q4e,{children:[t.jsx(Sn,{size:14}),t.jsx("strong",{children:"Draft something new"}),t.jsx("span",{children:"Pick a recommendation or audit fix below and the Content Agent will write a first draft for you to review."}),t.jsx(Z4e,{children:M})]}),S&&t.jsxs(J4e,{role:"tablist","aria-label":"Draft sources",children:[t.jsxs(Uz,{type:"button",$active:y==="all",role:"tab","aria-selected":y==="all",onClick:()=>w("all"),children:["All",t.jsx(Hz,{children:e.length+n.length})]}),t.jsxs(Uz,{type:"button",$active:y==="new",role:"tab","aria-selected":y==="new",onClick:()=>w("new"),children:[t.jsx(gr,{size:11})," New posts",t.jsx(Hz,{children:e.length})]}),t.jsxs(Uz,{type:"button",$active:y==="rewrite",role:"tab","aria-selected":y==="rewrite",onClick:()=>w("rewrite"),children:[t.jsx(Lc,{size:11})," Rewrites",t.jsx(Hz,{children:n.length})]})]}),r&&t.jsxs(qz,{children:[t.jsx(ei,{size:12}),t.jsx("span",{children:r})]}),i&&E===0?t.jsxs(eEe,{children:[t.jsx(nt,{width:"100%",height:42}),t.jsx(nt,{width:"100%",height:42}),t.jsx(nt,{width:"100%",height:42})]}):E===0?t.jsx(tEe,{children:y==="rewrite"?"No audit findings the Content Agent can fix right now. Run a fresh site audit to surface new opportunities.":y==="new"?"No content recommendations waiting. Generate more from the Actions page.":"Nothing waiting for the Content Agent right now. Run a site audit or generate more recommendations from the Actions page to surface new opportunities."}):t.jsxs(nEe,{children:[A.map(R=>{const F=`rewrite:${R.id}`,Y=m.has(F),H=g[F];return t.jsxs(zW,{children:[t.jsxs(TW,{children:[t.jsxs(EW,{children:[t.jsxs(MW,{$kind:"rewrite",children:[t.jsx(Lc,{size:10})," Rewrite"]}),t.jsx(rEe,{$s:R.severity,children:R.severity}),t.jsx(RW,{children:R.category||"audit"}),t.jsx(oEe,{title:R.code,children:R.code})]}),t.jsx(OW,{children:R.message}),R.fix&&t.jsx(DW,{children:R.fix}),R.target_url&&t.jsxs(aEe,{href:R.target_url,target:"_blank",rel:"noopener noreferrer",onClick:U=>U.stopPropagation(),children:[t.jsx(as,{size:10}),t.jsx("span",{children:Y4e(R.target_url)})]}),H&&t.jsxs(qz,{$compact:!0,children:[t.jsx(ei,{size:11}),t.jsx("span",{children:H})]})]}),u&&s&&t.jsx(at,{content:$?`Rewrite this post â costs ${$}.`:"Rewrite this post.",placement:"top",maxWidth:280,disabled:!$||Y,children:t.jsxs(cEe,{type:"button",onClick:()=>T(R.id),disabled:Y,children:[Y?t.jsx(LW,{size:12}):t.jsx(Ef,{size:12}),t.jsx("span",{children:Y?"Draftingâ¦":"Rewrite this"}),$&&!Y&&t.jsxs(NW,{children:["· ",$]}),t.jsx(Gi,{size:12})]})})]},F)}),I.map(R=>{const F=`new:${R.id}`,Y=m.has(F),H=g[F];return t.jsxs(zW,{children:[t.jsxs(TW,{children:[t.jsxs(EW,{children:[t.jsxs(MW,{$kind:"new",children:[t.jsx(gr,{size:10})," New post"]}),t.jsx(iEe,{$p:R.priority,children:R.priority}),t.jsx(RW,{children:R.category||"general"}),R.content_format&&t.jsx(sEe,{children:R.content_format})]}),t.jsx(OW,{children:R.title}),R.detail&&t.jsx(DW,{children:R.detail}),H&&t.jsxs(qz,{$compact:!0,children:[t.jsx(ei,{size:11}),t.jsx("span",{children:H})]})]}),u&&t.jsx(at,{content:v?`Generate a draft â costs ${v}.`:"",placement:"top",maxWidth:280,disabled:!v||Y,children:t.jsxs(lEe,{type:"button",onClick:()=>B(R.id),disabled:Y,children:[Y?t.jsx(LW,{size:12}):t.jsx(gr,{size:12}),t.jsx("span",{children:Y?"Draftingâ¦":"Draft this"}),v&&!Y&&t.jsxs(NW,{children:["· ",v]}),t.jsx(Gi,{size:12})]})})]},F)})]})]})}function Y4e(e){try{const n=new URL(e),i=n.pathname.replace(/\/$/,"")||"/",r=i.length>60?`â¦${i.slice(-58)}`:i;return`${n.host}${r}`}catch{return e.length>80?`${e.slice(0,78)}â¦`:e}}const X4e=p.div.withConfig({displayName:"EligibleActionPicker__Wrap",componentId:"sc-nrk7x7-0"})` 6751 border: 1px solid ${V}; 6752 background: ${Z}; 6753 border-radius: 0.875rem; 6754 padding: 0.85rem 1rem 1rem; 6755 display: grid; 6756 gap: 0.6rem; 6757`,Q4e=p.div.withConfig({displayName:"EligibleActionPicker__Heading",componentId:"sc-nrk7x7-1"})` 6758 display: flex; 6759 align-items: baseline; 6760 flex-wrap: wrap; 6761 gap: 0.4rem; 6762 color: ${z}; 6763 font-size: 0.78rem; 6764 & svg { color: ${Ft}; align-self: center; } 6765 & strong { color: ${O}; font-weight: 800; font-size: 0.85rem; margin-right: 0.25rem; } 6766 & > span { flex: 1; min-width: 200px; } 6767`,Z4e=p.div.withConfig({displayName:"EligibleActionPicker__CostChips",componentId:"sc-nrk7x7-2"})` 6768 margin-left: auto; 6769 display: inline-flex; 6770 align-items: center; 6771 gap: 0.3rem; 6772 flex-wrap: wrap; 6773`,AW=p.span.withConfig({displayName:"EligibleActionPicker__CostChip",componentId:"sc-nrk7x7-3"})` 6774 display: inline-flex; 6775 align-items: center; 6776 gap: 0.25rem; 6777 font-size: 0.68rem; 6778 font-weight: 700; 6779 text-transform: uppercase; 6780 letter-spacing: 0.04em; 6781 color: ${e=>e.$tone==="warning"?$i:Ft}; 6782 background: ${e=>e.$tone==="warning"?Jl:cn}; 6783 border: 1px solid transparent; 6784 border-radius: 0.4rem; 6785 padding: 0.15rem 0.45rem; 6786 align-self: center; 6787 & svg { color: inherit; } 6788`,J4e=p.div.withConfig({displayName:"EligibleActionPicker__TabStrip",componentId:"sc-nrk7x7-4"})` 6789 display: inline-flex; 6790 align-items: center; 6791 gap: 0.3rem; 6792 flex-wrap: wrap; 6793 background: ${$e}; 6794 padding: 0.2rem; 6795 border-radius: 0.5rem; 6796 width: fit-content; 6797`,Uz=p.button.withConfig({displayName:"EligibleActionPicker__TabBtn",componentId:"sc-nrk7x7-5"})` 6798 appearance: none; 6799 display: inline-flex; 6800 align-items: center; 6801 gap: 0.3rem; 6802 background: ${e=>e.$active?Z:"transparent"}; 6803 border: 1px solid ${e=>e.$active?V:"transparent"}; 6804 color: ${e=>e.$active?O:z}; 6805 font-size: 0.74rem; 6806 font-weight: 700; 6807 padding: 0.25rem 0.55rem; 6808 border-radius: 0.4rem; 6809 cursor: pointer; 6810 transition: background 120ms ease, color 120ms ease; 6811 &:hover { color: ${O}; } 6812 & svg { color: inherit; } 6813`,Hz=p.span.withConfig({displayName:"EligibleActionPicker__Count",componentId:"sc-nrk7x7-6"})` 6814 display: inline-flex; 6815 align-items: center; 6816 justify-content: center; 6817 min-width: 1.2rem; 6818 height: 1.05rem; 6819 padding: 0 0.35rem; 6820 border-radius: 999px; 6821 background: ${V}; 6822 color: ${O}; 6823 font-size: 0.62rem; 6824 font-weight: 800; 6825`,NW=p.span.withConfig({displayName:"EligibleActionPicker__BtnCost",componentId:"sc-nrk7x7-7"})` 6826 font-weight: 600; 6827 opacity: 0.85; 6828 letter-spacing: 0.02em; 6829`,eEe=p.div.withConfig({displayName:"EligibleActionPicker__SkeletonList",componentId:"sc-nrk7x7-8"})` 6830 display: grid; 6831 gap: 0.4rem; 6832`,tEe=p.div.withConfig({displayName:"EligibleActionPicker__Empty",componentId:"sc-nrk7x7-9"})` 6833 font-size: 0.8rem; 6834 color: ${z}; 6835 border: 1px dashed ${V}; 6836 border-radius: 0.5rem; 6837 padding: 0.75rem 0.85rem; 6838 line-height: 1.5; 6839`,nEe=p.div.withConfig({displayName:"EligibleActionPicker__List",componentId:"sc-nrk7x7-10"})` 6840 display: grid; 6841 gap: 0.4rem; 6842`,zW=p.div.withConfig({displayName:"EligibleActionPicker__Row",componentId:"sc-nrk7x7-11"})` 6843 display: flex; 6844 align-items: center; 6845 gap: 0.75rem; 6846 flex-wrap: wrap; 6847 min-width: 0; 6848 padding: 0.55rem 0.7rem; 6849 background: ${Z}; 6850 border: 1px solid ${V}; 6851 border-radius: 0.6rem; 6852 transition: border-color 0.12s, box-shadow 0.12s; 6853 &:hover { border-color: ${Rt}; } 6854`,TW=p.div.withConfig({displayName:"EligibleActionPicker__RowMain",componentId:"sc-nrk7x7-12"})` 6855 flex: 1; 6856 min-width: 0; 6857 display: grid; 6858 gap: 0.25rem; 6859`,EW=p.div.withConfig({displayName:"EligibleActionPicker__RowTop",componentId:"sc-nrk7x7-13"})` 6860 display: inline-flex; 6861 align-items: center; 6862 gap: 0.3rem; 6863 flex-wrap: wrap; 6864`,p1=p.span.withConfig({displayName:"EligibleActionPicker__Chip",componentId:"sc-nrk7x7-14"})` 6865 display: inline-flex; 6866 align-items: center; 6867 gap: 0.2rem; 6868 font-size: 0.6rem; 6869 font-weight: 800; 6870 text-transform: uppercase; 6871 letter-spacing: 0.04em; 6872 border-radius: 0.35rem; 6873 padding: 0.12rem 0.4rem; 6874`,MW=p(p1).withConfig({displayName:"EligibleActionPicker__KindChip",componentId:"sc-nrk7x7-15"})` 6875 background: ${e=>e.$kind==="rewrite"?Jl:cn}; 6876 color: ${e=>e.$kind==="rewrite"?$i:Ft}; 6877 & svg { color: inherit; } 6878`,iEe=p(p1).withConfig({displayName:"EligibleActionPicker__PriorityChip",componentId:"sc-nrk7x7-16"})` 6879 background: ${e=>e.$p==="high"?kn:e.$p==="medium"?cn:$e}; 6880 color: ${e=>e.$p==="high"?sr:e.$p==="medium"?Ft:z}; 6881`,rEe=p(p1).withConfig({displayName:"EligibleActionPicker__SeverityChip",componentId:"sc-nrk7x7-17"})` 6882 background: ${e=>
6882e.$s==="high"?kn:e.$s==="medium"?Jl:$e}; 6883 color: ${e=>e.$s==="high"?sr:e.$s==="medium"?$i:z}; 6884`,RW=p(p1).withConfig({displayName:"EligibleActionPicker__CategoryChip",componentId:"sc-nrk7x7-18"})` 6885 background: ${$e}; 6886 color: ${z}; 6887`,oEe=p(p1).withConfig({displayName:"EligibleActionPicker__CodeChip",componentId:"sc-nrk7x7-19"})` 6888 background: ${$e}; 6889 color: ${z}; 6890 font-family: ui-monospace, SFMono-Regular, Menlo, monospace; 6891 text-transform: none; 6892 letter-spacing: 0; 6893 max-width: 220px; 6894 overflow: hidden; 6895 text-overflow: ellipsis; 6896 white-space: nowrap; 6897 display: inline-block; 6898`,sEe=p(p1).withConfig({displayName:"EligibleActionPicker__FormatChip",componentId:"sc-nrk7x7-20"})` 6899 background: ${cn}; 6900 color: ${Ft}; 6901`,OW=p.div.withConfig({displayName:"EligibleActionPicker__RowTitle",componentId:"sc-nrk7x7-21"})` 6902 font-size: 0.85rem; 6903 font-weight: 700; 6904 color: ${O}; 6905 line-height: 1.35; 6906 overflow: hidden; 6907 text-overflow: ellipsis; 6908`,DW=p.div.withConfig({displayName:"EligibleActionPicker__RowDetail",componentId:"sc-nrk7x7-22"})` 6909 font-size: 0.75rem; 6910 color: ${z}; 6911 line-height: 1.45; 6912 display: -webkit-box; 6913 -webkit-line-clamp: 2; 6914 -webkit-box-orient: vertical; 6915 overflow: hidden; 6916`,aEe=p.a.withConfig({displayName:"EligibleActionPicker__TargetUrl",componentId:"sc-nrk7x7-23"})` 6917 display: inline-flex; 6918 align-items: center; 6919 gap: 0.25rem; 6920 font-size: 0.7rem; 6921 color: ${z}; 6922 text-decoration: none; 6923 width: fit-content; 6924 &:hover { color: ${Ft}; text-decoration: underline; } 6925 & svg { flex-shrink: 0; } 6926 & span { 6927 overflow: hidden; 6928 text-overflow: ellipsis; 6929 white-space: nowrap; 6930 max-width: 360px; 6931 } 6932`,lEe=p.button.withConfig({displayName:"EligibleActionPicker__GenerateBtn",componentId:"sc-nrk7x7-24"})` 6933 display: inline-flex; 6934 align-items: center; 6935 gap: 0.35rem; 6936 padding: 0.4rem 0.7rem; 6937 font-family: inherit; 6938 font-size: 0.74rem; 6939 font-weight: 700; 6940 border-radius: 0.5rem; 6941 background: ${ot}; 6942 color: ${Z}; 6943 border: 1px solid ${ot}; 6944 cursor: pointer; 6945 white-space: nowrap; 6946 transition: filter 0.12s; 6947 &:hover:enabled { filter: brightness(0.92); } 6948 &:disabled { opacity: 0.7; cursor: not-allowed; } 6949`,cEe=p.button.withConfig({displayName:"EligibleActionPicker__RewriteBtn",componentId:"sc-nrk7x7-25"})` 6950 display: inline-flex; 6951 align-items: center; 6952 gap: 0.35rem; 6953 padding: 0.4rem 0.7rem; 6954 font-family: inherit; 6955 font-size: 0.74rem; 6956 font-weight: 700; 6957 border-radius: 0.5rem; 6958 background: ${Z}; 6959 color: ${O}; 6960 border: 1px solid ${$i}; 6961 cursor: pointer; 6962 white-space: nowrap; 6963 transition: background 0.12s, filter 0.12s; 6964 &:hover:enabled { background: ${Jl}; } 6965 &:disabled { opacity: 0.7; cursor: not-allowed; } 6966 & svg { color: ${$i}; } 6967`,LW=p(Tr).withConfig({displayName:"EligibleActionPicker__Spinner",componentId:"sc-nrk7x7-26"})` 6968 animation: contentpicker-spin 0.8s linear infinite; 6969 @keyframes contentpicker-spin { to { transform: rotate(360deg); } } 6970`,qz=p.div.withConfig({displayName:"EligibleActionPicker__ErrorRow",componentId:"sc-nrk7x7-27"})` 6971 display: flex; 6972 align-items: center; 6973 gap: 0.35rem; 6974 font-size: ${e=>e.$compact?"0.7rem":"0.78rem"}; 6975 color: ${sr}; 6976 background: ${kn}; 6977 border-radius: 0.4rem; 6978 padding: ${e=>e.$compact?"0.25rem 0.45rem":"0.4rem 0.55rem"}; 6979 & svg { color: ${Ut}; } 6980`;function dEe({events:e,loading:n=!1,error:i=null,collapsible:r=!0,defaultOpen:o=!1,collapsedRows:s=1,expandedRows:a=25,onRevert:c,isRevertPending:u,onRetry:m,isRetryPending:h,canManage:g=!0}){const[x,y]=l.useState(o),w=l.useMemo(()=>{const v=x?a:s;return e.slice(0,Math.max(0,v))},[e,x,s,a]),j=l.useMemo(()=>n&&e.length===0?"Catching up on agent activityâ¦":i?"Couldn't load agent activity":e.length===0?"No recent agent activity":"Recent agent activity",[n,i,e.length]);return t.jsxs(yEe,{children:[t.jsxs(xEe,{type:"button",onClick:()=>r&&y(v=>!v),$clickable:r,"aria-expanded":x,children:[t.jsx(bEe,{$active:!i&&e.length>0}),t.jsx(gl,{size:14}),t.jsx("strong",{children:j}),e.length>0&&t.jsxs(vEe,{children:[e.length," recent ",e.length===1?"event":"events"]}),t.jsx(wEe,{}),r&&(x?t.jsx(yu,{size:14}):t.jsx(qn,{size:14}))]}),i&&!x&&t.jsx(WW,{children:i}),w.length>0&&t.jsx(jEe,{children:w.map(v=>{const _=v.source==="operation"&&typeof v.source_id=="number"?v.source_id:null,$=g&&!!_&&!!c&&v.details?.revertable===!0,k=v.details?.reverted_at??null,P=!!_&&!!u&&u(_),S=g&&!!_&&!!m&&v.details?.retryable===!0,I=!!_&&!!h&&h(_);return t.jsxs(_Ee,{children:[t.jsx(kEe,{$color:pEe(v),children:uEe(v)}),t.jsxs($Ee,{children:[t.jsx(IEe,{children:v.summary||hEe(v.type)}),t.jsxs(PEe,{children:[t.jsx(AEe,{$source:v.source,children:mEe(v)}),t.jsx(FW,{children:"·"}),t.jsx(fEe,{time:v.occurred_at}),k&&t.jsxs(t.Fragment,{children:[t.jsx(FW,{children:"·"}),t.jsx(SEe,{children:"Reverted"})]})]})]}),$&&_!==null&&t.jsx(BW,{children:t.jsx(at,{content:"Undo this fix and restore the previous values",placement:"top",maxWidth:280,disabled:P,children:t.jsxs(Ere,{type:"button",onClick:()=>c?.(_),disabled:P,children:[t.jsx(J8,{size:11}),P?"Revertingâ¦":"Revert"]})})}),S&&_!==null&&!$&&t.jsx(BW,{children:t.jsx(at,{content:"Re-queue this failed operation with the same parameters",placement:"top",maxWidth:280,disabled:I,children:t.jsxs(CEe,{type:"button",onClick:()=>m?.(_),disabled:I,children:[t.jsx(Wne,{size:11}),I?"Retryingâ¦":"Retry"]})})})]},v.id)})}),x&&w.length===0&&!n&&!i&&t.jsx(NEe,{children:"No recorded agent actions for this project yet. Run a site audit or accept a proposal to see activity here."}),x&&i&&t.jsx(WW,{children:i})]})}function uEe(e){switch(e.type){case"operation_succeeded":return t.jsx(co,{size:14});case"operation_failed":return t.jsx(Hc,{size:14});case"operation_queued":case"operation_dispatched":return t.jsx(Ks,{size:14});case"proposal_auto_accepted":case"proposal_accepted":return t.jsx(co,{size:14});case"proposal_auto_dismissed":case"proposal_dismissed":return t.jsx(WE,{size:14});case"proposal_stale":return t.jsx(WE,{size:14});case"proposal_created":return t.jsx(Lm,{size:14});case"content_draft_failed":return t.jsx(Hc,{size:14});case"content_draft_published":return t.jsx(co,{size:14});case"rule_triggered":return t.jsx(Ks,{size:14})}switch(e.source){case"operation":return t.jsx(Ef,{size:14});case"proposal":return t.jsx(Lm,{size:14});case"content_draft":return t.jsx(Ss,{size:14});case"rule":return t.jsx(Ks,{size:14});default:return t.jsx(Sn,{size:14})}}function pEe(e){switch(e.type){case"operation_succeeded":case"proposal_accepted":case"proposal_auto_accepted":case"content_draft_published":return Vt;case"operation_failed":case"content_draft_failed":return Ut;case"operation_queued":case"operation_dispatched":case"rule_triggered":return $i}return Ft}function mEe(e){return e.source==="rule"?"Rule":e.source==="operation"?"Auto-fix":e.source==="proposal"?e.agent_type==="content"?"Content suggestion":"Tech proposal":e.source==="content_draft"?"Content draft":"Activity"}function hEe(e){return e?e.replace(/_/g," ").replace(/^./,n=>n.toUpperCase()):"Activity"}function fEe({time:e}){if(!e)return t.jsx("span",{children:"just now"});const n=new Date(e),i=Date.now()-n.getTime();if(!Number.isFinite(i)||i<0)return t.jsx("span",{children:"just now"});const r=Math.floor(i/1e3);if(r<45)return t.jsx("span",{children:"just now"});const o=Math.floor(r/60);if(o<60)return t.jsxs("span",{children:[o,"m ago"]});const s=Math.floor(o/60);if(s<24)return t.jsxs("span",{children:[s,"h ago"]});const a=Math.floor(s/24);return a<7?t.jsxs("span",{children:[a,"d ago"]}):t.jsx("span",{children:n.toLocaleDateString()})}const gEe=Tn` 6981 0% { 6982 box-shadow: 0 0 0 0 color-mix(in srgb, ${Vt} 50%, transparent); 6983 } 6984 70% { 6985 box-shadow: 0 0 0 6px color-mix(in srgb, ${Vt} 0%, transparent); 6986 } 6987 100% { 6988 box-shadow: 0 0 0 0 color-mix(in srgb, ${Vt} 0%, transparent); 6989 } 6990`,yEe=p.div.withConfig({displayName:"NexusFeed__Wrap",componentId:"sc-g0dcnq-0"})` 6991 border: 1px solid ${V}; 6992 border-radius: 0.75rem; 6993 background: ${Z}; 6994 overflow: hidden; 6995`,xEe=p.button.withConfig({displayName:"NexusFeed__Header",componentId:"sc-g0dcnq-1"})` 6996 width: 100%; 6997 display: flex; 6998 align-items: center; 6999 gap: 0.5rem; 7000 background: linear-gradient(0deg, ${$e}, ${Z} 60%); 7001 border: 0; 7002 border-bottom: 1px solid ${V}; 7003 padding: 0.55rem 0.75rem; 7004 font-size: 0.78rem; 7005 color: ${O}; 7006 cursor: ${e=>e.$clickable?"pointer":"default"}; 7007 & strong { font-weight: 800; } 7008`,bEe=p.span.withConfig({displayName:"NexusFeed__PulseDot",componentId:"sc-g0dcnq-2"})` 7009 width: 0.55rem; 7010 height: 0.55rem; 7011 border-radius: 999px; 7012 background: ${e=>e.$active?Vt:z}; 7013 box-shadow: 0 0 0 0 7014 ${e=>e.$active?`color-mix(in srgb, ${Vt} 55%, transparent)`:"transparent"}; 7015 ${e=>e.$active?Pp` 7016 animation: ${gEe} 1.8s infinite; 7017 `:Pp` 7018 animation: none; 7019 `} 7020`,vEe=p.span.withConfig({displayName:"NexusFeed__Counter",componentId:"sc-g0dcnq-3"})` 7021 background: ${cn}; 7022 color: ${Ft}; 7023 font-weight: 800; 7024 border-radius: 999px; 7025 padding: 0.05rem 0.45rem; 7026 font-size: 0.65rem; 7027`,wEe=p.span.withConfig({displayName:"NexusFeed__Spacer",componentId:"sc-g0dcnq-4"})` 7028 flex: 1; 7029`,jEe=p.ul.withConfig({displayName:"NexusFeed__List",componentId:"sc-g0dcnq-5"})` 7030 list-style: none; 7031 margin: 0; 7032 padding: 0.25rem 0; 7033 display: grid; 7034 gap: 0; 7035`,_Ee=p.li.withConfig({displayName:"NexusFeed__Row",componentId:"sc-g0dcnq-6"})` 7036 display: grid; 7037 grid-template-columns: 1.75rem 1fr auto; 7038 align-items: center; 7039 gap: 0.5rem; 7040 padding: 0.45rem 0.75rem; 7041 border-bottom: 1px solid ${$e}; 7042 &:last-child { border-bottom: 0; } 7043`,BW=p.div.withConfig({displayName:"NexusFeed__RevertCell",componentId:"sc-g0dcnq-7"})` 7044 justify-self: end; 7045`,Ere=p.button.withConfig({displayName:"NexusFeed__RevertButton",componentId:"sc-g0dcnq-8"})` 7046 display: inline-flex; 7047 align-items: center; 7048 gap: 0.3rem; 7049 background: ${Z}; 7050 color: ${O}; 7051 border: 1px solid ${V}; 7052 border-radius: 999px; 7053 padding: 0.18rem 0.55rem; 7054 font-size: 0.68rem; 7055 font-weight: 700; 7056 cursor: pointer; 7057 transition: background 120ms ease, border-color 120ms ease; 7058 &:hover:not(:disabled) { 7059 background: ${$e}; 7060 border-color: ${z}; 7061 } 7062 &:disabled { opacity: 0.55;
7062 cursor: not-allowed; } 7063`,CEe=p(Ere).withConfig({displayName:"NexusFeed__RetryButton",componentId:"sc-g0dcnq-9"})` 7064 color: ${Ft}; 7065 border-color: ${cn}; 7066 background: ${cn}; 7067 &:hover:not(:disabled) { 7068 background: ${cn}; 7069 border-color: ${Ft}; 7070 } 7071`,SEe=p.span.withConfig({displayName:"NexusFeed__RevertedTag",componentId:"sc-g0dcnq-10"})` 7072 display: inline-flex; 7073 align-items: center; 7074 padding: 0.05rem 0.35rem; 7075 border-radius: 999px; 7076 background: ${$e}; 7077 color: ${O}; 7078 font-weight: 700; 7079 font-size: 0.6rem; 7080 text-transform: uppercase; 7081 letter-spacing: 0.04em; 7082`,kEe=p.span.withConfig({displayName:"NexusFeed__IconCell",componentId:"sc-g0dcnq-11"})` 7083 display: inline-flex; 7084 align-items: center; 7085 justify-content: center; 7086 color: ${e=>e.$color}; 7087 width: 1.5rem; 7088 height: 1.5rem; 7089 border-radius: 0.4rem; 7090 background: ${$e}; 7091`,$Ee=p.div.withConfig({displayName:"NexusFeed__SummaryCell",componentId:"sc-g0dcnq-12"})` 7092 display: grid; 7093 gap: 0.15rem; 7094 min-width: 0; 7095`,IEe=p.span.withConfig({displayName:"NexusFeed__SummaryText",componentId:"sc-g0dcnq-13"})` 7096 font-size: 0.8rem; 7097 color: ${O}; 7098 white-space: nowrap; 7099 overflow: hidden; 7100 text-overflow: ellipsis; 7101`,PEe=p.span.withConfig({displayName:"NexusFeed__SummaryMeta",componentId:"sc-g0dcnq-14"})` 7102 display: inline-flex; 7103 align-items: center; 7104 gap: 0.35rem; 7105 font-size: 0.7rem; 7106 color: ${z}; 7107`,FW=p.span.withConfig({displayName:"NexusFeed__Dot",componentId:"sc-g0dcnq-15"})` 7108 color: ${z}; 7109`,AEe=p.span.withConfig({displayName:"NexusFeed__SourceTag",componentId:"sc-g0dcnq-16"})` 7110 display: inline-flex; 7111 align-items: center; 7112 padding: 0.05rem 0.35rem; 7113 border-radius: 999px; 7114 background: ${e=>e.$source==="operation"?cn:(e.$source==="proposal"||e.$source==="content_draft"||e.$source==="rule",$e)}; 7115 color: ${e=>e.$source==="operation"?Ft:O}; 7116 font-weight: 700; 7117 font-size: 0.6rem; 7118 text-transform: uppercase; 7119 letter-spacing: 0.04em; 7120`,WW=p.div.withConfig({displayName:"NexusFeed__InlineError",componentId:"sc-g0dcnq-17"})` 7121 padding: 0.45rem 0.75rem; 7122 font-size: 0.75rem; 7123 color: ${Ut}; 7124 background: ${$e}; 7125`,NEe=p.div.withConfig({displayName:"NexusFeed__EmptyHint",componentId:"sc-g0dcnq-18"})` 7126 padding: 0.6rem 0.75rem; 7127 font-size: 0.75rem; 7128 color: ${z}; 7129`;function UW({selectedCount:e,totalCount:n,estimatedCreditsPerOp:i,connectorAlive:r=!0,allowAccept:o=!0,acceptLabel:s="Accept selected",dismissLabel:a="Dismiss selected",busy:c=!1,onAcceptAll:u,onDismissAll:m,onClear:h}){const[g,x]=l.useState(!1),[y,w]=l.useState(!1);if(e<=0)return null;const j=i&&i>0?i*e:null;return t.jsxs(zEe,{role:"region","aria-label":"Bulk actions",children:[t.jsxs(TEe,{children:[t.jsxs(MEe,{children:[t.jsx(GN,{size:14}),t.jsx("strong",{children:e}),typeof n=="number"?t.jsxs(HW,{children:[" of ",n]}):null," ","selected"]}),!r&&o&&t.jsx(REe,{children:"WordPress is offline â accepted fixes will queue and run when it reconnects."})]}),t.jsxs(EEe,{children:[o&&u&&(y?t.jsxs(qW,{children:[t.jsx(GW,{children:j?`Accept ${e} and spend â ${j} credits?`:`Accept ${e} proposals?`}),t.jsxs(s3,{type:"button",onClick:()=>{w(!1),u()},disabled:c,children:[c?t.jsx(Tr,{size:13,className:"spin"}):t.jsx(GN,{size:13}),"Confirm"]}),t.jsx(Gz,{type:"button",onClick:()=>w(!1),disabled:c,children:"Cancel"})]}):t.jsxs(s3,{type:"button",onClick:()=>w(!0),disabled:c,children:[t.jsx(GN,{size:13}),s,j?t.jsxs(HW,{style:{marginLeft:4},children:["(â ",j," cr)"]}):null]})),m&&(g?t.jsxs(qW,{children:[t.jsxs(GW,{children:["Dismiss ",e,"?"]}),t.jsxs(OEe,{type:"button",onClick:()=>{x(!1),m()},disabled:c,children:[c?t.jsx(Tr,{size:13,className:"spin"}):t.jsx(Ei,{size:13}),"Confirm"]}),t.jsx(Gz,{type:"button",onClick:()=>x(!1),disabled:c,children:"Cancel"})]}):t.jsxs(Gz,{type:"button",onClick:()=>x(!0),disabled:c,children:[t.jsx(Ei,{size:13}),a]})),t.jsx(DEe,{type:"button",onClick:h,disabled:c,"aria-label":"Clear selection",children:t.jsx(Ei,{size:14})})]})]})}const zEe=p.div.withConfig({displayName:"BulkActionBar__Wrap",componentId:"sc-h5m5s4-0"})` 7130 position: sticky; 7131 top: 0; 7132 z-index: 5; 7133 display: flex; 7134 align-items: center; 7135 justify-content: space-between; 7136 gap: 0.75rem; 7137 padding: 0.5rem 0.75rem; 7138 background: ${cn}; 7139 border: 1px solid ${Ft}; 7140 border-radius: 0.6rem; 7141 box-shadow: ${nge}; 7142 margin-top: 0.5rem; 7143`,TEe=p.div.withConfig({displayName:"BulkActionBar__Left",componentId:"sc-h5m5s4-1"})` 7144 display: flex; 7145 align-items: center; 7146 gap: 0.6rem; 7147 min-width: 0; 7148`,EEe=p.div.withConfig({displayName:"BulkActionBar__Right",componentId:"sc-h5m5s4-2"})` 7149 display: flex; 7150 align-items: center; 7151 gap: 0.4rem; 7152 flex-wrap: wrap; 7153 justify-content: flex-end; 7154`,MEe=p.div.withConfig({displayName:"BulkActionBar__Counter",componentId:"sc-h5m5s4-3"})` 7155 display: inline-flex; 7156 align-items: center; 7157 gap: 0.4rem; 7158 color: ${O}; 7159 font-size: 0.78rem; 7160 & strong { font-weight: 800; color: ${Ft}; } 7161`,HW=p.span.withConfig({displayName:"BulkActionBar__Muted",componentId:"sc-h5m5s4-4"})` 7162 color: ${z}; 7163 font-size: 0.7rem; 7164`,REe=p.span.withConfig({displayName:"BulkActionBar__Warning",componentId:"sc-h5m5s4-5"})` 7165 font-size: 0.7rem; 7166 color: ${Ut}; 7167 background: ${Z}; 7168 border: 1px solid ${V}; 7169 padding: 0.15rem 0.4rem; 7170 border-radius: 999px; 7171`,s3=p.button.withConfig({displayName:"BulkActionBar__PrimaryBtn",componentId:"sc-h5m5s4-6"})` 7172 display: inline-flex; 7173 align-items: center; 7174 gap: 0.3rem; 7175 background: ${Ft}; 7176 color: ${Z}; 7177 border: 0; 7178 padding: 0.4rem 0.7rem; 7179 border-radius: 0.5rem; 7180 font-size: 0.78rem; 7181 font-weight: 700; 7182 cursor: pointer; 7183 &:hover:not(:disabled) { filter: brightness(1.05); } 7184 &:disabled { opacity: 0.6;
7184 cursor: not-allowed; } 7185 & svg.spin { animation: spin 1s linear infinite; } 7186 @keyframes spin { to { transform: rotate(360deg); } } 7187`,OEe=p(s3).withConfig({displayName:"BulkActionBar__DangerBtn",componentId:"sc-h5m5s4-7"})` 7188 background: ${Ut}; 7189`,Gz=p.button.withConfig({displayName:"BulkActionBar__GhostBtn",componentId:"sc-h5m5s4-8"})` 7190 display: inline-flex; 7191 align-items: center; 7192 gap: 0.3rem; 7193 background: ${Z}; 7194 color: ${O}; 7195 border: 1px solid ${V}; 7196 padding: 0.4rem 0.7rem; 7197 border-radius: 0.5rem; 7198 font-size: 0.78rem; 7199 font-weight: 600; 7200 cursor: pointer; 7201 &:hover:not(:disabled) { background: ${$e}; } 7202 &:disabled { opacity: 0.6; cursor: not-allowed; } 7203`,DEe=p.button.withConfig({displayName:"BulkActionBar__ClearBtn",componentId:"sc-h5m5s4-9"})` 7204 display: inline-flex; 7205 align-items: center; 7206 justify-content: center; 7207 background: transparent; 7208 border: 0; 7209 color: ${z}; 7210 padding: 0.3rem; 7211 border-radius: 0.4rem; 7212 cursor: pointer; 7213 &:hover:not(:disabled) { color: ${O}; background: ${Z}; } 7214 &:disabled { opacity: 0.5; cursor: not-allowed; } 7215`,qW=p.div.withConfig({displayName:"BulkActionBar__ConfirmGroup",componentId:"sc-h5m5s4-10"})` 7216 display: inline-flex; 7217 align-items: center; 7218 gap: 0.35rem; 7219 background: ${Z}; 7220 border: 1px solid ${V}; 7221 padding: 0.25rem 0.5rem; 7222 border-radius: 0.5rem; 7223`,GW=p.span.withConfig({displayName:"BulkActionBar__ConfirmText",componentId:"sc-h5m5s4-11"})` 7224 font-size: 0.74rem; 7225 color: ${O}; 7226 font-weight: 600; 7227`,LEe={tech:{label:"Tech Agent",icon:Ef,cta:"auto-fixes",capLabel:"fixes / month"},content:{label:"Content Agent",icon:Sn,cta:"publishes",capLabel:"publishes / month"}};function BEe({techSetting:e,contentSetting:n,loading:i,saving:r,onUpdate:o,canManage:s=!0,selectedAgentType:a,onSelectAgentType:c,techCount:u,contentCount:m}){const h=!!(a&&c),g=l.useRef(null),x=l.useRef(null),y=l.useCallback(w=>{(w==="tech"?x.current:g.current)?.focus()},[]);return t.jsx(WEe,{children:t.jsxs(UEe,{role:h?"tablist":void 0,"aria-label":h?"Choose agent queue":void 0,children:[t.jsx(VW,{ref:g,agentType:"tech",setting:e,loading:i,saving:r==="tech",onUpdate:o,canManage:s,tabMode:h,selected:a==="tech",onSelect:c,onArrowNav:y,count:u}),t.jsx(VW,{ref:x,agentType:"content",setting:n,loading:i,saving:r==="content",onUpdate:o,canManage:s,tabMode:h,selected:a==="content",onSelect:c,onArrowNav:y,count:m})]})})}const VW=function({agentType:n,setting:i,loading:r,saving:o,onUpdate:s,canManage:a,tabMode:c,selected:u,onSelect:m,onArrowNav:h,count:g,ref:x}){const y=LEe[n],w=y.icon,j=i?.enabled??!0,v=i?.monthly_op_cap??null,_=i?.monthly_op_count??0,$=i?.cap_reached??!1,[k,P]=l.useState(!1),[S,I]=l.useState(v==null?"":String(v)),[A,E]=l.useState(i?.pause_reason??""),[B,T]=l.useState(!1);l.useEffect(()=>{I(v==null?"":String(v))},[v]),l.useEffect(()=>{E(i?.pause_reason??"")},[i?.pause_reason]);const M=v&&v>0?Math.min(100,Math.round(_/v*100)):0,R=l.useCallback(async()=>{await s(n,{enabled:!j})},[n,j,s]),F=l.useCallback(async()=>{const K=S.trim();let G=null;if(K!==""){const q=Number(K);if(!Number.isFinite(q)||q<0||!Number.isInteger(q))return;G=q}(await s(n,{monthly_op_cap:G})).ok&&P(!1)},[n,S,s]),Y=l.useCallback(async()=>{(await s(n,{pause_reason:A.trim()||null})).ok&&T(!1)},[n,A,s]),H=j?$?"capped":"running":"paused",U=l.useCallback(()=>{!c||!m||m(n)},[c,m,n]),X=l.useCallback(K=>{if(c){if(K.key==="Enter"||K.key===" "){K.preventDefault(),m?.(n);return}(K.key==="ArrowRight"||K.key==="ArrowLeft")&&(K.preventDefault(),h?.(n),m?.(n==="tech"?"content":"tech"))}},[c,m,h,n]),Q=l.useCallback(K=>{K.stopPropagation()},[]);return t.jsxs(HEe,{ref:x,$status:H,$tabMode:c,$selected:u,role:c?"tab":void 0,"aria-selected":c?u:void 0,tabIndex:c?u?0:-1:void 0,onClick:c?U:void 0,onKeyDown:c?X:void 0,children:[t.jsxs(GEe,{children:[t.jsxs(KEe,{children:[t.jsx(w,{size:14}),y.label,typeof g=="number"&&g>0&&t.jsx(YEe,{children:g}),c&&u&&t.jsx(qEe,{children:"Active"})]}),t.jsx(VEe,{onClick:Q,children:a?t.jsx(at,{content:j?`Pause ${y.label}`:`Resume ${y.label}`,placement:"top",disabled:r||o,children:t.jsxs(KW,{type:"button",$on:j,onClick:R,disabled:r||o,children:[j?t.jsx(j9,{size:12}):t.jsx(w9,{size:12}),j?"On":"Paused"]})}):t.jsxs(KW,{as:"span",$on:j,"aria-disabled":"true",children:[j?t.jsx(j9,{size:12}):t.jsx(w9,{size:12}),j?"On":"Paused"]})})]}),t.jsxs(XEe,{children:[t.jsx(QEe,{children:"This month"}),t.jsxs(ZEe,{children:[t.jsx("strong",{children:_}),v!=null?t.jsxs(t.Fragment,{children:[" / ",v]}):t.jsx(JEe,{children:" · no cap"})]})]}),v!=null&&t.jsx(e3e,{children:t.jsx(t3e,{style:{width:`${M}%`},$reached:$})}),t.jsx(n3e,{onClick:Q,children:a?k?t.jsxs(o3e,{children:[t.jsx(s3e,{type:"number",min:0,step:1,value:S,placeholder:"No cap",onChange:K=>I(K.target.value),disabled:o}),t.jsx("span",{children:y.capLabel}),t.jsx(at,{content:"Save cap",placement:"top",disabled:o,children:t.jsx(Tk,{t
7227ype:"button",onClick:F,disabled:o,children:t.jsx(Zn,{size:12})})}),t.jsx(at,{content:"Cancel",placement:"top",disabled:o,children:t.jsx(Tk,{type:"button",onClick:()=>{P(!1),I(v==null?"":String(v))},disabled:o,children:t.jsx(Ei,{size:12})})})]}):t.jsxs(r3e,{type:"button",onClick:()=>P(!0),disabled:r||o,children:[t.jsx(Lc,{size:11}),v==null?"Set monthly cap":`Edit cap (${v})`]}):t.jsx(i3e,{children:v==null?"No monthly cap set":`Cap: ${v} ${y.capLabel}`})}),!j&&!a&&i?.pause_reason&&t.jsx(YW,{children:t.jsx(XW,{children:t.jsxs("em",{children:["Paused â ",i.pause_reason]})})}),!j&&a&&t.jsx(YW,{onClick:Q,children:B?t.jsxs(t.Fragment,{children:[t.jsx(a3e,{value:A,placeholder:"Why is this agent paused? (optional)",onChange:K=>E(K.target.value),disabled:o}),t.jsx(at,{content:"Save note",placement:"top",disabled:o,children:t.jsx(Tk,{type:"button",onClick:Y,disabled:o,children:t.jsx(Zn,{size:12})})}),t.jsx(at,{content:"Cancel",placement:"top",disabled:o,children:t.jsx(Tk,{type:"button",onClick:()=>{T(!1),E(i?.pause_reason??"")},disabled:o,children:t.jsx(Ei,{size:12})})})]}):i?.pause_reason?t.jsxs(XW,{children:[t.jsxs("em",{children:["Paused â ",i.pause_reason]}),t.jsx(he,{variant:"outline",size:"sm",onClick:()=>T(!0),children:"Edit note"})]}):t.jsx(he,{variant:"outline",size:"sm",onClick:()=>T(!0),children:"Add a pause note"})}),$&&j&&t.jsxs(l3e,{children:["Monthly cap reached. This agent won't enqueue new ",y.cta," until ",FEe(i?.period_started_on),"."]})]})};function FEe(e){if(!e)return"next month";try{const n=new Date(e);return Number.isNaN(n.getTime())?"next month":new Date(n.getFullYear(),n.getMonth()+1,1).toLocaleDateString(void 0,{month:"short",day:"numeric"})}catch{return"next month"}}const WEe=p.div.withConfig({displayName:"AgentControls__Wrapper",componentId:"sc-6rm82-0"})` 7228 display: flex; 7229 flex-direction: column; 7230 gap: 0.5rem; 7231`,UEe=p.div.withConfig({displayName:"AgentControls__Grid",componentId:"sc-6rm82-1"})` 7232 display: grid; 7233 grid-template-columns: 1fr 1fr; 7234 gap: 0.75rem; 7235 @media (max-width: 720px) { grid-template-columns: 1fr; } 7236`,HEe=p.div.withConfig({displayName:"AgentControls__Card",componentId:"sc-6rm82-2"})` 7237 background: ${e=>e.$tabMode&&e.$selected?`color-mix(in srgb, ${cn} 80%, ${Z})`:Z}; 7238 border: ${e=>e.$tabMode&&e.$selected?`2px solid ${ot}`:`1px solid ${V}`}; 7239 border-left: ${e=>e.$tabMode&&e.$selected?`2px solid ${ot}`:`3px solid ${e.$status==="running"?Vt:e.$status==="capped"?$i:Ut}`}; 7240 /* Compensate for the 1px â 2px border swap when selected so the card 7241 doesn't visibly jump on activation. */ 7242 margin: ${e=>e.$tabMode&&e.$selected?"-1px":"0"}; 7243 border-radius: 0.6rem; 7244 padding: 0.85rem 1rem; 7245 display: flex; 7246 flex-direction: column; 7247 gap: 0.55rem; 7248 cursor: ${e=>e.$tabMode?"pointer":"default"}; 7249 transition: background 120ms ease, border-color 120ms ease, box-shadow 120ms ease; 7250 7251 &:hover { 7252 background: ${e=>e.$tabMode&&!e.$selected?`color-mix(in srgb, ${$e} 60%, ${Z})`:void 0}; 7253 } 7254 7255 &:focus-visible { 7256 outline: none; 7257 box-shadow: 0 0 0 3px ${En}; 7258 } 7259`,qEe=p.span.withConfig({displayName:"AgentControls__ActivePill",componentId:"sc-6rm82-3"})` 7260 display: inline-flex; 7261 align-items: center; 7262 padding: 0.1rem 0.45rem; 7263 border-radius: 999px; 7264 background: ${ot}; 7265 color: ${Z}; 7266 font-size: 0.6rem; 7267 font-weight: 800; 7268 letter-spacing: 0.04em; 7269 text-transform: uppercase; 7270`,GEe=p.div.withConfig({displayName:"AgentControls__CardHead",componentId:"sc-6rm82-4"})` 7271 display: flex; 7272 align-items: center; 7273 justify-content: space-between; 7274 gap: 0.5rem; 7275`,VEe=p.div.withConfig({displayName:"AgentControls__CardHeadActions",componentId:"sc-6rm82-5"})` 7276 display: inline-flex; 7277 align-items: center; 7278 gap: 0.4rem; 7279`,KEe=p.div.withConfig({displayName:"AgentControls__CardTitle",componentId:"sc-6rm82-6"})` 7280 display: inline-flex; 7281 align-items: center; 7282 gap: 0.4rem; 7283 font-size: 0.85rem; 7284 font-weight: 800; 7285 color: ${O}; 7286 & svg { color: ${Ft}; } 7287`,YEe=p.span.withConfig({displayName:"AgentControls__CountBadge",componentId:"sc-6rm82-7"})` 7288 display: inline-flex; 7289 align-items: center; 7290 justify-content: center; 7291 min-width: 1.25rem; 7292 padding: 0 0.35rem; 7293 border-radius: 999px; 7294 background: ${cn}; 7295 color: ${Ft}; 7296 font-size: 0.65rem; 7297 font-weight: 800; 7298`,KW=p.button.withConfig({displayName:"AgentControls__ToggleButton",componentId:"sc-6rm82-8"})` 7299 display: inline-flex; 7300 align-items: center; 7301 gap: 0.3rem; 7302 padding: 0.25rem 0.55rem; 7303 border-radius: 999px; 7304 font-size: 0.7rem; 7305 font-weight: 700; 7306 border: 1px solid ${e=>e.$on?Vt:Ut}; 7307 background: ${e=>e.$on?`color-mix(in srgb, ${Vt} 14%, ${Z})`:`color-mix(in srgb, ${Ut} 14%, ${Z})`}; 7308 color: ${e=>e.$on?Vt:Ut}; 7309 cursor: pointer; 7310 &:disabled { opacity: 0.6;
7310 cursor: not-allowed; } 7311`,XEe=p.div.withConfig({displayName:"AgentControls__UsageRow",componentId:"sc-6rm82-9"})` 7312 display: flex; 7313 align-items: baseline; 7314 justify-content: space-between; 7315`,QEe=p.span.withConfig({displayName:"AgentControls__UsageLabel",componentId:"sc-6rm82-10"})` 7316 font-size: 0.72rem; 7317 color: ${z}; 7318 text-transform: uppercase; 7319 letter-spacing: 0.04em; 7320`,ZEe=p.span.withConfig({displayName:"AgentControls__UsageValue",componentId:"sc-6rm82-11"})` 7321 font-size: 0.85rem; 7322 color: ${O}; 7323 & strong { font-weight: 800; } 7324`,JEe=p.span.withConfig({displayName:"AgentControls__Unlimited",componentId:"sc-6rm82-12"})` 7325 color: ${z}; 7326 font-weight: 500; 7327`,e3e=p.div.withConfig({displayName:"AgentControls__Bar",componentId:"sc-6rm82-13"})` 7328 height: 6px; 7329 background: ${$e}; 7330 border-radius: 999px; 7331 overflow: hidden; 7332`,t3e=p.div.withConfig({displayName:"AgentControls__Fill",componentId:"sc-6rm82-14"})` 7333 height: 100%; 7334 background: ${e=>e.$reached?Ut:Ft}; 7335 transition: width 200ms ease; 7336`,n3e=p.div.withConfig({displayName:"AgentControls__ControlsRow",componentId:"sc-6rm82-15"})` 7337 display: flex; 7338 align-items: center; 7339 justify-content: space-between; 7340 gap: 0.4rem; 7341`,i3e=p.span.withConfig({displayName:"AgentControls__CapStatic",componentId:"sc-6rm82-16"})` 7342 font-size: 0.72rem; 7343 color: ${z}; 7344 font-style: italic; 7345`,r3e=p.button.withConfig({displayName:"AgentControls__CapButton",componentId:"sc-6rm82-17"})` 7346 display: inline-flex; 7347 align-items: center; 7348 gap: 0.3rem; 7349 background: ${cn}; 7350 color: ${Ft}; 7351 border: 0; 7352 border-radius: 0.4rem; 7353 padding: 0.3rem 0.55rem; 7354 font-size: 0.72rem; 7355 font-weight: 700; 7356 cursor: pointer; 7357 &:disabled { opacity: 0.6; cursor: not-allowed; } 7358`,o3e=p.div.withConfig({displayName:"AgentControls__CapEditor",componentId:"sc-6rm82-18"})` 7359 display: inline-flex; 7360 align-items: center; 7361 gap: 0.35rem; 7362 font-size: 0.72rem; 7363 color: ${z}; 7364`,s3e=p.input.withConfig({displayName:"AgentControls__CapInput",componentId:"sc-6rm82-19"})` 7365 width: 5.5rem; 7366 padding: 0.25rem 0.4rem; 7367 border: 1px solid ${V}; 7368 border-radius: 0.35rem; 7369 font-size: 0.78rem; 7370 font-family: inherit; 7371 background: ${Z}; 7372 color: ${O}; 7373 &::placeholder { 7374 color: ${Pe}; 7375 } 7376 &:focus { 7377 outline: none; 7378 border-color: ${ot}; 7379 box-shadow: 0 0 0 3px ${En}; 7380 } 7381`,Tk=p.button.withConfig({displayName:"AgentControls__IconButton",componentId:"sc-6rm82-20"})` 7382 appearance: none; 7383 border: 1px solid ${V}; 7384 background: ${Z}; 7385 color: ${O}; 7386 width: 1.5rem; 7387 height: 1.5rem; 7388 display: inline-flex; 7389 align-items: center; 7390 justify-content: center; 7391 border-radius: 0.3rem; 7392 cursor: pointer; 7393 &:disabled { opacity: 0.6; cursor: not-allowed; } 7394`,YW=p.div.withConfig({displayName:"AgentControls__ReasonRow",componentId:"sc-6rm82-21"})` 7395 display: flex; 7396 align-items: center; 7397 gap: 0.4rem; 7398`,a3e=p.input.withConfig({displayName:"AgentControls__ReasonInput",componentId:"sc-6rm82-22"})` 7399 flex: 1; 7400 padding: 0.3rem 0.45rem; 7401 border: 1px solid ${V}; 7402 border-radius: 0.35rem; 7403 font-size: 0.78rem; 7404 font-family: inherit; 7405 background: ${Z}; 7406 color: ${O}; 7407 &::placeholder { 7408 color: ${Pe}; 7409 } 7410 &:focus { 7411 outline: none; 7412 border-color: ${ot}; 7413 box-shadow: 0 0 0 3px ${En}; 7414 } 7415`,XW=p.div.withConfig({displayName:"AgentControls__ReasonText",componentId:"sc-6rm82-23"})` 7416 display: flex; 7417 align-items: center; 7418 justify-content: space-between; 7419 gap: 0.5rem; 7420 flex: 1; 7421 font-size: 0.75rem; 7422 color: ${z}; 7423 & em { font-style: italic; } 7424`,l3e=p.div.withConfig({displayName:"AgentControls__CapWarning",componentId:"sc-6rm82-24"})` 7425 font-size: 0.72rem; 7426 color: ${$i}; 7427 background: color-mix(in srgb, ${$i} 14%, ${Z}); 7428 padding: 0.35rem 0.5rem; 7429 border-radius: 0.4rem; 7430`;function c3e({organizationId:e,projectId:n,filters:i,page:r,perPage:o=25,enabled:s=!0}){const a=e??null,c=n??null,[u,m]=l.useState(null),[h,g]=l.useState(!1),[x,y]=l.useState(null),[w,j]=l.useState(0),v=l.useMemo(()=>{const $=new URLSearchParams;return $.set("source",i.source),i.status&&$.set("status",i.status),i.agentType&&$.set("agent_type",i.agentType),i.command&&$.set("command",i.command),i.auditCode&&$.set("audit_code",i.auditCode),i.severity&&$.set("severity",i.severity),i.q&&$.set("q",i.q),i.since&&$.set("since",i.since),i.until&&$.set("until",i.until),$.set("page",String(r)),$.set("per_page",String(o)),$.toString()},[i,r,o]);l.useEffect(()=>{if(!s||!a||!c)return;let $=!1;g(!0),y(null);const k=`/api/v1/organizations/${a}/projects/${c}/agent_activity/log?${v}`;return ue(k).then(async P=>{const S=await P.json().catch(()=>({}));if(!P.ok)throw new Error(S?.error||`Failed to load log (HTTP ${P.status})`);$||m(S)}).catch(P=>{$||(y(P instanceof Error?P.message:"Network error"),m(null))}).finally(()=>{$||g(!1)}),()=>{$=!0}},[a,c,v,s,w]);const _=l.useCallback(()=>j($=>$+1),[]);return{data:u,loading:h,error:x,refetch:_}}function d3e({organizationId:e,projectId:n,onRetry:i,isRetryPending:r,onRevert:o,isRevertPending:s,canManage:a=!0}){const[c,u]=l.useState("operation"),[m,h]=l.useState(""),[g,x]=l.useState(""),[y,w]=l.useState(""),[j,v]=l.useState(1),_=B=>{B!==c&&(u(B),h(""),B==="content_draft"&&x(""),v(1))},$=l.useMemo(()=>({source:c,status:m||void 0,agentType:g||void 0,q:y||void 0}),[c,m,g,y]),{data:k,loading:P,error:S,refetch:I}=c3e({organizationId:e,projectId:n,filters:$,page:j,perPage:25}),A=k?.total_pages??0,E=k?.total??0;return t.jsxs(x3e,{children:[t.jsxs(b3e,{children:[t.jsxs(v3e,{children:[t.jsxs(Vz,{$active:c==="operation",onClick:()=>_("operation"),children:[t.jsx(Lm,{size:12})," Operations"]}),t.jsxs(Vz,{$active:c==="proposal",onClick:()=>_("proposal"),children:[t.jsx(Dy,{size:12})," Proposals"]}),t.jsxs(Vz,{$active:c==="content_draft",onClick:()=>_("content_draft"),children:[t.jsx(Ss,{size:12})," Drafts"]})]}),t.jsxs(w3e,{children:[t.jsx(Cs,{size:12}),t.jsx(j3e,{placeholder:h3e(c),value:y,onChange:B=>{w(B.target.value),v(1)}})]}),t.jsx(at,{content:"Refresh",placement:"top",children:t.jsx(_3e,{type:"button",onClick:I,children:t.jsx(No,{size:12})})})]}),t.jsxs(C3e,{children:[m3e[c].map(B=>t.jsx(Ek,{$active:m===B.value,onClick:()=>{h(B.value),v(1)},children:B.label},B.value||"all")),c!=="content_draft"&&t.jsxs(t.Fragment,{children:[t.jsx(S3e,{}),t.jsx(Ek,{$active:g==="",onClick:()=>{x(""),v(1)},children:"All agents"}),t.jsx(Ek,{$active:g==="tech",onClick:()=>{x("tech"),v(1)},children:"Tech"}),t.jsx(Ek,{$active:g==="content",onClick:()=>{x("content"),v(1)},children:"Content"})]})]}),S&&t.jsxs(k3e,{children:[t.jsx(ei,{size:12}
7430)," ",S]}),t.jsx($3e,{children:P&&!k?t.jsxs(QW,{children:[t.jsx(I3e,{size:14})," ",t.jsx("span",{children:"Loading logâ¦"})]}):k&&k.events.length===0?t.jsx(QW,{children:"No events match these filters."}):k?t.jsx(P3e,{children:k.events.map(B=>t.jsx(u3e,{ev:B,onRetry:a?i:void 0,isRetryPending:r,onRevert:a?o:void 0,isRevertPending:s},B.id))}):null}),t.jsxs(H3e,{children:[t.jsx(q3e,{children:E>0?`Showing ${(j-1)*(k?.per_page??25)+1}â${Math.min(j*(k?.per_page??25),E)} of ${E}`:""}),t.jsxs(G3e,{children:[t.jsx(eU,{type:"button",disabled:j<=1||P,onClick:()=>v(B=>Math.max(1,B-1)),children:"â Prev"}),t.jsxs(V3e,{children:["Page ",j," of ",Math.max(1,A)]}),t.jsx(eU,{type:"button",disabled:P||j>=Math.max(1,A),onClick:()=>v(B=>B+1),children:"Next â"})]})]})]})}function u3e({ev:e,onRetry:n,isRetryPending:i,onRevert:r,isRevertPending:o}){const[s,a]=l.useState(!1),c=f3e(e.status),u=g3e(e.status),m=y3e(e.occurred_at),h=e.source==="operation"?e.source_id:null,g=!!h&&!!n&&e.details?.retryable===!0,x=!!h&&!!i&&i(h),y=!!h&&!!r&&e.details?.revertable===!0,w=!!h&&!!o&&o(h),j=v=>v.stopPropagation();return t.jsxs(A3e,{children:[t.jsxs(z3e,{onClick:()=>a(v=>!v),children:[t.jsx(T3e,{children:s?t.jsx(qn,{size:12}):t.jsx(Gi,{size:12})}),t.jsx(E3e,{$tone:c,children:t.jsx(u,{size:11})}),t.jsx(M3e,{children:e.summary}),t.jsx(R3e,{$type:e.agent_type,children:e.agent_type}),t.jsx(at,{content:e.occurred_at??"",placement:"top",maxWidth:360,disabled:!e.occurred_at,children:t.jsxs(O3e,{children:[t.jsx(qc,{size:11})," ",m]})}),(g||y)&&h!==null&&t.jsxs(N3e,{onClick:j,children:[g&&t.jsx(at,{content:"Re-queue this failed operation with the same parameters",placement:"top",maxWidth:280,disabled:x,children:t.jsxs(ZW,{type:"button",$tone:"brand",onClick:()=>n?.(h),disabled:x,children:[t.jsx(Wne,{size:11}),x?"Retryingâ¦":"Retry"]})}),y&&t.jsx(at,{content:"Undo this fix and restore the previous values",placement:"top",maxWidth:280,disabled:w,children:t.jsxs(ZW,{type:"button",onClick:()=>r?.(h),disabled:w,children:[t.jsx(J8,{size:11}),w?"Revertingâ¦":"Revert"]})})]})]}),s&&t.jsx(p3e,{ev:e})]})}function p3e({ev:e}){const n=e.details;return t.jsxs(D3e,{children:[e.source==="operation"&&t.jsxs(Kz,{children:[t.jsx(ca,{label:"Command",value:String(n.command??"â"),mono:!0}),n.audit_code!=null&&t.jsx(ca,{label:"Audit code",value:String(n.audit_code),mono:!0}),n.audit_page_url!=null&&t.jsx(ca,{label:"Page",value:t.jsxs(Yz,{href:String(n.audit_page_url),target:"_blank",rel:"noopener noreferrer",children:[String(n.audit_page_url),t.jsx(as,{size:10})]})}),n.credits_charged!=null&&t.jsx(ca,{label:"Credits",value:String(n.credits_charged)}),n.error_code!=null&&t.jsx(ca,{label:"Error",value:t.jsxs(JW,{children:[t.jsx(ei,{size:10}),t.jsx("span",{children:String(n.error_code)}),n.error_message?t.jsxs("em",{children:["â ",String(n.error_message)]}):null]})}),n.reverted_at!=null&&t.jsx(ca,{label:"Reverted at",value:String(n.reverted_at)})]}),e.source==="proposal"&&t.jsxs(Kz,{children:[n.audit_code!=null&&t.jsx(ca,{label:"Audit code",value:String(n.audit_code),mono:!0}),n.audit_severity!=null&&t.jsx(ca,{label:"Severity",value:String(n.audit_severity)}),n.audit_page_url!=null&&t.jsx(ca,{label:"Page",value:t.jsxs(Yz,{href:String(n.audit_page_url),target:"_blank",rel:"noopener noreferrer",children:[String(n.audit_page_url)," ",t.jsx(as,{size:10})]})}),n.dismiss_reason!=null&&t.jsx(ca,{label:"Dismiss reason",value:String(n.dismiss_reason)}),n.triggered_by_rule_id!=null&&t.jsx(ca,{label:"Triggered by rule",value:`#${n.triggered_by_rule_id}`}),n.self_healing_operation_id!=null&&t.jsx(ca,{label:"Linked op",value:`#${n.self_healing_operation_id}`})]}),e.source==="content_draft"&&t.jsxs(Kz,{children:[n.title!=null&&t.jsx(ca,{label:"Title",value:String(n.title)}),n.post_type!=null&&t.jsx(ca,{label:"Post type",value:String(n.post_type)}),n.wp_post_status!=null&&t.jsx(ca,{label:"WP status",value:String(n.wp_post_status)}),n.wp_permalink!=null&&t.jsx(ca,{label:"Permalink",value:t.jsxs(Yz,{href:String(n.wp_permalink),target:"_blank",rel:"noopener noreferrer",children:[String(n.wp_permalink)," ",t.jsx(as,{size:10})]})}),n.generation_error!=null&&t.jsx(ca,{label:"Generation error",value:t.jsxs(JW,{children:[t.jsx(ei,{size:10}),t.jsx("span",{children:String(n.generation_error)})]})})]}),t.jsx(W3e,{children:t.jsxs(U3e,{children:[t.jsx("summary",{children:"Raw details"}),t.jsx("pre",{children:JSON.stringify(n,null,2)})]})})]})}function ca({label:e,value:n,mono:i}){return t.jsxs(L3e,{children:[t.jsx(B3e,{children:e}),t.jsx(F3e,{$mono:!!i,children:n})]})}const m3e={operation:[{value:"",label:"All"},{value:"queued",label:"Queued"},{value:"dispatched",label:"Dispatched"},{value:"succeeded",label:"Succeeded"},{value:"failed",label:"Failed"},{value:"cancelled",label:"Cancelled"},{value:"expired",label:"Expired"}],proposal:[{value:"",label:"All"},{value:"pending",label:"Pending"},{value:"accepted",label:"Accepted"},{value:"dismissed",label:"Dismissed"},{value:"stale",label:"Stale"},{value:"expired",label:"Expired"}],content_draft:[{value:"",label:"All"},{value:"pending_generation",label:"Drafting"},{value:"pending_review",label:"Awaiting review"},{value:"approved",label:"Approved"},{value:"publishing",label:"Publishing"},{value:"published",label:"Published"},{value:"failed",label:"Failed"},{value:"dismissed",label:"Dismissed"},{value:"superseded",label:"Replaced"}]};function h3e(e){switch(e){case"operation":return"Search commandâ¦";case"proposal":return"Search code, message, page URLâ¦";case"content_draft":return"Search title or slugâ¦"}}function f3e(e){return["succeeded","accepted","approved","published"].includes(e)?"ok":["failed","expired","cancelled"].includes(e)?"err":["pending_review","dispatched","publishing","regenerating","queued","pending_generation","pending"].includes(e)?"warn":"info"}function g3e(e){return["succeeded","accepted","approved","published"].includes(e)?co:["failed","expired","cancelled","dismissed"].includes(e)?Hc:["queued","dispatched","pending","publishing","regenerating","pending_generation","pending_review"].includes(e)?qc:ei}function y3e(e){if(!e)return"";const n=new Date(e).getTime();if(!Number.isFinite(n))return"";const i=Date.now()-n,r=Math.floor(i/6e4);if(r<1)return"just now";if(r<60)return`${r}m ago`;const o=Math.floor(r/60);if(o<24)return`${o}h ago`;const s=Math.floor(o/24);return s<30?`${s}d ago`:new Date(e).toLocaleDateString()}const x3e=p.section.withConfig({displayName:"ActivityLog__Wrap",componentId:"sc-hc4pxv-0"})` 7431 display: grid; 7432 gap: 0.75rem; 7433 background: ${Z}; 7434 border: 1px solid ${V}; 7435 border-radius: 0.75rem; 7436 padding: 1rem; 7437`,b3e=p.div.withConfig({displayName:"ActivityLog__Header",componentId:"sc-hc4pxv-1"})` 7438 display: flex; 7439 align-items: center; 7440 gap: 0.5rem; 7441 flex-wrap: wrap; 7442`,v3e=p.div.withConfig({displayName:"ActivityLog__SourceTabs",componentId:"sc-hc4pxv-2"})` 7443 display: inline-flex; 7444 background: ${$e}; 7445 border-radius: 0.5rem; 7446 padding: 0.2rem; 7447 gap: 0.15rem; 7448`,Vz=p.button.withConfig({displayName:"ActivityLog__SourceTab",componentId:"sc-hc4pxv-3"})` 7449 display: inline-flex; 7450 align-items: center; 7451 gap: 0.3rem; 7452 font-family: inherit; 7453 font-size: 0.75rem; 7454 font-weight: 700; 7455 background: ${e=>e.$active?Z:"transparent"}; 7456 color: ${e=>e.$active?O:z}; 7457 border: 1px solid ${e=>e.$active?V:"transparent"}; 7458 border-radius: 0.4rem; 7459 padding: 0.3rem 0.55rem; 7460 cursor: pointer; 7461 &:hover { color: ${O}; } 7462`,w3e=p.div.withConfig({displayName:"ActivityLog__SearchBox",componentId:"sc-hc4pxv-4"})` 7463 flex: 1; 7464 min-width: 0; 7465 display: inline-flex; 7466 align-items: center; 7467 gap: 0.3rem; 7468 background: ${At}; 7469 border: 1px solid ${V}; 7470 border-radius: 0.5rem; 7471 padding: 0.35rem 0.55rem; 7472 color: ${z}; 7473 7474 @media (min-width: 640px) { 7475 min-width: 180px; 7476 } 7477 7478 @media (max-width: 639px) { 7479 flex: 1 1 100%; 7480 } 7481`,j3e=p.input.withConfig({displayName:"ActivityLog__SearchInput",componentId:"sc-hc4pxv-5"})` 7482 flex: 1; 7483 background: transparent; 7484 border: 0; 7485 outline: 0; 7486 font-family: inherit; 7487 font-size: 0.8rem; 7488 color: ${O}; 7489 &::placeholder { color: ${z}; } 7490`,_3e=p.button.withConfig({displayName:"ActivityLog__RefreshBtnInner",componentId:"sc-hc4pxv-6"})` 7491 display: inline-flex; 7492 align-items: center; 7493 justify-content: center; 7494 background: ${Z}; 7495 color: ${z}; 7496 border: 1px solid ${V}; 7497 border-radius: 0.5rem; 7498 padding: 0.4rem; 7499 cursor: pointer; 7500 &:hover { background: ${At}; color: ${O}; } 7501`,C3e=p.div.withConfig({displayName:"ActivityLog__Filters",componentId:"sc-hc4pxv-7"})` 7502 display: flex; 7503 align-items: center; 7504 gap: 0.3rem; 7505 flex-wrap: wrap; 7506`,S3e=p.div.withConfig({displayName:"ActivityLog__Sep",componentId:"sc-hc4pxv-8"})` 7507 width: 1px; 7508 height: 16px; 7509 background: ${V}; 7510 margin: 0 0.25rem; 7511`,Ek=p.button.withConfig({displayName:"ActivityLog__Chip",componentId:"sc-hc4pxv-9"})` 7512 font-family: inherit; 7513 font-size: 0.68rem; 7514 font-weight: 700; 7515 text-transform: uppercase; 7516 letter-spacing: 0.04em; 7517 background: ${e=>e.$active?cn:Z}; 7518 color: ${e=>e.$active?Ft:z}; 7519 border: 1px solid ${e=>e.$active?ot:V}; 7520 border-radius: 0.4rem; 7521 padding: 0.25rem 0.5rem; 7522 cursor: pointer; 7523 &:hover { color: ${Ft}; border-color: ${ot}; } 7524`,k3e=p.div.withConfig({displayName:"ActivityLog__ErrorBanner",componentId:"sc-hc4pxv-10"})` 7525 display: flex; 7526 align-items: center; 7527 gap: 0.4rem; 7528 background: ${kn}; 7529 color: ${sr}; 7530 border-radius: 0.5rem; 7531 padding: 0.5rem 0.7rem; 7532 font-size: 0.75rem; 7533`,$3e=p.div.withConfig({displayName:"ActivityLog__TableShell",componentId:"sc-hc4pxv-11"})` 7534 border: 1px solid ${V}; 7535 border-radius: 0.5rem; 7536 overflow-x: auto; 7537 -webkit-overflow-scrolling: touch; 7538 background: ${Z}; 7539`,QW=p.div.withConfig({displayName:"ActivityLog__Empty",componentId:"sc-hc4pxv-12"})` 7540 display: flex; 7541 align-items: center; 7542 justify-content: center; 7543 gap: 0.4rem; 7544 padding: 2rem; 7545 color: ${z}; 7546 font-size: 0.85rem; 7547`,I3e=p(Tr).withConfig({displayName:"ActivityLog__Spinner",componentId:"sc-hc4pxv-13"})` 7548 animation: spin 0.8s linear infinite; 7549 @keyframes spin { to { transform: rotate(360deg); } } 7550`,P3e=p.div.withConfig({displayName:"ActivityLog__Rows",componentId:"sc-hc4pxv-14"})` 7551 display: flex; 7552 flex-direction: column; 7553`,A3e=p.div.withConfig({displayName:"ActivityLog__RowOuter",componentId:"sc-hc4pxv-15"})` 7554 border-bottom: 1px solid ${$e}; 7555 &:last-child { border-bottom: 0; } 7556`,N3e=p.div.withConfig({displayName:"ActivityLog__RowActions",componentId:"sc-hc4pxv-16"})` 7557 display: inline-flex; 7558 align-items: center; 7559 gap: 0.3rem; 7560 flex-wrap: wrap; 7561 justify-content: flex-end; 7562 7563 @media (max-width: 640px) { 7564 grid-column: 1 / -1; 7565 justify-self: end; 7566 margin-top: 0.1rem; 7567 } 7568`,z3e=p.div.withConfig({displayName:"ActivityLog__RowHead",componentId:"sc-hc4pxv-17"})` 7569 display: grid; 7570 /* caret · status · summary · agent chip · when · (optional actions) */ 7571 grid-template-columns: 16px 22px minmax(0, 1fr) auto auto auto; 7572 align-items: center; 7573 gap: 0.55rem; 7574 padding: 0.55rem 0.75rem; 7575 min-width: 0; 7576 cursor: pointer; 7577 &:hover { background: ${At}; } 7578 7579 @media (max-width: 640px) { 7580 grid-template-columns: 14px 20px minmax(0, 1fr); 7581 gap: 0.4rem; 7582 row-gap: 0.45rem; 7583 padding: 0.5rem 0.55rem;
7584 align-items: start; 7585 } 7586`,ZW=p.button.withConfig({displayName:"ActivityLog__RowActionBtn",componentId:"sc-hc4pxv-18"})` 7587 display: inline-flex; 7588 align-items: center; 7589 gap: 0.25rem; 7590 font-family: inherit; 7591 font-size: 0.65rem; 7592 font-weight: 700; 7593 text-transform: uppercase; 7594 letter-spacing: 0.04em; 7595 background: ${e=>e.$tone==="brand"?cn:Z}; 7596 color: ${e=>e.$tone==="brand"?Ft:O}; 7597 border: 1px solid ${e=>e.$tone==="brand"?cn:V}; 7598 border-radius: 999px; 7599 padding: 0.18rem 0.55rem; 7600 cursor: pointer; 7601 &:hover:not(:disabled) { 7602 background: ${e=>e.$tone==="brand"?cn:$e}; 7603 border-color: ${e=>e.$tone==="brand"?Ft:z}; 7604 } 7605 &:disabled { opacity: 0.55; cursor: not-allowed; } 7606`,T3e=p.span.withConfig({displayName:"ActivityLog__Caret",componentId:"sc-hc4pxv-19"})` 7607 display: inline-flex; 7608 color: ${z}; 7609`,E3e=p.span.withConfig({displayName:"ActivityLog__StatusDot",componentId:"sc-hc4pxv-20"})` 7610 display: inline-flex; 7611 align-items: center; 7612 justify-content: center; 7613 width: 22px; 7614 height: 22px; 7615 border-radius: 50%; 7616 background: ${e=>e.$tone==="ok"?si:e.$tone==="err"?kn:e.$tone==="warn"?Jl:$e}; 7617 color: ${e=>e.$tone==="ok"?Vt:e.$tone==="err"?Ut:e.$tone==="warn"?$i:z}; 7618`,M3e=p.div.withConfig({displayName:"ActivityLog__RowSummary",componentId:"sc-hc4pxv-21"})` 7619 font-size: 0.8rem; 7620 color: ${O}; 7621 font-weight: 600; 7622 overflow: hidden; 7623 text-overflow: ellipsis; 7624 white-space: nowrap; 7625`,R3e=p.span.withConfig({displayName:"ActivityLog__AgentChip",componentId:"sc-hc4pxv-22"})` 7626 display: inline-flex; 7627 align-items: center; 7628 font-size: 0.6rem; 7629 font-weight: 800; 7630 text-transform: uppercase; 7631 letter-spacing: 0.05em; 7632 padding: 0.15rem 0.4rem; 7633 border-radius: 0.35rem; 7634 background: ${e=>e.$type==="tech"?cn:si}; 7635 color: ${e=>e.$type==="tech"?Ft:Vt}; 7636`,O3e=p.span.withConfig({displayName:"ActivityLog__RowWhen",componentId:"sc-hc4pxv-23"})` 7637 display: inline-flex; 7638 align-items: center; 7639 gap: 0.25rem; 7640 font-size: 0.7rem; 7641 color: ${z}; 7642 white-space: nowrap; 7643`,D3e=p.div.withConfig({displayName:"ActivityLog__Details",componentId:"sc-hc4pxv-24"})` 7644 background: ${At}; 7645 border-top: 1px solid ${$e}; 7646 padding: 0.7rem 1rem 0.85rem; 7647 display: grid; 7648 gap: 0.5rem; 7649`,Kz=p.div.withConfig({displayName:"ActivityLog__DList",componentId:"sc-hc4pxv-25"})` 7650 display: grid; 7651 gap: 0.3rem; 7652`,L3e=p.div.withConfig({displayName:"ActivityLog__DRowWrap",componentId:"sc-hc4pxv-26"})` 7653 display: grid; 7654 grid-template-columns: 110px minmax(0, 1fr); 7655 gap: 0.5rem; 7656 align-items: start; 7657 font-size: 0.75rem; 7658`,B3e=p.span.withConfig({displayName:"ActivityLog__DLabel",componentId:"sc-hc4pxv-27"})` 7659 text-transform: uppercase; 7660 letter-spacing: 0.04em; 7661 font-weight: 700; 7662 color: ${z}; 7663 font-size: 0.62rem; 7664 padding-top: 0.18rem; 7665`,F3e=p.span.withConfig({displayName:"ActivityLog__DValue",componentId:"sc-hc4pxv-28"})` 7666 color: ${O}; 7667 font-family: ${e=>e.$mono?"ui-monospace, SFMono-Regular, Menlo, monospace":"inherit"}; 7668 font-size: ${e=>e.$mono?"0.7rem":"0.78rem"}; 7669 word-break: break-word; 7670 display: inline-flex; 7671 align-items: center; 7672 gap: 0.3rem; 7673`,JW=p.span.withConfig({displayName:"ActivityLog__ErrorPill",componentId:"sc-hc4pxv-29"})` 7674 display: inline-flex; 7675 align-items: center; 7676 gap: 0.25rem; 7677 background: ${kn}; 7678 color: ${sr}; 7679 border-radius: 0.35rem; 7680 padding: 0.15rem 0.45rem; 7681 font-size: 0.7rem; 7682 & em { font-style: italic; color: ${z}; } 7683`,Yz=p.a.withConfig({displayName:"ActivityLog__PageLink",componentId:"sc-hc4pxv-30"})` 7684 display: inline-flex; 7685 align-items: center; 7686 gap: 0.25rem; 7687 color: ${Ft}; 7688 text-decoration: none; 7689 font-weight: 600; 7690 &:hover { text-decoration: underline; } 7691`,W3e=p.div.withConfig({displayName:"ActivityLog__RawSummary",componentId:"sc-hc4pxv-31"})` 7692 border-top: 1px dashed ${V}; 7693 padding-top: 0.45rem; 7694`,U3e=p.details.withConfig({displayName:"ActivityLog__RawDetails",componentId:"sc-hc4pxv-32"})` 7695 font-size: 0.7rem; 7696 color: ${z}; 7697 & > summary { 7698 cursor: pointer; 7699 text-transform: uppercase; 7700 letter-spacing: 0.04em; 7701 font-weight: 700; 7702 padding: 0.1rem 0; 7703 user-select: none; 7704 } 7705 & > pre { 7706 margin: 0.3rem 0 0; 7707 padding: 0.5rem; 7708 background: ${Z}; 7709 border: 1px solid ${V}; 7710 border-radius: 0.4rem; 7711 color: ${O}; 7712 font-family: ui-monospace, SFMono-Regular, Menlo, monospace; 7713 font-size: 0.7rem; 7714 line-height: 1.45; 7715 white-space: pre-wrap; 7716 word-break: break-word; 7717 max-height: 320px; 7718 overflow: auto; 7719 } 7720`,H3e=p.div.withConfig({displayName:"ActivityLog__Footer",componentId:"sc-hc4pxv-33"})` 7721 display: flex; 7722 align-items: center; 7723 justify-content: space-between; 7724 gap: 0.5rem; 7725 padding: 0 0.25rem; 7726`,q3e=p.span.withConfig({displayName:"ActivityLog__FooterText",componentId:"sc-hc4pxv-34"})` 7727 color: ${z}; 7728 font-size: 0.72rem; 7729`,G3e=p.div.withConfig({displayName:"ActivityLog__Pager",componentId:"sc-hc4pxv-35"})` 7730 display: inline-flex; 7731 align-items: center; 7732 gap: 0.4rem; 7733`,eU=p.button.withConfig({displayName:"ActivityLog__PagerBtn",componentId:"sc-hc4pxv-36"})` 7734 font-family: inherit; 7735 font-size: 0.72rem; 7736 font-weight: 700; 7737 background: ${Z}; 7738 color: ${O}; 7739 border: 1px solid ${V}; 7740 border-radius: 0.4rem; 7741 padding: 0.3rem 0.55rem; 7742 cursor: pointer; 7743 &:hover:enabled { background: ${At}; } 7744 &:disabled { opacity: 0.5;
7744 cursor: not-allowed; } 7745`,V3e=p.span.withConfig({displayName:"ActivityLog__PagerLabel",componentId:"sc-hc4pxv-37"})` 7746 color: ${z}; 7747 font-size: 0.72rem; 7748 min-width: 100px; 7749 text-align: center; 7750`;function Mre(e){var n,i,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(n=0;n<o;n++)e[n]&&(i=Mre(e[n]))&&(r&&(r+=" "),r+=i)}else for(i in e)e[i]&&(r&&(r+=" "),r+=i);return r}function Ri(){for(var e,n,i=0,r="",o=arguments.length;i<o;i++)(e=arguments[i])&&(n=Mre(e))&&(r&&(r+=" "),r+=n);return r}var K3e=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"];function BM(e){if(typeof e!="string")return!1;var n=K3e;return n.includes(e)}var Y3e=["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRen
7750dering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"],X3e=new Set(Y3e);function Rre(e){return typeof e!="string"?!1:X3e.has(e)}function Ore(e){return typeof e=="string"&&e.startsWith("data-")}function yl(e){if(typeof e!="object"||e===null)return{};var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(Rre(i)||Ore(i))&&(n[i]=e[i]);return n}function $y(e){if(e==null)return null;if(l.isValidElement(e)&&typeof e.props=="object"&&e.props!==null){var n=e.props;return yl(n)}return typeof e=="object"&&!Array.isArray(e)?yl(e):null}function ba(e){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(Rre(i)||Ore(i)||BM(i))&&(n[i]=e[i]);return n}function Q3e(e){return e==null?null:l.isValidElement(e)?ba(e.props):typeof e=="object"&&!Array.isArray(e)?ba(e):null}var Z3e=["children","width","height","viewBox","className","style","title","desc"];function a3(){return a3=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var i=arguments[n];for(var r in i)({}).hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},a3.apply(null,arguments)}function J3e(e,n){if(e==null)return{};var i,r,o=e8e(e,n);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)i=s[r],n.indexOf(i)===-1&&{}.propertyIsEnumerable.call(e,i)&&(o[i]=e[i])}return o}function e8e(e,n){if(e==null)return{};var i={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(n.indexOf(r)!==-1)continue;i[r]=e[r]}return i}var FM=l.forwardRef((e,n)=>{var{children:i,width:r,height:o,viewBox:s,className:a,style:c,title:u,desc:m}=e,h=J3e(e,Z3e),g=s||{width:r,height:o,x:0,y:0},x=Ri("recharts-surface",a);return l.createElement("svg",a3({},ba(h),{className:x,width:r,height:o,style:c,viewBox:"".concat(g.x," ").concat(g.y," ").concat(g.width," ").concat(g.height),ref:n}),l.createElement("title",null,u),l.createElement("desc",null,m),i)}),t8e=["children","className"];function l3(){return l3=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var i=arguments[n];for(var r in i)({}).hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},l3.apply(null,arguments)}function n8e(e,n){if(e==null)return{};var i,r,o=i8e(e,n);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)i=s[r],n.indexOf(i)===-1&&{}.propertyIsEnumerable.call(e,i)&&(o[i]=e[i])}return o}function i8e(e,n){if(e==null)return{};var i={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(n.indexOf(r)!==-1)continue;i[r]=e[r]}return i}
7750var bo=l.forwardRef((e,n)=>{var{children:i,className:r}=e,o=n8e(e,t8e),s=Ri("recharts-layer",r);return l.createElement("g",l3({className:s},ba(o),{ref:n}),i)}),Dre=l.createContext(null),r8e=()=>l.useContext(Dre);function Fr(e){return function(){return e}}const Lre=Math.cos,J5=Math.sin,Mu=Math.sqrt,eI=Math.PI,DP=2*eI,c3=Math.PI,d3=2*c3,Kg=1e-6,o8e=d3-Kg;function Bre(e){this._+=e[0];for(let n=1,i=e.length;n<i;++n)this._+=arguments[n]+e[n]}function s8e(e){let n=Math.floor(e);if(!(n>=0))throw new Error(`invalid digits: ${e}`);if(n>15)return Bre;const i=10**n;return function(r){this._+=r[0];for(let o=1,s=r.length;o<s;++o)this._+=Math.round(arguments[o]*i)/i+r[o]}}let a8e=class{constructor(n){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=n==null?Bre:s8e(n)}moveTo(n,i){this._append`M${this._x0=this._x1=+n},${this._y0=this._y1=+i}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(n,i){this._append`L${this._x1=+n},${this._y1=+i}`}quadraticCurveTo(n,i,r,o){this._append`Q${+n},${+i},${this._x1=+r},${this._y1=+o}`}bezierCurveTo(n,i,r,o,s,a){this._append`C${+n},${+i},${+r},${+o},${this._x1=+s},${this._y1=+a}`}arcTo(n,i,r,o,s){if(n=+n,i=+i,r=+r,o=+o,s=+s,s<0)throw new Error(`negative radius: ${s}`);let a=this._x1,c=this._y1,u=r-n,m=o-i,h=a-n,g=c-i,x=h*h+g*g;if(this._x1===null)this._append`M${this._x1=n},${this._y1=i}`;else if(x>Kg)if(!(Math.abs(g*u-m*h)>Kg)||!s)this._append`L${this._x1=n},${this._y1=i}`;else{let y=r-a,w=o-c,j=u*u+m*m,v=y*y+w*w,_=Math.sqrt(j),$=Math.sqrt(x),k=s*Math.tan((c3-Math.acos((j+x-v)/(2*_*$)))/2),P=k/$,S=k/_;Math.abs(P-1)>Kg&&this._append`L${n+P*h},${i+P*g}`,this._append`A${s},${s},0,0,${+(g*y>h*w)},${this._x1=n+S*u},${this._y1=i+S*m}`}}arc(n,i,r,o,s,a){if(n=+n,i=+i,r=+r,a=!!a,r<0)throw new Error(`negative radius: ${r}`);let c=r*Math.cos(o),u=r*Math.sin(o),m=n+c,h=i+u,g=1^a,x=a?o-s:s-o;this._x1===null?this._append`M${m},${h}`:(Math.abs(this._x1-m)>Kg||Math.abs(this._y1-h)>Kg)&&this._append`L${m},${h}`,r&&(x<0&&(x=x%d3+d3),x>o8e?this._append`A${r},${r},0,1,${g},${n-c},${i-u}A${r},${r},0,1,${g},${this._x1=m},${this._y1=h}`:x>Kg&&this._append`A${r},${r},0,${+(x>=c3)},${g},${this._x1=n+r*Math.cos(s)},${this._y1=i+r*Math.sin(s)}`)}rect(n,i,r,o){this._append`M${this._x0=this._x1=+n},${this._y0=this._y1=+i}h${r=+r}v${+o}h${-r}Z`}toString(){return this._}};function WM(e){let n=3;return e.digits=function(i){if(!arguments.length)return n;if(i==null)n=null;else{const r=Math.floor(i);if(!(r>=0))throw new RangeError(`invalid digits: ${i}`);n=r}return e},()=>new a8e(n)}function UM(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Fre(e){this._context=e}Fre.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,n){switch(e=+e,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,n):this._context.moveTo(e,n);break;case 1:this._point=2;default:this._context.lineTo(e,n);break}}};function LP(e){return new Fre(e)}function Wre(e){return e[0]}function Ure(e){return e[1]}function Hre(e,n){var i=Fr(!0),r=null,o=LP,s=null,a=WM(c);e=typeof e=="function"?e:e===void 0?Wre:Fr(e),n=typeof n=="function"?n:n===void 0?Ure:Fr(n);function c(u){var m,h=(u=UM(u)).length,g,x=!1,y;for(r==null&&(s=o(y=a())),m=0;m<=h;++m)!(m<h&&i(g=u[m],m,u))===x&&((x=!x)?s.lineStart():s.lineEnd()),x&&s.point(+e(g,m,u),+n(g,m,u));if(y)return s=null,y+""||null}return c.x=function(u){return arguments.length?(e=typeof u=="function"?u:Fr(+u),c):e},c.y=function(u){return arguments.length?(n=typeof u=="function"?u:Fr(+u),c):n},c.defined=function(u){return arguments.length?(i=typeof u=="function"?u:Fr(!!u),c):i},c.curve=function(u){return arguments.length?(o=u,r!=null&&(s=o(r)),c):o},c.context=function(u){return arguments.length?(u==null?r=s=null:s=o(r=u),c):r},c}function Mk(e,n,i){var r=null,o=Fr(!0),s=null,a=LP,c=null,u=WM(m);e=typeof e=="function"?e:e===void 0?Wre:Fr(+e),n=typeof n=="function"?n:Fr(n===void 0?0:+n),i=typeof i=="function"?i:i===void 0?Ure:Fr(+i);function m(g){var x,y,w,j=(g=UM(g)).length,v,_=!1,$,k=new Array(j),P=new Array(j);for(s==null&&(c=a($=u())),x=0;x<=j;++x){if(!(x<j&&o(v=g[x],x,g))===_)if(_=!_)y=x,c.areaStart(),c.lineStart();else{for(c.lineEnd(),c.lineStart(),w=x-1;w>=y;--w)c.point(k[w],P[w]);c.lineEnd(),c.areaEnd()}_&&(k[x]=+e(v,x,g),P[x]=+n(v,x,g),c.point(r?+r(v,x,g):k[x],i?+i(v,x,g):P[x]))}if($)return c=null,$+""||null}function h(){return Hre().defined(o).curve(a).context(s)}return m.x=function(g){return arguments.length?(e=typeof g=="function"?g:Fr(+g),r=null,m):e},m.x0=function(g){return arguments.length?(e=typeof g=="function"?g:Fr(+g),m):e},m.x1=function(g){return arguments.length?(r=g==null?null:typeof g=="function"?g:Fr(+g),m):r},m.y=function(g){return arguments.length?(n=typeof g=="function"?g:Fr(+g),i=null,m):n},m.y0=function(g){return arguments.length?(n=typeof g=="function"?g:Fr(+g),m):n},m.y1=function(g){return arguments.length?(i=g==null?null:typeof g=="function"?g:Fr(+g),m):i},m.lineX0=m.lineY0=function(){return h().x(e).y(n)},m.lineY1=function(){return h().x(e).y(i)},m.lineX1=function(){return h().x(r).y(n)},m.defined=function(g){return arguments.length?(o=typeof g=="function"?g:Fr(!!g),m):o},m.curve=function(g){return arguments.length?(a=g,s!=null&&(c=a(s)),m):a},m.context=function(g){return arguments.length?(g==null?s=c=null:c=a(s=g),m):s},m}class qre{constructor(n,i){this._context=n,this._x=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(n,i){switch(n=+n,i=+i,this._point){case 0:{this._point=1,this._line?this._context.lineTo(n,i):this._context.moveTo(n,i);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+n)/2,this._y0,this._x0,i,n,i):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+i)/2,n,this._y0,n,i);break}}this._x0=n,this._y0=i}}function l8e(e){return new qre(e,!0)}function c8e(e){return new qre(e,!1)}const HM={draw(e,n){const i=Mu(n/eI);e.moveTo(i,0),e.arc(0,0,i,0,DP)}},d8e={draw(e,n){const i=Mu(n/5)/2;e.moveTo(-3*i,-i),e.lineTo(-i,-i),e.lineTo(-i,-3*i),e.lineTo(i,-3*i),e.lineTo(i,-i),e.lineTo(3*i,-i),e.lineTo(3*i,i),e.lineTo(i,i),e.lineTo(i,3*i),e.lineTo(-i,3*i),e.lineTo(-i,i),e.lineTo(-3*i,i),e.closePath()}},Gre=Mu(1/3),u8e=Gre*2,p8e={draw(e,n){const i=Mu(n/u8e),r=i*Gre;e.moveTo(0,-i),e.lineTo(r,0),e.lineTo(0,i),e.lineTo(-r,0),e.closePath()}},m8e={draw(e,n){const i=Mu(n),r=-i/2;e.rect(r,r,i,i)}},h8e=.8908130915292852,Vre=J5(eI/10)/J5(7*eI/10),f8e=J5(DP/10)*Vre,g8e=-Lre(DP/10)*Vre,y8e={draw(e,n){const i=Mu(n*h8e),r=f8e*i,o=g8e*i;e.moveTo(0,-i),e.lineTo(r,o);for(let s=1;s<5;++s){const a=DP*s/5,c=Lre(a),u=J5(a);e.lineTo(u*i,-c*i),e.lineTo(c*r-u*o,u*r+c*o)}e.closePath()}},Xz=Mu(3),x8e={draw(e,n){const i=-Mu(n/(Xz*3));e.moveTo(0,i*2),e.lineTo(-Xz*i,-i),e.lineTo(Xz*i,-i),e.closePath()}},fd=-.5,gd=Mu(3)/2,u3=1/Mu(12),b8e=(u3/2+1)*3,v8e={draw(e,n){const i=Mu(n/b8e),r=i/2,o=i*u3,s=r,a=i*u3+i,c=-s,u=a;e.moveTo(r,o),e.lineTo(s,a),e.lineTo(c,u),e.lineTo(fd*r-gd*o,gd*r+fd*o),e.lineTo(fd*s-gd*a,gd*s+fd*a),e.lineTo(fd*c-gd*u,gd*c+fd*u),e.lineTo(fd*r+gd*o,fd*o-gd*r),e.lineTo(fd*s+gd*a,fd*a-gd*s),e.lineTo(fd*c+gd*u,fd*u-gd*c),e.closePath()}};function w8e(e,n){let i=null,r=WM(o);e=typeof e=="function"?e:Fr(e||HM),n=typeof n=="function"?n:Fr(n===void 0?64:+n);function o(){let s;if(i||(i=s=r()),e.apply(this,arguments).draw(i,+n.apply(this,arguments)),s)return i=null,
vendor: 6,569 bytes, line 7750
7750s+""||null}return o.type=function(s){return arguments.length?(e=typeof s=="function"?s:Fr(s),o):e},o.size=function(s){return arguments.length?(n=typeof s=="function"?s:Fr(+s),o):n},o.context=function(s){return arguments.length?(i=s??null,o):i},o}function tI(){}function nI(e,n,i){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+n)/6,(e._y0+4*e._y1+i)/6)}function Kre(e){this._context=e}Kre.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:nI(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,n){switch(e=+e,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,n):this._context.moveTo(e,n);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:nI(this,e,n);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=n}};function j8e(e){return new Kre(e)}function Yre(e){this._context=e}Yre.prototype={areaStart:tI,areaEnd:tI,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,n){switch(e=+e,n=+n,this._point){case 0:this._point=1,this._x2=e,this._y2=n;break;case 1:this._point=2,this._x3=e,this._y3=n;break;case 2:this._point=3,this._x4=e,this._y4=n,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+n)/6);break;default:nI(this,e,n);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=n}};function _8e(e){return new Yre(e)}function Xre(e){this._context=e}Xre.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,n){switch(e=+e,n=+n,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var i=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+n)/6;this._line?this._context.lineTo(i,r):this._context.moveTo(i,r);break;case 3:this._point=4;default:nI(this,e,n);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=n}};function C8e(e){return new Xre(e)}function Qre(e){this._context=e}Qre.prototype={areaStart:tI,areaEnd:tI,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,n){e=+e,n=+n,this._point?this._context.lineTo(e,n):(this._point=1,this._context.moveTo(e,n))}};function S8e(e){return new Qre(e)}function tU(e){return e<0?-1:1}function nU(e,n,i){var r=e._x1-e._x0,o=n-e._x1,s=(e._y1-e._y0)/(r||o<0&&-0),a=(i-e._y1)/(o||r<0&&-0),c=(s*o+a*r)/(r+o);return(tU(s)+tU(a))*Math.min(Math.abs(s),Math.abs(a),.5*Math.abs(c))||0}function iU(e,n){var i=e._x1-e._x0;return i?(3*(e._y1-e._y0)/i-n)/2:n}function Qz(e,n,i){var r=e._x0,o=e._y0,s=e._x1,a=e._y1,c=(s-r)/3;e._context.bezierCurveTo(r+c,o+c*n,s-c,a-c*i,s,a)}function iI(e){this._context=e}iI.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Qz(this,this._t0,iU(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,n){var i=NaN;if(e=+e,n=+n,!(e===this._x1&&n===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,n):this._context.moveTo(e,n);break;case 1:this._point=2;break;case 2:this._point=3,Qz(this,iU(this,i=nU(this,e,n)),i);break;default:Qz(this,this._t0,i=nU(this,e,n));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=n,this._t0=i}}};function Zre(e){this._context=new Jre(e)}(Zre.prototype=Object.create(iI.prototype)).point=function(e,n){iI.prototype.point.call(this,n,e)};function Jre(e){this._context=e}Jre.prototype={moveTo:function(e,n){this._context.moveTo(n,e)},closePath:function(){this._context.closePath()},lineTo:function(e,n){this._context.lineTo(n,e)},bezierCurveTo:function(e,n,i,r,o,s){this._context.bezierCurveTo(n,e,r,i,s,o)}};function k8e(e){return new iI(e)}function $8e(e){return new Zre(e)}function eoe(e){this._context=e}eoe.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,n=this._y,i=e.length;if(i)if(this._line?this._context.lineTo(e[0],n[0]):this._context.moveTo(e[0],n[0]),i===2)this._context.lineTo(e[1],n[1]);else for(var r=rU(e),o=rU(n),s=0,a=1;a<i;++s,++a)this._context.bezierCurveTo(r[0][s],o[0][s],r[1][s],o[1][s],e[a],n[a]);(this._line||this._line!==0&&i===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,n){this._x.push(+e),this._y.push(+n)}};function rU(e){var n,i=e.length-1,r,o=new Array(i),s=new Array(i),a=new Array(i);for(o[0]=0,s[0]=2,a[0]=e[0]+2*e[1],n=1;n<i-1;++n)o[n]=1,s[n]=4,a[n]=4*e[n]+2*e[n+1];for(o[i-1]=2,s[i-1]=7,a[i-1]=8*e[i-1]+e[i],n=1;n<i;++n)r=o[n]/s[n-1],s[n]-=r,a[n]-=r*a[n-1];for(o[i-1]=a[i-1]/s[i-1],n=i-2;n>=0;--n)o[n]=(a[n]-o[n+1])/s[n];for(s[i-1]=(e[i]+o[i-1])/2,n=0;n<i-1;++n)s[n]=2*e[n+1]-o[n+1];return[o,s]}function I8e(e){return new eoe(e)}function BP(e,n){this._context=e,this._t=n}BP.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,n){switch(e=+e,n=+n,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,n):this._context.moveTo(e,n);break;case 1:this._point=2;
7750default:{if(this._t<=0)this._context.lineTo(this._x,n),this._context.lineTo(e,n);else{var i=this._x*(1-this._t)+e*this._t;this._context.lineTo(i,this._y),this._context.lineTo(i,n)}break}}this._x=e,this._y=n}};function P8e(e){return new BP(e,.5)}function A8e(e){return new BP(e,0)}function N8e(e){return new BP(e,1)}function Iy(e,n){if((a=e.length)>1)for(var i=1,r,o,s=e[n[0]],a,c=s.length;i<a;++i)for(o=s,s=e[n[i]],r=0;r<c;++r)s[r][1]+=s[r][0]=isNaN(o[r][1])?o[r][0]:o[r][1]}function p3(e){for(var n=e.length,i=new Array(n);--n>=0;)i[n]=n;return i}function z8e(e,n){return e[n]}function T8e(e){const n=[];return n.key=e,n}function E8e(){var e=Fr([]),n=p3,i=Iy,r=z8e;function o(s){var a=Array.from(e.apply(this,arguments),T8e),c,u=a.length,m=-1,h;for(const g of s)for(c=0,++m;c<u;++c)(a[c][m]=[0,+r(g,a[c].key,m,s)]).data=g;for(c=0,h=UM(n(a));c<u;++c)a[h[c]].index=c;return i(a,h),a}return o.keys=function(s){return arguments.length?(e=typeof s=="function"?s:Fr(Array.from(s)),o):e},o.value=function(s){return arguments.length?(r=typeof s=="function"?s:Fr(+s),o):r},o.order=function(s){return arguments.length?(n=s==null?p3:typeof s=="function"?s:Fr(Array.from(s)),o):n},o.offset=function(s){return arguments.length?(i=s??Iy,o):i},o}function M8e(e,n){if((r=e.length)>0){for(var i,r,o=0,s=e[0].length,a;o<s;++o){for(a=i=0;i<r;++i)a+=e[i][o][1]||0;if(a)for(i=0;i<r;++i)e[i][o][1]/=a}Iy(e,n)}}function R8e(e,n){if((o=e.length)>0){for(var i=0,r=e[n[0]],o,s=r.length;i<s;++i){for(var a=0,c=0;a<o;++a)c+=e[a][i][1]||0;r[i][1]+=r[i][0]=-c/2}Iy(e,n)}}function O8e(e,n){if(!(!((a=e.length)>0)||!((s=(o=e[n[0]]).length)>0))){for(var i=0,r=1,o,s,a;r<s;++r){for(var c=0,u=0,m=0;c<a;++c){for(var h=e[n[c]],g=h[r][1]||0,x=h[r-1][1]||0,y=(g-x)/2,w=0;w<c;++w){var j=e[n[w]],v=j[r][1]||0,_=j[r-1][1]||0;y+=v-_}u+=g,m+=y*g}o[r-1][1]+=o[r-1][0]=i,u&&(i-=m/u)}o[r-1][1]+=o[r-1][0]=i,Iy(e,n)}}var Zz={},Jz={},oU;function D8e(){return oU||(oU=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function n(i){return i==="__proto__"}e.isUnsafeProperty=n})(Jz)),Jz}var eT={},sU;function toe(){return sU||(sU=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function n(i){switch(typeof i){case"number":case"symbol":return!1;case"string":return i.includes(".")||i.includes("[")||i.includes("]")}}e.isDeepKey=n})(eT)),eT}var tT={},aU;function qM(){return aU||(aU=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function n(i){return typeof i=="string"||typeof i=="symbol"?i:Object.is(i?.valueOf?.(),-0)?"-0":String(i)}e.toKey=n})(tT)),tT}var nT={},iT={},lU;function L8e(){return lU||(lU=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function n(i){if(i==null)return"";if(typeof i=="string")return i;if(Array.isArray(i))return i.map(n).join(",");const r=String(i);return r==="0"&&Object.is(Number(i),-0)?"-0":r}e.toString=n})(iT)),iT}var cU;function GM(){return cU||(cU=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const n=L8e(),i=qM();function r(o){if(Array.isArray(o))return o.map(i.toKey);if(typeof o=="symbol")return[o];o=n.toString(o);const s=[],a=o.length;if(a===0)return s;let c=0,u="",m="",h=!1;
7750for(o.charCodeAt(0)===46&&(s.push(""),c++);c<a;){const g=o[c];m?g==="\\"&&c+1<a?(c++,u+=o[c]):g===m?m="":u+=g:h?g==='"'||g==="'"?m=g:g==="]"?(h=!1,s.push(u),u=""):u+=g:g==="["?(h=!0,u&&(s.push(u),u="")):g==="."?u&&(s.push(u),u=""):u+=g,c++}return u&&s.push(u),s}e.toPath=r})(nT)),nT}var dU;function VM(){return dU||(dU=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const n=D8e(),i=toe(),r=qM(),o=GM();function s(c,u,m){if(c==null)return m;switch(typeof u){case"string":{if(n.isUnsafeProperty(u))return m;const h=c[u];return h===void 0?i.isDeepKey(u)?s(c,o.toPath(u),m):m:h}case"number":case"symbol":{typeof u=="number"&&(u=r.toKey(u));const h=c[u];return h===void 0?m:h}default:{if(Array.isArray(u))return a(c,u,m);if(Object.is(u?.valueOf(),-0)?u="-0":u=String(u),n.isUnsafeProperty(u))return m;const h=c[u];return h===void 0?m:h}}}function a(c,u,m){if(u.length===0)return m;let h=c;for(let g=0;g<u.length;g++){if(h==null||n.isUnsafeProperty(u[g]))return m;h=h[u[g]]}return h===void 0?m:h}e.get=s})(Zz)),Zz}var rT,uU;function B8e(){return uU||(uU=1,rT=VM().get),rT}var F8e=B8e();const Py=Tu(F8e);var W8e=4;function gf(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:W8e,i=10**n,r=Math.round(e*i)/i;return Object.is(r,-0)?0:r}function Po(e){for(var n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];return e.reduce((o,s,a)=>{var c=i[a-1];return typeof c=="string"?o+c+s:c!==void 0?o+gf(c)+s:o+s},"")}var Vs=e=>e===0?0:e>0?1:-1,Xl=e=>typeof e=="number"&&e!=+e,Gm=e=>typeof e=="string"&&e.indexOf("%")===e.length-1,fn=e=>(typeof e=="number"||e instanceof Number)&&!Xl(e),Md=e=>fn(e)||typeof e=="string",U8e=0,S_=e=>{var n=++U8e;return"".concat(e||"").concat(n)},Wa=function(n,i){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!fn(n)&&typeof n!="string")return r;var s;if(Gm(n)){if(i==null)return r;var a=n.indexOf("%");s=i*parseFloat(n.slice(0,a))/100}else s=+n;return Xl(s)&&(s=r),o&&i!=null&&s>i&&(s=i),s},noe=e=>{if(!Array.isArray(e))return!1;for(var n=e.length,i={},r=0;r<n;r++)if(!i[String(e[r])])i[String(e[r])]=!0;else return!0;return!1};function ir(e,n,i){return fn(e)&&fn(n)?gf(e+i*(n-e)):n}function ioe(e,n,i){if(!(!e||!e.length))return e.find(r=>r&&(typeof n=="function"?n(r):Py(r,n))===i)}var eo=e=>e===null||typeof e>"u",sC=e=>eo(e)?e:"".concat(e.charAt(0).toUpperCase()).concat(e.slice(1));function H8e(e){return e!=null}function aC(){}var q8e=["type","size","sizeType"];function m3(){return m3=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var i=arguments[n];for(var r in i)({}).hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},m3.apply(null,arguments)}function pU(e,n){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),i.push.apply(i,r)}return i}function mU(e){for(var n=1;n<arguments.length;n++){var i=arguments[n]!=null?arguments[n]:{};n%2?pU(Object(i),!0).forEach(function(r){G8e(e,r,i[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):pU(Object(i)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(i,r))})}return e}function G8e(e,n,i){return(n=V8e(n))in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i,e}function V8e(e){var n=K8e(e,"string");return typeof n=="symbol"?n:n+""}function K8e(e,n){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,n);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function Y8e(e,n){if(e==null)return{};var i,r,o=X8e(e,n);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)i=s[r],n.indexOf(i)===-1&&{}.propertyIsEnumerable.call(e,i)&&(o[i]=e[i])}return o}function X8e(e,n){if(e==null)return{};var i={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(n.indexOf(r)!==-1)continue;i[r]=e[r]}return i}var roe={symbolCircle:HM,symbolCross:d8e,symbolDiamond:p8e,symbolSquare:m8e,symbolStar:y8e,symbolTriangle:x8e,symbolWye:v8e},Q8e=Math.PI/180,Z8e=e=>{var n="symbol".concat(sC(e));return roe[n]||HM},J8e=(e,n,i)=>{if(n==="area")return e;switch(i){case"cross":return 5*e*e/9;case"diamond":return .5*e*e/Math.sqrt(3);case"square":return e*e;case"star":{var r=18*Q8e;return 1.25*e*e*(Math.tan(r)-Math.tan(r*2)*Math.tan(r)**2)}case"triangle":return Math.sqrt(3)*e*e/4;case"wye":return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},eMe=(e,n)=>{roe["symbol".concat(sC(e))]=n},KM=e=>{var{type:n="circle",size:i=64,sizeType:r="area"}=e,o=Y8e(e,q8e),s=mU(mU({},o),{},{type:n,size:i,sizeType:r}),a="circle";typeof n=="string"&&(a=n);var c=()=>{var x=Z8e(a),y=w8e().type(x).size(J8e(i,r,a)),w=y();if(w!==null)return w},{className:u,cx:m,cy:h}=s,g=ba(s);return fn(m)&&fn(h)&&fn(i)?l.createElement("path",m3({}
7750,g,{className:Ri("recharts-symbols",u),transform:"translate(".concat(m,", ").concat(h,")"),d:c()})):null};KM.registerSymbol=eMe;var ooe=e=>"radius"in e&&"startAngle"in e&&"endAngle"in e,YM=(e,n)=>{if(!e||typeof e=="function"||typeof e=="boolean")return null;var i=e;if(l.isValidElement(e)&&(i=e.props),typeof i!="object"&&typeof i!="function")return null;var r={};return Object.keys(i).forEach(o=>{BM(o)&&(r[o]=(s=>i[o](i,s)))}),r},tMe=(e,n,i)=>r=>(e(n,i,r),null),lC=(e,n,i)=>{if(e===null||typeof e!="object"&&typeof e!="function")return null;var r=null;return Object.keys(e).forEach(o=>{var s=e[o];BM(o)&&typeof s=="function"&&(r||(r={}),r[o]=tMe(s,n,i))}),r};function hU(e,n){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),i.push.apply(i,r)}return i}function nMe(e){for(var n=1;n<arguments.length;n++){var i=arguments[n]!=null?arguments[n]:{};n%2?hU(Object(i),!0).forEach(function(r){iMe(e,r,i[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):hU(Object(i)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(i,r))})}return e}function iMe(e,n,i){return(n=rMe(n))in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i,e}function rMe(e){var n=oMe(e,"string");return typeof n=="symbol"?n:n+""}function oMe(e,n){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,n);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function jo(e,n){var i=nMe({},e),r=n,o=Object.keys(n),s=o.reduce((a,c)=>(a[c]===void 0&&r[c]!==void 0&&(a[c]=r[c]),a),i);return s}function rI(){return rI=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var i=arguments[n];for(var r in i)({}).hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},rI.apply(null,arguments)}function fU(e,n){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),i.push.apply(i,r)}return i}function sMe(e){for(var n=1;n<arguments.length;n++){var i=arguments[n]!=null?arguments[n]:{};n%2?fU(Object(i),!0).forEach(function(r){aMe(e,r,i[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):fU(Object(i)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(i,r))})}return e}function aMe(e,n,i){return(n=lMe(n))in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i,e}function lMe(e){var n=cMe(e,"string");return typeof n=="symbol"?n:n+""}function cMe(e,n){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,n);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}var _d=32,dMe={align:"center",iconSize:14,inactiveColor:"#ccc",layout:"horizontal",verticalAlign:"middle"};function uMe(e){var{data:n,iconType:i,inactiveColor:r}=e,o=_d/2,s=_d/6,a=_d/3,c=n.inactive?r:n.color,u=i??n.type;if(u==="none")return null;if(u==="plainline"){var m;return l.createElement("line",{strokeWidth:4,fill:"none",stroke:c,strokeDasharray:(m=n.payload)===null||m===void 0?void 0:m.strokeDasharray,x1:0,y1:o,x2:_d,y2:o,className:"recharts-legend-icon"})}if(u==="line")return l.createElement("path",{strokeWidth:4,fill:"none",stroke:c,d:"M0,".concat(o,"h").concat(a,` 7751 A`).concat(s,",").concat(s,",0,1,1,").concat(2*a,",").concat(o,` 7752 H`).concat(_d,"M").concat(2*a,",").concat(o,` 7753 A`).concat(s,",").concat(s,",0,1,1,").concat(a,",").concat(o),className:"recharts-legend-icon"});if(u==="rect")return l.createElement("path",{stroke:"none",fill:c,d:"M0,".concat(_d/8,"h").concat(_d,"v").concat(_d*3/4,"h").concat(-_d,"z"),className:"recharts-legend-icon"});if(l.isValidElement(n.legendIcon)){var h=sMe({},n);return delete h.legendIcon,l.cloneElement(n.legendIcon,h)}return l.createElement(KM,{fill:c,cx:o,cy:o,size:_d,sizeType:"diameter",type:u})}function pMe(e){var{payload:n,iconSize:i,layout:r,formatter:o,inactiveColor:s,iconType:a}=e,c={x:0,y:0,width:_d,height:_d},u={display:r==="horizontal"?"inline-block":"block",marginRight:10},m={display:"inline-block",verticalAlign:"middle",marginRight:4};return n.map((h,g)=>{var x=h.formatter||o,y=Ri({"recharts-legend-item":!0,["legend-item-".concat(g)]:!0,inactive:h.inactive});if(h.type==="none")return null;var w=h.inactive?s:h.color,j=x?x(h.value,h,g):h.value;
7753return l.createElement("li",rI({className:y,style:u,key:"legend-item-".concat(g)},lC(e,h,g)),l.createElement(FM,{width:i,height:i,viewBox:c,style:m,"aria-label":"".concat(j," legend icon")},l.createElement(uMe,{data:h,iconType:a,inactiveColor:s})),l.createElement("span",{className:"recharts-legend-item-text",style:{color:w}},j))})}var mMe=e=>{var n=jo(e,dMe),{payload:i,layout:r,align:o}=n;if(!i||!i.length)return null;var s={padding:0,margin:0,textAlign:r==="horizontal"?o:"left"};return l.createElement("ul",{className:"recharts-default-legend",style:s},l.createElement(pMe,rI({},n,{payload:i})))},oT={},sT={},gU;function hMe(){return gU||(gU=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function n(i,r){const o=new Map;for(let s=0;s<i.length;s++){const a=i[s],c=r(a);o.has(c)||o.set(c,a)}return Array.from(o.values())}e.uniqBy=n})(sT)),sT}var aT={},yU;function soe(){return yU||(yU=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function n(i){return i}e.identity=n})(aT)),aT}var lT={},cT={},dT={},xU;function fMe(){return xU||(xU=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function n(i){return Number.isSafeInteger(i)&&i>=0}e.isLength=n})(dT)),dT}var bU;function XM(){return bU||(bU=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const n=fMe();function i(r){return r!=null&&typeof r!="function"&&n.isLength(r.length)}e.isArrayLike=i})(cT)),cT}var uT={},vU;function gMe(){return vU||(vU=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function n(i){return typeof i=="object"&&i!==null}e.isObjectLike=n})(uT)),uT}var wU;function yMe(){return wU||(wU=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const n=XM(),i=gMe();function r(o){return i.isObjectLike(o)&&n.isArrayLike(o)}e.isArrayLikeObject=r})(lT)),lT}var pT={},mT={},jU;function xMe(){return jU||(jU=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const n=VM();function i(r){return function(o){return n.get(o,r)}}e.property=i})(mT)),mT}var hT={},fT={},gT={},yT={},_U;function aoe(){return _U||(_U=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function n(i){return i!==null&&(typeof i=="object"||typeof i=="function")}e.isObject=n})(yT)),yT}var xT={},CU;function loe(){return CU||(CU=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function n(i){return i==null||typeof i!="object"&&typeof i!="function"}e.isPrimitive=n})(xT)),xT}var bT={},SU;function coe(){return SU||(SU=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function n(i,r){return i===r||Number.isNaN(i)&&Number.isNaN(r)}e.eq=n})(bT)),bT}var kU;function bMe(){return kU||(kU=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const n=aoe(),i=loe(),r=coe();function o(h,g,x){return typeof x!="function"?o(h,g,()=>{}):s(h,g,function y(w,j,v,_,$,k){const P=x(w,j,v,_,$,k);return P!==void 0?!!P:s(w,j,y,k)},new Map)}function s(h,g,x,y){if(g===h)return!0;switch(typeof g){case"object":return a(h,g,x,y);case"function":return Object.keys(g).length>0?s(h,{...g},x,y):r.eq(h,g);default:return n.isObject(h)?typeof g=="string"?g==="":!0:r.eq(h,g)}}function a(h,g,x,y){if(g==null)return!0;if(Array.isArray(g))return u(h,g,x,y);if(g instanceof Map)return c(h,g,x,y);if(g instanceof Set)return m(h,g,x,y);const w=Object.keys(g);if(h==null||i.isPrimitive(h))return w.length===0;if(w.length===0)return!0;if(y?.has(g))return y.get(g)===h;y?.set(g,h);try{for(let j=0;j<w.length;j++){const v=w[j];if(!i.isPrimitive(h)&&!(v in h)||g[v]===void 0&&h[v]!==void 0||g[v]===null&&h[v]!==null||!x(h[v],g[v],v,h,g,y))return!1}return!0}finally{y?.delete(g)}}function c(h,g,x,y){if(g.size===0)return!0;if(!(h instanceof Map))return!1;for(const[w,j]of g.entries()){const v=h.get(w);if(x(v,j,w,h,g,y)===!1)return!1}return!0}function u(h,g,x,y){if(g.length===0)return!0;if(!Array.isArray(h))return!1;const w=new Set;for(let j=0;j<g.length;j++){const v=g[j];let _=!1;for(let $=0;$<h.length;$++){if(w.has($))continue;
7753const k=h[$];let P=!1;if(x(k,v,j,h,g,y)&&(P=!0),P){w.add($),_=!0;break}}if(!_)return!1}return!0}function m(h,g,x,y){return g.size===0?!0:h instanceof Set?u([...h],[...g],x,y):!1}e.isMatchWith=o,e.isSetMatch=m})(gT)),gT}var $U;function doe(){return $U||($U=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const n=bMe();function i(r,o){return n.isMatchWith(r,o,()=>{})}e.isMatch=i})(fT)),fT}var vT={},wT={},jT={},IU;function vMe(){return IU||(IU=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function n(i){return Object.getOwnPropertySymbols(i).filter(r=>Object.prototype.propertyIsEnumerable.call(i,r))}e.getSymbols=n})(jT)),jT}var _T={},PU;function uoe(){return PU||(PU=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function n(i){return i==null?i===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(i)}e.getTag=n})(_T)),_T}var CT={},AU;function poe(){return AU||(AU=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const n="[object RegExp]",i="[object String]",r="[object Number]",o="[object Boolean]",s="[object Arguments]",a="[object Symbol]",c="[object Date]",u="[object Map]",m="[object Set]",h="[object Array]",g="[object Function]",x="[object ArrayBuffer]",y="[object Object]",w="[object Error]",j="[object DataView]",v="[object Uint8Array]",_="[object Uint8ClampedArray]",$="[object Uint16Array]",k="[object Uint32Array]",P="[object BigUint64Array]",S="[object Int8Array]",I="[object Int16Array]",A="[object Int32Array]",E="[object BigInt64Array]",B="[object Float32Array]",T="[object Float64Array]";e.argumentsTag=s,e.arrayBufferTag=x,e.arrayTag=h,e.bigInt64ArrayTag=E,e.bigUint64ArrayTag=P,e.booleanTag=o,e.dataViewTag=j,e.dateTag=c,e.errorTag=w,e.float32ArrayTag=B,e.float64ArrayTag=T,e.functionTag=g,e.int16ArrayTag=I,e.int32ArrayTag=A,e.int8ArrayTag=S,e.mapTag=u,e.numberTag=r,e.objectTag=y,e.regexpTag=n,e.setTag=m,e.stringTag=i,e.symbolTag=a,e.uint16ArrayTag=$,e.uint32ArrayTag=k,e.uint8ArrayTag=v,e.uint8ClampedArrayTag=_})(CT)),CT}var ST={},NU;function wMe(){return NU||(NU=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function n(i){return ArrayBuffer.isView(i)&&!(i instanceof DataView)}e.isTypedArray=n})(ST)),ST}var zU;function moe(){return zU||(zU=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const n=vMe(),i=uoe(),r=poe(),o=loe(),s=wMe();function a(h,g){return c(h,void 0,h,new Map,g)}function c(h,g,x,y=new Map,w=void 0){const j=w?.(h,g,x,y);if(j!==void 0)return j;if(o.isPrimitive(h))return h;if(y.has(h))return y.get(h);if(Array.isArray(h)){const v=new Array(h.length);y.set(h,v);for(let _=0;_<h.length;_++)v[_]=c(h[_],_,x,y,w);return Object.hasOwn(h,"index")&&(v.index=h.index),Object.hasOwn(h,"input")&&(v.input=h.input),v}if(h instanceof Date)return new Date(h.getTime());if(h instanceof RegExp){const v=new RegExp(h.source,h.flags);return v.lastIndex=h.lastIndex,v}if(h instanceof Map){const v=new Map;y.set(h,v);for(const[_,$]of h)v.set(_,c($,_,x,y,w));return v}if(h instanceof Set){const v=new Set;y.set(h,v);for(const _ of h)v.add(c(_,void 0,x,y,w));return v}if(typeof Buffer<"u"&&Buffer.isBuffer(h))return h.subarray();if(s.isTypedArray(h)){const v=new(Object.getPrototypeOf(h)).constructor(h.length);y.set(h,v);for(let _=0;_<h.length;_++)v[_]=c(h[_],_,x,y,w);return v}if(h instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&h instanceof SharedArrayBuffer)return h.slice(0);if(h instanceof DataView){const v=new DataView(h.buffer.slice(0),h.byteOffset,h.byteLength);return y.set(h,v),u(v,h,x,y,w),v}if(typeof File<"u"&&h instanceof File){const v=new File([h],h.name,{type:h.type});return y.set(h,v),u(v,h,x,y,w),v}if(typeof Blob<"u"&&h instanceof Blob){const v=new Blob([h],{type:h.type});return y.set(h,v),u(v,h,x,y,w),v}if(h instanceof Error){const v=new h.constructor;return y.set(h,v),v.message=h.message,v.name=h.name,v.stack=h.stack,v.cause=h.cause,u(v,h,x,y,w),v}if(h instanceof Boolean){const v=new Boolean(h.valueOf());return y.set(h,v),u(v,h,x,y,w),v}if(h instanceof Number){const v=new Number(h.valueOf());return y.set(h,v),u(v,h,x,y,w),v}if(h instanceof String){const v=new String(h.valueOf());return y.set(h,v),u(v,h,x,y,w),v}if(typeof h=="object"&&m(h)){const v=Object.create(Object.getPrototypeOf(h));return y.set(h,v),u(v,h,x,y,w),v}return h}function u(h,g,x=h,y,w){const j=[...Object.keys(g),...n.getSymbols(g)];for(let v=0;v<j.length;v++){const _=j[v],$=Object.getOwnPropertyDescriptor(h,_);($==null||$.writable)&&(h[_]=c(g[_],_,x,y,w))}}function m(h){switch(i.getTag(h)){case r.argumentsTag:case r.arrayTag:case r.arrayBufferTag:case r.dataViewTag:case r.booleanTag:case r.dateTag:case r.float32ArrayTag:case r.float64ArrayTag:case r.int8ArrayTag:case r.int16ArrayTag:case r.int32ArrayTag:case r.mapTag:case r.numberTag:case r.objectTag:case r.regexpTag:case r.setTag:case r.stringTag:case r.symbolTag:case r.uint8ArrayTag:case r.uint8ClampedArrayTag:case r.uint16ArrayTag:case r.uint32ArrayTag:return!0;default:return!1}}e.cloneDeepWith=a,e.cloneDeepWithImpl=c,e.copyProperties=u})(wT)),wT}var TU;function jMe(){return TU||(TU=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const n=moe();function i(r){return n.cloneDeepWithImpl(r,void 0,r,new Map,void 0)}e.cloneDeep=i})(vT)),vT}var EU;function _Me(){return EU||(EU=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const n=doe(),i=jMe();function r(o){return o=i.cloneDeep(o),s=>n.isMatch(s,o)}e.matches=r})(hT)),hT}var kT={},$T={},IT={},MU;function CMe(){return MU||(MU=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const n=moe(),i=poe();function r(o,s){return n.cloneDeepWith(o,(a,c,u,m)=>{const h=s?.(a,c,u,m);if(h!==void 0)return h;if(typeof o=="object")switch(Object.prototype.toString.call(o)){case i.numberTag:case i.stringTag:case i.booleanTag:{const g=new o.constructor(o?.valueOf());return n.copyProperties(g,o),g}case i.argumentsTag:{const g={};return n.copyProperties(g,o),g.length=o.length,g[Symbol.iterator]=o[Symbol.iterator],g}default:return}})}e.cloneDeepWith=r})(IT)),IT}var RU;function SMe(){return RU||(RU=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const n=CMe();function i(r){return n.cloneDeepWith(r)}e.cloneDeep=i})($T)),$T}var PT={},AT={},OU;function hoe(){return OU||(OU=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const n=/^(?:0|[1-9]\d*)$/;function i(r,o=Number.MAX_SAFE_INTEGER){switch(typeof r){case"number":return Number.isInteger(r)&&r>=0&&r<o;case"symbol":return!1;case"string":return n.test(r)}}e.isIndex=i})(AT)),AT}var NT={},DU;function kMe(){return DU||(DU=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const n=uoe();function i(r){return r!==null&&typeof r=="object"&&n.getTag(r)==="[object Arguments]"}e.isArguments=i})(NT)),NT}var LU;function $Me(){return LU||(LU=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const n=toe(),i=hoe(),r=kMe(),o=GM();function s(a,c){let u;if(Array.isArray(c)?u=c:typeof c=="string"&&n.isDeepKey(c)&&a?.[c]==null?u=o.toPath(c):u
7753=[c],u.length===0)return!1;let m=a;for(let h=0;h<u.length;h++){const g=u[h];if((m==null||!Object.hasOwn(m,g))&&!((Array.isArray(m)||r.isArguments(m))&&i.isIndex(g)&&g<m.length))return!1;m=m[g]}return!0}e.has=s})(PT)),PT}var BU;function IMe(){return BU||(BU=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const n=doe(),i=qM(),r=SMe(),o=VM(),s=$Me();function a(c,u){switch(typeof c){case"object":{Object.is(c?.valueOf(),-0)&&(c="-0");break}case"number":{c=i.toKey(c);break}}return u=r.cloneDeep(u),function(m){const h=o.get(m,c);return h===void 0?s.has(m,c):u===void 0?h===void 0:n.isMatch(h,u)}}e.matchesProperty=a})(kT)),kT}var FU;function PMe(){return FU||(FU=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const n=soe(),i=xMe(),r=_Me(),o=IMe();function s(a){if(a==null)return n.identity;switch(typeof a){case"function":return a;case"object":return Array.isArray(a)&&a.length===2?o.matchesProperty(a[0],a[1]):r.matches(a);case"string":case"symbol":case"number":return i.property(a)}}e.iteratee=s})(pT)),pT}var WU;function AMe(){return WU||(WU=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const n=hMe(),i=soe(),r=yMe(),o=PMe();function s(a,c=i.identity){return r.isArrayLikeObject(a)?n.uniqBy(Array.from(a),o.iteratee(c)):[]}e.uniqBy=s})(oT)),oT}var zT,UU;function NMe(){return UU||(UU=1,zT=AMe().uniqBy),zT}var zMe=NMe();const HU=Tu(zMe);function foe(e,n,i){return n===!0?HU(e,i):typeof n=="function"?HU(e,n):e}var TT={exports:{}},ET={},MT={exports:{}},RT={};var qU;function TMe(){if(qU)return RT;qU=1;var e=n1();function n(g,x){return g===x&&(g!==0||1/g===1/x)||g!==g&&x!==x}var i=typeof Object.is=="function"?Object.is:n,r=e.useState,o=e.useEffect,s=e.useLayoutEffect,a=e.useDebugValue;function c(g,x){var y=x(),w=r({inst:{value:y,getSnapshot:x}}),j=w[0].inst,v=w[1];return s(function(){j.value=y,j.getSnapshot=x,u(j)&&v({inst:j})},[g,y,x]),o(function(){return u(j)&&v({inst:j}),g(function(){u(j)&&v({inst:j})})},[g]),a(y),y}function u(g){var x=g.getSnapshot;g=g.value;try{var y=x();return!i(g,y)}catch{return!0}}function m(g,x){return x()}var h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?m:c;return RT.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:h,RT}var GU;function EMe(){return GU||(GU=1,MT.exports=TMe()),MT.exports}var VU;function MMe(){if(VU)return ET;VU=1;var e=n1(),n=EMe();function i(m,h){return m===h&&(m!==0||1/m===1/h)||m!==m&&h!==h}var r=typeof Object.is=="function"?Object.is:i,o=n.useSyncExternalStore,s=e.useRef,a=e.useEffect,c=e.useMemo,u=e.useDebugValue;return ET.useSyncExternalStoreWithSelector=function(m,h,g,x,y){var w=s(null);if(w.current===null){var j={hasValue:!1,value:null};w.current=j}else j=w.current;w=c(function(){function _(I){if(!$){if($=!0,k=I,I=x(I),y!==void 0&&j.hasValue){var A=j.value;if(y(A,I))return P=A}return P=I}if(A=P,r(k,I))return A;var E=x(I);return y!==void 0&&y(A,E)?(k=I,A):(k=I,P=E)}var $=!1,k,P,S=g===void 0?null:g;return[function(){return _(h())},S===null?void 0:function(){return _(S())}]},[h,g,x,y]);var v=o(m,w[0],w[1]);return a(function(){j.hasValue=!0,j.value=v},[v]),u(v),v},ET}var KU;function RMe(){return KU||(KU=1,TT.exports=MMe()),TT.exports}var OMe=RMe(),QM=l.createContext(null),DMe=e=>e,Rr=()=>{var e=l.useContext(QM);return e?e.store.dispatch:DMe},$5=()=>{},LMe=()=>$5,BMe=(e,n)=>e===n;function gn(e){var n=l.useContext(QM);return OMe.useSyncExternalStoreWithSelector(n?n.subscription.addNestedSub:LMe,n?n.store.getState:$5,n?n.store.getState:$5,n?e:$5,BMe)}function FMe(e,n=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(n)}function WMe(e,n=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(n)}function UMe(e,n="expected all items to be functions, instead received the following types: "){if(!e.every(i=>typeof i=="function")){const i=e.map(r=>typeof r=="function"?`function ${r.name||"unnamed"}()`:typeof r).join(", ");throw new TypeError(`${n}[${i}]`)}}var YU=e=>Array.isArray(e)?e:[e];function HMe(e){const n=Array.isArray(e[0])?e[0]:e;return UMe(n,"createSelector expects all input-selectors to be functions, but received the following types: "),n}function qMe(e,n){const i=[],{length:r}=e;for(let o=0;o<r;o++)i.push(e[o].apply(null,n));return i}var GMe=class{constructor(e){this.value=e}deref(){return this.value}},VMe=typeof WeakRef<"u"?WeakRef:GMe,KMe=0,XU=1;function Rk(){return{s:KMe,v:void 0,o:null,p:null}}function goe(e,n={}){let i=Rk();const{resultEqualityCheck:r}=n;let o,s=0;function a(){let c=i;const{length:u}=arguments;for(let g=0,x=u;g<x;g++){const y=arguments[g];if(typeof y=="function"||typeof y=="object"&&y!==null){let w=c.o;w===null&&(c.o=w=new WeakMap);const j=w.get(y);j===void 0?(c=Rk(),w.set(y,c)):c=j}else{let w=c.p;w===null&&(c.p=w=new Map);const j=w.get(y);j===void 0?(c=Rk(),w.set(y,c)):c=j}}const m=c;let h;if(c.s===XU)h=c.v;else if(h=e.apply(null,arguments),s++,r){const g=o?.deref?.()??o;g!=null&&r(g,h)&&(h=g,s!==0&&s--),o=typeof h=="object"&&h!==null||typeof h=="function"?new VMe(h):h}return m.s=XU,m.v=h,h}return a.clearCache=()=>{i=Rk(),a.resetResultsCount()},a.resultsCount=()=>s,a.resetResultsCount=()=>{s=0},a}function YMe(e,...n){const i=typeof e=="function"?{memoize:e,memoizeOptions:n}:e,r=(...o)=>{let s=0,a=0,c,u={},m=o.pop();typeof m=="object"&&(u=m,m=o.pop()),FMe(m,`createSelector expects an output function after the inputs, but received: [${typeof m}]`);const h={...i,...u},{memoize:g,memoizeOptions:x=[],argsMemoize:y=goe,argsMemoizeOptions:w=[]}=h,j=YU(x),v=YU(w),_=HMe(o),$=g(function(){return s++,m.apply(null,arguments)},...j),k=y(function(){a++;const S=qMe(_,arguments);return c=$.apply(null,S),c},...v);return Object.assign(k,{resultFunc:m,memoizedResultFunc:$,dependencies:_,depen
7753dencyRecomputations:()=>a,resetDependencyRecomputations:()=>{a=0},lastResult:()=>c,recomputations:()=>s,resetRecomputations:()=>{s=0},memoize:g,argsMemoize:y})};return Object.assign(r,{withTypes:()=>r}),r}var _t=YMe(goe),XMe=Object.assign((e,n=_t)=>{WMe(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);const i=Object.keys(e),r=i.map(s=>e[s]);return n(r,(...s)=>s.reduce((a,c,u)=>(a[i[u]]=c,a),{}))},{withTypes:()=>XMe}),OT={},DT={},LT={},QU;function QMe(){return QU||(QU=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function n(r){return typeof r=="symbol"?1:r===null?2:r===void 0?3:r!==r?4:0}const i=(r,o,s)=>{if(r!==o){const a=n(r),c=n(o);if(a===c&&a===0){if(r<o)return s==="desc"?1:-1;if(r>o)return s==="desc"?-1:1}return s==="desc"?c-a:a-c}return 0};e.compareValues=i})(LT)),LT}var BT={},FT={},ZU;function yoe(){return ZU||(ZU=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function n(i){return typeof i=="symbol"||i instanceof Symbol}e.isSymbol=n})(FT)),FT}var JU;function ZMe(){return JU||(JU=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const n=yoe(),i=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function o(s,a){return Array.isArray(s)?!1:typeof s=="number"||typeof s=="boolean"||s==null||n.isSymbol(s)?!0:typeof s=="string"&&(r.test(s)||!i.test(s))||a!=null&&Object.hasOwn(a,s)}e.isKey=o})(BT)),BT}var eH;function JMe(){return eH||(eH=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const n=QMe(),i=ZMe(),r=GM();function o(s,a,c,u){if(s==null)return[];c=u?void 0:c,Array.isArray(s)||(s=Object.values(s)),Array.isArray(a)||(a=a==null?[null]:[a]),a.length===0&&(a=[null]),Array.isArray(c)||(c=c==null?[]:[c]),c=c.map(y=>String(y));const m=(y,w)=>{let j=y;for(let v=0;v<w.length&&j!=null;++v)j=j[w[v]];return j},h=(y,w)=>w==null||y==null?w:typeof y=="object"&&"key"in y?Object.hasOwn(w,y.key)?w[y.key]:m(w,y.path):typeof y=="function"?y(w):Array.isArray(y)?m(w,y):typeof w=="object"?w[y]:w,g=a.map(y=>(Array.isArray(y)&&y.length===1&&(y=y[0]),y==null||typeof y=="function"||Array.isArray(y)||i.isKey(y)?y:{key:y,path:r.toPath(y)}));return s.map(y=>({original:y,criteria:g.map(w=>h(w,y))})).slice().sort((y,w)=>{for(let j=0;j<g.length;j++){const v=n.compareValues(y.criteria[j],w.criteria[j],c[j]);if(v!==0)return v}return 0}).map(y=>y.original)}e.orderBy=o})(DT)),DT}var WT={},tH;function eRe(){return tH||(tH=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function n(i,r=1){const o=[],s=Math.floor(r),a=(c,u)=>{for(let m=0;m<c.length;m++){const h=c[m];Array.isArray(h)&&u<s?a(h,u+1):o.push(h)}};return a(i,0),o}e.flatten=n})(WT)),WT}var UT={},nH;function xoe(){return nH||(nH=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const n=hoe(),i=XM(),r=aoe(),o=coe();function s(a,c,u){return r.isObject(u)&&(typeof c=="number"&&i.isArrayLike(u)&&n.isIndex(c)&&c<u.length||typeof c=="string"&&c in u)?o.eq(u[c],a):!1}e.isIterateeCall=s})(UT)),UT}var iH;function tRe(){return iH||(iH=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const n=JMe(),i=eRe(),r=xoe();function o(s,...a){const c=a.length;return c>1&&r.isIterateeCall(s,a[0],a[1])?a=[]:c>2&&r.isIterateeCall(a[0],a[1],a[2])&&(a=[a[0]]),n.orderBy(s,i.flatten(a),["asc"])}e.sortBy=o})(OT)),OT}var HT,rH;function nRe(){return rH||(rH=1,HT=tRe().sortBy),HT}var iRe=nRe();const FP=Tu(iRe);var boe=e=>e.legend.settings,rRe=e=>e.legend.size,oRe=e=>e.legend.payload,sRe=_t([oRe,boe],(e,n)=>{var{itemSorter:i}=n,r=e.flat(1);return i?FP(r,i):r});function aRe(){return gn(sRe)}var Ok=1;function voe(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],[n,i]=l.useState({height:0,left:0,top:0,width:0}),r=l.useCallback(o=>{if(o!=null){var s=o.getBoundingClientRect(),a={height:s.height,left:s.left,top:s.top,width:s.width};(Math.abs(a.height-n.height)>Ok||Math.abs(a.left-n.left)>Ok||Math.abs(a.top-n.top)>Ok||Math.abs(a.width-n.width)>Ok)&&i({height:a.height,left:a.left,top:a.top,width:a.width})}},[n.width,n.height,n.top,n.left,...e]);return[n,r]}function da(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var lRe=typeof Symbol=="function"&&Symbol.observable||"@@observable",o
7753H=lRe,qT=()=>Math.random().toString(36).substring(7).split("").join("."),cRe={INIT:`@@redux/INIT${qT()}`,REPLACE:`@@redux/REPLACE${qT()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${qT()}`},oI=cRe;function ZM(e){if(typeof e!="object"||e===null)return!1;let n=e;for(;Object.getPrototypeOf(n)!==null;)n=Object.getPrototypeOf(n);return Object.getPrototypeOf(e)===n||Object.getPrototypeOf(e)===null}function woe(e,n,i){if(typeof e!="function")throw new Error(da(2));if(typeof n=="function"&&typeof i=="function"||typeof i=="function"&&typeof arguments[3]=="function")throw new Error(da(0));if(typeof n=="function"&&typeof i>"u"&&(i=n,n=void 0),typeof i<"u"){if(typeof i!="function")throw new Error(da(1));return i(woe)(e,n)}let r=e,o=n,s=new Map,a=s,c=0,u=!1;function m(){a===s&&(a=new Map,s.forEach((v,_)=>{a.set(_,v)}))}function h(){if(u)throw new Error(da(3));return o}function g(v){if(typeof v!="function")throw new Error(da(4));if(u)throw new Error(da(5));let _=!0;m();const $=c++;return a.set($,v),function(){if(_){if(u)throw new Error(da(6));_=!1,m(),a.delete($),s=null}}}function x(v){if(!ZM(v))throw new Error(da(7));if(typeof v.type>"u")throw new Error(da(8));if(typeof v.type!="string")throw new Error(da(17));if(u)throw new Error(da(9));try{u=!0,o=r(o,v)}finally{u=!1}return(s=a).forEach($=>{$()}),v}function y(v){if(typeof v!="function")throw new Error(da(10));r=v,x({type:oI.REPLACE})}function w(){const v=g;return{subscribe(_){if(typeof _!="object"||_===null)throw new Error(da(11));function $(){const P=_;P.next&&P.next(h())}return $(),{unsubscribe:v($)}},[oH](){return this}}}return x({type:oI.INIT}),{dispatch:x,subscribe:g,getState:h,replaceReducer:y,[oH]:w}}function dRe(e){Object.keys(e).forEach(n=>{const i=e[n];if(typeof i(void 0,{type:oI.INIT})>"u")throw new Error(da(12));if(typeof i(void 0,{type:oI.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(da(13))})}function joe(e){const n=Object.keys(e),i={};for(let s=0;s<n.length;s++){const a=n[s];typeof e[a]=="function"&&(i[a]=e[a])}const r=Object.keys(i);let o;try{dRe(i)}catch(s){o=s}return function(a={},c){if(o)throw o;let u=!1;const m={};for(let h=0;h<r.length;h++){const g=r[h],x=i[g],y=a[g],w=x(y,c);if(typeof w>"u")throw c&&c.type,new Error(da(14));m[g]=w,u=u||w!==y}return u=u||r.length!==Object.keys(a).length,u?m:a}}function sI(...e){return e.length===0?n=>n:e.length===1?e[0]:e.reduce((n,i)=>(...r)=>n(i(...r)))}function uRe(...e){return n=>(i,r)=>{const o=n(i,r);let s=()=>{throw new Error(da(15))};const a={getState:o.getState,dispatch:(u,...m)=>s(u,...m)},c=e.map(u=>u(a));return s=sI(...c)(o.dispatch),{...o,dispatch:s}}}function _oe(e){return ZM(e)&&"type"in e&&typeof e.type=="string"}var Coe=Symbol.for("immer-nothing"),sH=Symbol.for("immer-draftable"),xl=Symbol.for("immer-state");function mu(e,...n){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Oc=Object,qb=Oc.getPrototypeOf,aI="constructor",WP="prototype",h3="configurable",lI="enumerable",I5="writable",k_="value",Vm=e=>!!e&&!!e[xl];function Pu(e){return e?Soe(e)||UP(e)||!!e[sH]||!!e[aI]?.[sH]||HP(e)||qP(e):!1}var pRe=Oc[WP][aI].toString(),aH=new WeakMap;function Soe(e){if(!e||!JM(e))return!1;const n=qb(e);if(n===null||n===Oc[WP])return!0;const i=Oc.hasOwnProperty.call(n,aI)&&n[aI];if(i===Object)return!0;if(!ab(i))return!1;let r=aH.get(i);return r===void 0&&(r=Function.toString.call(i),aH.set(i,r)),r===pRe}function cC(e,n,i=!0){dC(e)===0?(i?Reflect.ownKeys(e):Oc.keys(e)).forEach(o=>{n(o,e[o],e)}):e.forEach((r,o)=>n(o,r,e))}function dC(e){const n=e[xl];return n?n.type_:UP(e)?1:HP(e)?2:qP(e)?3:0}var lH=(e,n,i=dC(e))=>i===2?e.has(n):Oc[WP].hasOwnProperty.call(e,n),f3=(e,n,i=dC(e))=>i===2?e.get(n):e[n],cI=(e,n,i,r=dC(e))=>{r===2?e.set(n,i):r===3?e.add(i):e[n]=i};function mRe(e,n){return e===n?e!==0||1/e===1/n:e!==e&&n!==n}var UP=Array.isArray,HP=e=>e instanceof Map,qP=e=>e instanceof Set,JM=e=>typeof e=="object",ab=e=>typeof e=="function",GT=e=>typeof e=="boolean",km=e=>e.copy_||e.base_,eR=e=>e.modified_?e.copy_:e.base_;function g3(e,n){if(HP(e))return new Map(e);if(qP(e))return new Set(e);if(UP(e))return Array[WP].slice.call(e);const i=Soe(e);if(n===!0||n==="class_only"&&!i){const r=Oc.getOwnPropertyDescriptors(e);delete r[xl];let o=Reflect.ownKeys(r);for(let s=0;s<o.length;s++){const a=o[s],c=r[a];c[I5]===!1&&(c[I5]=!0,c[h3]=!0),(c.get||c.set)&&(r[a]={[h3]:!0,[I5]:!0,[lI]:c[lI],[k_]:e[a]})}return Oc.create(qb(e),r)}else{const r=qb(e);if(r!==null&&i)return{...e};const o=Oc.create(r);return Oc.assign(o,e)}}function tR(e,n=!1){return GP(e)||Vm(e)||!Pu(e)||(dC(e)>
77531&&Oc.defineProperties(e,{set:Dk,add:Dk,clear:Dk,delete:Dk}),Oc.freeze(e),n&&cC(e,(i,r)=>{tR(r,!0)},!1)),e}function hRe(){mu(2)}var Dk={[k_]:hRe};function GP(e){return e===null||!JM(e)?!0:Oc.isFrozen(e)}var dI="MapSet",y3="Patches",koe={};function Gb(e){const n=koe[e];return n||mu(0,e),n}var fRe=e=>!!koe[e],$_,$oe=()=>$_,gRe=(e,n)=>({drafts_:[],parent_:e,immer_:n,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:fRe(dI)?Gb(dI):void 0});function cH(e,n){n&&(e.patchPlugin_=Gb(y3),e.patches_=[],e.inversePatches_=[],e.patchListener_=n)}function x3(e){b3(e),e.drafts_.forEach(yRe),e.drafts_=null}function b3(e){e===$_&&($_=e.parent_)}var dH=e=>$_=gRe($_,e);function yRe(e){const n=e[xl];n.type_===0||n.type_===1?n.revoke_():n.revoked_=!0}function uH(e,n){n.unfinalizedDrafts_=n.drafts_.length;const i=n.drafts_[0];if(e!==void 0&&e!==i){i[xl].modified_&&(x3(n),mu(4)),Pu(e)&&(e=pH(n,e));const{patchPlugin_:o}=n;o&&o.generateReplacementPatches_(i[xl].base_,e,n)}else e=pH(n,i);return xRe(n,e,!0),x3(n),n.patches_&&n.patchListener_(n.patches_,n.inversePatches_),e!==Coe?e:void 0}function pH(e,n){if(GP(n))return n;const i=n[xl];if(!i)return nR(n,e.handledSet_,e);if(!VP(i,e))return n;if(!i.modified_)return i.base_;if(!i.finalized_){const{callbacks_:r}=i;if(r)for(;r.length>0;)r.pop()(e);Aoe(i,e)}return i.copy_}function xRe(e,n,i=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&tR(n,i)}function Ioe(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var VP=(e,n)=>e.scope_===n,bRe=[];function Poe(e,n,i,r){const o=km(e),s=e.type_;if(r!==void 0&&f3(o,r,s)===n){cI(o,r,i,s);return}if(!e.draftLocations_){const c=e.draftLocations_=new Map;cC(o,(u,m)=>{if(Vm(m)){const h=c.get(m)||[];h.push(u),c.set(m,h)}})}const a=e.draftLocations_.get(n)??bRe;for(const c of a)cI(o,c,i,s)}function vRe(e,n,i){e.callbacks_.push(function(o){const s=n;
7753if(!s||!VP(s,o))return;o.mapSetPlugin_?.fixSetContents(s);const a=eR(s);Poe(e,s.draft_??s,a,i),Aoe(s,o)})}function Aoe(e,n){if(e.modified_&&!e.finalized_&&(e.type_===3||(e.assigned_?.size??0)>0)){const{patchPlugin_:r}=n;if(r){const o=r.getPath(e);o&&r.generatePatches_(e,o,n)}Ioe(e)}}function wRe(e,n,i){const{scope_:r}=e;if(Vm(i)){const o=i[xl];VP(o,r)&&o.callbacks_.push(function(){P5(e);const a=eR(o);Poe(e,i,a,n)})}else Pu(i)&&e.callbacks_.push(function(){const s=km(e);f3(s,n,e.type_)===i&&r.drafts_.length>1&&(e.assigned_.get(n)??!1)===!0&&e.copy_&&nR(f3(e.copy_,n,e.type_),r.handledSet_,r)})}function nR(e,n,i){return!i.immer_.autoFreeze_&&i.unfinalizedDrafts_<1||Vm(e)||n.has(e)||!Pu(e)||GP(e)||(n.add(e),cC(e,(r,o)=>{if(Vm(o)){const s=o[xl];if(VP(s,i)){const a=eR(s);cI(e,r,a,e.type_),Ioe(s)}}else Pu(o)&&nR(o,n,i)})),e}function jRe(e,n){const i=UP(e),r={type_:i?1:0,scope_:n?n.scope_:$oe(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:n,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let o=r,s=iR;i&&(o=[r],s=I_);const{revoke:a,proxy:c}=Proxy.revocable(o,s);return r.draft_=c,r.revoke_=a,[c,r]}var iR={get(e,n){if(n===xl)return e;const i=km(e);if(!lH(i,n,e.type_))return _Re(e,i,n);const r=i[n];if(e.finalized_||!Pu(r))return r;if(r===VT(e.base_,n)){P5(e);const o=e.type_===1?+n:n,s=w3(e.scope_,r,e,o);return e.copy_[o]=s}return r},has(e,n){return n in km(e)},ownKeys(e){return Reflect.ownKeys(km(e))},set(e,n,i){const r=Noe(km(e),n);if(r?.set)return r.set.call(e.draft_,i),!0;if(!e.modified_){const o=VT(km(e),n),s=o?.[xl];if(s&&s.base_===i)return e.copy_[n]=i,e.assigned_.set(n,!1),!0;if(mRe(i,o)&&(i!==void 0||lH(e.base_,n,e.type_)))return!0;P5(e),v3(e)}return e.copy_[n]===i&&(i!==void 0||n in e.copy_)||Number.isNaN(i)&&Number.isNaN(e.copy_[n])||(e.copy_[n]=i,e.assigned_.set(n,!0),wRe(e,n,i)),!0},deleteProperty(e,n){return P5(e),VT(e.base_,n)!==void 0||n in e.base_?(e.assigned_.set(n,!1),v3(e)):e.assigned_.delete(n),e.copy_&&delete e.copy_[n],!0},getOwnPropertyDescriptor(e,n){const i=km(e),r=Reflect.getOwnPropertyDescriptor(i,n);return r&&{[I5]:!0,[h3]:e.type_!==1||n!=="length",[lI]:r[lI],[k_]:i[n]}},defineProperty(){mu(11)},getPrototypeOf(e){return qb(e.base_)},setPrototypeOf(){mu(12)}},I_={};cC(iR,(e,n)=>{I_[e]=function(){const i=arguments;return i[0]=i[0][0],n.apply(this,i)}});I_.deleteProperty=function(e,n){return I_.set.call(this,e,n,void 0)};I_.set=function(e,n,i){return iR.set.call(this,e[0],n,i,e[0])};function VT(e,n){const i=e[xl];return(i?km(i):e)[n]}function _Re(e,n,i){const r=Noe(n,i);return r?k_ in r?r[k_]:r.get?.call(e.draft_):void 0}function Noe(e,n){if(!(n in e))return;let i=qb(e);for(;i;){const r=Object.getOwnPropertyDescriptor(i,n);if(r)return r;i=qb(i)}}function v3(e){e.modified_||(e.modified_=!0,e.parent_&&v3(e.parent_))}function P5(e){e.copy_||(e.assigned_=new Map,e.copy_=g3(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var CRe=class{constructor(n){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(i,r,o)=>{if(ab(i)&&!ab(r)){const a=r;r=i;const c=this;return function(m=a,...h){return c.produce(m,g=>r.call(this,g,...h))}}ab(r)||mu(6),o!==void 0&&!ab(o)&&mu(7);let s;if(Pu(i)){const a=dH(this),c=w3(a,i,void 0);let u=!0;try{s=r(c),u=!1}finally{u?x3(a):b3(a)}return cH(a,o),uH(s,a)}else if(!i||!JM(i)){if(s=r(i),s===void 0&&(s=i),s===Coe&&(s=void 0),this.autoFreeze_&&tR(s,!0),o){const a=[],c=[];Gb(y3).generateReplacementPatches_(i,s,{patches_:a,inversePatches_:c}),o(a,c)}return s}else mu(1,i)},this.produceWithPatches=(i,r)=>{if(ab(i))return(c,...u)=>this.produceWithPatches(c,m=>i(m,...u));let o,s;return[this.produce(i,r,(c,u)=>{o=c,s=u}),o,s]},GT(n?.autoFreeze)&&this.setAutoFreeze(n.autoFreeze),GT(n?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(n.useStrictShallowCopy),GT(n?.useStrictIteration)&&this.setUseStrictIteration(n.useStrictIteration)}createDraft(n){Pu(n)||mu(8),Vm(n)&&(n=Su(n));const i=dH(this),r=w3(i,n,void 0);return r[xl].isManual_=!0,b3(i),r}finishDraft(n,i){const r=n&&n[xl];(!r||!r.isManual_)&&mu(9);const{scope_:o}=r;return cH(o,i),uH(void 0,o)}setAutoFreeze(n){this.autoFreeze_=n}setUseStrictShallowCopy(n){this.useStrictShallowCopy_=n}setUseStrictIteration(n){this.useStrictIteration_=n}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(n,i){let r;for(r=i.length-1;r>=0;r--){const s=i[r];if(s.path.length===0&&s.op==="replace"){n=s.value;break}}r>-1&&(i=i.slice(r+1));const o=Gb(y3).applyPatches_;return Vm(n)?o(n,i):this.produce(n,s=>o(s,i))}};function w3(e,n,i,r){const[o,s]=HP(n)?Gb(dI).proxyMap_(n,i):qP(n)?Gb(dI).proxySet_(n,i):jRe(n,i);
7753return(i?.scope_??$oe()).drafts_.push(o),s.callbacks_=i?.callbacks_??[],s.key_=r,i&&r!==void 0?vRe(i,s,r):s.callbacks_.push(function(u){u.mapSetPlugin_?.fixSetContents(s);const{patchPlugin_:m}=u;s.modified_&&m&&m.generatePatches_(s,[],u)}),o}function Su(e){return Vm(e)||mu(10,e),zoe(e)}function zoe(e){if(!Pu(e)||GP(e))return e;const n=e[xl];let i,r=!0;if(n){if(!n.modified_)return n.base_;n.finalized_=!0,i=g3(e,n.scope_.immer_.useStrictShallowCopy_),r=n.scope_.immer_.shouldUseStrictIteration()}else i=g3(e,!0);return cC(i,(o,s)=>{cI(i,o,zoe(s))},r),n&&(n.finalized_=!1),i}var SRe=new CRe,Toe=SRe.produce;function Eoe(e){return({dispatch:i,getState:r})=>o=>s=>typeof s=="function"?s(i,r,e):o(s)}var kRe=Eoe(),$Re=Eoe,IRe=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?sI:sI.apply(null,arguments)};function Rd(e,n){function i(...r){if(n){let o=n(...r);if(!o)throw new Error(Wc(0));return{type:e,payload:o.payload,..."meta"in o&&{meta:o.meta},..."error"in o&&{error:o.error}}}return{type:e,payload:r[0]}}return i.toString=()=>`${e}`,i.type=e,i.match=r=>_oe(r)&&r.type===e,i}var Moe=class Gj extends Array{constructor(...n){super(...n),Object.setPrototypeOf(this,Gj.prototype)}static get[Symbol.species](){return Gj}concat(...n){return super.concat.apply(this,n)}prepend(...n){return n.length===1&&Array.isArray(n[0])?new Gj(...n[0].concat(this)):new Gj(...n.concat(this))}};function mH(e){return Pu(e)?Toe(e,()=>{}):e}function Lk(e,n,i){return e.has(n)?e.get(n):e.set(n,i(n)).get(n)}function PRe(e){return typeof e=="boolean"}var ARe=()=>function(n){const{thunk:i=!0,immutableCheck:r=!0,serializableCheck:o=!0,actionCreatorCheck:s=!0}=n??{};let a=new Moe;return i&&(PRe(i)?a.push(kRe):a.push($Re(i.extraArgument))),a},Roe="RTK_autoBatch",oo=()=>e=>({payload:e,meta:{[Roe]:!0}}),hH=e=>n=>{setTimeout(n,e)},Ooe=(e={type:"raf"})=>n=>(...i)=>{const r=n(...i);let o=!0,s=!1,a=!1;const c=new Set,u=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:hH(10):e.type==="callback"?e.queueNotification:hH(e.timeout),m=()=>{a=!1,s&&(s=!1,c.forEach(h=>h()))};return Object.assign({},r,{subscribe(h){const g=()=>o&&h(),x=r.subscribe(g);return c.add(h),()=>{x(),c.delete(h)}},dispatch(h){try{return o=!h?.meta?.[Roe],s=!o,s&&(a||(a=!0,u(m))),r.dispatch(h)}finally{o=!0}}})},NRe=e=>function(i){const{autoBatch:r=!0}=i??{};let o=new Moe(e);return r&&o.push(Ooe(typeof r=="object"?r:void 0)),o};function zRe(e){const n=ARe(),{reducer:i=void 0,middleware:r,devTools:o=!0,preloadedState:s=void 0,enhancers:a=void 0}=e||{};let c;if(typeof i=="function")c=i;else if(ZM(i))c=joe(i);else throw new Error(Wc(1));let u;typeof r=="function"?u=r(n):u=n();let m=sI;o&&(m=IRe({trace:!1,...typeof o=="object"&&o}));const h=uRe(...u),g=NRe(h);let x=typeof a=="function"?a(g):g();const y=m(...x);return woe(c,s,y)}function Doe(e){const n={},i=[];let r;const o={addCase(s,a){const c=typeof s=="string"?s:s.type;if(!c)throw new Error(Wc(28));if(c in n)throw new Error(Wc(29));return n[c]=a,o},addAsyncThunk(s,a){return a.pending&&(n[s.pending.type]=a.pending),a.rejected&&(n[s.rejected.type]=a.rejected),a.fulfilled&&(n[s.fulfilled.type]=a.fulfilled),a.settled&&i.push({matcher:s.settled,reducer:a.settled}),o},addMatcher(s,a){return i.push({matcher:s,reducer:a}),o},addDefaultCase(s){return r=s,o}};return e(o),[n,i,r]}function TRe(e){return typeof e=="function"}function ERe(e,n){let[i,r,o]=Doe(n),s;if(TRe(e))s=()=>mH(e());else{const c=mH(e);s=()=>c}function a(c=s(),u){let m=[i[u.type],...r.filter(({matcher:h})=>h(u)).map(({reducer:h})=>h)];return m.filter(h=>!!h).length===0&&(m=[o]),m.reduce((h,g)=>{if(g)if(Vm(h)){const y=g(h,u);return y===void 0?h:y}else{if(Pu(h))return Toe(h,x=>g(x,u));{const x=g(h,u);if(x===void 0){if(h===null)return h;throw Error("A case reducer on a non-draftable value must not return undefined")}return x}}return h},c)}return a.getInitialState=s,a}var MRe="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",RRe=(e=21)=>{let n="",i=e;for(;i--;)n+=MRe[Math.random()*64|0];return n},ORe=Symbol.for("rtk-slice-createasyncthunk");function DRe(e,n){return`${e}/${n}`}function LRe({creators:e}={}){const n=e?.asyncThunk?.[ORe];return function(r){const{name:o,reducerPath:s=o}=r;if(!o)throw new Error(Wc(11));const a=(typeof r.reducers=="function"?r.reducers(FRe()):r.reducers)||{},c=Object.keys(a),u={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},m={addCase(k,P){const S=typeof k=="string"?k:k.type;if(!S)throw new Error(Wc(12));if(S in u.sliceCaseReducersByType)throw new Error(Wc(13));return u.sliceCaseReducersByType[S]=P,m},addMatcher(k,P){return u.sliceMatchers.push({matcher:k,reducer:P}),m},exposeAction(k,P){return u.actionCreators[k]=P,m},exposeCaseReducer(k,P){return u.sliceCaseReducersByName[k]=P,m}};
7753c.forEach(k=>{const P=a[k],S={reducerName:k,type:DRe(o,k),createNotation:typeof r.reducers=="function"};URe(P)?qRe(S,P,m,n):WRe(S,P,m)});function h(){const[k={},P=[],S=void 0]=typeof r.extraReducers=="function"?Doe(r.extraReducers):[r.extraReducers],I={...k,...u.sliceCaseReducersByType};return ERe(r.initialState,A=>{for(let E in I)A.addCase(E,I[E]);for(let E of u.sliceMatchers)A.addMatcher(E.matcher,E.reducer);for(let E of P)A.addMatcher(E.matcher,E.reducer);S&&A.addDefaultCase(S)})}const g=k=>k,x=new Map,y=new WeakMap;let w;function j(k,P){return w||(w=h()),w(k,P)}function v(){return w||(w=h()),w.getInitialState()}function _(k,P=!1){function S(A){let E=A[k];return typeof E>"u"&&P&&(E=Lk(y,S,v)),E}function I(A=g){const E=Lk(x,P,()=>new WeakMap);return Lk(E,A,()=>{const B={};for(const[T,M]of Object.entries(r.selectors??{}))B[T]=BRe(M,A,()=>Lk(y,A,v),P);return B})}return{reducerPath:k,getSelectors:I,get selectors(){return I(S)},selectSlice:S}}const $={name:o,reducer:j,actions:u.actionCreators,caseReducers:u.sliceCaseReducersByName,getInitialState:v,..._(s),injectInto(k,{reducerPath:P,...S}={}){const I=P??s;return k.inject({reducerPath:I,reducer:j},S),{...$,..._(I,!0)}}};return $}}function BRe(e,n,i,r){function o(s,...a){let c=n(s);return typeof c>"u"&&r&&(c=i()),e(c,...a)}return o.unwrapped=e,o}var nc=LRe();function FRe(){function e(n,i){return{_reducerDefinitionType:"asyncThunk",payloadCreator:n,...i}}return e.withTypes=()=>e,{reducer(n){return Object.assign({[n.name](...i){return n(...i)}}[n.name],{_reducerDefinitionType:"reducer"})},preparedReducer(n,i){return{_reducerDefinitionType:"reducerWithPrepare",prepare:n,reducer:i}},asyncThunk:e}}function WRe({type:e,reducerName:n,createNotation:i},r,o){let s,a;if("reducer"in r){if(i&&!HRe(r))throw new Error(Wc(17));s=r.reducer,a=r.prepare}else s=r;o.addCase(e,s).exposeCaseReducer(n,s).exposeAction(n,a?Rd(e,a):Rd(e))}function URe(e){return e._reducerDefinitionType==="asyncThunk"}function HRe(e){return e._reducerDefinitionType==="reducerWithPrepare"}function qRe({type:e,reducerName:n},i,r,o){if(!o)throw new Error(Wc(18));const{payloadCreator:s,fulfilled:a,pending:c,rejected:u,settled:m,options:h}=i,g=o(e,s,h);r.exposeAction(n,g),a&&r.addCase(g.fulfilled,a),c&&r.addCase(g.pending,c),u&&r.addCase(g.rejected,u),m&&r.addMatcher(g.settled,m),r.exposeCaseReducer(n,{fulfilled:a||Bk,pending:c||Bk,rejected:u||Bk,settled:m||Bk})}function Bk(){}var GRe="task",Loe="listener",Boe="completed",rR="cancelled",VRe=`task-${rR}`,KRe=`task-${Boe}`,j3=`${Loe}-${rR}`,YRe=`${Loe}-${Boe}`,KP=class{constructor(e){this.code=e,this.message=`${GRe} ${rR} (reason: ${e})`}name="TaskAbortError";message},oR=(e,n)=>{if(typeof e!="function")throw new TypeError(Wc(32))},uI=()=>{},Foe=(e,n=uI)=>(e.catch(n),e),Woe=(e,n)=>(e.addEventListener("abort",n,{once:!0}),()=>e.removeEventListener("abort",n)),cy=e=>{if(e.aborted)throw new KP(e.reason)};function Uoe(e,n){let i=uI;return new Promise((r,o)=>{const s=()=>o(new KP(e.reason));if(e.aborted){s();return}i=Woe(e,s),n.finally(()=>i()).then(r,o)}).finally(()=>{i=uI})}var XRe=async(e,n)=>{try{return await Promise.resolve(),{status:"ok",value:await e()}}catch(i){return{status:i instanceof KP?"cancelled":"rejected",error:i}}finally{n?.()}},pI=e=>n=>Foe(Uoe(e,n).then(i=>(cy(e),i))),Hoe=e=>{const n=pI(e);return i=>n(new Promise(r=>setTimeout(r,i)))},{assign:Cb}=Object,fH={},YP="listenerMiddleware",QRe=(e,n)=>{const i=r=>Woe(e,()=>r.abort(e.reason));return(r,o)=>{oR(r);const s=new AbortController;i(s);const a=XRe(async()=>{cy(e),cy(s.signal);const c=await r({pause:pI(s.signal),delay:Hoe(s.signal),signal:s.signal});return cy(s.signal),c},()=>s.abort(KRe));return o?.autoJoin&&n.push(a.catch(uI)),{result:pI(e)(a),cancel(){s.abort(VRe)}}}},ZRe=(e,n)=>{const i=async(r,o)=>{cy(n);let s=()=>{};const c=[new Promise((u,m)=>{let h=e({predicate:r,effect:(g,x)=>{x.unsubscribe(),u([g,x.getState(),x.getOriginalState()])}});s=()=>{h(),m()}})];o!=null&&c.push(new Promise(u=>setTimeout(u,o,null)));try{const u=await Uoe(n,Promise.race(c));return cy(n),u}finally{s()}};return(r,o)=>Foe(i(r,o))},qoe=e=>{let{type:n,actionCreator:i,matcher:r,predicate:o,effect:s}=e;if(n)o=Rd(n).match;else if(i)n=i.type,o=i.match;else if(r)o=r;else if(!o)throw new Error(Wc(21));return oR(s),{predicate:o,type:n,effect:s}},Goe=Cb(e=>{const{type:n,predicate:i,effect:r}=qoe(e);return{id:RRe(),effect:r,type:n,predicate:i,pending:new Set,unsubscribe:()=>{throw new Error(Wc(22))}}},{withTypes:()=>Goe}),gH=(e,n)=>{const{type:i,effect:r,predicate:o}=qoe(n);return Array.from(e.values()).find(s=>(typeof i=="string"?s.type===i:s.predicate===o)&&s.effect===r)},_3=e=>{e.pending.forEach(n=>
7753{n.abort(j3)})},JRe=(e,n)=>()=>{for(const i of n.keys())_3(i);e.clear()},yH=(e,n,i)=>{try{e(n,i)}catch(r){setTimeout(()=>{throw r},0)}},Voe=Cb(Rd(`${YP}/add`),{withTypes:()=>Voe}),eOe=Rd(`${YP}/removeAll`),Koe=Cb(Rd(`${YP}/remove`),{withTypes:()=>Koe}),tOe=(...e)=>{console.error(`${YP}/error`,...e)},uC=(e={})=>{const n=new Map,i=new Map,r=y=>{const w=i.get(y)??0;i.set(y,w+1)},o=y=>{const w=i.get(y)??1;w===1?i.delete(y):i.set(y,w-1)},{extra:s,onError:a=tOe}=e;oR(a);const c=y=>(y.unsubscribe=()=>n.delete(y.id),n.set(y.id,y),w=>{y.unsubscribe(),w?.cancelActive&&_3(y)}),u=y=>{const w=gH(n,y)??Goe(y);return c(w)};Cb(u,{withTypes:()=>u});const m=y=>{const w=gH(n,y);return w&&(w.unsubscribe(),y.cancelActive&&_3(w)),!!w};Cb(m,{withTypes:()=>m});const h=async(y,w,j,v)=>{const _=new AbortController,$=ZRe(u,_.signal),k=[];try{y.pending.add(_),r(y),await Promise.resolve(y.effect(w,Cb({},j,{getOriginalState:v,condition:(P,S)=>$(P,S).then(Boolean),take:$,delay:Hoe(_.signal),pause:pI(_.signal),extra:s,signal:_.signal,fork:QRe(_.signal,k),unsubscribe:y.unsubscribe,subscribe:()=>{n.set(y.id,y)},cancelActiveListeners:()=>{y.pending.forEach((P,S,I)=>{P!==_&&(P.abort(j3),I.delete(P))})},cancel:()=>{_.abort(j3),y.pending.delete(_)},throwIfCancelled:()=>{cy(_.signal)}})))}catch(P){P instanceof KP||yH(a,P,{raisedBy:"effect"})}finally{await Promise.all(k),_.abort(YRe),o(y),y.pending.delete(_)}},g=JRe(n,i);return{middleware:y=>w=>j=>{if(!_oe(j))return w(j);if(Voe.match(j))return u(j.payload);if(eOe.match(j)){g();return}if(Koe.match(j))return m(j.payload);let v=y.getState();const _=()=>{if(v===fH)throw new Error(Wc(23));return v};let $;try{if($=w(j),n.size>0){const k=y.getState(),P=Array.from(n.values());for(const S of P){let I=!1;try{I=S.predicate(j,k,v)}catch(A){I=!1,yH(a,A,{raisedBy:"predicate"})}I&&h(S,j,y,_)}}}finally{v=fH}return $},startListening:u,stopListening:m,clearListeners:g}};function Wc(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var nOe={layoutType:"horizontal",width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},Yoe=nc({name:"chartLayout",initialState:nOe,reducers:{setLayout(e,n){e.layoutType=n.payload},setChartSize(e,n){e.width=n.payload.width,e.height=n.payload.height},setMargin(e,n){var i,r,o,s;e.margin.top=(i=n.payload.top)!==null&&i!==void 0?i:0,e.margin.right=(r=n.payload.right)!==null&&r!==void 0?r:0,e.margin.bottom=(o=n.payload.bottom)!==null&&o!==void 0?o:0,e.margin.left=(s=n.payload.left)!==null&&s!==void 0?s:0},setScale(e,n){e.scale=n.payload}}}),{setMargin:iOe,setLayout:rOe,setChartSize:oOe,setScale:sOe}=Yoe.actions,aOe=Yoe.reducer;function Xoe(e,n,i){return Array.isArray(e)&&e&&n+i!==0?e.slice(n,i+1):e}function Vi(e){return Number.isFinite(e)}function Np(e){return typeof e=="number"&&e>0&&Number.isFinite(e)}function xH(e,n){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),i.push.apply(i,r)}return i}function db(e){for(var n=1;n<arguments.length;n++){var i=arguments[n]!=null?arguments[n]:{};n%2?xH(Object(i),!0).forEach(function(r){lOe(e,r,i[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):xH(Object(i)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(i,r))})}return e}function lOe(e,n,i){return(n=cOe(n))in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i,e}function cOe(e){var n=dOe(e,"string");return typeof n=="symbol"?n:n+""}function dOe(e,n){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,n);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function or(e,n,i){return eo(e)||eo(n)?i:Md(n)?Py(e,n,i):typeof n=="function"?n(e):i}var uOe=(e,n,i)=>{if(n&&i){var{width:r,height:o}=i,{align:s,verticalAlign:a,layout:c}=n;if((c==="vertical"||c==="horizontal"&&a==="middle")&&s!=="center"&&fn(e[s]))return db(db({},e),{},{[s]:e[s]+(r||0)});if((c==="horizontal"||c==="vertical"&&s==="center")&&a!=="middle"&&fn(e[a]))return db(db({},e),{},{[a]:e[a]+(o||0)})}return e},Rp=(e,n)=>e==="horizontal"&&n==="xAxis"||e==="vertical"&&n==="yAxis"||e==="centric"&&n==="angleAxis"||e==="radial"&&n==="radiusAxis",Qoe=(e,n,i,r)=>{if(r)return e.map(c=>c.coordinate);var o,s,a=e.map(c=>(c.coordinate===n&&(o=!0),c.coordinate===i&&(s=!0),c.coordinate));return o||a.push(n),s||a.push(i),a},Zoe=(e,n,i)=>{if(!e)return null;var{duplicateDomain:r,type:o,range:s,scale:a,realScaleType:c,isCategorical:u,categoricalDomain:m,tickCount:h,ticks:g,niceTicks:x,axisType:y}=e;if(!a)return null;var w=c==="scaleBand"&&a.bandwidth?a.bandwidth()/2:2,j=o==="category"&&a.bandwidth?a.bandwidth()/w:0;if(j=y==="angleAxis"&&s&&s.length>=2?Vs(s[0]-s[1])*2*j:j,g||x){var v=(g||x||[]).map((_,$)=>{var k=r?r.indexOf(_):_;return{coordinate:a(k)+j,value:_,offset:j,index:$}});return v.filter(_=>!Xl(_.coordinate))}return u&&m?m.map((_,$)=>({coordinate:a(_)+j,value:_,index:$,offset:j})):a.ticks&&h!=null?a.ticks(h).map((_,$)=>({coordinate:a(_)+j,value:_,offset:j,index:$})):a.domain().map((_,$)=>({coordinate:a(_)+j,value:r?r[_]:_,index:$,offset:j}))},bH=1e-4,pOe=e=>{var n=e.domain();if(!(!n||n.length<=2)){var i=n.length,r=e.range(),o=Math.min(r[0],r[1])-bH,s=Math.max(r[0],r[1])+bH,a=e(n[0]),c=e(n[i-1]);(a<o||a>s||c<o||c>s)&&e.domain([n[0],n[i-1]])}},mOe=(e,n)=>{if(!n||n.length!==2||!fn(n[0])||!fn(n[1]))return e;var i=Math.min(n[0],n[1]),r=Math.max(n[0],n[1]),o=[e[0],e[1]];return(!fn(e[0])||e[0]<i)&&(o[0]=i),(!fn(e[1])||e[1]>r)&&(o[1]=r),o[0]>r&&(o[0]=r),o[1]<i&&(o[1]=i),o},hOe=e=>{var n,i=e.length;if(!(i<=0)){var r=(n=e[0])===null||n===void 0?void 0:n.length;if(!(r==null||r<=0))for(var o=0;o<r;++o)for(var s=0,a=0,c=0;c<i;++c){var u=e[c],m=u?.[o];if(m!=null){var h=m[1],g=m[0],x=Xl(h)?g:h;x>=0?(m[0]=s,m[1]=s+x,s=h):(m[0]=a,m[1]=a+x,a=h)}}}},fOe=e=>{var n,i=e.length;if(!(i<=0)){var r=(n=e[0])===null||n===void 0?void 0:n.length;if(!(r==null||r<=0))for(var o=0;o<r;++o)for(var s=0,a=0;a<i;++a){var c=e[a],u=c?.[o];if(u!=null){var m=Xl(u[1])?u[0]:u[1];m>=0?(u[0]=s,u[1]=s+m,s=u[1]):(u[0]=0,u[1]=0)}}}},gOe={sign:hOe,expand:M8e,none:Iy,silhouette:R8e,wiggle:O8e,positive:fOe},yOe=(e,n,i)=>{var r,o=(r=gOe[i])!==null&&r!==void 0?r:Iy,s=E8e().keys(n).value((c,u)=>Number(or(c,u,0))).order(p3).offset(o),a=s(e);return a.forEach((c,u)=>
7753{c.forEach((m,h)=>{var g=or(e[h],n[u],0);Array.isArray(g)&&g.length===2&&fn(g[0])&&fn(g[1])&&(m[0]=g[0],m[1]=g[1])})}),a};function Joe(e){return e==null?void 0:String(e)}function mI(e){var{axis:n,ticks:i,bandSize:r,entry:o,index:s,dataKey:a}=e;if(n.type==="category"){if(!n.allowDuplicatedCategory&&n.dataKey&&!eo(o[n.dataKey])){var c=ioe(i,"value",o[n.dataKey]);if(c)return c.coordinate+r/2}return i[s]?i[s].coordinate+r/2:null}var u=or(o,eo(a)?n.dataKey:a);return eo(u)?null:n.scale(u)}var vH=e=>{var{axis:n,ticks:i,offset:r,bandSize:o,entry:s,index:a}=e;if(n.type==="category")return i[a]?i[a].coordinate+r:null;var c=or(s,n.dataKey,n.scale.domain()[a]);return eo(c)?null:n.scale(c)-o/2+r},xOe=e=>{var{numericAxis:n}=e,i=n.scale.domain();if(n.type==="number"){var r=Math.min(i[0],i[1]),o=Math.max(i[0],i[1]);return r<=0&&o>=0?0:o<0?o:r}return i[0]},bOe=e=>{var n=e.flat(2).filter(fn);return[Math.min(...n),Math.max(...n)]},vOe=e=>[e[0]===1/0?0:e[0],e[1]===-1/0?0:e[1]],wOe=(e,n,i)=>{if(e!=null)return vOe(Object.keys(e).reduce((r,o)=>{var s=e[o];if(!s)return r;var{stackedData:a}=s,c=a.reduce((u,m)=>{var h=Xoe(m,n,i),g=bOe(h);return!Vi(g[0])||!Vi(g[1])?u:[Math.min(u[0],g[0]),Math.max(u[1],g[1])]},[1/0,-1/0]);return[Math.min(c[0],r[0]),Math.max(c[1],r[1])]},[1/0,-1/0]))},wH=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,jH=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Pf=(e,n,i)=>{if(e&&e.scale&&e.scale.bandwidth){var r=e.scale.bandwidth();if(!i||r>0)return r}if(e&&n&&n.length>=2){for(var o=FP(n,h=>h.coordinate),s=1/0,a=1,c=o.length;a<c;a++){var u=o[a],m=o[a-1];s=Math.min((u?.coordinate||0)-(m?.coordinate||0),s)}return s===1/0?0:s}return i?void 0:0};function _H(e){var{tooltipEntrySettings:n,dataKey:i,payload:r,value:o,name:s}=e;return db(db({},n),{},{dataKey:i,payload:r,value:o,name:s})}function Df(e,n){if(e)return String(e);if(typeof n=="string")return n}var jOe=(e,n)=>{if(n==="horizontal")return e.chartX;if(n==="vertical")return e.chartY},_Oe=(e,n)=>n==="centric"?e.angle:e.radius,sh=e=>e.layout.width,ah=e=>e.layout.height,COe=e=>e.layout.scale,ese=e=>e.layout.margin,XP=_t(e=>e.cartesianAxis.xAxis,e=>Object.values(e)),QP=_t(e=>e.cartesianAxis.yAxis,e=>Object.values(e)),tse="data-recharts-item-index",nse="data-recharts-item-id",pC=60;function CH(e,n){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),i.push.apply(i,r)}return i}function Fk(e){for(var n=1;n<arguments.length;n++){var i=arguments[n]!=null?arguments[n]:{};n%2?CH(Object(i),!0).forEach(function(r){SOe(e,r,i[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):CH(Object(i)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(i,r))})}return e}function SOe(e,n,i){return(n=kOe(n))in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i,e}function kOe(e){var n=$Oe(e,"string");return typeof n=="symbol"?n:n+""}function $Oe(e,n){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,n);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}var IOe=e=>e.brush.height;function POe(e){var n=QP(e);return n.reduce((i,r)=>{if(r.orientation==="left"&&!r.mirror&&!r.hide){var o=typeof r.width=="number"?r.width:pC;return i+o}return i},0)}function AOe(e){var n=QP(e);return n.reduce((i,r)=>{if(r.orientation==="right"&&!r.mirror&&!r.hide){var o=typeof r.width=="number"?r.width:pC;return i+o}return i},0)}function NOe(e){var n=XP(e);return n.reduce((i,r)=>r.orientation==="top"&&!r.mirror&&!r.hide?i+r.height:i,0)}function zOe(e){var n=XP(e);return n.reduce((i,r)=>r.orientation==="bottom"&&!r.mirror&&!r.hide?i+r.height:i,0)}var ks=_t([sh,ah,ese,IOe,POe,AOe,NOe,zOe,boe,rRe],(e,n,i,r,o,s,a,c,u,m)=>{var h={left:(i.left||0)+o,right:(i.right||0)+s},g={top:(i.top||0)+a,bottom:(i.bottom||0)+c},x=Fk(Fk({},g),h),y=x.bottom;x.bottom+=r,x=uOe(x,u,m);var w=e-x.left-x.right,j=n-x.top-x.bottom;return Fk(Fk({brushBottom:y},x),{},{width:Math.max(w,0),height:Math.max(j,0)})}),TOe=_t(ks,e=>({x:e.left,y:e.top,width:e.width,height:e.height})),sR=_t(sh,ah,(e,n)=>({x:0,y:0,width:e,height:n})),EOe=l.createContext(null),$s=()=>l.useContext(EOe)!=null,ZP=e=>e.brush,JP=_t([ZP,ks,ese],(e,n,i)=>({height:e.height,x:fn(e.x)?e.x:n.left,y:fn(e.y)?e.y:n.top+n.height+n.brushBottom-(i?.bottom||0),width:fn(e.width)?e.width:n.width})),KT={},YT={},XT={},SH;function MOe(){return SH||(SH=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function n(i,r,{signal:o,edges:s}={}){let a,c=null;const u=s!=null&&s.includes("leading"),m=s==null||s.includes("trailing"),h=()=>{c!==null&&(i.apply(a,c),a=void 0,c=null)},g=()=>{m&&h(),j()};let x=null;const y=()=>{x!=null&&clearTimeout(x),x=setTimeout(()=>{x=null,g()},r)},w=()=>{x!==null&&(clearTimeout(x),x=null)},j=()=>{w(),a=void 0,c=null},v=()=>{h()},_=function(...$){if(o?.aborted)return;a=this,c=$;
7753const k=x==null;y(),u&&k&&h()};return _.schedule=y,_.cancel=j,_.flush=v,o?.addEventListener("abort",j,{once:!0}),_}e.debounce=n})(XT)),XT}var kH;function ROe(){return kH||(kH=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const n=MOe();function i(r,o=0,s={}){typeof s!="object"&&(s={});const{leading:a=!1,trailing:c=!0,maxWait:u}=s,m=Array(2);a&&(m[0]="leading"),c&&(m[1]="trailing");let h,g=null;const x=n.debounce(function(...j){h=r.apply(this,j),g=null},o,{edges:m}),y=function(...j){return u!=null&&(g===null&&(g=Date.now()),Date.now()-g>=u)?(h=r.apply(this,j),g=Date.now(),x.cancel(),x.schedule(),h):(x.apply(this,j),h)},w=()=>(x.flush(),h);return y.cancel=x.cancel,y.flush=w,y}e.debounce=i})(YT)),YT}var $H;function OOe(){return $H||($H=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const n=ROe();function i(r,o=0,s={}){const{leading:a=!0,trailing:c=!0}=s;return n.debounce(r,o,{leading:a,maxWait:o,trailing:c})}e.throttle=i})(KT)),KT}var QT,IH;function DOe(){return IH||(IH=1,QT=OOe().throttle),QT}var LOe=DOe();const BOe=Tu(LOe);var hI=function(n,i){for(var r=arguments.length,o=new Array(r>2?r-2:0),s=2;s<r;s++)o[s-2]=arguments[s];if(typeof console<"u"&&console.warn&&(i===void 0&&console.warn("LogUtils requires an error message argument"),!n))if(i===void 0)console.warn("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var a=0;console.warn(i.replace(/%s/g,()=>o[a++]))}},ise=(e,n,i)=>{var{width:r="100%",height:o="100%",aspect:s,maxHeight:a}=i,c=Gm(r)?e:Number(r),u=Gm(o)?n:Number(o);return s&&s>0&&(c?u=c/s:u&&(c=u*s),a&&u!=null&&u>a&&(u=a)),{calculatedWidth:c,calculatedHeight:u}},FOe={width:0,height:0,overflow:"visible"},WOe={width:0,overflowX:"visible"},UOe={height:0,overflowY:"visible"},HOe={},qOe=e=>{var{width:n,height:i}=e,r=Gm(n),o=Gm(i);return r&&o?FOe:r?WOe:o?UOe:HOe};function GOe(e){var{width:n,height:i,aspect:r}=e,o=n,s=i;return o===void 0&&s===void 0?(o="100%",s="100%"):o===void 0?o=r&&r>0?void 0:"100%":s===void 0&&(s=r&&r>0?void 0:"100%"),{width:o,height:s}}function C3(){return C3=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var i=arguments[n];for(var r in i)({}).hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},C3.apply(null,arguments)}function PH(e,n){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),i.push.apply(i,r)}return i}function AH(e){for(var n=1;n<arguments.length;n++){var i=arguments[n]!=null?arguments[n]:{};n%2?PH(Object(i),!0).forEach(function(r){VOe(e,r,i[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):PH(Object(i)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(i,r))})}return e}function VOe(e,n,i){return(n=KOe(n))in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i,e}function KOe(e){var n=YOe(e,"string");return typeof n=="symbol"?n:n+""}function YOe(e,n){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,n);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}var rse=l.createContext({width:-1,height:-1});function XOe(e){return Np(e.width)&&Np(e.height)}function ose(e){var{children:n,width:i,height:r}=e,o=l.useMemo(()=>({width:i,height:r}),[i,r]);return XOe(o)?l.createElement(rse.Provider,{value:o},n):null}var aR=()=>l.useContext(rse),QOe=l.forwardRef((e,n)=>{var{aspect:i,initialDimension:r={width:-1,height:-1},width:o,height:s,minWidth:a=0,minHeight:c,maxHeight:u,children:m,debounce:h=0,id:g,className:x,onResize:y,style:w={}}=e,j=l.useRef(null),v=l.useRef();v.current=y,l.useImperativeHandle(n,()=>j.current);var[_,$]=l.useState({containerWidth:r.width,containerHeight:r.height}),k=l.useCallback((E,B)=>{$(T=>{var M=Math.round(E),R=Math.round(B);return T.containerWidth===M&&T.containerHeight===R?T:{containerWidth:M,containerHeight:R}})},[]);l.useEffect(()=>{if(j.current==null||typeof ResizeObserver>"u")return aC;var E=R=>{var F,{width:Y,height:H}=R[0].contentRect;k(Y,H),(F=v.current)===null||F===void 0||F.call(v,Y,H)};h>0&&(E=BOe(E,h,{trailing:!0,leading:!1}));var B=new ResizeObserver(E),{width:T,height:M}=j.current.getBoundingClientRect();return k(T,M),B.observe(j.current),()=>{B.disconnect()}},[k,h]);var{containerWidth:P,containerHeight:S}=_;hI(!i||i>0,"The aspect(%s) must be greater than zero.",i);var{calculatedWidth:I,calculatedHeight:A}=ise(P,S,{width:o,height:s,aspect:i,maxHeight:u});return hI(I!=null&&I>0||A!=null&&A>0,`The width(%s) and height(%s) of chart should be greater than 0, 7754 please check the style of container, or the props width(%s) and height(%s), 7755 or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the 7756 height and width.`,I,A,o,s,a,c,i),l.createElement("div",{id:g?"".concat(g):void 0,className:Ri("recharts-responsive-container",x),style:AH(AH({},w),{},{width:o,height:s,minWidth:a,minHeight:c,maxHeight:u}),ref:j},l.createElement("div",{style:qOe({width:o,height:s})},l.createElement(ose,{width:I,height:A},m)))}
7756),Gl=l.forwardRef((e,n)=>{var i=aR();if(Np(i.width)&&Np(i.height))return e.children;var{width:r,height:o}=GOe({width:e.width,height:e.height,aspect:e.aspect}),{calculatedWidth:s,calculatedHeight:a}=ise(void 0,void 0,{width:r,height:o,aspect:e.aspect,maxHeight:e.maxHeight});return fn(s)&&fn(a)?l.createElement(ose,{width:s,height:a},e.children):l.createElement(QOe,C3({},e,{width:r,height:o,ref:n}))});function sse(e){if(e)return{x:e.x,y:e.y,upperWidth:"upperWidth"in e?e.upperWidth:e.width,lowerWidth:"lowerWidth"in e?e.lowerWidth:e.width,width:e.width,height:e.height}}var mC=()=>{var e,n=$s(),i=gn(TOe),r=gn(JP),o=(e=gn(ZP))===null||e===void 0?void 0:e.padding;return!n||!r||!o?i:{width:r.width-o.left-o.right,height:r.height-o.top-o.bottom,x:o.left,y:o.top}},ZOe={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},ase=()=>{var e;return(e=gn(ks))!==null&&e!==void 0?e:ZOe},lR=()=>gn(sh),cR=()=>gn(ah),JOe=()=>gn(e=>e.layout.margin),ji=e=>e.layout.layoutType,Lf=()=>gn(ji),eDe=()=>{var e=Lf();if(e==="horizontal"||e==="vertical")return e},tDe=()=>{var e=Lf();return e!==void 0},eA=e=>{var n=Rr(),i=$s(),{width:r,height:o}=e,s=aR(),a=r,c=o;return s&&(a=s.width>0?s.width:r,c=s.height>0?s.height:o),l.useEffect(()=>{!i&&Np(a)&&Np(c)&&n(oOe({width:a,height:c}))},[n,i,a,c]),null},lse=Symbol.for("immer-nothing"),NH=Symbol.for("immer-draftable"),Gc=Symbol.for("immer-state");function hu(e,...n){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var P_=Object.getPrototypeOf;function Vb(e){return!!e&&!!e[Gc]}function Ay(e){return e?cse(e)||Array.isArray(e)||!!e[NH]||!!e.constructor?.[NH]||hC(e)||nA(e):!1}var nDe=Object.prototype.constructor.toString(),zH=new WeakMap;function cse(e){if(!e||typeof e!="object")return!1;const n=Object.getPrototypeOf(e);if(n===null||n===Object.prototype)return!0;const i=Object.hasOwnProperty.call(n,"constructor")&&n.constructor;if(i===Object)return!0;if(typeof i!="function")return!1;let r=zH.get(i);return r===void 0&&(r=Function.toString.call(i),zH.set(i,r)),r===nDe}function fI(e,n,i=!0){tA(e)===0?(i?Reflect.ownKeys(e):Object.keys(e)).forEach(o=>{n(o,e[o],e)}):e.forEach((r,o)=>n(o,r,e))}function tA(e){const n=e[Gc];return n?n.type_:Array.isArray(e)?1:hC(e)?2:nA(e)?3:0}function S3(e,n){return tA(e)===2?e.has(n):Object.prototype.hasOwnProperty.call(e,n)}function dse(e,n,i){const r=tA(e);r===2?e.set(n,i):r===3?e.add(i):e[n]=i}function iDe(e,n){return e===n?e!==0||1/e===1/n:e!==e&&n!==n}function hC(e){return e instanceof Map}function nA(e){return e instanceof Set}function Yg(e){return e.copy_||e.base_}function k3(e,n){if(hC(e))return new Map(e);if(nA(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const i=cse(e);if(n===!0||n==="class_only"&&!i){const r=Object.getOwnPropertyDescriptors(e);delete r[Gc];let o=Reflect.ownKeys(r);for(let s=0;s<o.length;s++){const a=o[s],c=r[a];c.writable===!1&&(c.writable=!0,c.configurable=!0),(c.get||c.set)&&(r[a]={configurable:!0,writable:!0,enumerable:c.enumerable,value:e[a]})}return Object.create(P_(e),r)}else{const r=P_(e);if(r!==null&&i)return{...e};const o=Object.create(r);return Object.assign(o,e)}}function dR(e,n=!1){return iA(e)||Vb(e)||!Ay(e)||(tA(e)>1&&Object.defineProperties(e,{set:Wk,add:Wk,clear:Wk,delete:Wk}),Object.freeze(e),n&&Object.values(e).forEach(i=>dR(i,!0))),e}function rDe(){hu(2)}var Wk={value:rDe};function iA(e){return e===null||typeof e!="object"?!0:Object.isFrozen(e)}var oDe={};function Ny(e){const n=oDe[e];return n||hu(0,e),n}var A_;function use(){return A_}function sDe(e,n){return{drafts_:[],parent_:e,immer_:n,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function TH(e,n){n&&(Ny("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=n)}function $3(e){I3(e),e.drafts_.forEach(aDe),e.drafts_=null}function I3(e){e===A_&&(A_=e.parent_)}function EH(e){return A_=sDe(A_,e)}function aDe(e){const n=e[Gc];n.type_===0||n.type_===1?n.revoke_():n.revoked_=!0}function MH(e,n){n.unfinalizedDrafts_=n.drafts_.length;const i=n.drafts_[0];return e!==void 0&&e!==i?(i[Gc].modified_&&($3(n),hu(4)),Ay(e)&&(e=gI(n,e),n.parent_||yI(n,e)),n.patches_&&Ny("Patches").generateReplacementPatches_(i[Gc].base_,e,n.patches_,n.inversePatches_)):e=gI(n,i,[]),$3(n),n.patches_&&n.patchListener_(n.patches_,n.inversePatches_),e!==lse?e:void 0}function gI(e,n,i){if(iA(n))return n;const r=e.immer_.shouldUseStrictIteration(),o=n[Gc];if(!o)return fI(n,(s,a)=>RH(e,o,n,s,a,i),r),n;if(o.scope_!==e)return n;if(!o.modified_)return yI(e,o.base_,!0),o.base_;if(!o.finalized_){o.finalized_=!0,o.scope_.unfinalizedDrafts_--;const s=o.copy_;let a=s,c=!1;o.type_===3&&(a=new Set(s),s.clear(),c=!0),fI(a,(u,m)=>RH(e,o,s,u,m,i,c),r),yI(e,s,!1),i&&e.patches_&&Ny("Patches").generatePatches_(o,i,e.patches_,e.inversePatches_)}return o.copy_}function RH(e,n,i,r,o,s,a){if(o==null||typeof o!="object"&&!a)return;const c=iA(o);if(!(c&&!a)){if(Vb(o)){const u=s&&n&&n.type_!==3&&!S3(n.assigned_,r)?s.concat(r):void 0,m=gI(e,o,u);if(dse(i,r,m),Vb(m))e.canAutoFreeze_=!1;else return}else a&&i.add(o);if(Ay(o)&&!c){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||n&&n.base_&&n.base_[r]===o&&c)return;gI(e,o),(!n||!n.scope_.parent_)&&typeof r!="symbol"&&(hC(i)?i.has(r):Object.prototype.propertyIsEnumerable.call(i,r))&&yI(e,o)}}}function yI(e,n,i=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&dR(n,i)}function lDe(e,n){const i=Array.isArray(e),r={type_:i?1:0,scope_:n?n.scope_:use(),modified_:!1,finalized_:!1,assigned_:{},parent_:n,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=r,s=uR;i&&(o=[r],s=N_);const{revoke:a,proxy:c}=Proxy.revocable(o,s);return r.draft_=c,r.revoke_=a,c}var uR={get(e,n){if(n===Gc)return e;const i=Yg(e);if(!S3(i,n))return cDe(e,i,n);const r=i[n];return e.finalized_||!Ay(r)?r:r===ZT(e.base_,n)?(JT(e),e.copy_[n]=A3(r,e)):r},has(e,n){return n in Yg(e)},ownKeys(e){return Reflect.ownKeys(Yg(e))},set(e,n,i){const r=pse(Yg(e),n);if(r?.set)return r.set.call(e.draft_,i),!0;if(!e.modified_){const o=ZT(Yg(e),n),s=o?.[Gc];if(s&&s.base_===i)return e.copy_[n]=i,e.assigned_[n]=!1,!0;if(iDe(i,o)&&(i!==void 0||S3(e.base_,n)))return!0;JT(e),P3(e)}return e.copy_[n]===i&&(i!==void 0||n in e.copy_)||Number.isNaN(i)&&Number.isNaN(e.copy_[n])||
7756(e.copy_[n]=i,e.assigned_[n]=!0),!0},deleteProperty(e,n){return ZT(e.base_,n)!==void 0||n in e.base_?(e.assigned_[n]=!1,JT(e),P3(e)):delete e.assigned_[n],e.copy_&&delete e.copy_[n],!0},getOwnPropertyDescriptor(e,n){const i=Yg(e),r=Reflect.getOwnPropertyDescriptor(i,n);return r&&{writable:!0,configurable:e.type_!==1||n!=="length",enumerable:r.enumerable,value:i[n]}},defineProperty(){hu(11)},getPrototypeOf(e){return P_(e.base_)},setPrototypeOf(){hu(12)}},N_={};fI(uR,(e,n)=>{N_[e]=function(){return arguments[0]=arguments[0][0],n.apply(this,arguments)}});N_.deleteProperty=function(e,n){return N_.set.call(this,e,n,void 0)};N_.set=function(e,n,i){return uR.set.call(this,e[0],n,i,e[0])};function ZT(e,n){const i=e[Gc];return(i?Yg(i):e)[n]}function cDe(e,n,i){const r=pse(n,i);return r?"value"in r?r.value:r.get?.call(e.draft_):void 0}function pse(e,n){if(!(n in e))return;let i=P_(e);for(;i;){const r=Object.getOwnPropertyDescriptor(i,n);if(r)return r;i=P_(i)}}function P3(e){e.modified_||(e.modified_=!0,e.parent_&&P3(e.parent_))}function JT(e){e.copy_||(e.copy_=k3(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var dDe=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(n,i,r)=>{if(typeof n=="function"&&typeof i!="function"){const s=i;i=n;const a=this;return function(u=s,...m){return a.produce(u,h=>i.call(this,h,...m))}}typeof i!="function"&&hu(6),r!==void 0&&typeof r!="function"&&hu(7);let o;if(Ay(n)){const s=EH(this),a=A3(n,void 0);let c=!0;try{o=i(a),c=!1}finally{c?$3(s):I3(s)}return TH(s,r),MH(o,s)}else if(!n||typeof n!="object"){if(o=i(n),o===void 0&&(o=n),o===lse&&(o=void 0),this.autoFreeze_&&dR(o,!0),r){const s=[],a=[];Ny("Patches").generateReplacementPatches_(n,o,s,a),r(s,a)}return o}else hu(1,n)},this.produceWithPatches=(n,i)=>{if(typeof n=="function")return(a,...c)=>this.produceWithPatches(a,u=>n(u,...c));let r,o;return[this.produce(n,i,(a,c)=>{r=a,o=c}),r,o]},typeof e?.autoFreeze=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof e?.useStrictShallowCopy=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),typeof e?.useStrictIteration=="boolean"&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){Ay(e)||hu(8),Vb(e)&&(e=uDe(e));const n=EH(this),i=A3(e,void 0);return i[Gc].isManual_=!0,I3(n),i}finishDraft(e,n){const i=e&&e[Gc];(!i||!i.isManual_)&&hu(9);const{scope_:r}=i;return TH(r,n),MH(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,n){let i;for(i=n.length-1;i>=0;i--){const o=n[i];if(o.path.length===0&&o.op==="replace"){e=o.value;break}}i>-1&&(n=n.slice(i+1));const r=Ny("Patches").applyPatches_;return Vb(e)?r(e,n):this.produce(e,o=>r(o,n))}};function A3(e,n){const i=hC(e)?Ny("MapSet").proxyMap_(e,n):nA(e)?Ny("MapSet").proxySet_(e,n):lDe(e,n);return(n?n.scope_:use()).drafts_.push(i),i}function uDe(e){return Vb(e)||hu(10,e),mse(e)}function mse(e){if(!Ay(e)||iA(e))return e;const n=e[Gc];let i,r=!0;if(n){if(!n.modified_)return n.base_;n.finalized_=!0,i=k3(e,n.scope_.immer_.useStrictShallowCopy_),r=n.scope_.immer_.shouldUseStrictIteration()}else i=k3(e,!0);return fI(i,(o,s)=>{dse(i,o,mse(s))},r),n&&(n.finalized_=!1),i}var pDe=new dDe;pDe.produce;var mDe={settings:{layout:"horizontal",align:"center",verticalAlign:"middle",itemSorter:"value"},size:{width:0,height:0},payload:[]},hse=nc({name:"legend",initialState:mDe,reducers:{setLegendSize(e,n){e.size.width=n.payload.width,e.size.height=n.payload.height},setLegendSettings(e,n){e.settings.align=n.payload.align,e.settings.layout=n.payload.layout,e.settings.verticalAlign=n.payload.verticalAlign,e.settings.itemSorter=n.payload.itemSorter},addLegendPayload:{reducer(e,n){e.payload.push(n.payload)},prepare:oo()},replaceLegendPayload:{reducer(e,n){var{prev:i,next:r}=n.payload,o=Su(e).payload.indexOf(i);o>-1&&(e.payload[o]=r)},prepare:oo()},removeLegendPayload:{reducer(e,n){var i=Su(e).payload.indexOf(n.payload);i>-1&&e.payload.splice(i,1)},prepare:oo()}}}),{setLegendSize:OH,setLegendSettings:hDe,addLegendPayload:fse,replaceLegendPayload:gse,removeLegendPayload:yse}=hse.actions,fDe=hse.reducer,gDe=["contextPayload"];function N3(){return N3=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var i=arguments[n];for(var r in i)({}).hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},N3.apply(null,arguments)}function DH(e,n){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),i.push.apply(i,r)}return i}function Kb(e){for(var n=1;n<arguments.length;n++){var i=arguments[n]!=null?arguments[n]:{};
7756n%2?DH(Object(i),!0).forEach(function(r){yDe(e,r,i[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):DH(Object(i)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(i,r))})}return e}function yDe(e,n,i){return(n=xDe(n))in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i,e}function xDe(e){var n=bDe(e,"string");return typeof n=="symbol"?n:n+""}function bDe(e,n){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,n);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function vDe(e,n){if(e==null)return{};var i,r,o=wDe(e,n);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)i=s[r],n.indexOf(i)===-1&&{}.propertyIsEnumerable.call(e,i)&&(o[i]=e[i])}return o}function wDe(e,n){if(e==null)return{};var i={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(n.indexOf(r)!==-1)continue;i[r]=e[r]}return i}function jDe(e){return e.value}function _De(e){var{contextPayload:n}=e,i=vDe(e,gDe),r=foe(n,e.payloadUniqBy,jDe),o=Kb(Kb({},i),{},{payload:r});return l.isValidElement(e.content)?l.cloneElement(e.content,o):typeof e.content=="function"?l.createElement(e.content,o):l.createElement(mMe,o)}function CDe(e,n,i,r,o,s){var{layout:a,align:c,verticalAlign:u}=n,m,h;return(!e||(e.left===void 0||e.left===null)&&(e.right===void 0||e.right===null))&&(c==="center"&&a==="vertical"?m={left:((r||0)-s.width)/2}:m=c==="right"?{right:i&&i.right||0}:{left:i&&i.left||0}),(!e||(e.top===void 0||e.top===null)&&(e.bottom===void 0||e.bottom===null))&&(u==="middle"?h={top:((o||0)-s.height)/2}:h=u==="bottom"?{bottom:i&&i.bottom||0}:{top:i&&i.top||0}),Kb(Kb({},m),h)}function SDe(e){var n=Rr();return l.useEffect(()=>{n(hDe(e))},[n,e]),null}function kDe(e){var n=Rr();return l.useEffect(()=>(n(OH(e)),()=>{n(OH({width:0,height:0}))}),[n,e]),null}function $De(e,n,i,r){return e==="vertical"&&fn(n)?{height:n}:e==="horizontal"?{width:i||r}:null}var IDe={align:"center",iconSize:14,itemSorter:"value",layout:"horizontal",verticalAlign:"bottom"};function rA(e){var n=jo(e,IDe),i=aRe(),r=r8e(),o=JOe(),{width:s,height:a,wrapperStyle:c,portal:u}=n,[m,h]=voe([i]),g=lR(),x=cR();if(g==null||x==null)return null;var y=g-(o?.left||0)-(o?.right||0),w=$De(n.layout,a,s,y),j=u?c:Kb(Kb({position:"absolute",width:w?.width||s||"auto",height:w?.height||a||"auto"},CDe(c,n,o,g,x,m)),c),v=u??r;if(v==null||i==null)return null;var _=l.createElement("div",{className:"recharts-legend-wrapper",style:j,ref:h},l.createElement(SDe,{layout:n.layout,align:n.align,verticalAlign:n.verticalAlign,itemSorter:n.itemSorter}),!u&&l.createElement(kDe,{width:m.width,height:m.height}),l.createElement(_De,N3({},n,w,{margin:o,chartWidth:g,chartHeight:x,contextPayload:i})));return jr.createPortal(_,v)}rA.displayName="Legend";function z3(){return z3=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var i=arguments[n];for(var r in i)({}).hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},z3.apply(null,arguments)}function LH(e,n){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),i.push.apply(i,r)}return i}function e6(e){for(var n=1;n<arguments.length;n++){var i=arguments[n]!=null?arguments[n]:{};n%2?LH(Object(i),!0).forEach(function(r){PDe(e,r,i[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):LH(Object(i)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(i,r))})}return e}function PDe(e,n,i){return(n=ADe(n))in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i,e}function ADe(e){var n=NDe(e,"string");return typeof n=="symbol"?n:n+""}function NDe(e,n){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,n);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function zDe(e){return Array.isArray(e)&&Md(e[0])&&Md(e[1])?e.join(" ~ "):e}var TDe=e=>{var{separator:n=" : ",contentStyle:i={},itemStyle:r={},labelStyle:o={},payload:s,formatter:a,itemSorter:c,wrapperClassName:u,labelClassName:m,label:h,labelFormatter:g,accessibilityLayer:x=!1}=e,y=()=>
7756{if(s&&s.length){var S={padding:0,margin:0},I=(c?FP(s,c):s).map((A,E)=>{if(A.type==="none")return null;var B=A.formatter||a||zDe,{value:T,name:M}=A,R=T,F=M;if(B){var Y=B(T,M,A,E,s);if(Array.isArray(Y))[R,F]=Y;else if(Y!=null)R=Y;else return null}var H=e6({display:"block",paddingTop:4,paddingBottom:4,color:A.color||"#000"},r);return l.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(E),style:H},Md(F)?l.createElement("span",{className:"recharts-tooltip-item-name"},F):null,Md(F)?l.createElement("span",{className:"recharts-tooltip-item-separator"},n):null,l.createElement("span",{className:"recharts-tooltip-item-value"},R),l.createElement("span",{className:"recharts-tooltip-item-unit"},A.unit||""))});return l.createElement("ul",{className:"recharts-tooltip-item-list",style:S},I)}return null},w=e6({margin:0,padding:10,backgroundColor:"#fff",border:"1px solid #ccc",whiteSpace:"nowrap"},i),j=e6({margin:0},o),v=!eo(h),_=v?h:"",$=Ri("recharts-default-tooltip",u),k=Ri("recharts-tooltip-label",m);v&&g&&s!==void 0&&s!==null&&(_=g(h,s));var P=x?{role:"status","aria-live":"assertive"}:{};return l.createElement("div",z3({className:$,style:w},P),l.createElement("p",{className:k,style:j},l.isValidElement(_)?_:"".concat(_)),y())},vw="recharts-tooltip-wrapper",EDe={visibility:"hidden"};function MDe(e){var{coordinate:n,translateX:i,translateY:r}=e;return Ri(vw,{["".concat(vw,"-right")]:fn(i)&&n&&fn(n.x)&&i>=n.x,["".concat(vw,"-left")]:fn(i)&&n&&fn(n.x)&&i<n.x,["".concat(vw,"-bottom")]:fn(r)&&n&&fn(n.y)&&r>=n.y,["".concat(vw,"-top")]:fn(r)&&n&&fn(n.y)&&r<n.y})}function BH(e){var{allowEscapeViewBox:n,coordinate:i,key:r,offsetTopLeft:o,position:s,reverseDirection:a,tooltipDimension:c,viewBox:u,viewBoxDimension:m}=e;if(s&&fn(s[r]))return s[r];var h=i[r]-c-(o>0?o:0),g=i[r]+o;if(n[r])return a[r]?h:g;var x=u[r];if(x==null)return 0;if(a[r]){var y=h,w=x;return y<w?Math.max(g,x):Math.max(h,x)}if(m==null)return 0;var j=g+c,v=x+m;return j>v?Math.max(h,x):Math.max(g,x)}function RDe(e){var{translateX:n,translateY:i,useTranslate3d:r}=e;return{transform:r?"translate3d(".concat(n,"px, ").concat(i,"px, 0)"):"translate(".concat(n,"px, ").concat(i,"px)")}}function ODe(e){var{allowEscapeViewBox:n,coordinate:i,offsetTopLeft:r,position:o,reverseDirection:s,tooltipBox:a,useTranslate3d:c,viewBox:u}=e,m,h,g;return a.height>0&&a.width>0&&i?(h=BH({allowEscapeViewBox:n,coordinate:i,key:"x",offsetTopLeft:r,position:o,reverseDirection:s,tooltipDimension:a.width,viewBox:u,viewBoxDimension:u.width}),g=BH({allowEscapeViewBox:n,coordinate:i,key:"y",offsetTopLeft:r,position:o,reverseDirection:s,tooltipDimension:a.height,viewBox:u,viewBoxDimension:u.height}),m=RDe({translateX:h,translateY:g,useTranslate3d:c})):m=EDe,{cssProperties:m,cssClasses:MDe({translateX:h,translateY:g,coordinate:i})}}function FH(e,n){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),i.push.apply(i,r)}return i}function Uk(e){for(var n=1;n<arguments.length;n++){var i=arguments[n]!=null?arguments[n]:{};n%2?FH(Object(i),!0).forEach(function(r){T3(e,r,i[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):FH(Object(i)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(i,r))})}return e}function T3(e,n,i){return(n=DDe(n))in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i,e}function DDe(e){var n=LDe(e,"string");return typeof n=="symbol"?n:n+""}function LDe(e,n){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,n);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}class BDe extends l.PureComponent{constructor(){super(...arguments),T3(this,"state",{dismissed:!1,dismissedAtCoordinate:{x:0,y:0}}),T3(this,"handleKeyDown",n=>{if(n.key==="Escape"){var i,r,o,s;this.setState({dismissed:!0,dismissedAtCoordinate:{x:(i=(r=this.props.coordinate)===null||r===void 0?void 0:r.x)!==null&&i!==void 0?i:0,y:(o=(s=this.props.coordinate)===null||s===void 0?void 0:s.y)!==null&&o!==void 0?o:0}})}})}componentDidMount(){document.addEventListener("keydown",this.handleKeyDown)}componentWillUnmount(){document.removeEventListener("keydown",this.handleKeyDown)}componentDidUpdate(){var n,i;this.state.dismissed&&(((n=this.props.coordinate)===null||n===void 0?void 0:n.x)!==this.state.dismissedAtCoordinate.x||((i=this.props.coordinate)===null||i===void 0?void 0:i.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}render(){var{active:n,allowEscapeViewBox:i,animationDuration:r,animationEasing:o,children:s,coordinate:a,hasPayload:c,isAnimationActive:u,offset:m,position:h,reverseDirection:g,useTranslate3d:x,viewB
7756ox:y,wrapperStyle:w,lastBoundingBox:j,innerRef:v,hasPortalFromProps:_}=this.props,{cssClasses:$,cssProperties:k}=ODe({allowEscapeViewBox:i,coordinate:a,offsetTopLeft:m,position:h,reverseDirection:g,tooltipBox:{height:j.height,width:j.width},useTranslate3d:x,viewBox:y}),P=_?{}:Uk(Uk({transition:u&&n?"transform ".concat(r,"ms ").concat(o):void 0},k),{},{pointerEvents:"none",visibility:!this.state.dismissed&&n&&c?"visible":"hidden",position:"absolute",top:0,left:0}),S=Uk(Uk({},P),{},{visibility:!this.state.dismissed&&n&&c?"visible":"hidden"},w);return l.createElement("div",{xmlns:"http://www.w3.org/1999/xhtml",tabIndex:-1,className:$,style:S,ref:v},s)}}var xse=()=>{var e;return(e=gn(n=>n.rootProps.accessibilityLayer))!==null&&e!==void 0?e:!0};function E3(){return E3=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var i=arguments[n];for(var r in i)({}).hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},E3.apply(null,arguments)}function WH(e,n){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),i.push.apply(i,r)}return i}function UH(e){for(var n=1;n<arguments.length;n++){var i=arguments[n]!=null?arguments[n]:{};n%2?WH(Object(i),!0).forEach(function(r){FDe(e,r,i[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):WH(Object(i)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(i,r))})}return e}function FDe(e,n,i){return(n=WDe(n))in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i,e}function WDe(e){var n=UDe(e,"string");return typeof n=="symbol"?n:n+""}function UDe(e,n){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,n);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}var HH={curveBasisClosed:_8e,curveBasisOpen:C8e,curveBasis:j8e,curveBumpX:l8e,curveBumpY:c8e,curveLinearClosed:S8e,curveLinear:LP,curveMonotoneX:k8e,curveMonotoneY:$8e,curveNatural:I8e,curveStep:P8e,curveStepAfter:N8e,curveStepBefore:A8e},xI=e=>Vi(e.x)&&Vi(e.y),qH=e=>e.base!=null&&xI(e.base)&&xI(e),ww=e=>e.x,jw=e=>e.y,HDe=(e,n)=>{if(typeof e=="function")return e;var i="curve".concat(sC(e));return(i==="curveMonotone"||i==="curveBump")&&n?HH["".concat(i).concat(n==="vertical"?"Y":"X")]:HH[i]||LP},qDe=e=>{var{type:n="linear",points:i=[],baseLine:r,layout:o,connectNulls:s=!1}=e,a=HDe(n,o),c=s?i.filter(xI):i,u;if(Array.isArray(r)){var m=i.map((y,w)=>UH(UH({},y),{},{base:r[w]}));o==="vertical"?u=Mk().y(jw).x1(ww).x0(y=>y.base.x):u=Mk().x(ww).y1(jw).y0(y=>y.base.y);var h=u.defined(qH).curve(a),g=s?m.filter(qH):m;return h(g)}o==="vertical"&&fn(r)?u=Mk().y(jw).x1(ww).x0(r):fn(r)?u=Mk().x(ww).y1(jw).y0(r):u=Hre().x(ww).y(jw);var x=u.defined(xI).curve(a);return x(c)},Sb=e=>{var{className:n,points:i,path:r,pathRef:o}=e,s=Lf();if((!i||!i.length)&&!r)return null;var a={type:e.type,points:e.points,baseLine:e.baseLine,layout:e.layout||s,connectNulls:e.connectNulls},c=i&&i.length?qDe(a):r;return l.createElement("path",E3({},yl(e),YM(e),{className:Ri("recharts-curve",n),d:c===null?void 0:c,ref:o}))},GDe=["x","y","top","left","width","height","className"];function M3(){return M3=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var i=arguments[n];for(var r in i)({}).hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},M3.apply(null,arguments)}function GH(e,n){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),i.push.apply(i,r)}return i}function VDe(e){for(var n=1;n<arguments.length;n++){var i=arguments[n]!=null?arguments[n]:{};n%2?GH(Object(i),!0).forEach(function(r){KDe(e,r,i[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):GH(Object(i)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(i,r))})}return e}function KDe(e,n,i){return(n=YDe(n))in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i,e}function YDe(e){var n=XDe(e,"string");return typeof n=="symbol"?n:n+""}function XDe(e,n){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,n);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function QDe(e,n){if(e==null)return{};var i,r,o=ZDe(e,n);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)i=s[r],n.indexOf(i)===-1&&{}.propertyIsEnumerable.call(e,i)&&(o[i]=e[i])}return o}function ZDe(e,n){if(e==null)return{};var i={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(n.indexOf(r)!==-1)continue;i[r]=e[r]}return i}var JDe=(e,n,i,r,o,s)=>"M".concat(e,",").concat(o,"v").concat(r,"M").concat(s,",").concat(n,"h").concat(i),eLe=e=>{var{x:n=0,y:i=0,top:r=0,left:o=0,width:s=0,height:a=0,className:c}=e,u=QDe(e,GDe),m=VDe({x:n,y:i,top:r,left:o,width:s,height:a},u);return!fn(n)||!fn(i)||!fn(s)||!fn(a)||!fn(r)||!fn(o)?null:l.createElement("path",M3({},ba(m),{className:Ri("recharts-cross",c),d:JDe(n,i,s,a,r,o)}))};function tLe(e,n,i,r){var o=r/2;return{stroke:"none",fill:"#ccc",x:e==="horizontal"?n.x-o:i.left+.5,y:e==="horizontal"?i.top+.5:n.y-o,width:e==="horizontal"?r:i.width-1,height:e==="horizontal"?i.height-1:r}}
7756function VH(e,n){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),i.push.apply(i,r)}return i}function KH(e){for(var n=1;n<arguments.length;n++){var i=arguments[n]!=null?arguments[n]:{};n%2?VH(Object(i),!0).forEach(function(r){nLe(e,r,i[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):VH(Object(i)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(i,r))})}return e}function nLe(e,n,i){return(n=iLe(n))in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i,e}function iLe(e){var n=rLe(e,"string");return typeof n=="symbol"?n:n+""}function rLe(e,n){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,n);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}var oLe=e=>e.replace(/([A-Z])/g,n=>"-".concat(n.toLowerCase())),bse=(e,n,i)=>e.map(r=>"".concat(oLe(r)," ").concat(n,"ms ").concat(i)).join(","),sLe=(e,n)=>[Object.keys(e),Object.keys(n)].reduce((i,r)=>i.filter(o=>r.includes(o))),z_=(e,n)=>Object.keys(n).reduce((i,r)=>KH(KH({},i),{},{[r]:e(r,n[r])}),{});function YH(e,n){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),i.push.apply(i,r)}return i}function vs(e){for(var n=1;n<arguments.length;n++){var i=arguments[n]!=null?arguments[n]:{};n%2?YH(Object(i),!0).forEach(function(r){aLe(e,r,i[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):YH(Object(i)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(i,r))})}return e}function aLe(e,n,i){return(n=lLe(n))in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i,e}function lLe(e){var n=cLe(e,"string");return typeof n=="symbol"?n:n+""}function cLe(e,n){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,n);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}var bI=(e,n,i)=>e+(n-e)*i,R3=e=>{var{from:n,to:i}=e;return n!==i},vse=(e,n,i)=>{var r=z_((o,s)=>{if(R3(s)){var[a,c]=e(s.from,s.to,s.velocity);return vs(vs({},s),{},{from:a,velocity:c})}return s},n);return i<1?z_((o,s)=>R3(s)&&r[o]!=null?vs(vs({},s),{},{velocity:bI(s.velocity,r[o].velocity,i),from:bI(s.from,r[o].from,i)}):s,n):vse(e,r,i-1)};function dLe(e,n,i,r,o,s){var a,c=r.reduce((x,y)=>vs(vs({},x),{},{[y]:{from:e[y],velocity:0,to:n[y]}}),{}),u=()=>z_((x,y)=>y.from,c),m=()=>!Object.values(c).filter(R3).length,h=null,g=x=>{a||(a=x);var y=x-a,w=y/i.dt;c=vse(i,c,w),o(vs(vs(vs({},e),n),u())),a=x,m()||(h=s.setTimeout(g))};return()=>(h=s.setTimeout(g),()=>{var x;(x=h)===null||x===void 0||x()})}function uLe(e,n,i,r,o,s,a){var c=null,u=o.reduce((g,x)=>{var y=e[x],w=n[x];return y==null||w==null?g:vs(vs({},g),{},{[x]:[y,w]})},{}),m,h=g=>{m||(m=g);var x=(g-m)/r,y=z_((j,v)=>bI(...v,i(x)),u);if(s(vs(vs(vs({},e),n),y)),x<1)c=a.setTimeout(h);else{var w=z_((j,v)=>bI(...v,i(1)),u);s(vs(vs(vs({},e),n),w))}};return()=>(c=a.setTimeout(h),()=>{var g;(g=c)===null||g===void 0||g()})}const pLe=(e,n,i,r,o,s)=>{var a=sLe(e,n);return i==null?()=>(o(vs(vs({},e),n)),()=>{}):i.isStepper===!0?dLe(e,n,i,a,o,s):uLe(e,n,i,r,a,o,s)};var vI=1e-4,wse=(e,n)=>[0,3*e,3*n-6*e,3*e-3*n+1],jse=(e,n)=>e.map((i,r)=>i*n**r).reduce((i,r)=>i+r),XH=(e,n)=>i=>{var r=wse(e,n);return jse(r,i)},mLe=(e,n)=>i=>{var r=wse(e,n),o=[...r.map((s,a)=>s*a).slice(1),0];return jse(o,i)},hLe=e=>{var n,i=e.split("(");if(i.length!==2||i[0]!=="cubic-bezier")return null;var r=(n=i[1])===null||n===void 0||(n=n.split(")")[0])===null||n===void 0?void 0:n.split(",");if(r==null||r.length!==4)return null;var o=r.map(s=>parseFloat(s));return[o[0],o[1],o[2],o[3]]},fLe=function(){for(var n=arguments.length,i=new Array(n),r=0;r<n;r++)i[r]=arguments[r];if(i.length===1)switch(i[0]){case"linear":return[0,0,1,1];case"ease":return[.25,.1,.25,1];case"ease-in":return[.42,0,1,1];case"ease-out":return[.42,0,.58,1];case"ease-in-out":return[0,0,.58,1];default:{var o=hLe(i[0]);if(o)return o}}return i.length===4?i:[0,0,1,1]},gLe=(e,n,i,r)=>
7756{var o=XH(e,i),s=XH(n,r),a=mLe(e,i),c=m=>m>1?1:m<0?0:m,u=m=>{for(var h=m>1?1:m,g=h,x=0;x<8;++x){var y=o(g)-h,w=a(g);if(Math.abs(y-h)<vI||w<vI)return s(g);g=c(g-y/w)}return s(g)};return u.isStepper=!1,u},QH=function(){return gLe(...fLe(...arguments))},yLe=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{stiff:i=100,damping:r=8,dt:o=17}=n,s=(a,c,u)=>{var m=-(a-c)*i,h=u*r,g=u+(m-h)*o/1e3,x=u*o/1e3+a;return Math.abs(x-c)<vI&&Math.abs(g)<vI?[c,0]:[x,g]};return s.isStepper=!0,s.dt=o,s},xLe=e=>{if(typeof e=="string")switch(e){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return QH(e);case"spring":return yLe();default:if(e.split("(")[0]==="cubic-bezier")return QH(e)}return typeof e=="function"?e:null};function bLe(e){var n,i=()=>null,r=!1,o=null,s=a=>{if(!r){if(Array.isArray(a)){if(!a.length)return;var c=a,[u,...m]=c;if(typeof u=="number"){o=e.setTimeout(s.bind(null,m),u);return}s(u),o=e.setTimeout(s.bind(null,m));return}typeof a=="string"&&(n=a,i(n)),typeof a=="object"&&(n=a,i(n)),typeof a=="function"&&a()}};return{stop:()=>{r=!0},start:a=>{r=!1,o&&(o(),o=null),s(a)},subscribe:a=>(i=a,()=>{i=()=>null}),getTimeoutController:()=>e}}class vLe{setTimeout(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=performance.now(),o=null,s=a=>{a-r>=i?n(a):typeof requestAnimationFrame=="function"&&(o=requestAnimationFrame(s))};return o=requestAnimationFrame(s),()=>{o!=null&&cancelAnimationFrame(o)}}}function wLe(){return bLe(new vLe)}var jLe=l.createContext(wLe);function _Le(e,n){var i=l.useContext(jLe);return l.useMemo(()=>n??i(e),[e,n,i])}var CLe=()=>!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout),fC={isSsr:CLe()},SLe={begin:0,duration:1e3,easing:"ease",isActive:!0,canBegin:!0,onAnimationEnd:()=>{},onAnimationStart:()=>{}},ZH={t:0},t6={t:1};function m1(e){var n=jo(e,SLe),{isActive:i,canBegin:r,duration:o,easing:s,begin:a,onAnimationEnd:c,onAnimationStart:u,children:m}=n,h=i==="auto"?!fC.isSsr:i,g=_Le(n.animationId,n.animationManager),[x,y]=l.useState(h?ZH:t6),w=l.useRef(null);return l.useEffect(()=>{h||y(t6)},[h]),l.useEffect(()=>{if(!h||!r)return aC;var j=pLe(ZH,t6,xLe(s),o,y,g.getTimeoutController()),v=()=>{w.current=j()};return g.start([u,a,v,o,c]),()=>{g.stop(),w.current&&w.current(),c()}},[h,r,o,s,a,u,c,g]),m(x.t)}function h1(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"animation-",i=l.useRef(S_(n)),r=l.useRef(e);return r.current!==e&&(i.current=S_(n),r.current=e),i.current}var kLe=["radius"],$Le=["radius"],JH,eq,tq,nq,iq,rq,oq,sq,aq,lq;function cq(e,n){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),i.push.apply(i,r)}return i}function dq(e){for(var n=1;n<arguments.length;n++){var i=arguments[n]!=null?arguments[n]:{};n%2?cq(Object(i),!0).forEach(function(r){ILe(e,r,i[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):cq(Object(i)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(i,r))})}return e}function ILe(e,n,i){return(n=PLe(n))in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i,e}function PLe(e){var n=ALe(e,"string");return typeof n=="symbol"?n:n+""}function ALe(e,n){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,n);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function wI(){return wI=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var i=arguments[n];for(var r in i)({}).hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},wI.apply(null,arguments)}function uq(e,n){if(e==null)return{};var i,r,o=NLe(e,n);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)i=s[r],n.indexOf(i)===-1&&{}.propertyIsEnumerable.call(e,i)&&(o[i]=e[i])}return o}function NLe(e,n){if(e==null)return{};var i={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(n.indexOf(r)!==-1)continue;i[r]=e[r]}return i}function dp(e,n){return n||(n=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}var pq=(e,n,i,r,o)=>{var s=gf(i),a=gf(r),c=Math.min(Math.abs(s)/2,Math.abs(a)/2),u=a>=0?1:-1,m=s>=0?1:-1,h=a>=0&&s>=0||a<0&&s<0?1:0,g;if(c>0&&o instanceof Array){for(var x=[0,0,0,0],y=0,w=4;y<w;y++)x[y]=o[y]>c?c:o[y];g=Po(JH||(JH=dp(["M",",",""])),e,n+u*x[0]),x[0]>0&&(g+=Po(eq||(eq=dp(["A ",",",",0,0,",",",",",""])),x[0],x[0],h,e+m*x[0],n)),g+=Po(tq||(tq=dp(["L ",",",""])),e+i-m*x[1],n),x[1]>0&&(g+=Po(nq||(nq=dp(["A ",",",",0,0,",`, 7757 `,",",""])),x[1],x[1],h,e+i,n+u*x[1])),g+=Po(iq||(iq=dp(["L ",",",""])),e+i,n+r-u*x[2]),x[2]>0&&(g+=Po(rq||(rq=dp(["A ",",",",0,0,",`,
7758 `,",",""])),x[2],x[2],h,e+i-m*x[2],n+r)),g+=Po(oq||(oq=dp(["L ",",",""])),e+m*x[3],n+r),x[3]>0&&(g+=Po(sq||(sq=dp(["A ",",",",0,0,",`, 7759 `,",",""])),x[3],x[3],h,e,n+r-u*x[3])),g+="Z"}else if(c>0&&o===+o&&o>0){var j=Math.min(c,o);g=Po(aq||(aq=dp(["M ",",",` 7760 A `,",",",0,0,",",",",",` 7761 L `,",",` 7762 A `,",",",0,0,",",",",",` 7763 L `,",",` 7764 A `,",",",0,0,",",",",",` 7765 L `,",",` 7766 A `,",",",0,0,",",",","," Z"])),e,n+u*j,j,j,h,e+m*j,n,e+i-m*j,n,j,j,h,e+i,n+u*j,e+i,n+r-u*j,j,j,h,e+i-m*j,n+r,e+m*j,n+r,j,j,h,e,n+r-u*j)}else g=Po(lq||(lq=dp(["M ",","," h "," v "," h "," Z"])),e,n,i,r,-i);return g},mq={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},_se=e=>{var n=jo(e,mq),i=l.useRef(null),[r,o]=l.useState(-1);l.useEffect(()=>{if(i.current&&i.current.getTotalLength)try{var X=i.current.getTotalLength();X&&o(X)}catch{}},[]);var{x:s,y:a,width:c,height:u,radius:m,className:h}=n,{animationEasing:g,animationDuration:x,animationBegin:y,isAnimationActive:w,isUpdateAnimationActive:j}=n,v=l.useRef(c),_=l.useRef(u),$=l.useRef(s),k=l.useRef(a),P=l.useMemo(()=>({x:s,y:a,width:c,height:u,radius:m}),[s,a,c,u,m]),S=h1(P,"rectangle-");if(s!==+s||a!==+a||c!==+c||u!==+u||c===0||u===0)return null;var I=Ri("recharts-rectangle",h);if(!j){var A=ba(n),{radius:E}=A,B=uq(A,kLe);return l.createElement("path",wI({},B,{x:gf(s),y:gf(a),width:gf(c),height:gf(u),radius:typeof m=="number"?m:void 0,className:I,d:pq(s,a,c,u,m)}))}var T=v.current,M=_.current,R=$.current,F=k.current,Y="0px ".concat(r===-1?1:r,"px"),H="".concat(r,"px 0px"),U=bse(["strokeDasharray"],x,typeof g=="string"?g:mq.animationEasing);return l.createElement(m1,{animationId:S,key:S,canBegin:r>0,duration:x,easing:g,isActive:j,begin:y},X=>{var Q=ir(T,c,X),K=ir(M,u,X),G=ir(R,s,X),L=ir(F,a,X);i.current&&(v.current=Q,_.current=K,$.current=G,k.current=L);var q;w?X>0?q={transition:U,strokeDasharray:H}:q={strokeDasharray:Y}:q={strokeDasharray:H};var W=ba(n),{radius:oe}=W,se=uq(W,$Le);return l.createElement("path",wI({},se,{radius:typeof m=="number"?m:void 0,className:I,d:pq(G,L,Q,K,m),ref:i,style:dq(dq({},q),n.style)}))})};function hq(e,n){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),i.push.apply(i,r)}return i}function fq(e){for(var n=1;n<arguments.length;n++){var i=arguments[n]!=null?arguments[n]:{};n%2?hq(Object(i),!0).forEach(function(r){zLe(e,r,i[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):hq(Object(i)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(i,r))})}return e}function zLe(e,n,i){return(n=TLe(n))in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i,e}function TLe(e){var n=ELe(e,"string");return typeof n=="symbol"?n:n+""}function ELe(e,n){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,n);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}var jI=Math.PI/180,MLe=e=>e*180/Math.PI,ss=(e,n,i,r)=>({x:e+Math.cos(-jI*r)*i,y:n+Math.sin(-jI*r)*i}),Cse=function(n,i){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(n-(r.left||0)-(r.right||0)),Math.abs(i-(r.top||0)-(r.bottom||0)))/2},RLe=(e,n)=>{var{x:i,y:r}=e,{x:o,y:s}=n;return Math.sqrt((i-o)**2+(r-s)**2)},OLe=(e,n)=>{var{x:i,y:r}=e,{cx:o,cy:s}=n,a=RLe({x:i,y:r},{x:o,y:s});if(a<=0)return{radius:a,angle:0};var c=(i-o)/a,u=Math.acos(c);return r>s&&(u=2*Math.PI-u),{radius:a,angle:MLe(u),angleInRadian:u}},DLe=e=>{var{startAngle:n,endAngle:i}=e,r=Math.floor(n/360),o=Math.floor(i/360),s=Math.min(r,o);return{startAngle:n-s*360,endAngle:i-s*360}},LLe=(e,n)=>{var{startAngle:i,endAngle:r}=n,o=Math.floor(i/360),s=Math.floor(r/360),a=Math.min(o,s);return e+a*360},BLe=(e,n)=>{var{chartX:i,chartY:r}=e,{radius:o,angle:s}=OLe({x:i,y:r},n),{innerRadius:a,outerRadius:c}=n;if(o<a||o>c||o===0)return null;var{startAngle:u,endAngle:m}=DLe(n),h=s,g;if(u<=m){for(;h>m;)h-=360;for(;h<u;)h+=360;g=h>=u&&h<=m}else{for(;h>u;)h-=360;for(;h<m;)h+=360;g=h>=m&&h<=u}return g?fq(fq({},n),{},{radius:o,angle:LLe(h,n)}):null};function Sse(e){var{cx:n,cy:i,radius:r,startAngle:o,endAngle:s}=e,a=ss(n,i,r,o),c=ss(n,i,r,s);return{points:[a,c],cx:n,cy:i,radius:r,startAngle:o,endAngle:s}}var gq,yq,xq,bq,vq,wq,jq;function O3(){return O3=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var i=arguments[n];for(var r in i)({}).hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},O3.apply(null,arguments)}function ty(e,n){return n||(n=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}var FLe=(e,n)=>{var i=Vs(n-e),r=Math.min(Math.abs(n-e),359.999);return i*r},Hk=e=>{var{cx:n,cy:i,radius:r,angle:o,sign:s,isExternal:a,cornerRadius:c,cornerIsExternal:u}=e,m=c*(a?1:-1)+r,h=Math.asin(c/m)/jI,g=u?o:o+s*h,x=ss(n,i,m,g),y=ss(n,i,r,g),w=u?o-s*h:o,j=ss(n,i,m*Math.cos(h*jI),w);return{center:x,circleTangency:y,lineTangency:j,theta:h}},kse=e=>{var{cx:n,cy:i,innerRadius:r,outerRadius:o,startAngle:s,endAngle:a}=e,c=FLe(s,a),u=s+c,m=ss(n,i,o,s),h=ss(n,i,o,u),g=Po(gq||(gq=ty(["M ",",",` 7767 A `,",",`,0, 7768 `,",",`, 7769 `,",",` 7770 `])),m.x,m.y,o,o,+(Math.abs(c)>180),+(s>u),h.x,h.y);if(r>0){var x=ss(n,i,r,s),y=ss(n,i,r,u);g+=Po(yq||(yq=ty(["L ",",",` 7771 A `,",",`,0, 7772 `,",",`, 7773 `,","," Z"])),y.x,y.y,r,r,+(Math.abs(c)>180),+(s<=u),x.x,x.y)}else g+=Po(xq||(xq=ty(["L ",","," Z"])),n,i);return g},WLe=e=>{var{cx:n,cy:i,innerRadius:r,outerRadius:o,cornerRadius:s,forceCornerRadius:a,cornerIsExternal:c,startAngle:u,endAngle:m}=e,h=Vs(m-u),{circleTangency:g,lineTangency:x,theta:y}=Hk({cx:n,cy:i,radius:o,angle:u,sign:h,cornerRadius:s,cornerIsExternal:c}),{circleTangency:w,lineTangency:j,theta:v}=Hk({cx:n,cy:i,radius:o,angle:m,sign:-h,cornerRadius:s,cornerIsExternal:c}),_=c?Math.abs(u-m):Math.abs(u-m)-y-v;if(_<0)return a?Po(bq||(bq=ty(["M ",",",` 7774 a`,",",",0,0,1,",`,0 7775 a`,",",",0,0,1,",`,0 7776 `])),x.x,x.y,s,s,s*2,s,s,-s*2):kse({cx:n,cy:i,innerRadius:r,outerRadius:o,startAngle:u,endAngle:m});var $=Po(vq||(vq=ty(["M ",",",` 7777 A`,",",",0,0,",",",",",` 7778 A`,",",",0,",",",",",",",` 7779 A`,",",",0,0,",",",",",` 7780 `])),x.x,x.y,s,s,+(h<0),g.x,g.y,o,o,+(_>180),+(h<0),w.x,w.y,s,s,+(h<0),j.x,j.y);if(r>0){var{circleTangency:k,lineTangency:P,theta:S}=Hk({cx:n,cy:i,radius:r,angle:u,sign:h,isExternal:!0,cornerRadius:s,cornerIsExternal:c}),{circleTangency:I,lineTangency:A,theta:E}=Hk({cx:n,cy:i,radius:r,angle:m,sign:-h,isExternal:!0,cornerRadius:s,cornerIsExternal:c}),B=c?Math.abs(u-m):Math.abs(u-m)-S-E;if(B<0&&s===0)return"".concat($,"L").concat(n,",").concat(i,"Z");$+=Po(wq||(wq=ty(["L",",",` 7781 A`,",",",0,0,",",",",",` 7782 A`,",",",0,",",",",",",",` 7783 A`,",",",0,0,",",",",","Z"])),A.x,A.y,s,s,+(h<0),I.x,I.y,r,r,+(B>180),+(h>0),k.x,k.y,s,s,+(h<0),P.x,P.y)}else $+=Po(jq||(jq=ty(["L",",","Z"])),n,i);return $},ULe={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},$se=e=>{var n=jo(e,ULe),{cx:i,cy:r,innerRadius:o,outerRadius:s,cornerRadius:a,forceCornerRadius:c,cornerIsExternal:u,startAngle:m,endAngle:h,className:g}=n;if(s<o||m===h)return null;var x=Ri("recharts-sector",g),y=s-o,w=Wa(a,y,0,!0),j;return w>0&&Math.abs(m-h)<360?j=WLe({cx:i,cy:r,innerRadius:o,outerRadius:s,cornerRadius:Math.min(w,y/2),forceCornerRadius:c,cornerIsExternal:u,startAngle:m,endAngle:h}):j=kse({cx:i,cy:r,innerRadius:o,outerRadius:s,startAngle:m,endAngle:h}),l.createElement("path",O3({},ba(n),{className:x,d:j}))};function HLe(e,n,i){if(e==="horizontal")return[{x:n.x,y:i.top},{x:n.x,y:i.top+i.height}];if(e==="vertical")return[{x:i.left,y:n.y},{x:i.left+i.width,y:n.y}];if(ooe(n)){if(e==="centric"){var{cx:r,cy:o,innerRadius:s,outerRadius:a,angle:c}=n,u=ss(r,o,s,c),m=ss(r,o,a,c);return[{x:u.x,y:u.y}
7783,{x:m.x,y:m.y}]}return Sse(n)}}var n6={},i6={},r6={},_q;function qLe(){return _q||(_q=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const n=yoe();function i(r){return n.isSymbol(r)?NaN:Number(r)}e.toNumber=i})(r6)),r6}var Cq;function GLe(){return Cq||(Cq=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const n=qLe();function i(r){return r?(r=n.toNumber(r),r===1/0||r===-1/0?(r<0?-1:1)*Number.MAX_VALUE:r===r?r:0):r===0?r:0}e.toFinite=i})(i6)),i6}var Sq;function VLe(){return Sq||(Sq=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const n=xoe(),i=GLe();function r(o,s,a){a&&typeof a!="number"&&n.isIterateeCall(o,s,a)&&(s=a=void 0),o=i.toFinite(o),s===void 0?(s=o,o=0):s=i.toFinite(s),a=a===void 0?o<s?1:-1:i.toFinite(a);const c=Math.max(Math.ceil((s-o)/(a||1)),0),u=new Array(c);for(let m=0;m<c;m++)u[m]=o,o+=a;return u}e.range=r})(n6)),n6}var o6,kq;function KLe(){return kq||(kq=1,o6=VLe().range),o6}var YLe=KLe();const Ise=Tu(YLe);function wf(e,n){return e==null||n==null?NaN:e<n?-1:e>n?1:e>=n?0:NaN}function XLe(e,n){return e==null||n==null?NaN:n<e?-1:n>e?1:n>=e?0:NaN}function pR(e){let n,i,r;e.length!==2?(n=wf,i=(c,u)=>wf(e(c),u),r=(c,u)=>e(c)-u):(n=e===wf||e===XLe?e:QLe,i=e,r=e);function o(c,u,m=0,h=c.length){if(m<h){if(n(u,u)!==0)return h;do{const g=m+h>>>1;i(c[g],u)<0?m=g+1:h=g}while(m<h)}return m}function s(c,u,m=0,h=c.length){if(m<h){if(n(u,u)!==0)return h;do{const g=m+h>>>1;i(c[g],u)<=0?m=g+1:h=g}while(m<h)}return m}function a(c,u,m=0,h=c.length){const g=o(c,u,m,h-1);return g>m&&r(c[g-1],u)>-r(c[g],u)?g-1:g}return{left:o,center:a,right:s}}function QLe(){return 0}function Pse(e){return e===null?NaN:+e}function*ZLe(e,n){for(let i of e)i!=null&&(i=+i)>=i&&(yield i)}const JLe=pR(wf),gC=JLe.right;pR(Pse).center;class $q extends Map{constructor(n,i=n9e){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:i}}),n!=null)for(const[r,o]of n)this.set(r,o)}get(n){return super.get(Iq(this,n))}has(n){return super.has(Iq(this,n))}set(n,i){return super.set(e9e(this,n),i)}delete(n){return super.delete(t9e(this,n))}}function Iq({_intern:e,_key:n},i){const r=n(i);return e.has(r)?e.get(r):i}function e9e({_intern:e,_key:n},i){const r=n(i);return e.has(r)?e.get(r):(e.set(r,i),i)}function t9e({_intern:e,_key:n},i){const r=n(i);return e.has(r)&&(i=e.get(r),e.delete(r)),i}function n9e(e){return e!==null&&typeof e=="object"?e.valueOf():e}function i9e(e=wf){if(e===wf)return Ase;if(typeof e!="function")throw new TypeError("compare is not a function");return(n,i)=>{const r=e(n,i);return r||r===0?r:(e(i,i)===0)-(e(n,n)===0)}}function Ase(e,n){return(e==null||!(e>=e))-(n==null||!(n>=n))||(e<n?-1:e>n?1:0)}const r9e=Math.sqrt(50),o9e=Math.sqrt(10),s9e=Math.sqrt(2);function _I(e,n,i){const r=(n-e)/Math.max(0,i),o=Math.floor(Math.log10(r)),s=r/Math.pow(10,o),a=s>=r9e?10:s>=o9e?5:s>=s9e?2:1;let c,u,m;return o<0?(m=Math.pow(10,-o)/a,c=Math.round(e*m),u=Math.round(n*m),c/m<e&&++c,u/m>n&&--u,m=-m):(m=Math.pow(10,o)*a,c=Math.round(e/m),u=Math.round(n/m),c*m<e&&++c,u*m>n&&--u),u<c&&.5<=i&&i<2?_I(e,n,i*2):[c,u,m]}function D3(e,n,i){if(n=+n,e=+e,i=+i,!(i>0))return[];if(e===n)return[e];const r=n<e,[o,s,a]=r?_I(n,e,i):_I(e,n,i);if(!(s>=o))return[];const c=s-o+1,u=new Array(c);if(r)if(a<0)for(let m=0;m<c;++m)u[m]=(s-m)/-a;else for(let m=0;m<c;++m)u[m]=(s-m)*a;else if(a<0)for(let m=0;m<c;++m)u[m]=(o+m)/-a;else for(let m=0;m<c;++m)u[m]=(o+m)*a;return u}function L3(e,n,i){return n=+n,e=+e,i=+i,_I(e,n,i)[2]}function B3(e,n,i){n=+n,e=+e,i=+i;const r=n<e,o=r?L3(n,e,i):L3(e,n,i);return(r?-1:1)*(o<0?1/-o:o)}function Pq(e,n){let i;for(const r of e)r!=null&&(i<r||i===void 0&&r>=r)&&(i=r);return i}function Aq(e,n){let i;for(const r of e)r!=null&&(i>r||i===void 0&&r>=r)&&(i=r);return i}function Nse(e,n,i=0,r=1/0,o){if(n=Math.floor(n),i=Math.floor(Math.max(0,i)),r=Math.floor(Math.min(e.length-1,r)),!(i<=n&&n<=r))return e;for(o=o===void 0?Ase:i9e(o);r>i;){if(r-i>600){const u=r-i+1,m=n-i+1,h=Math.log(u),g=.5*Math.exp(2*h/3),x=.5*Math.sqrt(h*g*(u-g)/u)*(m-u/2<0?-1:1),y=Math.max(i,Math.floor(n-m*g/u+x)),w=Math.min(r,Math.floor(n+(u-m)*g/u+x));Nse(e,n,y,w,o)}const s=e[n];let a=i,c=r;for(_w(e,i,n),o(e[r],s)>0&&_w(e,i,r);a<c;){for(_w(e,a,c),++a,--c;o(e[a],s)<0;)++a;for(;o(e[c],s)>0;)--c}o(e[i],s)===0?_w(e,i,c):(++c,_w(e,c,r)),c<=n&&(i=c+1),n<=c&&(r=c-1)}return e}function _w(e,n,i){const r=e[n];e[n]=e[i],e[i]=r}function a9e(e,n,i){if(e=Float64Array.from(ZLe(e)),!(!(r=e.length)||isNaN(n=+n))){if(n<=0||r<2)return Aq(e);
7783if(n>=1)return Pq(e);var r,o=(r-1)*n,s=Math.floor(o),a=Pq(Nse(e,s).subarray(0,s+1)),c=Aq(e.subarray(s+1));return a+(c-a)*(o-s)}}function l9e(e,n,i=Pse){if(!(!(r=e.length)||isNaN(n=+n))){if(n<=0||r<2)return+i(e[0],0,e);if(n>=1)return+i(e[r-1],r-1,e);var r,o=(r-1)*n,s=Math.floor(o),a=+i(e[s],s,e),c=+i(e[s+1],s+1,e);return a+(c-a)*(o-s)}}function c9e(e,n,i){e=+e,n=+n,i=(o=arguments.length)<2?(n=e,e=0,1):o<3?1:+i;for(var r=-1,o=Math.max(0,Math.ceil((n-e)/i))|0,s=new Array(o);++r<o;)s[r]=e+r*i;return s}function Fd(e,n){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(n).domain(e);break}return this}function lh(e,n){switch(arguments.length){case 0:break;case 1:{typeof e=="function"?this.interpolator(e):this.range(e);break}default:{this.domain(e),typeof n=="function"?this.interpolator(n):this.range(n);break}}return this}const F3=Symbol("implicit");function mR(){var e=new $q,n=[],i=[],r=F3;function o(s){let a=e.get(s);if(a===void 0){if(r!==F3)return r;e.set(s,a=n.push(s)-1)}return i[a%i.length]}return o.domain=function(s){if(!arguments.length)return n.slice();n=[],e=new $q;for(const a of s)e.has(a)||e.set(a,n.push(a)-1);return o},o.range=function(s){return arguments.length?(i=Array.from(s),o):i.slice()},o.unknown=function(s){return arguments.length?(r=s,o):r},o.copy=function(){return mR(n,i).unknown(r)},Fd.apply(o,arguments),o}function hR(){var e=mR().unknown(void 0),n=e.domain,i=e.range,r=0,o=1,s,a,c=!1,u=0,m=0,h=.5;delete e.unknown;function g(){var x=n().length,y=o<r,w=y?o:r,j=y?r:o;s=(j-w)/Math.max(1,x-u+m*2),c&&(s=Math.floor(s)),w+=(j-w-s*(x-u))*h,a=s*(1-u),c&&(w=Math.round(w),a=Math.round(a));var v=c9e(x).map(function(_){return w+s*_});return i(y?v.reverse():v)}return e.domain=function(x){return arguments.length?(n(x),g()):n()},e.range=function(x){return arguments.length?([r,o]=x,r=+r,o=+o,g()):[r,o]},e.rangeRound=function(x){return[r,o]=x,r=+r,o=+o,c=!0,g()},e.bandwidth=function(){return a},e.step=function(){return s},e.round=function(x){return arguments.length?(c=!!x,g()):c},e.padding=function(x){return arguments.length?(u=Math.min(1,m=+x),g()):u},e.paddingInner=function(x){return arguments.length?(u=Math.min(1,x),g()):u},e.paddingOuter=function(x){return arguments.length?(m=+x,g()):m},e.align=function(x){return arguments.length?(h=Math.max(0,Math.min(1,x)),g()):h},e.copy=function(){return hR(n(),[r,o]).round(c).paddingInner(u).paddingOuter(m).align(h)},Fd.apply(g(),arguments)}function zse(e){var n=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,delete e.paddingOuter,e.copy=function(){return zse(n())},e}function d9e(){return zse(hR.apply(null,arguments).paddingInner(1))}function fR(e,n,i){e.prototype=n.prototype=i,i.constructor=e}function Tse(e,n){var i=Object.create(e.prototype);for(var r in n)i[r]=n[r];return i}function yC(){}var T_=.7,CI=1/T_,kb="\\s*([+-]?\\d+)\\s*",E_="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ip="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",u9e=/^#([0-9a-f]{3,8})$/,p9e=new RegExp(`^rgb\\(${kb},${kb},${kb}\\)$`),m9e=new RegExp(`^rgb\\(${Ip},${Ip},${Ip}\\)$`),h9e=new RegExp(`^rgba\\(${kb},${kb},${kb},${E_}\\)$`),f9e=new RegExp(`^rgba\\(${Ip},${Ip},${Ip},${E_}\\)$`),g9e=new RegExp(`^hsl\\(${E_},${Ip},${Ip}\\)$`),y9e=new RegExp(`^hsla\\(${E_},${Ip},${Ip},${E_}\\)$`),Nq={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};fR(yC,M_,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:zq,formatHex:zq,formatHex8:x9e,formatHsl:b9e,formatRgb:Tq,toString:Tq});function zq(){return this.rgb().formatHex()}function x9e(){return this.rgb().formatHex8()}function b9e(){return Ese(this).formatHsl()}function Tq(){return this.rgb().formatRgb()}function M_(e){var n,i;return e=(e+"").trim().toLowerCase(),(n=u9e.exec(e))?(i=n[1].length,n=parseInt(n[1],16),i===6?Eq(n):i===3?new Fl(n>>8&15|n>>4&240,n>>4&15|n&240,(n&15)<<4|n&15,1):i===8?qk(n>>24&255,n>>16&255,n>>8&255,(n&255)/255):i===4?qk(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|n&240,((n&15)<<4|n&15)/255):null):(n=p9e.exec(e))?new Fl(n[1],n[2],n[3],1):(n=m9e.exec(e))?new Fl(n[1]*255/100,n[2]*255/100,n[3]*255/100,1):(n=h9e.exec(e))?qk(n[1],n[2],n[3],n[4]):(n=f9e.exec(e))?qk(n[1]*255/100,n[2]*255/100,n[3]*255/100,n[4]):(n=g9e.exec(e))?Oq(n[1],n[2]/100,n[3]/100,1):(n=y9e.exec(e))?Oq(n[1],n[2]/100,n[3]/100,n[4]):Nq.hasOwnProperty(e)?Eq(Nq[e]):e==="transparent"?new Fl(NaN,NaN,NaN,0):null}function Eq(e){return new Fl(e>>16&255,e>>8&255,e&255,1)}function qk(e,n,i,r){return r<=0&&(e=n=i=NaN),new Fl(e,n,i,r)}function v9e(e){return e instanceof yC||(e=M_(e)),e?(e=e.rgb(),new Fl(e.r,e.g,e.b,e.opacity)):new Fl}function W3(e,n,i,r){return arguments.length===1?v9e(e):new Fl(e,n,i,r??1)}function Fl(e,n,i,r){this.r=+e,this.g=+n,this.b=+i,this.opacity=+r}fR(Fl,W3,Tse(yC,{brighter(e){return e=e==null?CI:Math.pow(CI,e),new Fl(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?T_:Math.pow(T_,e),new Fl(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Fl(dy(this.r),dy(this.g),dy(this.b),SI(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Mq,formatHex:Mq,formatHex8:w9e,formatRgb:Rq,toString:Rq}));function Mq(){return`#${ny(this.r)}${ny(this.g)}${ny(this.b)}`}function w9e(){return`#${ny(this.r)}${ny(this.g)}${ny(this.b)}${ny((isNaN(this.opacity)?1:this.opacity)*255)}`}function Rq(){const e=SI(this.opacity);return`${e===1?"rgb(":"rgba("}${dy(this.r)}, ${dy(this.g)}, ${dy(this.b)}${e===1?")":`, ${e})`}`}function SI(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function dy(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ny(e){return e=dy(e),(e<16?"0":"")+e.toString(16)}function Oq(e,n,i,r){return r<=0?e=n=i=NaN:i<=0||i>=1?e=n=NaN:n<=0&&(e=NaN),new fu(e,n,i,r)}function Ese(e){if(e instanceof fu)return new fu(e.h,e.s,e.l,e.opacity);if(e instanceof yC||(e=M_(e)),!e)return new fu;if(e instanceof fu)return e;e=e.rgb();var n=e.r/255,i=e.g/255,r=e.b/255,o=Math.min(n,i,r),s=Math.max(n,i,r),a=NaN,c=s-o,u=(s+o)/2;return c?(n===s?a=(i-r)/c+(i<r)*6:i===s?a=(r-n)/c+2:a=(n-i)/c+4,c/=u<.5?s+o:2-s-o,a*=60):c=u>0&&u<1?0:a,new fu(a,c,u,e.opacity)}function j9e(e,n,i,r){return arguments.length===1?Ese(e):new fu(e,n,i,r??1)}function fu(e,n,i,r){this.h=+e,this.s=+n,this.l=+i,this.opacity=+r}
vendor: 5,059 bytes, line 7783
7783fR(fu,j9e,Tse(yC,{brighter(e){return e=e==null?CI:Math.pow(CI,e),new fu(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?T_:Math.pow(T_,e),new fu(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,n=isNaN(e)||isNaN(this.s)?0:this.s,i=this.l,r=i+(i<.5?i:1-i)*n,o=2*i-r;return new Fl(s6(e>=240?e-240:e+120,o,r),s6(e,o,r),s6(e<120?e+240:e-120,o,r),this.opacity)},clamp(){return new fu(Dq(this.h),Gk(this.s),Gk(this.l),SI(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=SI(this.opacity);return`${e===1?"hsl(":"hsla("}${Dq(this.h)}, ${Gk(this.s)*100}%, ${Gk(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Dq(e){return e=(e||0)%360,e<0?e+360:e}function Gk(e){return Math.max(0,Math.min(1,e||0))}function s6(e,n,i){return(e<60?n+(i-n)*e/60:e<180?i:e<240?n+(i-n)*(240-e)/60:n)*255}const gR=e=>()=>e;function _9e(e,n){return function(i){return e+i*n}}function C9e(e,n,i){return e=Math.pow(e,i),n=Math.pow(n,i)-e,i=1/i,function(r){return Math.pow(e+r*n,i)}}function S9e(e){return(e=+e)==1?Mse:function(n,i){return i-n?C9e(n,i,e):gR(isNaN(n)?i:n)}}function Mse(e,n){var i=n-e;return i?_9e(e,i):gR(isNaN(e)?n:e)}const Lq=(function e(n){var i=S9e(n);function r(o,s){var a=i((o=W3(o)).r,(s=W3(s)).r),c=i(o.g,s.g),u=i(o.b,s.b),m=Mse(o.opacity,s.opacity);return function(h){return o.r=a(h),o.g=c(h),o.b=u(h),o.opacity=m(h),o+""}}return r.gamma=e,r})(1);function k9e(e,n){n||(n=[]);var i=e?Math.min(n.length,e.length):0,r=n.slice(),o;return function(s){for(o=0;o<i;++o)r[o]=e[o]*(1-s)+n[o]*s;return r}}function $9e(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function I9e(e,n){var i=n?n.length:0,r=e?Math.min(i,e.length):0,o=new Array(r),s=new Array(i),a;for(a=0;a<r;++a)o[a]=f1(e[a],n[a]);for(;a<i;++a)s[a]=n[a];return function(c){for(a=0;a<r;++a)s[a]=o[a](c);return s}}function P9e(e,n){var i=new Date;return e=+e,n=+n,function(r){return i.setTime(e*(1-r)+n*r),i}}function kI(e,n){return e=+e,n=+n,function(i){return e*(1-i)+n*i}}function A9e(e,n){var i={},r={},o;(e===null||typeof e!="object")&&(e={}),(n===null||typeof n!="object")&&(n={});for(o in n)o in e?i[o]=f1(e[o],n[o]):r[o]=n[o];return function(s){for(o in i)r[o]=i[o](s);return r}}var U3=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,a6=new RegExp(U3.source,"g");function N9e(e){return function(){return e}}function z9e(e){return function(n){return e(n)+""}}function T9e(e,n){var i=U3.lastIndex=a6.lastIndex=0,r,o,s,a=-1,c=[],u=[];for(e=e+"",n=n+"";(r=U3.exec(e))&&(o=a6.exec(n));)(s=o.index)>i&&(s=n.slice(i,s),c[a]?c[a]+=s:c[++a]=s),(r=r[0])===(o=o[0])?c[a]?c[a]+=o:c[++a]=o:(c[++a]=null,u.push({i:a,x:kI(r,o)})),i=a6.lastIndex;return i<n.length&&(s=n.slice(i),c[a]?c[a]+=s:c[++a]=s),c.length<2?u[0]?z9e(u[0].x):N9e(n):(n=u.length,function(m){for(var h=0,g;h<n;++h)c[(g=u[h]).i]=g.x(m);return c.join("")})}function f1(e,n){var i=typeof n,r;return n==null||i==="boolean"?gR(n):(i==="number"?kI:i==="string"?(r=M_(n))?(n=r,Lq):T9e:n instanceof M_?Lq:n instanceof Date?P9e:$9e(n)?k9e:Array.isArray(n)?I9e:typeof n.valueOf!="function"&&typeof n.toString!="function"||isNaN(n)?A9e:kI)(e,n)}function yR(e,n){return e=+e,n=+n,function(i){return Math.round(e*(1-i)+n*i)}}function E9e(e,n){n===void 0&&(n=e,e=f1);for(var i=0,r=n.length-1,o=n[0],s=new Array(r<0?0:r);i<r;)s[i]=e(o,o=n[++i]);return function(a){var c=Math.max(0,Math.min(r-1,Math.floor(a*=r)));return s[c](a-c)}}function M9e(e){return function(){return e}}function $I(e){return+e}var Bq=[0,1];function fl(e){return e}function H3(e,n){return(n-=e=+e)?function(i){return(i-e)/n}:M9e(isNaN(n)?NaN:.5)}function R9e(e,n){var i;return e>n&&(i=e,e=n,n=i),function(r){return Math.max(e,Math.min(n,r))}}function O9e(e,n,i){var r=e[0],o=e[1],s=n[0],a=n[1];return o<r?(r=H3(o,r),s=i(a,s)):(r=H3(r,o),s=i(s,a)),function(c){return s(r(c))}}function D9e(e,n,i){var r=Math.min(e.length,n.length)-1,o=new Array(r),s=new Array(r),a=-1;for(e[r]<e[0]&&(e=e.slice().reverse(),n=n.slice().reverse());++a<r;)o[a]=H3(e[a],e[a+1]),s[a]=i(n[a],n[a+1]);return function(c){var u=gC(e,c,1,r)-1;return s[u](o[u](c))}}function xC(e,n){return n.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function oA(){var e=Bq,n=Bq,i=f1,r,o,s,a=fl,c,u,m;function h(){var x=Math.min(e.length,n.length);return a!==fl&&(a=R9e(e[0],e[x-1])),c=x>2?D9e:O9e,u=m=null,g}function g(x){return x==null||isNaN(x=+x)?s:(u||(u=c(e.map(r),n,i)))(r(a(x)))}return g.invert=function(x){return a(o((m||(m=c(n,e.map(r),kI)))(x)))},g.domain=function(x){return arguments.length?(e=Array.from(x,$I),h()):e.slice()},g.range=function(x){return arguments.length?(n=Array.from(x),h()):n.slice()},g.rangeRound=function(x){return n=Array.from(x),i=yR,h()},g.clamp=function(x){return arguments.length?(a=x?!0:fl,h()):a!==fl},g.interpolate=function(x){return arguments.length?(i=x,h()):i},g.unknown=function(x){return arguments.length?(s=x,g):s},function(x,y){return r=x,o=y,h()}}function xR(){return oA()(fl,fl)}
vendor: 5,075 bytes, line 7783
7783function L9e(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function II(e,n){if((i=(e=n?e.toExponential(n-1):e.toExponential()).indexOf("e"))<0)return null;var i,r=e.slice(0,i);return[r.length>1?r[0]+r.slice(2):r,+e.slice(i+1)]}function Yb(e){return e=II(Math.abs(e)),e?e[1]:NaN}function B9e(e,n){return function(i,r){for(var o=i.length,s=[],a=0,c=e[0],u=0;o>0&&c>0&&(u+c+1>r&&(c=Math.max(1,r-u)),s.push(i.substring(o-=c,o+c)),!((u+=c+1)>r));)c=e[a=(a+1)%e.length];return s.reverse().join(n)}}function F9e(e){return function(n){return n.replace(/[0-9]/g,function(i){return e[+i]})}}var W9e=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function R_(e){if(!(n=W9e.exec(e)))throw new Error("invalid format: "+e);var n;return new bR({fill:n[1],align:n[2],sign:n[3],symbol:n[4],zero:n[5],width:n[6],comma:n[7],precision:n[8]&&n[8].slice(1),trim:n[9],type:n[10]})}R_.prototype=bR.prototype;function bR(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}bR.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function U9e(e){e:for(var n=e.length,i=1,r=-1,o;i<n;++i)switch(e[i]){case".":r=o=i;break;case"0":r===0&&(r=i),o=i;break;default:if(!+e[i])break e;r>0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(o+1):e}var Rse;function H9e(e,n){var i=II(e,n);if(!i)return e+"";var r=i[0],o=i[1],s=o-(Rse=Math.max(-8,Math.min(8,Math.floor(o/3)))*3)+1,a=r.length;return s===a?r:s>a?r+new Array(s-a+1).join("0"):s>0?r.slice(0,s)+"."+r.slice(s):"0."+new Array(1-s).join("0")+II(e,Math.max(0,n+s-1))[0]}function Fq(e,n){var i=II(e,n);if(!i)return e+"";var r=i[0],o=i[1];return o<0?"0."+new Array(-o).join("0")+r:r.length>o+1?r.slice(0,o+1)+"."+r.slice(o+1):r+new Array(o-r.length+2).join("0")}const Wq={"%":(e,n)=>(e*100).toFixed(n),b:e=>Math.round(e).toString(2),c:e=>e+"",d:L9e,e:(e,n)=>e.toExponential(n),f:(e,n)=>e.toFixed(n),g:(e,n)=>e.toPrecision(n),o:e=>Math.round(e).toString(8),p:(e,n)=>Fq(e*100,n),r:Fq,s:H9e,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function Uq(e){return e}var Hq=Array.prototype.map,qq=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function q9e(e){var n=e.grouping===void 0||e.thousands===void 0?Uq:B9e(Hq.call(e.grouping,Number),e.thousands+""),i=e.currency===void 0?"":e.currency[0]+"",r=e.currency===void 0?"":e.currency[1]+"",o=e.decimal===void 0?".":e.decimal+"",s=e.numerals===void 0?Uq:F9e(Hq.call(e.numerals,String)),a=e.percent===void 0?"%":e.percent+"",c=e.minus===void 0?"â":e.minus+"",u=e.nan===void 0?"NaN":e.nan+"";function m(g){g=R_(g);var x=g.fill,y=g.align,w=g.sign,j=g.symbol,v=g.zero,_=g.width,$=g.comma,k=g.precision,P=g.trim,S=g.type;S==="n"?($=!0,S="g"):Wq[S]||(k===void 0&&(k=12),P=!0,S="g"),(v||x==="0"&&y==="=")&&(v=!0,x="0",y="=");var I=j==="$"?i:j==="#"&&/[boxX]/.test(S)?"0"+S.toLowerCase():"",A=j==="$"?r:/[%p]/.test(S)?a:"",E=Wq[S],B=/[defgprs%]/.test(S);k=k===void 0?6:/[gprs]/.test(S)?Math.max(1,Math.min(21,k)):Math.max(0,Math.min(20,k));function T(M){var R=I,F=A,Y,H,U;if(S==="c")F=E(M)+F,M="";else{M=+M;var X=M<0||1/M<0;if(M=isNaN(M)?u:E(Math.abs(M),k),P&&(M=U9e(M)),X&&+M==0&&w!=="+"&&(X=!1),R=(X?w==="("?w:c:w==="-"||w==="("?"":w)+R,F=(S==="s"?qq[8+Rse/3]:"")+F+(X&&w==="("?")":""),B){for(Y=-1,H=M.length;++Y<H;)if(U=M.charCodeAt(Y),48>U||U>57){F=(U===46?o+M.slice(Y+1):M.slice(Y))+F,M=M.slice(0,Y);break}}}$&&!v&&(M=n(M,1/0));var Q=R.length+M.length+F.length,K=Q<_?new Array(_-Q+1).join(x):"";switch($&&v&&(M=n(K+M,K.length?_-F.length:1/0),K=""),y){case"<":M=R+M+F+K;break;case"=":M=R+K+M+F;break;case"^":M=K.slice(0,Q=K.length>>1)+R+M+F+K.slice(Q);break;default:M=K+R+M+F;break}return s(M)}return T.toString=function(){return g+""},T}function h(g,x){var y=m((g=R_(g),g.type="f",g)),w=Math.max(-8,Math.min(8,Math.floor(Yb(x)/3)))*3,j=Math.pow(10,-w),v=qq[8+w/3];return function(_){return y(j*_)+v}}return{format:m,formatPrefix:h}}var Vk,vR,Ose;G9e({thousands:",",grouping:[3],currency:["$",""]});function G9e(e){return Vk=q9e(e),vR=Vk.format,Ose=Vk.formatPrefix,Vk}function V9e(e){return Math.max(0,-Yb(Math.abs(e)))}function K9e(e,n){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Yb(n)/3)))*3-Yb(Math.abs(e)))}function Y9e(e,n){return e=Math.abs(e),n=Math.abs(n)-e,Math.max(0,Yb(n)-Yb(e))+1}function Dse(e,n,i,r){var o=B3(e,n,i),s;switch(r=R_(r??",f"),r.type){case"s":{var a=Math.max(Math.abs(e),Math.abs(n));return r.precision==null&&!isNaN(s=K9e(o,a))&&(r.precision=s),Ose(r,a)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(s=Y9e(
7783o,Math.max(Math.abs(e),Math.abs(n))))&&(r.precision=s-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(s=V9e(o))&&(r.precision=s-(r.type==="%")*2);break}}return vR(r)}function Bf(e){var n=e.domain;return e.ticks=function(i){var r=n();return D3(r[0],r[r.length-1],i??10)},e.tickFormat=function(i,r){var o=n();return Dse(o[0],o[o.length-1],i??10,r)},e.nice=function(i){i==null&&(i=10);var r=n(),o=0,s=r.length-1,a=r[o],c=r[s],u,m,h=10;for(c<a&&(m=a,a=c,c=m,m=o,o=s,s=m);h-- >0;){if(m=L3(a,c,i),m===u)return r[o]=a,r[s]=c,n(r);if(m>0)a=Math.floor(a/m)*m,c=Math.ceil(c/m)*m;else if(m<0)a=Math.ceil(a*m)/m,c=Math.floor(c*m)/m;else break;u=m}return e},e}function Lse(){var e=xR();return e.copy=function(){return xC(e,Lse())},Fd.apply(e,arguments),Bf(e)}function Bse(e){var n;function i(r){return r==null||isNaN(r=+r)?n:r}return i.invert=i,i.domain=i.range=function(r){return arguments.length?(e=Array.from(r,$I),i):e.slice()},i.unknown=function(r){return arguments.length?(n=r,i):n},i.copy=function(){return Bse(e).unknown(n)},e=arguments.length?Array.from(e,$I):[0,1],Bf(i)}function Fse(e,n){e=e.slice();var i=0,r=e.length-1,o=e[i],s=e[r],a;return s<o&&(a=i,i=r,r=a,a=o,o=s,s=a),e[i]=n.floor(o),e[r]=n.ceil(s),e}function Gq(e){return Math.log(e)}function Vq(e){return Math.exp(e)}function X9e(e){return-Math.log(-e)}function Q9e(e){return-Math.exp(-e)}function Z9e(e){return isFinite(e)?+("1e"+e):e<0?0:e}function J9e(e){return e===10?Z9e:e===Math.E?Math.exp:n=>Math.pow(e,n)}function eBe(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),n=>Math.log(n)/e)}function Kq(e){return(n,i)=>-e(-n,i)}function wR(e){const n=e(Gq,Vq),i=n.domain;let r=10,o,s;function a(){return o=eBe(r),s=J9e(r),i()[0]<0?(o=Kq(o),s=Kq(s),e(X9e,Q9e)):e(Gq,Vq),n}return n.base=function(c){return arguments.length?(r=+c,a()):r},n.domain=function(c){return arguments.length?(i(c),a()):i()},n.ticks=c=>{const u=i();let m=u[0],h=u[u.length-1];const g=h<m;g&&([m,h]=[h,m]);let x=o(m),y=o(h),w,j;const v=c==null?10:+c;let _=[];if(!(r%1)&&y-x<v){if(x=Math.floor(x),y=Math.ceil(y),m>0){for(;x<=y;++x)for(w=1;w<r;++w)if(j=x<0?w/s(-x):w*s(x),!(j<m)){if(j>h)break;_.push(j)}}else for(;x<=y;++x)for(w=r-1;w>=1;--w)if(j=x>0?w/s(-x):w*s(x),!(j<m)){if(j>h)break;_.push(j)}_.length*2<v&&(_=D3(m,h,v))}else _=D3(x,y,Math.min(y-x,v)).map(s);return g?_.reverse():_},n.tickFormat=(c,u)=>{if(c==null&&(c=10),u==null&&(u=r===10?"s":","),typeof u!="function"&&(!(r%1)&&(u=R_(u)).precision==null&&(u.trim=!0),u=vR(u)),c===1/0)return u;const m=Math.max(1,r*c/n.ticks().length);return h=>{let g=h/s(Math.round(o(h)));return g*r<r-.5&&(g*=r),g<=m?u(h):""}},n.nice=()=>i(Fse(i(),{floor:c=>s(Math.floor(o(c))),ceil:c=>s(Math.ceil(o(c)))})),n}function Wse(){const e=wR(oA()).domain([1,10]);return e.copy=()=>xC(e,Wse()).base(e.base()),Fd.apply(e,arguments),e}function Yq(e){return function(n){return Math.sign(n)*Math.log1p(Math.abs(n/e))}}function Xq(e){return function(n){return Math.sign(n)*Math.expm1(Math.abs(n))*e}}function jR(e){var n=1,i=e(Yq(n),Xq(n));return i.constant=function(r){return arguments.length?e(Yq(n=+r),Xq(n)):n},Bf(i)}function Use(){var e=jR(oA());return e.copy=function(){return xC(e,Use()).constant(e.constant())},Fd.apply(e,arguments)}function Qq(e){return function(n){return n<0?-Math.pow(-n,e):Math.pow(n,e)}}function tBe(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function nBe(e){return e<0?-e*e:e*e}function _R(e){var n=e(fl,fl),i=1;function r(){return i===1?e(fl,fl):i===.5?e(tBe,nBe):e(Qq(i),Qq(1/i))}return n.exponent=function(o){return arguments.length?(i=+o,r()):i},Bf(n)}function CR(){var e=_R(oA());return e.copy=function(){return xC(e,CR()).exponent(e.exponent())},Fd.apply(e,arguments),e}function iBe(){return CR.apply(null,arguments).exponent(.5)}function Zq(e){return Math.sign(e)*e*e}function rBe(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function Hse(){var e=xR(),n=[0,1],i=!1,r;function o(s){var a=rBe(e(s));return isNaN(a)?r:i?Math.round(a):a}return o.invert=function(s){return e.invert(Zq(s))},o.domain=function(s){return arguments.length?(e.domain(s),o):e.domain()},o.range=function(s){return arguments.length?(e.range((n=Array.from(s,$I)).map(Zq)),o):n.slice()}
7783,o.rangeRound=function(s){return o.range(s).round(!0)},o.round=function(s){return arguments.length?(i=!!s,o):i},o.clamp=function(s){return arguments.length?(e.clamp(s),o):e.clamp()},o.unknown=function(s){return arguments.length?(r=s,o):r},o.copy=function(){return Hse(e.domain(),n).round(i).clamp(e.clamp()).unknown(r)},Fd.apply(o,arguments),Bf(o)}function qse(){var e=[],n=[],i=[],r;function o(){var a=0,c=Math.max(1,n.length);for(i=new Array(c-1);++a<c;)i[a-1]=l9e(e,a/c);return s}function s(a){return a==null||isNaN(a=+a)?r:n[gC(i,a)]}return s.invertExtent=function(a){var c=n.indexOf(a);return c<0?[NaN,NaN]:[c>0?i[c-1]:e[0],c<i.length?i[c]:e[e.length-1]]},s.domain=function(a){if(!arguments.length)return e.slice();e=[];for(let c of a)c!=null&&!isNaN(c=+c)&&e.push(c);return e.sort(wf),o()},s.range=function(a){return arguments.length?(n=Array.from(a),o()):n.slice()},s.unknown=function(a){return arguments.length?(r=a,s):r},s.quantiles=function(){return i.slice()},s.copy=function(){return qse().domain(e).range(n).unknown(r)},Fd.apply(s,arguments)}function Gse(){var e=0,n=1,i=1,r=[.5],o=[0,1],s;function a(u){return u!=null&&u<=u?o[gC(r,u,0,i)]:s}function c(){var u=-1;for(r=new Array(i);++u<i;)r[u]=((u+1)*n-(u-i)*e)/(i+1);return a}return a.domain=function(u){return arguments.length?([e,n]=u,e=+e,n=+n,c()):[e,n]},a.range=function(u){return arguments.length?(i=(o=Array.from(u)).length-1,c()):o.slice()},a.invertExtent=function(u){var m=o.indexOf(u);return m<0?[NaN,NaN]:m<1?[e,r[0]]:m>=i?[r[i-1],n]:[r[m-1],r[m]]},a.unknown=function(u){return arguments.length&&(s=u),a},a.thresholds=function(){return r.slice()},a.copy=function(){return Gse().domain([e,n]).range(o).unknown(s)},Fd.apply(Bf(a),arguments)}function Vse(){var e=[.5],n=[0,1],i,r=1;function o(s){return s!=null&&s<=s?n[gC(e,s,0,r)]:i}return o.domain=function(s){return arguments.length?(e=Array.from(s),r=Math.min(e.length,n.length-1),o):e.slice()},o.range=function(s){return arguments.length?(n=Array.from(s),r=Math.min(e.length,n.length-1),o):n.slice()},o.invertExtent=function(s){var a=n.indexOf(s);return[e[a-1],e[a]]},o.unknown=function(s){return arguments.length?(i=s,o):i},o.copy=function(){return Vse().domain(e).range(n).unknown(i)},Fd.apply(o,arguments)}const l6=new Date,c6=new Date;function Is(e,n,i,r){function o(s){return e(s=arguments.length===0?new Date:new Date(+s)),s}return o.floor=s=>(e(s=new Date(+s)),s),o.ceil=s=>(e(s=new Date(s-1)),n(s,1),e(s),s),o.round=s=>{const a=o(s),c=o.ceil(s);return s-a<c-s?a:c},o.offset=(s,a)=>(n(s=new Date(+s),a==null?1:Math.floor(a)),s),o.range=(s,a,c)=>{const u=[];if(s=o.ceil(s),c=c==null?1:Math.floor(c),!(s<a)||!(c>0))return u;let m;do u.push(m=new Date(+s)),n(s,c),e(s);while(m<s&&s<a);return u},o.filter=s=>Is(a=>{if(a>=a)for(;e(a),!s(a);)a.setTime(a-1)},(a,c)=>{if(a>=a)if(c<0)for(;++c<=0;)for(;n(a,-1),!s(a););else for(;--c>=0;)for(;n(a,1),!s(a););}),i&&(o.count=(s,a)=>(l6.setTime(+s),c6.setTime(+a),e(l6),e(c6),Math.floor(i(l6,c6))),o.every=s=>(s=Math.floor(s),!isFinite(s)||!(s>0)?null:s>1?o.filter(r?a=>r(a)%s===0:a=>o.count(0,a)%s===0):o)),o}const PI=Is(()=>{},(e,n)=>{e.setTime(+e+n)},(e,n)=>n-e);PI.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?Is(n=>{n.setTime(Math.floor(n/e)*e)},(n,i)=>{n.setTime(+n+i*e)},(n,i)=>(i-n)/e):PI);PI.range;const Nm=1e3,Ad=Nm*60,zm=Ad*60,Km=zm*24,SR=Km*7,Jq=Km*30,d6=Km*365,iy=Is(e=>{e.setTime(e-e.getMilliseconds())},(e,n)=>{e.setTime(+e+n*Nm)},(e,n)=>(n-e)/Nm,e=>e.getUTCSeconds());iy.range;const kR=Is(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Nm)},(e,n)=>{e.setTime(+e+n*Ad)},(e,n)=>(n-e)/Ad,e=>e.getMinutes());kR.range;const $R=Is(e=>{e.setUTCSeconds(0,0)},(e,n)=>{e.setTime(+e+n*Ad)},(e,n)=>(n-e)/Ad,e=>e.getUTCMinutes());$R.range;const IR=Is(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Nm-e.getMinutes()*Ad)},(e,n)=>{e.setTime(+e+n*zm)},(e,n)=>(n-e)/zm,e=>e.getHours());IR.range;const PR=Is(e=>{e.setUTCMinutes(0,0,0)},(e,n)=>{e.setTime(+e+n*zm)},(e,n)=>(n-e)/zm,e=>e.getUTCHours());PR.range;const bC=Is(e=>e.setHours(0,0,0,0),(e,n)=>e.setDate(e.getDate()+n),(e,n)=>(n-e-(n.getTimezoneOffset()-e.getTimezoneOffset())*Ad)/Km,e=>e.getDate()-1);bC.range;const sA=Is(e=>{e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCDate(e.getUTCDate()+n)},(e,n)=>(n-e)/Km,e=>e.getUTCDate()-1);sA.range;const Kse=Is(e=>{e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCDate(e.getUTCDate()+n)},(e,n)=>(n-e)/Km,e=>Math.floor(e/Km));Kse.range;function Wy(e){return Is(n=>{n.setDate(n.getDate()-(n.getDay()+7-e)%7),n.setHours(0,0,0,0)},(n,i)=>{n.setDate(n.getDate()+i*7)},(n,i)=>(i-n-(i.getTimezoneOffset()-n.getTimezoneOffset())*Ad)/SR)}const aA=Wy(0),AI=Wy(1),oBe=Wy(2),sBe=Wy(3),Xb=Wy(4),aBe=Wy(5),lBe=Wy(6);aA.range;AI.range;oBe.range;sBe.range;Xb.range;aBe.range;lBe.range;function Uy(e){return Is(n=>{n.setUTCDate(n.getUTCDate()-(n.getUTCDay()+7-e)%7),n.setUTCHours(0,0,0,0)},(n,i)=>{n.setUTCDate(n.getUTCDate()+i*7)},(n,i)=>(i-n)/SR)}
vendor: 4,684 bytes, line 7783
7783const lA=Uy(0),NI=Uy(1),cBe=Uy(2),dBe=Uy(3),Qb=Uy(4),uBe=Uy(5),pBe=Uy(6);lA.range;NI.range;cBe.range;dBe.range;Qb.range;uBe.range;pBe.range;const AR=Is(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,n)=>{e.setMonth(e.getMonth()+n)},(e,n)=>n.getMonth()-e.getMonth()+(n.getFullYear()-e.getFullYear())*12,e=>e.getMonth());AR.range;const NR=Is(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCMonth(e.getUTCMonth()+n)},(e,n)=>n.getUTCMonth()-e.getUTCMonth()+(n.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());NR.range;const Ym=Is(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,n)=>{e.setFullYear(e.getFullYear()+n)},(e,n)=>n.getFullYear()-e.getFullYear(),e=>e.getFullYear());Ym.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Is(n=>{n.setFullYear(Math.floor(n.getFullYear()/e)*e),n.setMonth(0,1),n.setHours(0,0,0,0)},(n,i)=>{n.setFullYear(n.getFullYear()+i*e)});Ym.range;const Xm=Is(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n)},(e,n)=>n.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());Xm.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Is(n=>{n.setUTCFullYear(Math.floor(n.getUTCFullYear()/e)*e),n.setUTCMonth(0,1),n.setUTCHours(0,0,0,0)},(n,i)=>{n.setUTCFullYear(n.getUTCFullYear()+i*e)});Xm.range;function Yse(e,n,i,r,o,s){const a=[[iy,1,Nm],[iy,5,5*Nm],[iy,15,15*Nm],[iy,30,30*Nm],[s,1,Ad],[s,5,5*Ad],[s,15,15*Ad],[s,30,30*Ad],[o,1,zm],[o,3,3*zm],[o,6,6*zm],[o,12,12*zm],[r,1,Km],[r,2,2*Km],[i,1,SR],[n,1,Jq],[n,3,3*Jq],[e,1,d6]];function c(m,h,g){const x=h<m;x&&([m,h]=[h,m]);const y=g&&typeof g.range=="function"?g:u(m,h,g),w=y?y.range(m,+h+1):[];return x?w.reverse():w}function u(m,h,g){const x=Math.abs(h-m)/g,y=pR(([,,v])=>v).right(a,x);if(y===a.length)return e.every(B3(m/d6,h/d6,g));if(y===0)return PI.every(Math.max(B3(m,h,g),1));const[w,j]=a[x/a[y-1][2]<a[y][2]/x?y-1:y];return w.every(j)}return[c,u]}const[mBe,hBe]=Yse(Xm,NR,lA,Kse,PR,$R),[fBe,gBe]=Yse(Ym,AR,aA,bC,IR,kR);function u6(e){if(0<=e.y&&e.y<100){var n=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return n.setFullYear(e.y),n}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function p6(e){if(0<=e.y&&e.y<100){var n=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return n.setUTCFullYear(e.y),n}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function Cw(e,n,i){return{y:e,m:n,d:i,H:0,M:0,S:0,L:0}}function yBe(e){var n=e.dateTime,i=e.date,r=e.time,o=e.periods,s=e.days,a=e.shortDays,c=e.months,u=e.shortMonths,m=Sw(o),h=kw(o),g=Sw(s),x=kw(s),y=Sw(a),w=kw(a),j=Sw(c),v=kw(c),_=Sw(u),$=kw(u),k={a:X,A:Q,b:K,B:G,c:null,d:oG,e:oG,f:BBe,g:XBe,G:ZBe,H:OBe,I:DBe,j:LBe,L:Xse,m:FBe,M:WBe,p:L,q,Q:lG,s:cG,S:UBe,u:HBe,U:qBe,V:GBe,w:VBe,W:KBe,x:null,X:null,y:YBe,Y:QBe,Z:JBe,"%":aG},P={a:W,A:oe,b:se,B:de,c:null,d:sG,e:sG,f:iFe,g:mFe,G:fFe,H:eFe,I:tFe,j:nFe,L:Zse,m:rFe,M:oFe,p:le,q:me,Q:lG,s:cG,S:sFe,u:aFe,U:lFe,V:cFe,w:dFe,W:uFe,x:null,X:null,y:pFe,Y:hFe,Z:gFe,"%":aG},S={a:T,A:M,b:R,B:F,c:Y,d:iG,e:iG,f:TBe,g:nG,G:tG,H:rG,I:rG,j:PBe,L:zBe,m:IBe,M:ABe,p:B,q:$Be,Q:MBe,s:RBe,S:NBe,u:jBe,U:_Be,V:CBe,w:wBe,W:SBe,x:H,X:U,y:nG,Y:tG,Z:kBe,"%":EBe};k.x=I(i,k),k.X=I(r,k),k.c=I(n,k),P.x=I(i,P),P.X=I(r,P),P.c=I(n,P);function I(ee,ne){return function(Ae){var _e=[],we=-1,Ke=0,ce=ee.length,ie,Re,Be;for(Ae instanceof Date||(Ae=new Date(+Ae));++we<ce;)ee.charCodeAt(we)===37&&(_e.push(ee.slice(Ke,we)),(Re=eG[ie=ee.charAt(++we)])!=null?ie=ee.charAt(++we):Re=ie==="e"?" ":"0",(Be=ne[ie])&&(ie=Be(Ae,Re)),_e.push(ie),Ke=we+1);return _e.push(ee.slice(Ke,we)),_e.join("")}}function A(ee,ne){return function(Ae){var _e=Cw(1900,void 0,1),we=E(_e,ee,Ae+="",0),Ke,ce;if(we!=Ae.length)return null;if("Q"in _e)return new Date(_e.Q);if("s"in _e)return new Date(_e.s*1e3+("L"in _e?_e.L:0));if(ne&&!("Z"in _e)&&(_e.Z=0),"p"in _e&&(_e.H=_e.H%12+_e.p*12),_e.m===void 0&&(_e.m="q"in _e?_e.q:0),"V"in _e){if(_e.V<1||_e.V>53)return null;"w"in _e||(_e.w=1),"Z"in _e?(Ke=p6(Cw(_e.y,0,1)),ce=Ke.getUTCDay(),Ke=ce>4||ce===0?NI.ceil(Ke):NI(Ke),Ke=sA.offset(Ke,(_e.V-1)*7),_e.y=Ke.getUTCFullYear(),_e.m=Ke.getUTCMonth(),_e.d=Ke.getUTCDate()+(_e.w+6)%7):(Ke=u6(Cw(_e.y,0,1)),ce=Ke.getDay(),Ke=ce>4||ce===0?AI.ceil(Ke):AI(Ke),Ke=bC.offset(Ke,(_e.V-1)*7),_e.y=Ke.getFullYear(),_e.m=Ke.getMonth(),_e.d=Ke.getDate()+(_e.w+6)%7)}else("W"in _e||"U"in _e)&&("w"in _e||(_e.w="u"in _e?_e.u%7:"W"in _e?1:0),ce="Z"in _e?p6(Cw(_e.y,0,1)).getUTCDay():u6(Cw(_e.y,0,1)).getDay(),_e.m=0,_e.d="W"in _e?(_e.w+6)%7+_e.W*7-(ce+5)%7:_e.w+_e.U*7-(ce+6)%7);return"Z"in _e?(_e.H+=_e.Z/100|0,_e.M+=_e.Z%100,p6(_e)):u6(_e)}}function E(ee,ne,Ae,_e){for(var we=0,Ke=ne.length,ce=Ae.length,ie,Re;we<Ke;){if(_e>=ce)return-1;if(ie=ne.charCodeAt(we++),ie===37){if(ie=ne.charAt(we++),Re=S[ie in eG?ne.charAt(we++):ie],!
vendor: 5,719 bytes, line 7783
7783Re||(_e=Re(ee,Ae,_e))<0)return-1}else if(ie!=Ae.charCodeAt(_e++))return-1}return _e}function B(ee,ne,Ae){var _e=m.exec(ne.slice(Ae));return _e?(ee.p=h.get(_e[0].toLowerCase()),Ae+_e[0].length):-1}function T(ee,ne,Ae){var _e=y.exec(ne.slice(Ae));return _e?(ee.w=w.get(_e[0].toLowerCase()),Ae+_e[0].length):-1}function M(ee,ne,Ae){var _e=g.exec(ne.slice(Ae));return _e?(ee.w=x.get(_e[0].toLowerCase()),Ae+_e[0].length):-1}function R(ee,ne,Ae){var _e=_.exec(ne.slice(Ae));return _e?(ee.m=$.get(_e[0].toLowerCase()),Ae+_e[0].length):-1}function F(ee,ne,Ae){var _e=j.exec(ne.slice(Ae));return _e?(ee.m=v.get(_e[0].toLowerCase()),Ae+_e[0].length):-1}function Y(ee,ne,Ae){return E(ee,n,ne,Ae)}function H(ee,ne,Ae){return E(ee,i,ne,Ae)}function U(ee,ne,Ae){return E(ee,r,ne,Ae)}function X(ee){return a[ee.getDay()]}function Q(ee){return s[ee.getDay()]}function K(ee){return u[ee.getMonth()]}function G(ee){return c[ee.getMonth()]}function L(ee){return o[+(ee.getHours()>=12)]}function q(ee){return 1+~~(ee.getMonth()/3)}function W(ee){return a[ee.getUTCDay()]}function oe(ee){return s[ee.getUTCDay()]}function se(ee){return u[ee.getUTCMonth()]}function de(ee){return c[ee.getUTCMonth()]}function le(ee){return o[+(ee.getUTCHours()>=12)]}function me(ee){return 1+~~(ee.getUTCMonth()/3)}return{format:function(ee){var ne=I(ee+="",k);return ne.toString=function(){return ee},ne},parse:function(ee){var ne=A(ee+="",!1);return ne.toString=function(){return ee},ne},utcFormat:function(ee){var ne=I(ee+="",P);return ne.toString=function(){return ee},ne},utcParse:function(ee){var ne=A(ee+="",!0);return ne.toString=function(){return ee},ne}}}var eG={"-":"",_:" ",0:"0"},Qs=/^\s*\d+/,xBe=/^%/,bBe=/[\\^$*+?|[\]().{}]/g;function Wi(e,n,i){var r=e<0?"-":"",o=(r?-e:e)+"",s=o.length;return r+(s<i?new Array(i-s+1).join(n)+o:o)}function vBe(e){return e.replace(bBe,"\\$&")}function Sw(e){return new RegExp("^(?:"+e.map(vBe).join("|")+")","i")}function kw(e){return new Map(e.map((n,i)=>[n.toLowerCase(),i]))}function wBe(e,n,i){var r=Qs.exec(n.slice(i,i+1));return r?(e.w=+r[0],i+r[0].length):-1}function jBe(e,n,i){var r=Qs.exec(n.slice(i,i+1));return r?(e.u=+r[0],i+r[0].length):-1}function _Be(e,n,i){var r=Qs.exec(n.slice(i,i+2));return r?(e.U=+r[0],i+r[0].length):-1}function CBe(e,n,i){var r=Qs.exec(n.slice(i,i+2));return r?(e.V=+r[0],i+r[0].length):-1}function SBe(e,n,i){var r=Qs.exec(n.slice(i,i+2));return r?(e.W=+r[0],i+r[0].length):-1}function tG(e,n,i){var r=Qs.exec(n.slice(i,i+4));return r?(e.y=+r[0],i+r[0].length):-1}function nG(e,n,i){var r=Qs.exec(n.slice(i,i+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),i+r[0].length):-1}function kBe(e,n,i){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(n.slice(i,i+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),i+r[0].length):-1}function $Be(e,n,i){var r=Qs.exec(n.slice(i,i+1));return r?(e.q=r[0]*3-3,i+r[0].length):-1}function IBe(e,n,i){var r=Qs.exec(n.slice(i,i+2));return r?(e.m=r[0]-1,i+r[0].length):-1}function iG(e,n,i){var r=Qs.exec(n.slice(i,i+2));return r?(e.d=+r[0],i+r[0].length):-1}function PBe(e,n,i){var r=Qs.exec(n.slice(i,i+3));return r?(e.m=0,e.d=+r[0],i+r[0].length):-1}function rG(e,n,i){var r=Qs.exec(n.slice(i,i+2));return r?(e.H=+r[0],i+r[0].length):-1}function ABe(e,n,i){var r=Qs.exec(n.slice(i,i+2));return r?(e.M=+r[0],i+r[0].length):-1}function NBe(e,n,i){var r=Qs.exec(n.slice(i,i+2));return r?(e.S=+r[0],i+r[0].length):-1}function zBe(e,n,i){var r=Qs.exec(n.slice(i,i+3));return r?(e.L=+r[0],i+r[0].length):-1}function TBe(e,n,i){var r=Qs.exec(n.slice(i,i+6));return r?(e.L=Math.floor(r[0]/1e3),i+r[0].length):-1}function EBe(e,n,i){var r=xBe.exec(n.slice(i,i+1));return r?i+r[0].length:-1}function MBe(e,n,i){var r=Qs.exec(n.slice(i));return r?(e.Q=+r[0],i+r[0].length):-1}function RBe(e,n,i){var r=Qs.exec(n.slice(i));return r?(e.s=+r[0],i+r[0].length):-1}function oG(e,n){return Wi(e.getDate(),n,2)}function OBe(e,n){return Wi(e.getHours(),n,2)}function DBe(e,n){return Wi(e.getHours()%12||12,n,2)}function LBe(e,n){return Wi(1+bC.count(Ym(e),e),n,3)}function Xse(e,n){return Wi(e.getMilliseconds(),n,3)}function BBe(e,n){return Xse(e,n)+"000"}function FBe(e,n){return Wi(e.getMonth()+1,n,2)}function WBe(e,n){return Wi(e.getMinutes(),n,2)}function UBe(e,n){return Wi(e.getSeconds(),n,2)}function HBe(e){var n=e.getDay();return n===0?7:n}function qBe(e,n){return Wi(aA.count(Ym(e)-1,e),n,2)}function Qse(e){var n=e.getDay();return n>=4||n===0?Xb(e):Xb.ceil(e)}function GBe(e,n){return e=Qse(e),Wi(Xb.count(Ym(e),e)+(Ym(e).getDay()===4),n,2)}function VBe(e){return e.getDay()}function KBe(e,n){return Wi(AI.count(Ym(e)-1,e),n,2)}function YBe(e,n){return Wi(e.getFullYear()%100,n,2)}function XBe(e,n){return e=Qse(e),Wi(e.getFullYear()%100,n,2)}function QBe(e,n){return Wi(e.getFullYear()%1e4,n,4)}function ZBe(e,n){var i=e.getDay();return e=i>=4||i===0?Xb(e):Xb.ceil(e),Wi(e.getFullYear()%1e4,n,4)}function JBe(e){var n=e.getTimezoneOffset();return(n>0?"-":(n*=-1,"+"))+Wi(n/60|0,"0",2)+Wi(n%60,"0",2)}function sG(e,n){return Wi(e.getUTCDate(),n,2)}function eFe(e,n){return Wi(e.getUTCHours(),n,2)}function tFe(e,n){return Wi(e.getUTCHours()%12||12,n,2)}function nFe(e,n){return Wi(1+sA.count(Xm(e),e),n,3)}function Zse(e,n){return Wi(e.getUTCMilliseconds(),n,3)}function iFe(e,n){return Zse(e,n)+"000"}function rFe(e,n){return Wi(e.getUTCMonth()+1,n,2)}function oFe(e,n){return Wi(e.getUTCMinutes(),n,2)}function sFe(e,n){return Wi(e.getUTCSeconds(),n,2)}function aFe(e){var n=e.getUTCDay();return n===0?7:n}function lFe(e,n){return Wi(lA.count(Xm(e)-1,e),n,2)}function Jse(e){var n=e.getUTCDay();return n>=4||n===0?Qb(e):Qb.ceil(e)}function cFe(e,n){return e=Jse(e),Wi(Qb.count(Xm(e),e)+(Xm(e).getUTCDay()===4),n,2)}function dFe(e){return e.getUTCDay()}
7783function uFe(e,n){return Wi(NI.count(Xm(e)-1,e),n,2)}function pFe(e,n){return Wi(e.getUTCFullYear()%100,n,2)}function mFe(e,n){return e=Jse(e),Wi(e.getUTCFullYear()%100,n,2)}function hFe(e,n){return Wi(e.getUTCFullYear()%1e4,n,4)}function fFe(e,n){var i=e.getUTCDay();return e=i>=4||i===0?Qb(e):Qb.ceil(e),Wi(e.getUTCFullYear()%1e4,n,4)}function gFe(){return"+0000"}function aG(){return"%"}function lG(e){return+e}function cG(e){return Math.floor(+e/1e3)}var cx,eae,tae;yFe({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function yFe(e){return cx=yBe(e),eae=cx.format,cx.parse,tae=cx.utcFormat,cx.utcParse,cx}function xFe(e){return new Date(e)}function bFe(e){return e instanceof Date?+e:+new Date(+e)}function zR(e,n,i,r,o,s,a,c,u,m){var h=xR(),g=h.invert,x=h.domain,y=m(".%L"),w=m(":%S"),j=m("%I:%M"),v=m("%I %p"),_=m("%a %d"),$=m("%b %d"),k=m("%B"),P=m("%Y");function S(I){return(u(I)<I?y:c(I)<I?w:a(I)<I?j:s(I)<I?v:r(I)<I?o(I)<I?_:$:i(I)<I?k:P)(I)}return h.invert=function(I){return new Date(g(I))},h.domain=function(I){return arguments.length?x(Array.from(I,bFe)):x().map(xFe)},h.ticks=function(I){var A=x();return e(A[0],A[A.length-1],I??10)},h.tickFormat=function(I,A){return A==null?S:m(A)},h.nice=function(I){var A=x();return(!I||typeof I.range!="function")&&(I=n(A[0],A[A.length-1],I??10)),I?x(Fse(A,I)):h},h.copy=function(){return xC(h,zR(e,n,i,r,o,s,a,c,u,m))},h}function vFe(){return Fd.apply(zR(fBe,gBe,Ym,AR,aA,bC,IR,kR,iy,eae).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function wFe(){return Fd.apply(zR(mBe,hBe,Xm,NR,lA,sA,PR,$R,iy,tae).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function cA(){var e=0,n=1,i,r,o,s,a=fl,c=!1,u;function m(g){return g==null||isNaN(g=+g)?u:a(o===0?.5:(g=(s(g)-i)*o,c?Math.max(0,Math.min(1,g)):g))}m.domain=function(g){return arguments.length?([e,n]=g,i=s(e=+e),r=s(n=+n),o=i===r?0:1/(r-i),m):[e,n]},m.clamp=function(g){return arguments.length?(c=!!g,m):c},m.interpolator=function(g){return arguments.length?(a=g,m):a};function h(g){return function(x){var y,w;return arguments.length?([y,w]=x,a=g(y,w),m):[a(0),a(1)]}}return m.range=h(f1),m.rangeRound=h(yR),m.unknown=function(g){return arguments.length?(u=g,m):u},function(g){return s=g,i=g(e),r=g(n),o=i===r?0:1/(r-i),m}}function Ff(e,n){return n.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function nae(){var e=Bf(cA()(fl));return e.copy=function(){return Ff(e,nae())},lh.apply(e,arguments)}function iae(){var e=wR(cA()).domain([1,10]);return e.copy=function(){return Ff(e,iae()).base(e.base())},lh.apply(e,arguments)}function rae(){var e=jR(cA());return e.copy=function(){return Ff(e,rae()).constant(e.constant())},lh.apply(e,arguments)}function TR(){var e=_R(cA());return e.copy=function(){return Ff(e,TR()).exponent(e.exponent())},lh.apply(e,arguments)}function jFe(){return TR.apply(null,arguments).exponent(.5)}function oae(){var e=[],n=fl;function i(r){if(r!=null&&!isNaN(r=+r))return n((gC(e,r,1)-1)/(e.length-1))}return i.domain=function(r){if(!arguments.length)return e.slice();e=[];for(let o of r)o!=null&&!isNaN(o=+o)&&e.push(o);return e.sort(wf),i},i.interpolator=function(r){return arguments.length?(n=r,i):n},i.range=function(){return e.map((r,o)=>n(o/(e.length-1)))},i.quantiles=function(r){return Array.from({length:r+1},(o,s)=>a9e(e,s/r))},i.copy=function(){return oae(n).domain(e)},lh.apply(i,arguments)}function dA(){var e=0,n=.5,i=1,r=1,o,s,a,c,u,m=fl,h,g=!1,x;function y(j){return isNaN(j=+j)?x:(j=.5+((j=+h(j))-s)*(r*j<r*s?c:u),m(g?Math.max(0,Math.min(1,j)):j))}y.domain=function(j){return arguments.length?([e,n,i]=j,o=h(e=+e),s=h(n=+n),a=h(i=+i),c=o===s?0:.5/(s-o),u=s===a?0:.5/(a-s),r=s<o?-1:1,y):[e,n,i]},y.clamp=function(j){return arguments.length?(g=!!j,y):g},y.interpolator=function(j){return arguments.length?(m=j,y):m};function w(j){return function(v){var _,$,k;return arguments.length?([_,$,k]=v,m=E9e(j,[_,$,k]),y):[m(0),m(.5),m(1)]}}return y.range=w(f1),y.rangeRound=w(yR),y.unknown=function(j){return arguments.length?(x=j,y):x},function(j){return h=j,o=j(e),s=j(n),a=j(i),c=o===s?0:.5/(s-o),u=s===a?0:.5/(a-s),r=s<o?-1:1,y}}function sae(){var e=Bf(dA()(fl));return e.copy=function(){return Ff(e,sae())},lh.apply(e,arguments)}function aae(){var e=wR(dA()).domain([.1,1,10]);return e.copy=function(){return Ff(e,aae()).base(e.base())},lh.apply(e,arguments)}function lae(){var e=jR(dA());return e.copy=function(){return Ff(e,lae()).constant(e.constant())},lh.apply(e,arguments)}function ER(){var e=_R(dA());return e.copy=function(){return Ff(e,ER()).exponent(e.exponent())},lh.apply(e,arguments)}function _Fe(){return ER.apply(null,arguments).exponent(.5)}const Vj=Object.freeze(Object.defineProperty({__proto__:null,scaleBand:hR,scaleDiverging:sae,scaleDivergingLog:aae,scaleDivergingPow:ER,scaleDivergingSqrt:_Fe,scaleDivergingSymlog:lae,scaleIdentity:Bse,scaleImplicit:F3,scaleLinear:Lse,scaleLog:Wse,scaleOrdinal:mR,scalePoint:d9e,scalePow:CR,scaleQuantile:qse,scaleQuantize:Gse,scaleRadial:Hse,scaleSequential:nae,scaleSequentialLog:iae,scaleSequentialPow:TR,scaleSequentialQuantile:oae,scaleSequentialSqrt:jFe,scaleSequentialSymlog:rae,scaleSqrt:iBe,scaleSymlog:Use,scaleThreshold:Vse,scaleTime:vFe,scaleUtc:wFe,tickFormat:Dse},Symbol.toStringTag,{value:"Module"}));var ch=e=>e.chartData,uA=_t([ch],e=>{var n=e.chartData!=null?e.chartData.length-1:0;return{chartData:e.chartData,computedData:e.computedData,dataEndIndex:n,dataStartIndex:0}}),MR=(e,n,i,r)=>r?uA(e):ch(e),cae=(e,n,i)=>i?uA(e):ch(e);function Af(e){if(Array.isArray(e)&&e.length===2){var[n,i]=e;if(Vi(n)&&Vi(i))return!0}return!1}function dG(e,n,i){return i?e:[Math.min(e[0],n[0]),Math.max(e[1],n[1])]}function dae(e,n){if(n&&typeof e!="function"&&Array.isArray(e)&&e.length===2){var[i,r]=e,o,s;if(Vi(i))o=i;else if(typeof i=="function")return;if(Vi(r))s=r;else if(typeof r=="function")return;var a=[o,s];if(Af(a))return a}}function CFe(e,n,i){if(!(!i&&n==null)){if(typeof e=="function"&&n!=null)try{var r=e(n,i);if(Af(r))return dG(r,n,i)}catch{}if(Array.isArray(e)&&e.length===2){var[o,s]=e,a,c;if(o==="auto")n!=null&&(a=Math.min(...n));else if(fn(o))a=o;else if(typeof o=="function")try{n!=null&&(a=o(n?.[0]))}catch{}
7783else if(typeof o=="string"&&wH.test(o)){var u=wH.exec(o);if(u==null||u[1]==null||n==null)a=void 0;else{var m=+u[1];a=n[0]-m}}else a=n?.[0];if(s==="auto")n!=null&&(c=Math.max(...n));else if(fn(s))c=s;else if(typeof s=="function")try{n!=null&&(c=s(n?.[1]))}catch{}else if(typeof s=="string"&&jH.test(s)){var h=jH.exec(s);if(h==null||h[1]==null||n==null)c=void 0;else{var g=+h[1];c=n[1]+g}}else c=n?.[1];var x=[a,c];if(Af(x))return n==null?x:dG(x,n,i)}}}var g1=1e9,SFe={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},OR,ao=!0,Od="[DecimalError] ",uy=Od+"Invalid argument: ",RR=Od+"Exponent out of range: ",y1=Math.floor,Xg=Math.pow,kFe=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,Mc,Fs=1e7,Jr=7,uae=9007199254740991,zI=y1(uae/Jr),jn={};jn.absoluteValue=jn.abs=function(){var e=new this.constructor(this);return e.s&&(e.s=1),e};jn.comparedTo=jn.cmp=function(e){var n,i,r,o,s=this;if(e=new s.constructor(e),s.s!==e.s)return s.s||-e.s;if(s.e!==e.e)return s.e>e.e^s.s<0?1:-1;for(r=s.d.length,o=e.d.length,n=0,i=r<o?r:o;n<i;++n)if(s.d[n]!==e.d[n])return s.d[n]>e.d[n]^s.s<0?1:-1;return r===o?0:r>o^s.s<0?1:-1};jn.decimalPlaces=jn.dp=function(){var e=this,n=e.d.length-1,i=(n-e.e)*Jr;if(n=e.d[n],n)for(;n%10==0;n/=10)i--;return i<0?0:i};jn.dividedBy=jn.div=function(e){return Rm(this,new this.constructor(e))};jn.dividedToIntegerBy=jn.idiv=function(e){var n=this,i=n.constructor;return Nr(Rm(n,new i(e),0,1),i.precision)};jn.equals=jn.eq=function(e){return!this.cmp(e)};jn.exponent=function(){return ls(this)};jn.greaterThan=jn.gt=function(e){return this.cmp(e)>0};jn.greaterThanOrEqualTo=jn.gte=function(e){return this.cmp(e)>=0};jn.isInteger=jn.isint=function(){return this.e>this.d.length-2};jn.isNegative=jn.isneg=function(){return this.s<0};jn.isPositive=jn.ispos=function(){return this.s>0};jn.isZero=function(){return this.s===0};jn.lessThan=jn.lt=function(e){return this.cmp(e)<0};jn.lessThanOrEqualTo=jn.lte=function(e){return this.cmp(e)<1};jn.logarithm=jn.log=function(e){var n,i=this,r=i.constructor,o=r.precision,s=o+5;if(e===void 0)e=new r(10);else if(e=new r(e),e.s<1||e.eq(Mc))throw Error(Od+"NaN");if(i.s<1)throw Error(Od+(i.s?"NaN":"-Infinity"));return i.eq(Mc)?new r(0):(ao=!1,n=Rm(O_(i,s),O_(e,s),s),ao=!0,Nr(n,o))};jn.minus=jn.sub=function(e){var n=this;return e=new n.constructor(e),n.s==e.s?hae(n,e):pae(n,(e.s=-e.s,e))};jn.modulo=jn.mod=function(e){var n,i=this,r=i.constructor,o=r.precision;if(e=new r(e),!e.s)throw Error(Od+"NaN");return i.s?(ao=!1,n=Rm(i,e,0,1).times(e),ao=!0,i.minus(n)):Nr(new r(i),o)};jn.naturalExponential=jn.exp=function(){return mae(this)};jn.naturalLogarithm=jn.ln=function(){return O_(this)};jn.negated=jn.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};jn.plus=jn.add=function(e){var n=this;return e=new n.constructor(e),n.s==e.s?pae(n,e):hae(n,(e.s=-e.s,e))};jn.precision=jn.sd=function(e){var n,i,r,o=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(uy+e);if(n=ls(o)+1,r=o.d.length-1,i=r*Jr+1,r=o.d[r],r){for(;r%10==0;r/=10)i--;for(r=o.d[0];r>=10;r/=10)i++}return e&&n>i?n:i};jn.squareRoot=jn.sqrt=function(){var e,n,i,r,o,s,a,c=this,u=c.constructor;if(c.s<1){if(!c.s)return new u(0);throw Error(Od+"NaN")}for(e=ls(c),ao=!1,o=Math.sqrt(+c),o==0||o==1/0?(n=kp(c.d),(n.length+e)%2==0&&(n+="0"),o=Math.sqrt(n),e=y1((e+1)/2)-(e<0||e%2),o==1/0?n="5e"+e:(n=o.toExponential(),n=n.slice(0,n.indexOf("e")+1)+e),r=new u(n)):r=new u(o.toString()),i=u.precision,o=a=i+3;;)if(s=r,r=s.plus(Rm(c,s,a+2)).times(.5),kp(s.d).slice(0,a)===(n=kp(r.d)).slice(0,a)){if(n=n.slice(a-3,a+1),o==a&&n=="4999"){if(Nr(s,i+1,0),s.times(s).eq(c)){r=s;break}}else if(n!="9999")break;a+=4}return ao=!0,Nr(r,i)};jn.times=jn.mul=function(e){var n,i,r,o,s,a,c,u,m,h=this,g=h.constructor,x=h.d,y=(e=new g(e)).d;if(!h.s||!e.s)return new g(0);for(e.s*=h.s,i=h.e+e.e,u=x.length,m=y.length,u<m&&(s=x,x=y,y=s,a=u,u=m,m=a),s=[],a=u+m,r=a;r--;)s.push(0);for(r=m;--r>=0;){for(n=0,o=u+r;o>r;)c=s[o]+y[r]*x[o-r-1]+n,s[o--]=c%Fs|0,n=c/Fs|0;s[o]=(s[o]+n)%Fs|0}for(;!s[--a];)s.pop();return n?++i:s.shift(),e.d=s,e.e=i,ao?Nr(e,g.precision):e};jn.toDecimalPlaces=jn.todp=function(e,n){var i=this,r=i.constructor;return i=new r(i),e===void 0?i:(zp(e,0,g1),n===void 0?n=r.rounding:zp(n,0,8),Nr(i,e+ls(i)+1,n))};jn.toExponential=function(e,n){var i,r=this,o=r.constructor;
vendor: 9,641 bytes, line 7783
7783return e===void 0?i=zy(r,!0):(zp(e,0,g1),n===void 0?n=o.rounding:zp(n,0,8),r=Nr(new o(r),e+1,n),i=zy(r,!0,e+1)),i};jn.toFixed=function(e,n){var i,r,o=this,s=o.constructor;return e===void 0?zy(o):(zp(e,0,g1),n===void 0?n=s.rounding:zp(n,0,8),r=Nr(new s(o),e+ls(o)+1,n),i=zy(r.abs(),!1,e+ls(r)+1),o.isneg()&&!o.isZero()?"-"+i:i)};jn.toInteger=jn.toint=function(){var e=this,n=e.constructor;return Nr(new n(e),ls(e)+1,n.rounding)};jn.toNumber=function(){return+this};jn.toPower=jn.pow=function(e){var n,i,r,o,s,a,c=this,u=c.constructor,m=12,h=+(e=new u(e));if(!e.s)return new u(Mc);if(c=new u(c),!c.s){if(e.s<1)throw Error(Od+"Infinity");return c}if(c.eq(Mc))return c;if(r=u.precision,e.eq(Mc))return Nr(c,r);if(n=e.e,i=e.d.length-1,a=n>=i,s=c.s,a){if((i=h<0?-h:h)<=uae){for(o=new u(Mc),n=Math.ceil(r/Jr+4),ao=!1;i%2&&(o=o.times(c),pG(o.d,n)),i=y1(i/2),i!==0;)c=c.times(c),pG(c.d,n);return ao=!0,e.s<0?new u(Mc).div(o):Nr(o,r)}}else if(s<0)throw Error(Od+"NaN");return s=s<0&&e.d[Math.max(n,i)]&1?-1:1,c.s=1,ao=!1,o=e.times(O_(c,r+m)),ao=!0,o=mae(o),o.s=s,o};jn.toPrecision=function(e,n){var i,r,o=this,s=o.constructor;return e===void 0?(i=ls(o),r=zy(o,i<=s.toExpNeg||i>=s.toExpPos)):(zp(e,1,g1),n===void 0?n=s.rounding:zp(n,0,8),o=Nr(new s(o),e,n),i=ls(o),r=zy(o,e<=i||i<=s.toExpNeg,e)),r};jn.toSignificantDigits=jn.tosd=function(e,n){var i=this,r=i.constructor;return e===void 0?(e=r.precision,n=r.rounding):(zp(e,1,g1),n===void 0?n=r.rounding:zp(n,0,8)),Nr(new r(i),e,n)};jn.toString=jn.valueOf=jn.val=jn.toJSON=jn[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,n=ls(e),i=e.constructor;return zy(e,n<=i.toExpNeg||n>=i.toExpPos)};function pae(e,n){var i,r,o,s,a,c,u,m,h=e.constructor,g=h.precision;if(!e.s||!n.s)return n.s||(n=new h(e)),ao?Nr(n,g):n;if(u=e.d,m=n.d,a=e.e,o=n.e,u=u.slice(),s=a-o,s){for(s<0?(r=u,s=-s,c=m.length):(r=m,o=a,c=u.length),a=Math.ceil(g/Jr),c=a>c?a+1:c+1,s>c&&(s=c,r.length=1),r.reverse();s--;)r.push(0);r.reverse()}for(c=u.length,s=m.length,c-s<0&&(s=c,r=m,m=u,u=r),i=0;s;)i=(u[--s]=u[s]+m[s]+i)/Fs|0,u[s]%=Fs;for(i&&(u.unshift(i),++o),c=u.length;u[--c]==0;)u.pop();return n.d=u,n.e=o,ao?Nr(n,g):n}function zp(e,n,i){if(e!==~~e||e<n||e>i)throw Error(uy+e)}function kp(e){var n,i,r,o=e.length-1,s="",a=e[0];if(o>0){for(s+=a,n=1;n<o;n++)r=e[n]+"",i=Jr-r.length,i&&(s+=lf(i)),s+=r;a=e[n],r=a+"",i=Jr-r.length,i&&(s+=lf(i))}else if(a===0)return"0";for(;a%10===0;)a/=10;return s+a}var Rm=(function(){function e(r,o){var s,a=0,c=r.length;for(r=r.slice();c--;)s=r[c]*o+a,r[c]=s%Fs|0,a=s/Fs|0;return a&&r.unshift(a),r}function n(r,o,s,a){var c,u;if(s!=a)u=s>a?1:-1;else for(c=u=0;c<s;c++)if(r[c]!=o[c]){u=r[c]>o[c]?1:-1;break}return u}function i(r,o,s){for(var a=0;s--;)r[s]-=a,a=r[s]<o[s]?1:0,r[s]=a*Fs+r[s]-o[s];for(;!r[0]&&r.length>1;)r.shift()}return function(r,o,s,a){var c,u,m,h,g,x,y,w,j,v,_,$,k,P,S,I,A,E,B=r.constructor,T=r.s==o.s?1:-1,M=r.d,R=o.d;if(!r.s)return new B(r);if(!o.s)throw Error(Od+"Division by zero");for(u=r.e-o.e,A=R.length,S=M.length,y=new B(T),w=y.d=[],m=0;R[m]==(M[m]||0);)++m;if(R[m]>(M[m]||0)&&--u,s==null?$=s=B.precision:a?$=s+(ls(r)-ls(o))+1:$=s,$<0)return new B(0);if($=$/Jr+2|0,m=0,A==1)for(h=0,R=R[0],$++;(m<S||h)&&$--;m++)k=h*Fs+(M[m]||0),w[m]=k/R|0,h=k%R|0;else{for(h=Fs/(R[0]+1)|0,h>1&&(R=e(R,h),M=e(M,h),A=R.length,S=M.length),P=A,j=M.slice(0,A),v=j.length;v<A;)j[v++]=0;E=R.slice(),E.unshift(0),I=R[0],R[1]>=Fs/2&&++I;do h=0,c=n(R,j,A,v),c<0?(_=j[0],A!=v&&(_=_*Fs+(j[1]||0)),h=_/I|0,h>1?(h>=Fs&&(h=Fs-1),g=e(R,h),x=g.length,v=j.length,c=n(g,j,x,v),c==1&&(h--,i(g,A<x?E:R,x))):(h==0&&(c=h=1),g=R.slice()),x=g.length,x<v&&g.unshift(0),i(j,g,v),c==-1&&(v=j.length,c=n(R,j,A,v),c<1&&(h++,i(j,A<v?E:R,v))),v=j.length):c===0&&(h++,j=[0]),w[m++]=h,c&&j[0]?j[v++]=M[P]||0:(j=[M[P]],v=1);while((P++<S||j[0]!==void 0)&&$--)}return w[0]||w.shift(),y.e=u,Nr(y,a?s+ls(y)+1:s)}})();function mae(e,n){var i,r,o,s,a,c,u=0,m=0,h=e.constructor,g=h.precision;if(ls(e)>16)throw Error(RR+ls(e));if(!e.s)return new h(Mc);for(ao=!1,c=g,a=new h(.03125);e.abs().gte(.1);)e=e.times(a),m+=5;for(r=Math.log(Xg(2,m))/Math.LN10*2+5|0,c+=r,i=o=s=new h(Mc),h.precision=c;;){if(o=Nr(o.times(e),c),i=i.times(++u),a=s.plus(Rm(o,i,c)),kp(a.d).slice(0,c)===kp(s.d).slice(0,c)){for(;m--;)s=Nr(s.times(s),c);return h.precision=g,n==null?(ao=!0,Nr(s,g)):s}s=a}}function ls(e){for(var n=e.e*Jr,i=e.d[0];i>=10;i/=10)n++;return n}function m6(e,n,i){if(n>e.LN10.sd())throw ao=!0,i&&(e.precision=i),Error(Od+"LN10 precision limit exceeded");return Nr(new e(e.LN10),n)}function lf(e){for(var n="";e--;)n+="0";return n}function O_(e,n){var i,r,o,s,a,c,u,m,h,g=1,x=10,y=e,w=y.d,j=y.constructor,v=j.precision;if(y.s<1)throw Error(Od+(y.s?"NaN":"-Infinity"));if(y.eq(Mc))return new j(0);if(n==null?(ao=!1,m=v):m=n,y.eq(10))return n==null&&(ao=!0),m6(j,m);if(m+=x,j.precision=m,i=kp(w),r=i.charAt(0),s=ls(y),Math.abs(s)<15e14){for(;r<7&&r!=1||r==1&&i.charAt(1)>3;)y=y.times(e),i=kp(y.d),r=i.charAt(0),g++;s=ls(y),r>1?(y=new j("0."+i),s++):y=new j(r+"."+i.slice(1))}else return u=m6(j,m+2,v).times(s+""),y=O_(new j(r+"."+i.slice(1)),m-x).plus(u),j.precision=v,n==null?(ao=!0,Nr(y,v)):y;for(c=a=y=Rm(y.minus(Mc),y.plus(Mc),m),h=Nr(y.times(y),m),o=3;;){if(a=Nr(a.times(h),m),u=c.plus(Rm(a,new j(o),m)),kp(u.d).slice(0,m)===kp(c.d).slice(0,m))return c=c.times(2),s!==0&&(c=c.plus(m6(j,m+2,v).times(s+""))),c=Rm(c,new j(g),m),j.precision=v,n==null?(ao=!0,Nr(c,v)):c;c=u,o+=2}}function uG(e,n){var i,r,o;for((i=n.indexOf("."))>-1&&(n=n.replace(".","")),(r=n.search(/e/i))>0?(i<0&&(i=r),i+=+n.slice(r+1),n=n.substring(0,r)):i<0&&(i=n.length),r=0;n.charCodeAt(r)===48;)++r;for(o=n.length;n.charCodeAt(o-1)===48;)--o;if(n=n.slice(r,o),n){if(o-=r,i=i-r-1,e.e=y1(i/Jr),e.d=[],r=(i+1)%Jr,i<0&&(r+=Jr),r<o){for(r&&e.d.push(+n.slice(0,r)),o-=Jr;r<o;)e.d.push(+n.slice(r,r+=Jr));n=n.slice(r),r=Jr-n.length}else r-=o;for(;r--;)n+="0";if(e.d.push(+n),ao&&(e.e>zI||e.e<-zI))throw Error(RR+i)}else e.s=0,e.e=0,e.d=[0];return e}function Nr(e,n,i){var r,o,s,a,c,u,m,h,g=e.d;for(a=1,s=g[0];s>=10;s/=10)a++;if(r=n-a,r<0)r+=Jr,o=n,m=g[h=0];else{if(h=Math.ceil((r+1)/Jr),s=g.length,h>=s)return e;for(m=s=g[h],a=1;s>=10;s/=10)a++;r%=Jr,o=r-Jr+a}if(i!==void 0&&(s=Xg(10,a-o-1),c=m/s%10|0,u=n<0||g[h+1]!==void 0||m%s,u=i<4?(c||u)&&(i==0||i==(e.s<0?3:2)):c>5||c==5&&(i==4||u||i==6&&(r>0?o>0?m/Xg(10,a-o):0:g[h-1])%10&1||i==(e.s<0?8:7))),n<1||!g[0])return u?(s=ls(e),g.length=1,n=n-s-1,g[0]=Xg(10,(Jr-n%Jr)%Jr),e.e=y1(-n/Jr)||0):(g.length=1,g[0]=e.e=e.s=0),e;if(r==0?(g.length=h,s=1,h--):(g.length=h+1,s=Xg(10,Jr-r),g[h]=o>0?(m/Xg(10,a-o)%Xg(10,o)|0)*s:0),u)for(;;)if(h==0){(g[0]+=s)==Fs&&(g[0]=1,++e.e);break}else{if(g[h]+=s,g[h]!=Fs)break;g[h--]=0,s=1}for(r=g.length;g[--r]===0;)g.pop();if(ao&&(e.e>zI||e.e<-zI))throw Error(RR+ls(e));return e}function hae(e,n){var i,r,o,s,a,c,u,m,h,g,x=e.constructor,y=x.precision;if(!e.s||!n.s)return n.s?n.s=-n.s:n=new x(e),ao?Nr(n,y):n;if(u=e.d,g=n.d,r=n.e,m=e.e,u=u.slice(),a=m-r,a){for(h=a<0,h?(i=u,a=-a,c=g.length):(i=g,r=m,c=u.length),o=Math.max(Math.ceil(y/Jr),c)+2,a>o&&(a=o,i.length=1),i.reverse(),o=a;o--;)i.push(0);i.reverse()}else{for(o=u.length,c=g.length,h=o<c,h&&(c=o),o=0;o<c;o++)if(u[o]!=g[o]){h=u[o]<g[o];break}a=0}for(h&&(i=u,u=g,g=i,n.s=-n.s),c=u.length,o=g.length-c;o>0;--o)u[c++]=0;for(o=g.length;o>a;){if(u[--o]<g[o]){for(s=o;s&&u[--s]===0;)u[s]=Fs-1;--u[s],u[o]+=Fs}u[o]-=g[o]}for(;u[--c]===0;)u.pop();for(;u[0]===0;u.shift())--r;return u[0]?(n.d=u,n.e=r,ao?Nr(n,y):n):new x(0)}function zy(e,n,i){var r,o=ls(e),s=kp(e.d),a=s.length;return n?(i&&(r=i-a)>0?s=s.charAt(0)+"."+s.slice(1)+lf(r):a>1&&(s=s.charAt(0)+"."+s.slice(1)),s=s+(o<0?"e":"e+")+o):o<0?(s="0."+lf(-o-1)+s,i&&(r=i-a)>0&&(s+=lf(r))):o>=a?(s+=lf(o+1-a),i&&(r=i-o-1)>0&&(s=s+"."+lf(r))):((r=o+1)<a&&(s=s.slice(0,r)+"."+s.slice(r)),i&&(r=i-a)>0&&(o+1===a&&(s+="."),s+=lf(r))),e.s<0?"-"+s:s}function pG(e,n){if(e.length>n)return e.length=n,!0}function fae(e){var n,i,r;function o(s){var a=this;if(!(a instanceof o))return new o(s);if(a.constructor=o,s instanceof o){a.s=s.s,a.e=s.e,a.d=(s=s.d)?s.slice():s;return}if(typeof s=="number"){if(s*0!==0)throw Error(uy+s);if(s>0)a.s=1;else if(s<0)s=-s,a.s=-1;else{a.s=0,a.e=0,a.d=[0];return}if(s===~~s&&s<1e7){a.e=0,a.d=[s];return}return uG(a,s.toString())}else if(typeof s!="string")throw Error(uy+s);if(s.charCodeAt(0)===45?(s=s.slice(1),a.s=-1):a.s=1,kFe.test(s))uG(a,s);else throw Error(uy+s)}if(o.prototype=jn,o.ROUND_UP=0,o.ROUND_DOWN=1,o.ROUND_CEIL=2,o.ROUND_FLOOR=3,o.ROUND_HALF_UP=4,o.ROUND_HALF_DOWN=5,o.ROUND_HALF_EVEN=6,o.ROUND_HALF_CEIL=7,o.ROUND_HALF_FLOOR=8,o.clone=fae,o.config=o.set=$Fe,e===void 0&&(e={}),e)for(r=["precision","rounding","toExpNeg","toExpPos","LN10"],n=0;n<r.length;)e.hasOwnProperty(i=r[n++])||(e[i]=this[i]);return o.config(e),o}function $Fe(e){if(!e||typeof e!="object")throw Error(Od+"Object expected");var n,i,r,o=["precision",1,g1,"rounding",0,8,"toExpNeg",-1/0,0,"toExpPos",0,1/0];for(n=0;n<o.length;n+=3)if((r=e[i=o[n]])!==void 0)if(y1(r)===r&&r>=o[n+1]&&r<=o[n+2])this[i]=r;else throw Error(uy+i+": "+r);if((r=e[i="LN10"])!==void 0)if(r==Math.LN10)this[i]=new this(r);else throw Error(uy+i+": "+r);return this}var OR=fae(SFe);Mc=new OR(1);const ur=OR;var IFe=e=>e,gae={},yae=e=>e===gae,mG=e=>function n(){return arguments.length===0||arguments.length===1&&yae(arguments.length<=0?void 0:arguments[0])?n:e(...arguments)},xae=(e,n)=>e===1?n:mG(function(){for(var i=arguments.length,r=new Array(i),o=0;o<i;o++)r[o]=arguments[o];var s=r.filter(a=>a!==gae).length;return s>=e?n(...r):xae(e-s,mG(function(){for(var a=arguments.length,c=new Array(a),u=0;u<a;u++)c[u]=arguments[u];var m=r.map(h=>yae(h)?c.shift():h);return n(...m,...c)}))}),PFe=e=>
7783xae(e.length,e),q3=(e,n)=>{for(var i=[],r=e;r<n;++r)i[r-e]=r;return i},AFe=PFe((e,n)=>Array.isArray(n)?n.map(e):Object.keys(n).map(i=>n[i]).map(e)),NFe=function(){for(var n=arguments.length,i=new Array(n),r=0;r<n;r++)i[r]=arguments[r];if(!i.length)return IFe;var o=i.reverse(),s=o[0],a=o.slice(1);return function(){return a.reduce((c,u)=>u(c),s(...arguments))}};function bae(e){var n;return e===0?n=1:n=Math.floor(new ur(e).abs().log(10).toNumber())+1,n}function vae(e,n,i){for(var r=new ur(e),o=0,s=[];r.lt(n)&&o<1e5;)s.push(r.toNumber()),r=r.add(i),o++;return s}var wae=e=>{var[n,i]=e,[r,o]=[n,i];return n>i&&([r,o]=[i,n]),[r,o]},jae=(e,n,i)=>{if(e.lte(0))return new ur(0);var r=bae(e.toNumber()),o=new ur(10).pow(r),s=e.div(o),a=r!==1?.05:.1,c=new ur(Math.ceil(s.div(a).toNumber())).add(i).mul(a),u=c.mul(o);return n?new ur(u.toNumber()):new ur(Math.ceil(u.toNumber()))},zFe=(e,n,i)=>{var r=new ur(1),o=new ur(e);if(!o.isint()&&i){var s=Math.abs(e);s<1?(r=new ur(10).pow(bae(e)-1),o=new ur(Math.floor(o.div(r).toNumber())).mul(r)):s>1&&(o=new ur(Math.floor(e)))}else e===0?o=new ur(Math.floor((n-1)/2)):i||(o=new ur(Math.floor(e)));var a=Math.floor((n-1)/2),c=NFe(AFe(u=>o.add(new ur(u-a).mul(r)).toNumber()),q3);return c(0,n)},_ae=function(n,i,r,o){var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((i-n)/(r-1)))return{step:new ur(0),tickMin:new ur(0),tickMax:new ur(0)};var a=jae(new ur(i).sub(n).div(r-1),o,s),c;n<=0&&i>=0?c=new ur(0):(c=new ur(n).add(i).div(2),c=c.sub(new ur(c).mod(a)));var u=Math.ceil(c.sub(n).div(a).toNumber()),m=Math.ceil(new ur(i).sub(c).div(a).toNumber()),h=u+m+1;return h>r?_ae(n,i,r,o,s+1):(h<r&&(m=i>0?m+(r-h):m,u=i>0?u:u+(r-h)),{step:a,tickMin:c.sub(new ur(u).mul(a)),tickMax:c.add(new ur(m).mul(a))})},TFe=function(n){var[i,r]=n,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,a=Math.max(o,2),[c,u]=wae([i,r]);if(c===-1/0||u===1/0){var m=u===1/0?[c,...q3(0,o-1).map(()=>1/0)]:[...q3(0,o-1).map(()=>-1/0),u];return i>r?m.reverse():m}if(c===u)return zFe(c,o,s);var{step:h,tickMin:g,tickMax:x}=_ae(c,u,a,s,0),y=vae(g,x.add(new ur(.1).mul(h)),h);return i>r?y.reverse():y},EFe=function(n,i){var[r,o]=n,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,[a,c]=wae([r,o]);if(a===-1/0||c===1/0)return[r,o];if(a===c)return[a];var u=Math.max(i,2),m=jae(new ur(c).sub(a).div(u-1),s,0),h=[...vae(new ur(a),new ur(c),m),c];return s===!1&&(h=h.map(g=>Math.round(g))),r>o?h.reverse():h},Cae=e=>e.rootProps.maxBarSize,MFe=e=>e.rootProps.barGap,Sae=e=>e.rootProps.barCategoryGap,RFe=e=>e.rootProps.barSize,vC=e=>e.rootProps.stackOffset,kae=e=>e.rootProps.reverseStackOrder,DR=e=>e.options.chartName,LR=e=>e.rootProps.syncId,$ae=e=>e.rootProps.syncMethod,BR=e=>e.options.eventEmitter,OFe=e=>e.rootProps.baseValue,zo={grid:-100,barBackground:-50,area:100,cursorRectangle:200,bar:300,line:400,axis:500,scatter:600,activeBar:1e3,cursorLine:1100,activeDot:1200,label:2e3},Pm={allowDuplicatedCategory:!0,angleAxisId:0,reversed:!1,scale:"auto",tick:!0,type:"category"},Ac={allowDataOverflow:!1,allowDuplicatedCategory:!0,radiusAxisId:0,scale:"auto",tick:!0,tickCount:5,type:"number"},pA=(e,n)=>{if(!(!e||!n))return e!=null&&e.reversed?[n[1],n[0]]:n},DFe={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!1,dataKey:void 0,domain:void 0,id:Pm.angleAxisId,includeHidden:!1,name:void 0,reversed:Pm.reversed,scale:Pm.scale,tick:Pm.tick,tickCount:void 0,ticks:void 0,type:Pm.type,unit:void 0},LFe={allowDataOverflow:Ac.allowDataOverflow,allowDecimals:!1,allowDuplicatedCategory:Ac.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:Ac.radiusAxisId,includeHidden:!1,name:void 0,reversed:!1,scale:Ac.scale,tick:Ac.tick,tickCount:Ac.tickCount,ticks:void 0,type:Ac.type,unit:void 0},BFe={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:Pm.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:Pm.angleAxisId,includeHidden:!1,name:void 0,reversed:!1,scale:Pm.scale,tick:Pm.tick,tickCount:void 0,ticks:void 0,type:"number",unit:void 0},FFe={allowDataOverflow:Ac.allowDataOverflow,allowDecimals:!1,allowDuplicatedCategory:Ac.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:Ac.radiusAxisId,includeHidden:!1,name:void 0,reversed:!1,scale:Ac.scale,tick:Ac.tick,tickCount:Ac.tickCount,ticks:void 0,type:"category",unit:void 0},FR=(e,n)=>e.polarAxis.angleAxis[n]!=null?e.polarAxis.angleAxis[n]:e.layout.layoutType==="radial"?BFe:DFe,WR=(e,n)=>e.polarAxis.radiusAxis[n]!=null?e.polarAxis.radiusAxis[n]:e.layout.layoutType==="radial"?FFe:LFe,mA=e=>e.polarOptions,UR=_t([sh,ah,ks],Cse),Iae=_t([mA,UR],(e,n)=>
7783{if(e!=null)return Wa(e.innerRadius,n,0)}),Pae=_t([mA,UR],(e,n)=>{if(e!=null)return Wa(e.outerRadius,n,n*.8)}),WFe=e=>{if(e==null)return[0,0];var{startAngle:n,endAngle:i}=e;return[n,i]},Aae=_t([mA],WFe);_t([FR,Aae],pA);var Nae=_t([UR,Iae,Pae],(e,n,i)=>{if(!(e==null||n==null||i==null))return[n,i]});_t([WR,Nae],pA);var zae=_t([ji,mA,Iae,Pae,sh,ah],(e,n,i,r,o,s)=>{if(!(e!=="centric"&&e!=="radial"||n==null||i==null||r==null)){var{cx:a,cy:c,startAngle:u,endAngle:m}=n;return{cx:Wa(a,o,o/2),cy:Wa(c,s,s/2),innerRadius:i,outerRadius:r,startAngle:u,endAngle:m,clockWise:!1}}}),uo=(e,n)=>n,wC=(e,n,i)=>i;function hA(e){return e?.id}function Tae(e,n,i){var{chartData:r=[]}=n,{allowDuplicatedCategory:o,dataKey:s}=i,a=new Map;return e.forEach(c=>{var u,m=(u=c.data)!==null&&u!==void 0?u:r;if(!(m==null||m.length===0)){var h=hA(c);m.forEach((g,x)=>{var y=s==null||o?x:String(or(g,s,null)),w=or(g,c.dataKey,0),j;a.has(y)?j=a.get(y):j={},Object.assign(j,{[h]:w}),a.set(y,j)})}}),Array.from(a.values())}function fA(e){return"stackId"in e&&e.stackId!=null&&e.dataKey!=null}var gA=(e,n)=>e===n?!0:e==null||n==null?!1:e[0]===n[0]&&e[1]===n[1];function yA(e,n){return Array.isArray(e)&&Array.isArray(n)&&e.length===0&&n.length===0?!0:e===n}function UFe(e,n){if(e.length===n.length){for(var i=0;i<e.length;i++)if(e[i]!==n[i])return!1;return!0}return!1}var Ps=e=>{var n=ji(e);return n==="horizontal"?"xAxis":n==="vertical"?"yAxis":n==="centric"?"angleAxis":"radiusAxis"},x1=e=>e.tooltip.settings.axisId;function hG(e,n){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),i.push.apply(i,r)}return i}function TI(e){for(var n=1;n<arguments.length;n++){var i=arguments[n]!=null?arguments[n]:{};n%2?hG(Object(i),!0).forEach(function(r){HFe(e,r,i[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):hG(Object(i)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(i,r))})}return e}function HFe(e,n,i){return(n=qFe(n))in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i,e}function qFe(e){var n=GFe(e,"string");return typeof n=="symbol"?n:n+""}function GFe(e,n){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,n);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}var G3=[0,"auto"],Ls={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:void 0,height:30,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"bottom",padding:{left:0,right:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"category",unit:void 0},Eae=(e,n)=>e.cartesianAxis.xAxis[n],Op=(e,n)=>{var i=Eae(e,n);return i??Ls},Bs={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:G3,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"left",padding:{top:0,bottom:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"number",unit:void 0,width:pC},Mae=(e,n)=>e.cartesianAxis.yAxis[n],Dp=(e,n)=>{var i=Mae(e,n);return i??Bs},VFe={domain:[0,"auto"],includeHidden:!1,reversed:!1,allowDataOverflow:!1,allowDuplicatedCategory:!1,dataKey:void 0,id:0,name:"",range:[64,64],scale:"auto",type:"number",unit:""},HR=(e,n)=>{var i=e.cartesianAxis.zAxis[n];return i??VFe},_o=(e,n,i)=>{switch(n){case"xAxis":return Op(e,i);case"yAxis":return Dp(e,i);case"zAxis":return HR(e,i);case"angleAxis":return FR(e,i);case"radiusAxis":return WR(e,i);default:throw new Error("Unexpected axis type: ".concat(n))}},KFe=(e,n,i)=>{switch(n){case"xAxis":return Op(e,i);case"yAxis":return Dp(e,i);default:throw new Error("Unexpected axis type: ".concat(n))}},jC=(e,n,i)=>{switch(n){case"xAxis":return Op(e,i);case"yAxis":return Dp(e,i);case"angleAxis":return FR(e,i);case"radiusAxis":return WR(e,i);default:throw new Error("Unexpected axis type: ".concat(n))}},Rae=e=>e.graphicalItems.cartesianItems.some(n=>n.type==="bar")||e.graphicalItems.polarItems.some(n=>n.type==="radialBar");function qR(e,n){return i=>{switch(e){case"xAxis":return"xAxisId"in i&&i.xAxisId===n;case"yAxis":return"yAxisId"in i&&i.yAxisId===n;case"zAxis":return"zAxisId"in i&&i.zAxisId===n;case"angleAxis":return"angleAxisId"in i&&i.angleAxisId===n;case"radiusAxis":return"radiusAxisId"in i&&i.radiusAxisId===n;default:return!1}}}var _C=e=>e.graphicalItems.cartesianItems,YFe=_t([uo,wC],qR),GR=(e,n,i)=>e.filter(i).filter(r=>n?.includeHidden===!0?!0:!r.hide),CC=_t([_C,_o,YFe],GR,{memoizeOptions:{resultEqualityCheck:yA}}),Oae=_t([CC],e=>e.filter(n=>n.type==="area"||n.type==="bar").filter(fA)),Dae=e=>e.filter(n=>!("stackId"in n)||n.stackId===void 0),XFe=_t([CC],Dae),VR=e=>e.map(n=>
7783n.data).filter(Boolean).flat(1),QFe=_t([CC],VR,{memoizeOptions:{resultEqualityCheck:yA}}),KR=(e,n)=>{var{chartData:i=[],dataStartIndex:r,dataEndIndex:o}=n;return e.length>0?e:i.slice(r,o+1)},YR=_t([QFe,MR],KR),XR=(e,n,i)=>n?.dataKey!=null?e.map(r=>({value:or(r,n.dataKey)})):i.length>0?i.map(r=>r.dataKey).flatMap(r=>e.map(o=>({value:or(o,r)}))):e.map(r=>({value:r})),xA=_t([YR,_o,CC],XR);function Lae(e,n){switch(e){case"xAxis":return n.direction==="x";case"yAxis":return n.direction==="y";default:return!1}}function A5(e){if(Md(e)||e instanceof Date){var n=Number(e);if(Vi(n))return n}}function fG(e){if(Array.isArray(e)){var n=[A5(e[0]),A5(e[1])];return Af(n)?n:void 0}var i=A5(e);if(i!=null)return[i,i]}function Qm(e){return e.map(A5).filter(H8e)}function ZFe(e,n,i){return!i||typeof n!="number"||Xl(n)?[]:i.length?Qm(i.flatMap(r=>{var o=or(e,r.dataKey),s,a;if(Array.isArray(o)?[s,a]=o:s=a=o,!(!Vi(s)||!Vi(a)))return[n-s,n+a]})):[]}var As=e=>{var n=Ps(e),i=x1(e);return jC(e,n,i)},SC=_t([As],e=>e?.dataKey),JFe=_t([Oae,MR,As],Tae),Bae=(e,n,i,r)=>{var o={},s=n.reduce((a,c)=>{if(c.stackId==null)return a;var u=a[c.stackId];return u==null&&(u=[]),u.push(c),a[c.stackId]=u,a},o);return Object.fromEntries(Object.entries(s).map(a=>{var[c,u]=a,m=r?[...u].reverse():u,h=m.map(hA);return[c,{stackedData:yOe(e,h,i),graphicalItems:m}]}))},EI=_t([JFe,Oae,vC,kae],Bae),Fae=(e,n,i,r)=>{var{dataStartIndex:o,dataEndIndex:s}=n;if(r==null&&i!=="zAxis"){var a=wOe(e,o,s);if(!(a!=null&&a[0]===0&&a[1]===0))return a}},eWe=_t([_o],e=>e.allowDataOverflow),QR=e=>{var n;if(e==null||!("domain"in e))return G3;if(e.domain!=null)return e.domain;if("ticks"in e&&e.ticks!=null){if(e.type==="number"){var i=Qm(e.ticks);return[Math.min(...i),Math.max(...i)]}if(e.type==="category")return e.ticks.map(String)}return(n=e?.domain)!==null&&n!==void 0?n:G3},ZR=_t([_o],QR),JR=_t([ZR,eWe],dae),tWe=_t([EI,ch,uo,JR],Fae,{memoizeOptions:{resultEqualityCheck:gA}}),bA=e=>e.errorBars,nWe=(e,n,i)=>e.flatMap(r=>n[r.id]).filter(Boolean).filter(r=>Lae(i,r)),MI=function(){for(var n=arguments.length,i=new Array(n),r=0;r<n;r++)i[r]=arguments[r];var o=i.filter(Boolean);if(o.length!==0){var s=o.flat(),a=Math.min(...s),c=Math.max(...s);return[a,c]}},eO=(e,n,i,r,o)=>{var s,a;if(i.length>0&&e.forEach(c=>{i.forEach(u=>{var m,h,g=(m=r[u.id])===null||m===void 0?void 0:m.filter(_=>Lae(o,_)),x=or(c,(h=n.dataKey)!==null&&h!==void 0?h:u.dataKey),y=ZFe(c,x,g);if(y.length>=2){var w=Math.min(...y),j=Math.max(...y);(s==null||w<s)&&(s=w),(a==null||j>a)&&(a=j)}var v=fG(x);v!=null&&(s=s==null?v[0]:Math.min(s,v[0]),a=a==null?v[1]:Math.max(a,v[1]))})}),n?.dataKey!=null&&e.forEach(c=>{var u=fG(or(c,n.dataKey));u!=null&&(s=s==null?u[0]:Math.min(s,u[0]),a=a==null?u[1]:Math.max(a,u[1]))}),Vi(s)&&Vi(a))return[s,a]},iWe=_t([YR,_o,XFe,bA,uo],eO,{memoizeOptions:{resultEqualityCheck:gA}});function rWe(e){var{value:n}=e;if(Md(n)||n instanceof Date)return n}var oWe=(e,n,i)=>{var r=e.map(rWe).filter(o=>o!=null);return i&&(n.dataKey==null||n.allowDuplicatedCategory&&noe(r))?Ise(0,e.length):n.allowDuplicatedCategory?r:Array.from(new Set(r))},Wae=e=>e.referenceElements.dots,b1=(e,n,i)=>e.filter(r=>r.ifOverflow==="extendDomain").filter(r=>n==="xAxis"?r.xAxisId===i:r.yAxisId===i),sWe=_t([Wae,uo,wC],b1),Uae=e=>e.referenceElements.areas,aWe=_t([Uae,uo,wC],b1),Hae=e=>e.referenceElements.lines,lWe=_t([Hae,uo,wC],b1),qae=(e,n)=>{if(e!=null){var i=Qm(e.map(r=>n==="xAxis"?r.x:r.y));if(i.length!==0)return[Math.min(...i),Math.max(...i)]}},cWe=_t(sWe,uo,qae),Gae=(e,n)=>{if(e!=null){var i=Qm(e.flatMap(r=>[n==="xAxis"?r.x1:r.y1,n==="xAxis"?r.x2:r.y2]));if(i.length!==0)return[Math.min(...i),Math.max(...i)]}},dWe=_t([aWe,uo],Gae);function uWe(e){var n;if(e.x!=null)return Qm([e.x]);var i=(n=e.segment)===null||n===void 0?void 0:n.map(r=>r.x);return i==null||i.length===0?[]:Qm(i)}function pWe(e){var n;if(e.y!=null)return Qm([e.y]);var i=(n=e.segment)===null||n===void 0?void 0:n.map(r=>r.y);return i==null||i.length===0?[]:Qm(i)}var Vae=(e,n)=>{if(e!=null){var i=e.flatMap(r=>n==="xAxis"?uWe(r):pWe(r));if(i.length!==0)return[Math.min(...i),Math.max(...i)]}},mWe=_t([lWe,uo],Vae),hWe=_t(cWe,mWe,dWe,(e,n,i)=>MI(e,i,n)),tO=(e,n,i,r,o,s,a,c)=>{if(i!=null)return i;var u=a==="vertical"&&c==="xAxis"||a==="horizontal"&&c==="yAxis",m=u?MI(r,s,o):MI(s,o);return CFe(n,m,e.allowDataOverflow)},fWe=_t([_o,ZR,JR,tWe,iWe,hWe,ji,uo],tO,{memoizeOptions:{resultEqualityCheck:gA}}),gWe=[0,1],nO=(e,n,i,r,o,s,a)=>
7783{if(!((e==null||i==null||i.length===0)&&a===void 0)){var{dataKey:c,type:u}=e,m=Rp(n,s);if(m&&c==null){var h;return Ise(0,(h=i?.length)!==null&&h!==void 0?h:0)}return u==="category"?oWe(r,e,m):o==="expand"?gWe:a}},iO=_t([_o,ji,YR,xA,vC,uo,fWe],nO),Kae=(e,n,i,r,o)=>{if(e!=null){var{scale:s,type:a}=e;if(s==="auto")return n==="radial"&&o==="radiusAxis"?"band":n==="radial"&&o==="angleAxis"?"linear":a==="category"&&r&&(r.indexOf("LineChart")>=0||r.indexOf("AreaChart")>=0||r.indexOf("ComposedChart")>=0&&!i)?"point":a==="category"?"band":"linear";if(typeof s=="string"){var c="scale".concat(sC(s));return c in Vj?c:"point"}}},v1=_t([_o,ji,Rae,DR,uo],Kae);function yWe(e){if(e!=null){if(e in Vj)return Vj[e]();var n="scale".concat(sC(e));if(n in Vj)return Vj[n]()}}function rO(e,n,i,r){if(!(i==null||r==null)){if(typeof e.scale=="function")return e.scale.copy().domain(i).range(r);var o=yWe(n);if(o!=null){var s=o.domain(i).range(r);return pOe(s),s}}}var oO=(e,n,i)=>{var r=QR(n);if(!(i!=="auto"&&i!=="linear")){if(n!=null&&n.tickCount&&Array.isArray(r)&&(r[0]==="auto"||r[1]==="auto")&&Af(e))return TFe(e,n.tickCount,n.allowDecimals);if(n!=null&&n.tickCount&&n.type==="number"&&Af(e))return EFe(e,n.tickCount,n.allowDecimals)}},sO=_t([iO,jC,v1],oO),aO=(e,n,i,r)=>{if(r!=="angleAxis"&&e?.type==="number"&&Af(n)&&Array.isArray(i)&&i.length>0){var o=n[0],s=i[0],a=n[1],c=i[i.length-1];return[Math.min(o,s),Math.max(a,c)]}return n},xWe=_t([_o,iO,sO,uo],aO),bWe=_t(xA,_o,(e,n)=>{if(!(!n||n.type!=="number")){var i=1/0,r=Array.from(Qm(e.map(g=>g.value))).sort((g,x)=>g-x),o=r[0],s=r[r.length-1];if(o==null||s==null)return 1/0;var a=s-o;if(a===0)return 1/0;for(var c=0;c<r.length-1;c++){var u=r[c],m=r[c+1];if(!(u==null||m==null)){var h=m-u;i=Math.min(i,h)}}return i/a}}),Yae=_t(bWe,ji,Sae,ks,(e,n,i,r,o)=>o,(e,n,i,r,o)=>{if(!Vi(e))return 0;var s=n==="vertical"?r.height:r.width;if(o==="gap")return e*s/2;if(o==="no-gap"){var a=Wa(i,e*s),c=e*s/2;return c-a-(c-a)/s*a}return 0}),vWe=(e,n,i)=>{var r=Op(e,n);return r==null||typeof r.padding!="string"?0:Yae(e,"xAxis",n,i,r.padding)},wWe=(e,n,i)=>{var r=Dp(e,n);return r==null||typeof r.padding!="string"?0:Yae(e,"yAxis",n,i,r.padding)},jWe=_t(Op,vWe,(e,n)=>{var i,r;if(e==null)return{left:0,right:0};var{padding:o}=e;return typeof o=="string"?{left:n,right:n}:{left:((i=o.left)!==null&&i!==void 0?i:0)+n,right:((r=o.right)!==null&&r!==void 0?r:0)+n}}),_We=_t(Dp,wWe,(e,n)=>{var i,r;if(e==null)return{top:0,bottom:0};var{padding:o}=e;return typeof o=="string"?{top:n,bottom:n}:{top:((i=o.top)!==null&&i!==void 0?i:0)+n,bottom:((r=o.bottom)!==null&&r!==void 0?r:0)+n}}),CWe=_t([ks,jWe,JP,ZP,(e,n,i)=>i],(e,n,i,r,o)=>{var{padding:s}=r;return o?[s.left,i.width-s.right]:[e.left+n.left,e.left+e.width-n.right]}),SWe=_t([ks,ji,_We,JP,ZP,(e,n,i)=>i],(e,n,i,r,o,s)=>{var{padding:a}=o;return s?[r.height-a.bottom,a.top]:n==="horizontal"?[e.top+e.height-i.bottom,e.top+i.top]:[e.top+i.top,e.top+e.height-i.bottom]}),kC=(e,n,i,r)=>{var o;switch(n){case"xAxis":return CWe(e,i,r);case"yAxis":return SWe(e,i,r);case"zAxis":return(o=HR(e,i))===null||o===void 0?void 0:o.range;case"angleAxis":return Aae(e);case"radiusAxis":return Nae(e,i);default:return}},Xae=_t([_o,kC],pA),Zb=_t([_o,v1,xWe,Xae],rO);_t([CC,bA,uo],nWe);function Qae(e,n){return e.id<n.id?-1:e.id>n.id?1:0}var vA=(e,n)=>n,wA=(e,n,i)=>i,kWe=_t(XP,vA,wA,(e,n,i)=>e.filter(r=>r.orientation===n).filter(r=>r.mirror===i).sort(Qae)),$We=_t(QP,vA,wA,(e,n,i)=>e.filter(r=>r.orientation===n).filter(r=>r.mirror===i).sort(Qae)),Zae=(e,n)=>({width:e.width,height:n.height}),IWe=(e,n)=>{var i=typeof n.width=="number"?n.width:pC;return{width:i,height:e.height}},Jae=_t(ks,Op,Zae),PWe=(e,n,i)=>{switch(n){case"top":return e.top;case"bottom":return i-e.bottom;default:return 0}},AWe=(e,n,i)=>{switch(n){case"left":return e.left;case"right":return i-e.right;default:return 0}},NWe=_t(ah,ks,kWe,vA,wA,(e,n,i,r,o)=>{var s={},a;return i.forEach(c=>{var u=Zae(n,c);a==null&&(a=PWe(n,r,e));var m=r==="top"&&!o||r==="bottom"&&o;s[c.id]=a-Number(m)*u.height,a+=(m?-1:1)*u.height}),s}),zWe=_t(sh,ks,$We,vA,wA,(e,n,i,r,o)=>{var s={},a;
7783return i.forEach(c=>{var u=IWe(n,c);a==null&&(a=AWe(n,r,e));var m=r==="left"&&!o||r==="right"&&o;s[c.id]=a-Number(m)*u.width,a+=(m?-1:1)*u.width}),s}),TWe=(e,n)=>{var i=Op(e,n);if(i!=null)return NWe(e,i.orientation,i.mirror)},EWe=_t([ks,Op,TWe,(e,n)=>n],(e,n,i,r)=>{if(n!=null){var o=i?.[r];return o==null?{x:e.left,y:0}:{x:e.left,y:o}}}),MWe=(e,n)=>{var i=Dp(e,n);if(i!=null)return zWe(e,i.orientation,i.mirror)},RWe=_t([ks,Dp,MWe,(e,n)=>n],(e,n,i,r)=>{if(n!=null){var o=i?.[r];return o==null?{x:0,y:e.top}:{x:o,y:e.top}}}),ele=_t(ks,Dp,(e,n)=>{var i=typeof n.width=="number"?n.width:pC;return{width:i,height:e.height}}),gG=(e,n,i)=>{switch(n){case"xAxis":return Jae(e,i).width;case"yAxis":return ele(e,i).height;default:return}},tle=(e,n,i,r)=>{if(i!=null){var{allowDuplicatedCategory:o,type:s,dataKey:a}=i,c=Rp(e,r),u=n.map(m=>m.value);if(a&&c&&s==="category"&&o&&noe(u))return u}},lO=_t([ji,xA,_o,uo],tle),nle=(e,n,i,r)=>{if(!(i==null||i.dataKey==null)){var{type:o,scale:s}=i,a=Rp(e,r);if(a&&(o==="number"||s!=="auto"))return n.map(c=>c.value)}},cO=_t([ji,xA,jC,uo],nle),yG=_t([ji,KFe,v1,Zb,lO,cO,kC,sO,uo],(e,n,i,r,o,s,a,c,u)=>{if(n!=null){var m=Rp(e,u);return{angle:n.angle,interval:n.interval,minTickGap:n.minTickGap,orientation:n.orientation,tick:n.tick,tickCount:n.tickCount,tickFormatter:n.tickFormatter,ticks:n.ticks,type:n.type,unit:n.unit,axisType:u,categoricalDomain:s,duplicateDomain:o,isCategorical:m,niceTicks:c,range:a,realScaleType:i,scale:r}}}),OWe=(e,n,i,r,o,s,a,c,u)=>{if(!(n==null||r==null)){var m=Rp(e,u),{type:h,ticks:g,tickCount:x}=n,y=i==="scaleBand"&&typeof r.bandwidth=="function"?r.bandwidth()/2:2,w=h==="category"&&r.bandwidth?r.bandwidth()/y:0;w=u==="angleAxis"&&s!=null&&s.length>=2?Vs(s[0]-s[1])*2*w:w;var j=g||o;if(j){var v=j.map((_,$)=>{var k=a?a.indexOf(_):_;return{index:$,coordinate:r(k)+w,value:_,offset:w}});return v.filter(_=>Vi(_.coordinate))}return m&&c?c.map((_,$)=>({coordinate:r(_)+w,value:_,index:$,offset:w})).filter(_=>Vi(_.coordinate)):r.ticks?r.ticks(x).map(_=>({coordinate:r(_)+w,value:_,offset:w})):r.domain().map((_,$)=>({coordinate:r(_)+w,value:a?a[_]:_,index:$,offset:w}))}},ile=_t([ji,jC,v1,Zb,sO,kC,lO,cO,uo],OWe),DWe=(e,n,i,r,o,s,a)=>{if(!(n==null||i==null||r==null||r[0]===r[1])){var c=Rp(e,a),{tickCount:u}=n,m=0;return m=a==="angleAxis"&&r?.length>=2?Vs(r[0]-r[1])*2*m:m,c&&s?s.map((h,g)=>
7783({coordinate:i(h)+m,value:h,index:g,offset:m})):i.ticks?i.ticks(u).map(h=>({coordinate:i(h)+m,value:h,offset:m})):i.domain().map((h,g)=>({coordinate:i(h)+m,value:o?o[h]:h,index:g,offset:m}))}},Tp=_t([ji,jC,Zb,kC,lO,cO,uo],DWe),Ep=_t(_o,Zb,(e,n)=>{if(!(e==null||n==null))return TI(TI({},e),{},{scale:n})}),LWe=_t([_o,v1,iO,Xae],rO);_t((e,n,i)=>HR(e,i),LWe,(e,n)=>{if(!(e==null||n==null))return TI(TI({},e),{},{scale:n})});var BWe=_t([ji,XP,QP],(e,n,i)=>{switch(e){case"horizontal":return n.some(r=>r.reversed)?"right-to-left":"left-to-right";case"vertical":return i.some(r=>r.reversed)?"bottom-to-top":"top-to-bottom";case"centric":case"radial":return"left-to-right";default:return}}),rle=e=>e.options.defaultTooltipEventType,ole=e=>e.options.validateTooltipEventTypes;function sle(e,n,i){if(e==null)return n;var r=e?"axis":"item";return i==null?n:i.includes(r)?r:n}function dO(e,n){var i=rle(e),r=ole(e);return sle(n,i,r)}function FWe(e){return gn(n=>dO(n,e))}var ale=(e,n)=>{var i,r=Number(n);if(!(Xl(r)||n==null))return r>=0?e==null||(i=e[r])===null||i===void 0?void 0:i.value:void 0},WWe=e=>e.tooltip.settings,hf={active:!1,index:null,dataKey:void 0,graphicalItemId:void 0,coordinate:void 0},UWe={itemInteraction:{click:hf,hover:hf},axisInteraction:{click:hf,hover:hf},keyboardInteraction:hf,syncInteraction:{active:!1,index:null,dataKey:void 0,label:void 0,coordinate:void 0,sourceViewBox:void 0,graphicalItemId:void 0},tooltipItemPayloads:[],settings:{shared:void 0,trigger:"hover",axisId:0,active:!1,defaultIndex:void 0}},lle=nc({name:"tooltip",initialState:UWe,reducers:{addTooltipEntrySettings:{reducer(e,n){e.tooltipItemPayloads.push(n.payload)},prepare:oo()},replaceTooltipEntrySettings:{reducer(e,n){var{prev:i,next:r}=n.payload,o=Su(e).tooltipItemPayloads.indexOf(i);o>-1&&(e.tooltipItemPayloads[o]=r)},prepare:oo()},removeTooltipEntrySettings:{reducer(e,n){var i=Su(e).tooltipItemPayloads.indexOf(n.payload);i>-1&&e.tooltipItemPayloads.splice(i,1)},prepare:oo()},setTooltipSettingsState(e,n){e.settings=n.payload},setActiveMouseOverItemIndex(e,n){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.itemInteraction.hover.active=!0,e.itemInteraction.hover.index=n.payload.activeIndex,e.itemInteraction.hover.dataKey=n.payload.activeDataKey,e.itemInteraction.hover.graphicalItemId=n.payload.activeGraphicalItemId,e.itemInteraction.hover.coordinate=n.payload.activeCoordinate},mouseLeaveChart(e){e.itemInteraction.hover.active=!1,e.axisInteraction.hover.active=!1},mouseLeaveItem(e){e.itemInteraction.hover.active=!1},setActiveClickItemIndex(e,n){e.syncInteraction.active=!1,e.itemInteraction.click.active=!0,e.keyboardInteraction.active=!1,e.itemInteraction.click.index=n.payload.activeIndex,e.itemInteraction.click.dataKey=n.payload.activeDataKey,e.itemInteraction.click.graphicalItemId=n.payload.activeGraphicalItemId,e.itemInteraction.click.coordinate=n.payload.activeCoordinate},setMouseOverAxisIndex(e,n){e.syncInteraction.active=!1,e.axisInteraction.hover.active=!0,e.keyboardInteraction.active=!1,e.axisInteraction.hover.index=n.payload.activeIndex,e.axisInteraction.hover.dataKey=n.payload.activeDataKey,e.axisInteraction.hover.coordinate=n.payload.activeCoordinate},setMouseClickAxisIndex(e,n){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.axisInteraction.click.active=!0,e.axisInteraction.click.index=n.payload.activeIndex,e.axisInteraction.click.dataKey=n.payload.activeDataKey,e.axisInteraction.click.coordinate=n.payload.activeCoordinate},setSyncInteraction(e,n){e.syncInteraction=n.payload},setKeyboardInteraction(e,n){e.keyboardInteraction.active=n.payload.active,e.keyboardInteraction.index=n.payload.activeIndex,e.keyboardInteraction.coordinate=n.payload.activeCoordinate}}}),{addTooltipEntrySettings:HWe,replaceTooltipEntrySettings:qWe,removeTooltipEntrySettings:GWe,setTooltipSettingsState:VWe,setActiveMouseOverItemIndex:cle,mouseLeaveItem:KWe,mouseLeaveChart:dle,setActiveClickItemIndex:YWe,setMouseOverAxisIndex:ule,setMouseClickAxisIndex:XWe,setSyncInteraction:V3,setKeyboardInteraction:K3}=lle.actions,QWe=lle.reducer;function xG(e,n){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),i.push.apply(i,r)}return i}function Kk(e){for(var n=1;n<arguments.length;n++){var i=arguments[n]!=null?arguments[n]:{};
7783n%2?xG(Object(i),!0).forEach(function(r){ZWe(e,r,i[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):xG(Object(i)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(i,r))})}return e}function ZWe(e,n,i){return(n=JWe(n))in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i,e}function JWe(e){var n=eUe(e,"string");return typeof n=="symbol"?n:n+""}function eUe(e,n){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,n);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function tUe(e,n,i){return n==="axis"?i==="click"?e.axisInteraction.click:e.axisInteraction.hover:i==="click"?e.itemInteraction.click:e.itemInteraction.hover}function nUe(e){return e.index!=null}var ple=(e,n,i,r)=>{if(n==null)return hf;var o=tUe(e,n,i);if(o==null)return hf;if(o.active)return o;if(e.keyboardInteraction.active)return e.keyboardInteraction;if(e.syncInteraction.active&&e.syncInteraction.index!=null)return e.syncInteraction;var s=e.settings.active===!0;if(nUe(o)){if(s)return Kk(Kk({},o),{},{active:!0})}else if(r!=null)return{active:!0,coordinate:void 0,dataKey:void 0,index:r,graphicalItemId:void 0};return Kk(Kk({},hf),{},{coordinate:o.coordinate})};function iUe(e){if(typeof e=="number")return Number.isFinite(e)?e:void 0;if(e instanceof Date){var n=e.valueOf();return Number.isFinite(n)?n:void 0}var i=Number(e);return Number.isFinite(i)?i:void 0}function rUe(e,n){var i=iUe(e),r=n[0],o=n[1];if(i===void 0)return!1;var s=Math.min(r,o),a=Math.max(r,o);return i>=s&&i<=a}function oUe(e,n,i){if(i==null||n==null)return!0;var r=or(e,n);return r==null||!Af(i)?!0:rUe(r,i)}var uO=(e,n,i,r)=>{var o=e?.index;if(o==null)return null;var s=Number(o);if(!Vi(s))return o;var a=0,c=1/0;n.length>0&&(c=n.length-1);var u=Math.max(a,Math.min(s,c)),m=n[u];return m==null||oUe(m,i,r)?String(u):null},mle=(e,n,i,r,o,s,a,c)=>{if(!(s==null||c==null)){var u=a[0],m=u==null?void 0:c(u.positions,s);if(m!=null)return m;var h=o?.[Number(s)];if(h)switch(i){case"horizontal":return{x:h.coordinate,y:(r.top+n)/2};default:return{x:(r.left+e)/2,y:h.coordinate}}}},hle=(e,n,i,r)=>{if(n==="axis")return e.tooltipItemPayloads;if(e.tooltipItemPayloads.length===0)return[];var o;if(i==="hover"?o=e.itemInteraction.hover.graphicalItemId:o=e.itemInteraction.click.graphicalItemId,o==null&&r!=null){var s=e.tooltipItemPayloads[0];return s!=null?[s]:[]}return e.tooltipItemPayloads.filter(a=>{var c;return((c=a.settings)===null||c===void 0?void 0:c.graphicalItemId)===o})},$C=e=>e.options.tooltipPayloadSearcher,w1=e=>e.tooltip;function bG(e,n){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),i.push.apply(i,r)}return i}function vG(e){for(var n=1;n<arguments.length;n++){var i=arguments[n]!=null?arguments[n]:{};n%2?bG(Object(i),!0).forEach(function(r){sUe(e,r,i[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):bG(Object(i)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(i,r))})}return e}function sUe(e,n,i){return(n=aUe(n))in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i,e}function aUe(e){var n=lUe(e,"string");return typeof n=="symbol"?n:n+""}function lUe(e,n){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,n);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function cUe(e,n){return e??n}var fle=(e,n,i,r,o,s,a)=>{if(!(n==null||s==null)){var{chartData:c,computedData:u,dataStartIndex:m,dataEndIndex:h}=i,g=[];return e.reduce((x,y)=>{var w,{dataDefinedOnItem:j,settings:v}=y,_=cUe(j,c),$=Array.isArray(_)?Xoe(_,m,h):_,k=(w=v?.dataKey)!==null&&w!==void 0?w:r,P=v?.nameKey,S;if(r&&Array.isArray($)&&!Array.isArray($[0])&&a==="axis"?S=ioe($,r,o):S=s($,n,u,P),Array.isArray(S))S.forEach(A=>{var E=vG(vG({},v),{},{name:A.name,unit:A.unit,color:void 0,fill:void 0});x.push(_H({tooltipEntrySettings:E,dataKey:A.dataKey,payload:A.payload,value:or(A.payload,A.dataKey),name:A.name}))});else{var I;x.push(_H({tooltipEntrySettings:v,dataKey:k,payload:S,value:or(S,k),name:(I=or(S,P))!==null&&I!==void 0?I:v?.name}))}return x},g)}}
7783,pO=_t([As,ji,Rae,DR,Ps],Kae),dUe=_t([e=>e.graphicalItems.cartesianItems,e=>e.graphicalItems.polarItems],(e,n)=>[...e,...n]),uUe=_t([Ps,x1],qR),j1=_t([dUe,As,uUe],GR,{memoizeOptions:{resultEqualityCheck:yA}}),pUe=_t([j1],e=>e.filter(fA)),mUe=_t([j1],VR,{memoizeOptions:{resultEqualityCheck:yA}}),_1=_t([mUe,ch],KR),hUe=_t([pUe,ch,As],Tae),mO=_t([_1,As,j1],XR),gle=_t([As],QR),fUe=_t([As],e=>e.allowDataOverflow),yle=_t([gle,fUe],dae),gUe=_t([j1],e=>e.filter(fA)),yUe=_t([hUe,gUe,vC,kae],Bae),xUe=_t([yUe,ch,Ps,yle],Fae),bUe=_t([j1],Dae),vUe=_t([_1,As,bUe,bA,Ps],eO,{memoizeOptions:{resultEqualityCheck:gA}}),wUe=_t([Wae,Ps,x1],b1),jUe=_t([wUe,Ps],qae),_Ue=_t([Uae,Ps,x1],b1),CUe=_t([_Ue,Ps],Gae),SUe=_t([Hae,Ps,x1],b1),kUe=_t([SUe,Ps],Vae),$Ue=_t([jUe,kUe,CUe],MI),IUe=_t([As,gle,yle,xUe,vUe,$Ue,ji,Ps],tO),IC=_t([As,ji,_1,mO,vC,Ps,IUe],nO),PUe=_t([IC,As,pO],oO),AUe=_t([As,IC,PUe,Ps],aO),xle=e=>{var n=Ps(e),i=x1(e),r=!1;return kC(e,n,i,r)},ble=_t([As,xle],pA),vle=_t([As,pO,AUe,ble],rO),NUe=_t([ji,mO,As,Ps],tle),zUe=_t([ji,mO,As,Ps],nle),TUe=(e,n,i,r,o,s,a,c)=>{if(n){var{type:u}=n,m=Rp(e,c);if(r){var h=i==="scaleBand"&&r.bandwidth?r.bandwidth()/2:2,g=u==="category"&&r.bandwidth?r.bandwidth()/h:0;return g=c==="angleAxis"&&o!=null&&o?.length>=2?Vs(o[0]-o[1])*2*g:g,m&&a?a.map((x,y)=>({coordinate:r(x)+g,value:x,index:y,offset:g})):r.domain().map((x,y)=>({coordinate:r(x)+g,value:s?s[x]:x,index:y,offset:g}))}}},dh=_t([ji,As,pO,vle,xle,NUe,zUe,Ps],TUe),hO=_t([rle,ole,WWe],(e,n,i)=>sle(i.shared,e,n)),wle=e=>e.tooltip.settings.trigger,fO=e=>e.tooltip.settings.defaultIndex,PC=_t([w1,hO,wle,fO],ple),Nf=_t([PC,_1,SC,IC],uO),jle=_t([dh,Nf],ale),gO=_t([PC],e=>{if(e)return e.dataKey}),EUe=_t([PC],e=>{if(e)return e.graphicalItemId}),_le=_t([w1,hO,wle,fO],hle),MUe=_t([sh,ah,ji,ks,dh,fO,_le,$C],mle),RUe=_t([PC,MUe],(e,n)=>e!=null&&e.coordinate?e.coordinate:n),OUe=_t([PC],e=>{var n;return(n=e?.active)!==null&&n!==void 0?n:!1}),DUe=_t([_le,Nf,ch,SC,jle,$C,hO],fle),LUe=_t([DUe],e=>{if(e!=null){var n=e.map(i=>i.payload).filter(i=>i!=null);return Array.from(new Set(n))}});function wG(e,n){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),i.push.apply(i,r)}return i}function jG(e){for(var n=1;n<arguments.length;n++){var i=arguments[n]!=null?arguments[n]:{};n%2?wG(Object(i),!0).forEach(function(r){BUe(e,r,i[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):wG(Object(i)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(i,r))})}return e}function BUe(e,n,i){return(n=FUe(n))in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i,e}function FUe(e){var n=WUe(e,"string");return typeof n=="symbol"?n:n+""}function WUe(e,n){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,n);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}var UUe=()=>gn(As),HUe=()=>{var e=UUe(),n=gn(dh),i=gn(vle);return Pf(!e||!i?void 0:jG(jG({},e),{},{scale:i}),n)};function _G(e,n){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),i.push.apply(i,r)}return i}function dx(e){for(var n=1;n<arguments.length;n++){var i=arguments[n]!=null?arguments[n]:{};n%2?_G(Object(i),!0).forEach(function(r){qUe(e,r,i[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):_G(Object(i)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(i,r))})}return e}function qUe(e,n,i){return(n=GUe(n))in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i,e}function GUe(e){var n=VUe(e,"string");return typeof n=="symbol"?n:n+""}function VUe(e,n){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,n);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}var KUe=(e,n,i,r)=>{var o=n.find(s=>s&&s.index===i);if(o){if(e==="horizontal")return{x:o.coordinate,y:r.chartY};
7783if(e==="vertical")return{x:r.chartX,y:o.coordinate}}return{x:0,y:0}},YUe=(e,n,i,r)=>{var o=n.find(m=>m&&m.index===i);if(o){if(e==="centric"){var s=o.coordinate,{radius:a}=r;return dx(dx(dx({},r),ss(r.cx,r.cy,a,s)),{},{angle:s,radius:a})}var c=o.coordinate,{angle:u}=r;return dx(dx(dx({},r),ss(r.cx,r.cy,c,u)),{},{angle:u,radius:c})}return{angle:0,clockWise:!1,cx:0,cy:0,endAngle:0,innerRadius:0,outerRadius:0,radius:0,startAngle:0,x:0,y:0}};function XUe(e,n){var{chartX:i,chartY:r}=e;return i>=n.left&&i<=n.left+n.width&&r>=n.top&&r<=n.top+n.height}var Cle=(e,n,i,r,o)=>{var s,a=(s=n?.length)!==null&&s!==void 0?s:0;if(a<=1||e==null)return 0;if(r==="angleAxis"&&o!=null&&Math.abs(Math.abs(o[1]-o[0])-360)<=1e-6)for(var c=0;c<a;c++){var u,m,h,g,x,y=c>0?(u=i[c-1])===null||u===void 0?void 0:u.coordinate:(m=i[a-1])===null||m===void 0?void 0:m.coordinate,w=(h=i[c])===null||h===void 0?void 0:h.coordinate,j=c>=a-1?(g=i[0])===null||g===void 0?void 0:g.coordinate:(x=i[c+1])===null||x===void 0?void 0:x.coordinate,v=void 0;if(!(y==null||w==null||j==null))if(Vs(w-y)!==Vs(j-w)){var _=[];if(Vs(j-w)===Vs(o[1]-o[0])){v=j;var $=w+o[1]-o[0];_[0]=Math.min($,($+y)/2),_[1]=Math.max($,($+y)/2)}else{v=y;var k=j+o[1]-o[0];_[0]=Math.min(w,(k+w)/2),_[1]=Math.max(w,(k+w)/2)}var P=[Math.min(w,(v+w)/2),Math.max(w,(v+w)/2)];if(e>P[0]&&e<=P[1]||e>=_[0]&&e<=_[1]){var S;return(S=i[c])===null||S===void 0?void 0:S.index}}else{var I=Math.min(y,j),A=Math.max(y,j);if(e>(I+w)/2&&e<=(A+w)/2){var E;return(E=i[c])===null||E===void 0?void 0:E.index}}}else if(n)for(var B=0;B<a;B++){var T=n[B];if(T!=null){var M=n[B+1],R=n[B-1];if(B===0&&M!=null&&e<=(T.coordinate+M.coordinate)/2||B===a-1&&R!=null&&e>(T.coordinate+R.coordinate)/2||B>0&&B<a-1&&R!=null&&M!=null&&e>(T.coordinate+R.coordinate)/2&&e<=(T.coordinate+M.coordinate)/2)return T.index}}return-1},Sle=()=>gn(DR),yO=(e,n)=>n,kle=(e,n,i)=>i,xO=(e,n,i,r)=>r,QUe=_t(dh,e=>FP(e,n=>n.coordinate)),bO=_t([w1,yO,kle,xO],ple),vO=_t([bO,_1,SC,IC],uO),ZUe=(e,n,i)=>{if(n!=null){var r=w1(e);return n==="axis"?i==="hover"?r.axisInteraction.hover.dataKey:r.axisInteraction.click.dataKey:i==="hover"?r.itemInteraction.hover.dataKey:r.itemInteraction.click.dataKey}},$le=_t([w1,yO,kle,xO],hle),RI=_t([sh,ah,ji,ks,dh,xO,$le,$C],mle),JUe=_t([bO,RI],(e,n)=>{var i;return(i=e.coordinate)!==null&&i!==void 0?i:n}),Ile=_t([dh,vO],ale),eHe=_t([$le,vO,ch,SC,Ile,$C,yO],fle),tHe=_t([bO,vO],(e,n)=>({isActive:e.active&&n!=null,activeIndex:n})),nHe=(e,n,i,r,o,s,a)=>{if(!(!e||!i||!r||!o)&&XUe(e,a)){var c=jOe(e,n),u=Cle(c,s,o,i,r),m=KUe(n,o,u,e);return{activeIndex:String(u),activeCoordinate:m}}},iHe=(e,n,i,r,o,s,a)=>{if(!(!e||!r||!o||!s||!i)){var c=BLe(e,i);if(c){var u=_Oe(c,n),m=Cle(u,a,s,r,o),h=YUe(n,s,m,c);return{activeIndex:String(m),activeCoordinate:h}}}},rHe=(e,n,i,r,o,s,a,c)=>{if(!(!e||!n||!r||!o||!s))return n==="horizontal"||n==="vertical"?nHe(e,n,r,o,s,a,c):iHe(e,n,i,r,o,s,a)},oHe=_t(e=>e.zIndex.zIndexMap,(e,n)=>n,(e,n,i)=>i,(e,n,i)=>{if(n!=null){var r=e[n];if(r!=null)return i?r.panoramaElement:r.element}}),sHe=_t(e=>e.zIndex.zIndexMap,e=>{var n=Object.keys(e).map(r=>parseInt(r,10)).concat(Object.values(zo)),i=Array.from(new Set(n));return i.sort((r,o)=>r-o)},{memoizeOptions:{resultEqualityCheck:UFe}});function CG(e,n){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),i.push.apply(i,r)}return i}function SG(e){for(var n=1;n<arguments.length;n++){var i=arguments[n]!=null?arguments[n]:{};n%2?CG(Object(i),!0).forEach(function(r){aHe(e,r,i[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):CG(Object(i)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(i,r))})}return e}function aHe(e,n,i){return(n=lHe(n))in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i,e}function lHe(e){var n=cHe(e,"string");return typeof n=="symbol"?n:n+""}function cHe(e,n){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,n);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}var dHe={},uHe={zIndexMap:Object.values(zo).reduce((e,n)=>SG(SG({},e),{},{[n]:{element:void 0,panoramaElement:void 0,consumers:0}}),dHe)},pHe=new Set(Object.values(zo));function mHe(e){return pHe.has(e)}var Ple=nc({name:"zIndex",initialState:uHe,reducers:{registerZIndexPortal:{reducer:(e,n)=>{var{zIndex:i}=n.payload;e.zIndexMap[i]?e.zIndexMap[i].consumers+=1:e.zIndexMap[i]={consumers:1,element:void 0,panoramaElement:void 0}},prepare:oo()},unregisterZIndexPortal:{reducer:(e,n)=>{var{zIndex:i}=n.payload;e.zIndexMap[i]&&(e.zIndexMap[i].consumers-=1,e.zIndexMap[i].consumers<=0&&!mHe(i)&&delete e.zIndexMap[i])},prepare:oo()},registerZIndexPortalElement:{reducer:(e,n)=>{var{zIndex:i,element:r,isPanorama:o}=n.payload;e.zIndexMap[i]?o?e.zIndexMap[i].panoramaElement=r:e.zIndexMap[i].element=r:e.zIndexMap[i]={consumers:0,element:o?void 0:r,panoramaElement:o?r:void 0}},prepare:oo()},unregisterZIndexPortalElement:{reducer:(e,n)=>{var{zIndex:i}=n.payload;e.zIndexMap[i]&&(n.payload.isPanorama?e.zIndexMap[i].panoramaElement=void 0:e.zIndexMap[i].element=void 0)},prepare:oo()}}}),{registerZIndexPortal:hHe,unregisterZIndexPortal:fHe,registerZIndexPortalElement:gHe,unregisterZIndexPortalElement:yHe}=Ple.actions,xHe=Ple.reducer;function Ha(e){var{zIndex:n,children:i}=e,r=tDe(),o=r&&n!==void 0&&n!==0,s=$s(),a=Rr();l.useLayoutEffect(()=>o?(a(hHe({zIndex:n})),()=>{a(fHe({zIndex:n}))}):aC,[a,n,o]);var c=gn(u=>oHe(u,n,s));return o?c?jr.createPortal(i,c):null:i}function Y3(){return Y3=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var i=arguments[n];for(var r in i)({}).hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},Y3.apply(null,arguments)}function kG(e,n){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),i.push.apply(i,r)}return i}function Yk(e){for(var n=1;n<arguments.length;n++){var i=arguments[n]!=null?arguments[n]:{};
7783n%2?kG(Object(i),!0).forEach(function(r){bHe(e,r,i[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):kG(Object(i)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(i,r))})}return e}function bHe(e,n,i){return(n=vHe(n))in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i,e}function vHe(e){var n=wHe(e,"string");return typeof n=="symbol"?n:n+""}function wHe(e,n){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,n);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function jHe(e){var{cursor:n,cursorComp:i,cursorProps:r}=e;return l.isValidElement(n)?l.cloneElement(n,r):l.createElement(i,r)}function _He(e){var n,{coordinate:i,payload:r,index:o,offset:s,tooltipAxisBandSize:a,layout:c,cursor:u,tooltipEventType:m,chartName:h}=e,g=i,x=r,y=o;if(!u||!g||h!=="ScatterChart"&&m!=="axis")return null;var w,j,v;if(h==="ScatterChart")w=g,j=eLe,v=zo.cursorLine;else if(h==="BarChart")w=tLe(c,g,s,a),j=_se,v=zo.cursorRectangle;else if(c==="radial"&&ooe(g)){var{cx:_,cy:$,radius:k,startAngle:P,endAngle:S}=Sse(g);w={cx:_,cy:$,startAngle:P,endAngle:S,innerRadius:k,outerRadius:k},j=$se,v=zo.cursorLine}else w={points:HLe(c,g,s)},j=Sb,v=zo.cursorLine;var I=typeof u=="object"&&"className"in u?u.className:void 0,A=Yk(Yk(Yk(Yk({stroke:"#ccc",pointerEvents:"none"},s),w),$y(u)),{},{payload:x,payloadIndex:y,className:Ri("recharts-tooltip-cursor",I)});return l.createElement(Ha,{zIndex:(n=e.zIndex)!==null&&n!==void 0?n:v},l.createElement(jHe,{cursor:u,cursorComp:j,cursorProps:A}))}function CHe(e){var n=HUe(),i=ase(),r=Lf(),o=Sle();return n==null||i==null||r==null||o==null?null:l.createElement(_He,Y3({},e,{offset:i,layout:r,tooltipAxisBandSize:n,chartName:o}))}var Ale=l.createContext(null),SHe=()=>l.useContext(Ale),h6={exports:{}},$G;function kHe(){return $G||($G=1,(function(e){var n=Object.prototype.hasOwnProperty,i="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(i=!1));function o(u,m,h){this.fn=u,this.context=m,this.once=h||!1}function s(u,m,h,g,x){if(typeof h!="function")throw new TypeError("The listener must be a function");var y=new o(h,g||u,x),w=i?i+m:m;return u._events[w]?u._events[w].fn?u._events[w]=[u._events[w],y]:u._events[w].push(y):(u._events[w]=y,u._eventsCount++),u}function a(u,m){--u._eventsCount===0?u._events=new r:delete u._events[m]}function c(){this._events=new r,this._eventsCount=0}c.prototype.eventNames=function(){var m=[],h,g;if(this._eventsCount===0)return m;for(g in h=this._events)n.call(h,g)&&m.push(i?g.slice(1):g);return Object.getOwnPropertySymbols?m.concat(Object.getOwnPropertySymbols(h)):m},c.prototype.listeners=function(m){var h=i?i+m:m,g=this._events[h];if(!g)return[];if(g.fn)return[g.fn];for(var x=0,y=g.length,w=new Array(y);x<y;x++)w[x]=g[x].fn;return w},c.prototype.listenerCount=function(m){var h=i?i+m:m,g=this._events[h];return g?g.fn?1:g.length:0},c.prototype.emit=function(m,h,g,x,y,w){var j=i?i+m:m;if(!this._events[j])return!1;var v=this._events[j],_=arguments.length,$,k;if(v.fn){switch(v.once&&this.removeListener(m,v.fn,void 0,!0),_){case 1:return v.fn.call(v.context),!0;case 2:return v.fn.call(v.context,h),!0;case 3:return v.fn.call(v.context,h,g),!0;case 4:return v.fn.call(v.context,h,g,x),!0;case 5:return v.fn.call(v.context,h,g,x,y),!0;case 6:return v.fn.call(v.context,h,g,x,y,w),!0}for(k=1,$=new Array(_-1);k<_;k++)$[k-1]=arguments[k];v.fn.apply(v.context,$)}else{var P=v.length,S;for(k=0;k<P;k++)switch(v[k].once&&this.removeListener(m,v[k].fn,void 0,!0),_){case 1:v[k].fn.call(v[k].context);break;case 2:v[k].fn.call(v[k].context,h);break;case 3:v[k].fn.call(v[k].context,h,g);break;case 4:v[k].fn.call(v[k].context,h,g,x);break;default:if(!$)for(S=1,$=new Array(_-1);S<_;S++)$[S-1]=arguments[S];v[k].fn.apply(v[k].context,$)}}return!0},c.prototype.on=function(m,h,g){return s(this,m,h,g,!1)},c.prototype.once=function(m,h,g){return s(this,m,h,g,!0)},c.prototype.removeListener=function(m,h,g,x){var y=i?i+m:m;if(!this._events[y])return this;if(!h)return a(this,y),this;var w=this._events[y];if(w.fn)w.fn===h&&(!x||w.once)&&(!g||w.context===g)&&a(this,y);else{for(var j=0,v=[],_=w.length;j<_;j++)(w[j].fn!==h||x&&!w[j].once||g&&w[j].context!==g)&&v.push(w[j]);v.length?this._events[y]=v.length===1?v[0]:v:a(this,y)}return this},c.prototype.removeAllListeners=function(m){var h;return m?(h=i?i+m:m,this._events[h]&&a(this,h)):(this._events=new r,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=i,c.EventEmitter=c,e.exports=c})(h6)),h6.exports}var $He=kHe();const IHe=Tu($He);var D_=new IHe,X3="recharts.syncEvent.tooltip",IG="recharts.syncEvent.brush";function jA(e,n){if(n){var i=Number.parseInt(n,10);if(!Xl(i))return e?.[i]}}var PHe={chartName:"",tooltipPayloadSearcher:void 0,eventEmitter:void 0,defaultTooltipEventType:"axis"},Nle=nc({name:"options",initialState:PHe,reducers:{createEventEmitter:e=>{e.eventEmitter==null&&(e.eventEmitter=Symbol("rechartsEventEmitter"))}}}),AHe=Nle.reducer,{createEventEmitter:NHe}=Nle.actions;function zHe(e){return e.tooltip.syncInteraction}var THe={chartData:void 0,computedData:void 0,dataStartIndex:0,dataEndIndex:0},zle=nc({name:"chartData",initialState:THe,reducers:{setChartData(e,n){if(e.chartData=n.payload,n.payload==null){e.dataStartIndex=0,e.dataEndIndex=0;return}n.payload.length>0&&e.dataEndIndex!==n.payload.length-1&&(e.dataEndIndex=n.payload.length-1)},setComputedData(e,n){e.computedData=n.payload},setDataStartEndIndexes(e,n){var{startIndex:i,endIndex:r}=n.payload;i!=null&&(e.dataStartIndex=i),r!=null&&(e.dataEndIndex=r)}}}),{setChartData:PG,setDataStartEndIndexes:EHe,setComputedData:YTt}=zle.actions,MHe=zle.reducer,RHe=["x","y"];function AG(e,n){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),i.push.apply(i,r)}return i}function ux(e){for(var n=1;n<arguments.length;n++){var i=arguments[n]!=null?arguments[n]:{};
7783n%2?AG(Object(i),!0).forEach(function(r){OHe(e,r,i[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):AG(Object(i)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(i,r))})}return e}function OHe(e,n,i){return(n=DHe(n))in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i,e}function DHe(e){var n=LHe(e,"string");return typeof n=="symbol"?n:n+""}function LHe(e,n){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,n);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function BHe(e,n){if(e==null)return{};var i,r,o=FHe(e,n);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)i=s[r],n.indexOf(i)===-1&&{}.propertyIsEnumerable.call(e,i)&&(o[i]=e[i])}return o}function FHe(e,n){if(e==null)return{};var i={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(n.indexOf(r)!==-1)continue;i[r]=e[r]}return i}function WHe(){var e=gn(LR),n=gn(BR),i=Rr(),r=gn($ae),o=gn(dh),s=Lf(),a=mC(),c=gn(u=>u.rootProps.className);l.useEffect(()=>{if(e==null)return aC;var u=(m,h,g)=>{if(n!==g&&e===m){if(r==="index"){var x;if(a&&h!==null&&h!==void 0&&(x=h.payload)!==null&&x!==void 0&&x.coordinate&&h.payload.sourceViewBox){var y=h.payload.coordinate,{x:w,y:j}=y,v=BHe(y,RHe),{x:_,y:$,width:k,height:P}=h.payload.sourceViewBox,S=ux(ux({},v),{},{x:a.x+(k?(w-_)/k:0)*a.width,y:a.y+(P?(j-$)/P:0)*a.height});i(ux(ux({},h),{},{payload:ux(ux({},h.payload),{},{coordinate:S})}))}else i(h);return}if(o!=null){var I;if(typeof r=="function"){var A={activeTooltipIndex:h.payload.index==null?void 0:Number(h.payload.index),isTooltipActive:h.payload.active,activeIndex:h.payload.index==null?void 0:Number(h.payload.index),activeLabel:h.payload.label,activeDataKey:h.payload.dataKey,activeCoordinate:h.payload.coordinate},E=r(o,A);I=o[E]}else r==="value"&&(I=o.find(U=>String(U.value)===h.payload.label));var{coordinate:B}=h.payload;if(I==null||h.payload.active===!1||B==null||a==null){i(V3({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}var{x:T,y:M}=B,R=Math.min(T,a.x+a.width),F=Math.min(M,a.y+a.height),Y={x:s==="horizontal"?I.coordinate:R,y:s==="horizontal"?F:I.coordinate},H=V3({active:h.payload.active,coordinate:Y,dataKey:h.payload.dataKey,index:String(I.index),label:h.payload.label,sourceViewBox:h.payload.sourceViewBox,graphicalItemId:h.payload.graphicalItemId});i(H)}}};return D_.on(X3,u),()=>{D_.off(X3,u)}},[c,i,n,e,r,o,s,a])}function UHe(){var e=gn(LR),n=gn(BR),i=Rr();l.useEffect(()=>{if(e==null)return aC;var r=(o,s,a)=>{n!==a&&e===o&&i(EHe(s))};return D_.on(IG,r),()=>{D_.off(IG,r)}},[i,n,e])}function HHe(){var e=Rr();l.useEffect(()=>{e(NHe())},[e]),WHe(),UHe()}function qHe(e,n,i,r,o,s){var a=gn(y=>ZUe(y,e,n)),c=gn(BR),u=gn(LR),m=gn($ae),h=gn(zHe),g=h?.active,x=mC();l.useEffect(()=>{if(!g&&u!=null&&c!=null){var y=V3({active:s,coordinate:i,dataKey:a,index:o,label:typeof r=="number"?String(r):r,sourceViewBox:x,graphicalItemId:void 0});D_.emit(X3,u,y,c)}},[g,i,a,o,r,c,u,m,s,x])}function NG(e,n){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),i.push.apply(i,r)}return i}function zG(e){for(var n=1;n<arguments.length;n++){var i=arguments[n]!=null?arguments[n]:{};n%2?NG(Object(i),!0).forEach(function(r){GHe(e,r,i[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):NG(Object(i)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(i,r))})}return e}function GHe(e,n,i){return(n=VHe(n))in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i,e}function VHe(e){var n=KHe(e,"string");return typeof n=="symbol"?n:n+""}function KHe(e,n){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,n);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function YHe(e){return e.dataKey}function XHe(e,n){return l.isValidElement(e)?l.cloneElement(e,n):typeof e=="function"?l.createElement(e,n):l.createElement(TDe,n)}var TG=[],QHe={allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",axisId:0,contentStyle:{},cursor:!0,filterNull:!0,includeHidden:!1,isAnimationActive:"auto",itemSorter:"name",itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,wrapperStyle:{}};function Vl(e){var n,i,r=jo(e,QHe),{active:o,allowEscapeViewBox:s,animationDuration:a,animationEasing:c,content:u,filterNull:m,isAnimationActive:h,offset:g,payloadUniqBy:x,position:y,reverseDirection:w,useTranslate3d:j,wrapperStyle:v,cursor:_,shared:$,trigger:k,defaultIndex:P,portal:S,axisId:I}=r,A=Rr(),E=typeof P=="number"?String(P):P;l.useEffect(()=>{A(VWe({shared:$,trigger:k,axisId:I,active:o,defaultIndex:E}))},[A,$,k,I,o,E]);var B=mC(),T=xse(),M=FWe($),{activeIndex:R,isActive:F}=(n=gn(le=>tHe(le,M,k,E)))!==null&&n!==void 0?n:{},Y=gn(le=>eHe(le,M,k,E)),H=gn(le=>Ile(le,M,k,E)),U=gn(le=>JUe(le,M,k,E)),X=Y,Q=SHe(),K=(i=o??F)!==null&&i!==void 0?i:!1,[G,L]=voe([X,K]),q=M==="axis"?H:void 0;qHe(M,k,U,q,R,K);var W=S??Q;if(W==null||B==null||M==null)return null;var oe=X??TG;K||(oe=TG),m&&oe.length&&(oe=foe(oe.filter(le=>le.value!=null&&(le.hide!==!0||r.includeHidden)),x,YHe));var se=oe.length>0,de=l.createElement(BDe,{allowEscapeViewBox:s,animationDuration:a,animationEasing:c,isAnimationActive:h,active:K,coordinate:U,hasPayload:se,offset:g,position:y,reverseDirection:w,useTranslate3d:j,viewBox:B,wrapperStyle:v,lastBoundingBox:G,innerRef:L,hasPortalFromProps:!!S},XHe(u,zG(zG({},r),{},{payload:oe,label:q,active:K,activeIndex:R,coordinate:U,accessibilityLayer:T})));return l.createElement(l.Fragment,null,jr.createPortal(de,W),K&&l.createElement(CHe,{cursor:_,tooltipEventType:M,coordinate:U,payload:oe,index:R}))}var py=e=>null;py.displayName="Cell";function ZHe(e,n,i){return(n=JHe(n))in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i,e}function JHe(e){var n=eqe(e,"string");return typeof n=="symbol"?n:n+""}function eqe(e,n){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,n);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}
7783class tqe{constructor(n){ZHe(this,"cache",new Map),this.maxSize=n}get(n){var i=this.cache.get(n);return i!==void 0&&(this.cache.delete(n),this.cache.set(n,i)),i}set(n,i){if(this.cache.has(n))this.cache.delete(n);else if(this.cache.size>=this.maxSize){var r=this.cache.keys().next().value;r!=null&&this.cache.delete(r)}this.cache.set(n,i)}clear(){this.cache.clear()}size(){return this.cache.size}}function EG(e,n){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),i.push.apply(i,r)}return i}function nqe(e){for(var n=1;n<arguments.length;n++){var i=arguments[n]!=null?arguments[n]:{};n%2?EG(Object(i),!0).forEach(function(r){iqe(e,r,i[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):EG(Object(i)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(i,r))})}return e}function iqe(e,n,i){return(n=rqe(n))in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i,e}function rqe(e){var n=oqe(e,"string");return typeof n=="symbol"?n:n+""}function oqe(e,n){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,n);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}var sqe={cacheSize:2e3,enableCache:!0},Tle=nqe({},sqe),MG=new tqe(Tle.cacheSize),aqe={position:"absolute",top:"-20000px",left:0,padding:0,margin:0,border:"none",whiteSpace:"pre"},RG="recharts_measurement_span";function lqe(e,n){var i=n.fontSize||"",r=n.fontFamily||"",o=n.fontWeight||"",s=n.fontStyle||"",a=n.letterSpacing||"",c=n.textTransform||"";return"".concat(e,"|").concat(i,"|").concat(r,"|").concat(o,"|").concat(s,"|").concat(a,"|").concat(c)}var OG=(e,n)=>{try{var i=document.getElementById(RG);i||(i=document.createElement("span"),i.setAttribute("id",RG),i.setAttribute("aria-hidden","true"),document.body.appendChild(i)),Object.assign(i.style,aqe,n),i.textContent="".concat(e);var r=i.getBoundingClientRect();return{width:r.width,height:r.height}}catch{return{width:0,height:0}}},c_=function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(n==null||fC.isSsr)return{width:0,height:0};if(!Tle.enableCache)return OG(n,i);var r=lqe(n,i),o=MG.get(r);if(o)return o;var s=OG(n,i);return MG.set(r,s),s},Ele;function cqe(e,n,i){return(n=dqe(n))in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i,e}function dqe(e){var n=uqe(e,"string");return typeof n=="symbol"?n:n+""}function uqe(e,n){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,n);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}var DG=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,LG=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,pqe=/^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/,mqe=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,hqe={cm:96/2.54,mm:96/25.4,pt:96/72,pc:96/6,in:96,Q:96/(2.54*40),px:1},fqe=["cm","mm","pt","pc","in","Q","px"];function gqe(e){return fqe.includes(e)}var ub="NaN";function yqe(e,n){return e*hqe[n]}class ua{static parse(n){var i,[,r,o]=(i=mqe.exec(n))!==null&&i!==void 0?i:[];return r==null?ua.NaN:new ua(parseFloat(r),o??"")}constructor(n,i){this.num=n,this.unit=i,this.num=n,this.unit=i,Xl(n)&&(this.unit=""),i!==""&&!pqe.test(i)&&(this.num=NaN,this.unit=""),gqe(i)&&(this.num=yqe(n,i),this.unit="px")}add(n){return this.unit!==n.unit?new ua(NaN,""):new ua(this.num+n.num,this.unit)}subtract(n){return this.unit!==n.unit?new ua(NaN,""):new ua(this.num-n.num,this.unit)}multiply(n){return this.unit!==""&&n.unit!==""&&this.unit!==n.unit?new ua(NaN,""):new ua(this.num*n.num,this.unit||n.unit)}divide(n){return this.unit!==""&&n.unit!==""&&this.unit!==n.unit?new ua(NaN,""):new ua(this.num/n.num,this.unit||n.unit)}toString(){return"".concat(this.num).concat(this.unit)}isNaN(){return Xl(this.num)}}Ele=ua;cqe(ua,"NaN",new Ele(NaN,""));function Mle(e){if(e==null||e.includes(ub))return ub;for(var n=e;n.includes("*")||n.includes("/");){var i,[,r,o,s]=(i=DG.exec(n))!==null&&i!==void 0?i:[],a=ua.parse(r??""),c=ua.parse(s??""),u=o==="*"?a.multiply(c):a.divide(c);if(u.isNaN())return ub;n=n.replace(DG,u.toString())}for(;n.includes("+")||/.-\d+(?:\.\d+)?/.test(n);){var m,[,h,g,x]=(m=LG.exec(n))!==null&&m!==void 0?m:[],y=ua.parse(h??""),w=ua.parse(x??""),j=g==="+"?y.add(w):y.subtract(w);if(j.isNaN())return ub;n=n.replace(LG,j.toString())}return n}var BG=/\(([^()]*)\)/;function xqe(e){for(var n=e,i;(i=BG.exec(n))!=null;){var[,r]=i;n=n.replace(BG,Mle(r))}return n}function bqe(e){var n=e.replace(/\s+/g,"");return n=xqe(n),n=Mle(n),n}function vqe(e){try{return bqe(e)}catch{return ub}}function f6(e){var n=vqe(e.slice(5,-1));return n===ub?"":n}var wqe=["x","y","lineHeight","capHeight","fill","scaleToFit","textAnchor","verticalAnchor"],jqe=["dx","dy","angle","className","breakAll"];function Q3(){return Q3=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var i=arguments[n];for(var r in i)({}).hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},Q3.apply(null,arguments)}function FG(e,n){if(e==null)return{};var i,r,o=_qe(e,n);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)i=s[r],n.indexOf(i)===-1&&{}.propertyIsEnumerable.call(e,i)&&(o[i]=e[i])}return o}function _qe(e,n){if(e==null)return{};var i={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(n.indexOf(r)!==-1)continue;i[r]=e[r]}return i}var Rle=/[ \f\n\r\t\v\u2028\u2029]+/,Ole=e=>{var{children:n,breakAll:i,style:r}=e;try{var o=[];eo(n)||(i?o=n.toString().split(""):o=n.toString().split(Rle));var s=o.map(c=>({word:c,width:c_(c,r).width})),a=i?0:c_(" ",r).width;return{wordsWithComputedWidth:s,spaceWidth:a}}catch{return null}};function Cqe(e){return e==="start"||e==="middle"||e==="end"||e==="inherit"}var Dle=(e,n,i,r)=>e.reduce((o,s)=>{var{word:a,width:c}=s,u=o[o.length-1];if(u&&c!=null&&(n==null||r||u.width+c+i<Number(n)))u.words.push(a),u.width+=c+i;else{var m={words:[a],width:c};o.push(m)}return o},[]),Lle=e=>e.reduce((n,i)=>n.width>i.width?n:i),Sqe="â¦",WG=(e,n,i,r,o,s,a,c)=>{var u=e.slice(0,n),m=Ole({breakAll:i,style:r,children:u+Sqe});if(!m)return[!1,[]];var h=Dle(m.wordsWithComputedWidth,s,a,c),g=h.length>o||Lle(h).width>Number(s);return[g,h]},kqe=(e,n,i,r,o)=>{var{maxLines:s,children:a,style:c,breakAll:u}=e,m=fn(s),h=String(a),g=Dle(n,r,i,o);if(!m||o)return g;var x=g.length>s||Lle(g).width>Number(r);
7783if(!x)return g;for(var y=0,w=h.length-1,j=0,v;y<=w&&j<=h.length-1;){var _=Math.floor((y+w)/2),$=_-1,[k,P]=WG(h,$,u,c,s,r,i,o),[S]=WG(h,_,u,c,s,r,i,o);if(!k&&!S&&(y=_+1),k&&S&&(w=_-1),!k&&S){v=P;break}j++}return v||g},UG=e=>{var n=eo(e)?[]:e.toString().split(Rle);return[{words:n,width:void 0}]},$qe=e=>{var{width:n,scaleToFit:i,children:r,style:o,breakAll:s,maxLines:a}=e;if((n||i)&&!fC.isSsr){var c,u,m=Ole({breakAll:s,children:r,style:o});if(m){var{wordsWithComputedWidth:h,spaceWidth:g}=m;c=h,u=g}else return UG(r);return kqe({breakAll:s,children:r,maxLines:a,style:o},c,u,n,!!i)}return UG(r)},Ble="#808080",Iqe={angle:0,breakAll:!1,capHeight:"0.71em",fill:Ble,lineHeight:"1em",scaleToFit:!1,textAnchor:"start",verticalAnchor:"end",x:0,y:0},_A=l.forwardRef((e,n)=>{var i=jo(e,Iqe),{x:r,y:o,lineHeight:s,capHeight:a,fill:c,scaleToFit:u,textAnchor:m,verticalAnchor:h}=i,g=FG(i,wqe),x=l.useMemo(()=>$qe({breakAll:g.breakAll,children:g.children,maxLines:g.maxLines,scaleToFit:u,style:g.style,width:g.width}),[g.breakAll,g.children,g.maxLines,u,g.style,g.width]),{dx:y,dy:w,angle:j,className:v,breakAll:_}=g,$=FG(g,jqe);if(!Md(r)||!Md(o)||x.length===0)return null;var k=Number(r)+(fn(y)?y:0),P=Number(o)+(fn(w)?w:0);if(!Vi(k)||!Vi(P))return null;var S;switch(h){case"start":S=f6("calc(".concat(a,")"));break;case"middle":S=f6("calc(".concat((x.length-1)/2," * -").concat(s," + (").concat(a," / 2))"));break;default:S=f6("calc(".concat(x.length-1," * -").concat(s,")"));break}var I=[];if(u){var A=x[0].width,{width:E}=g;I.push("scale(".concat(fn(E)&&fn(A)?E/A:1,")"))}return j&&I.push("rotate(".concat(j,", ").concat(k,", ").concat(P,")")),I.length&&($.transform=I.join(" ")),l.createElement("text",Q3({},ba($),{ref:n,x:k,y:P,className:Ri("recharts-text",v),textAnchor:m,fill:c.includes("url")?Ble:c}),x.map((B,T)=>{var M=B.words.join(_?"":" ");return l.createElement("tspan",{x:k,dy:T===0?S:s,key:"".concat(M,"-").concat(T)},M)}))});_A.displayName="Text";var Pqe=["labelRef"],Aqe=["content"];function HG(e,n){if(e==null)return{};var i,r,o=Nqe(e,n);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)i=s[r],n.indexOf(i)===-1&&{}.propertyIsEnumerable.call(e,i)&&(o[i]=e[i])}return o}function Nqe(e,n){if(e==null)return{};var i={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(n.indexOf(r)!==-1)continue;i[r]=e[r]}return i}function qG(e,n){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),i.push.apply(i,r)}return i}function Lo(e){for(var n=1;n<arguments.length;n++){var i=arguments[n]!=null?arguments[n]:{};n%2?qG(Object(i),!0).forEach(function(r){zqe(e,r,i[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):qG(Object(i)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(i,r))})}return e}function zqe(e,n,i){return(n=Tqe(n))in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i,e}function Tqe(e){var n=Eqe(e,"string");return typeof n=="symbol"?n:n+""}function Eqe(e,n){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,n);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function Am(){return Am=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var i=arguments[n];for(var r in i)({}).hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},Am.apply(null,arguments)}var Fle=l.createContext(null),Wle=e=>{var{x:n,y:i,upperWidth:r,lowerWidth:o,width:s,height:a,children:c}=e,u=l.useMemo(()=>({x:n,y:i,upperWidth:r,lowerWidth:o,width:s,height:a}),[n,i,r,o,s,a]);return l.createElement(Fle.Provider,{value:u},c)},Ule=()=>{var e=l.useContext(Fle),n=mC();return e||sse(n)},Mqe=l.createContext(null),Rqe=()=>{var e=l.useContext(Mqe),n=gn(zae);return e||n},Oqe=e=>{var{value:n,formatter:i}=e,r=eo(e.children)?n:e.children;return typeof i=="function"?i(r):r},wO=e=>e!=null&&typeof e=="function",Dqe=(e,n)=>{var i=Vs(n-e),r=Math.min(Math.abs(n-e),360);return i*r},Lqe=(e,n,i,r,o)=>{var{offset:s,className:a}=e,{cx:c,cy:u,innerRadius:m,outerRadius:h,startAngle:g,endAngle:x,clockWise:y}=o,w=(m+h)/2,j=Dqe(g,x),v=j>=0?1:-1,_,$;switch(n){case"insideStart":_=g+v*s,$=y;break;case"insideEnd":_=x-v*s,$=!y;break;case"end":_=x+v*s,$=y;break;default:throw new Error("Unsupported position ".concat(n))}$=j<=0?$:!$;var k=ss(c,u,w,_),P=ss(c,u,w,_+($?1:-1)*359),S="M".concat(k.x,",").concat(k.y,` 7784 A`).concat(w,",").concat(w,",0,1,").concat($?0:1,`, 7785 `).concat(P.x,",").concat(P.y),I=eo(e.id)?S_("recharts-radial-line-"):e.id;return l.createElement("text",Am({},r,{dominantBaseline:"central",className:Ri("recharts-radial-bar-label",a)}),l.createElement("defs",null,l.createElement("path",{id:I,d:S}
7785)),l.createElement("textPath",{xlinkHref:"#".concat(I)},i))},Bqe=(e,n,i)=>{var{cx:r,cy:o,innerRadius:s,outerRadius:a,startAngle:c,endAngle:u}=e,m=(c+u)/2;if(i==="outside"){var{x:h,y:g}=ss(r,o,a+n,m);return{x:h,y:g,textAnchor:h>=r?"start":"end",verticalAnchor:"middle"}}if(i==="center")return{x:r,y:o,textAnchor:"middle",verticalAnchor:"middle"};if(i==="centerTop")return{x:r,y:o,textAnchor:"middle",verticalAnchor:"start"};if(i==="centerBottom")return{x:r,y:o,textAnchor:"middle",verticalAnchor:"end"};var x=(s+a)/2,{x:y,y:w}=ss(r,o,x,m);return{x:y,y:w,textAnchor:"middle",verticalAnchor:"middle"}},Z3=e=>"cx"in e&&fn(e.cx),Fqe=(e,n)=>{var{parentViewBox:i,offset:r,position:o}=e,s;i!=null&&!Z3(i)&&(s=i);var{x:a,y:c,upperWidth:u,lowerWidth:m,height:h}=n,g=a,x=a+(u-m)/2,y=(g+x)/2,w=(u+m)/2,j=g+u/2,v=h>=0?1:-1,_=v*r,$=v>0?"end":"start",k=v>0?"start":"end",P=u>=0?1:-1,S=P*r,I=P>0?"end":"start",A=P>0?"start":"end";if(o==="top"){var E={x:g+u/2,y:c-_,textAnchor:"middle",verticalAnchor:$};return Lo(Lo({},E),s?{height:Math.max(c-s.y,0),width:u}:{})}if(o==="bottom"){var B={x:x+m/2,y:c+h+_,textAnchor:"middle",verticalAnchor:k};return Lo(Lo({},B),s?{height:Math.max(s.y+s.height-(c+h),0),width:m}:{})}if(o==="left"){var T={x:y-S,y:c+h/2,textAnchor:I,verticalAnchor:"middle"};return Lo(Lo({},T),s?{width:Math.max(T.x-s.x,0),height:h}:{})}if(o==="right"){var M={x:y+w+S,y:c+h/2,textAnchor:A,verticalAnchor:"middle"};return Lo(Lo({},M),s?{width:Math.max(s.x+s.width-M.x,0),height:h}:{})}var R=s?{width:w,height:h}:{};return o==="insideLeft"?Lo({x:y+S,y:c+h/2,textAnchor:A,verticalAnchor:"middle"},R):o==="insideRight"?Lo({x:y+w-S,y:c+h/2,textAnchor:I,verticalAnchor:"middle"},R):o==="insideTop"?Lo({x:g+u/2,y:c+_,textAnchor:"middle",verticalAnchor:k},R):o==="insideBottom"?Lo({x:x+m/2,y:c+h-_,textAnchor:"middle",verticalAnchor:$},R):o==="insideTopLeft"?Lo({x:g+S,y:c+_,textAnchor:A,verticalAnchor:k},R):o==="insideTopRight"?Lo({x:g+u-S,y:c+_,textAnchor:I,verticalAnchor:k},R):o==="insideBottomLeft"?Lo({x:x+S,y:c+h-_,textAnchor:A,verticalAnchor:$},R):o==="insideBottomRight"?Lo({x:x+m-S,y:c+h-_,textAnchor:I,verticalAnchor:$},R):o&&typeof o=="object"&&(fn(o.x)||Gm(o.x))&&(fn(o.y)||Gm(o.y))?Lo({x:a+Wa(o.x,w),y:c+Wa(o.y,h),textAnchor:"end",verticalAnchor:"end"},R):Lo({x:j,y:c+h/2,textAnchor:"middle",verticalAnchor:"middle"},R)},Wqe={angle:0,offset:5,zIndex:zo.label,position:"middle",textBreakAll:!1};function cf(e){var n=jo(e,Wqe),{viewBox:i,position:r,value:o,children:s,content:a,className:c="",textBreakAll:u,labelRef:m}=n,h=Rqe(),g=Ule(),x=r==="center"?g:h??g,y,w,j;if(i==null?y=x:Z3(i)?y=i:y=sse(i),!y||eo(o)&&eo(s)&&!l.isValidElement(a)&&typeof a!="function")return null;var v=Lo(Lo({},n),{},{viewBox:y});if(l.isValidElement(a)){var{labelRef:_}=v,$=HG(v,Pqe);return l.cloneElement(a,$)}if(typeof a=="function"){var{content:k}=v,P=HG(v,Aqe);if(w=l.createElement(a,P),l.isValidElement(w))return w}else w=Oqe(n);var S=ba(n);if(Z3(y)){if(r==="insideStart"||r==="insideEnd"||r==="end")return Lqe(n,r,w,S,y);j=Bqe(y,n.offset,n.position)}else j=Fqe(n,y);return l.createElement(Ha,{zIndex:n.zIndex},l.createElement(_A,Am({ref:m,className:Ri("recharts-label",c)},S,j,{textAnchor:Cqe(S.textAnchor)?S.textAnchor:j.textAnchor,breakAll:u}),w))}cf.displayName="Label";var Uqe=(e,n,i)=>{if(!e)return null;var r={viewBox:n,labelRef:i};return e===!0?l.createElement(cf,Am({key:"label-implicit"},r)):Md(e)?l.createElement(cf,Am({key:"label-implicit",value:e},r)):l.isValidElement(e)?e.type===cf?l.cloneElement(e,Lo({key:"label-implicit"},r)):l.createElement(cf,Am({key:"label-implicit",content:e},r)):wO(e)?l.createElement(cf,Am({key:"label-implicit",content:e},r)):e&&typeof e=="object"?l.createElement(cf,Am({},e,{key:"label-implicit"},r)):null};function Hle(e){var{label:n,labelRef:i}=e,r=Ule();return Uqe(n,r,i)||null}var g6={},y6={},GG;function Hqe(){return GG||(GG=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function n(i){return i[i.length-1]}e.last=n})(y6)),y6}var x6={},VG;function qqe(){return VG||(VG=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function n(i){return Array.isArray(i)?i:Array.from(i)}e.toArray=n})(x6)),x6}var KG;function Gqe(){return KG||(KG=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const n=Hqe(),i=qqe(),r=XM();function o(s){if(r.isArrayLike(s))return n.last(i.toArray(s))}e.last=o})(g6)),g6}var b6,YG;function Vqe(){return YG||(YG=1,b6=Gqe().last),b6}var Kqe=Vqe();const Yqe=Tu(Kqe);var Xqe=["valueAccessor"],Qqe=["dataKey","clockWise","id","textBreakAll","zIndex"];function OI(){return OI=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var i=arguments[n];for(var r in i)({}).hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},OI.apply(null,arguments)}
7785function XG(e,n){if(e==null)return{};var i,r,o=Zqe(e,n);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)i=s[r],n.indexOf(i)===-1&&{}.propertyIsEnumerable.call(e,i)&&(o[i]=e[i])}return o}function Zqe(e,n){if(e==null)return{};var i={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(n.indexOf(r)!==-1)continue;i[r]=e[r]}return i}var Jqe=e=>Array.isArray(e.value)?Yqe(e.value):e.value,qle=l.createContext(void 0),jO=qle.Provider,Gle=l.createContext(void 0),eGe=Gle.Provider;function tGe(){return l.useContext(qle)}function nGe(){return l.useContext(Gle)}function N5(e){var{valueAccessor:n=Jqe}=e,i=XG(e,Xqe),{dataKey:r,clockWise:o,id:s,textBreakAll:a,zIndex:c}=i,u=XG(i,Qqe),m=tGe(),h=nGe(),g=m||h;return!g||!g.length?null:l.createElement(Ha,{zIndex:c??zo.label},l.createElement(bo,{className:"recharts-label-list"},g.map((x,y)=>{var w,j=eo(r)?n(x,y):or(x&&x.payload,r),v=eo(s)?{}:{id:"".concat(s,"-").concat(y)};return l.createElement(cf,OI({key:"label-".concat(y)},ba(x),u,v,{fill:(w=i.fill)!==null&&w!==void 0?w:x.fill,parentViewBox:x.parentViewBox,value:j,textBreakAll:a,viewBox:x.viewBox,index:y,zIndex:0}))})))}N5.displayName="LabelList";function CA(e){var{label:n}=e;return n?n===!0?l.createElement(N5,{key:"labelList-implicit"}):l.isValidElement(n)||wO(n)?l.createElement(N5,{key:"labelList-implicit",content:n}):typeof n=="object"?l.createElement(N5,OI({key:"labelList-implicit"},n,{type:String(n.type)})):null:null}function J3(){return J3=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var i=arguments[n];for(var r in i)({}).hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},J3.apply(null,arguments)}var Vle=e=>{var{cx:n,cy:i,r,className:o}=e,s=Ri("recharts-dot",o);return fn(n)&&fn(i)&&fn(r)?l.createElement("circle",J3({},yl(e),YM(e),{className:s,cx:n,cy:i,r})):null},Kle=e=>e.graphicalItems.polarItems,iGe=_t([uo,wC],qR),SA=_t([Kle,_o,iGe],GR),rGe=_t([SA],VR),kA=_t([rGe,uA],KR),oGe=_t([kA,_o,SA],XR);_t([kA,_o,SA],(e,n,i)=>i.length>0?e.flatMap(r=>i.flatMap(o=>{var s,a=or(r,(s=n.dataKey)!==null&&s!==void 0?s:o.dataKey);return{value:a,errorDomain:[]}})).filter(Boolean):n?.dataKey!=null?e.map(r=>({value:or(r,n.dataKey),errorDomain:[]})):e.map(r=>({value:r,errorDomain:[]})));var QG=()=>{},sGe=_t([kA,_o,SA,bA,uo],eO),aGe=_t([_o,ZR,JR,QG,sGe,QG,ji,uo],tO),Yle=_t([_o,ji,kA,oGe,vC,uo,aGe],nO),lGe=_t([Yle,_o,v1],oO);_t([_o,Yle,lGe,uo],aO);var cGe={radiusAxis:{},angleAxis:{}},Xle=nc({name:"polarAxis",initialState:cGe,reducers:{addRadiusAxis(e,n){e.radiusAxis[n.payload.id]=n.payload},removeRadiusAxis(e,n){delete e.radiusAxis[n.payload.id]},addAngleAxis(e,n){e.angleAxis[n.payload.id]=n.payload},removeAngleAxis(e,n){delete e.angleAxis[n.payload.id]}}}),{addRadiusAxis:XTt,removeRadiusAxis:QTt,addAngleAxis:ZTt,removeAngleAxis:JTt}=Xle.actions,dGe=Xle.reducer;function ZG(e,n){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),i.push.apply(i,r)}return i}function JG(e){for(var n=1;n<arguments.length;n++){var i=arguments[n]!=null?arguments[n]:{};n%2?ZG(Object(i),!0).forEach(function(r){uGe(e,r,i[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):ZG(Object(i)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(i,r))})}return e}function uGe(e,n,i){return(n=pGe(n))in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i,e}function pGe(e){var n=mGe(e,"string");return typeof n=="symbol"?n:n+""}function mGe(e,n){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,n);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}var hGe=(e,n)=>n,_O=_t([Kle,hGe],(e,n)=>e.filter(i=>i.type==="pie").find(i=>i.id===n)),fGe=[],CO=(e,n,i)=>i?.length===0?fGe:i,Qle=_t([uA,_O,CO],(e,n,i)=>{var{chartData:r}=e;if(n!=null){var o;if(n?.data!=null&&n.data.length>0?o=n.data:o=r,(!o||!o.length)&&i!=null&&(o=i.map(s=>JG(JG({},n.presentationProps),s.props))),o!=null)return o}}),gGe=_t([Qle,_O,CO],(e,n,i)=>{if(!(e==null||n==null))return e.map((r,o)=>{var s,a=or(r,n.nameKey,n.name),c;return i!=null&&(s=i[o])!==null&&s!==void 0&&(s=s.props)!==null&&s!==void 0&&s.fill?c=i[o].props.fill:typeof r=="object"&&r!=null&&"fill"in r?c=r.fill:c=n.fill,{value:Df(a,n.dataKey),color:c,payload:r,type:n.legendT
7785ype}})}),yGe=_t([Qle,_O,CO,ks],(e,n,i,r)=>{if(!(n==null||e==null))return bVe({offset:r,pieSettings:n,displayedData:e,cells:i})}),v6={exports:{}},Qi={};var eV;function xGe(){if(eV)return Qi;eV=1;var e=typeof Symbol=="function"&&Symbol.for,n=e?Symbol.for("react.element"):60103,i=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,o=e?Symbol.for("react.strict_mode"):60108,s=e?Symbol.for("react.profiler"):60114,a=e?Symbol.for("react.provider"):60109,c=e?Symbol.for("react.context"):60110,u=e?Symbol.for("react.async_mode"):60111,m=e?Symbol.for("react.concurrent_mode"):60111,h=e?Symbol.for("react.forward_ref"):60112,g=e?Symbol.for("react.suspense"):60113,x=e?Symbol.for("react.suspense_list"):60120,y=e?Symbol.for("react.memo"):60115,w=e?Symbol.for("react.lazy"):60116,j=e?Symbol.for("react.block"):60121,v=e?Symbol.for("react.fundamental"):60117,_=e?Symbol.for("react.responder"):60118,$=e?Symbol.for("react.scope"):60119;function k(S){if(typeof S=="object"&&S!==null){var I=S.$$typeof;switch(I){case n:switch(S=S.type,S){case u:case m:case r:case s:case o:case g:return S;default:switch(S=S&&S.$$typeof,S){case c:case h:case w:case y:case a:return S;default:return I}}case i:return I}}}function P(S){return k(S)===m}return Qi.AsyncMode=u,Qi.ConcurrentMode=m,Qi.ContextConsumer=c,Qi.ContextProvider=a,Qi.Element=n,Qi.ForwardRef=h,Qi.Fragment=r,Qi.Lazy=w,Qi.Memo=y,Qi.Portal=i,Qi.Profiler=s,Qi.StrictMode=o,Qi.Suspense=g,Qi.isAsyncMode=function(S){return P(S)||k(S)===u},Qi.isConcurrentMode=P,Qi.isContextConsumer=function(S){return k(S)===c},Qi.isContextProvider=function(S){return k(S)===a},Qi.isElement=function(S){return typeof S=="object"&&S!==null&&S.$$typeof===n},Qi.isForwardRef=function(S){return k(S)===h},Qi.isFragment=function(S){return k(S)===r},Qi.isLazy=function(S){return k(S)===w},Qi.isMemo=function(S){return k(S)===y},Qi.isPortal=function(S){return k(S)===i},Qi.isProfiler=function(S){return k(S)===s},Qi.isStrictMode=function(S){return k(S)===o},Qi.isSuspense=function(S){return k(S)===g},Qi.isValidElementType=function(S){return typeof S=="string"||typeof S=="function"||S===r||S===m||S===s||S===o||S===g||S===x||typeof S=="object"&&S!==null&&(S.$$typeof===w||S.$$typeof===y||S.$$typeof===a||S.$$typeof===c||S.$$typeof===h||S.$$typeof===v||S.$$typeof===_||S.$$typeof===$||S.$$typeof===j)},Qi.typeOf=k,Qi}var tV;function bGe(){return tV||(tV=1,v6.exports=xGe()),v6.exports}var vGe=bGe(),nV=e=>typeof e=="string"?e:e?e.displayName||e.name||"Component":"",iV=null,w6=null,Zle=e=>{if(e===iV&&Array.isArray(w6))return w6;var n=[];return l.Children.forEach(e,i=>{eo(i)||(vGe.isFragment(i)?n=n.concat(Zle(i.props.children)):n.push(i))}),w6=n,iV=e,n};function SO(e,n){var i=[],r=[];return Array.isArray(n)?r=n.map(o=>nV(o)):r=[nV(n)],Zle(e).forEach(o=>{var s=Py(o,"type.displayName")||Py(o,"type.name");s&&r.indexOf(s)!==-1&&i.push(o)}),i}var kO=e=>e&&typeof e=="object"&&"clipDot"in e?!!e.clipDot:!0,j6={},rV;function wGe(){return rV||(rV=1,(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function n(i){if(typeof i!="object"||i==null)return!1;if(Object.getPrototypeOf(i)===null)return!0;if(Object.prototype.toString.call(i)!=="[object Object]"){const o=i[Symbol.toStringTag];return o==null||!Object.getOwnPropertyDescriptor(i,Symbol.toStringTag)?.writable?!1:i.toString()===`[object ${o}]`}let r=i;for(;Object.getPrototypeOf(r)!==null;)r=Object.getPrototypeOf(r);return Object.getPrototypeOf(i)===r}e.isPlainObject=n})(j6)),j6}var _6,oV;function jGe(){return oV||(oV=1,_6=wGe().isPlainObject),_6}var _Ge=jGe();const CGe=Tu(_Ge);var sV,aV,lV,cV,dV;function uV(e,n){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),i.push.apply(i,r)}return i}function pV(e){for(var n=1;n<arguments.length;n++){var i=arguments[n]!=null?arguments[n]:{};n%2?uV(Object(i),!0).forEach(function(r){SGe(e,r,i[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):uV(Object(i)).forEac
7785h(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(i,r))})}return e}function SGe(e,n,i){return(n=kGe(n))in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i,e}function kGe(e){var n=$Ge(e,"string");return typeof n=="symbol"?n:n+""}function $Ge(e,n){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,n);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function DI(){return DI=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var i=arguments[n];for(var r in i)({}).hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},DI.apply(null,arguments)}function $w(e,n){return n||(n=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}var mV=(e,n,i,r,o)=>{var s=i-r,a;return a=Po(sV||(sV=$w(["M ",",",""])),e,n),a+=Po(aV||(aV=$w(["L ",",",""])),e+i,n),a+=Po(lV||(lV=$w(["L ",",",""])),e+i-s/2,n+o),a+=Po(cV||(cV=$w(["L ",",",""])),e+i-s/2-r,n+o),a+=Po(dV||(dV=$w(["L ",","," Z"])),e,n),a},IGe={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},PGe=e=>{var n=jo(e,IGe),{x:i,y:r,upperWidth:o,lowerWidth:s,height:a,className:c}=n,{animationEasing:u,animationDuration:m,animationBegin:h,isUpdateAnimationActive:g}=n,x=l.useRef(null),[y,w]=l.useState(-1),j=l.useRef(o),v=l.useRef(s),_=l.useRef(a),$=l.useRef(i),k=l.useRef(r),P=h1(e,"trapezoid-");if(l.useEffect(()=>{if(x.current&&x.current.getTotalLength)try{var Y=x.current.getTotalLength();Y&&w(Y)}catch{}},[]),i!==+i||r!==+r||o!==+o||s!==+s||a!==+a||o===0&&s===0||a===0)return null;var S=Ri("recharts-trapezoid",c);if(!g)return l.createElement("g",null,l.createElement("path",DI({},ba(n),{className:S,d:mV(i,r,o,s,a)})));var I=j.current,A=v.current,E=_.current,B=$.current,T=k.current,M="0px ".concat(y===-1?1:y,"px"),R="".concat(y,"px 0px"),F=bse(["strokeDasharray"],m,u);return l.createElement(m1,{animationId:P,key:P,canBegin:y>0,duration:m,easing:u,isActive:g,begin:h},Y=>{var H=ir(I,o,Y),U=ir(A,s,Y),X=ir(E,a,Y),Q=ir(B,i,Y),K=ir(T,r,Y);x.current&&(j.current=H,v.current=U,_.current=X,$.current=Q,k.current=K);var G=Y>0?{transition:F,strokeDasharray:R}:{strokeDasharray:M};return l.createElement("path",DI({},ba(n),{className:S,d:mV(Q,K,H,U,X),ref:x,style:pV(pV({},G),n.style)}))})},AGe=["option","shapeType","activeClassName"];function NGe(e,n){if(e==null)return{};var i,r,o=zGe(e,n);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)i=s[r],n.indexOf(i)===-1&&{}.propertyIsEnumerable.call(e,i)&&(o[i]=e[i])}return o}function zGe(e,n){if(e==null)return{};var i={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(n.indexOf(r)!==-1)continue;i[r]=e[r]}return i}function hV(e,n){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),i.push.apply(i,r)}return i}function LI(e){for(var n=1;n<arguments.length;n++){var i=arguments[n]!=null?arguments[n]:{};n%2?hV(Object(i),!0).forEach(function(r){TGe(e,r,i[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):hV(Object(i)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(i,r))})}return e}function TGe(e,n,i){return(n=EGe(n))in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i,e}function EGe(e){var n=MGe(e,"string");return typeof n=="symbol"?n:n+""}function MGe(e,n){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,n);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function RGe(e,n){return LI(LI({},n),e)}function OGe(e,n){return e==="symbols"}function fV(e){var{shapeType:n,elementProps:i}=e;switch(n){case"rectangle":return l.createElement(_se,i);case"trapezoid":return l.createElement(PGe,i);case"sector":return l.createElement($se,i);case"symbols":if(OGe(n))return l.createElement(KM,i);break;case"curve":return l.createElement(Sb,i);default:return null}}function DGe(e){return l.isValidElement(e)?e.props:e}function $O(e){var{option:n,shapeType:i,activeClassName:r="recharts-active-shape"}=e,o=NGe(e,AGe),s;if(l.isValidElement(n))s=l.cloneElement(n,LI(LI({},o),DGe(n)));else if(typeof n=="function")s=n(o,o.index);else if(CGe(n)&&typeof n!="boolean"){var a=RGe(n,o);s=l.createElement(fV,{shapeType:i,elementProps:a})}else{var c=o;s=l.createElement(fV,{shapeType:i,elementProps:c})}return o.isActive?l.createElement(bo,{className:r},s):s}var IO=(e,n,i)=>{var r=Rr();return(o,s)=>a=>{e?.(o,s,a),r(cle({activeIndex:String(s),activeDataKey:n,activeCoordinate:o.tooltipPosition,activeGraphicalItemId:i}))}},PO=e=>{var n=Rr();return(i,r)=>o=>{e?.(i,r,o),n(KWe())}},AO=(e,n,i)=>{var r=Rr();return(o,s)=>a=>{e?.(o,s,a),r(YWe({activeIndex:String(s),activeDataKey:n,activeCoordinate:o.tooltipPosition,activeGraphicalItemId:i}))}};function $A(e){var{tooltipEntrySettings:n}=e,i=Rr(),r=$s(),o=l.useRef(null);return l.useLayoutEffect(()=>{r||(o.current===null?i(HWe(n)):o.current!==n&&i(qWe({prev:o.current,next:n})),o.current=n)},[n,i,r]),l.useLayoutEffect(()=>()=>{o.current&&(i(GWe(o.current)),o.current=null)},[i]),null}function NO(e){var{legendPayload:n}=e,i=Rr(),r=$s(),o=l.useRef(null);return l.useLayoutEffect(()=>{r||(o.current===null?i(fse(n)):o.current!==n&&i(gse({prev:o.current,next:n})),o.current=n)},[i,r,n]),l.useLayoutEffect(()=>()=>{o.current&&(i(yse(o.current)),o.current=null)},[i]),null}function LGe(e){var{legendPayload:n}=e,i=Rr(),r=gn(ji),o=l.useRef(null);return l.useLayoutEffect(()=>{r!=="centric"&&r!=="radial"||(o.current===null?i(fse(n)):o.current!==n&&i(gse({prev:o.current,next:n})),o.current=n)},[i,r,n]),l.useLayoutEffect(()=>()=>{o.current&&(i(yse(o.current)),o.current=null)},[i]),null}var C6,BGe=()=>{var[e]=l.useState(()=>S_("uid-"));return e},FGe=(C6=$me.useId)!==null&&C6!==void 0?C6:BGe;function WGe(e,n){var i=FGe();return n||(e?"".concat(e,"-").concat(i):i)}var UGe=l.createContext(void 0),IA=e=>{var{id:n,type:i,children:r}=e,o=WGe("recharts-".concat(i),n);return l.createElement(UGe.Provider,{value:o},r(o))},HGe={cartesianItems:[],polarItems:[]},Jle=nc({name:"graphicalItems",initialState:HGe,reducers:{addCartesianGraphicalItem:{reducer(e,n){e.cartesianItems.push(n.payload)},prepare:oo()},replaceCartesianGraphicalItem:{reducer(e,n){var{prev:i,next:r}=n.payload,o=Su(e).cartesianItems.indexOf(i);o>-1&&(e.cartesianItems[o]=r)},prepare:oo()},removeCartesianGraphicalItem:{reducer(e,n){var i=Su(e).cartesianItems.indexOf(n.payload);i>-1&&e.cartesianItems.splice(i,1)},prepare:oo()},addPolarGraphicalItem:{reducer(e,n){e.polarItems.push(n.payload)},prepare:oo()},removePolarGraphicalItem:{reducer(e,n){var i=Su(e).polarItems.indexOf(n.payload);i>-1&&e.polarItems.splice(i,1)},prepare:oo()}}}),{addCartesianGraphicalItem:qGe,replaceCartesianGraphicalItem:GGe,removeCartesianGraphicalItem:VGe,addPolarGraphicalItem:KGe,removePolarGraphicalItem:YGe}=Jle.actions,XGe=Jle.reducer,QGe=e=>{var n=Rr(),i=l.useRef(null);return l.useLayoutEffect(()=>
7785{i.current===null?n(qGe(e)):i.current!==e&&n(GGe({prev:i.current,next:e})),i.current=e},[n,e]),l.useLayoutEffect(()=>()=>{i.current&&(n(VGe(i.current)),i.current=null)},[n]),null},zO=l.memo(QGe);function ZGe(e){var n=Rr();return l.useLayoutEffect(()=>(n(KGe(e)),()=>{n(YGe(e))}),[n,e]),null}var JGe=["key"],eVe=["onMouseEnter","onClick","onMouseLeave"],tVe=["id"],nVe=["id"];function gV(e,n){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),i.push.apply(i,r)}return i}function Ao(e){for(var n=1;n<arguments.length;n++){var i=arguments[n]!=null?arguments[n]:{};n%2?gV(Object(i),!0).forEach(function(r){iVe(e,r,i[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):gV(Object(i)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(i,r))})}return e}function iVe(e,n,i){return(n=rVe(n))in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i,e}function rVe(e){var n=oVe(e,"string");return typeof n=="symbol"?n:n+""}function oVe(e,n){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,n);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function zf(){return zf=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var i=arguments[n];for(var r in i)({}).hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},zf.apply(null,arguments)}function PA(e,n){if(e==null)return{};var i,r,o=sVe(e,n);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)i=s[r],n.indexOf(i)===-1&&{}.propertyIsEnumerable.call(e,i)&&(o[i]=e[i])}return o}function sVe(e,n){if(e==null)return{};var i={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(n.indexOf(r)!==-1)continue;i[r]=e[r]}return i}function aVe(e){var n=l.useMemo(()=>SO(e.children,py),[e.children]),i=gn(r=>gGe(r,e.id,n));return i==null?null:l.createElement(LGe,{legendPayload:i})}var lVe=l.memo(e=>{var{dataKey:n,nameKey:i,sectors:r,stroke:o,strokeWidth:s,fill:a,name:c,hide:u,tooltipType:m,id:h}=e,g={dataDefinedOnItem:r.map(x=>x.tooltipPayload),positions:r.map(x=>x.tooltipPosition),settings:{stroke:o,strokeWidth:s,fill:a,dataKey:n,nameKey:i,name:Df(c,n),hide:u,type:m,color:a,unit:"",graphicalItemId:h}};return l.createElement($A,{tooltipEntrySettings:g})}),cVe=(e,n)=>e>n?"start":e<n?"end":"middle",dVe=(e,n,i)=>Wa(typeof n=="function"?n(e):n,i,i*.8),uVe=(e,n,i)=>{var{top:r,left:o,width:s,height:a}=n,c=Cse(s,a),u=o+Wa(e.cx,s,s/2),m=r+Wa(e.cy,a,a/2),h=Wa(e.innerRadius,c,0),g=dVe(i,e.outerRadius,c),x=e.maxRadius||Math.sqrt(s*s+a*a)/2;return{cx:u,cy:m,innerRadius:h,outerRadius:g,maxRadius:x}},pVe=(e,n)=>{var i=Vs(n-e),r=Math.min(Math.abs(n-e),360);return i*r};function mVe(e){return e&&typeof e=="object"&&"className"in e&&typeof e.className=="string"?e.className:""}var hVe=(e,n)=>{if(l.isValidElement(e))return l.cloneElement(e,n);if(typeof e=="function")return e(n);var i=Ri("recharts-pie-label-line",typeof e!="boolean"?e.className:""),{key:r}=n,o=PA(n,JGe);return l.createElement(Sb,zf({},o,{type:"linear",className:i}))},fVe=(e,n,i)=>{if(l.isValidElement(e))return l.cloneElement(e,n);var r=i;if(typeof e=="function"&&(r=e(n),l.isValidElement(r)))return r;var o=Ri("recharts-pie-label-text",mVe(e));return l.createElement(_A,zf({},n,{alignmentBaseline:"middle",className:o}),r)};function gVe(e){var{sectors:n,props:i,showLabels:r}=e,{label:o,labelLine:s,dataKey:a}=i;if(!r||!o||!n)return null;var c=yl(i),u=$y(o),m=$y(s),h=typeof o=="object"&&"offsetRadius"in o&&typeof o.offsetRadius=="number"&&o.offsetRadius||20,g=n.map((x,y)=>{var w=(x.startAngle+x.endAngle)/2,j=ss(x.cx,x.cy,x.outerRadius+h,w),v=Ao(Ao(Ao(Ao({},c),x),{},{stroke:"none"},u),{},{index:y,textAnchor:cVe(j.x,x.cx)},j),_=Ao(Ao(Ao(Ao({},c),x),{},{fill:"none",stroke:x.fill},m),{},{index:y,points:[ss(x.cx,x.cy,x.outerRadius,w),j],key:"line"});return l.createElement(Ha,{zIndex:zo.label,key:"label-".concat(x.startAngle,"-").concat(x.endAngle,"-").concat(x.midAngle,"-").concat(y)},l.createElement(bo,null,s&&hVe(s,_),fVe(o,v,or(x,a))))});return l.createElement(bo,{className:"recharts-pie-labels"},g)}function yVe(e){var{sectors:n,props:i,showLabels:r}=e,{label:o}=i;return typeof o=="object"&&o!=null&&"position"in o?l.createElement(CA,{label:o}):l.createElement(gVe,{sectors:n,props:i,showLabels:r})}function xVe(e){var{sectors:n,activeShape:i,inactiveShape:r,allOtherPieProps:o,shape:s,id:a}=e,c=gn(Nf),u=gn(gO),m=gn(EUe),{onMouseEnter:h,onClick:g,onMouseLeave:x}=o,y=PA(o,eVe),w=IO(h,o.dataKey,a),j=PO(x),v=AO(g,o.dataKey,a);return n==null||n.length===0?null:l.createElement(l.Fragment,null,n.map((_,$)=>{if(_?.startAngle===0&&_?.endAngle===0&&n.length!==1)return null;var k=m==null||m===a,P=String($)===c&&(u==null||o.dataKey===u)&&k,S=c?r:null,I=i&&P?i:S,A=Ao(Ao({},_),{},{stroke:_.stroke,tabIndex:-1,[tse]:$,[nse]:a});return l.createElement(bo,zf({key:"sector-".concat(_?.startAngle,"-").concat(_?.endAngle,"-").concat(_.midAngle,"-").concat($),tabIndex:-1,
7785className:"recharts-pie-sector"},lC(y,_,$),{onMouseEnter:w(_,$),onMouseLeave:j(_,$),onClick:v(_,$)}),l.createElement($O,zf({option:s??I,index:$,shapeType:"sector",isActive:P},A)))}))}function bVe(e){var n,{pieSettings:i,displayedData:r,cells:o,offset:s}=e,{cornerRadius:a,startAngle:c,endAngle:u,dataKey:m,nameKey:h,tooltipType:g}=i,x=Math.abs(i.minAngle),y=pVe(c,u),w=Math.abs(y),j=r.length<=1?0:(n=i.paddingAngle)!==null&&n!==void 0?n:0,v=r.filter(I=>or(I,m,0)!==0).length,_=(w>=360?v:v-1)*j,$=w-v*x-_,k=r.reduce((I,A)=>{var E=or(A,m,0);return I+(fn(E)?E:0)},0),P;if(k>0){var S;P=r.map((I,A)=>{var E=or(I,m,0),B=or(I,h,A),T=uVe(i,s,I),M=(fn(E)?E:0)/k,R,F=Ao(Ao({},I),o&&o[A]&&o[A].props);A?R=S.endAngle+Vs(y)*j*(E!==0?1:0):R=c;var Y=R+Vs(y)*((E!==0?x:0)+M*$),H=(R+Y)/2,U=(T.innerRadius+T.outerRadius)/2,X=[{name:B,value:E,payload:F,dataKey:m,type:g,graphicalItemId:i.id}],Q=ss(T.cx,T.cy,U,H);return S=Ao(Ao(Ao(Ao({},i.presentationProps),{},{percent:M,cornerRadius:typeof a=="string"?parseFloat(a):a,name:B,tooltipPayload:X,midAngle:H,middleRadius:U,tooltipPosition:Q},F),T),{},{value:E,dataKey:m,startAngle:R,endAngle:Y,payload:F,paddingAngle:Vs(y)*j}),S})}return P}function vVe(e){var{showLabels:n,sectors:i,children:r}=e,o=l.useMemo(()=>!n||!i?[]:i.map(s=>({value:s.value,payload:s.payload,clockWise:!1,parentViewBox:void 0,viewBox:{cx:s.cx,cy:s.cy,innerRadius:s.innerRadius,outerRadius:s.outerRadius,startAngle:s.startAngle,endAngle:s.endAngle,clockWise:!1},fill:s.fill})),[i,n]);return l.createElement(eGe,{value:n?o:void 0},r)}function wVe(e){var{props:n,previousSectorsRef:i,id:r}=e,{sectors:o,isAnimationActive:s,animationBegin:a,animationDuration:c,animationEasing:u,activeShape:m,inactiveShape:h,onAnimationStart:g,onAnimationEnd:x}=n,y=h1(n,"recharts-pie-"),w=i.current,[j,v]=l.useState(!1),_=l.useCallback(()=>{typeof x=="function"&&x(),v(!1)},[x]),$=l.useCallback(()=>{typeof g=="function"&&g(),v(!0)},[g]);return l.createElement(vVe,{showLabels:!j,sectors:o},l.createElement(m1,{animationId:y,begin:a,duration:c,isActive:s,easing:u,onAnimationStart:$,onAnimationEnd:_,key:y},k=>{var P=[],S=o&&o[0],I=S?.startAngle;return o?.forEach((A,E)=>{var B=w&&w[E],T=E>0?Py(A,"paddingAngle",0):0;if(B){var M=ir(B.endAngle-B.startAngle,A.endAngle-A.startAngle,k),R=Ao(Ao({},A),{},{startAngle:I+T,endAngle:I+M+T});P.push(R),I=R.endAngle}else{var{endAngle:F,startAngle:Y}=A,H=ir(0,F-Y,k),U=Ao(Ao({},A),{},{startAngle:I+T,endAngle:I+H+T});P.push(U),I=U.endAngle}}),i.current=P,l.createElement(bo,null,l.createElement(xVe,{sectors:P,activeShape:m,inactiveShape:h,allOtherPieProps:n,shape:n.shape,id:r}))}),l.createElement(yVe,{showLabels:!j,sectors:o,props:n}),n.children)}var jVe={animationBegin:400,animationDuration:1500,animationEasing:"ease",cx:"50%",cy:"50%",dataKey:"value",endAngle:360,fill:"#808080",hide:!1,innerRadius:0,isAnimationActive:"auto",label:!1,labelLine:!0,legendType:"rect",minAngle:0,nameKey:"name",outerRadius:"80%",paddingAngle:0,rootTabIndex:0,startAngle:0,stroke:"#fff",zIndex:zo.area};function _Ve(e){var{id:n}=e,i=PA(e,tVe),{hide:r,className:o,rootTabIndex:s}=e,a=l.useMemo(()=>SO(e.children,py),[e.children]),c=gn(h=>yGe(h,n,a)),u=l.useRef(null),m=Ri("recharts-pie",o);return r||c==null?(u.current=null,l.createElement(bo,{tabIndex:s,className:m})):l.createElement(Ha,{zIndex:e.zIndex},l.createElement(lVe,{dataKey:e.dataKey,nameKey:e.nameKey,sectors:c,stroke:e.stroke,strokeWidth:e.strokeWidth,fill:e.fill,name:e.name,hide:e.hide,tooltipType:e.tooltipType,id:n}),l.createElement(bo,{tabIndex:s,className:m},l.createElement(wVe,{props:Ao(Ao({},i),{},{sectors:c}),previousSectorsRef:u,id:n})))}function ece(e){var n=jo(e,jVe),{id:i}=n,r=PA(n,nVe),o=yl(r);return l.createElement(IA,{id:i,type:"pie"},s=>l.createElement(l.Fragment,null,l.createElement(ZGe,{type:"pie",id:s,data:r.data,dataKey:r.dataKey,hide:r.hide,angleAxisId:0,radiusAxisId:0,name:r.name,nameKey:r.nameKey,tooltipType:r.tooltipType,legendType:r.legendType,fill:r.fill,cx:r.cx,cy:r.cy,startAngle:r.startAngle,endAngle:r.endAngle,paddingAngle:r.paddingAngle,minAngle:r.minAngle,innerRadius:r.innerRadius,outerRadius:r.outerRadius,cornerRadius:r.cornerRadius,presentationProps:o,maxRadius:n.maxRadius}),l.createElement(aVe,zf({},r,{id:s})),l.createElement(_Ve,zf({},r,{id:s}))))}ece.displayName="Pie";var CVe=["points"];function yV(e,n){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),i.push.apply(i,r)}return i}function S6(e){for(var n=1;n<arguments.length;n++){var i=arguments[n]!=null?arguments[n]:{};
7785n%2?yV(Object(i),!0).forEach(function(r){SVe(e,r,i[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):yV(Object(i)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(i,r))})}return e}function SVe(e,n,i){return(n=kVe(n))in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i,e}function kVe(e){var n=$Ve(e,"string");return typeof n=="symbol"?n:n+""}function $Ve(e,n){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,n);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function BI(){return BI=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var i=arguments[n];for(var r in i)({}).hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},BI.apply(null,arguments)}function IVe(e,n){if(e==null)return{};var i,r,o=PVe(e,n);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)i=s[r],n.indexOf(i)===-1&&{}.propertyIsEnumerable.call(e,i)&&(o[i]=e[i])}return o}function PVe(e,n){if(e==null)return{};var i={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(n.indexOf(r)!==-1)continue;i[r]=e[r]}return i}function AVe(e){var{option:n,dotProps:i,className:r}=e;if(l.isValidElement(n))return l.cloneElement(n,i);if(typeof n=="function")return n(i);var o=Ri(r,typeof n!="boolean"?n.className:""),s=i??{},{points:a}=s,c=IVe(s,CVe);return l.createElement(Vle,BI({},c,{className:o}))}function NVe(e,n){return e==null?!1:n?!0:e.length===1}function tce(e){var{points:n,dot:i,className:r,dotClassName:o,dataKey:s,baseProps:a,needClip:c,clipPathId:u,zIndex:m=zo.scatter}=e;if(!NVe(n,i))return null;var h=kO(i),g=Q3e(i),x=n.map((w,j)=>{var v,_,$=S6(S6(S6({r:3},a),g),{},{index:j,cx:(v=w.x)!==null&&v!==void 0?v:void 0,cy:(_=w.y)!==null&&_!==void 0?_:void 0,dataKey:s,value:w.value,payload:w.payload,points:n});return l.createElement(AVe,{key:"dot-".concat(j),option:i,dotProps:$,className:o})}),y={};return c&&u!=null&&(y.clipPath="url(#clipPath-".concat(h?"":"dots-").concat(u,")")),l.createElement(Ha,{zIndex:m},l.createElement(bo,BI({className:r},y),x))}function xV(e,n){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),i.push.apply(i,r)}return i}function bV(e){for(var n=1;n<arguments.length;n++){var i=arguments[n]!=null?arguments[n]:{};n%2?xV(Object(i),!0).forEach(function(r){zVe(e,r,i[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):xV(Object(i)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(i,r))})}return e}function zVe(e,n,i){return(n=TVe(n))in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i,e}function TVe(e){var n=EVe(e,"string");return typeof n=="symbol"?n:n+""}function EVe(e,n){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,n);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}var nce=0,MVe={xAxis:{},yAxis:{},zAxis:{}},ice=nc({name:"cartesianAxis",initialState:MVe,reducers:{addXAxis:{reducer(e,n){e.xAxis[n.payload.id]=n.payload},prepare:oo()},replaceXAxis:{reducer(e,n){var{prev:i,next:r}=n.payload;e.xAxis[i.id]!==void 0&&(i.id!==r.id&&delete e.xAxis[i.id],e.xAxis[r.id]=r)},prepare:oo()},removeXAxis:{reducer(e,n){delete e.xAxis[n.payload.id]},prepare:oo()},addYAxis:{reducer(e,n){e.yAxis[n.payload.id]=n.payload},prepare:oo()},replaceYAxis:{reducer(e,n){var{prev:i,next:r}=n.payload;e.yAxis[i.id]!==void 0&&(i.id!==r.id&&delete e.yAxis[i.id],e.yAxis[r.id]=r)},prepare:oo()},removeYAxis:{reducer(e,n){delete e.yAxis[n.payload.id]},prepare:oo()},addZAxis:{reducer(e,n){e.zAxis[n.payload.id]=n.payload},prepare:oo()},replaceZAxis:{reducer(e,n){var{prev:i,next:r}=n.payload;e.zAxis[i.id]!==void 0&&(i.id!==r.id&&delete e.zAxis[i.id],e.zAxis[r.id]=r)},prepare:oo()},removeZAxis:{reducer(e,n){delete e.zAxis[n.payload.id]},prepare:oo()},updateYAxisWidth(e,n){var{id:i,width:r}=n.payload,o=e.yAxis[i];if(o){var s=o.widthHistory||[];if(s.length===3&&s[0]===s[2]&&r===s[1]&&r!==o.width&&Math.abs(r-s[0])<=1)return;var a=[...s,r].slice(-3);e.yAxis[i]=bV(bV({},e.yAxis[i]),{}
7785,{width:r,widthHistory:a})}}}}),{addXAxis:RVe,replaceXAxis:OVe,removeXAxis:DVe,addYAxis:LVe,replaceYAxis:BVe,removeYAxis:FVe,addZAxis:e6t,replaceZAxis:t6t,removeZAxis:n6t,updateYAxisWidth:WVe}=ice.actions,UVe=ice.reducer,HVe=_t([ks],e=>({top:e.top,bottom:e.bottom,left:e.left,right:e.right})),qVe=_t([HVe,sh,ah],(e,n,i)=>{if(!(!e||n==null||i==null))return{x:e.left,y:e.top,width:Math.max(0,n-e.left-e.right),height:Math.max(0,i-e.top-e.bottom)}}),AA=()=>gn(qVe),GVe=()=>gn(LUe);function vV(e,n){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),i.push.apply(i,r)}return i}function k6(e){for(var n=1;n<arguments.length;n++){var i=arguments[n]!=null?arguments[n]:{};n%2?vV(Object(i),!0).forEach(function(r){VVe(e,r,i[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):vV(Object(i)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(i,r))})}return e}function VVe(e,n,i){return(n=KVe(n))in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i,e}function KVe(e){var n=YVe(e,"string");return typeof n=="symbol"?n:n+""}function YVe(e,n){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,n);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}var XVe=e=>{var{point:n,childIndex:i,mainColor:r,activeDot:o,dataKey:s,clipPath:a}=e;if(o===!1||n.x==null||n.y==null)return null;var c={index:i,dataKey:s,cx:n.x,cy:n.y,r:4,fill:r??"none",strokeWidth:2,stroke:"#fff",payload:n.payload,value:n.value},u=k6(k6(k6({},c),$y(o)),YM(o)),m;return l.isValidElement(o)?m=l.cloneElement(o,u):typeof o=="function"?m=o(u):m=l.createElement(Vle,u),l.createElement(bo,{className:"recharts-active-dot",clipPath:a},m)};function e8(e){var{points:n,mainColor:i,activeDot:r,itemDataKey:o,clipPath:s,zIndex:a=zo.activeDot}=e,c=gn(Nf),u=GVe();if(n==null||u==null)return null;var m=n.find(h=>u.includes(h.payload));return eo(m)?null:l.createElement(Ha,{zIndex:a},l.createElement(XVe,{point:m,childIndex:Number(c),mainColor:i,dataKey:o,activeDot:r,clipPath:s}))}var wV=(e,n,i)=>{var r=i??e;if(!eo(r))return Wa(r,n,0)},QVe=(e,n,i)=>{var r={},o=e.filter(fA),s=e.filter(m=>m.stackId==null),a=o.reduce((m,h)=>(m[h.stackId]||(m[h.stackId]=[]),m[h.stackId].push(h),m),r),c=Object.entries(a).map(m=>{var[h,g]=m,x=g.map(w=>w.dataKey),y=wV(n,i,g[0].barSize);return{stackId:h,dataKeys:x,barSize:y}}),u=s.map(m=>{var h=[m.dataKey].filter(x=>x!=null),g=wV(n,i,m.barSize);return{stackId:void 0,dataKeys:h,barSize:g}});return[...c,...u]};function jV(e,n){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),i.push.apply(i,r)}return i}function Xk(e){for(var n=1;n<arguments.length;n++){var i=arguments[n]!=null?arguments[n]:{};n%2?jV(Object(i),!0).forEach(function(r){ZVe(e,r,i[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):jV(Object(i)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(i,r))})}return e}function ZVe(e,n,i){return(n=JVe(n))in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i,e}function JVe(e){var n=eKe(e,"string");return typeof n=="symbol"?n:n+""}function eKe(e,n){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,n);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function tKe(e,n,i,r,o){var s=r.length;if(!(s<1)){var a=Wa(e,i,0,!0),c,u=[];if(Vi(r[0].barSize)){var m=!1,h=i/s,g=r.reduce((_,$)=>_+($.barSize||0),0);g+=(s-1)*a,g>=i&&(g-=(s-1)*a,a=0),g>=i&&h>0&&(m=!0,h*=.9,g=s*h);var x=(i-g)/2>>0,y={offset:x-a,size:0};c=r.reduce((_,$)=>{var k,P={stackId:$.stackId,dataKeys:$.dataKeys,position:{offset:y.offset+y.size+a,size:m?h:(k=$.barSize)!==null&&k!==void 0?k:0}},S=[..._,P];return y=S[S.length-1].position,S},u)}else{var w=Wa(n,i,0,!0);i-2*w-(s-1)*a<=0&&(a=0);var j=(i-2*w-(s-1)*a)/s;j>1&&(j>>=0);var v=Vi(o)?Math.min(j,o):j;c=r.reduce((_,$,k)=>[..._,{stackId:$.stackId,dataKeys:$.dataKeys,position:{offset:w+(j+a)*k+(j-v)/2,size:v}}],u)}return c}}var nKe=(e,n,i,r,o,s,a)=>{var c=eo(a)?n:a,u=tKe(i,r,o!==s?o:s,e,c);return o!==s&&u!=null&&(u=u.map(m=>Xk(Xk({},m),{},{position:Xk(Xk({},m.position),{},{offset:m.position.offset-o/2})}))),u},iKe=(e,n)=>{var i=hA(n);if(!(!e||i==null||n==null)){var{stackId:r}=n;if(r!=null){var o=e[r];if(o){var{stackedData:s}=o;if(s)return s.find(a=>a.key===i)}}}};function rKe(e,n){return e&&typeof e=="object"&&"zIndex"in e&&typeof e.zIndex=="number"&&Vi(e.zIndex)?e.zIndex:n}var rce=e=>{var{chartData:n}=e,i=Rr(),r=$s();return l.useEffect(()=>r?()=>{}:(i(PG(n)),()=>{i(PG(void 0))}),[n,i,r]),null},_V={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},oce=nc({name:"brush",initialState:_V,reducers:{setBrushSettings(e,n
7785){return n.payload==null?_V:n.payload}}}),{setBrushSettings:i6t}=oce.actions,oKe=oce.reducer;function CV(e,n){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),i.push.apply(i,r)}return i}function Qk(e){for(var n=1;n<arguments.length;n++){var i=arguments[n]!=null?arguments[n]:{};n%2?CV(Object(i),!0).forEach(function(r){sce(e,r,i[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):CV(Object(i)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(i,r))})}return e}function sce(e,n,i){return(n=sKe(n))in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i,e}function sKe(e){var n=aKe(e,"string");return typeof n=="symbol"?n:n+""}function aKe(e,n){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,n);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}var lKe=(e,n)=>{var{x:i,y:r}=e,{x:o,y:s}=n;return{x:Math.min(i,o),y:Math.min(r,s),width:Math.abs(o-i),height:Math.abs(s-r)}},cKe=e=>{var{x1:n,y1:i,x2:r,y2:o}=e;return lKe({x:n,y:i},{x:r,y:o})};class NA{static create(n){return new NA(n)}constructor(n){this.scale=n}get domain(){return this.scale.domain}get range(){return this.scale.range}get rangeMin(){return this.range()[0]}get rangeMax(){return this.range()[1]}get bandwidth(){return this.scale.bandwidth}
7785apply(n){var{bandAware:i,position:r}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(n!==void 0){if(r)switch(r){case"start":return this.scale(n);case"middle":{var o=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+o}case"end":{var s=this.bandwidth?this.bandwidth():0;return this.scale(n)+s}default:return this.scale(n)}if(i){var a=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+a}return this.scale(n)}}isInRange(n){var i=this.range(),r=i[0],o=i[i.length-1];return r<=o?n>=r&&n<=o:n>=o&&n<=r}}sce(NA,"EPS",1e-4);var dKe=e=>{var n=Object.keys(e).reduce((i,r)=>Qk(Qk({},i),{},{[r]:NA.create(e[r])}),{});return Qk(Qk({},n),{},{apply(i){var{bandAware:r,position:o}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Object.fromEntries(Object.entries(i).map(s=>{var[a,c]=s;return[a,n[a].apply(c,{bandAware:r,position:o})]}))},isInRange(i){return Object.keys(i).every(r=>n[r].isInRange(i[r]))}})};function uKe(e){return(e%180+180)%180}var pKe=function(n){var{width:i,height:r}=n,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,s=uKe(o),a=s*Math.PI/180,c=Math.atan(r/i),u=a>c&&a<Math.PI-c?r/Math.sin(a):i/Math.cos(a);return Math.abs(u)},mKe={dots:[],areas:[],lines:[]},ace=nc({name:"referenceElements",initialState:mKe,reducers:{addDot:(e,n)=>{e.dots.push(n.payload)},removeDot:(e,n)=>{var i=Su(e).dots.findIndex(r=>r===n.payload);i!==-1&&e.dots.splice(i,1)},addArea:(e,n)=>{e.areas.push(n.payload)},removeArea:(e,n)=>{var i=Su(e).areas.findIndex(r=>r===n.payload);i!==-1&&e.areas.splice(i,1)},addLine:(e,n)=>{e.lines.push(n.payload)},removeLine:(e,n)=>{var i=Su(e).lines.findIndex(r=>r===n.payload);i!==-1&&e.lines.splice(i,1)}}}),{addDot:r6t,removeDot:o6t,addArea:s6t,removeArea:a6t,addLine:hKe,removeLine:fKe}=ace.actions,gKe=ace.reducer,lce=l.createContext(void 0),yKe=e=>{var{children:n}=e,[i]=l.useState("".concat(S_("recharts"),"-clip")),r=AA();if(r==null)return null;var{x:o,y:s,width:a,height:c}=r;return l.createElement(lce.Provider,{value:i},l.createElement("defs",null,l.createElement("clipPath",{id:i},l.createElement("rect",{x:o,y:s,height:c,width:a}))),n)},xKe=()=>l.useContext(lce);function SV(e,n){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),i.push.apply(i,r)}return i}function kV(e){for(var n=1;n<arguments.length;n++){var i=arguments[n]!=null?arguments[n]:{};n%2?SV(Object(i),!0).forEach(function(r){bKe(e,r,i[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):SV(Object(i)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(i,r))})}return e}function bKe(e,n,i){return(n=vKe(n))in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i,e}function vKe(e){var n=wKe(e,"string");return typeof n=="symbol"?n:n+""}function wKe(e,n){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,n);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function FI(){return FI=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var i=arguments[n];for(var r in i)({}).hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},FI.apply(null,arguments)}var jKe=(e,n)=>{var i;if(l.isValidElement(e))i=l.cloneElement(e,n);else if(typeof e=="function")i=e(n);else{if(!Vi(n.x1)||!Vi(n.y1)||!Vi(n.x2)||!Vi(n.y2))return null;i=l.createElement("line",FI({},n,{className:"recharts-reference-line-line"}))}return i},_Ke=(e,n,i,r,o,s)=>{var{x:a,width:c}=s,u=o.y.apply(e,{position:i});if(Xl(u)||n==="discard"&&!o.y.isInRange(u))return null;var m=[{x:a+c,y:u},{x:a,y:u}];return r==="left"?m.reverse():m},CKe=(e,n,i,r,o,s)=>{var{y:a,height:c}=s,u=o.x.apply(e,{position:i});if(Xl(u)||n==="discard"&&!o.x.isInRange(u))return null;var m=[{x:u,y:a+c},{x:u,y:a}];return r==="top"?m.reverse():m},SKe=(e,n,i,r)=>{var o=e.map(s=>r.apply(s,{position:i}));return n==="discard"&&o.some(s=>!r.isInRange(s))?null:o},kKe=(e,n,i,r,o,s)=>{var{x:a,y:c,segment:u,ifOverflow:m}=s,h=Md(a),g=Md(c);return g?_Ke(c,m,i,o,e,n):h?CKe(a,m,i,r,e,n):u!=null&&u.length===2?SKe(u,m,i,e):null};function $Ke(e){var n=Rr();return l.useEffect(()=>(n(hKe(e)),()=>{n(fKe(e))})),null}function IKe(e){var{xAxisId:n,yAxisId:i,shape:r,className:o,ifOverflow:s}=e,a=$s(),c=xKe(),u=gn(I=>Op(I,n)),m=gn(I=>Dp(I,i)),h=gn(I=>Zb(I,"xAxis",n,a)),g=gn(I=>Zb(I,"yAxis",i,a)),x=mC();if(!c||!x||u==null||m==null||h==null||g==null)return null;var y=dKe({x:h,y:g}),w=kKe(y,x,e.position,u.orientation,m.orientation,e);if(!w)return null;var[{x:j,y:v},{x:_,y:$}]=w,k=s==="hidden"?"url(#".concat(c,")"):void 0,P=kV(kV({clipPath:k},ba(e)),{},{x1:j,y1:v,x2:_,y2:$}),S=cKe({x1:j,y1:v,x2:_,y2:$});return l.createElement(Ha,{zIndex:e.zIndex},l.createElement(bo,{className:Ri("recharts-reference-line",o)},jKe(r,P),l.createElement(Wle,FI({},S,{lowerWidth:S.width,upperWidth:S.width}),l.createElement(Hle,{label:e.label}),e.children)))}var PKe={ifOverflow:"discard",xAxisId:0,yAxisId:0,fill:"none",stroke:"#ccc",fillOpacity:1,strokeWidth:1,position:"middle",zIndex:zo.line};function cce(e){var n=jo(e,PKe);return l.createElement(l.Fragment,null,l.createElement($Ke,{yAxisId:n.yAxisId,xAxisId:n.xAxisId,ifOverflow:n.ifOverflow,x:n.x,y:n.y,segment:n.segment}),l.createElement(IKe,n))}cce.displayName="ReferenceLine";function dce(e,n){if(n<1)return[];if(n===1)return e;for(var i=[],r=0;r<e.length;r+=n){var o=e[r];o!==void 0&&i.push(o)}return i}function AKe(e,n,i){var r={width:e.width+n.width,height:e.height+n.height};return pKe(r,i)}function NKe(e,n,i){var r=i==="width",{x:o,y:s,width:a,height:c}=e;return n===1?{start:r?o:s,end:r?o+a:s+c}:{start:r?o+a:s+c,end:r?o:s}}function L_(e,n,i,r,o){if(e*n<e*r||e*n>e*o)return!1;var s=i();return e*(n-e*s/2-r)>=0&&e*(n+e*s/2-o)<=0}function zKe(e,n){return dce(e,n+1)}function TKe(e,n,i,r,o){for(var s=(r||[]).slice(),{start:a,end:c}=n,u=0,m=1,h=a,g=function(){var w=r?.[u];if(w===void 0)return{v:dce(r,m)}
7785;var j=u,v,_=()=>(v===void 0&&(v=i(w,j)),v),$=w.coordinate,k=u===0||L_(e,$,_,h,c);k||(u=0,h=a,m+=1),k&&(h=$+e*(_()/2+o),u+=m)},x;m<=s.length;)if(x=g(),x)return x.v;return[]}function EKe(e,n,i,r,o){var s=(r||[]).slice(),a=s.length;if(a===0)return[];for(var{start:c,end:u}=n,m=1;m<=a;m++){for(var h=(a-1)%m,g=c,x=!0,y=function(){var $=r[w],k=w,P,S=()=>(P===void 0&&(P=i($,k)),P),I=$.coordinate,A=w===h||L_(e,I,S,g,u);if(!A)return x=!1,1;A&&(g=I+e*(S()/2+o))},w=h;w<a&&!y();w+=m);if(x){for(var j=[],v=h;v<a;v+=m)j.push(r[v]);return j}}return[]}function $V(e,n){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),i.push.apply(i,r)}return i}function Da(e){for(var n=1;n<arguments.length;n++){var i=arguments[n]!=null?arguments[n]:{};n%2?$V(Object(i),!0).forEach(function(r){MKe(e,r,i[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):$V(Object(i)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(i,r))})}return e}function MKe(e,n,i){return(n=RKe(n))in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i,e}function RKe(e){var n=OKe(e,"string");return typeof n=="symbol"?n:n+""}function OKe(e,n){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,n);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function DKe(e,n,i,r,o){for(var s=(r||[]).slice(),a=s.length,{start:c}=n,{end:u}=n,m=function(x){var y=s[x],w,j=()=>(w===void 0&&(w=i(y,x)),w);if(x===a-1){var v=e*(y.coordinate+e*j()/2-u);s[x]=y=Da(Da({},y),{},{tickCoord:v>0?y.coordinate-v*e:y.coordinate})}else s[x]=y=Da(Da({},y),{},{tickCoord:y.coordinate});if(y.tickCoord!=null){var _=L_(e,y.tickCoord,j,c,u);_&&(u=y.tickCoord-e*(j()/2+o),s[x]=Da(Da({},y),{},{isShow:!0}))}},h=a-1;h>=0;h--)m(h);return s}function LKe(e,n,i,r,o,s){var a=(r||[]).slice(),c=a.length,{start:u,end:m}=n;if(s){var h=r[c-1],g=i(h,c-1),x=e*(h.coordinate+e*g/2-m);if(a[c-1]=h=Da(Da({},h),{},{tickCoord:x>0?h.coordinate-x*e:h.coordinate}),h.tickCoord!=null){var y=L_(e,h.tickCoord,()=>g,u,m);y&&(m=h.tickCoord-e*(g/2+o),a[c-1]=Da(Da({},h),{},{isShow:!0}))}}for(var w=s?c-1:c,j=function($){var k=a[$],P,S=()=>(P===void 0&&(P=i(k,$)),P);if($===0){var I=e*(k.coordinate-e*S()/2-u);a[$]=k=Da(Da({},k),{},{tickCoord:I<0?k.coordinate-I*e:k.coordinate})}else a[$]=k=Da(Da({},k),{},{tickCoord:k.coordinate});if(k.tickCoord!=null){var A=L_(e,k.tickCoord,S,u,m);A&&(u=k.tickCoord+e*(S()/2+o),a[$]=Da(Da({},k),{},{isShow:!0}))}},v=0;v<w;v++)j(v);return a}function TO(e,n,i){var{tick:r,ticks:o,viewBox:s,minTickGap:a,orientation:c,interval:u,tickFormatter:m,unit:h,angle:g}=e;if(!o||!o.length||!r)return[];if(fn(u)||fC.isSsr){var x;return(x=zKe(o,fn(u)?u:0))!==null&&x!==void 0?x:[]}var y=[],w=c==="top"||c==="bottom"?"width":"height",j=h&&w==="width"?c_(h,{fontSize:n,letterSpacing:i}):{width:0,height:0},v=(k,P)=>{var S=typeof m=="function"?m(k.value,P):k.value;return w==="width"?AKe(c_(S,{fontSize:n,letterSpacing:i}),j,g):c_(S,{fontSize:n,letterSpacing:i})[w]},_=o.length>=2?Vs(o[1].coordinate-o[0].coordinate):1,$=NKe(s,_,w);return u==="equidistantPreserveStart"?TKe(_,$,v,o,a):u==="equidistantPreserveEnd"?EKe(_,$,v,o,a):(u==="preserveStart"||u==="preserveStartEnd"?y=LKe(_,$,v,o,a,u==="preserveStartEnd"):y=DKe(_,$,v,o,a),y.filter(k=>k.isShow))}var BKe=e=>{var{ticks:n,label:i,labelGapWithTick:r=5,tickSize:o=0,tickMargin:s=0}=e,a=0;if(n){Array.from(n).forEach(h=>{if(h){var g=h.getBoundingClientRect();g.width>a&&(a=g.width)}});var c=i?i.getBoundingClientRect().width:0,u=o+s,m=a+u+c+(i?r:0);return Math.round(m)}return 0},FKe=["axisLine","width","height","className","hide","ticks","axisType"];function WKe(e,n){if(e==null)return{};var i,r,o=UKe(e,n);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)i=s[r],n.indexOf(i)===-1&&{}.propertyIsEnumerable.call(e,i)&&(o[i]=e[i])}return o}function UKe(e,n){if(e==null)return{};var i={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(n.indexOf(r)!==-1)continue;i[r]=e[r]}return i}function Ty(){return Ty=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var i=arguments[n];for(var r in i)({}).hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},Ty.apply(null,arguments)}function IV(e,n){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),i.push.apply(i,r)}return i}function es(e){for(var n=1;n<arguments.length;n++){var i=arguments[n]!=null?arguments[n]:{};
7785n%2?IV(Object(i),!0).forEach(function(r){HKe(e,r,i[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):IV(Object(i)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(i,r))})}return e}function HKe(e,n,i){return(n=qKe(n))in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i,e}function qKe(e){var n=GKe(e,"string");return typeof n=="symbol"?n:n+""}function GKe(e,n){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,n);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}var Om={x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd",zIndex:zo.axis};function VKe(e){var{x:n,y:i,width:r,height:o,orientation:s,mirror:a,axisLine:c,otherSvgProps:u}=e;if(!c)return null;var m=es(es(es({},u),yl(c)),{},{fill:"none"});if(s==="top"||s==="bottom"){var h=+(s==="top"&&!a||s==="bottom"&&a);m=es(es({},m),{},{x1:n,y1:i+h*o,x2:n+r,y2:i+h*o})}else{var g=+(s==="left"&&!a||s==="right"&&a);m=es(es({},m),{},{x1:n+g*r,y1:i,x2:n+g*r,y2:i+o})}return l.createElement("line",Ty({},m,{className:Ri("recharts-cartesian-axis-line",Py(c,"className"))}))}function KKe(e,n,i,r,o,s,a,c,u){var m,h,g,x,y,w,j=c?-1:1,v=e.tickSize||a,_=fn(e.tickCoord)?e.tickCoord:e.coordinate;switch(s){case"top":m=h=e.coordinate,x=i+ +!c*o,g=x-j*v,w=g-j*u,y=_;break;case"left":g=x=e.coordinate,h=n+ +!c*r,m=h-j*v,y=m-j*u,w=_;break;case"right":g=x=e.coordinate,h=n+ +c*r,m=h+j*v,y=m+j*u,w=_;break;default:m=h=e.coordinate,x=i+ +c*o,g=x+j*v,w=g+j*u,y=_;break}return{line:{x1:m,y1:g,x2:h,y2:x},tick:{x:y,y:w}}}function YKe(e,n){switch(e){case"left":return n?"start":"end";case"right":return n?"end":"start";default:return"middle"}}function XKe(e,n){switch(e){case"left":case"right":return"middle";case"top":return n?"start":"end";default:return n?"end":"start"}}function QKe(e){var{option:n,tickProps:i,value:r}=e,o,s=Ri(i.className,"recharts-cartesian-axis-tick-value");if(l.isValidElement(n))o=l.cloneElement(n,es(es({},i),{},{className:s}));else if(typeof n=="function")o=n(es(es({},i),{},{className:s}));else{var a="recharts-cartesian-axis-tick-value";typeof n!="boolean"&&(a=Ri(a,n?.className)),o=l.createElement(_A,Ty({},i,{className:a}),r)}return o}var ZKe=l.forwardRef((e,n)=>{var{ticks:i=[],tick:r,tickLine:o,stroke:s,tickFormatter:a,unit:c,padding:u,tickTextProps:m,orientation:h,mirror:g,x,y,width:w,height:j,tickSize:v,tickMargin:_,fontSize:$,letterSpacing:k,getTicksConfig:P,events:S,axisType:I}=e,A=TO(es(es({},P),{},{ticks:i}),$,k),E=YKe(h,g),B=XKe(h,g),T=yl(P),M=$y(r),R={};typeof o=="object"&&(R=o);var F=es(es({},T),{},{fill:"none"},R),Y=A.map(X=>es({entry:X},KKe(X,x,y,w,j,h,v,g,_))),H=Y.map(X=>{var{entry:Q,line:K}=X;return l.createElement(bo,{className:"recharts-cartesian-axis-tick",key:"tick-".concat(Q.value,"-").concat(Q.coordinate,"-").concat(Q.tickCoord)},o&&l.createElement("line",Ty({},F,K,{className:Ri("recharts-cartesian-axis-tick-line",Py(o,"className"))})))}),U=Y.map((X,Q)=>{var{entry:K,tick:G}=X,L=es(es(es(es({textAnchor:E,verticalAnchor:B},T),{},{stroke:"none",fill:s},M),G),{},{index:Q,payload:K,visibleTicksCount:A.length,tickFormatter:a,padding:u},m);return l.createElement(bo,Ty({className:"recharts-cartesian-axis-tick-label",key:"tick-label-".concat(K.value,"-").concat(K.coordinate,"-").concat(K.tickCoord)},lC(S,K,Q)),r&&l.createElement(QKe,{option:r,tickProps:L,value:"".concat(typeof a=="function"?a(K.value,Q):K.value).concat(c||"")}))});return l.createElement("g",{className:"recharts-cartesian-axis-ticks recharts-".concat(I,"-ticks")},U.length>0&&l.createElement(Ha,{zIndex:zo.label},l.createElement("g",{className:"recharts-cartesian-axis-tick-labels recharts-".concat(I,"-tick-labels"),ref:n},U)),H.length>0&&l.createElement("g",{className:"recharts-cartesian-axis-tick-lines recharts-".concat(I,"-tick-lines")},H))}
7785),JKe=l.forwardRef((e,n)=>{var{axisLine:i,width:r,height:o,className:s,hide:a,ticks:c,axisType:u}=e,m=WKe(e,FKe),[h,g]=l.useState(""),[x,y]=l.useState(""),w=l.useRef(null);l.useImperativeHandle(n,()=>({getCalculatedWidth:()=>{var v;return BKe({ticks:w.current,label:(v=e.labelRef)===null||v===void 0?void 0:v.current,labelGapWithTick:5,tickSize:e.tickSize,tickMargin:e.tickMargin})}}));var j=l.useCallback(v=>{if(v){var _=v.getElementsByClassName("recharts-cartesian-axis-tick-value");w.current=_;var $=_[0];if($){var k=window.getComputedStyle($),P=k.fontSize,S=k.letterSpacing;(P!==h||S!==x)&&(g(P),y(S))}}},[h,x]);return a||r!=null&&r<=0||o!=null&&o<=0?null:l.createElement(Ha,{zIndex:e.zIndex},l.createElement(bo,{className:Ri("recharts-cartesian-axis",s)},l.createElement(VKe,{x:e.x,y:e.y,width:r,height:o,orientation:e.orientation,mirror:e.mirror,axisLine:i,otherSvgProps:yl(e)}),l.createElement(ZKe,{ref:j,axisType:u,events:m,fontSize:h,getTicksConfig:e,height:e.height,letterSpacing:x,mirror:e.mirror,orientation:e.orientation,padding:e.padding,stroke:e.stroke,tick:e.tick,tickFormatter:e.tickFormatter,tickLine:e.tickLine,tickMargin:e.tickMargin,tickSize:e.tickSize,tickTextProps:e.tickTextProps,ticks:c,unit:e.unit,width:e.width,x:e.x,y:e.y}),l.createElement(Wle,{x:e.x,y:e.y,width:e.width,height:e.height,lowerWidth:e.width,upperWidth:e.width},l.createElement(Hle,{label:e.label,labelRef:e.labelRef}),e.children)))}),EO=l.forwardRef((e,n)=>{var i=jo(e,Om);return l.createElement(JKe,Ty({},i,{ref:n}))});EO.displayName="CartesianAxis";var eYe=["x1","y1","x2","y2","key"],tYe=["offset"],nYe=["xAxisId","yAxisId"],iYe=["xAxisId","yAxisId"];function PV(e,n){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),i.push.apply(i,r)}return i}function Ba(e){for(var n=1;n<arguments.length;n++){var i=arguments[n]!=null?arguments[n]:{};n%2?PV(Object(i),!0).forEach(function(r){rYe(e,r,i[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):PV(Object(i)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(i,r))})}return e}function rYe(e,n,i){return(n=oYe(n))in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i,e}function oYe(e){var n=sYe(e,"string");return typeof n=="symbol"?n:n+""}function sYe(e,n){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,n);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function ry(){return ry=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var i=arguments[n];for(var r in i)({}).hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},ry.apply(null,arguments)}function WI(e,n){if(e==null)return{};var i,r,o=aYe(e,n);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)i=s[r],n.indexOf(i)===-1&&{}.propertyIsEnumerable.call(e,i)&&(o[i]=e[i])}return o}function aYe(e,n){if(e==null)return{};var i={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(n.indexOf(r)!==-1)continue;i[r]=e[r]}return i}var lYe=e=>{var{fill:n}=e;if(!n||n==="none")return null;var{fillOpacity:i,x:r,y:o,width:s,height:a,ry:c}=e;return l.createElement("rect",{x:r,y:o,ry:c,width:s,height:a,stroke:"none",fill:n,fillOpacity:i,className:"recharts-cartesian-grid-bg"})};function uce(e){var{option:n,lineItemProps:i}=e,r;if(l.isValidElement(n))r=l.cloneElement(n,i);else if(typeof n=="function")r=n(i);else{var o,{x1:s,y1:a,x2:c,y2:u,key:m}=i,h=WI(i,eYe),g=(o=yl(h))!==null&&o!==void 0?o:{},{offset:x}=g,y=WI(g,tYe);r=l.createElement("line",ry({},y,{x1:s,y1:a,x2:c,y2:u,fill:"none",key:m}))}return r}function cYe(e){var{x:n,width:i,horizontal:r=!0,horizontalPoints:o}=e;if(!r||!o||!o.length)return null;var{xAxisId:s,yAxisId:a}=e,c=WI(e,nYe),u=o.map((m,h)=>{var g=Ba(Ba({},c),{},{x1:n,y1:m,x2:n+i,y2:m,key:"line-".concat(h),index:h});return l.createElement(uce,{key:"line-".concat(h),option:r,lineItemProps:g})});return l.createElement("g",{className:"recharts-cartesian-grid-horizontal"},u)}function dYe(e){var{y:n,height:i,vertical:r=!0,verticalPoints:o}=e;if(!r||!o||!o.length)return null;var{xAxisId:s,yAxisId:a}=e,c=WI(e,iYe),u=o.map((m,h)=>{var g=Ba(Ba({},c),{},{x1:m,y1:n,x2:m,y2:n+i,key:"line-".concat(h),index:h});return l.createElement(uce,{option:r,lineItemProps:g,key:"line-".concat(h)})});return l.createElement("g",{className:"recharts-cartesian-grid-vertical"},u)}function uYe(e){var{horizontalFill:n,fillOpacity:i,x:r,y:o,width:s,height:a,horizontalPoints:c,horizontal:u=!0}=e;if(!u||!n||!n.length||c==null)return null;var m=c.map(g=>Math.round(g+o-o)).sort((g,x)=>g-x);o!==m[0]&&m.unshift(0);var h=m.map((g,x)=>{var y=!m[x+1],w=y?o+a-g:m[x+1]-g;if(w<=0)return null;var j=x%n.length;return l.createElement("rect",{key:"react-".concat(x),y:g,x:r,height:w,width:s,stroke:"none",fill:n[j],fillOpacity:i,className:"recharts-cartesian-grid-bg"})});return l.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},h)}function pYe(e){var{vertical:n=!0,verticalFill:i,fillOpacity:r,x:o,y:s,width:a,height:c,verticalPoints:u}=e;if(!n||!i||!i.length)return null;var m=u.map(g=>Math.round(g+o-o)).sort((g,x)=>g-x);o!==m[0]&&m.unshift(0);var h=m.map((g,x)=>{var y=!m[x+1],w=y?o+a-g:m[x+1]-g;if(w<=0)return null;var j=x%i.length;return l.createElement("rect",{key:"react-".concat(x),x:g,y:s,width:w,height:c,stroke:"none",fill:i[j],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return l.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},h)}
7785var mYe=(e,n)=>{var{xAxis:i,width:r,height:o,offset:s}=e;return Qoe(TO(Ba(Ba(Ba({},Om),i),{},{ticks:Zoe(i),viewBox:{x:0,y:0,width:r,height:o}})),s.left,s.left+s.width,n)},hYe=(e,n)=>{var{yAxis:i,width:r,height:o,offset:s}=e;return Qoe(TO(Ba(Ba(Ba({},Om),i),{},{ticks:Zoe(i),viewBox:{x:0,y:0,width:r,height:o}})),s.top,s.top+s.height,n)},fYe={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:zo.grid};function Zm(e){var n=lR(),i=cR(),r=ase(),o=Ba(Ba({},jo(e,fYe)),{},{x:fn(e.x)?e.x:r.left,y:fn(e.y)?e.y:r.top,width:fn(e.width)?e.width:r.width,height:fn(e.height)?e.height:r.height}),{xAxisId:s,yAxisId:a,x:c,y:u,width:m,height:h,syncWithTicks:g,horizontalValues:x,verticalValues:y}=o,w=$s(),j=gn(B=>yG(B,"xAxis",s,w)),v=gn(B=>yG(B,"yAxis",a,w));if(!Np(m)||!Np(h)||!fn(c)||!fn(u))return null;var _=o.verticalCoordinatesGenerator||mYe,$=o.horizontalCoordinatesGenerator||hYe,{horizontalPoints:k,verticalPoints:P}=o;if((!k||!k.length)&&typeof $=="function"){var S=x&&x.length,I=$({yAxis:v?Ba(Ba({},v),{},{ticks:S?x:v.ticks}):void 0,width:n??m,height:i??h,offset:r},S?!0:g);hI(Array.isArray(I),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(typeof I,"]")),Array.isArray(I)&&(k=I)}if((!P||!P.length)&&typeof _=="function"){var A=y&&y.length,E=_({xAxis:j?Ba(Ba({},j),{},{ticks:A?y:j.ticks}):void 0,width:n??m,height:i??h,offset:r},A?!0:g);hI(Array.isArray(E),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(typeof E,"]")),Array.isArray(E)&&(P=E)}return l.createElement(Ha,{zIndex:o.zIndex},l.createElement("g",{className:"recharts-cartesian-grid"},l.createElement(lYe,{fill:o.fill,fillOpacity:o.fillOpacity,x:o.x,y:o.y,width:o.width,height:o.height,ry:o.ry}),l.createElement(uYe,ry({},o,{horizontalPoints:k})),l.createElement(pYe,ry({},o,{verticalPoints:P})),l.createElement(cYe,ry({},o,{offset:r,horizontalPoints:k,xAxis:j,yAxis:v})),l.createElement(dYe,ry({},o,{offset:r,verticalPoints:P,xAxis:j,yAxis:v}))))}Zm.displayName="CartesianGrid";var gYe={},pce=nc({name:"errorBars",initialState:gYe,reducers:{addErrorBar:(e,n)=>{var{itemId:i,errorBar:r}=n.payload;e[i]||(e[i]=[]),e[i].push(r)},replaceErrorBar:(e,n)=>{var{itemId:i,prev:r,next:o}=n.payload;e[i]&&(e[i]=e[i].map(s=>s.dataKey===r.dataKey&&s.direction===r.direction?o:s))},removeErrorBar:(e,n)=>{var{itemId:i,errorBar:r}=n.payload;e[i]&&(e[i]=e[i].filter(o=>o.dataKey!==r.dataKey||o.direction!==r.direction))}}}),{addErrorBar:l6t,replaceErrorBar:c6t,removeErrorBar:d6t}=pce.actions,yYe=pce.reducer,xYe=["children"];function bYe(e,n){if(e==null)return{};var i,r,o=vYe(e,n);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)i=s[r],n.indexOf(i)===-1&&{}.propertyIsEnumerable.call(e,i)&&(o[i]=e[i])}return o}function vYe(e,n){if(e==null)return{};var i={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(n.indexOf(r)!==-1)continue;i[r]=e[r]}return i}var wYe={data:[],xAxisId:"xAxis-0",yAxisId:"yAxis-0",dataPointFormatter:()=>({x:0,y:0,value:0}),errorBarOffset:0},jYe=l.createContext(wYe);function mce(e){var{children:n}=e,i=bYe(e,xYe);return l.createElement(jYe.Provider,{value:i},n)}function zA(e,n){var i,r,o=gn(m=>Op(m,e)),s=gn(m=>Dp(m,n)),a=(i=o?.allowDataOverflow)!==null&&i!==void 0?i:Ls.allowDataOverflow,c=(r=s?.allowDataOverflow)!==null&&r!==void 0?r:Bs.allowDataOverflow,u=a||c;return{needClip:u,needClipX:a,needClipY:c}}function MO(e){var{xAxisId:n,yAxisId:i,clipPathId:r}=e,o=AA(),{needClipX:s,needClipY:a,needClip:c}=zA(n,i);if(!c||!o)return null;var{x:u,y:m,width:h,height:g}=o;return l.createElement("clipPath",{id:"clipPath-".concat(r)},l.createElement("rect",{x:s?u:u-h/2,y:a?m:m-g/2,width:s?h:h*2,height:a?g:g*2}))}var hce=(e,n,i,r)=>Ep(e,"xAxis",n,r),fce=(e,n,i,r)=>Tp(e,"xAxis",n,r),gce=(e,n,i,r)=>Ep(e,"yAxis",i,r),yce=(e,n,i,r)=>Tp(e,"yAxis",i,r),_Ye=_t([ji,hce,gce,fce,yce],(e,n,i,r,o)=>Rp(e,"xAxis")?Pf(n,r,!1):Pf(i,o,!1)),CYe=(e,n,i,r,o)=>o;function SYe(e){return e.type==="line"}var kYe=_t([_C,CYe],(e,n)=>e.filter(SYe).find(i=>i.id===n)),$Ye=_t([ji,hce,gce,fce,yce,kYe,_Ye,MR],(e,n,i,r,o,s,a,c)=>{var{chartData:u,dataStartIndex:m,dataEndIndex:h}=c;if(!(s==null||n==null||i==null||r==null||o==null||r.length===0||o.length===0||a==null||e!=="horizontal"&&e!=="vertical")){var{dataKey:g,data:x}=s,y;if(x!=null&&x.length>0?y=x:y=u?.slice(m,h+1),y!=null)return mXe({layout:e,xAxis:n,yAxis:i,xAxisTicks:r,yAxisTicks:o,dataKey:g,bandSize:a,displayedData:y})}});function xce(e){var n=$y(e),i=3,r=2;if(n!=null){var{r:o,strokeWidth:s}=n,a=Number(o),c=Number(s);return(Number.isNaN(a)||a<0)&&(a=i),(Number.isNaN(c)||c<0)&&(c=r),{r:a,strokeWidth:c}}return{r:i,strokeWidth:r}}var $6={exports:{}},I6={};var AV;function IYe(){if(AV)return I6;AV=1;var e=n1();function n(u,m){return u===m&&(u!==0||1/u===1/m)||u!==u&&m!==m}var i=typeof Object.is=="function"?Object.is:n,r=e.useSyncExternalStore,o=e.useRef,s=e.useEffect,a=e.useMemo,c=e.useDebugValue;return I6.useSyncExternalStoreWithSelector=function(u,m,h,g,x){var y=o(null);if(y.current===null){var w={hasValue:!1,value:null};y.current=w}else w=y.current;y=a(function(){function v(S){if(!_){if(_=!0,$=S,S=g(S),x!==void 0&&w.hasValue){var I=w.value;if(x(I,S))return k=I}return k=S}if(I=k,i($,S))return I;var A=g(S);return x!==void 0&&x(I,A)?($=S,I):($=S,k=A)}var _=!1,$,k,P=h===void 0?null:h;return[function(){return v(m())},P===null?void 0:function(){return v(P())}]},[m,h,g,x]);var j=r(u,y[0],y[1]);return s(function(){w.hasValue=!0,w.value=j},[j]),c(j),j},I6}var NV;function PYe(){return NV||(NV=1,$6.exports=IYe()),$6.exports}
7785PYe();function AYe(e){e()}function NYe(){let e=null,n=null;return{clear(){e=null,n=null},notify(){AYe(()=>{let i=e;for(;i;)i.callback(),i=i.next})},get(){const i=[];let r=e;for(;r;)i.push(r),r=r.next;return i},subscribe(i){let r=!0;const o=n={callback:i,next:null,prev:n};return o.prev?o.prev.next=o:e=o,function(){!r||e===null||(r=!1,o.next?o.next.prev=o.prev:n=o.prev,o.prev?o.prev.next=o.next:e=o.next)}}}}var zV={notify(){},get:()=>[]};function zYe(e,n){let i,r=zV,o=0,s=!1;function a(j){h();const v=r.subscribe(j);let _=!1;return()=>{_||(_=!0,v(),g())}}function c(){r.notify()}function u(){w.onStateChange&&w.onStateChange()}function m(){return s}function h(){o++,i||(i=e.subscribe(u),r=NYe())}function g(){o--,i&&o===0&&(i(),i=void 0,r.clear(),r=zV)}function x(){s||(s=!0,h())}function y(){s&&(s=!1,g())}const w={addNestedSub:a,notifyNestedSubs:c,handleChangeWrapper:u,isSubscribed:m,trySubscribe:x,tryUnsubscribe:y,getListeners:()=>r};return w}var TYe=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",EYe=TYe(),MYe=()=>typeof navigator<"u"&&navigator.product==="ReactNative",RYe=MYe(),OYe=()=>EYe||RYe?l.useLayoutEffect:l.useEffect,DYe=OYe();function TV(e,n){return e===n?e!==0||n!==0||1/e===1/n:e!==e&&n!==n}function LYe(e,n){if(TV(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;const i=Object.keys(e),r=Object.keys(n);if(i.length!==r.length)return!1;for(let o=0;o<i.length;o++)if(!Object.prototype.hasOwnProperty.call(n,i[o])||!TV(e[i[o]],n[i[o]]))return!1;return!0}var BYe=Symbol.for("react-redux-context"),FYe=typeof globalThis<"u"?globalThis:{};function WYe(){if(!l.createContext)return{};const e=FYe[BYe]??=new Map;let n=e.get(l.createContext);return n||(n=l.createContext(null),e.set(l.createContext,n)),n}var UYe=WYe();function HYe(e){const{children:n,context:i,serverState:r,store:o}=e,s=l.useMemo(()=>{const u=zYe(o);return{store:o,subscription:u,getServerState:r?()=>r:void 0}},[o,r]),a=l.useMemo(()=>o.getState(),[o]);DYe(()=>{const{subscription:u}=s;return u.onStateChange=u.notifyNestedSubs,u.trySubscribe(),a!==o.getState()&&u.notifyNestedSubs(),()=>{u.tryUnsubscribe(),u.onStateChange=void 0}},[s,a]);const c=i||UYe;return l.createElement(c.Provider,{value:s},n)}var qYe=HYe,GYe=new Set(["axisLine","tickLine","activeBar","activeDot","activeLabel","activeShape","allowEscapeViewBox","background","cursor","dot","label","line","margin","padding","position","shape","style","tick","wrapperStyle","radius"]);function VYe(e,n){return e==null&&n==null?!0:typeof e=="number"&&typeof n=="number"?e===n||e!==e&&n!==n:e===n}function AC(e,n){var i=new Set([...Object.keys(e),...Object.keys(n)]);for(var r of i)if(GYe.has(r)){if(e[r]==null&&n[r]==null)continue;if(!LYe(e[r],n[r]))return!1}else if(!VYe(e[r],n[r]))return!1;return!0}var KYe=["id"],YYe=["type","layout","connectNulls","needClip","shape"],XYe=["activeDot","animateNewValues","animationBegin","animationDuration","animationEasing","connectNulls","dot","hide","isAnimationActive","label","legendType","xAxisId","yAxisId","id"];function B_(){return B_=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var i=arguments[n];for(var r in i)({}).hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},B_.apply(null,arguments)}function EV(e,n){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),i.push.apply(i,r)}return i}function jp(e){for(var n=1;n<arguments.length;n++){var i=arguments[n]!=null?arguments[n]:{};n%2?EV(Object(i),!0).forEach(function(r){QYe(e,r,i[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):EV(Object(i)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(i,r))})}return e}function QYe(e,n,i){return(n=ZYe(n))in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i,e}function ZYe(e){var n=JYe(e,"string");return typeof n=="symbol"?n:n+""}function JYe(e,n){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,n);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function RO(e,n){if(e==null)return{};var i,r,o=eXe(e,n);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)i=s[r],n.indexOf(i)===-1&&{}.propertyIsEnumerable.call(e,i)&&(o[i]=e[i])}return o}function eXe(e,n){if(e==null)return{};var i={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(n.indexOf(r)!==-1)continue;i[r]=e[r]}return i}var tXe=e=>{var{dataKey:n,name:i,stroke:r,legendType:o,hide:s}=e;return[{inactive:s,dataKey:n,type:o,color:r,value:Df(i,n),payload:e}]},nXe=l.memo(e=>{var{dataKey:n,data:i,stroke:r,strokeWidth:o,fill:s,name:a,hide:c,unit:u,tooltipType:m,id:h}=e,g={dataDefinedOnItem:i,positions:void 0,settings:{stroke:r,strokeWidth:o,fill:s,dataKey:n,nameKey:void 0,name:Df(a,n),hide:c,type:m,color:r,unit:u,graphicalItemId:h}};return l.createElement($A,{tooltipEntrySettings:g})}),bce=(e,n)=>"".concat(n,"px ").concat(e-n,"px");function iXe(e,n){for(var i=e.length%2!==0?[...e,0]:e,r=[],o=0;o<n;++o)r=[...r,...i];return r}var rXe=(e,n,i)=>{var r=i.reduce((g,x)=>g+x);if(!r)return bce(n,e);for(var o=Math.floor(e/r),s=e%r,a=n-e,c=[],u=0,m=0;u<i.length;m+=i[u],++u)if(m+i[u]>s){c=[...i.slice(0,u),s-m];break}var h=c.length%2===0?[0,a]:[a];return[...iXe(i,o),...c,...h].map(g=>"".concat(g,"px")).join(", ")};function oXe(e){var{clipPathId:n,points:i,props:r}=e,{dot:o,dataKey:s,needClip:a}=r,{id:c}=r,u=RO(r,KYe),m=yl(u);return l.createElement(tce,{points:i,dot:o,className:"recharts-line-dots",dotClassName:"recharts-line-dot",dataKey:s,baseProps:m,needClip:a,clipPathId:n})}function sXe(e){var{showLabels:n,children:i,points:r}=e,o=l.useMemo(()=>r?.map(s=>{var a,c,u={x:(a=s.x)!==null&&a!==void 0?a:0,y:(c=s.y)!==null&&c!==void 0?c:0,width:0,lowerWidth:0,upperWidth:0,height:0};return jp(jp({},u),{},{value:s.value,payload:s.payload,viewBox:u,parentViewBox:void 0,fill:void 0})}),[r]);return l.createElement(jO,{value:n?o:void 0},i)}function MV(e){var{clipPathId:n,pathRef:i,points:r,strokeDasharray:o,props:s}=e,{type:a,layout:c,connectNulls:u,needClip:m,shape:h}
7785=s,g=RO(s,YYe),x=jp(jp({},ba(g)),{},{fill:"none",className:"recharts-line-curve",clipPath:m?"url(#clipPath-".concat(n,")"):void 0,points:r,type:a,layout:c,connectNulls:u,strokeDasharray:o??s.strokeDasharray});return l.createElement(l.Fragment,null,r?.length>1&&l.createElement($O,B_({shapeType:"curve",option:h},x,{pathRef:i})),l.createElement(oXe,{points:r,clipPathId:n,props:s}))}function aXe(e){try{return e&&e.getTotalLength&&e.getTotalLength()||0}catch{return 0}}function lXe(e){var{clipPathId:n,props:i,pathRef:r,previousPointsRef:o,longestAnimatedLengthRef:s}=e,{points:a,strokeDasharray:c,isAnimationActive:u,animationBegin:m,animationDuration:h,animationEasing:g,animateNewValues:x,width:y,height:w,onAnimationEnd:j,onAnimationStart:v}=i,_=o.current,$=h1(a,"recharts-line-"),k=l.useRef($),[P,S]=l.useState(!1),I=!P,A=l.useCallback(()=>{typeof j=="function"&&j(),S(!1)},[j]),E=l.useCallback(()=>{typeof v=="function"&&v(),S(!0)},[v]),B=aXe(r.current),T=l.useRef(0);k.current!==$&&(T.current=s.current,k.current=$);var M=T.current;return l.createElement(sXe,{points:a,showLabels:I},i.children,l.createElement(m1,{animationId:$,begin:m,duration:h,isActive:u,easing:g,onAnimationEnd:A,onAnimationStart:E,key:$},R=>{var F=ir(M,B+M,R),Y=Math.min(F,B),H;if(u)if(c){var U="".concat(c).split(/[,\s]+/gim).map(K=>parseFloat(K));H=rXe(Y,B,U)}else H=bce(B,Y);else H=c==null?void 0:String(c);if(R>0&&B>0&&(o.current=a,s.current=Math.max(s.current,Y)),_){var X=_.length/a.length,Q=R===1?a:a.map((K,G)=>{var L=Math.floor(G*X);if(_[L]){var q=_[L];return jp(jp({},K),{},{x:ir(q.x,K.x,R),y:ir(q.y,K.y,R)})}return x?jp(jp({},K),{},{x:ir(y*2,K.x,R),y:ir(w/2,K.y,R)}):jp(jp({},K),{},{x:K.x,y:K.y})});return o.current=Q,l.createElement(MV,{props:i,points:Q,clipPathId:n,pathRef:r,strokeDasharray:H})}return l.createElement(MV,{props:i,points:a,clipPathId:n,pathRef:r,strokeDasharray:H})}),l.createElement(CA,{label:i.label}))}function cXe(e){var{clipPathId:n,props:i}=e,r=l.useRef(null),o=l.useRef(0),s=l.useRef(null);return l.createElement(lXe,{props:i,clipPathId:n,previousPointsRef:r,longestAnimatedLengthRef:o,pathRef:s})}var dXe=(e,n)=>{var i,r;return{x:(i=e.x)!==null&&i!==void 0?i:void 0,y:(r=e.y)!==null&&r!==void 0?r:void 0,value:e.value,errorVal:or(e.payload,n)}};class uXe extends l.Component{render(){var{hide:n,dot:i,points:r,className:o,xAxisId:s,yAxisId:a,top:c,left:u,width:m,height:h,id:g,needClip:x,zIndex:y}=this.props;if(n)return null;var w=Ri("recharts-line",o),j=g,{r:v,strokeWidth:_}=xce(i),$=kO(i),k=v*2+_,P=x?"url(#clipPath-".concat($?"":"dots-").concat(j,")"):void 0;return l.createElement(Ha,{zIndex:y},l.createElement(bo,{className:w},x&&l.createElement("defs",null,l.createElement(MO,{clipPathId:j,xAxisId:s,yAxisId:a}),!$&&l.createElement("clipPath",{id:"clipPath-dots-".concat(j)},l.createElement("rect",{x:u-k/2,y:c-k/2,width:m+k,height:h+k}))),l.createElement(mce,{xAxisId:s,yAxisId:a,data:r,dataPointFormatter:dXe,errorBarOffset:0},l.createElement(cXe,{props:this.props,clipPathId:j}))),l.createElement(e8,{activeDot:this.props.activeDot,points:r,mainColor:this.props.stroke,itemDataKey:this.props.dataKey,clipPath:P}))}}var vce={activeDot:!0,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!0,fill:"#fff",hide:!1,isAnimationActive:"auto",label:!1,legendType:"line",stroke:"#3182bd",strokeWidth:1,xAxisId:0,yAxisId:0,zIndex:zo.line,type:"linear"};function pXe(e){var n=jo(e,vce),{activeDot:i,animateNewValues:r,animationBegin:o,animationDuration:s,animationEasing:a,connectNulls:c,dot:u,hide:m,isAnimationActive:h,label:g,legendType:x,xAxisId:y,yAxisId:w,id:j}=n,v=RO(n,XYe),{needClip:_}=zA(y,w),$=AA(),k=Lf(),P=$s(),S=gn(T=>$Ye(T,y,w,P,j));if(k!=="horizontal"&&k!=="vertical"||S==null||$==null)return null;var{height:I,width:A,x:E,y:B}=$;return l.createElement(uXe,B_({},v,{id:j,connectNulls:c,dot:u,activeDot:i,animateNewValues:r,animationBegin:o,animationDuration:s,animationEasing:a,isAnimationActive:h,hide:m,label:g,legendType:x,xAxisId:y,yAxisId:w,points:S,layout:k,height:I,width:A,left:E,top:B,needClip:_}))}function mXe(e){var{layout:n,xAxis:i,yAxis:r,xAxisTicks:o,yAxisTicks:s,dataKey:a,bandSize:c,displayedData:u}=e;return u.map((m,h)=>{var g=or(m,a);if(n==="horizontal"){var x=mI({axis:i,ticks:o,bandSize:c,entry:m,index:h}),y=eo(g)?null:r.scale(g);return{x,y,value:g,payload:m}}var w=eo(g)?null:i.scale(g),j=mI({axis:r,ticks:s,bandSize:c,entry:m,index:h});return w==null||j==null?null:{x:w,y:j,value:g,payload:m}}
7785).filter(Boolean)}function hXe(e){var n=jo(e,vce),i=$s();return l.createElement(IA,{id:n.id,type:"line"},r=>l.createElement(l.Fragment,null,l.createElement(NO,{legendPayload:tXe(n)}),l.createElement(nXe,{dataKey:n.dataKey,data:n.data,stroke:n.stroke,strokeWidth:n.strokeWidth,fill:n.fill,name:n.name,hide:n.hide,unit:n.unit,tooltipType:n.tooltipType,id:r}),l.createElement(zO,{type:"line",id:r,data:n.data,xAxisId:n.xAxisId,yAxisId:n.yAxisId,zAxisId:0,dataKey:n.dataKey,hide:n.hide,isPanorama:i}),l.createElement(pXe,B_({},n,{id:r}))))}var Nd=l.memo(hXe,AC);Nd.displayName="Line";function Lp(e,n){var i,r;return(i=(r=e.graphicalItems.cartesianItems.find(o=>o.id===n))===null||r===void 0?void 0:r.xAxisId)!==null&&i!==void 0?i:nce}function Bp(e,n){var i,r;return(i=(r=e.graphicalItems.cartesianItems.find(o=>o.id===n))===null||r===void 0?void 0:r.yAxisId)!==null&&i!==void 0?i:nce}var wce=(e,n,i)=>Ep(e,"xAxis",Lp(e,n),i),jce=(e,n,i)=>Tp(e,"xAxis",Lp(e,n),i),_ce=(e,n,i)=>Ep(e,"yAxis",Bp(e,n),i),Cce=(e,n,i)=>Tp(e,"yAxis",Bp(e,n),i),fXe=_t([ji,wce,_ce,jce,Cce],(e,n,i,r,o)=>Rp(e,"xAxis")?Pf(n,r,!1):Pf(i,o,!1)),gXe=(e,n)=>n,Sce=_t([_C,gXe],(e,n)=>e.filter(i=>i.type==="area").find(i=>i.id===n)),kce=e=>{var n=ji(e),i=Rp(n,"xAxis");return i?"yAxis":"xAxis"},yXe=(e,n)=>{var i=kce(e);return i==="yAxis"?Bp(e,n):Lp(e,n)},xXe=(e,n,i)=>EI(e,kce(e),yXe(e,n),i),bXe=_t([Sce,xXe],(e,n)=>{var i;if(!(e==null||n==null)){var{stackId:r}=e,o=hA(e);if(!(r==null||o==null)){var s=(i=n[r])===null||i===void 0?void 0:i.stackedData,a=s?.find(c=>c.key===o);if(a!=null)return a.map(c=>[c[0],c[1]])}}}),vXe=_t([ji,wce,_ce,jce,Cce,bXe,cae,fXe,Sce,OFe],(e,n,i,r,o,s,a,c,u,m)=>{var{chartData:h,dataStartIndex:g,dataEndIndex:x}=a;if(!(u==null||e!=="horizontal"&&e!=="vertical"||n==null||i==null||r==null||o==null||r.length===0||o.length===0||c==null)){var{data:y}=u,w;if(y&&y.length>0?w=y:w=h?.slice(g,x+1),w!=null)return LXe({layout:e,xAxis:n,yAxis:i,xAxisTicks:r,yAxisTicks:o,dataStartIndex:g,areaSettings:u,stackedData:s,displayedData:w,chartBaseValue:m,bandSize:c})}}),wXe=["id"],jXe=["activeDot","animationBegin","animationDuration","animationEasing","connectNulls","dot","fill","fillOpacity","hide","isAnimationActive","legendType","stroke","xAxisId","yAxisId"];function my(){return my=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var i=arguments[n];for(var r in i)({}).hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},my.apply(null,arguments)}function $ce(e,n){if(e==null)return{};var i,r,o=_Xe(e,n);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)i=s[r],n.indexOf(i)===-1&&{}.propertyIsEnumerable.call(e,i)&&(o[i]=e[i])}return o}function _Xe(e,n){if(e==null)return{};var i={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(n.indexOf(r)!==-1)continue;i[r]=e[r]}return i}function RV(e,n){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),i.push.apply(i,r)}return i}function pb(e){for(var n=1;n<arguments.length;n++){var i=arguments[n]!=null?arguments[n]:{};n%2?RV(Object(i),!0).forEach(function(r){CXe(e,r,i[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):RV(Object(i)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(i,r))})}return e}function CXe(e,n,i){return(n=SXe(n))in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i,e}function SXe(e){var n=kXe(e,"string");return typeof n=="symbol"?n:n+""}function kXe(e,n){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,n);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function UI(e,n){return e&&e!=="none"?e:n}var $Xe=e=>{var{dataKey:n,name:i,stroke:r,fill:o,legendType:s,hide:a}=e;return[{inactive:a,dataKey:n,type:s,color:UI(r,o),value:Df(i,n),payload:e}]},IXe=l.memo(e=>{var{dataKey:n,data:i,stroke:r,strokeWidth:o,fill:s,name:a,hide:c,unit:u,tooltipType:m,id:h}=e,g={dataDefinedOnItem:i,positions:void 0,settings:{stroke:r,strokeWidth:o,fill:s,dataKey:n,nameKey:void 0,name:Df(a,n),hide:c,type:m,color:UI(r,s),unit:u,graphicalItemId:h}};return l.createElement($A,{tooltipEntrySettings:g})});function PXe(e){var{clipPathId:n,points:i,props:r}=e,{needClip:o,dot:s,dataKey:a}=r,c=yl(r);return l.createElement(tce,{points:i,dot:s,className:"recharts-area-dots",dotClassName:"recharts-area-dot",dataKey:a,baseProps:c,needClip:o,clipPathId:n})}function AXe(e){var{showLabels:n,children:i,points:r}=e,o=r.map(s=>{var a,c,u={x:(a=s.x)!==null&&a!==void 0?a:0,y:(c=s.y)!==null&&c!==void 0?c:0,width:0,lowerWidth:0,upperWidth:0,height:0};return pb(pb({},u),{}
7785,{value:s.value,payload:s.payload,parentViewBox:void 0,viewBox:u,fill:void 0})});return l.createElement(jO,{value:n?o:void 0},i)}function OV(e){var{points:n,baseLine:i,needClip:r,clipPathId:o,props:s}=e,{layout:a,type:c,stroke:u,connectNulls:m,isRange:h}=s,{id:g}=s,x=$ce(s,wXe),y=yl(x),w=ba(x);return l.createElement(l.Fragment,null,n?.length>1&&l.createElement(bo,{clipPath:r?"url(#clipPath-".concat(o,")"):void 0},l.createElement(Sb,my({},w,{id:g,points:n,connectNulls:m,type:c,baseLine:i,layout:a,stroke:"none",className:"recharts-area-area"})),u!=="none"&&l.createElement(Sb,my({},y,{className:"recharts-area-curve",layout:a,type:c,connectNulls:m,fill:"none",points:n})),u!=="none"&&h&&l.createElement(Sb,my({},y,{className:"recharts-area-curve",layout:a,type:c,connectNulls:m,fill:"none",points:i}))),l.createElement(PXe,{points:n,props:x,clipPathId:o}))}function NXe(e){var n,i,{alpha:r,baseLine:o,points:s,strokeWidth:a}=e,c=(n=s[0])===null||n===void 0?void 0:n.y,u=(i=s[s.length-1])===null||i===void 0?void 0:i.y;if(!Vi(c)||!Vi(u))return null;var m=r*Math.abs(c-u),h=Math.max(...s.map(g=>g.x||0));return fn(o)?h=Math.max(o,h):o&&Array.isArray(o)&&o.length&&(h=Math.max(...o.map(g=>g.x||0),h)),fn(h)?l.createElement("rect",{x:0,y:c<u?c:c-m,width:h+(a?parseInt("".concat(a),10):1),height:Math.floor(m)}):null}function zXe(e){var n,i,{alpha:r,baseLine:o,points:s,strokeWidth:a}=e,c=(n=s[0])===null||n===void 0?void 0:n.x,u=(i=s[s.length-1])===null||i===void 0?void 0:i.x;if(!Vi(c)||!Vi(u))return null;var m=r*Math.abs(c-u),h=Math.max(...s.map(g=>g.y||0));return fn(o)?h=Math.max(o,h):o&&Array.isArray(o)&&o.length&&(h=Math.max(...o.map(g=>g.y||0),h)),fn(h)?l.createElement("rect",{x:c<u?c:c-m,y:0,width:m,height:Math.floor(h+(a?parseInt("".concat(a),10):1))}):null}function TXe(e){var{alpha:n,layout:i,points:r,baseLine:o,strokeWidth:s}=e;return i==="vertical"?l.createElement(NXe,{alpha:n,points:r,baseLine:o,strokeWidth:s}):l.createElement(zXe,{alpha:n,points:r,baseLine:o,strokeWidth:s})}function EXe(e){var{needClip:n,clipPathId:i,props:r,previousPointsRef:o,previousBaselineRef:s}=e,{points:a,baseLine:c,isAnimationActive:u,animationBegin:m,animationDuration:h,animationEasing:g,onAnimationStart:x,onAnimationEnd:y}=r,w=l.useMemo(()=>({points:a,baseLine:c}),[a,c]),j=h1(w,"recharts-area-"),v=eDe(),[_,$]=l.useState(!1),k=!_,P=l.useCallback(()=>{typeof y=="function"&&y(),$(!1)},[y]),S=l.useCallback(()=>{typeof x=="function"&&x(),$(!0)},[x]);if(v==null)return null;var I=o.current,A=s.current;return l.createElement(AXe,{showLabels:k,points:a},r.children,l.createElement(m1,{animationId:j,begin:m,duration:h,isActive:u,easing:g,onAnimationEnd:P,onAnimationStart:S,key:j},E=>{if(I){var B=I.length/a.length,T=E===1?a:a.map((R,F)=>{var Y=Math.floor(F*B);if(I[Y]){var H=I[Y];return pb(pb({},R),{},{x:ir(H.x,R.x,E),y:ir(H.y,R.y,E)})}return R}),M;return fn(c)?M=ir(A,c,E):eo(c)||Xl(c)?M=ir(A,0,E):M=c.map((R,F)=>{var Y=Math.floor(F*B);if(Array.isArray(A)&&A[Y]){var H=A[Y];return pb(pb({},R),{},{x:ir(H.x,R.x,E),y:ir(H.y,R.y,E)})}return R}),E>0&&(o.current=T,s.current=M),l.createElement(OV,{points:T,baseLine:M,needClip:n,clipPathId:i,props:r})}return E>0&&(o.current=a,s.current=c),l.createElement(bo,null,u&&l.createElement("defs",null,l.createElement("clipPath",{id:"animationClipPath-".concat(i)},l.createElement(TXe,{alpha:E,points:a,baseLine:c,layout:v,strokeWidth:r.strokeWidth}))),l.createElement(bo,{clipPath:"url(#animationClipPath-".concat(i,")")},l.createElement(OV,{points:a,baseLine:c,needClip:n,clipPathId:i,props:r})))}),l.createElement(CA,{label:r.label}))}function MXe(e){var{needClip:n,clipPathId:i,props:r}=e,o=l.useRef(null),s=l.useRef();return l.createElement(EXe,{needClip:n,clipPathId:i,props:r,previousPointsRef:o,previousBaselineRef:s})}class RXe extends l.PureComponent{render(){var{hide:n,dot:i,points:r,className:o,top:s,left:a,needClip:c,xAxisId:u,yAxisId:m,width:h,height:g,id:x,baseLine:y,zIndex:w}=this.props;if(n)return null;var j=Ri("recharts-area",o),v=x,{r:_,strokeWidth:$}
7785=xce(i),k=kO(i),P=_*2+$,S=c?"url(#clipPath-".concat(k?"":"dots-").concat(v,")"):void 0;return l.createElement(Ha,{zIndex:w},l.createElement(bo,{className:j},c&&l.createElement("defs",null,l.createElement(MO,{clipPathId:v,xAxisId:u,yAxisId:m}),!k&&l.createElement("clipPath",{id:"clipPath-dots-".concat(v)},l.createElement("rect",{x:a-P/2,y:s-P/2,width:h+P,height:g+P}))),l.createElement(MXe,{needClip:c,clipPathId:v,props:this.props})),l.createElement(e8,{points:r,mainColor:UI(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:S}),this.props.isRange&&Array.isArray(y)&&l.createElement(e8,{points:y,mainColor:UI(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:S}))}}var Ice={activeDot:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!1,fill:"#3182bd",fillOpacity:.6,hide:!1,isAnimationActive:"auto",legendType:"line",stroke:"#3182bd",strokeWidth:1,type:"linear",label:!1,xAxisId:0,yAxisId:0,zIndex:zo.area};function OXe(e){var n,i=jo(e,Ice),{activeDot:r,animationBegin:o,animationDuration:s,animationEasing:a,connectNulls:c,dot:u,fill:m,fillOpacity:h,hide:g,isAnimationActive:x,legendType:y,stroke:w,xAxisId:j,yAxisId:v}=i,_=$ce(i,jXe),$=Lf(),k=Sle(),{needClip:P}=zA(j,v),S=$s(),{points:I,isRange:A,baseLine:E}=(n=gn(Y=>vXe(Y,e.id,S)))!==null&&n!==void 0?n:{},B=AA();if($!=="horizontal"&&$!=="vertical"||B==null||k!=="AreaChart"&&k!=="ComposedChart")return null;var{height:T,width:M,x:R,y:F}=B;return!I||!I.length?null:l.createElement(RXe,my({},_,{activeDot:r,animationBegin:o,animationDuration:s,animationEasing:a,baseLine:E,connectNulls:c,dot:u,fill:m,fillOpacity:h,height:T,hide:g,layout:$,isAnimationActive:x==="auto"?!fC.isSsr:x,isRange:A,legendType:y,needClip:P,points:I,stroke:w,width:M,left:R,top:F,xAxisId:j,yAxisId:v}))}var DXe=(e,n,i,r,o)=>{var s=i??n;if(fn(s))return s;var a=e==="horizontal"?o:r,c=a.scale.domain();if(a.type==="number"){var u=Math.max(c[0],c[1]),m=Math.min(c[0],c[1]);return s==="dataMin"?m:s==="dataMax"||u<0?u:Math.max(Math.min(c[0],c[1]),0)}return s==="dataMin"?c[0]:s==="dataMax"?c[1]:c[0]};function LXe(e){var{areaSettings:{connectNulls:n,baseValue:i,dataKey:r},stackedData:o,layout:s,chartBaseValue:a,xAxis:c,yAxis:u,displayedData:m,dataStartIndex:h,xAxisTicks:g,yAxisTicks:x,bandSize:y}=e,w=o&&o.length,j=DXe(s,a,i,c,u),v=s==="horizontal",_=!1,$=m.map((P,S)=>{var I,A,E;if(w)E=o[h+S];else{var B=or(P,r);Array.isArray(B)?(E=B,_=!0):E=[j,B]}var T=(I=(A=E)===null||A===void 0?void 0:A[1])!==null&&I!==void 0?I:null,M=T==null||w&&!n&&or(P,r)==null;return v?{x:mI({axis:c,ticks:g,bandSize:y,entry:P,index:S}),y:M?null:u.scale(T),value:E,payload:P}:{x:M?null:c.scale(T),y:mI({axis:u,ticks:x,bandSize:y,entry:P,index:S}),value:E,payload:P}}),k;return w||_?k=$.map(P=>{var S=Array.isArray(P.value)?P.value[0]:null;return v?{x:P.x,y:S!=null&&P.y!=null?u.scale(S):null,payload:P.payload}:{x:S!=null?c.scale(S):null,y:P.y,payload:P.payload}}):k=v?u.scale(j):c.scale(j),{points:$,baseLine:k,isRange:_}}function BXe(e){var n=jo(e,Ice),i=$s();return l.createElement(IA,{id:n.id,type:"area"},r=>l.createElement(l.Fragment,null,l.createElement(NO,{legendPayload:$Xe(n)}),l.createElement(IXe,{dataKey:n.dataKey,data:n.data,stroke:n.stroke,strokeWidth:n.strokeWidth,fill:n.fill,name:n.name,hide:n.hide,unit:n.unit,tooltipType:n.tooltipType,id:r}),l.createElement(zO,{type:"area",id:r,data:n.data,dataKey:n.dataKey,xAxisId:n.xAxisId,yAxisId:n.yAxisId,zAxisId:0,stackId:Joe(n.stackId),hide:n.hide,barSize:void 0,baseValue:n.baseValue,isPanorama:i,connectNulls:n.connectNulls}),l.createElement(OXe,my({},n,{id:r}))))}var jf=l.memo(BXe,AC);jf.displayName="Area";var FXe="Invariant failed";function WXe(e,n){throw new Error(FXe)}function t8(){return t8=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var i=arguments[n];for(var r in i)({}).hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},t8.apply(null,arguments)}function HI(e){return l.createElement($O,t8({shapeType:"rectangle",activeClassName:"recharts-active-bar"},e))}var UXe=function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return(r,o)=>{if(fn(n))return n;var s=fn(r)||eo(r);return s?n(r,o):(s||WXe(),i)}},HXe=(e,n,i)=>i,qXe=(e,n)=>n,NC=_t([_C,qXe],(e,n)=>e.filter(i=>i.type==="bar").find(i=>i.id===n)),GXe=_t([NC],e=>e?.maxBarSize),VXe=(e,n,i,r)=>
7785r,KXe=_t([ji,_C,Lp,Bp,HXe],(e,n,i,r,o)=>n.filter(s=>e==="horizontal"?s.xAxisId===i:s.yAxisId===r).filter(s=>s.isPanorama===o).filter(s=>s.hide===!1).filter(s=>s.type==="bar")),YXe=(e,n,i)=>{var r=ji(e),o=Lp(e,n),s=Bp(e,n);if(!(o==null||s==null))return r==="horizontal"?EI(e,"yAxis",s,i):EI(e,"xAxis",o,i)},XXe=(e,n)=>{var i=ji(e),r=Lp(e,n),o=Bp(e,n);if(!(r==null||o==null))return i==="horizontal"?gG(e,"xAxis",r):gG(e,"yAxis",o)},QXe=_t([KXe,RFe,XXe],QVe),ZXe=(e,n,i)=>{var r,o,s=NC(e,n);if(s!=null){var a=Lp(e,n),c=Bp(e,n);if(!(a==null||c==null)){var u=ji(e),m=Cae(e),{maxBarSize:h}=s,g=eo(h)?m:h,x,y;return u==="horizontal"?(x=Ep(e,"xAxis",a,i),y=Tp(e,"xAxis",a,i)):(x=Ep(e,"yAxis",c,i),y=Tp(e,"yAxis",c,i)),(r=(o=Pf(x,y,!0))!==null&&o!==void 0?o:g)!==null&&r!==void 0?r:0}}},Pce=(e,n,i)=>{var r=ji(e),o=Lp(e,n),s=Bp(e,n);if(!(o==null||s==null)){var a,c;return r==="horizontal"?(a=Ep(e,"xAxis",o,i),c=Tp(e,"xAxis",o,i)):(a=Ep(e,"yAxis",s,i),c=Tp(e,"yAxis",s,i)),Pf(a,c)}},JXe=_t([QXe,Cae,MFe,Sae,ZXe,Pce,GXe],nKe),eQe=(e,n,i)=>{var r=Lp(e,n);if(r!=null)return Ep(e,"xAxis",r,i)},tQe=(e,n,i)=>{var r=Bp(e,n);if(r!=null)return Ep(e,"yAxis",r,i)},nQe=(e,n,i)=>{var r=Lp(e,n);if(r!=null)return Tp(e,"xAxis",r,i)},iQe=(e,n,i)=>{var r=Bp(e,n);if(r!=null)return Tp(e,"yAxis",r,i)},rQe=_t([JXe,NC],(e,n)=>{if(!(e==null||n==null)){var i=e.find(r=>r.stackId===n.stackId&&n.dataKey!=null&&r.dataKeys.includes(n.dataKey));if(i!=null)return i.position}}),oQe=_t([YXe,NC],iKe),sQe=_t([ks,sR,eQe,tQe,nQe,iQe,rQe,ji,cae,Pce,oQe,NC,VXe],(e,n,i,r,o,s,a,c,u,m,h,g,x)=>{var{chartData:y,dataStartIndex:w,dataEndIndex:j}=u;if(!(g==null||a==null||n==null||c!=="horizontal"&&c!=="vertical"||i==null||r==null||o==null||s==null||m==null)){var{data:v}=g,_;if(v!=null&&v.length>0?_=v:_=y?.slice(w,j+1),_!=null)return MQe({layout:c,barSettings:g,pos:a,parentViewBox:n,bandSize:m,xAxis:i,yAxis:r,xAxisTicks:o,yAxisTicks:s,stackedData:h,displayedData:_,offset:e,cells:x,dataStartIndex:w})}}),aQe=["index"];function n8(){return n8=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var i=arguments[n];for(var r in i)({}).hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},n8.apply(null,arguments)}function lQe(e,n){if(e==null)return{};var i,r,o=cQe(e,n);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)i=s[r],n.indexOf(i)===-1&&{}.propertyIsEnumerable.call(e,i)&&(o[i]=e[i])}return o}function cQe(e,n){if(e==null)return{};var i={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(n.indexOf(r)!==-1)continue;i[r]=e[r]}return i}var Ace=l.createContext(void 0),dQe=e=>{var n=l.useContext(Ace);if(n!=null)return n.stackId;if(e!=null)return Joe(e)},uQe=(e,n)=>"recharts-bar-stack-clip-path-".concat(e,"-").concat(n),pQe=e=>{var n=l.useContext(Ace);if(n!=null){var{stackId:i}=n;return"url(#".concat(uQe(i,e),")")}},mQe=e=>{var{index:n}=e,i=lQe(e,aQe),r=pQe(n);return l.createElement(bo,n8({className:"recharts-bar-stack-layer",clipPath:r},i))},hQe=["onMouseEnter","onMouseLeave","onClick"],fQe=["value","background","tooltipPosition"],gQe=["id"],yQe=["onMouseEnter","onClick","onMouseLeave"];function Jm(){return Jm=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var i=arguments[n];for(var r in i)({}).hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},Jm.apply(null,arguments)}function DV(e,n){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),i.push.apply(i,r)}return i}function pl(e){for(var n=1;n<arguments.length;n++){var i=arguments[n]!=null?arguments[n]:{};n%2?DV(Object(i),!0).forEach(function(r){xQe(e,r,i[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):DV(Object(i)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(i,r))})}return e}function xQe(e,n,i){return(n=bQe(n))in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i,e}function bQe(e){var n=vQe(e,"string");return typeof n=="symbol"?n:n+""}function vQe(e,n){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,n);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function qI(e,n){if(e==null)return{};var i,r,o=wQe(e,n);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)i=s[r],n.indexOf(i)===-1&&{}.propertyIsEnumerable.call(e,i)&&(o[i]=e[i])}return o}function wQe(e,n){if(e==null)return{};var i={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(n.indexOf(r)!==-1)continue;i[r]=e[r]}return i}var jQe=e=>{var{dataKey:n,name:i,fill:r,legendType:o,hide:s}=e;return[{inactive:s,dataKey:n,type:o,color:r,value:Df(i,n),payload:e}]},_Qe=l.memo(e=>{var{dataKey:n,stroke:i,strokeWidth:r,fill:o,name:s,hide:a,unit:c,tooltipType:u,id:m}=e,h={dataDefinedOnItem:void 0,positions:void 0,settings:{stroke:i,strokeWidth:r,fill:o,dataKey:n,nameKey:void 0,name:Df(s,n),hide:a,type:u,color:o,unit:c,graphicalItemId:m}};return l.createElement($A,{tooltipEntrySettings:h})});function CQe(e){var n=gn(Nf),{data:i,dataKey:r,background:o,allOtherBarProps:s}=e,{onMouseEnter:a,onMouseLeave:c,onClick:u}=s,m=qI(s,hQe),h=IO(a,r,s.id),g=PO(c),x=AO(u,r,s.id);if(!o||i==null)return null;var y=$y(o);
7785return l.createElement(Ha,{zIndex:rKe(o,zo.barBackground)},i.map((w,j)=>{var{value:v,background:_,tooltipPosition:$}=w,k=qI(w,fQe);if(!_)return null;var P=h(w,j),S=g(w,j),I=x(w,j),A=pl(pl(pl(pl(pl({option:o,isActive:String(j)===n},k),{},{fill:"#eee"},_),y),lC(m,w,j)),{},{onMouseEnter:P,onMouseLeave:S,onClick:I,dataKey:r,index:j,className:"recharts-bar-background-rectangle"});return l.createElement(HI,Jm({key:"background-bar-".concat(j)},A))}))}function SQe(e){var{showLabels:n,children:i,rects:r}=e,o=r?.map(s=>{var a={x:s.x,y:s.y,width:s.width,lowerWidth:s.width,upperWidth:s.width,height:s.height};return pl(pl({},a),{},{value:s.value,payload:s.payload,parentViewBox:s.parentViewBox,viewBox:a,fill:s.fill})});return l.createElement(jO,{value:n?o:void 0},i)}function kQe(e){var{shape:n,activeBar:i,baseProps:r,entry:o,index:s,dataKey:a}=e,c=gn(Nf),u=gn(gO),m=i&&String(s)===c&&(u==null||a===u),h=m?i:n;return m?l.createElement(Ha,{zIndex:zo.activeBar},l.createElement(HI,Jm({},r,{name:String(r.name)},o,{isActive:m,option:h,index:s,dataKey:a}))):l.createElement(HI,Jm({},r,{name:String(r.name)},o,{isActive:m,option:h,index:s,dataKey:a}))}function $Qe(e){var{shape:n,baseProps:i,entry:r,index:o,dataKey:s}=e;return l.createElement(HI,Jm({},i,{name:String(i.name)},r,{isActive:!1,option:n,index:o,dataKey:s}))}function IQe(e){var n,{data:i,props:r}=e,o=(n=yl(r))!==null&&n!==void 0?n:{},{id:s}=o,a=qI(o,gQe),{shape:c,dataKey:u,activeBar:m}=r,{onMouseEnter:h,onClick:g,onMouseLeave:x}=r,y=qI(r,yQe),w=IO(h,u,s),j=PO(x),v=AO(g,u,s);return i?l.createElement(l.Fragment,null,i.map((_,$)=>l.createElement(mQe,Jm({index:$,key:"rectangle-".concat(_?.x,"-").concat(_?.y,"-").concat(_?.value,"-").concat($),className:"recharts-bar-rectangle"},lC(y,_,$),{onMouseEnter:w(_,$),onMouseLeave:j(_,$),onClick:v(_,$)}),m?l.createElement(kQe,{shape:c,activeBar:m,baseProps:a,entry:_,index:$,dataKey:u}):l.createElement($Qe,{shape:c,baseProps:a,entry:_,index:$,dataKey:u})))):null}function PQe(e){var{props:n,previousRectanglesRef:i}=e,{data:r,layout:o,isAnimationActive:s,animationBegin:a,animationDuration:c,animationEasing:u,onAnimationEnd:m,onAnimationStart:h}=n,g=i.current,x=h1(n,"recharts-bar-"),[y,w]=l.useState(!1),j=!y,v=l.useCallback(()=>{typeof m=="function"&&m(),w(!1)},[m]),_=l.useCallback(()=>{typeof h=="function"&&h(),w(!0)},[h]);return l.createElement(SQe,{showLabels:j,rects:r},l.createElement(m1,{animationId:x,begin:a,duration:c,isActive:s,easing:u,onAnimationEnd:v,onAnimationStart:_,key:x},$=>{var k=$===1?r:r?.map((P,S)=>{var I=g&&g[S];if(I)return pl(pl({},P),{},{x:ir(I.x,P.x,$),y:ir(I.y,P.y,$),width:ir(I.width,P.width,$),height:ir(I.height,P.height,$)});if(o==="horizontal"){var A=ir(0,P.height,$),E=ir(P.stackedBarStart,P.y,$);return pl(pl({},P),{},{y:E,height:A})}var B=ir(0,P.width,$),T=ir(P.stackedBarStart,P.x,$);return pl(pl({},P),{},{width:B,x:T})});return $>0&&(i.current=k??null),k==null?null:l.createElement(bo,null,l.createElement(IQe,{props:n,data:k}))}),l.createElement(CA,{label:n.label}),n.children)}function AQe(e){var n=l.useRef(null);return l.createElement(PQe,{previousRectanglesRef:n,props:e})}var Nce=0,NQe=(e,n)=>{var i=Array.isArray(e.value)?e.value[1]:e.value;return{x:e.x,y:e.y,value:i,errorVal:or(e,n)}};class zQe extends l.PureComponent{render(){var{hide:n,data:i,dataKey:r,className:o,xAxisId:s,yAxisId:a,needClip:c,background:u,id:m}=this.props;if(n||i==null)return null;var h=Ri("recharts-bar",o),g=m;return l.createElement(bo,{className:h,id:m},c&&l.createElement("defs",null,l.createElement(MO,{clipPathId:g,xAxisId:s,yAxisId:a})),l.createElement(bo,{className:"recharts-bar-rectangles",clipPath:c?"url(#clipPath-".concat(g,")"):void 0},l.createElement(CQe,{data:i,dataKey:r,background:u,allOtherBarProps:this.props}),l.createElement(AQe,this.props)))}}var TQe={activeBar:!1,animationBegin:0,animationDuration:400,animationEasing:"ease",background:!1,hide:!1,isAnimationActive:"auto",label:!1,legendType:"rect",minPointSize:Nce,xAxisId:0,yAxisId:0,zIndex:zo.bar};function EQe(e){var{xAxisId:n,yAxisId:i,hide:r,legendType:o,minPointSize:s,activeBar:a,animationBegin:c,animationDuration:u,animationEasing:m,isAnimationActive:h}=e,{needClip:g}=zA(n,i),x=Lf(),y=$s(),w=SO(e.children,py),j=gn($=>sQe($,e.id,y,w));if(x!=="vertical"&&x!=="horizontal")return null;var v,_=j?.[0];return _==null||_.height==null||_.width==null?v=0:v=x==="vertical"?_.height/2:_.width/2,l.createElement(mce,{xAxisId:n,yAxisId:i,data:j,dataPointFormatter:NQe,errorBarOffset:v},l.createElement(zQe,Jm({},e,{layout:x,needClip:g,data:j,xAxisId:n,yAxisId:i,hide:r,legendType:o,minPointSize:s,activeBar:a,animationBegin:c,animationDuration:u,animationEasing:m,isAnimationActive:h})))}function MQe(e){var{layout:n,barSettings:{dataKey:i,minPointSize:r},pos:o,bandSize:s,xAxis:a,yAxis:c,xAxisTicks:u,yAxisTicks:m,stackedData:h,displayedData:g,offset:x,cells:y,parentViewBox:w,dataStartIndex:j}=e,v=n==="horizontal"?c:a,_=h?v.scale.domain():null,$=xOe({numericAxis:v}),k=v.scale($);return g.map((P,S)=>{var I,A,E,B,T,M;if(h){var R=h[S+j];if(R==null)return null;I=mOe(R,_)}else I=or(P,i),Array.isArray(I)||(I=[$,I]);var F=UXe(r,Nce)(I[1],S);if(n==="horizontal"){var Y,[H,U]=[c.scale(I[0]),c.scale(I[1])];A=vH({axis:a,ticks:u,bandSize:s,offset:o.offset,entry:P,index:S}),E=(Y=U??H)!==null&&Y!==void 0?Y:void 0,B=o.size;var X=H-U;if(T=Xl(X)?0:X,M={x:A,y:x.top,width:B,height:x.height},Math.abs(F)>0&&Math.abs(T)<Math.abs(F)){var Q=Vs(T||F)*(Math.abs(F)-Math.abs(T));E-=Q,T+=Q}}else{var[K,G]=[a.scale(I[0]),a.scale(I[1])];if(A=K,E=vH({axis:c,ticks:m,bandSize:s,offset:o.offset,entry:P,index:S}),B=G-K,T=o.size,M={x:x.left,y:E,width:x.width,height:T},Math.abs(F)>0&&Math.abs(B)<Math.abs(F)){var L=Vs(B||F)*(Math.abs(F)-Math.abs(B));B+=L}}if(A==null||E==null||B==null||T==null)return null;var q=pl(pl({},P),{},{stackedBarStart:k,x:A,y:E,width:B,height:T,value:h?I:I[1],payload:P,background:M,tooltipPosition:{x:A+B/2,y:E+T/2},parentViewBox:w},y&&y[S]&&y[S].props);return q}
7785).filter(Boolean)}function RQe(e){var n=jo(e,TQe),i=dQe(n.stackId),r=$s();return l.createElement(IA,{id:n.id,type:"bar"},o=>l.createElement(l.Fragment,null,l.createElement(NO,{legendPayload:jQe(n)}),l.createElement(_Qe,{dataKey:n.dataKey,stroke:n.stroke,strokeWidth:n.strokeWidth,fill:n.fill,name:n.name,hide:n.hide,unit:n.unit,tooltipType:n.tooltipType,id:o}),l.createElement(zO,{type:"bar",id:o,data:void 0,xAxisId:n.xAxisId,yAxisId:n.yAxisId,zAxisId:0,dataKey:n.dataKey,stackId:i,hide:n.hide,barSize:n.barSize,minPointSize:n.minPointSize,maxBarSize:n.maxBarSize,isPanorama:r}),l.createElement(Ha,{zIndex:n.zIndex},l.createElement(EQe,Jm({},n,{id:o})))))}var i8=l.memo(RQe,AC);i8.displayName="Bar";var OQe=["domain","range"],DQe=["domain","range"];function LV(e,n){if(e==null)return{};var i,r,o=LQe(e,n);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)i=s[r],n.indexOf(i)===-1&&{}.propertyIsEnumerable.call(e,i)&&(o[i]=e[i])}return o}function LQe(e,n){if(e==null)return{};var i={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(n.indexOf(r)!==-1)continue;i[r]=e[r]}return i}function BV(e,n){return e===n?!0:Array.isArray(e)&&e.length===2&&Array.isArray(n)&&n.length===2?e[0]===n[0]&&e[1]===n[1]:!1}function zce(e,n){if(e===n)return!0;var{domain:i,range:r}=e,o=LV(e,OQe),{domain:s,range:a}=n,c=LV(n,DQe);return!BV(i,s)||!BV(r,a)?!1:AC(o,c)}var BQe=["dangerouslySetInnerHTML","ticks","scale"],FQe=["id","scale"];function r8(){return r8=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var i=arguments[n];for(var r in i)({}).hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},r8.apply(null,arguments)}function FV(e,n){if(e==null)return{};var i,r,o=WQe(e,n);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)i=s[r],n.indexOf(i)===-1&&{}.propertyIsEnumerable.call(e,i)&&(o[i]=e[i])}return o}function WQe(e,n){if(e==null)return{};var i={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(n.indexOf(r)!==-1)continue;i[r]=e[r]}return i}function UQe(e){var n=Rr(),i=l.useRef(null);return l.useLayoutEffect(()=>{i.current===null?n(RVe(e)):i.current!==e&&n(OVe({prev:i.current,next:e})),i.current=e},[e,n]),l.useLayoutEffect(()=>()=>{i.current&&(n(DVe(i.current)),i.current=null)},[n]),null}var HQe=e=>{var{xAxisId:n,className:i}=e,r=gn(sR),o=$s(),s="xAxis",a=gn(_=>ile(_,s,n,o)),c=gn(_=>Jae(_,n)),u=gn(_=>EWe(_,n)),m=gn(_=>Eae(_,n));if(c==null||u==null||m==null)return null;var{dangerouslySetInnerHTML:h,ticks:g,scale:x}=e,y=FV(e,BQe),{id:w,scale:j}=m,v=FV(m,FQe);return l.createElement(EO,r8({},y,v,{x:u.x,y:u.y,width:c.width,height:c.height,className:Ri("recharts-".concat(s," ").concat(s),i),viewBox:r,ticks:a,axisType:s}))},qQe={allowDataOverflow:Ls.allowDataOverflow,allowDecimals:Ls.allowDecimals,allowDuplicatedCategory:Ls.allowDuplicatedCategory,angle:Ls.angle,axisLine:Om.axisLine,height:Ls.height,hide:!1,includeHidden:Ls.includeHidden,interval:Ls.interval,minTickGap:Ls.minTickGap,mirror:Ls.mirror,orientation:Ls.orientation,padding:Ls.padding,reversed:Ls.reversed,scale:Ls.scale,tick:Ls.tick,tickCount:Ls.tickCount,tickLine:Om.tickLine,tickSize:Om.tickSize,type:Ls.type,xAxisId:0},GQe=e=>{var n=jo(e,qQe);return l.createElement(l.Fragment,null,l.createElement(UQe,{allowDataOverflow:n.allowDataOverflow,allowDecimals:n.allowDecimals,allowDuplicatedCategory:n.allowDuplicatedCategory,angle:n.angle,dataKey:n.dataKey,domain:n.domain,height:n.height,hide:n.hide,id:n.xAxisId,includeHidden:n.includeHidden,interval:n.interval,minTickGap:n.minTickGap,mirror:n.mirror,name:n.name,orientation:n.orientation,padding:n.padding,reversed:n.reversed,scale:n.scale,tick:n.tick,tickCount:n.tickCount,tickFormatter:n.tickFormatter,ticks:n.ticks,type:n.type,unit:n.unit}),l.createElement(HQe,n))},Ql=l.memo(GQe,zce);Ql.displayName="XAxis";var VQe=["dangerouslySetInnerHTML","ticks","scale"],KQe=["id","scale"];function o8(){return o8=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var i=arguments[n];for(var r in i)({}).hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},o8.apply(null,arguments)}function WV(e,n){if(e==null)return{};var i,r,o=YQe(e,n);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)i=s[r],n.indexOf(i)===-1&&{}.propertyIsEnumerable.call(e,i)&&(o[i]=e[i])}return o}function YQe(e,n){if(e==null)return{};var i={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(n.indexOf(r)!==-1)continue;i[r]=e[r]}return i}function XQe(e){var n=Rr(),i=l.useRef(null);return l.useLayoutEffect(()=>{i.current===null?n(LVe(e)):i.current!==e&&n(BVe({prev:i.current,next:e})),i.current=e},[e,n]),l.useLayoutEffect(()=>()=>{i.current&&(n(FVe(i.current)),i.current=null)},[n]),null}var QQe=e=>{var{yAxisId:n,className:i,width:r,label:o}=e,s=l.useRef(null),a=l.useRef(null),c=gn(sR),u=$s(),m=Rr(),h="yAxis",g=gn(I=>ele(I,n)),x=gn(I=>RWe(I,n)),y=gn(I=>ile(I,h,n,u)),w=gn(I=>Mae(I,n));if(l.useLayoutEffect(()=>{if(!(r!=="auto"||!g||wO(o)||l.isValidElement(o)||w==null)){var I=s.current;if(I){var A=I.getCalculatedWidth();
7785Math.round(g.width)!==Math.round(A)&&m(WVe({id:n,width:A}))}}},[y,g,m,o,n,r,w]),g==null||x==null||w==null)return null;var{dangerouslySetInnerHTML:j,ticks:v,scale:_}=e,$=WV(e,VQe),{id:k,scale:P}=w,S=WV(w,KQe);return l.createElement(EO,o8({},$,S,{ref:s,labelRef:a,x:x.x,y:x.y,tickTextProps:r==="auto"?{width:void 0}:{width:r},width:g.width,height:g.height,className:Ri("recharts-".concat(h," ").concat(h),i),viewBox:c,ticks:y,axisType:h}))},ZQe={allowDataOverflow:Bs.allowDataOverflow,allowDecimals:Bs.allowDecimals,allowDuplicatedCategory:Bs.allowDuplicatedCategory,angle:Bs.angle,axisLine:Om.axisLine,hide:!1,includeHidden:Bs.includeHidden,interval:Bs.interval,minTickGap:Bs.minTickGap,mirror:Bs.mirror,orientation:Bs.orientation,padding:Bs.padding,reversed:Bs.reversed,scale:Bs.scale,tick:Bs.tick,tickCount:Bs.tickCount,tickLine:Om.tickLine,tickSize:Om.tickSize,type:Bs.type,width:Bs.width,yAxisId:0},JQe=e=>{var n=jo(e,ZQe);return l.createElement(l.Fragment,null,l.createElement(XQe,{interval:n.interval,id:n.yAxisId,scale:n.scale,type:n.type,domain:n.domain,allowDataOverflow:n.allowDataOverflow,dataKey:n.dataKey,allowDuplicatedCategory:n.allowDuplicatedCategory,allowDecimals:n.allowDecimals,tickCount:n.tickCount,padding:n.padding,includeHidden:n.includeHidden,reversed:n.reversed,ticks:n.ticks,width:n.width,orientation:n.orientation,mirror:n.mirror,hide:n.hide,unit:n.unit,name:n.name,angle:n.angle,minTickGap:n.minTickGap,tick:n.tick,tickFormatter:n.tickFormatter}),l.createElement(QQe,n))},Zl=l.memo(JQe,zce);Zl.displayName="YAxis";var eZe=(e,n)=>n,OO=_t([eZe,ji,zae,Ps,ble,dh,QUe,ks],rHe),DO=e=>{var n=e.currentTarget.getBoundingClientRect(),i=n.width/e.currentTarget.offsetWidth,r=n.height/e.currentTarget.offsetHeight;return{chartX:Math.round((e.clientX-n.left)/i),chartY:Math.round((e.clientY-n.top)/r)}},Tce=Rd("mouseClick"),Ece=uC();Ece.startListening({actionCreator:Tce,effect:(e,n)=>{var i=e.payload,r=OO(n.getState(),DO(i));r?.activeIndex!=null&&n.dispatch(XWe({activeIndex:r.activeIndex,activeDataKey:void 0,activeCoordinate:r.activeCoordinate}))}});var s8=Rd("mouseMove"),Mce=uC(),Zk=null;Mce.startListening({actionCreator:s8,effect:(e,n)=>{var i=e.payload;Zk!==null&&cancelAnimationFrame(Zk);var r=DO(i);Zk=requestAnimationFrame(()=>{var o=n.getState(),s=dO(o,o.tooltip.settings.shared);if(s==="axis"){var a=OO(o,r);a?.activeIndex!=null?n.dispatch(ule({activeIndex:a.activeIndex,activeDataKey:void 0,activeCoordinate:a.activeCoordinate})):n.dispatch(dle())}Zk=null})}});function tZe(e,n){return n instanceof HTMLElement?"HTMLElement <".concat(n.tagName,' class="').concat(n.className,'">'):n===window?"global.window":e==="children"&&typeof n=="object"&&n!==null?"<<CHILDREN>>":n}var UV={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:"none",syncId:void 0,syncMethod:"index",baseValue:void 0,reverseStackOrder:!1},Rce=nc({name:"rootProps",initialState:UV,reducers:{updateOptions:(e,n)=>{var i;e.accessibilityLayer=n.payload.accessibilityLayer,e.barCategoryGap=n.payload.barCategoryGap,e.barGap=(i=n.payload.barGap)!==null&&i!==void 0?i:UV.barGap,e.barSize=n.payload.barSize,e.maxBarSize=n.payload.maxBarSize,e.stackOffset=n.payload.stackOffset,e.syncId=n.payload.syncId,e.syncMethod=n.payload.syncMethod,e.className=n.payload.className,e.baseValue=n.payload.baseValue,e.reverseStackOrder=n.payload.reverseStackOrder}}}),nZe=Rce.reducer,{updateOptions:iZe}=Rce.actions,Oce=nc({name:"polarOptions",initialState:null,reducers:{updatePolarOptions:(e,n)=>n.payload}}),{updatePolarOptions:rZe}=Oce.actions,oZe=Oce.reducer,Dce=Rd("keyDown"),Lce=Rd("focus"),LO=uC();LO.startListening({actionCreator:Dce,effect:(e,n)=>{var i=n.getState(),r=i.rootProps.accessibilityLayer!==!1;if(r){var{keyboardInteraction:o}=i.tooltip,s=e.payload;if(!(s!=="ArrowRight"&&s!=="ArrowLeft"&&s!=="Enter")){var a=uO(o,_1(i),SC(i),IC(i)),c=a==null?-1:Number(a);if(!(!Number.isFinite(c)||c<0)){var u=dh(i);if(s==="Enter"){var m=RI(i,"axis","hover",String(o.index));n.dispatch(K3({active:!o.active,activeIndex:o.index,activeCoordinate:m}));return}var h=BWe(i),g=h==="left-to-right"?1:-1,x=s==="ArrowRight"?1:-1,y=c+x*g;if(!(u==null||y>=u.length||y<0)){var w=RI(i,"axis","hover",String(y));n.dispatch(K3({active:!0,activeIndex:y.toString(),activeCoordinate:w}))}}}}}});LO.startListening({actionCreator:Lce,effect:(e,n)=>{var i=n.getState(),r=i.rootProps.accessibilityLayer!==!1;if(r){var{keyboardInteraction:o}=i.tooltip;if(!o.active&&o.index==null){var s="0",a=RI(i,"axis","hover",String(s));n.dispatch(K3({active:!0,activeIndex:s,activeCoordinate:a}))}}}});var wd=Rd("externalEvent"),Bce=uC(),P6=new Map;Bce.startListening({actionCreator:wd,effect:(e,n)=>{var{handler:i,reactEvent:r}=e.payload;if(i!=null){r.persist();var o=r.type,s=P6.get(o);s!==void 0&&cancelAnimationFrame(s);var a=requestAnimationFrame(()=>{try{var c=n.getState(),u={activeCoordinate:RUe(c),activeDataKey:gO(c),activeIndex:Nf(c),activeLabel:jle(c),activeTooltipIndex:Nf(c),isTooltipActive:OUe(c)};i(u,r)}finally{P6.delete(o)}});P6.set(o,a)}}});var sZe=_t([w1],e=>e.tooltipItemPayloads),aZe=_t([sZe,$C,(e,n)=>n,(e,n,i)=>i],(e,n,i,r)=>{var o=e.find(c=>c.settings.graphicalItemId===r);if(o!=null){var{positions:s}=o;if(s!=null){var a=n(s,i);return a}}}),Fce=Rd("touchMove"),Wce=uC();Wce.startListening({actionCreator:Fce,effect:(e,n)=>{var i=e.payload;if(!(i.touches==null||i.touches.length===0)){var r=n.getState(),o=dO(r,r.tooltip.settings.shared);if(o==="axis"){var s=i.touches[0];if(s==null)return;
7785var a=OO(r,DO({clientX:s.clientX,clientY:s.clientY,currentTarget:i.currentTarget}));a?.activeIndex!=null&&n.dispatch(ule({activeIndex:a.activeIndex,activeDataKey:void 0,activeCoordinate:a.activeCoordinate}))}else if(o==="item"){var c,u=i.touches[0];if(document.elementFromPoint==null||u==null)return;var m=document.elementFromPoint(u.clientX,u.clientY);if(!m||!m.getAttribute)return;var h=m.getAttribute(tse),g=(c=m.getAttribute(nse))!==null&&c!==void 0?c:void 0,x=j1(r).find(j=>j.id===g);if(h==null||x==null||g==null)return;var{dataKey:y}=x,w=aZe(r,h,g);n.dispatch(cle({activeDataKey:y,activeIndex:h,activeCoordinate:w,activeGraphicalItemId:g}))}}}});var lZe=joe({brush:oKe,cartesianAxis:UVe,chartData:MHe,errorBars:yYe,graphicalItems:XGe,layout:aOe,legend:fDe,options:AHe,polarAxis:dGe,polarOptions:oZe,referenceElements:gKe,rootProps:nZe,tooltip:QWe,zIndex:xHe}),cZe=function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Chart";return zRe({reducer:lZe,preloadedState:n,middleware:r=>{var o;return r({serializableCheck:!1,immutableCheck:!["commonjs","es6","production"].includes((o="es6")!==null&&o!==void 0?o:"")}).concat([Ece.middleware,Mce.middleware,LO.middleware,Bce.middleware,Wce.middleware])},enhancers:r=>{var o=r;return typeof r=="function"&&(o=r()),o.concat(Ooe({type:"raf"}))},devTools:{serialize:{replacer:tZe},name:"recharts-".concat(i)}})};function Uce(e){var{preloadedState:n,children:i,reduxStoreName:r}=e,o=$s(),s=l.useRef(null);if(o)return i;s.current==null&&(s.current=cZe(n,r));var a=QM;return l.createElement(qYe,{context:a,store:s.current},i)}function dZe(e){var{layout:n,margin:i}=e,r=Rr(),o=$s();return l.useEffect(()=>{o||(r(rOe(n)),r(iOe(i)))},[r,o,n,i]),null}var Hce=l.memo(dZe,AC);function qce(e){var n=Rr();return l.useEffect(()=>{n(iZe(e))},[n,e]),null}function HV(e){var{zIndex:n,isPanorama:i}=e,r=l.useRef(null),o=Rr();return l.useLayoutEffect(()=>(r.current&&o(gHe({zIndex:n,element:r.current,isPanorama:i})),()=>{o(yHe({zIndex:n,isPanorama:i}))}),[o,n,i]),l.createElement("g",{tabIndex:-1,ref:r})}function qV(e){var{children:n,isPanorama:i}=e,r=gn(sHe);if(!r||r.length===0)return n;var o=r.filter(a=>a<0),s=r.filter(a=>a>0);return l.createElement(l.Fragment,null,o.map(a=>l.createElement(HV,{key:a,zIndex:a,isPanorama:i})),n,s.map(a=>l.createElement(HV,{key:a,zIndex:a,isPanorama:i})))}var uZe=["children"];function pZe(e,n){if(e==null)return{};var i,r,o=mZe(e,n);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)i=s[r],n.indexOf(i)===-1&&{}.propertyIsEnumerable.call(e,i)&&(o[i]=e[i])}return o}function mZe(e,n){if(e==null)return{};var i={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(n.indexOf(r)!==-1)continue;i[r]=e[r]}return i}function GI(){return GI=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var i=arguments[n];for(var r in i)({}).hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},GI.apply(null,arguments)}var hZe={width:"100%",height:"100%",display:"block"},fZe=l.forwardRef((e,n)=>{var i=lR(),r=cR(),o=xse();if(!Np(i)||!Np(r))return null;var{children:s,otherAttributes:a,title:c,desc:u}=e,m,h;return a!=null&&(typeof a.tabIndex=="number"?m=a.tabIndex:m=o?0:void 0,typeof a.role=="string"?h=a.role:h=o?"application":void 0),l.createElement(FM,GI({},a,{title:c,desc:u,role:h,tabIndex:m,width:i,height:r,style:hZe,ref:n}),s)}),gZe=e=>{var{children:n}=e,i=gn(JP);if(!i)return null;var{width:r,height:o,y:s,x:a}=i;return l.createElement(FM,{width:r,height:o,x:a,y:s},n)},GV=l.forwardRef((e,n)=>{var{children:i}=e,r=pZe(e,uZe),o=$s();return o?l.createElement(gZe,null,l.createElement(qV,{isPanorama:!0},i)):l.createElement(fZe,GI({ref:n},r),l.createElement(qV,{isPanorama:!1},i))});function yZe(){var e=Rr(),[n,i]=l.useState(null),r=gn(COe);return l.useEffect(()=>{if(n!=null){var o=n.getBoundingClientRect(),s=o.width/n.offsetWidth;Vi(s)&&s!==r&&e(sOe(s))}},[n,e,r]),i}function VV(e,n){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),i.push.apply(i,r)}return i}function xZe(e){for(var n=1;n<arguments.length;n++){var i=arguments[n]!=null?arguments[n]:{};
7785n%2?VV(Object(i),!0).forEach(function(r){bZe(e,r,i[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):VV(Object(i)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(i,r))})}return e}function bZe(e,n,i){return(n=vZe(n))in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i,e}function vZe(e){var n=wZe(e,"string");return typeof n=="symbol"?n:n+""}function wZe(e,n){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,n);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function Ey(){return Ey=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var i=arguments[n];for(var r in i)({}).hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},Ey.apply(null,arguments)}var jZe=()=>(HHe(),null);function VI(e){if(typeof e=="number")return e;if(typeof e=="string"){var n=parseFloat(e);if(!Number.isNaN(n))return n}return 0}var _Ze=l.forwardRef((e,n)=>{var i,r,o=l.useRef(null),[s,a]=l.useState({containerWidth:VI((i=e.style)===null||i===void 0?void 0:i.width),containerHeight:VI((r=e.style)===null||r===void 0?void 0:r.height)}),c=l.useCallback((m,h)=>{a(g=>{var x=Math.round(m),y=Math.round(h);return g.containerWidth===x&&g.containerHeight===y?g:{containerWidth:x,containerHeight:y}})},[]),u=l.useCallback(m=>{if(typeof n=="function"&&n(m),m!=null&&typeof ResizeObserver<"u"){var{width:h,height:g}=m.getBoundingClientRect();c(h,g);var x=w=>{var{width:j,height:v}=w[0].contentRect;c(j,v)},y=new ResizeObserver(x);y.observe(m),o.current=y}},[n,c]);return l.useEffect(()=>()=>{var m=o.current;m?.disconnect()},[c]),l.createElement(l.Fragment,null,l.createElement(eA,{width:s.containerWidth,height:s.containerHeight}),l.createElement("div",Ey({ref:u},e)))}),CZe=l.forwardRef((e,n)=>{var{width:i,height:r}=e,[o,s]=l.useState({containerWidth:VI(i),containerHeight:VI(r)}),a=l.useCallback((u,m)=>{s(h=>{var g=Math.round(u),x=Math.round(m);return h.containerWidth===g&&h.containerHeight===x?h:{containerWidth:g,containerHeight:x}})},[]),c=l.useCallback(u=>{if(typeof n=="function"&&n(u),u!=null){var{width:m,height:h}=u.getBoundingClientRect();a(m,h)}},[n,a]);return l.createElement(l.Fragment,null,l.createElement(eA,{width:o.containerWidth,height:o.containerHeight}),l.createElement("div",Ey({ref:c},e)))}),SZe=l.forwardRef((e,n)=>{var{width:i,height:r}=e;return l.createElement(l.Fragment,null,l.createElement(eA,{width:i,height:r}),l.createElement("div",Ey({ref:n},e)))}),kZe=l.forwardRef((e,n)=>{var{width:i,height:r}=e;return Gm(i)||Gm(r)?l.createElement(CZe,Ey({},e,{ref:n})):l.createElement(SZe,Ey({},e,{ref:n}))});function $Ze(e){return e===!0?_Ze:kZe}var IZe=l.forwardRef((e,n)=>{var{children:i,className:r,height:o,onClick:s,onContextMenu:a,onDoubleClick:c,onMouseDown:u,onMouseEnter:m,onMouseLeave:h,onMouseMove:g,onMouseUp:x,onTouchEnd:y,onTouchMove:w,onTouchStart:j,style:v,width:_,responsive:$,dispatchTouchEvents:k=!0}=e,P=l.useRef(null),S=Rr(),[I,A]=l.useState(null),[E,B]=l.useState(null),T=yZe(),M=aR(),R=M?.width>0?M.width:_,F=M?.height>0?M.height:o,Y=l.useCallback(ee=>{T(ee),typeof n=="function"&&n(ee),A(ee),B(ee),ee!=null&&(P.current=ee)},[T,n,A,B]),H=l.useCallback(ee=>{S(Tce(ee)),S(wd({handler:s,reactEvent:ee}))},[S,s]),U=l.useCallback(ee=>{S(s8(ee)),S(wd({handler:m,reactEvent:ee}))},[S,m]),X=l.useCallback(ee=>{S(dle()),S(wd({handler:h,reactEvent:ee}))},[S,h]),Q=l.useCallback(ee=>{S(s8(ee)),S(wd({handler:g,reactEvent:ee}))},[S,g]),K=l.useCallback(()=>{S(Lce())},[S]),G=l.useCallback(ee=>{S(Dce(ee.key))},[S]),L=l.useCallback(ee=>{S(wd({handler:a,reactEvent:ee}))},[S,a]),q=l.useCallback(ee=>{S(wd({handler:c,reactEvent:ee}))},[S,c]),W=l.useCallback(ee=>{S(wd({handler:u,reactEvent:ee}))},[S,u]),oe=l.useCallback(ee=>{S(wd({handler:x,reactEvent:ee}))},[S,x]),se=l.useCallback(ee=>{S(wd({handler:j,reactEvent:ee}))},[S,j]),de=l.useCallback(ee=>{k&&S(Fce(ee)),S(wd({handler:w,reactEvent:ee}))},[S,k,w]),le=l.useCallback(ee=>{S(wd({handler:y,reactEvent:ee}))},[S,y]),me=$Ze($);return l.createElement(Ale.Provider,{value:I},l.createElement(Dre.Provider,{value:E},l.createElement(me,{width:R??v?.width,height:F??v?.height,className:Ri("recharts-wrapper",r),style:xZe({position:"relative",curs
7785or:"default",width:R,height:F},v),onClick:H,onContextMenu:L,onDoubleClick:q,onFocus:K,onKeyDown:G,onMouseDown:W,onMouseEnter:U,onMouseLeave:X,onMouseMove:Q,onMouseUp:oe,onTouchEnd:le,onTouchMove:de,onTouchStart:se,ref:Y},l.createElement(jZe,null),i)))}),PZe=["width","height","responsive","children","className","style","compact","title","desc"];function AZe(e,n){if(e==null)return{};var i,r,o=NZe(e,n);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)i=s[r],n.indexOf(i)===-1&&{}.propertyIsEnumerable.call(e,i)&&(o[i]=e[i])}return o}function NZe(e,n){if(e==null)return{};var i={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(n.indexOf(r)!==-1)continue;i[r]=e[r]}return i}var Gce=l.forwardRef((e,n)=>{var{width:i,height:r,responsive:o,children:s,className:a,style:c,compact:u,title:m,desc:h}=e,g=AZe(e,PZe),x=yl(g);return u?l.createElement(l.Fragment,null,l.createElement(eA,{width:i,height:r}),l.createElement(GV,{otherAttributes:x,title:m,desc:h},s)):l.createElement(IZe,{className:a,style:c,width:i,height:r,responsive:o??!1,onClick:e.onClick,onMouseLeave:e.onMouseLeave,onMouseEnter:e.onMouseEnter,onMouseMove:e.onMouseMove,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onContextMenu:e.onContextMenu,onDoubleClick:e.onDoubleClick,onTouchStart:e.onTouchStart,onTouchMove:e.onTouchMove,onTouchEnd:e.onTouchEnd},l.createElement(GV,{otherAttributes:x,title:m,desc:h,ref:n},l.createElement(yKe,null,s)))});function a8(){return a8=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var i=arguments[n];for(var r in i)({}).hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},a8.apply(null,arguments)}var zZe={top:5,right:5,bottom:5,left:5},TZe={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,layout:"horizontal",margin:zZe,responsive:!1,reverseStackOrder:!1,stackOffset:"none",syncMethod:"index"},BO=l.forwardRef(function(n,i){var r,o=jo(n.categoricalChartProps,TZe),{chartName:s,defaultTooltipEventType:a,validateTooltipEventTypes:c,tooltipPayloadSearcher:u,categoricalChartProps:m}=n,h={chartName:s,defaultTooltipEventType:a,validateTooltipEventTypes:c,tooltipPayloadSearcher:u,eventEmitter:void 0};return l.createElement(Uce,{preloadedState:{options:h},reduxStoreName:(r=m.id)!==null&&r!==void 0?r:s},l.createElement(rce,{chartData:m.data}),l.createElement(Hce,{layout:o.layout,margin:o.margin}),l.createElement(qce,{baseValue:o.baseValue,accessibilityLayer:o.accessibilityLayer,barCategoryGap:o.barCategoryGap,maxBarSize:o.maxBarSize,stackOffset:o.stackOffset,barGap:o.barGap,barSize:o.barSize,syncId:o.syncId,syncMethod:o.syncMethod,className:o.className,reverseStackOrder:o.reverseStackOrder}),l.createElement(Gce,a8({},o,{ref:i})))}),EZe=["axis"],C1=l.forwardRef((e,n)=>l.createElement(BO,{chartName:"LineChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:EZe,tooltipPayloadSearcher:jA,categoricalChartProps:e,ref:n})),MZe=["axis","item"],KV=l.forwardRef((e,n)=>l.createElement(BO,{chartName:"BarChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:MZe,tooltipPayloadSearcher:jA,categoricalChartProps:e,ref:n}));function RZe(e){var n=Rr();return l.useEffect(()=>{n(rZe(e))},[n,e]),null}var OZe=["layout"];function l8(){return l8=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var i=arguments[n];for(var r in i)({}).hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},l8.apply(null,arguments)}function DZe(e,n){if(e==null)return{};var i,r,o=LZe(e,n);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)i=s[r],n.indexOf(i)===-1&&{}.propertyIsEnumerable.call(e,i)&&(o[i]=e[i])}return o}function LZe(e,n){if(e==null)return{};var i={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(n.indexOf(r)!==-1)continue;i[r]=e[r]}return i}var BZe={top:5,right:5,bottom:5,left:5},Vce={accessibilityLayer:!0,stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:BZe,reverseStackOrder:!1,syncMethod:"index",layout:"radial",responsive:!1,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"},FZe=l.forwardRef(function(n,i){var r,o=jo(n.categoricalChartProps,Vce),{layout:s}=o,a=DZe(o,OZe),{chartName:c,defaultTooltipEventType:u,validateTooltipEventTypes:m,tooltipPayloadSearcher:h}=n,g={chartName:c,defaultTooltipEventType:u,validateTooltipEventTypes:m,tooltipPayloadSearcher:h,eventEmitter:void 0};return l.createElement(Uce,{preloadedState:{options:g},reduxStoreName:(r=o.id)!==null&&r!==void 0?r:c},l.createElement(rce,{chartData:o.data}),l.createElement(Hce,{layout:s,margin:o.margin}),l.createElement(qce,{baseValue:void 0,accessibilityLayer:o.accessibilityLayer,barCategoryGap:o.barCategoryGap,maxBarSize:o.maxBarSize,stackOffset:o.stackOffset,barGap:o.barGap,barSize:o.barSize,syncId:o.syncId,syncMethod:o.syncMethod,className:o.className,reverseStackOrder:o.reverseStackOrder}),l.createElement(RZe,{cx:o.cx,cy:o.cy,startAngle:o.startAngle,endAngle:o.endAngle,innerRadius:o.innerRadius,outerRadius:o.outerRadius}),l.createElement(Gce,l8({},a,{ref:i}
7785)))});function YV(e,n){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),i.push.apply(i,r)}return i}function XV(e){for(var n=1;n<arguments.length;n++){var i=arguments[n]!=null?arguments[n]:{};n%2?YV(Object(i),!0).forEach(function(r){WZe(e,r,i[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):YV(Object(i)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(i,r))})}return e}function WZe(e,n,i){return(n=UZe(n))in e?Object.defineProperty(e,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[n]=i,e}function UZe(e){var n=HZe(e,"string");return typeof n=="symbol"?n:n+""}function HZe(e,n){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,n);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}var qZe=["item"],GZe=XV(XV({},Vce),{},{layout:"centric",startAngle:0,endAngle:360}),VZe=l.forwardRef((e,n)=>{var i=jo(e,GZe);return l.createElement(FZe,{chartName:"PieChart",defaultTooltipEventType:"item",validateTooltipEventTypes:qZe,tooltipPayloadSearcher:jA,categoricalChartProps:i,ref:n})}),KZe=["axis"],zC=l.forwardRef((e,n)=>l.createElement(BO,{chartName:"AreaChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:KZe,tooltipPayloadSearcher:jA,categoricalChartProps:e,ref:n}));const YZe=p.div.withConfig({displayName:"APIUsageChart__ChartWrap",componentId:"sc-1bgm1mv-0"})` 7786 width: 100%; 7787 border: 1px solid ${V}; 7788 background: ${Z}; 7789 border-radius: 0.75rem; 7790 padding: 0.75rem; 7791`,XZe=p.div.withConfig({displayName:"APIUsageChart__TooltipCard",componentId:"sc-1bgm1mv-1"})` 7792 background: ${Z}; 7793 border: 1px solid ${V}; 7794 color: ${O}; 7795 border-radius: 0.75rem; 7796 padding: 0.5rem 0.625rem; 7797 box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12); 7798`,QZe=p.div.withConfig({displayName:"APIUsageChart__TooltipTitle",componentId:"sc-1bgm1mv-2"})` 7799 font-size: 0.75rem; 7800 font-weight: 800; 7801 color: ${O}; 7802 margin-bottom: 0.25rem; 7803`,ZZe=p.div.withConfig({displayName:"APIUsageChart__TooltipValue",componentId:"sc-1bgm1mv-3"})` 7804 font-size: 0.75rem; 7805 font-weight: 700; 7806 color: ${z}; 7807`;function QV(e){return!e||typeof e!="string"?"":j_({value:e,format:"date",timeZoneMode:"viewer"})}function TA({data:e,height:n=220}){const i=l.useMemo(()=>Math.max(0,...e.map(s=>s.requests)),[e]),r=[0,i===0?5:Math.ceil(i*1.15)],o=l.useMemo(()=>{if(e.length<=1)return e.map(a=>a.date);const s=Math.max(1,Math.floor(e.length/6));return e.filter((a,c)=>c%s===0).map(a=>a.date)},[e]);return t.jsxs(YZe,{children:[t.jsx("div",{style:{width:"100%",height:n},children:t.jsx(Gl,{width:"100%",height:"100%",children:t.jsxs(C1,{data:e,margin:{top:6,right:8,left:0,bottom:0},children:[t.jsx(Zm,{stroke:Cf,strokeDasharray:"4 4"}),t.jsx(Ql,{dataKey:"date",ticks:o,tick:{fill:z,fontSize:12,fontWeight:700},axisLine:{stroke:V},tickLine:{stroke:V},minTickGap:12,tickFormatter:QV}),t.jsx(Zl,{domain:r,tick:{fill:z,fontSize:12,fontWeight:700},axisLine:{stroke:V},tickLine:{stroke:V},width:36}),t.jsx(Vl,{cursor:{stroke:Pe,strokeWidth:1},content:({active:s,payload:a,label:c})=>{if(!s||!a?.length)return null;const u=a[0]?.value,m=typeof u=="number"?u:0;return t.jsxs(XZe,{children:[t.jsx(QZe,{children:QV(c)}),t.jsxs(ZZe,{children:[m," requests"]})]})}}),t.jsx(Nd,{type:"monotone",dataKey:"requests",stroke:Ft,strokeWidth:2,dot:{r:2,stroke:Ft,fill:Ft},activeDot:{r:4}})]})})}),t.jsx("div",{style:{height:1,background:$e,marginTop:10}}),t.jsx("div",{style:{fontSize:"0.75rem",color:z,fontWeight:700,marginTop:8},children:"Daily requests"})]})}const JZe=p.div.withConfig({displayName:"APIUsageViewer__Header",componentId:"sc-5yye87-0"})` 7808 display: flex; 7809 align-items: flex-start; 7810 justify-content: space-between; 7811 gap: 0.75rem; 7812 margin-bottom: 0.75rem; 7813`,eJe=p.div.withConfig({displayName:"APIUsageViewer__Title",componentId:"sc-5yye87-1"})` 7814 display: inline-flex; 7815 align-items: center; 7816 gap: 0.5rem; 7817 font-size: 0.875rem; 7818 font-weight: 900; 7819 color: ${O}; 7820`,ZV=p.div.withConfig({displayName:"APIUsageViewer__Meta",componentId:"sc-5yye87-2"})` 7821 font-size: 0.75rem; 7822 font-weight: 700; 7823 color: ${z}; 7824 margin-top: 0.125rem; 7825`,tJe=p.div.withConfig({displayName:"APIUsageViewer__Right",componentId:"sc-5yye87-3"})` 7826 text-align: right; 7827`,nJe=p.div.withConfig({displayName:"APIUsageViewer__Total",componentId:"sc-5yye87-4"})` 7828 font-size: 0.875rem; 7829 font-weight: 900; 7830 color: ${O}; 7831`,iJe=p.div.withConfig({displayName:"APIUsageViewer__TotalLabel",componentId:"sc-5yye87-5"})` 7832 font-size: 0.75rem; 7833 font-weight: 700; 7834 color: ${z}; 7835`;function JV({organizationId:e,apiKeyId:n}){const[i,r]=l.useState(!0),[o,s]=l.useState(null),[a,c]=l.useState(null),u=l.useMemo(()=>n?`/api/v1/organizations/${e}/api_keys/${n}/usage`:`/api/v1/organizations/${e}/api_keys/api_usage`,[n,e]);l.useEffect(()=>{let g=!1;async function x(){r(!0),s(null);try{const y=await ue(u,{method:"GET"}),w=await y.json();if(!y.ok)throw new Error(w?.error||"Failed to load usage");g||c(w.usage)}catch(y){g||s(y?.message||"Failed to load usage")}finally{g||r(!1)}}return x(),()=>{g=!0}},[u]);const m=l.useMemo(()=>(a?.series||[]).reduce((g,x)=>g+(x.requests||0),0),[a]),h=l.useMemo(()=>
7835{if(!a)return null;const g=new Date(a.from),x=new Date(a.to),y=new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric"});return`${y.format(g)} â ${y.format(x)}`},[a]);return i?t.jsx(ZV,{children:"Loading usageâ¦"}):o?t.jsx(hr,{$variant:"error",children:o}):a?t.jsxs("div",{children:[t.jsxs(JZe,{children:[t.jsxs("div",{children:[t.jsxs(eJe,{children:[t.jsx(gl,{size:16}),"Usage"]}),h?t.jsx(ZV,{children:h}):null]}),t.jsxs(tJe,{children:[t.jsx(nJe,{children:m}),t.jsx(iJe,{children:"requests"})]})]}),t.jsx(TA,{data:a.series||[]})]}):null}const rJe=p.div.withConfig({displayName:"LogoPicker__Row",componentId:"sc-enlr3q-0"})` 7836 display: flex; 7837 align-items: center; 7838 gap: 1rem; 7839 flex-wrap: wrap; 7840`,oJe=p.div.withConfig({displayName:"LogoPicker__Preview",componentId:"sc-enlr3q-1"})` 7841 width: 56px; 7842 height: 56px; 7843 border-radius: 0.75rem; 7844 border: 1px solid ${V}; 7845 background: ${$e}; 7846 overflow: hidden; 7847 display: flex; 7848 align-items: center; 7849 justify-content: center; 7850 flex-shrink: 0; 7851 7852 img { 7853 width: 100%; 7854 height: 100%; 7855 object-fit: cover; 7856 display: block; 7857 } 7858`,sJe=p.input.withConfig({displayName:"LogoPicker__HiddenFileInput",componentId:"sc-enlr3q-2"})` 7859 display: none; 7860`;function FO({previewUrl:e,disabled:n=!1,hasLogo:i,onPickFile:r,onRemove:o,helperText:s="PNG/JPG recommended. Square logos work best.",previewAriaLabel:a="Logo preview",previewAlt:c="Logo"}){const u=l.useRef(null),m=l.useMemo(()=>i?"Change logo":"Upload logo",[i]);return t.jsxs(rJe,{children:[t.jsx(oJe,{"aria-label":a,children:e?t.jsx("img",{src:e,alt:c}):t.jsx(r0e,{size:20,color:z})}),t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"0.5rem",minWidth:0},children:[t.jsxs("div",{style:{display:"flex",gap:"0.5rem",flexWrap:"wrap"},children:[t.jsx(he,{type:"button",variant:"outline",size:"sm",disabled:n,onClick:()=>u.current?.click(),children:m}),t.jsx(he,{type:"button",variant:"ghost",size:"sm",disabled:n||!i,onClick:o,children:"Remove"})]}),t.jsx(Gs,{children:s})]}),t.jsx(sJe,{ref:u,type:"file",accept:"image/*",onChange:h=>{const g=h.target.files?.[0]||null;r(g)}})]})}const aJe=[{value:"global",label:"Global",icon:Nne},{value:"country",label:"Country",icon:E0e},{value:"region",label:"Region",icon:G0e},{value:"city",label:"City",icon:by}],lJe=p.div.withConfig({displayName:"FocusSelector__Grid",componentId:"sc-1ukq8kb-0"})` 7861 display: grid; 7862 grid-template-columns: repeat(4, 1fr); 7863 gap: 0.75rem; 7864 margin-bottom: 0.5rem; 7865 7866 @media (max-width: 768px) { 7867 grid-template-columns: repeat(2, 1fr); 7868 } 7869`,cJe=p.button.withConfig({displayName:"FocusSelector__Card",componentId:"sc-1ukq8kb-1"})` 7870 padding: 1.25rem 1rem; 7871 min-height: 4.25rem; 7872 border: 1px solid ${e=>e.$selected?ot:Rt}; 7873 border-radius: 1rem; 7874 background-color: ${Z}; 7875 cursor: pointer; 7876 transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease, background-color 0.18s ease; 7877 display: flex; 7878 flex-direction: column; 7879 align-items: center; 7880 justify-content: center; 7881 gap: 0.5rem; 7882 box-sizing: border-box; 7883 box-shadow: ${e=>e.$selected?"0 6px 18px rgba(17, 24, 39, 0.08)":"0 1px 2px rgba(0, 0, 0, 0.06)"}; 7884 7885 &:hover:not(:disabled) { 7886 border-color: ${ot};
7887 box-shadow: 0 8px 22px rgba(17, 24, 39, 0.1); 7888 transform: translateY(-1px); 7889 } 7890 7891 &:disabled { 7892 cursor: not-allowed; 7893 opacity: 0.55; 7894 transform: none; 7895 } 7896 7897 &:focus-visible { 7898 outline: none; 7899 box-shadow: 0 0 0 3px ${En}, 0 8px 22px rgba(17, 24, 39, 0.1); 7900 } 7901`,dJe=p.div.withConfig({displayName:"FocusSelector__IconBox",componentId:"sc-1ukq8kb-2"})` 7902 color: ${e=>e.$selected?Z:O}; 7903 width: 2.25rem; 7904 height: 2.25rem; 7905 border-radius: 0.75rem; 7906 display: flex; 7907 align-items: center; 7908 justify-content: center; 7909 background: ${e=>e.$selected?ot:Z}; 7910 border: 1px solid ${e=>e.$selected?"transparent":Rt}; 7911 transition: transform 0.18s ease, background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease; 7912 box-shadow: ${e=>e.$selected?"0 6px 14px rgba(79, 70, 229, 0.18)":"0 1px 2px rgba(0, 0, 0, 0.05)"}; 7913 7914 svg { 7915 width: 1.25rem; 7916 height: 1.25rem; 7917 color: ${e=>e.$selected?Z:O}; 7918 } 7919`,uJe=p.div.withConfig({displayName:"FocusSelector__Label",componentId:"sc-1ukq8kb-3"})` 7920 font-size: 0.875rem; 7921 font-weight: 600; 7922 color: ${O}; 7923 text-transform: capitalize; 7924`;function WO({value:e,onChange:n,disabled:i=!1,options:r=aJe}){return t.jsx(lJe,{children:r.map(({value:o,label:s,icon:a})=>t.jsxs(cJe,{type:"button",$selected:e===o,onClick:()=>n(o),disabled:i,children:[t.jsx(dJe,{$selected:e===o,"aria-hidden":"true",children:t.jsx(a,{})}),t.jsx(uJe,{children:s})]},o))})}function TC(e,n){if(!e.ok)throw new Error(n)}async function eK(e,n,i){const r=i?.page&&i.page>0?i.page:1,o=i?.per_page&&i.per_page>0?i.per_page:25,s=new URLSearchParams({page:String(r),per_page:String(o)}),a=await ue(`/api/v1/organizations/${e}/projects/${n}/chat_sessions?${s.toString()}`,{method:"GET"});TC(a,"Failed to load chats");const c=await a.json().catch(()=>null),u=Array.isArray(c?.sessions)?c.sessions:[],m=c?.pagination&&typeof c.pagination=="object"?c.pagination:null;return{sessions:u,pagination:m}}async function Kce(e,n,i,r){const o={title:i||""};r&&Object.keys(r).length>0&&(o.metadata=r);const s=await ue(`/api/v1/organizations/${e}/projects/${n}/chat_sessions`,{method:"POST",body:JSON.stringify(o)});TC(s,"Failed to create chat");const a=await s.json().catch(()=>null);if(!a?.session)throw new Error("Invalid create chat response");return{session:a.session,reused:!!a.reused}}async function pJe(e,n,i){const r={title:"",metadata:i,lookup_only:!0},o=await ue(`/api/v1/organizations/${e}/projects/${n}/chat_sessions`,{method:"POST",body:JSON.stringify(r)});if(!o.ok)return null;const s=await o.json().catch(()=>null);return s?.session?s.session:null}async function mJe(e,n,i){const r=await ue(`/api/v1/organizations/${e}/projects/${n}/chat_sessions/${i}`,{method:"DELETE"});TC(r,"Failed to delete chat")}async function hJe(e,n,i,r){const o=await ue(`/api/v1/organizations/${e}/projects/${n}/chat_sessions/${i}`,{method:"PATCH",body:JSON.stringify({title:r||""})});TC(o,"Failed to rename chat");const s=await o.json().catch(()=>null);if(!s?.session)throw new Error("Invalid rename chat response");return s.session}async function c8(e,n,i,r){const o=r?.limit&&r.limit>0?r.limit:50,s=r?.before_id&&r.before_id>0?r.before_id:null,a=new URLSearchParams;a.set("limit",String(o)),s&&a.set("before_id",String(s));const c=await ue(`/api/v1/organizations/${e}/projects/${n}/chat_sessions/${i}/messages?${a.toString()}`,{method:"GET"});TC(c,"Failed to load chat messages");const u=await c.json().catch(()=>null),m=Array.isArray(u?.messages)?u.messages:[],h=u?.pagination&&typeof u.pagination=="object"?u.pagination:null;return{messages:m,pagination:h}}const fJe=p.button.withConfig({displayName:"ChatSidePanel__CtaButton",componentId:"sc-73c3fy-0"})` 7925 display: flex; 7926 align-items: center; 7927 gap: 0.6rem; 7928 width: 100%; 7929 padding: 0.85rem 1rem; 7930 border: 1.5px solid ${ot}; 7931 border-radius: 0.75rem; 7932 background: linear-gradient(135deg, rgba(79, 70, 229, 0.04), rgba(79, 70, 229, 0.10)); 7933 cursor: pointer; 7934 transition: all 0.15s ease; 7935 &:hover { 7936 background: linear-gradient(135deg, rgba(79, 70, 229, 0.08), rgba(79, 70, 229, 0.16)); 7937 border-color: ${Ft}; 7938 transform: translateY(-1px); 7939 box-shadow: 0 2px 8px rgba(79, 70, 229, 0.12); 7940 } 7941 &:active { transform: translateY(0); } 7942`,gJe=p.span.withConfig({displayName:"ChatSidePanel__CtaIcon",componentId:"sc-73c3fy-1"})` 7943 display: flex; 7944 align-items: center; 7945 justify-content: center; 7946 width: 28px; 7947 height: 28px; 7948 border-radius: 50%; 7949 background: ${ot}; 7950 color: #fff; 7951 flex-shrink: 0; 7952`,yJe=p.span.withConfig({displayName:"ChatSidePanel__CtaText",componentId:"sc-73c3fy-2"})` 7953 flex: 1; 7954 text-align: left; 7955`,xJe=p.span.withConfig({displayName:"ChatSidePanel__CtaTitle",componentId:"sc-73c3fy-3"})` 7956 display: block; 7957 font-size: 0.8rem; 7958 font-weight: 700; 7959 color: ${Ft}; 7960`,bJe=p.span.withConfig({displayName:"ChatSidePanel__CtaSub",componentId:"sc-73c3fy-4"})` 7961 display: block; 7962 font-size: 0.68rem; 7963 color: ${Pe}; 7964 margin-top: 0.1rem; 7965`,vJe=p.button.withConfig({displayName:"ChatSidePanel__FloatingLauncher",componentId:"sc-73c3fy-5"})` 7966 position: fixed; 7967 right: 1.5rem; 7968 bottom: 1.5rem; 7969 z-index: 1100; 7970 width: 3.5rem; 7971 height: 3.5rem; 7972 border-radius: 999px; 7973 border: 1px solid rgba(79, 70, 229, 0.28); 7974 background: ${ot}; 7975 color: ${Z}; 7976 display: inline-flex; 7977 align-items: center; 7978 justify-content: center; 7979 cursor: pointer; 7980 box-shadow: 0 16px 40px rgba(79, 70, 229, 0.28); 7981 transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease; 7982 7983 &:hover { 7984 background: ${Ft}; 7985 transform: translateY(-2px); 7986 box-shadow: 0 20px 48px rgba(79, 70, 229, 0.34); 7987 } 7988 7989 &:focus-visible { 7990 outline: none; 7991 box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.18), 0 16px 40px rgba(79, 70, 229, 0.28); 7992 } 7993 7994 @media (max-width: 640px) { 7995 right: 1rem; 7996 bottom: 1rem; 7997 } 7998`,Yce=p.div.withConfig({displayName:"ChatSidePanel__Panel",componentId:"sc-73c3fy-6"})` 7999 border: 1px solid ${V}; 8000 background: ${Z}; 8001 border-radius: 0.75rem; 8002 display: flex; 8003 flex-direction: column; 8004 overflow: hidden; 8005 height: 480px; 8006 max-height: 480px; 8007 contain: layout style; 8008`,wJe=p.div.withConfig({displayName:"ChatSidePanel__Header",componentId:"sc-73c3fy-7"})` 8009 display: flex; 8010 align-items: center; 8011 gap: 0.5rem; 8012 padding: 0.6rem 0.75rem; 8013 border-bottom: 1px solid ${V}; 8014 background: ${At}; 8015 cursor: pointer; 8016 user-select: none; 8017 flex-shrink: 0; 8018`,jJe=p.span.withConfig({displayName:"ChatSidePanel__HeaderTitle",componentId:"sc-73c3fy-8"})` 8019 font-size: 0.775rem; 8020 font-weight: 700; 8021 color: ${O}; 8022 flex: 1; 8023 overflow: hidden; 8024 text-overflow: ellipsis; 8025 white-space: nowrap; 8026`,_Je=p.button.withConfig({displayName:"ChatSidePanel__HeaderBtn",componentId:"sc-73c3fy-9"})` 8027 background: none; 8028 border: none; 8029 cursor: pointer;
8030 color: ${Pe}; 8031 padding: 0; 8032 display: flex; 8033 align-items: center; 8034 &:hover { color: ${O}; } 8035`,CJe=p.div.withConfig({displayName:"ChatSidePanel__OverlayBackdrop",componentId:"sc-73c3fy-10"})` 8036 position: fixed; 8037 inset: 0; 8038 z-index: 1200; 8039 background: rgba(17, 24, 39, 0.18); 8040 display: flex; 8041 align-items: center; 8042 justify-content: flex-end; 8043 padding: 1.25rem; 8044 8045 @media (max-width: 640px) { 8046 align-items: stretch; 8047 justify-content: center; 8048 padding: 0.75rem; 8049 } 8050`,SJe=p(Yce).withConfig({displayName:"ChatSidePanel__OverlayPanel",componentId:"sc-73c3fy-11"})` 8051 width: min(420px, calc(100vw - 2.5rem)); 8052 height: min(720px, calc(100vh - 2.5rem)); 8053 max-height: calc(100vh - 2.5rem); 8054 box-shadow: 0 24px 80px rgba(17, 24, 39, 0.22); 8055 8056 @media (max-width: 640px) { 8057 width: 100%; 8058 height: 100%; 8059 max-height: none; 8060 border-radius: 1rem; 8061 } 8062`,kJe=p.div.withConfig({displayName:"ChatSidePanel__MessagesArea",componentId:"sc-73c3fy-12"})` 8063 flex: 1; 8064 overflow-y: auto; 8065 overscroll-behavior: contain; 8066 padding: 0.75rem; 8067 display: flex; 8068 flex-direction: column; 8069 gap: 0.75rem; 8070 min-height: 0; 8071`,$Je=p.div.withConfig({displayName:"ChatSidePanel__MsgBubble",componentId:"sc-73c3fy-13"})` 8072 max-width: 92%; 8073 align-self: ${e=>e.$role==="user"?"flex-end":"flex-start"}; 8074 padding: 0.5rem 0.65rem; 8075 border-radius: 0.65rem; 8076 font-size: 0.775rem; 8077 line-height: 1.5; 8078 color: ${O}; 8079 background: ${e=>e.$role==="user"?"rgba(79,70,229,0.08)":At}; 8080 border: 1px solid ${e=>e.$role==="user"?"rgba(79,70,229,0.15)":V}; 8081 white-space: ${e=>e.$role==="user"?"pre-wrap":"normal"}; 8082 overflow-wrap: anywhere; 8083 8084 /* Markdown content sizing */ 8085 p { margin: 0.2rem 0; } 8086 ul, ol { margin: 0.2rem 0; padding-left: 1.1rem; } 8087 li { margin: 0.1rem 0; } 8088 code { font-size: 0.75em; background: ${$e}; padding: 0.05rem 0.2rem; border-radius: 3px; } 8089 pre { font-size: 0.75em; background: ${$e}; padding: 0.4rem; border-radius: 4px; overflow-x: auto; } 8090`,IJe=p.span.withConfig({displayName:"ChatSidePanel__ThinkingDot",componentId:"sc-73c3fy-14"})` 8091 font-size: 0.75rem; 8092 color: ${Pe}; 8093 font-style: italic; 8094`,PJe=p.span.withConfig({displayName:"ChatSidePanel__MiniCreditsBadge",componentId:"sc-73c3fy-15"})` 8095 display: inline-flex; 8096 align-items: center; 8097 gap: 0.2rem; 8098 font-size: 0.58rem; 8099 font-weight: 700; 8100 color: ${Pe}; 8101 margin-top: 0.2rem; 8102`,AJe=p.div.withConfig({displayName:"ChatSidePanel__ComposerWrap",componentId:"sc-73c3fy-16"})` 8103 display: flex; 8104 flex-direction: column; 8105 border-top: 1px solid ${V}; 8106 background: ${Z}; 8107 flex-shrink: 0; 8108`,NJe=p(Dn).withConfig({displayName:"ChatSidePanel__FooterLink",componentId:"sc-73c3fy-17"})` 8109 display: inline-flex; 8110 align-items: center; 8111 justify-content: center; 8112 gap: 0.2rem; 8113 font-size: 0.62rem; 8114 font-weight: 600; 8115 color: ${Pe}; 8116 text-decoration: none; 8117 flex: 1; 8118 &:hover { color: ${O}; } 8119`,zJe=p.textarea.withConfig({displayName:"ChatSidePanel__ComposerInput",componentId:"sc-73c3fy-18"})` 8120 width: 100%; 8121 border: none; 8122 border-radius: 0; 8123 padding: 0.5rem 0.75rem; 8124 font-size: 0.75rem; 8125 font-family: inherit; 8126 color: ${O}; 8127 background: rgba(79, 70, 229, 0.04); 8128 outline: none; 8129 resize: none; 8130 min-height: ${e=>e.$roomy?"6.5rem":"2.5rem"}; 8131 max-height: ${e=>e.$roomy?"11rem":"5rem"}; 8132 overflow-y: auto; 8133 box-sizing: border-box; 8134 transition: background 0.15s ease; 8135 &:focus { 8136 background: rgba(79, 70, 229, 0.08); 8137 } 8138 &::placeholder { color: ${Pe}; } 8139`,TJe=p(he).withConfig({displayName:"ChatSidePanel__SendBtn",componentId:"sc-73c3fy-19"})` 8140 flex-shrink: 0; 8141 min-height: 0; 8142 height: 1.75rem !important; 8143 padding: 0 0.65rem; 8144 font-size: 0.68rem; 8145 line-height: 1 !important; 8146`,EJe=p.div.withConfig({displayName:"ChatSidePanel__EmptyHint",componentId:"sc-73c3fy-20"})` 8147 text-align: center; 8148 padding: 1rem; 8149 font-size: 0.75rem; 8150 color: ${Pe}; 8151`,MJe=p.div.withConfig({displayName:"ChatSidePanel__ComposerActions",componentId:"sc-73c3fy-21"})` 8152 display: flex; 8153 align-items: center; 8154 gap: 0.4rem; 8155 padding: 0.35rem 0.75rem; 8156`,RJe=p.span.withConfig({displayName:"ChatSidePanel__ComposerSpacer",componentId:"sc-73c3fy-22"})` 8157 flex: 1; 8158 min-width: 0; 8159`,OJe=p.div.withConfig({displayName:"ChatSidePanel__MiniPickerWrap",componentId:"sc-73c3fy-23"})` 8160 position: relative; 8161`,DJe=p.button.withConfig({displayName:"ChatSidePanel__MiniPickerTrigger",componentId:"sc-73c3fy-24"})` 8162 display: inline-flex; 8163 align-items: center; 8164 gap: 0.2rem; 8165 padding: 0.3rem 0.45rem; 8166 border-radius: 0.4rem; 8167 border: 1px solid ${e=>e.$open?"rgba(79,70,229,0.25)":V}; 8168 background: ${e=>e.$open?"rgba(79,70,229,0.06)":"transparent"}; 8169 color: ${e=>e.$open?"rgb(79,70,229)":Pe}; 8170 font-size: 0.62rem; 8171 font-weight: 700; 8172 cursor: pointer; 8173 transition: all 0.12s ease; 8174 line-height: 1; 8175 8176 &:hover { 8177 background: ${$e}; 8178 color: ${O}; 8179 border-color: ${V}; 8180 } 8181`,LJe=p.div.withConfig({displayName:"ChatSidePanel__MiniPickerMe
8181nu",componentId:"sc-73c3fy-25"})` 8182 position: absolute; 8183 bottom: calc(100% + 0.4rem); 8184 left: 0; 8185 min-width: 180px; 8186 background: ${Z}; 8187 border: 1px solid ${V}; 8188 border-radius: 0.6rem; 8189 box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12); 8190 padding: 0.3rem; 8191 z-index: 50; 8192 animation: miniMenuIn 100ms ease; 8193 8194 @keyframes miniMenuIn { 8195 from { opacity: 0; transform: translateY(3px); } 8196 to { opacity: 1; transform: translateY(0); } 8197 } 8198`,BJe=p.button.withConfig({displayName:"ChatSidePanel__MiniPickerItem",componentId:"sc-73c3fy-26"})` 8199 display: flex; 8200 align-items: center; 8201 gap: 0.5rem; 8202 width: 100%; 8203 padding: 0.4rem 0.5rem; 8204 border: none; 8205 border-radius: 0.35rem; 8206 background: ${e=>e.$selected?"rgba(79,70,229,0.06)":"transparent"}; 8207 cursor: pointer; 8208 text-align: left; 8209 font-size: 0.7rem; 8210 font-weight: 700; 8211 color: ${e=>e.$selected?"rgb(79,70,229)":O}; 8212 transition: background 0.1s ease; 8213 8214 &:hover { 8215 background: ${e=>e.$selected?"rgba(79,70,229,0.09)":$e}; 8216 } 8217`,A6=[{key:"flash",label:"Fast",icon:Ks},{key:"balanced",label:"Balanced",icon:Sn},{key:"pro",label:"Pro",icon:wP}];function FJe({modelTier:e,onChange:n,isCorePlan:i=!1}){const[r,o]=l.useState(!1),s=l.useRef(null);l.useEffect(()=>{if(!r)return;const u=m=>{s.current&&!s.current.contains(m.target)&&o(!1)};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[r]);const a=A6.find(u=>u.key===e)||A6[1],c=a.icon;return t.jsxs(OJe,{ref:s,children:[t.jsxs(DJe,{type:"button",$open:r,onClick:()=>o(u=>!u),title:`Model: ${a.label}`,children:[t.jsx(c,{size:11}),a.label,t.jsx(qn,{size:9,style:{opacity:.5}})]}),r?t.jsx(LJe,{children:A6.map(u=>{const m=u.icon,h=i&&u.key==="pro",g=t.jsxs(BJe,{type:"button",$selected:e===u.key,onClick:()=>{h||(n(u.key),o(!1))},style:h?{opacity:.45,cursor:"default"}:void 0,children:[t.jsx(m,{size:12}),u.label,h?t.jsx(ku,{size:10,style:{marginLeft:2,opacity:.7}}):null]},u.key);return u.key==="pro"?t.jsx(at,{content:h?"Pro uses the most powerful model and costs significantly more credits per message. Upgrade your plan to unlock it.":"Pro uses the most powerful model and costs significantly more credits per message.",placement:"top",maxWidth:240,children:g},u.key):g})}):null]})}function EC({orgId:e,projectId:n,sessionTitle:i,initialMessage:r,metadata:o,placeholder:s="Ask a follow-upâ¦",variant:a="inline",launcher:c="card",className:u}){const{subscribe:m}=wo(),{user:h}=yn(),g=h?.organizations?.find(we=>Number(we.id)===e)||null,y=(g?.role||null)==="owner",w=g?.plan_family==="core",j=!!g?.partner_managed,[v,_]=l.useState(!1),[$,k]=l.useState(null),[P,S]=l.useState([]),[I,A]=l.useState(""),[E,B]=l.useState("balanced");l.useEffect(()=>{w&&E==="pro"&&B("balanced")},[w,E]);const[T,M]=l.useState(!1),[R,F]=l.useState(!1),[Y,H]=l.useState(!1),U=l.useRef(!1),X=l.useRef(o);X.current=o;const Q=l.useRef(null),K=l.useRef(null),G=l.useRef(null);l.useEffect(()=>{const we=Q.current;we&&(we.scrollTop=we.scrollHeight)},[P]);const L=l.useCallback(we=>{const Ke=we?.type;if(Ke==="chat_message_created"||Ke==="chat_message_updated"){const ce=we?.message;if(!ce)return;const ie={id:String(ce.id),role:ce.role==="assistant"?"assistant":"user",content:String(ce.content||""),status:ce.status,metadata:ce.metadata,created_at:String(ce.created_at)};S(Re=>{const Be=Re.findIndex(dt=>dt.id===ie.id);if(Be>=0){const dt=[...Re];return dt[Be]={...dt[Be],...ie},dt}const tt=ie.metadata?.client_nonce;if(tt){const dt=Re.findIndex(je=>je.id.startsWith("local-")&&je.metadata?.client_nonce===tt&&je.role===ie.role);if(dt>=0){const je=[...Re];return je[dt]=ie,je}}return[...Re,ie]}),ie.role==="assistant"&&(ie.status==="done"||ie.status==="failed"?M(!1):M(!0))}else if(Ke==="credits_updated")Fo();else if(Ke==="chat_error"){const ce=we?.error_code;if(ce==="credits_insufficient"){if(F(!0),M(!1),we?.client_nonce){const ie=we.client_nonce;S(Re=>Re.filter(Be=>!(Be.id.startsWith("local-")&&Be.metadata?.client_nonce===ie)))}}else ce==="provider_rate_limit"&&M(!1)}},[]),q=l.useRef(r);q.current=r;const W=l.useCallback(we=>{try{K.current?.unsubscribe?.()}catch{}K.current=m({channel:"ChatChannel",chat_session_id:we},{connected:()=>{!U.current&&q.current&&(U.current=!0,A(q.current))},received:L})},[m,L]),[oe,se]=l.useState(!1);l.useEffect(()=>{if(!v||G.current||!e||!n)return;let we=!1;return(async()=>
8217{if(X.current?.resource_type)try{const Ke=await pJe(e,n,X.current);if(we)return;if(Ke){const ce=Ke.id;G.current=ce,k(ce),U.current=!0;try{const{messages:ie}=await c8(e,n,ce,{limit:50});!we&&ie.length>0&&S(ie.map(Re=>({id:String(Re.id),role:Re.role==="assistant"?"assistant":"user",content:String(Re.content||""),status:Re.status,metadata:Re.metadata,created_at:String(Re.created_at)})))}catch{}W(ce),se(!0);return}}catch{}we||(!U.current&&q.current&&(U.current=!0,A(q.current)),se(!0))})(),()=>{we=!0}},[v,e,n]),l.useEffect(()=>()=>{try{K.current?.unsubscribe?.()}catch{}},[]);const de=l.useCallback(async()=>{if(G.current)return G.current;if(!e||!n)return null;try{const{session:we}=await Kce(e,n,i,X.current),Ke=we.id;return k(Ke),G.current=Ke,W(Ke),await new Promise(ce=>setTimeout(ce,300)),Ke}catch(we){return console.error("[ChatSidePanel] failed to create session:",we),null}},[e,n,i,W]),le=l.useCallback(async()=>{const we=I.trim();if(!we||T||!await de())return;const ce=`nonce-${Date.now()}`;S(ie=>[...ie,{id:`local-${ce}`,role:"user",content:we,status:"done",metadata:{client_nonce:ce},created_at:new Date().toISOString()}]),M(!0),A(""),K.current?.perform("send_message",{content:we,client_nonce:ce,model_tier:E})},[I,T,de,E]),me=l.useCallback(we=>{const Ke=Number(we);!Number.isFinite(Ke)||Ke<=0||!K.current||(S(ce=>ce.map(ie=>ie.id===we?{...ie,status:"pending",content:""}:ie)),M(!0),K.current.perform("retry_message",{assistant_message_id:Ke}))},[]),ee=T,ne=a==="overlay";if(!v)return c==="floating"?t.jsx(vJe,{className:u,type:"button",onClick:()=>_(!0),"aria-label":"Open chat",title:"Explore in Chat",children:t.jsx(f5,{size:22})}):t.jsxs(fJe,{className:u,onClick:()=>_(!0),children:[t.jsx(gJe,{children:t.jsx(Sn,{size:14})}),t.jsxs(yJe,{children:[t.jsx(xJe,{children:"Explore in Chat"}),t.jsx(bJe,{children:o?.resource_type?"Continue or start a conversation":"Ask questions, get guidance, dig deeper"})]}),t.jsx(f5,{size:14,style:{color:ot,flexShrink:0}})]});const Ae=ne?SJe:Yce,_e=t.jsxs(Ae,{className:ne?void 0:u,children:[t.jsxs(wJe,{onClick:()=>_(!1),children:[t.jsx(f5,{size:14,style:{color:O}}),t.jsx(jJe,{children:"Chat"}),t.jsx(_Je,{onClick:we=>{we.stopPropagation(),_(!1)},children:t.jsx(B0e,{size:13})})]}),t.jsxs(kJe,{ref:Q,children:[P.length===0&&!T&&t.jsx(EJe,{children:oe?"Send a message to start the conversation.":"Loadingâ¦"}),P.map(we=>t.jsx($Je,{$role:we.role,children:we.role==="assistant"?we.status==="failed"?we.metadata?.error_code==="provider_rate_limit"?t.jsx("span",{style:{color:"#d97706"},children:"The AI service is temporarily busy. Please try again in a few minutes."}):t.jsxs(t.Fragment,{children:[t.jsx("span",{style:{color:"#ef4444"},children:"Something went wrong."}),t.jsx("div",{style:{marginTop:4},children:t.jsx(he,{variant:"outline",size:"sm",onClick:()=>me(we.id),children:"Retry"})})]}):!we.content&&(we.status==="pending"||we.status==="streaming")?t.jsx(IJe,{children:"Thinkingâ¦"}):t.jsxs(t.Fragment,{children:[t.jsx(X5,{wrap:"none",markdown:we.content}),we.status==="done"&&(we.metadata?.model_tier||we.metadata?.credits_charged)?t.jsxs(PJe,{children:[we.metadata.model_tier?t.jsx("span",{children:we.metadata.model_tier==="flash"?"Fast":we.metadata.model_tier==="pro"?"Pro":"Balanced"}):null,we.metadata.credits_charged?t.jsxs(t.Fragment,{children:[t.jsx(vy,{size:9})," ",we.metadata.credits_charged]}):null]}):null]}):we.content},we.id))]}),R?t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.4rem",padding:"0.5rem 0.75rem",background:"rgba(239, 68, 68, 0.06)",borderTop:"1px solid rgba(239, 68, 68, 0.15)",fontSize:"0.68rem",fontWeight:700,color:"rgb(185, 28, 28)"},children:[t.jsx(ei,{size:12,style:{flexShrink:0}}),t.jsx("span",{children:j?"No credits remaining. Contact your partner to upgrade.":y?t.jsxs(t.Fragment,{children:["No credits remaining. ",t.jsx("button",{onClick:()=>H(!0),style:{color:"inherit",fontWeight:850,textDecoration:"underline",background:"none",border:"none",padding:0,font:"inherit",cursor:"pointer"},children:"Upgrade your plan"})," to continue."]}):"No credits remaining. Ask your workspace owner to upgrade."})]}):t.jsxs(AJe,{children:[t.jsx(zJe,{$roomy:ne,value:I,onChange:we=>A(we.target.value),onKeyDown:we=>{we.key==="Enter"&&!we.shiftKey&&(we.preventDefault(),le())},placeholder:ee?"Waiting for responseâ¦":s,disabled:ee||!oe}),t.jsxs(MJe,{children:[t.jsx(FJe,{modelTier:E,onChange:B,isCorePlan:w}
8217),$?t.jsxs(NJe,{to:`/workspaces/${e}/projects/${n}/chat?chatId=${$}`,children:[t.jsx(as,{size:9}),"Open in Chat"]}):t.jsx(RJe,{}),t.jsx(TJe,{variant:"primary",size:"sm",onClick:le,disabled:ee||!I.trim()||!oe,children:"Send"})]})]}),t.jsx(ec,{isOpen:Y,orgId:e,onClose:()=>H(!1)})]});return ne?jr.createPortal(t.jsx(CJe,{onMouseDown:we=>{we.target===we.currentTarget&&_(!1)},children:_e}),document.body):_e}const UO=p.div.withConfig({displayName:"PillTabs",componentId:"sc-15p21og-0"})` 8218 display: inline-flex; 8219 align-items: center; 8220 gap: 0.25rem; 8221 padding: 0.25rem; 8222 border: 1px solid ${V}; 8223 background: ${$e}; 8224 border-radius: 0.75rem; 8225`,hy=p.button.withConfig({displayName:"PillTabs__PillTab",componentId:"sc-15p21og-1"})` 8226 appearance: none; 8227 border: 0; 8228 background: ${e=>e.$active?Z:"transparent"}; 8229 color: ${O}; 8230 border-radius: 0.6rem; 8231 padding: 0.5rem 0.7rem; 8232 font-size: 0.8125rem; 8233 font-weight: ${e=>e.$active?950:850}; 8234 display: inline-flex; 8235 align-items: center; 8236 gap: 0.45rem; 8237 cursor: pointer; 8238 box-shadow: ${e=>e.$active?"0 1px 0 rgba(0,0,0,0.06), 0 6px 16px rgba(0,0,0,0.08)":"none"}; 8239 text-decoration: none; 8240 8241 &:hover { 8242 background: ${e=>e.$active?Z:"rgba(255,255,255,0.65)"}; 8243 } 8244`,WJe=p.div.withConfig({displayName:"ScrollableTable__Wrapper",componentId:"sc-1s7vnum-0"})` 8245 position: relative; 8246 flex: 1; 8247 min-height: 0; 8248 width: 100%; 8249`,UJe=p.div.withConfig({displayName:"ScrollableTable__Inner",componentId:"sc-1s7vnum-1"})` 8250 width: 100%; 8251 height: 100%; 8252 overflow: auto; 8253 -webkit-overflow-scrolling: touch; 8254 background: ${Z}; 8255`,tK=p.div.withConfig({displayName:"ScrollableTable__Fade",componentId:"sc-1s7vnum-2"})` 8256 position: absolute; 8257 top: 0; 8258 bottom: 0; 8259 width: 32px; 8260 pointer-events: none; 8261 z-index: 2; 8262 transition: opacity 0.2s ease; 8263 opacity: ${e=>e.$visible?1:0}; 8264 ${e=>e.$side==="right"?"right: 0; background: linear-gradient(to right, transparent, rgba(0,0,0,0.06));":"left: 0; background: linear-gradient(to left, transparent, rgba(0,0,0,0.06));"} 8265`,HJe=Tn` 8266 0%, 100% { transform: translateX(0); } 8267 50% { transform: translateX(3px); } 8268`,qJe=Tn` 8269 0%, 100% { transform: translateX(0); } 8270 50% { transform: translateX(-3px); } 8271`,nK=p.button.withConfig({displayName:"ScrollableTable__ScrollHint",componentId:"sc-1s7vnum-3"})` 8272 position: absolute; 8273 ${e=>e.$side==="right"?"right: 6px;":"left: 6px;"} 8274 top: 50%; 8275 margin-top: -14px; 8276 z-index: 3; 8277 width: 28px; 8278 height: 28px; 8279 border-radius: 9999px; 8280 border: 1px solid ${V}; 8281 background: ${Z}; 8282 box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); 8283 display: flex; 8284 align-items: center; 8285 justify-content: center; 8286 cursor: pointer; 8287 color: ${z}; 8288 transition: opacity 0.2s ease, box-shadow 0.15s ease; 8289 opacity: ${e=>e.$visible?1:0}; 8290 pointer-events: ${e=>e.$visible?"auto":"none"}; 8291 animation: ${e=>e.$side==="right"?HJe:qJe} 1.8s ease-in-out infinite; 8292 8293 &:hover { 8294 box-shadow: 0 2px 12px rgba(0, 0, 0, 0.16); 8295 color: ${O}; 8296 } 8297`;function Xce({children:e,className:n}){const i=l.useRef(null),[r,o]=l.useState(!1),[s,a]=l.useState(!1),c=l.useCallback(()=>{const m=i.current;m&&(o(m.scrollLeft>2),a(m.scrollLeft+m.clientWidth<m.scrollWidth-2))},[]);l.useEffect(()=>{const m=i.current;if(!m)return;c(),m.addEventListener("scroll",c,{passive:!0});const h=new ResizeObserver(c);return h.observe(m),()=>{m.removeEventListener("scroll",c),h.disconnect()}},[c]);const u=l.useCallback(m=>{const h=i.current;h&&h.scrollBy({left:m==="right"?260:-260,behavior:"smooth"})},[]);return t.jsxs(WJe,{className:n,children:[t.jsx(tK,{$side:"left",$visible:r}),t.jsx(tK,{$side:"right",$visible:s}),t.jsx(nK,{$side:"left",$visible:r,onClick:()=>u("left"),"aria-label":"Scroll left",type:"button",tabIndex:-1,children:t.jsx(Bd,{size:16})}),t.jsx(nK,{$side:"right",$visible:s,onClick:()=>u("right"),"aria-label":"Scroll right",type:"button",tabIndex:-1,children:t.jsx(Gi,{size:16})}),t.jsx(UJe,{ref:i,children:e})]})}function GJe(){return l.useEffect(()=>{if(!window.opener){console.error("GoogleCallback: Not in a popup window"),window.location.href="/signin";return}const e=window.location.hash.substring(1),n=new URLSearchParams(e),i=n.get("id_token"),r=n.get("error"),o=n.get("state"),s=sessionStorage.getItem("X_google_oauth_state");
8297if(o&&s&&o!==s){window.opener?.postMessage({type:"GOOGLE_OAUTH_ERROR",error:"Invalid state parameter"},window.location.origin),setTimeout(()=>window.close(),100);return}if(r){window.opener?.postMessage({type:"GOOGLE_OAUTH_ERROR",error:r},window.location.origin),setTimeout(()=>window.close(),100);return}i?(sessionStorage.setItem("X_google_oauth_success","true"),window.opener?.postMessage({type:"GOOGLE_OAUTH_SUCCESS",id_token:i},window.location.origin),setTimeout(()=>window.close(),100)):(window.opener?.postMessage({type:"GOOGLE_OAUTH_ERROR",error:"No ID token received"},window.location.origin),setTimeout(()=>window.close(),100))},[]),t.jsx(IP,{message:"Completing sign-in..."})}function VJe(){const e=zn(),{login:n}=yn(),[i]=yr(),r=l.useMemo(()=>{const a=i.get("next")||"/";return a.startsWith("/")?a:"/"},[i]),[o,s]=l.useState(null);return l.useEffect(()=>{(async()=>{try{const c=Td(),u=i.get("code")||"";if(u){const j=await fetch(`${c}/api/v1/auth/partner_exchange`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({code:u})}),v=await j.json().catch(()=>({}));if(!j.ok)throw new Error(v?.error||"Failed to sign in");if(!v?.access_token||!v?.refresh_token||!v?.user)throw new Error("Invalid response from server");b_(v.access_token,v.refresh_token),n(v.access_token,v.refresh_token,v.user),window.history.replaceState(null,"",window.location.pathname),e(r,{replace:!0});return}const m=window.location.hash.startsWith("#")?window.location.hash.slice(1):window.location.hash,h=new URLSearchParams(m),g=h.get("access_token")||"",x=h.get("refresh_token")||"";if(!g||!x)throw new Error("This login link is invalid or expired");b_(g,x);const y=await fetch(`${c}/api/v1/users/me`,{method:"GET",headers:{Accept:"application/json",Authorization:`Bearer ${g}`}}),w=await y.json().catch(()=>({}));if(!y.ok)throw new Error(w?.error||"Failed to sign in");if(!w?.user)throw new Error("Invalid response from server");n(g,x,w.user),window.history.replaceState(null,"",window.location.pathname),e(r,{replace:!0})}catch(c){const u=c instanceof Error?c.message:"Failed to sign in";s(`${u}. Please return to your vendor to sign in.`),Im(),window.history.replaceState(null,"",window.location.pathname)}})()},[]),t.jsx(IP,{message:o||"Signing you inâ¦"})}function KJe(){const[e,n]=l.useState(!1),[i,r]=l.useState(!1),[o,s]=l.useState(""),[a,c]=l.useState({}),u=()=>{const g={};return o.trim()?Fb(o)||(g.email="Please enter a valid email address"):g.email="Email is required",c(g),Object.keys(g).length===0},m=()=>o.trim()!==""&&Fb(o),h=async g=>{if(g.preventDefault(),c({}),r(!1),!!u()){n(!0);try{const x=await ue("/api/v1/auth/forgot_password",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:o.trim().toLowerCase()})});if(x.ok)r(!0),s("");else{const y=await x.json();y.error?c({general:y.error}):c({general:"An error occurred. Please try again."})}}catch{c({general:"Network error. Please check your connection and try again."})}finally{n(!1)}}};return t.jsxs(Bm,{children:[t.jsx(xa,{}),t.jsx(Fm,{children:t.jsx(Wm,{children:t.jsxs(Um,{children:[t.jsxs(Hm,{children:[t.jsx(kf,{children:"Forgot Password"}),t.jsx($f,{children:"Enter your email address and we'll send you a code to reset your password"})]}),t.jsxs(Z_,{onSubmit:h,children:[a.general&&t.jsx(Mm,{children:a.general}),i&&t.jsx(eie,{children:"If an account exists with that email, a password reset code has been sent."}),t.jsxs(Cy,{children:[t.jsx(Xt,{id:"email",type:"email",placeholder:"Enter your email",value:o,onChange:g=>{s(g.target.value),a.email&&c({...a,email:void 0}),r(!1)},variant:a.email?"error":"default"}),a.email&&t.jsx(_p,{children:a.email})]}),t.jsx(he,{type:"submit",fullWidth:!0,size:"md",disabled:!m()||e,children:e?"Sending...":"Send Reset Code"}),t.jsxs(zbe,{children:["Remember your password?"," ",t.jsx(Dn,{to:"/signin",children:"Sign in"})]})]})]})})})]})}function YJe(){const e=zn(),[n]=yr(),i=n.get("code"),[r,o]=l.useState(!1),[s,a]=l.useState(!0),[c,u]=l.useState(null),[m,h]=l.useState(""),[g,x]=l.useState(""),[y,w]=l.useState({}),j=()=>{const $={};return m?v_(m)||($.password=q5):$.password="Password is required",g?m!==g&&($.confirmPassword="Passwords do not match"):$.confirmPassword="Please confirm your password",w($),Object.keys($).length===0},v=()=>m!==""&&v_(m)&&g!==""&&m===g;l.useEffect(()=>{(async()=>
8297{if(!i){w({general:"Reset code is required"}),a(!1);return}try{const k=await ue(`/api/v1/auth/reset_password_info?code=${i}`,{method:"GET",headers:{"Content-Type":"application/json"}});if(k.ok){const P=await k.json();P.valid&&P.email?u(P.email):w({general:"Invalid reset code"})}else{const P=await k.json();w({general:P.error||"Invalid or expired reset code"})}}catch{w({general:"Network error. Please check your connection and try again."})}finally{a(!1)}})()},[i]);const _=async $=>{if($.preventDefault(),!i){w({general:"Reset code is required"});return}if(w({}),!!j()){o(!0);try{const k=await ue("/api/v1/auth/reset_password",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:i,password:m,password_confirmation:g})});if(k.ok)e("/signin",{replace:!0,state:{message:"Password has been reset successfully. Please sign in with your new password."}});else{const P=await k.json();if(P.errors&&Array.isArray(P.errors)){const S={};P.errors.forEach(I=>{const A=I.toLowerCase();A.includes("password")?A.includes("confirmation")||A.includes("match")?S.confirmPassword=I:S.password=I:S.general=I}),w(S)}else P.error?w({general:P.error}):w({general:"An error occurred. Please try again."})}}catch{w({general:"Network error. Please check your connection and try again."})}finally{o(!1)}}};return s?t.jsxs(Bm,{children:[t.jsx(xa,{}),t.jsx(Fm,{children:t.jsx(Wm,{children:t.jsx(Um,{children:t.jsxs(Hm,{children:[t.jsx(kf,{children:"Reset Password"}),t.jsx($f,{children:"Verifying reset code..."})]})})})})]}):t.jsxs(Bm,{children:[t.jsx(xa,{}),t.jsx(Fm,{children:t.jsx(Wm,{children:t.jsxs(Um,{children:[t.jsxs(Hm,{children:[t.jsx(kf,{children:"Reset Password"}),t.jsx($f,{children:c?`Enter your new password for ${c}`:"Enter your new password"})]}),t.jsxs(Z_,{onSubmit:_,children:[y.general&&t.jsx(Mm,{children:y.general}),t.jsxs(Cy,{children:[t.jsx(Em,{id:"password",placeholder:"Enter your new password",value:m,onChange:$=>{h($.target.value),y.password&&w({...y,password:void 0})},variant:y.password?"error":"default"}),t.jsx(lM,{password:m}),y.password&&t.jsx(_p,{children:y.password})]}),t.jsxs(Cy,{children:[t.jsx(Em,{id:"confirmPassword",placeholder:"Confirm your new password",value:g,onChange:$=>{x($.target.value),y.confirmPassword&&w({...y,confirmPassword:void 0})},variant:y.confirmPassword?"error":"default"}),y.confirmPassword&&t.jsx(_p,{children:y.confirmPassword})]}),t.jsx(he,{type:"submit",fullWidth:!0,size:"md",disabled:!v()||r||!i,children:r?"Resetting Password...":"Reset Password"})]})]})})})]})}const XJe=p.label.withConfig({displayName:"EmailVerificationstyle__Label",componentId:"sc-dbxqk6-0"})` 8298 font-size: 0.875rem; 8299 font-weight: 500; 8300 color: ${O}; 8301`,QJe=p.div.withConfig({displayName:"EmailVerificationstyle__CodeInputContainer",componentId:"sc-dbxqk6-1"})` 8302 display: flex; 8303 gap: 0.75rem; 8304 justify-content: center; 8305 margin-top: 0.75rem; 8306`,ZJe=p.input.withConfig({displayName:"EmailVerificationstyle__CodeInput",componentId:"sc-dbxqk6-2"})` 8307 width: 3.5rem; 8308 height: 3.5rem; 8309 text-align: center; 8310 font-size: 1.5rem; 8311 font-weight: 600; 8312 border: 1px solid ${Rt}; 8313 border-radius: 0.375rem; 8314 transition: border-color 0.2s, box-shadow 0.2s; 8315 background-color: ${Z}; 8316 color: ${O}; 8317 font-family: 'Manrope', sans-serif; 8318 8319 &:focus { 8320 outline: none; 8321 border-color: ${ot}; 8322 box-shadow: 0 0 0 3px ${En}; 8323 } 8324 8325 &::placeholder { 8326 color: ${Pe}; 8327 } 8328 8329 &:disabled { 8330 background-color: ${$e}; 8331 cursor: not-allowed; 8332 opacity: 0.6; 8333 } 8334`,JJe=p.p.withConfig({displayName:"EmailVerificationstyle__ResendLink",componentId:"sc-dbxqk6-3"})` 8335 text-align: center; 8336 font-size: 0.875rem; 8337 color: ${Pe}; 8338 margin-top: 0.5rem; 8339 8340 button { 8341 background: none; 8342 border: none; 8343 color: ${ot}; 8344 text-decoration: none; 8345 font-weight: 500; 8346 cursor: pointer; 8347 padding: 0; 8348 transition: text-decoration 0.2s; 8349 font-family: 'Manrope', sans-serif; 8350 8351 &:hover { 8352 text-decoration: underline; 8353 } 8354 } 8355`,eet=60;function Qce(){const e=zn(),{user:n,setUser:i}=yn(),[r,o]=l.useState(["","","","","",""]),[s,a]=l.useState(!1),[c,u]=l.useState(!1),[m,h]=l.useState(null),[g,x]=l.useState(null),[y,w]=l.useState(0),j=l.useRef(null),v=(I,A)=>{if(A&&!/^\d$/.test(A))return;const E=[...r];E[I]=A,o(E),A&&I<5&&document.getElementById(`code-${I+1}`)?.focus()},_=(I,A)=>{A.key==="Backspace"&&!r[I]&&I>0&&document.getElementById(`code-${I-1}`)?.focus()},$=I=>{I.preventDefault();const E=I.clipboardData.getData("text").trim().replace(/\D/g,"").slice(0,6).split(""),B=[...r];
8355E.forEach((R,F)=>{F<6&&(B[F]=R)}),o(B);const T=Math.min(E.length-1,5);document.getElementById(`code-${T}`)?.focus()},k=async I=>{I.preventDefault();const A=r.join("");if(!(A.length!==6||!n)){a(!0),h(null),x(null);try{const E=await ue("/api/v1/users/verify_email",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:A})});if(E.ok){const B=await E.json();x("Email verified successfully!"),B.user&&(i(B.user),e("/onboarding",{replace:!0}))}else{const B=await E.json();h(B.error||"Invalid verification code"),o(["","","","","",""]),document.getElementById("code-0")?.focus()}}catch{h("Network error. Please try again.")}finally{a(!1)}}},P=async()=>{if(!(!n||y>0)){u(!0),h(null),x(null);try{const I=await ue("/api/v1/users/resend_verification",{method:"POST",headers:{"Content-Type":"application/json"}});if(I.ok)x("Verification email sent! Please check your inbox."),o(["","","","","",""]),w(eet),document.getElementById("code-0")?.focus();else{const A=await I.json();h(A.error||"Failed to resend verification email")}}catch{h("Network error. Please try again.")}finally{u(!1)}}};l.useEffect(()=>(y>0&&(j.current=setInterval(()=>{w(I=>I<=1?(j.current&&(clearInterval(j.current),j.current=null),0):I-1)},1e3)),()=>{j.current&&(clearInterval(j.current),j.current=null)}),[y]);const S=r.every(I=>I!=="");return t.jsxs(Bm,{children:[t.jsx(xa,{}),t.jsx(Fm,{children:t.jsx(Wm,{children:t.jsxs(Um,{children:[t.jsxs(Hm,{children:[t.jsx(kf,{children:"Verify Your Email"}),t.jsx($f,{children:"We've sent a verification code to your email address. Please enter the code below."})]}),t.jsxs(Z_,{onSubmit:k,children:[m&&t.jsx(Mm,{children:m}),g&&t.jsx(eie,{children:g}),t.jsxs(Cy,{children:[t.jsx(XJe,{htmlFor:"code-0",children:"Verification Code"}),t.jsx(QJe,{children:r.map((I,A)=>t.jsx(ZJe,{id:`code-${A}`,type:"text",inputMode:"numeric",maxLength:1,value:I,onChange:E=>{v(A,E.target.value),h(null)},onKeyDown:E=>_(A,E),onPaste:A===0?$:void 0,autoFocus:A===0,disabled:s},A))}),t.jsxs(JJe,{children:["Didn't receive the code?"," ",t.jsx("button",{type:"button",onClick:P,disabled:c||y>0,children:c?"Sending...":y>0?`Resend in ${y}s`:"Resend"})]})]}),t.jsx(he,{type:"submit",fullWidth:!0,size:"md",disabled:!S||s,children:s?"Verifying...":"Verify Email"})]})]})})})]})}const Zce=[{step:1,type:"user-type"},{step:2,type:"workspace"},{step:3,type:"website"},{step:4,type:"location"},{step:5,type:"topic_analysis"},{step:6,type:"topics"},{step:7,type:"prompt_analysis"},{step:8,type:"prompts"},{step:9,type:"competitor_analysis"},{step:10,type:"competitors"},{step:12,type:"report"}];function tet(e){return e?e===11?"report":Zce.find(i=>i.step===e)?.type||null:null}function HO(e){return Zce.find(i=>i.type===e)?.step||null}function d_(e){const n=tet(e);return n?`/onboarding?type=${n}`:null}function net(e,n){if(!n)return!1;const i=HO(e);return i?n>=5?i===n:i<=n:!1}const iK=ot,rK=Ft,oK=Kl,N6=En,iet=At,ret=Z,qO=O,Jce=z,KI=Cf,sK=Rt,Wf=p.div.withConfig({displayName:"style__Container",componentId:"sc-1d7cz7d-0"})` 8356 min-height: 100vh; 8357 display: flex; 8358 flex-direction: column; 8359 8360 @media (min-width: 1024px) { 8361 flex-direction: row; 8362 } 8363`,uh=p.div.withConfig({displayName:"style__FormSection",componentId:"sc-1d7cz7d-1"})` 8364 width: 100%; 8365 flex: 1; 8366 display: flex; 8367 align-items: center; 8368 justify-content: center; 8369 padding: 2rem 1.5rem; 8370 background-color: ${iet}; 8371 position: relative; 8372 order: 2; /* Appears second on mobile */ 8373 8374 @media (min-width: 1024px) { 8375 width: 50%; 8376 flex: 0 0 50%; 8377 padding: 2rem; 8378 order: 1; /* Appears first on desktop */ 8379 } 8380 8381 /* Dashed Top Full Width Fade Grid */ 8382 &::before { 8383 content: ''; 8384 position: absolute; 8385 inset: 0; 8386 z-index: 0; 8387 background-image: 8388 linear-gradient(to right, ${KI} 1px, ${hn} 1px), 8389 linear-gradient(to bottom, ${KI} 1px, ${hn} 1px); 8390 background-size: 20px 20px; 8391 background-position: 0 0, 0 0; 8392 mask-image: 8393 repeating-linear-gradient( 8394 to right, 8395 ${mn} 0px, 8396 ${mn} 3px, 8397 ${hn} 3px, 8398 ${hn} 8px 8399 ), 8400 repeating-linear-gradient( 8401 to bottom, 8402 ${mn} 0px, 8403 ${mn} 3px, 8404 ${hn} 3px, 8405 ${hn} 8px 8406 ), 8407 linear-gradient(to bottom, ${mn} 0%, ${mn} 40%, ${hn} 70%); 8408 -webkit-mask-image: 8409 repeating-linear-gradient( 8410 to right, 8411 ${mn} 0px, 8412 ${mn} 3px, 8413 ${hn} 3px, 8414 ${hn} 8px 8415 ), 8416 repeating-linear-gradient( 8417 to bottom, 8418 ${mn} 0px, 8419 ${mn} 3px, 8420 ${hn} 3px, 8421 ${hn} 8px 8422 ), 8423 linear-gradient(to bottom, ${mn} 0%, ${mn} 40%, ${hn} 70%); 8424 mask-composite: intersect; 8425 -webkit-mask-composite: source-in; 8426 pointer-events: none; 8427 } 8428 8429 /* Subtle divider line on the right edge (desktop only) */ 8430 &::after { 8431 content: ''; 8432 position: absolute; 8433 right: 0; 8434 top: 0; 8435 bottom: 0; 8436 width: 1px; 8437 background: linear-gradient( 8438 to bottom, 8439 transparent 0%, 8440 ${sK} 10%, 8441 ${sK} 90%, 8442 transparent 100% 8443 ); 8444 z-index: 1; 8445 pointer-events: none; 8446 display: none; 8447 8448 @media (min-width: 1024px) { 8449 display: block; 8450 } 8451 } 8452`,bl=p.div.withConfig({displayName:"style__FormContainer",componentId:"sc-1d7cz7d-2"})` 8453 width: 100%; 8454 max-width: 32rem; 8455 position: relative; 8456 z-index: 1; 8457 8458 @media (max-width: 1023px) { 8459 max-width: 100%; 8460 padding: 0; 8461 } 8462`,vl=p.div.withConfig({displayName:"style__Card",componentId:"sc-1d7cz7d-3"})` 8463 border: none; 8464 box-shadow: none; 8465`,Yc=p.div.withConfig({displayName:"style__CardHeader",componentId:"sc-1d7cz7d-4"})` 8466 display: flex; 8467 flex-direction: column; 8468 gap: 0.5rem; 8469 margin-bottom: 2rem; 8470`,Wd=p.h1.withConfig({displayName:"style__CardTitle",componentId:"sc-1d7cz7d-5"})` 8471 font-size: 1.875rem; 8472 font-weight: 700; 8473 line-height: 2.25rem; 8474 color: ${qO};
8475`,Ud=p.p.withConfig({displayName:"style__CardDescription",componentId:"sc-1d7cz7d-6"})` 8476 color: ${Jce}; 8477 font-size: 0.875rem; 8478 line-height: 1.5rem; 8479`,Ru=p.form.withConfig({displayName:"style__Form",componentId:"sc-1d7cz7d-7"})` 8480 display: flex; 8481 flex-direction: column; 8482 gap: 1.5rem; 8483`,Wo=p.div.withConfig({displayName:"style__FormGroup",componentId:"sc-1d7cz7d-8"})` 8484 display: flex; 8485 flex-direction: column; 8486 gap: 0.5rem; 8487`,js=p.label.withConfig({displayName:"style__Label",componentId:"sc-1d7cz7d-9"})` 8488 font-size: 0.875rem; 8489 font-weight: 500; 8490 color: ${qO}; 8491`,_s=p.p.withConfig({displayName:"style__HelperText",componentId:"sc-1d7cz7d-10"})` 8492 font-size: 0.75rem; 8493 color: ${Jce}; 8494 margin-top: 0.25rem; 8495`,Uf=p.div.withConfig({displayName:"style__ButtonContainer",componentId:"sc-1d7cz7d-11"})` 8496 display: flex; 8497 gap: 1rem; 8498 justify-content: space-between; 8499`;p.button.withConfig({displayName:"style__BackButton",componentId:"sc-1d7cz7d-12"})` 8500 background-color: ${Z} !important; 8501 color: ${iK} !important; 8502 border: 1px solid ${iK} !important; 8503 border-radius: 0.375rem; 8504 padding: 0.75rem 1.5rem; 8505 font-size: 0.875rem; 8506 font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 8507 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 8508 sans-serif; 8509 font-weight: 500; 8510 line-height: 1.5; 8511 cursor: pointer; 8512 display: inline-flex; 8513 align-items: center; 8514 justify-content: center; 8515 gap: 0.5rem; 8516 transition: all 0.2s; 8517 white-space: nowrap; 8518 box-sizing: border-box; 8519 height: 3.125rem; 8520 8521 &:hover:not(:disabled) { 8522 background-color: ${N6} !important; 8523 border-color: ${rK} !important; 8524 color: ${rK} !important; 8525 } 8526 8527 &:active:not(:disabled) { 8528 background-color: ${N6} !important; 8529 border-color: ${oK} !important; 8530 color: ${oK} !important; 8531 } 8532 8533 &:disabled { 8534 opacity: 0.6; 8535 cursor: not-allowed; 8536 } 8537 8538 &:focus { 8539 outline: none; 8540 box-shadow: 0 0 0 3px ${N6}; 8541 } 8542`;const Xs=p.div.withConfig({displayName:"style__ErrorText",componentId:"sc-1d7cz7d-13"})` 8543 color: ${Ut}; 8544 font-size: 0.875rem; 8545 text-align: center; 8546 padding: 0.75rem; 8547 background-color: ${kn}; 8548 border: 1px solid ${Er}; 8549 border-radius: 0.375rem; 8550 margin-bottom: 1rem; 8551`;p.div.withConfig({displayName:"style__GradientSection",componentId:"sc-1d7cz7d-14"})` 8552 display: flex; 8553 width: 100%; 8554 flex: 0 0 auto; 8555 min-height: 40vh; 8556 position: relative; 8557 align-items: center; 8558 justify-content: center; 8559 overflow: hidden; 8560 background-color: ${ret}; 8561 order: 1; /* Appears first on mobile */ 8562 8563 @media (min-width: 1024px) { 8564 width: 50%; 8565 flex: 0 0 50%; 8566 min-height: 100vh; 8567 order: 2; /* Appears second on desktop */ 8568 } 8569 8570 /* Dashed Bottom Full Width Fade Grid */ 8571 &::before { 8572 content: ''; 8573 position: absolute; 8574 inset: 0; 8575 z-index: 0; 8576 background-image: 8577 linear-gradient(to right, ${KI} 1px, ${hn} 1px), 8578 linear-gradient(to bottom, ${KI} 1px, ${hn} 1px); 8579 background-size: 20px 20px; 8580 background-position: 0 0, 0 0; 8581 mask-image: 8582 repeating-linear-gradient( 8583 to right, 8584 ${mn} 0px, 8585 ${mn} 3px, 8586 ${hn} 3px, 8587 ${hn} 8px 8588 ), 8589 repeating-linear-gradient( 8590 to bottom, 8591 ${mn} 0px, 8592 ${mn} 3px, 8593 ${hn} 3px, 8594 ${hn} 8px 8595 ), 8596 linear-gradient(to top, ${mn} 0%, ${mn} 40%, ${hn} 70%); 8597 -webkit-mask-image: 8598 repeating-linear-gradient( 8599 to right, 8600 ${mn} 0px, 8601 ${mn} 3px, 8602 ${hn} 3px, 8603 ${hn} 8px 8604 ), 8605 repeating-linear-gradient( 8606 to bottom, 8607 ${mn} 0px, 8608 ${mn} 3px, 8609 ${hn} 3px, 8610 ${hn} 8px 8611 ), 8612 linear-gradient(to top, ${mn} 0%, ${mn} 40%, ${hn} 70%); 8613 mask-composite: intersect; 8614 -webkit-mask-composite: source-in; 8615 pointer-events: none; 8616 } 8617`;p.div.withConfig({displayName:"style__OrbContainer",componentId:"sc-1d7cz7d-15"})` 8618 position: absolute; 8619 top: 0; 8620 right: 0; 8621 bottom: 0; 8622 left: 0; 8623 width: 100%; 8624 height: 100%; 8625 z-index: 1; 8626 min-height: 100%; 8627 8628 @media (max-width: 1023px) { 8629 min-height: 40vh; 8630 } 8631`;p.div.withConfig({displayName:"style__ContentWrapper",componentId:"sc-1d7cz7d-16"})` 8632 position: relative; 8633 z-index: 10; 8634 display: flex; 8635 flex-direction: column; 8636 align-items: center; 8637 gap: 1rem; 8638 text-align: center; 8639 padding: 2rem 1.5rem; 8640 8641 @media (min-width: 1024px) { 8642 gap: 1.5rem; 8643 padding-left: 1.5rem; 8644 padding-right: 1.5rem; 8645 } 8646`;p.h1.withConfig({displayName:"style__Heading",componentId:"sc-1d7cz7d-17"})` 8647 text-transform: capitalize; 8648 font-size: 1.5rem; 8649 font-weight: 600; 8650 letter-spacing: -0.025em; 8651 color: ${qO}; 8652 margin: 0; 8653 8654 @media (min-width: 768px) { 8655 font-size: 1.875rem; 8656 } 8657 8658 @media (min-width: 1024px) { 8659 font-size: 3rem; 8660 } 8661`;const oet=p.div.withConfig({displayName:"OnboardingFailedstyle__ErrorIcon",componentId:"sc-19o7zsx-0"})` 8662 width: 4rem; 8663 height: 4rem; 8664 border-radius: 50%; 8665 background-color: ${U8}; 8666 display: flex; 8667 align-items: center; 8668 justify-content: center; 8669 margin: 0 auto 1.5rem; 8670 color: ${Ut}; 8671`,set=p.div.withConfig({displayName:"OnboardingFailedstyle__ErrorMessage",componentId:"sc-19o7zsx-1"})` 8672 text-align: center; 8673 margin-bottom: 2rem; 8674`,aet=p.h2.withConfig({displayName:"OnboardingFailedstyle__ErrorTitle",componentId:"sc-19o7zsx-2"})` 8675 font-size: 1.5rem; 8676 font-weight: 600; 8677 color: ${O}; 8678 margin: 0 0 0.5rem 0; 8679`,cet=p.p.withConfig({displayName:"OnboardingFailedstyle__ErrorDescription",componentId:"sc-19o7zsx-3"})` 8680 font-size: 0.875rem; 8681 color: ${z}; 8682 margin: 0; 8683 line-height: 1.6; 8684`,det=p.div.withConfig({displayName:"OnboardingFailedstyle__ButtonContainer",componentId:"sc-19o7zsx-4"})` 8685 display: flex; 8686 justify-content: center; 8687 gap: 0.75rem; 8688 width: 100%; 8689 margin-top: 1.5rem; 8690`,uet=p(uh).withConfig({displayName:"OnboardingFailedstyle__FullWidthSection",componentId:"sc-19o7zsx-
86905"})` 8691 width: 100%; 8692 min-height: 100vh; 8693 8694 @media (min-width: 1024px) { 8695 width: 100%; 8696 flex: 1; 8697 } 8698`;function ede(){const e=zn(),{logout:n,setUser:i}=yn(),[r,o]=l.useState(!1),s=async()=>{o(!0);try{const c=await ue("/api/v1/onboarding/restart",{method:"POST"});if(!c.ok)return;const u=await c.json();u?.user&&i(u.user);const m=d_(1)||"/onboarding?type=user-type";e(m,{replace:!0})}finally{o(!1)}},a=async()=>{await n()};return t.jsx(uet,{children:t.jsx(bl,{children:t.jsx(vl,{children:t.jsxs(Yc,{children:[t.jsx(oet,{children:t.jsx(Sf,{size:32})}),t.jsxs(set,{children:[t.jsx(aet,{children:"Onboarding Failed"}),t.jsx(cet,{children:"We encountered an error while processing your onboarding. Please try restarting onboarding or logout and try again."})]}),t.jsxs(det,{children:[t.jsx(he,{onClick:s,disabled:r,children:r?"Restarting...":"Restart onboarding"}),t.jsx(he,{variant:"outline",onClick:a,disabled:r,children:"Logout"})]})]})})})})}const pet=p.div.withConfig({displayName:"ErrorPagestyle__Badge",componentId:"sc-4x2p43-0"})` 8699 display: inline-flex; 8700 align-items: center; 8701 justify-content: center; 8702 width: 56px; 8703 height: 56px; 8704 border-radius: 14px; 8705 background: ${Z}; 8706 border: 1px solid ${V}; 8707 box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06); 8708 margin: 0 auto 1rem; 8709 color: ${O}; 8710`,met=p.div.withConfig({displayName:"ErrorPagestyle__Code",componentId:"sc-4x2p43-1"})` 8711 font-size: 0.75rem; 8712 font-weight: 650; 8713 letter-spacing: 0.08em; 8714 text-transform: uppercase; 8715 color: ${ot}; 8716`,het=p.h1.withConfig({displayName:"ErrorPagestyle__Title",componentId:"sc-4x2p43-2"})` 8717 margin: 0.25rem 0 0; 8718 font-size: 1.875rem; 8719 font-weight: 750; 8720 line-height: 2.25rem; 8721 color: ${O}; 8722`,fet=p.p.withConfig({displayName:"ErrorPagestyle__Description",componentId:"sc-4x2p43-3"})` 8723 margin: 0.75rem 0 0; 8724 font-size: 0.875rem; 8725 line-height: 1.5rem; 8726 color: ${z}; 8727`,get=p.div.withConfig({displayName:"ErrorPagestyle__ButtonRow",componentId:"sc-4x2p43-4"})` 8728 display: grid; 8729 grid-template-columns: 1fr; 8730 gap: 0.75rem; 8731 margin-top: 1.5rem; 8732 8733 @media (min-width: 480px) { 8734 grid-template-columns: 1fr 1fr; 8735 } 8736`;function tde({code:e,title:n,description:i,icon:r,actions:o}){return t.jsxs(Bm,{children:[t.jsx(xa,{}),t.jsx(Fm,{children:t.jsx(Wm,{children:t.jsx(Um,{children:t.jsxs(Hm,{children:[t.jsx(pet,{"aria-hidden":"true",children:r}),t.jsx(met,{children:e}),t.jsx(het,{children:n}),t.jsx(fet,{children:i}),t.jsx(get,{children:o})]})})})})]})}function yet(){const e=zn(),n=()=>{e(-1)},i=()=>{e("/signin")};return t.jsx(tde,{code:"404",title:"Page not found",description:"The page youâre looking for doesnât exist or may have been moved.",icon:t.jsx(jxe,{size:22}),actions:t.jsxs(t.Fragment,{children:[t.jsx(he,{variant:"outline",onClick:n,leftIcon:t.jsx(xy,{size:18}),children:"Back"}),t.jsx(he,{onClick:i,leftIcon:t.jsx(Lne,{size:18}),children:"Sign in"})]})})}function xet(){const e=zn(),i=vo().state?.from;return t.jsx(tde,{code:"403",title:"Access denied",description:t.jsxs(t.Fragment,{children:["You donât have permission to view this page.",i?t.jsxs(t.Fragment,{children:[t.jsx("br",{}),"(Tried to access ",t.jsx("b",{children:i}),".)"]}):null]}),icon:t.jsx(y5,{size:22}),actions:t.jsxs(t.Fragment,{children:[t.jsx(he,{variant:"outline",onClick:()=>e(-1),leftIcon:t.jsx(xy,{size:18}),children:"Back"}),t.jsx(he,{onClick:()=>e("/"),leftIcon:t.jsx(n0e,{size:18}),children:"Home"})]})})}const bet=p.div.withConfig({displayName:"CancelOnboardingAction__Wrapper",componentId:"sc-v8h5kl-0"})` 8737 display: inline-flex; 8738 align-items: center; 8739 gap: 0.5rem; 8740`,vet=p.div.withConfig({displayName:"CancelOnboardingAction__Hint",componentId:"sc-v8h5kl-1"})` 8741 font-size: 0.75rem; 8742 color: ${z}; 8743 white-space: nowrap; 8744`;function ph({disabled:e=!1,showHint:n=!1,onError:i}){const{user:r,setUser:o}=yn(),s=zn(),[a,c]=l.useState(!1);return r?.can_cancel_onboarding?t.jsxs(bet,{children:[n?t.jsx(vet,{children:"Not now?"}):null,t.jsx(he,{type:"button",variant:"outline",size:"sm",disabled:e||a,onClick:async()=>{if(!(e||a)){c(!0);try{const u=await ue("/api/v1/onboarding/cancel",{method:"POST"}),m=await u.json().catch(()=>({}));if(!u.ok){const h=m?.error||"Failed to cancel onboarding";i?.(h);return}m?.user&&o(m.user),s("/",{replace:!0})}catch{i?.("Network error. Please try again.")}finally{c(!1)}}},children:a?"Cancelling...":"Cancel onboarding"})]}):null}const wet=p.div.withConfig({displayName:"UserTypeStep__OptionContainer",componentId:"sc-h1kn2p-0"})` 8745 display: flex; 8746 gap: 1rem; 8747 margin-bottom: 2rem; 8748 8749 @media (max-width: 640px) { 8750 flex-direction: column; 8751 } 8752`,aK=p.button.withConfig({displayName:"UserTypeStep__OptionCard",componentId:"sc-h1kn2p-1"})` 8753 flex: 1; 8754 padding: 2rem; 8755 border: 1px solid ${e=>e.$selected?ot:Rt}; 8756 border-radius: 1rem; 8757 background-color: ${Z} !important; 8758 cursor: pointer; 8759 transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease, background-color 0.18s ease; 8760 display: flex; 8761 flex-direction: column; 8762 align-items: center; 8763 gap: 1rem; 8764 box-sizing: border-box; 8765 box-shadow: ${e=>e.$selected?"0 6px 18px rgba(17, 24, 39, 0.08)":"0 1px 2px rgba(0, 0, 0, 0.06)"}; 8766 8767 &:hover:not(:disabled) { 8768 border-color: ${ot} !important; 8769 background-color: ${Z} !important; 8770 box-shadow: 0 8px 22px rgba(17, 24, 39, 0.10); 8771 transform: translateY(-1px); 8772 } 8773 8774 &:focus-visible { 8775 outline: none; 8776 box-shadow: 0 0 0 3px ${En}, 0 8px 22px rgba(17, 24, 39, 0.10); 8777 } 8778`,lK=p.div.withConfig({displayName:"UserTypeStep__OptionIcon",componentId:"sc-h1kn2p-2"})` 8779 width: 4.25rem; 8780 height: 4.25rem; 8781 border-radius: 1.25rem; 8782 background: ${e=>e.$selected?ot:Z}; 8783 border: 1px solid ${e=>e.$selected?"transparent":Rt}; 8784 display: flex; 8785 align-items: center; 8786 justify-content: center; 8787 color: ${e=>e.$selected?Z:O}; 8788 transition: transform 0.18s ease, background-color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease; 8789 box-shadow: ${e=>e.$selected?"0 6px 14px rgba(79, 70, 229, 0.18)":"0 1px 2px rgba(0, 0, 0, 0.05)"}; 8790 8791 svg { 8792 color: ${e=>e.$selected?Z:O}; 8793 } 8794`,cK=p.div.withConfig({displayName:"UserTypeStep__OptionLabel",componentId:"sc-h1kn2p-3"})` 8795 font-size: 1.0625rem; 8796 font-weight: 650; 8797 color: ${O}; 8798`,dK=p.div.withConfig({displayName:"UserTypeStep__OptionDescription",componentId:"sc-h1kn2p-4"})` 8799 font-size: 0.875rem; 8800 color: ${z}; 8801 text-align: center; 8802 max-width: 18rem; 8803`;function jet(){const e=zn(),{setUser:n}=yn(),[i,r]=l.useState(null),[o,s]=l.useState(!1),[a,c]=l.useState(null);l.useEffect(()=>{let m=!1;return(async()=>{try{const g=await ue("/api/v1/onboarding/step_info?step_number=1",{method:"GET"});if(!g.ok)return;const y=(await g.json())?.organization_type;!m&&(y==="business"||y==="agency")&&r(y)}catch{}})(),()=>{m=!0}},[]);const u=async()=>
8803{if(!(!i||o)){s(!0),c(null);try{const h=await ue("/api/v1/onboarding/step",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({step_number:1,organization:{organization_type:i}})});if(!h.ok){const x=await h.json();c(x.errors?.[0]||x.error||"Failed to create organization"),s(!1);return}const g=await h.json();g?.user&&n(g.user),e("/onboarding?type=workspace",{replace:!0})}catch{c("Network error. Please try again."),s(!1)}}};return t.jsxs(Wf,{children:[t.jsx(xa,{size:"small",topLeft:t.jsx(ph,{disabled:o,onError:m=>c(m)})}),t.jsx(uh,{children:t.jsx(bl,{children:t.jsxs(vl,{children:[t.jsx(Vc,{currentStep:1,totalSteps:4}),t.jsxs(Yc,{children:[t.jsx(Wd,{children:"Are you a business or an agency?"}),t.jsx(Ud,{children:"Choose the option that best describes you, in order to personalize your experience."})]}),a&&t.jsx(Xs,{children:a}),t.jsxs(wet,{children:[t.jsxs(aK,{$selected:i==="business",onClick:()=>r("business"),type:"button","data-option-card":!0,children:[t.jsx(lK,{$selected:i==="business",children:t.jsx(by,{size:24})}),t.jsx(cK,{children:"Business"}),t.jsx(dK,{children:"Iâm working on my own business"})]}),t.jsxs(aK,{$selected:i==="agency",onClick:()=>r("agency"),type:"button","data-option-card":!0,children:[t.jsx(lK,{$selected:i==="agency",children:t.jsx(Ap,{size:24})}),t.jsx(cK,{children:"Agency"}),t.jsx(dK,{children:"I manage multiple clients"})]})]}),t.jsx(Uf,{style:{justifyContent:"flex-end"},children:t.jsx(he,{type:"button",variant:"nav",onClick:u,disabled:!i||o,children:o?"Loading...":"Continue"})})]})})})]})}function _et(){const e=zn(),{setUser:n}=yn(),[i,r]=l.useState(""),[o,s]=l.useState(!0),[a,c]=l.useState(!1),[u,m]=l.useState(null);l.useEffect(()=>{let x=!1;return(async()=>{s(!0);try{const w=await ue("/api/v1/onboarding/step_info?step_number=2",{method:"GET"});if(!w.ok)return;const v=(await w.json())?.workspace_name;!x&&typeof v=="string"&&r(v)}finally{x||s(!1)}})(),()=>{x=!0}},[]);const h=async x=>{if(x.preventDefault(),!(!i.trim()||a)){c(!0),m(null);try{const y=await ue("/api/v1/onboarding/step",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({step_number:2,organization:{name:i.trim()}})});if(!y.ok){const j=await y.json();m(j.errors?.[0]||j.error||"Failed to update workspace name"),c(!1);return}const w=await y.json();w?.user&&n(w.user),e("/onboarding?type=website",{replace:!0})}catch{m("Network error. Please try again."),c(!1)}}},g=()=>{a||e("/onboarding?type=user-type",{replace:!0})};return t.jsxs(Wf,{children:[t.jsx(xa,{size:"small",topLeft:t.jsx(ph,{disabled:a||o})}),t.jsx(uh,{children:t.jsx(bl,{children:t.jsxs(vl,{children:[t.jsx(Vc,{currentStep:2,totalSteps:4}),t.jsxs(Yc,{children:[t.jsx(Wd,{children:"What's your workspace name?"}),t.jsx(Ud,{children:"This will be used to identify your workspace and organize your projects."})]}),u&&t.jsx(Xs,{children:u}),t.jsxs(Ru,{onSubmit:h,children:[t.jsxs(Wo,{children:[t.jsx(js,{htmlFor:"workspace",children:"Workspace Name"}),t.jsx(Xt,{id:"workspace",type:"text",placeholder:"Enter workspace name",leftIcon:t.jsx(Uge,{size:20}),value:i,onChange:x=>r(x.target.value),disabled:o||a,required:!0}),t.jsx(_s,{children:"You can change this later in your workspace settings."})]}),t.jsxs(Uf,{children:[t.jsx(he,{type:"button","data-back-button":!0,onClick:g,variant:"navOutline",disabled:a,children:"â Back"}),t.jsx(he,{type:"submit",variant:"nav",disabled:!i.trim()||o||a,children:a?"Loading...":"Continue"})]})]})]})})})]})}const Cet="example.com or https://example.com",EA=l.forwardRef(function({placeholder:n=Cet,iconSize:i=20,...r},o){return t.jsx(Xt,{ref:o,type:"text",placeholder:n,leftIcon:t.jsx(To,{size:i}),...r})});function Wl(e){const n=String(e||"").trim();if(!n)return null;const i=n.includes("://"),r=i?n:`https://${n}`;try{const o=new URL(r);if(o.protocol!=="http:"&&o.protocol!=="https:")return null;const s=(o.hostname||"").replace(/^www\./i,"").trim().toLowerCase();if(!s||s==="localhost"||!s.includes("."))return null;const a=s.split(".");if(a.some(y=>y.length===0))return null;const c=a[a.length-1];if(!c||c.length<2)return null;const u=/^\d{1,3}(\.\d{1,3}){3}$/.test(s),m=s.includes(":");if(u||m)return null;const h=i&&o.protocol==="http:"?"http":"https";let g=o.pathname||"";g==="/"?g="":g.endsWith("/")&&(g=g.replace(/\/+$/,""));const x=o.search||"";return`${h}://${s}${g}${x}`}catch{return null}}const ket=p.div.withConfig({displayName:"WebsiteStep__WebsiteInlineError",componentId:"sc-pjeax8-0"})` 8804 margin-top: 0.25rem; 8805 font-size: 0.75rem; 8806 color: ${Ut}; 8807 min-height: 1rem; 8808`;function $et(){const e=zn(),{setUser:n}=yn(),[i,r]=l.useState(""),[o,s]=l.useState(""),[a,c]=l.useState(!0),[u,m]=l.useState(!1),[h,g]=l.useState(null),[x,y]=l.useState(!1);l.useEffect(()=>{let k=!1;return(async()=>{c(!0);try{const S=await ue("/api/v1/onboarding/step_info?step_number=3",{method:"GET"});if(!S.ok)return;const I=await S.json();if(k)return;typeof I?.project_name=="string"&&r(I.project_name),typeof I?.website=="string"&&s(I.website)}finally{k||c(!1)}})(),()=>{k=!0}},[]);const w=Wl(o),j=o.trim().length>0&&!w,v=!!w,_=async k=>
8808{if(k.preventDefault(),!(!i.trim()||!o.trim()||u)){if(!w){y(!0),g("Please enter a valid website URL (e.g., example.com or https://example.com)");return}m(!0),g(null);try{const P=await ue("/api/v1/onboarding/step",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({step_number:3,project:{name:i.trim(),website:w}})});if(!P.ok){const I=await P.json();g(I.errors?.[0]||I.error||"Failed to create project"),m(!1);return}const S=await P.json();S?.user&&n(S.user),e("/onboarding?type=location",{replace:!0})}catch{g("Network error. Please try again."),m(!1)}}},$=()=>{u||e("/onboarding?type=workspace",{replace:!0})};return t.jsxs(Wf,{children:[t.jsx(xa,{size:"small",topLeft:t.jsx(ph,{disabled:u||a})}),t.jsx(uh,{children:t.jsx(bl,{children:t.jsxs(vl,{children:[t.jsx(Vc,{currentStep:3,totalSteps:4}),t.jsxs(Yc,{children:[t.jsx(Wd,{children:"Create your first project"}),t.jsx(Ud,{children:"Enter your project name and website to get started."})]}),h&&t.jsx(Xs,{children:h}),t.jsxs(Ru,{onSubmit:_,children:[t.jsxs(Wo,{children:[t.jsx(js,{htmlFor:"projectName",children:"Project Name"}),t.jsx(Xt,{id:"projectName",type:"text",placeholder:"Enter project name",leftIcon:t.jsx(Y8,{size:20}),value:i,onChange:k=>r(k.target.value),disabled:a||u,required:!0}),t.jsx(_s,{children:"This will be the name of your project."})]}),t.jsxs(Wo,{children:[t.jsx(js,{htmlFor:"website",children:"Website URL"}),t.jsx(EA,{id:"website",value:o,onChange:k=>{y(!0),s(k.target.value),g(null)},onBlur:()=>{y(!0)},disabled:a||u,required:!0}),x&&j?t.jsxs(ket,{children:["This URL looks malformed. Please check it (e.g., ",t.jsx("strong",{children:"example.com"}),")."]}):t.jsx(_s,{children:"Enter the website URL for this project."})]}),t.jsxs(Uf,{children:[t.jsx(he,{type:"button","data-back-button":!0,onClick:$,disabled:u,variant:"navOutline",children:"â Back"}),t.jsx(he,{type:"submit",variant:"nav",disabled:!i.trim()||!v||a||u,children:u?"Loading...":"Continue"})]})]})]})})})]})}async function Jb(e){if(!e||e.length<2)return[];const n=await ue(`/api/v1/common/location_search?q=${encodeURIComponent(e)}`,{method:"GET"});if(!n.ok)throw new Error("Failed to search cities");return(await n.json()).cities||[]}async function Iet(e){if(!e)return null;const n=await ue(`/api/v1/common/place_details?place_id=${encodeURIComponent(e)}`,{method:"GET"});return n.ok&&(await n.json()).place||null}const Pet=[["Serbian","ÑÑпÑки Ñезик","sr","srp","srp"],["Romanian, Moldavian, Moldovan","RomânÄ","ro","ron","rum"],["Sichuan Yi, Nuosu","êê ê¿ Nuosuhxop","ii","iii","iii"],["Tahitian","Reo Tahiti","ty","tah","tah"],["Tagalog","Wikang Tagalog","tl","tgl","tgl"],["Yiddish","××Ö´××ש","yi","yid","yid"],["Akan","Akan","ak","aka","aka"],["Malay","Bahasa Melayu, Ø¨ÙØ§Ø³ Ù
ÙØ§ÙÙ","ms","msa","may"],["Arabic","Ø§ÙØ¹Ø±Ø¨ÙØ©","ar","ara","ara"],["Norwegian","Norsk","no","nor","nor"],["Ojibwa","ááááá¯á§áá","oj","oji","oji"],["Fulah","Fulfulde, Pulaar, Pular","ff","ful","ful"],["Persian","ÙØ§Ø±Ø³Û","fa","fas","per"],["Albanian","Shqip","sq","sqi","alb"],["Aymara","aymar aru","ay","aym","aym"],["Azerbaijani","azÉrbaycan dili","az","aze","aze"],["Chinese","䏿 (ZhÅngwén), æ±è¯, æ¼¢èª","zh","zho","chi"],["Cree","áá¦ááááá£","cr","cre","cre"],["Estonian","eesti, eesti keel","et","est","est"],["GuaranÃ","Avañe'ẽ","gn","grn","grn"],["Inupiaq","Iñupiaq, Iñupiatun","ik","ipk","ipk"],["Inuktitut","áááááá¦","iu","iku","iku"],["Kanuri","Kanuri","kr","kau","kau"],["Komi","коми кÑв","kv","kom","kom"],["Kongo","Kikongo","kg","kon","kon"],["Kurdish","Kurdî, Ø£ÛØ²Ø¨ÛÙ","ku","kur","kur"],["Latvian","latvieÅ¡u valoda","lv","lav","lav"],["Malagasy","fiteny malagasy","mg","mlg","mlg"],["Mongolian","Ðонгол Ñ
Ñл","mn","mon","mon"],["Oromo","Afaan Oromoo","om","orm","orm"],["Pashto, Pushto","Ù¾ÚØªÙ","ps","pus","pus"],["Quechua","Runa Simi, Kichwa","qu","que","que"],["Sardinian","sardu","sc","srd","srd"],["Swahili","Kiswahili","sw","swa","swa"],["Uzbek","OÊ»zbek, Ðзбек, ","uz","uzb","uzb"],["Zhuang, Chuang","Saɯ cueÅÆ
, Saw cuengh","za","zha","zha"],["Bislama","Bislama","bi","bis","bis"],["Norweg
8808ian BokmÃ¥l","Norsk BokmÃ¥l","nb","nob","nob"],["Norwegian Nynorsk","Norsk Nynorsk","nn","nno","nno"],["Indonesian","Bahasa Indonesia","id","ind","ind"],["Twi","Twi","tw","twi","twi"],["Esperanto","Esperanto","eo","epo","epo"],["Interlingua","Interlingua","ia","ina","ina"],["Interlingue","Originally called Occidental; then Interlingue after WWII","ie","ile","ile"],["Ido","Ido","io","ido","ido"],["Volapük","Volapük","vo","vol","vol"],["Bihari languages","à¤à¥à¤à¤ªà¥à¤°à¥","bh","bih","bih"],["Hebrew (modern)","×¢×ר×ת","he","heb","heb"],["Sanskrit","सà¤à¤¸à¥à¤à¥à¤¤à¤®à¥","sa","san","san"],["Church Slavic, Church Slavonic, Old Church Slavonic, Old Slavonic, Old Bulgarian","ѩзÑÐºÑ ÑловѣнÑÑкÑ","cu","chu","chu"],["Pali","पाऴि","pi","pli","pli"],["Avestan","avesta","ae","ave","ave"],["Latin","latine, lingua latina","la","lat","lat"],["Armenian","ÕÕ¡ÕµÕ¥ÖÕ¥Õ¶","hy","hye","arm"],["Swati","SiSwati","ss","ssw","ssw"],["Tibetan","à½à½¼à½à¼à½¡à½²à½","bo","bod","tib"],["South Ndebele","isiNdebele","nr","nbl","nbl"],["Slovene","Slovenski Jezik, SlovenÅ¡Äina","sl","slv","slv"],["Oriya","à¬à¬¡à¬¼à¬¿à¬","or","ori","ori"],["North Ndebele","isiNdebele","nd","nde","nde"],["Nauru","Dorerin Naoero","na","nau","nau"],["Maori","te reo MÄori","mi","mri","mao"],["Marathi","मराठà¥","mr","mar","mar"],["Luba-Katanga","Kiluba","lu","lub","lub"],["Rundi","Ikirundi","rn","run","run"],["Central Khmer","ááááá, áááááá¶áá¶, áá¶áá¶ááááá","km","khm","khm"],["Western Frisian","Frysk","fy","fry","fry"],["Bengali","বাà¦à¦²à¦¾","bn","ben","ben"],["Avaric","Ð°Ð²Ð°Ñ Ð¼Ð°ÑÓ, магÓаÑÑл маÑÓ","av","ava","ava"],["Abkhazian","аҧÑÑа бÑзÑÓа, аҧÑÑÓа","ab","abk","abk"],["Afar","Afaraf","aa","aar","aar"],["Afrikaans","Afrikaans","af","afr","afr"],["Amharic","á ááá","am","amh","amh"],["Aragonese","aragonés","an","arg","arg"],["Assamese","à¦
সমà§à¦¯à¦¼à¦¾","as","asm","asm"],["Bambara","bamanankan","bm","bam","bam"],["Bashkir","баÑҡоÑÑ Ñеле","ba","bak","bak"],["Basque","euskara, euskera","eu","eus","baq"],["Belarusian","белаÑÑÑÐºÐ°Ñ Ð¼Ð¾Ð²Ð°","be","bel","bel"],["Bosnian","bosanski jezik","bs","bos","bos"],["Breton","brezhoneg","br","bre","bre"],["Bulgarian","бÑлгаÑÑки език","bg","bul","bul"],["Burmese","ááá¬á
á¬","my","mya","bur"],["Catalan, Valencian","català , valencià ","ca","cat","cat"],["Chamorro","Chamoru","ch","cha","cha"],["Chechen","ноÑ
Ñийн моÑÑ","ce","che","che"],["Chichewa, Chewa, Nyanja","chiCheŵa, chinyanja","ny","nya","nya"],["Chuvash","ÑÓÐ²Ð°Ñ ÑÓлÑ
и","cv","chv","chv"],["Cornish","Kernewek","kw","cor","cor"],["Corsican","corsu, lingua corsa","co","cos","cos"],["Croatian","hrvatski jezik","hr","hrv","hrv"],["Czech","ÄeÅ¡tina, Äeský jazyk","cs","ces","cze"],["Danish","dansk","da","dan","dan"],["Divehi, Dhivehi, Maldivian","ÞÞ¨ÞÞ¬ÞÞ¨","dv","div","div"],["Dutch, Flemish","Nederlands, Vlaams","nl","nld","dut"],["Dzongkha","རྫོà½à¼à½","dz","dzo","dzo"],["English","English","en","eng","eng"],["Ewe","EÊegbe","ee","ewe","ewe"],["Faroese","føroyskt","fo","fao","fao"],["Fijian","vosa Vakaviti","fj","fij","fij"],["Finnish","suomi, suomen kieli","fi","fin","fin"],["French","français, langue française","fr","fra","fre"],["Galician","Galego","gl","glg","glg"],["Georgian","á¥áá áá£áá","ka","kat","geo"],["German","Deutsch","de","deu","ger"],["Greek (modern)","ελληνικά","el","ell","gre"],["Gujarati","àªà«àªàª°àª¾àª¤à«","gu","guj","guj"],["Haitian, Haitian Creole","Kreyòl ayisyen","ht","hat","hat"],["Hausa","(Hausa) ÙÙÙÙØ³Ù","ha","hau","hau"],["Herero","Otjiherero","hz","her","her"],["Hindi","हिनà¥à¤¦à¥, हिà¤à¤¦à¥","hi","hin","hin"],["Hiri Motu","Hiri Motu","ho","hmo","hmo"],["Hungarian","magyar","hu","hun","hun"],["Irish","Gaeilge","ga","gle","gle"],["Igbo","Asụsụ Igbo","ig","ibo","ibo"],["Icelandic","Ãslenska","is","isl","ice"],["Italian","Italiano","it","ita","ita"],["Japanese","æ¥æ¬èª (ã«ã»ãã)","ja","jpn","jpn"],["Javanese","ꦧꦱê¦ê¦®, Basa Jawa","jv","jav","jav"],["Kalaallisut, Greenlandic","kalaallisut, kalaallit oqaasii","kl","kal","kal"],["Kannada","à²à²¨à³à²¨à²¡","kn","kan","kan"],["Kashmiri","à¤à¤¶à¥à¤®à¥à¤°à¥, ÙØ´Ù
ÙØ±Ù","ks","kas","kas"],["Kazakh","ÒÐ°Ð·Ð°Ò ÑÑлÑ","kk","kaz","kaz"],["Kikuyu, Gikuyu","GÄ©kÅ©yÅ©","ki","kik","kik"],["Kinyarwanda","Ikinyarwanda","rw","kin","kin"],["Kirghiz, Kyrgyz","ÐÑÑгÑзÑа, ÐÑÑгÑз Ñили","ky","kir","kir"],["Korean","íêµì´","ko","kor","kor"],["Kuanyama, Kwanyama","Kuanyama","kj","kua","kua"],["Luxembourgish, Letzeburgesch","Lëtzebuergesch","lb","ltz","ltz"],["Ganda","Luganda","lg","lug","lug"],["Limburgan, Limburger, Limburgish","Limburgs","li","lim","lim"],["Lingala","Lingála","ln","lin","lin"],["Lao","àºàº²àºªàº²àº¥àº²àº§","lo","lao","lao"],["Lithuanian","lietuvių kalba","lt","lit","lit"],["Manx","Gaelg, Gailck","gv","glv","glv"],["Macedonian","македонÑки Ñазик","mk","mkd","mac"],["Malayalam","മലയാളà´","ml","mal","mal"],["Maltese","Malti","mt","mlt","mlt"],["Marshallese","Kajin M̧ajeļ","mh","mah","mah"],["Navajo, Navaho","Diné bizaad","nv","nav","nav"],["Nepali","नà¥à¤ªà¤¾à¤²à¥","ne","nep","nep"],["Ndonga","Owambo","
8808ng","ndo","ndo"],["Occitan","occitan, lenga d'oc","oc","oci","oci"],["Ossetian, Ossetic","иÑон æвзаг","os","oss","oss"],["Panjabi, Punjabi","ਪੰà¨à¨¾à¨¬à©","pa","pan","pan"],["Polish","jÄzyk polski, polszczyzna","pl","pol","pol"],["Portuguese","Português","pt","por","por"],["Romansh","Rumantsch Grischun","rm","roh","roh"],["Russian","ÑÑÑÑкий","ru","rus","rus"],["Sindhi","सिनà¥à¤§à¥, سÙÚÙØ Ø³ÙØ¯Ú¾Û","sd","snd","snd"],["Northern Sami","Davvisámegiella","se","sme","sme"],["Samoan","gagana fa'a Samoa","sm","smo","smo"],["Sango","yângâ tî sängö","sg","sag","sag"],["Gaelic, Scottish Gaelic","Gà idhlig","gd","gla","gla"],["Shona","chiShona","sn","sna","sna"],["Sinhala, Sinhalese","à·à·à¶à·à¶½","si","sin","sin"],["Slovak","SlovenÄina, Slovenský Jazyk","sk","slk","slo"],["Somali","Soomaaliga, af Soomaali","so","som","som"],["Southern Sotho","Sesotho","st","sot","sot"],["Spanish, Castilian","Español","es","spa","spa"],["Sundanese","Basa Sunda","su","sun","sun"],["Swedish","Svenska","sv","swe","swe"],["Tamil","தமிழà¯","ta","tam","tam"],["Telugu","à°¤à±à°²à±à°à±","te","tel","tel"],["Tajik","Ñоҷикӣ, toçikÄ«, تاجÛÚ©Û","tg","tgk","tgk"],["Thai","à¹à¸à¸¢","th","tha","tha"],["Tigrinya","áµááá","ti","tir","tir"],["Turkmen","Türkmen, ТүÑкмен","tk","tuk","tuk"],["Tswana","Setswana","tn","tsn","tsn"],["Tongan (Tonga Islands)","Faka Tonga","to","ton","ton"],["Turkish","Türkçe","tr","tur","tur"],["Tsonga","Xitsonga","ts","tso","tso"],["Tatar","ÑаÑÐ°Ñ Ñеле, tatar tele","tt","tat","tat"],["Uighur, Uyghur","ئÛÙØºÛرÚÛ, Uyghurche","ug","uig","uig"],["Ukrainian","УкÑаÑнÑÑка","uk","ukr","ukr"],["Urdu","اردÙ","ur","urd","urd"],["Venda","Tshivená¸a","ve","ven","ven"],["Vietnamese","Tiếng Viá»t","vi","vie","vie"],["Walloon","Walon","wa","wln","wln"],["Welsh","Cymraeg","cy","cym","wel"],["Wolof","Wollof","wo","wol","wol"],["Xhosa","isiXhosa","xh","xho","xho"],["Yoruba","Yorùbá","yo","yor","yor"],["Zulu","isiZulu","zu","zul","zul"]],Bo=Pet.map(e=>({name:e[0],nativeName:e[1],iso639_1:e[2],iso639_2T:e[3],iso639_2B:e[4]}));Bo.sort((e,n)=>e.name.localeCompare(n.name));function z6(e){return Bo.find(n=>n.iso639_1===e)}const Aet=p.div.withConfig({displayName:"LocationStep__FormRow",componentId:"sc-9m6tg3-0"})` 8809 display: flex; 8810 gap: 1rem; 8811 width: 100%; 8812 8813 @media (max-width: 768px) { 8814 flex-direction: column; 8815 } 8816`,uK=p.div.withConfig({displayName:"LocationStep__FormRowItem",componentId:"sc-9m6tg3-1"})` 8817 flex: 1; 8818`,Net=p.div.withConfig({displayName:"LocationStep__InlineError",componentId:"sc-9m6tg3-2"})` 8819 margin-top: 0.25rem; 8820 font-size: 0.75rem; 8821 color: ${Ut}; 8822 min-height: 1rem; 8823`;function zet(){const e=zn(),{setUser:n}=yn(),[i,r]=l.useState(""),[o,s]=l.useState([]),[a,c]=l.useState(null),[u,m]=l.useState(!1),[h,g]=l.useState(null),[x,y]=l.useState(""),[w,j]=l.useState([]),[v,_]=l.useState(""),[$,k]=l.useState(""),[P,S]=l.useState(!1),[I,A]=l.useState(!0),[E,B]=l.useState(!1),[T,M]=l.useState(null);l.useEffect(()=>{let X=!1;return(async()=>{A(!0);try{const K=await ue("/api/v1/onboarding/step_info?step_number=4",{method:"GET"});if(!K.ok)return;const G=await K.json();if(X)return;if(typeof G?.city=="string"&&typeof G?.country=="string"&&(c({name:G.city,country:G.country,country_code:typeof G?.country_code=="string"?G.country_code:void 0}),r(`${G.city}, ${G.country}`)),typeof G?.language=="string"){y(G.language);const L=Bo.find(q=>q.iso639_1===G.language);L&&_(L.name)}typeof G?.focus=="string"&&k(G.focus),typeof G?.local_mode=="boolean"&&S(G.local_mode)}finally{X||A(!1)}})(),()=>{X=!0}},[]),l.useEffect(()=>{if(!i||i.length<2){s([]),g(null);return}const X=window.setTimeout(async()=>{m(!0),g(null);try{const K=(await Jb(i)).map(G=>{const q=String(G?.place_type||"")==="Country"||!G.name&&!G.state&&!!G.country_code,W=String(G.name||G.state||G.country||"Unknown"),oe=q?[G.country]:[W,G.country];return!q&&G.state&&G.name&&oe.splice(1,0,G.state),{value:q?G.country:`${W}, ${G.country}`,label:oe.join(", "),data:{name:q?"":String(G.name||G.state||W),country:G.country,country_code:G.country_code,state:G.state}}});s(K),K.length===0&&i.length>=2&&g("No results found")}catch{s([]),g("Location data unavailable")}finally{m(!1)}},300);return()=>window.clearTimeout(X)},[i]),l.useEffect(()=>{j(Bo.map(X=>({value:X.iso639_1,label:X.name})))},[]),l.useEffect(()=>{if(!v){j(Bo.map(Q=>({value:Q.iso639_1,label:Q.name})));return}const X=Bo.filter(Q=>Q.name.toLowerCase().includes(v.toLowerCase()));j(X.map(Q=>({value:Q.iso639_1,label:Q.name})))},[v]);const R=X=>{const Q=X;r(Q.label),c({name:Q.data.name,country:Q.data.country,country_code:Q.data.country_code}),s([]),g(null)},F=X=>{y(X.value);const Q=Bo.find(K=>K.iso639_1===X.value);Q&&_(Q.name)},Y=X=>{S(X),X&&k("city")},H=async X=>{if(X.preventDefault(),!(!a||!x||!$||E)&&!(P&&!a.name)){B(!0),M(null);try{const Q=await ue("/api/v1/onboarding/step",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({step_number:4,project:{city:a.name,country:a.country,country_code:a.country_code,language:x,focus:$,local_mode:P}})});if(!Q.ok){const G=await Q.json();M(G.errors?.[0]||G.error||"Failed to update project"),B(!1);return}const K=await Q.json();K?.user&&n(K.user),e("/onboarding?type=topic_analysis",{replace:!0})}catch{M("Network error. Please try again."),B(!1)}}},U=()=>{E||e("/onboarding?type=website",{replace:!0})};return t.jsxs(Wf,{children:[t.jsx(xa,{size:"small",topLeft:t.jsx(ph,{disabled:E||I})}),t.jsx(uh,{children:t.jsx(bl,{children:t.jsxs(vl,{children:[t.jsx(Vc,{currentStep:4,totalSteps:4}),t.jsxs(Yc,{children:[t.jsx(Wd,{children:"Where are you located?"}),t.jsx(Ud,{children:"Tell us about your location, language, and focus area."})]}),T&&t.jsx(Xs,{children:T}),t.jsxs(Ru,{onSubmit:H,children:[t.jsxs(Aet,{children:[t.jsx(uK,{children:t.jsxs(Wo,{children:[t.jsx(js,{htmlFor:"city",children:"Location"}),t.jsx(_u,{value:i,onChange:X=>{r(X),c(null)},onSelect:R,placeholder:"Search for a city or country...",leftIcon:t.jsx(_y,{size:20}),options:o,isLoading:u,disabled:I||E}),h?t.jsx(Net,{children:h}):t.jsx(_s,{children:"Search and select your city."})]})}),t.jsx(uK,{children:t.jsxs(Wo,{children:[t.jsx(js,{htmlFor:"language",children:"Language"}
8823),t.jsx(_u,{value:v,onChange:X=>{_(X);const Q=Bo.find(K=>K.name.toLowerCase()===X.toLowerCase());y(Q?Q.iso639_1:"")},onSelect:F,placeholder:"Search for a language...",leftIcon:t.jsx(To,{size:20}),options:w,disabled:I||E}),t.jsx(_s,{children:"Select the primary language for your project."})]})})]}),t.jsxs(Wo,{children:[t.jsx(js,{htmlFor:"focus",children:"Focus"}),t.jsx(WO,{value:$||"",onChange:X=>k(X),disabled:I||E||P}),t.jsx(_s,{children:P?"Set to city when local mode is enabled.":"What is your main focus area?"})]}),t.jsx(Wo,{children:t.jsx(dM,{checked:P,onChange:Y,disabled:I||E,label:"Local mode",description:"Generate hyper-targeted prompts, actions, and competitors focused on your project's specific city and area."})}),t.jsxs(Uf,{children:[t.jsx(he,{type:"button","data-back-button":!0,onClick:U,disabled:E,variant:"navOutline",children:"â Back"}),t.jsx(he,{type:"submit",variant:"nav",disabled:!a||!a.country||!a.country_code||!x||!$||$==="city"&&!a.name||P&&!a.name||I||E,children:E?"Loading...":"Continue"})]})]})]})})})]})}const Tet=Tn` 8824 from { transform: rotate(0deg); } 8825 to { transform: rotate(360deg); } 8826`,nde=p.div.withConfig({displayName:"Analyzingstyle__HeaderContent",componentId:"sc-flmemq-0"})` 8827 display: flex; 8828 flex-direction: column; 8829 align-items: center; 8830 gap: 0.75rem; 8831 text-align: center; 8832 margin-bottom: 1.5rem; 8833`,ide=p.h2.withConfig({displayName:"Analyzingstyle__Title",componentId:"sc-flmemq-1"})` 8834 font-size: 1.25rem; 8835 font-weight: 700; 8836 color: ${O}; 8837 margin: 0; 8838`,rde=p.p.withConfig({displayName:"Analyzingstyle__Subtitle",componentId:"sc-flmemq-2"})` 8839 font-size: 0.875rem; 8840 color: ${z}; 8841 margin: 0; 8842 line-height: 1.6; 8843`,ode=p.div.withConfig({displayName:"Analyzingstyle__SpinnerWrapper",componentId:"sc-flmemq-3"})` 8844 display: flex; 8845 justify-content: center; 8846 margin: 1rem 0 0.5rem 0; 8847`,sde=p.div.withConfig({displayName:"Analyzingstyle__Spinner",componentId:"sc-flmemq-4"})` 8848 width: 2.5rem; 8849 height: 2.5rem; 8850 border: 3px solid ${V}; 8851 border-top: 3px solid ${ot}; 8852 border-radius: 9999px; 8853 animation: ${Tet} 1s linear infinite; 8854`,ade=p.div.withConfig({displayName:"Analyzingstyle__StatusContainer",componentId:"sc-flmemq-5"})` 8855 display: flex; 8856 flex-direction: column; 8857 gap: 0.75rem; 8858`,lde=p.div.withConfig({displayName:"Analyzingstyle__StatusItem",componentId:"sc-flmemq-6"})` 8859 display: flex; 8860 align-items: center; 8861 gap: 0.875rem; 8862 padding: 1rem; 8863 border-radius: 0.875rem; 8864 background: ${e=>e.$active?"rgba(79, 70, 229, 0.04)":e.$completed?"rgba(16, 185, 129, 0.04)":At}; 8865 border: 1px solid ${e=>e.$active?"rgba(79, 70, 229, 0.18)":e.$completed?"rgba(16, 185, 129, 0.18)":$e}; 8866 transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.2s ease; 8867 8868 &:hover { 8869 transform: translateX(2px); 8870 border-color: ${e=>e.$active?"rgba(79, 70, 229, 0.25)":V}; 8871 } 8872`,cde=p.div.withConfig({displayName:"Analyzingstyle__StatusIcon",componentId:"sc-flmemq-7"})` 8873 width: 2.5rem; 8874 height: 2.5rem; 8875 border-radius: 0.75rem; 8876 display: flex; 8877 align-items: center; 8878 justify-content: center; 8879 flex-shrink: 0; 8880 background: ${e=>e.$completed?"rgba(16, 185, 129, 0.10)":e.$active?"rgba(79, 70, 229, 0.10)":Z}; 8881 color: ${e=>e.$completed?"rgba(16, 185, 129, 0.75)":e.$active?"rgba(79, 70, 229, 0.75)":Pe}; 8882 border: 1px solid ${e=>e.$active?"rgba(79, 70, 229, 0.16)":V}; 8883 8884 &:focus-visible { 8885 outline: none; 8886 box-shadow: 0 0 0 3px ${En}; 8887 } 8888`,dde=p.div.withConfig({displayName:"Analyzingstyle__StatusText",componentId:"sc-flmemq-8"})` 8889 display: flex; 8890 flex-direction: column; 8891 gap: 0.125rem; 8892 min-width: 0; 8893`,ude=p.div.withConfig({displayName:"Analyzingstyle__StatusLabel",componentId:"sc-flmemq-9"})` 8894 font-size: 0.9375rem; 8895 font-weight: 600; 8896 color: ${O}; 8897`,pde=p.div.withConfig({displayName:"Analyzingstyle__StatusDescription",componentId:"sc-flmemq-10"})` 8898 font-size: 0.8125rem; 8899 color: ${z}; 8900 line-height: 1.5; 8901`,Eet={topic_analysis:5,prompt_analysis:7,competitor_analysis:9},T6={topic_analysis:{title:"Finding relevant topics",subtitle:"Weâre analyzing your project and preparing topic suggestions. This can take a moment.",statuses:[{id:"searching",label:"Searching for topics",description:"Analyzing your industry and website",icon:Cs},{id:"categorizing",label:"Categorizing topics",description:"Organizing relevant topics for you",icon:Sn},{id:"preparing",label:"Preparing suggestions",description:"Finalizing topic recommendations",icon:qi}]},prompt_analysis:{title:"Generating prompts",subtitle:"Weâre generating optimized prompts from your topics. This can take a moment.",statuses:[{id:"analyzing",label:"Analyzing topics",description:"Generating prompt c
8901andidates",icon:Ss},{id:"optimizing",label:"Optimizing prompts",description:"Refining prompts for better results",icon:Sn},{id:"finalizing",label:"Finalizing",description:"Preparing your prompt list",icon:qi}]},competitor_analysis:{title:"Analyzing competitors",subtitle:"Weâre identifying competitors and preparing competitive insights. This can take a moment.",statuses:[{id:"scanning",label:"Scanning competitors",description:"Identifying key players in your industry",icon:Cs},{id:"analyzing",label:"Analyzing strategies",description:"Processing competitor data",icon:Sn},{id:"preparing",label:"Preparing insights",description:"Finalizing competitor suggestions",icon:qi}]}};function Met(){const[e]=yr(),{user:n,refreshUser:i}=yn(),r=e.get("type")||"topic_analysis",o=Eet[r]??null,s=l.useMemo(()=>r in T6?T6[r]:T6.topic_analysis,[r]),[a,c]=l.useState(0),[u,m]=l.useState(null);return l.useEffect(()=>{c(0);const h=s.statuses.map((g,x)=>window.setTimeout(()=>c(x),x*1800));return()=>h.forEach(g=>window.clearTimeout(g))},[s.statuses]),l.useEffect(()=>{if(!o||!n||n.onboarding_step!==o)return;let h=null;const g=async()=>{try{await i(),m(null)}catch{}};return g(),h=window.setInterval(g,5e3),()=>{h&&window.clearInterval(h)}},[o,n?.onboarding_step,i]),t.jsxs(Wf,{children:[t.jsx(xa,{size:"small",topLeft:t.jsx(ph,{})}),t.jsx(uh,{children:t.jsx(bl,{children:t.jsxs(vl,{children:[t.jsx(Vc,{currentStep:o||1,totalSteps:12}),u&&t.jsx(Xs,{children:u}),t.jsxs(nde,{children:[t.jsx(ide,{children:s.title}),t.jsx(rde,{children:s.subtitle}),t.jsx(ode,{children:t.jsx(sde,{})})]}),t.jsx(ade,{children:s.statuses.map((h,g)=>{const x=h.icon,y=a===g,w=a>g;return t.jsxs(lde,{$active:y,$completed:w,children:[t.jsx(cde,{$active:y,$completed:w,children:t.jsx(x,{size:18})}),t.jsxs(dde,{children:[t.jsx(ude,{children:h.label}),t.jsx(pde,{children:h.description})]})]},h.id)})})]})})})]})}const ni={chatUserMessageMaxChars:2500,projectDescriptionMaxChars:1e3,topicNameMaxChars:80,promptContentMaxChars:500,promptBulkMax:100};function mde({value:e,onChange:n,onAdd:i,placeholder:r,disabled:o,addDisabled:s}){return t.jsxs("div",{style:{display:"flex",gap:"0.5rem",alignItems:"flex-start"},children:[t.jsx(Xt,{type:"text",value:e,onChange:a=>n(a.target.value),maxLength:ni.topicNameMaxChars,placeholder:r||"e.g., SEO, Digital marketing, Content strategy",disabled:o,onKeyDown:a=>{a.key==="Enter"&&(a.preventDefault(),i())}}),t.jsxs(he,{type:"button",onClick:i,disabled:!!s||!!o,children:[t.jsx(gr,{size:16}),"Add"]})]})}const Ret=p.div.withConfig({displayName:"TopicsCardsGrid__TopicsList",componentId:"sc-1e3jsfv-0"})` 8902 display: grid; 8903 grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); 8904 gap: 0.75rem; 8905`,Oet=p.div.withConfig({displayName:"TopicsCardsGrid__TopicItem",componentId:"sc-1e3jsfv-1"})` 8906 position: relative; 8907 display: flex; 8908 align-items: center; 8909 padding: 0.625rem 0.75rem; 8910 background: ${Z}; 8911 border: 1px solid ${Rt}; 8912 border-radius: 0.5rem; 8913 /* Allow the card to grow with long topic names (no truncation). */ 8914 min-height: 44px; 8915 transition: border-color 0.15s ease, box-shadow 0.15s ease; 8916 8917 &:hover { 8918 border-color: ${ot}; 8919 box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.08); 8920 } 8921 8922 &:focus-within { 8923 border-color: ${ot}; 8924 } 8925 8926 &:hover [data-topic-remove="1"], 8927 &:focus-within [data-topic-remove="1"] { 8928 opacity: 1; 8929 pointer-events: auto; 8930 transform: translateY(-50%); 8931 } 8932`,Det=p.div.withConfig({displayName:"TopicsCardsGrid__TopicIcon",componentId:"sc-1e3jsfv-2"})` 8933 width: 30px; 8934 height: 30px; 8935 flex: 0 0 30px; 8936 border-radius: 0.7rem; 8937 border: 1px solid ${V}; 8938 background: ${$e}; 8939 color: ${z}; 8940 display: inline-flex; 8941 align-items: center; 8942 justify-content: center; 8943 margin-right: 0.625rem; 8944`,Let=p.div.withConfig({displayName:"TopicsCardsGrid__TopicRow",componentId:"sc-1e3jsfv-3"})` 8945 display: flex; 8946 align-items: ${e=>e.$multiline?"flex-start":"center"}; 8947 min-width: 0; 8948 width: 100%; 8949`,Bet=p.div.withConfig({displayName:"TopicsCardsGrid__TopicName",componentId:"sc-1e3jsfv-4"})` 8950 font-size: 0.875rem; 8951 font-weight: 600; 8952 color: ${O}; 8953 white-space: normal;
8954 overflow-wrap: anywhere; 8955 word-break: break-word; 8956 line-height: 1.25; 8957 padding-right: 2rem; 8958 width: 100%; 8959 min-width: 0; 8960`,Fet=p.button.withConfig({displayName:"TopicsCardsGrid__RemoveButton",componentId:"sc-1e3jsfv-5"})` 8961 position: absolute; 8962 top: 50%; 8963 right: 0.5rem; 8964 width: 24px; 8965 height: 24px; 8966 border-radius: 0.375rem; 8967 border: none; 8968 background: transparent; 8969 color: ${z}; 8970 cursor: pointer; 8971 display: inline-flex; 8972 align-items: center; 8973 justify-content: center; 8974 opacity: 0; 8975 pointer-events: none; 8976 transform: translateY(calc(-50% - 2px)); 8977 transition: opacity 0.15s ease, transform 0.15s ease, background-color 0.15s ease; 8978 8979 &:hover { 8980 background: ${$e}; 8981 } 8982 8983 &:focus-visible { 8984 outline: none; 8985 background: ${$e}; 8986 box-shadow: 0 0 0 3px ${En}; 8987 } 8988 8989 &:disabled { 8990 opacity: 0.4; 8991 cursor: not-allowed; 8992 } 8993`;function hde({topics:e,onRemove:n,disabled:i,emptyText:r="No topics yet.",tooltipMaxWidth:o=420}){if(!e||e.length===0)return t.jsx("div",{style:{color:z,fontSize:"0.8125rem"},children:r});const s=l.useMemo(()=>e.map(m=>String(m.id)),[e]),a=l.useRef({}),[c,u]=l.useState({});return l.useLayoutEffect(()=>{const m={};for(const h of s){const g=a.current[h];if(!g)continue;const x=window.getComputedStyle(g),y=Number.parseFloat(x.lineHeight||""),w=Number.isFinite(y)&&y>0?y:16;m[h]=g.scrollHeight>w*1.4}u(h=>{for(const g of s)if(!!h[g]!=!!m[g])return m;return h})},[s.join("|")]),t.jsx(Ret,{children:e.map(m=>t.jsxs(Oet,{children:[t.jsx(at,{content:m.name,onlyIfTruncated:!0,size:"sm",maxWidth:o,children:t.jsxs(Let,{$multiline:!!c[String(m.id)],children:[t.jsx(Det,{"aria-hidden":!0,children:t.jsx(X_,{size:14})}),t.jsx(Bet,{ref:h=>a.current[String(m.id)]=h,children:m.name})]})}),t.jsx(Fet,{type:"button","data-topic-remove":"1","aria-label":`Remove ${m.name}`,onClick:()=>n(m.id),disabled:i,children:t.jsx(Ei,{size:14})})]},String(m.id)))})}const Wet=p.div.withConfig({displayName:"TopicsImportanceCallout__Wrap",componentId:"sc-1uny3ag-0"})` 8994 margin: 0.75rem 0 1rem; 8995 padding: 0.85rem 0.9rem; 8996 border-radius: 0.875rem; 8997 border: 1px solid ${V}; 8998 background: linear-gradient(180deg, ${Z} 0%, ${At} 100%); 8999 box-shadow: 0 1px 2px rgba(17, 24, 39, 0.04); 9000`,Uet=p.div.withConfig({displayName:"TopicsImportanceCallout__Header",componentId:"sc-1uny3ag-1"})` 9001 display: flex; 9002 align-items: flex-start; 9003 gap: 0.75rem; 9004 min-width: 0; 9005`,Het=p.div.withConfig({displayName:"TopicsImportanceCallout__IconWrap",componentId:"sc-1uny3ag-2"})` 9006 width: 2.25rem; 9007 height: 2.25rem; 9008 border-radius: 0.875rem; 9009 background: ${$e}; 9010 border: 1px solid ${V}; 9011 display: flex; 9012 align-items: center; 9013 justify-content: center; 9014 flex: 0 0 auto; 9015 color: ${ot}; 9016`,qet=p.div.withConfig({displayName:"TopicsImportanceCallout__Text",componentId:"sc-1uny3ag-3"})` 9017 min-width: 0; 9018 flex: 1 1 auto; 9019 display: flex; 9020 flex-direction: column; 9021 gap: 0.35rem; 9022`,Get=p.div.withConfig({displayName:"TopicsImportanceCallout__Title",componentId:"sc-1uny3ag-4"})` 9023 font-size: 0.875rem; 9024 font-weight: 850; 9025 color: ${O}; 9026 display: flex; 9027 align-items: center; 9028 gap: 0.4rem; 9029`,Vet=p.div.withConfig({displayName:"TopicsImportanceCallout__Subtitle",componentId:"sc-1uny3ag-5"})` 9030 font-size: 0.8125rem; 9031 color: ${z}; 9032 line-height: 1.5; 9033`,Ket=p.ul.withConfig({displayName:"TopicsImportanceCallout__Bullets",componentId:"sc-1uny3ag-6"})` 9034 margin: 0.55rem 0 0 0; 9035 padding-left: 1.1rem; 9036 display: grid; 9037 gap: 0.35rem; 9038 color: ${z}; 9039 font-size: 0.8125rem; 9040 line-height: 1.5; 9041 9042 li { 9043 min-width: 0; 9044 } 9045`,Yet=p.div.withConfig({displayName:"TopicsImportanceCallout__Hint",componentId:"sc-1uny3ag-7"})` 9046 margin-top: 0.6rem; 9047 display: inline-flex; 9048 align-items: center; 9049 gap: 0.45rem; 9050 padding: 0.45rem 0.55rem; 9051 border-radius: 0.75rem; 9052 border: 1px solid ${V}; 9053 background: ${Z}; 9054 color: ${z}; 9055 font-size: 0.75rem; 9056 9057 &:focus-visible { 9058 outline: none; 9059 box-shadow: 0 0 0 3px ${En}; 9060 } 9061`;function fde(){return t.jsx(Wet,{role:"note","aria-label":"Why topics matter",children:t.jsxs(Uet,{children:[t.jsx(Het,{"aria-hidden":"true",children:t.jsx(CP,{size:18})}),t.jsxs(qet,{children:[t.jsxs(Get,{children:["Why topics matter ",t.jsx(Sn,{size:16,"aria-hidden":"true"})]}),t.jsx(Vet,{children:"Topics are the way Ceyo organizes your project. They shape how prompts are grouped and how insights are presented across the platform."}),t.jsxs(Ket,{children:[t.jsx("li",{children:"Prompts are created and grouped under topics (so a clear topic = clearer prompts)."}),t.jsx("li",{children:"Dashboards, actions, and reports use topics to break down performance."}),t.jsx("li",{children:"You can edit topics later, but choosing good ones now gives better suggestions immediately."})]}),t.jsx(Yet,{children:"Tip: pick broad customer intents (not brand names) and keep them mutually distinct."})]})]})})}const px=5,Xet=p(bl).withConfig({displayName:"TopicsStep__WideFormContainer",componentId:"sc-1mihd97-0"})` 9062 @media (min-width: 1024px) { 9063 max-width: 44rem; 9064 } 9065`,Qet=p.div.withConfig({displayName:"TopicsStep__LabelRow",componentId:"sc-1mihd97-1"})` 9066 display: flex; 9067 align-items: center; 9068 justify-content: space-between; 9069 gap: 0.75rem; 9070`,Zet=p.span.withConfig({displayName:"TopicsStep__CounterPill",componentId:"sc-1mihd97-2"})` 9071 font-size: 0.75rem; 9072 font-weight: 700; 9073 color: ${z}; 9074 background: ${$e}; 9075 border: 1px solid ${V}; 9076 padding: 0.125rem 0.5rem; 9077 border-radius: 9999px; 9078 white-space: nowrap; 9079`;function Jet(){const{setUser:e}=yn(),n=zn(),[i,r]=l.useState([]),[o,s]=l.useState(""),[a,c]=l.useState(!0),[u,m]=l.useState(!1),[h,g]=l.useState(null),x=l.useMemo(()=>new Set(i.map($=>
9079$.name.trim().toLowerCase()).filter(Boolean)),[i]),y=i.length>=px,w=l.useMemo(()=>i.map($=>({id:$.id??$.name,name:$.name})),[i]);l.useEffect(()=>{let $=!1;return(async()=>{c(!0),g(null);try{const P=await ue("/api/v1/onboarding/step_info?step_number=6",{method:"GET"});if(!P.ok){g("Failed to load topics");return}const S=await P.json(),A=(Array.isArray(S?.topics)?S.topics:[]).map(E=>({id:E?.id,name:String(E?.name||"").trim()})).filter(E=>E.name.length>0);$||r(A.slice(0,px))}catch{$||g("Network error. Please try again.")}finally{$||c(!1)}})(),()=>{$=!0}},[]);const j=()=>{if(y){g(`You can add up to ${px} topics.`);return}const $=o.trim();if(!$)return;if($.length>ni.topicNameMaxChars){g(`Topic is too long (max ${ni.topicNameMaxChars} characters).`);return}const k=$.toLowerCase();if(x.has(k)){g("This topic already exists");return}r(P=>[...P,{id:Date.now(),name:$}]),s(""),g(null)},v=$=>{r(k=>typeof $=="number"?k.filter(P=>P.id!==$):k.filter(P=>P.name.trim().toLowerCase()!==String($).trim().toLowerCase()))},_=async $=>{if($.preventDefault(),u)return;const k=i.map(P=>({name:P.name.trim().toLowerCase()})).filter(P=>P.name.length>0);if(k.length===0){g("Please add at least one topic");return}if(k.length>px){g(`You can select a maximum of ${px} topics.`);return}m(!0),g(null);try{const P=await ue("/api/v1/onboarding/step",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({step_number:6,topics:k})});if(!P.ok){const I=await P.json().catch(()=>({}));g(I?.error||I?.errors?.[0]||"Failed to save topics"),m(!1);return}const S=await P.json();S?.user&&e(S.user),n("/onboarding?type=prompt_analysis",{replace:!0})}catch{g("Network error. Please try again."),m(!1)}};return t.jsxs(Wf,{children:[t.jsx(xa,{size:"small",topLeft:t.jsx(ph,{disabled:u})}),t.jsx(uh,{children:t.jsx(Xet,{children:t.jsxs(vl,{children:[t.jsx(Vc,{currentStep:6,totalSteps:12}),t.jsxs(Yc,{children:[t.jsx(Wd,{children:"Review your topics"}),t.jsx(Ud,{children:"Review and manage the topics we found. Add or remove any that donât apply."})]}),t.jsx(fde,{}),h&&t.jsx(Xs,{children:h}),t.jsxs(Ru,{onSubmit:_,children:[t.jsxs(Wo,{children:[t.jsxs(Qet,{children:[t.jsx(js,{children:"Add a topic"}),t.jsxs(Zet,{children:[i.length,"/",px]})]}),t.jsx(mde,{value:o,onChange:s,onAdd:j,disabled:a||u||y,addDisabled:!o.trim()||a||u||y}),o.length>=ni.topicNameMaxChars?t.jsxs(_s,{children:["Topic name is limited to ",ni.topicNameMaxChars," characters."]}):t.jsx(_s,{children:"Add a topic to your project."})]}),t.jsxs(Wo,{children:[t.jsx(js,{children:"Your topics"}),a?t.jsx(_s,{children:"Loading topicsâ¦"}):t.jsx(hde,{topics:w,onRemove:v,disabled:u,emptyText:"No topics yet. Add your first topic above.",tooltipMaxWidth:420})]}),t.jsx(Uf,{style:{justifyContent:"flex-end"},children:t.jsx(he,{type:"submit",variant:"nav",disabled:a||u||i.length===0,children:u?"Savingâ¦":"Continue"})})]})]})})})]})}const ett=p.div.withConfig({displayName:"AddPromptModal__Stack",componentId:"sc-nk55ev-0"})` 9080 display: flex; 9081 flex-direction: column; 9082 gap: 0.75rem; 9083`,ttt=p.div.withConfig({displayName:"AddPromptModal__BulkLayout",componentId:"sc-nk55ev-1"})` 9084 display: grid; 9085 grid-template-rows: auto minmax(0, 1fr); 9086 gap: 0.75rem; 9087 min-height: 0; 9088 height: 100%; 9089`,Jk=p.div.withConfig({displayName:"AddPromptModal__Field",componentId:"sc-nk55ev-2"})` 9090 display: flex; 9091 flex-direction: column; 9092 gap: 0.35rem; 9093`,e$=p.div.withConfig({displayName:"AddPromptModal__Label",componentId:"sc-nk55ev-3"})` 9094 font-size: 0.75rem; 9095 font-weight: 800; 9096 color: ${O}; 9097`,d8=p.div.withConfig({displayName:"AddPromptModal__Helper",componentId:"sc-nk55ev-4"})` 9098 font-size: 0.75rem; 9099 color: ${z}; 9100 line-height: 1.4; 9101`;function ntt(e){const n=[];(e||[]).forEach(r=>{const s=String(r?.place_type||"")==="Country"||!r?.name&&!r?.state&&!!r?.country_code,a=String(r?.country||"").trim();if(!a)return;const c=String(r?.country_code||"").trim().toUpperCase()||void 0;if(s){const g=c?`${a} (${c})`:a;n.push({value:c||a,label:g,data:{kind:"country",city:"",country:a,country_code:c}});return}const u=String(r?.name||r?.state||r?.country||"Unknown").trim();if(!u)return;const m=String(r?.state||"").trim(),h=[u];m&&m.toLowerCase()!==a.toLowerCase()&&h.push(m),h.push(a),n.push({value:`${u}|${m}|${c||a}`,label:h.join(", "),data:{kind:"city",city:u,country:a,country_code:c}})});const i=new Set;return n.filter(r=>{const o=r.data.kind==="country"?`country:${(r.data.country_code||r.data.country).toLowerCase()}`:`city:${r.data.city.toLowerCase()}|${(r.data.country_code||r.data.country).toLowerCase()}`;return i.has(o)?!1:(i.add(o),!0)})}
9101function itt(e,n){const i=String(e||"").trim(),r=String(n?.name||"").trim(),o=String(n?.code||"").trim().toUpperCase();return i&&r?`${i}, ${o?`${r} (${o})`:r}`:i||(r?o?`${r} (${o})`:r:o||"")}function E6(e,n,i){const r=String(e||"").trim(),o=String(n||"").trim(),s=String(i||"").trim().toUpperCase();return r&&o?`${r}, ${s?`${o} (${s})`:o}`:r||(o?s?`${o} (${s})`:o:s||"")}function t$({value:e,onChange:n,onPick:i,disabled:r,placeholder:o,showHelper:s,helperText:a}){const[c,u]=l.useState([]),[m,h]=l.useState(!1);return l.useEffect(()=>{const g=e.trim();if(!g||g.length<2){u([]),h(!1);return}let x=!1;const y=window.setTimeout(async()=>{h(!0);try{const w=await Jb(g);if(x)return;u(ntt(w))}catch{x||u([])}finally{x||h(!1)}},300);return()=>{x=!0,window.clearTimeout(y)}},[e]),t.jsxs("div",{style:{minWidth:0},children:[t.jsx(_u,{value:e,onChange:n,onSelect:g=>i(g.data),placeholder:o||"Search for a city or country...",leftIcon:t.jsx(_y,{size:16}),options:c,isLoading:m,disabled:r,inputSize:"sm",inputStyle:{height:"2rem"},dropdownPortal:!0}),s?t.jsx(d8,{children:a}):null]})}const rtt=p.textarea.withConfig({displayName:"AddPromptModal__PromptTextArea",componentId:"sc-nk55ev-5"})` 9102 width: 100%; 9103 border-radius: 0.75rem; 9104 border: 1px solid ${Rt}; 9105 background: ${Z}; 9106 color: ${O}; 9107 padding: 0.75rem 0.875rem; 9108 font-size: 0.9375rem; 9109 line-height: 1.4; 9110 min-height: 132px; 9111 max-height: 320px; 9112 resize: vertical; 9113 overflow: auto; 9114 outline: none; 9115 9116 &:focus-visible { 9117 border-color: ${ot}; 9118 box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12); 9119 } 9120 9121 &:disabled { 9122 opacity: 0.6; 9123 cursor: not-allowed; 9124 } 9125`,ott=p.div.withConfig({displayName:"AddPromptModal__RowsHeader",componentId:"sc-nk55ev-6"})` 9126 display: flex; 9127 align-items: center; 9128 justify-content: space-between; 9129 gap: 0.75rem; 9130 margin-bottom: 0.5rem; 9131`,stt=p.div.withConfig({displayName:"AddPromptModal__RowsTitle",componentId:"sc-nk55ev-7"})` 9132 font-size: 0.8125rem; 9133 font-weight: 850; 9134 color: ${O}; 9135`,att=p.div.withConfig({displayName:"AddPromptModal__RowsMeta",componentId:"sc-nk55ev-8"})` 9136 font-size: 0.75rem; 9137 font-weight: 700; 9138 color: ${z}; 9139`,ltt=p.div.withConfig({displayName:"AddPromptModal__RowsScroll",componentId:"sc-nk55ev-9"})` 9140 min-height: 0; 9141 overflow: auto; 9142 padding-right: 0.25rem; 9143`,ctt=p.div.withConfig({displayName:"AddPromptModal__MinimalRows",componentId:"sc-nk55ev-10"})` 9144 display: flex; 9145 flex-direction: column; 9146 min-height: 0; 9147`,dtt=p.div.withConfig({displayName:"AddPromptModal__MinimalRow",componentId:"sc-nk55ev-11"})` 9148 display: grid; 9149 grid-template-columns: minmax(26rem, 2.2fr) minmax(10rem, 1fr) minmax(10rem, 1fr) minmax(14rem, 1.25fr) 2rem; 9150 gap: 0.75rem; 9151 align-items: center; 9152 min-width: 0; 9153 padding: 0.65rem 0; 9154 9155 @media (max-width: 768px) { 9156 grid-template-columns: 1fr; 9157 align-items: stretch; 9158 padding: 0.95rem 0; 9159 border-bottom: 1px solid ${Rt}; 9160 9161 &:last-child { 9162 border-bottom: 0; 9163 } 9164 } 9165`,utt=p.div.withConfig({displayName:"AddPromptModal__MinimalHeaderRow",componentId:"sc-nk55ev-12"})` 9166 display: grid; 9167 grid-template-columns: minmax(26rem, 2.2fr) minmax(10rem, 1fr) minmax(10rem, 1fr) minmax(14rem, 1.25fr) 2rem; 9168 gap: 0.75rem; 9169 align-items: center; 9170 min-width: 0; 9171 padding: 0.35rem 0; 9172 font-size: 0.75rem; 9173 font-weight: 850; 9174 color: ${z}; 9175 9176 @media (max-width: 768px) { 9177 display: none; 9178 } 9179`,ptt=p.button.withConfig({displayName:"AddPromptModal__MinimalRemoveButton",componentId:"sc-nk55ev-13"})` 9180 width: 2.5rem; 9181 height: 2.5rem; 9182 appearance: none; 9183 border: 1px solid rgba(239, 68, 68, 0.25); 9184 background: rgba(239, 68, 68, 0.08); 9185 color: rgb(185, 28, 28); 9186 width: 2rem; 9187 height: 2rem; 9188 border-radius: 0.6rem; 9189 display: inline-flex; 9190 align-items: center; 9191 justify-content: center; 9192 cursor: pointer; 9193 flex-shrink: 0; 9194 9195 &:hover:not(:disabled) { 9196 background: rgba(239, 68, 68, 0.12); 9197 } 9198 9199 &:disabled { 9200 opacity: 0.4; 9201 cursor: not-allowed; 9202 } 9203`,mtt=p.div.withConfig({displayName:"AddPromptModal__MinimalAddButtonWrap",componentId:"sc-nk55ev-14"})` 9204 display: flex; 9205 justify-content: center; 9206 padding-top: 0.25rem; 9207 9208 @media (max-width: 768px) { 9209 padding-top: 0.75rem; 9210 padding-bottom: 0.75rem; 9211 } 9212`;function u_({isOpen:e,onClose:n,title:i,description:r,size:o="lg",isSubmitting:s,...a}){const c=a.mode||"single",u=c==="bulk"?a:null,m=c==="single"?a:null,h=ni.promptBulkMax,[g,x]=l.useState([]);l.useEffect(()=>{if(!e||c!=="bulk")return;const M=Array.isArray(u?.initialRows)&&u.initialRows.length>0?u.initialRows:[{content:""}],R=!!u?.lockLocationOverride;x(M.slice(0,h).map((F,Y)=>({id:`row-${Date.now()}-${Y}-${Math.floor(Math.random()*1e5)}`,content:String(F.content||""),topicValue:F.topicValue??u?.topicValue,categoryValue:F.categoryValue??u?.categoryValue,countryOverride:R?void 0:F.countryOverride,countryCodeOverride:R?void 0:F.countryCodeOverride,cityOverride:R?void 0:F.cityOverride,locationQuery:R?"":E6(F.cityOverride,F.countryOverride,F.countryCodeOverride)})))},[e,c]);const y=!!u?.lockLocationOverride,w="Your plan doesn't allow location overrides.",[j,v]=l.useState("");l.useEffect(()=>{e&&c==="single"&&m?.showLocation&&v(itt(m?.cityValue,m?.countryValue??null))},[e,c]);const _=(m?.promptValue||"").toString(),$=_.trim(),k=!!$&&$.length<=ni.promptContentMaxChars&&!s,P=_.length>=ni.promptContentMaxChars,S=l.useMemo(()=>g.filter(M=>M.content.trim().length>0),[g]),I=S.length>h,A=S.length>0&&!I&&!s,E=l.useMemo(()=>u?(u.topicOptions||[]).map(M=>({id:Number(M.value),label:String(M.label||"")})).filter(M=>Number.isFinite(M.id)&&M.id>0&&M.label.trim()!==""):[],[u]),B=l.useMemo(()=>{const M=Number(u?.topicValue);return Number.isFinite(M)&&M>0?M:E[0]?.id||0},[u?.topicValue,E]),T=c==="bulk"?t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:"0.75rem",flexWrap:"wrap"},children:[t.jsx(he,{type:"button",size:"sm",variant:"outline",onClick:n,disabled:s,children:"Cancel"}),t.jsx("div",{style:{display:"inline-flex",gap:"0.75rem",flexWrap:"wrap",justifyContent:"flex-end"},children:t.jsxs(he,{type:"button",size:"sm",disabled:!A,onClick:()=>
9212{if(!u||I)return;const M=S.map(R=>({content:R.content.trim(),topicValue:(R.topicValue||"").toString().trim()||u.topicValue,categoryValue:(R.categoryValue||"").toString().trim()||u.categoryValue,countryOverride:y?void 0:(R.countryOverride??"").toString().trim()||void 0,countryCodeOverride:y?void 0:(R.countryCodeOverride??"").toString().trim()||void 0,cityOverride:y?void 0:(R.cityOverride??"").toString().trim()||void 0}));u.onAddMany(M)},children:["Save ",S.length," ",S.length===1?"prompt":"prompts"]})})]}):t.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.75rem"},children:[t.jsx(he,{type:"button",size:"sm",variant:"outline",onClick:n,disabled:s,children:"Cancel"}),t.jsx(he,{type:"button",size:"sm",onClick:()=>m?.onAdd(),disabled:!k,children:"Add prompt"})]});return t.jsx(Hn,{isOpen:e,onClose:n,title:i,description:r,size:o,maxWidth:c==="bulk"?"72rem":void 0,height:c==="bulk"?"34rem":void 0,footer:T,children:c==="bulk"&&u?t.jsx(ttt,{children:t.jsxs("div",{style:{minHeight:0},children:[t.jsx(ott,{children:t.jsxs("div",{style:{display:"inline-flex",alignItems:"baseline",gap:10,minWidth:0},children:[t.jsx(stt,{children:"Prompts"}),t.jsxs(att,{children:["Max ",h," prompts per batch"]})]})}),I?t.jsxs(d8,{style:{marginBottom:8,fontWeight:800},children:["You can add up to ",h," prompts at a time. Remove ",S.length-h," prompt",S.length-h===1?"":"s"," to continue."]}):null,t.jsx(ltt,{children:t.jsxs(ctt,{children:[t.jsxs(utt,{"aria-hidden":"true",children:[t.jsx("div",{children:"Prompt"}),t.jsx("div",{children:"Topic"}),t.jsx("div",{children:"Category"}),t.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[t.jsx("span",{children:"Location"}),t.jsx(at,{content:"Search and select a city or a country. Selecting a country sets a country override; selecting a city sets city + country.",children:t.jsx("span",{"aria-label":"Location info",style:{display:"inline-flex",alignItems:"center",color:z},children:t.jsx(wn,{size:14})})})]}),t.jsx("div",{})]}),g.map(M=>t.jsxs(dtt,{children:[t.jsx(Xt,{value:M.content,placeholder:"Type a promptâ¦",disabled:s,size:"sm",style:{height:"2rem"},onChange:R=>{const F=R.target.value;x(Y=>Y.map(H=>H.id===M.id?{...H,content:F}:H))}}),t.jsx(Fn,{value:String((M.topicValue||u.topicValue||B).toString()),onChange:R=>x(F=>F.map(Y=>Y.id===M.id?{...Y,topicValue:String(R)}:Y)),options:u.topicOptions,disabled:s,size:"sm",fullWidth:!0,dropdownPortal:!0}),t.jsx(Fn,{value:(M.categoryValue||u.categoryValue).toString(),onChange:R=>x(F=>F.map(Y=>Y.id===M.id?{...Y,categoryValue:String(R)}:Y)),options:u.categoryOptions,disabled:s,size:"sm",fullWidth:!0,dropdownPortal:!0}),y?t.jsx(at,{content:w,children:t.jsx("span",{style:{display:"block",minWidth:0},children:t.jsx("div",{style:{pointerEvents:"none"},children:t.jsx(t$,{value:String((M.locationQuery||"").toString()),disabled:!0,onChange:()=>{},onPick:()=>{}})})})}):t.jsx(t$,{value:String((M.locationQuery||"").toString()),disabled:s,onChange:R=>{x(F=>F.map(Y=>Y.id===M.id?{...Y,locationQuery:R,cityOverride:void 0,countryOverride:void 0,countryCodeOverride:void 0}:Y))},onPick:R=>{const F=E6(R.city,R.country,R.country_code);x(Y=>Y.map(H=>H.id===M.id?{...H,locationQuery:F,cityOverride:R.kind==="city"?R.city:void 0,countryOverride:R.country||void 0,countryCodeOverride:R.country_code||void 0}:H))}}),t.jsx(ptt,{type:"button","aria-label":"Remove prompt",title:"Remove",disabled:s||g.length<=1,onClick:()=>{g.length<=1||x(R=>R.filter(F=>F.id!==M.id))},children:t.jsx(Fi,{size:16})})]},M.id))]})}),t.jsx(mtt,{children:t.jsx(he,{type:"button",size:"sm",variant:"outline",disabled:s||g.length>=h,onClick:()=>{s||g.length>=h||x(M=>{const R=M[M.length-1],F=R?.topicValue??u.topicValue,Y=R?.categoryValue??u.categoryValue,H=y||!R?{countryOverride:void 0,countryCodeOverride:void 0,cityOverride:void 0,locationQuery:""}:{countryOverride:R.countryOverride,countryCodeOverride:R.countryCodeOverride,cityOverride:R.cityOverride,locationQuery:R.locationQuery||""};return[...M,{id:`row-${Date.now()}-${Math.floor(Math.random()*1e5)}`,content:"",categoryValue:Y,topicValue:F,...H}]})},children:"Add prompt"})})]})}):t.jsxs(ett,{children:[Array.isArray(m?.topicOptions)&&m.topicOptions.length>0&&m?.onTopicChange?t.jsxs(Jk,{children:[t.jsx(e$,{children:m?.topicLabel||"Topic"}),t.jsx(Fn,{value:(m?.topicValue||"").toString(),onChange:M=>m?.onTopicChange?.(String(M)),options:m?.topicOptions||[],disabled:s})]}):null,t.jsxs(Jk,{children:[t.jsx(e$,{children:m?.categoryLabel||"Category"}),t.jsx(Fn,{value:m?.categoryValue||"",onChange:M=>m?.onCategoryChange(String(M)),options:m?.categoryOptions||[],disabled:s})]}),m?.showLocation?t.jsxs(Jk,{children:[t.jsxs(e$,{style:{display:"inline-flex",alignItems:"center",gap:6},children:[t.jsx("span",{children:"Location override (optional)"}),t.jsx(at,{content:"Search and select a city or a country. Selecting a country sets a country override; selecting a city sets city + country.",children:t.jsx("span",{"aria-label":"Location override info",style:{display:"inline-flex",alignItems:"center",color:z},children:t.jsx(wn,{size:14})})})]}),t.jsx(d8,{children:"Leave blank to use the projectâs location."}),m?.lockLocationOverride?t.jsx(at,{content:w,children:t.jsx("span",{style:{display:"block",minWidth:0},children:t.jsx("div",{style:{pointerEvents:"none"},children:t.jsx(t$,{value:j,disabled:!0,onChange:()=>{},onPick:()=>{}})})})}):t.jsx(t$,{value:j,disabled:!!s,onChange:M=>{v(M),m?.onCountryChange?.(null),m?.onCityChange?.("")},onPick:M=>{const R=E6(M.city,M.country,M.country_code);v(R),m?.onCountryChange?.({name:M.country,code:M.country_code}),m?.onCityChange?.(M.kind==="city"?M.city:"")}})]}):null,t.jsxs(Jk,{children:[t.jsx(e$,{children:m?.promptLabel||"Prompt"}),t.jsx(rtt,{value:m?.promptValue||"",onChange:M=>m?.onPromptChange(M.target.value),placeholder:m?.promptPlaceholder||"Type a promptâ¦",disabled:s,maxLength:ni.promptContentMaxChars,onKeyDown:M=>
9212{M.key==="Enter"&&(M.metaKey||M.ctrlKey)&&(M.preventDefault(),m?.onAdd())}}),P?t.jsxs("div",{style:{fontSize:12,fontWeight:750,color:"rgba(107,114,128,0.9)"},children:["Prompt is limited to ",ni.promptContentMaxChars," characters."]}):null]})]})})}const htt=p.div.withConfig({displayName:"TopicsPromptsCardList__TopicsList",componentId:"sc-13x4h4w-0"})` 9213 display: flex; 9214 flex-direction: column; 9215 gap: 0.75rem; 9216`,ftt=p.div.withConfig({displayName:"TopicsPromptsCardList__ScrollArea",componentId:"sc-13x4h4w-1"})` 9217 max-height: calc(100vh - 22rem); 9218 overflow-y: auto; 9219 padding-right: 0.5rem; 9220 9221 &::-webkit-scrollbar { 9222 width: 6px; 9223 } 9224 &::-webkit-scrollbar-track { 9225 background: transparent; 9226 } 9227 &::-webkit-scrollbar-thumb { 9228 background: ${V}; 9229 border-radius: 9999px; 9230 } 9231`,gtt=p.div.withConfig({displayName:"TopicsPromptsCardList__TopicCard",componentId:"sc-13x4h4w-2"})` 9232 background: ${Z}; 9233 border: 1px solid ${Rt}; 9234 border-radius: 0.75rem; 9235 overflow: hidden; 9236 transition: border-color 0.15s ease, box-shadow 0.15s ease; 9237 9238 &:hover { 9239 border-color: ${ot}; 9240 box-shadow: 0 2px 10px rgba(17, 24, 39, 0.06); 9241 } 9242`,ytt=p.button.withConfig({displayName:"TopicsPromptsCardList__TopicHeader",componentId:"sc-13x4h4w-3"})` 9243 width: 100%; 9244 display: flex; 9245 align-items: center; 9246 justify-content: space-between; 9247 gap: 0.75rem; 9248 padding: 0.875rem 0.875rem; 9249 background: ${At}; 9250 border: none; 9251 cursor: pointer; 9252 text-align: left; 9253 9254 &:focus-visible { 9255 outline: none; 9256 box-shadow: 0 0 0 3px ${En}; 9257 } 9258`,xtt=p.div.withConfig({displayName:"TopicsPromptsCardList__TopicHeaderLeft",componentId:"sc-13x4h4w-4"})` 9259 display: flex; 9260 align-items: center; 9261 gap: 0.75rem; 9262 min-width: 0; 9263 flex: 1; 9264`,btt=p.div.withConfig({displayName:"TopicsPromptsCardList__Chevron",componentId:"sc-13x4h4w-5"})` 9265 display: flex; 9266 align-items: center; 9267 color: ${z}; 9268 transform: ${e=>e.$open?"rotate(0deg)":"rotate(-90deg)"}; 9269 transition: transform 0.2s ease; 9270`,vtt=p.div.withConfig({displayName:"TopicsPromptsCardList__TopicName",componentId:"sc-13x4h4w-6"})` 9271 font-size: 0.9375rem; 9272 font-weight: 650; 9273 color: ${O}; 9274 overflow: hidden; 9275 text-overflow: ellipsis; 9276 white-space: nowrap; 9277`,wtt=p.span.withConfig({displayName:"TopicsPromptsCardList__TopicCount",componentId:"sc-13x4h4w-7"})` 9278 font-size: 0.75rem; 9279 font-weight: 600; 9280 color: ${z}; 9281 background: ${$e}; 9282 border: 1px solid ${V}; 9283 padding: 0.125rem 0.5rem; 9284 border-radius: 9999px; 9285`,jtt=p.div.withConfig({displayName:"TopicsPromptsCardList__TopicHeaderRight",componentId:"sc-13x4h4w-8"})` 9286 display: flex; 9287 align-items: center; 9288 gap: 0.5rem; 9289`,_tt=p.button.withConfig({displayName:"TopicsPromptsCardList__AddPromptButton",componentId:"sc-13x4h4w-9"})` 9290 border: 1px solid ${Rt}; 9291 background: ${Z}; 9292 color: ${O}; 9293 border-radius: 0.5rem; 9294 padding: 0.375rem 0.5rem; 9295 display: inline-flex; 9296 align-items: center; 9297 gap: 0.375rem; 9298 cursor: pointer; 9299 transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease; 9300 9301 &:hover { 9302 background: ${$e}; 9303 border-color: ${z}; 9304 box-shadow: 0 2px 10px rgba(17, 24, 39, 0.06); 9305 } 9306 9307 &:disabled { 9308 opacity: 0.6; 9309 cursor: not-allowed; 9310 } 9311`,Ctt=p.div.withConfig({displayName:"TopicsPromptsCardList__PromptsContainer",componentId:"sc-13x4h4w-10"})` 9312 display: ${e=>e.$open?"block":"none"}; 9313 border-top: 1px solid ${Rt}; 9314 background: ${Z}; 9315`,Stt=p.div.withConfig({displayName:"TopicsPromptsCardList__PromptsGrid",componentId:"sc-13x4h4w-11"})` 9316 display: grid; 9317 grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); 9318 gap: 0.5rem; 9319 padding: 0.75rem; 9320 9321 @media (max-width: 768px) { 9322 grid-template-columns: 1fr; 9323 } 9324`,ktt=p.div.withConfig({displayName:"TopicsPromptsCardList__PromptCard",componentId:"sc-13x4h4w-12"})` 9325 position: relative; 9326 padding: 0.625rem 0.75rem; 9327 background: ${At}; 9328 border: 1px solid ${V}; 9329 border-radius: 0.5rem; 9330 transition: background-color 0.15s ease, border-color 0.15s ease; 9331 9332 &:hover { 9333 background: ${Z}; 9334 border-color: ${z}; 9335 } 9336`,$tt=p.div.withConfig({displayName:"TopicsPromptsCardList__PromptContent",componentId:"sc-13x4h4w-13"})` 9337 font-size: 0.8125rem; 9338 color: ${O}; 9339 line-height: 1.5; 9340 padding-right: 3.5rem; 9341 margin-bottom: 0.5rem; 9342 word-break: break-word; 9343`,Itt=p.textarea.withConfig({displayName:"TopicsPromptsCardList__PromptEditArea",componentId:"sc-13x4h4w-14"})` 9344 width: 100%; 9345 min-height: 5.5rem; 9346 max-height: 9.5rem; 9347 resize: vertical; 9348 border: 1px solid ${Rt}; 9349 border-radius: 0.5rem; 9350 padding: 0.5rem 3.5rem 0.5rem 0.6rem; /* leave room for action icons */ 9351 font-size: 0.8125rem; 9352 line-height: 1.45; 9353 color: ${O}; 9354 background: ${Z}; 9355 box-sizing: border-box; 9356 9357 &:focus { 9358 outline: none; 9359 border-color: ${ot}; 9360 box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.10); 9361 } 9362`,Ptt=p.div.withConfig({displayName:"TopicsPromptsCardList__PromptCategory",componentId:"sc-13x4h4w-15"})` 9363 display: inline-flex; 9364 align-items: center; 9365 gap: 0.25rem; 9366 font-size: 0.6875rem; 9367 font-weight: 650; 9368 color: ${ot}; 9369 background: rgba(79, 70, 229, 0.10); 9370 border: 1px solid rgba(79, 70, 229, 0.18); 9371 padding: 0.125rem 0.5rem; 9372 border-radius: 9999px; 9373 text-transform: capitalize; 9374`,Att=p.div.withConfig({displayName:"TopicsPromptsCardList__PromptActions",componentId:"sc-13x4h4w-16"})` 9375 position: absolute; 9376 top: 0.5rem; 9377 right: 0.5rem; 9378 display: inline-flex; 9379 align-items: center; 9380 gap: 0.25rem; 9381 z-index: 2; 9382`,n$=p.button.withConfig({displayName:"TopicsPromptsCardList__IconBtn",componentId:"sc-13x4h4w-17"})` 9383 width: 24px; 9384 height: 24px; 9385 border-radius: 0.5rem; 9386 border: none; 9387 background: transparent; 9388 color: ${z}; 9389 cursor: pointer; 9390 display: inline-flex; 9391 align-items: center; 9392 justify-content: center; 9393 9394 &:hover { 9395 background: ${$e}; 9396 } 9397 9398 &:disabled { 9399 opacity: 0.6;
9400 cursor: not-allowed; 9401 } 9402`;function gde({topics:e,expandedTopicIds:n,onToggleTopic:i,onAddPromptClick:r,onRemovePrompt:o,onEditPrompt:s,isAtMax:a,isSubmitting:c,isLoading:u,loadingText:m="Loading promptsâ¦",emptyText:h="No topics found."}){return u?t.jsx("div",{style:{color:z,fontSize:"0.8125rem"},children:m}):!e||e.length===0?t.jsx("div",{style:{color:z,fontSize:"0.8125rem"},children:h}):t.jsx(ftt,{children:t.jsx(htt,{children:e.map(g=>{const x=n.has(g.id);return t.jsxs(gtt,{children:[t.jsxs(ytt,{type:"button",onClick:()=>i(g.id),"aria-expanded":x,children:[t.jsxs(xtt,{children:[t.jsx(btt,{$open:x,children:t.jsx(qn,{size:18})}),t.jsx(vtt,{children:g.name}),t.jsx(wtt,{children:g.prompts.length})]}),t.jsx(jtt,{children:t.jsxs(_tt,{type:"button",disabled:!!a||!!c,onClick:y=>{y.stopPropagation(),r(g.id)},children:[t.jsx(gr,{size:16}),"Add prompt"]})})]}),t.jsx(Ctt,{$open:x,children:g.prompts.length===0?t.jsx("div",{style:{padding:"0.75rem",color:z,fontSize:"0.8125rem"},children:"No prompts yet. Click âAdd promptâ."}):t.jsx(Stt,{children:g.prompts.map(y=>{const w=`${g.id}::${y.id}`;return t.jsx(Ntt,{topicId:g.id,prompt:y,isSubmitting:c,onRemovePrompt:o,onEditPrompt:s},w)})})})]},g.id)})})})}
9402function Ntt({topicId:e,prompt:n,isSubmitting:i,onRemovePrompt:r,onEditPrompt:o}){const[s,a]=l.useState(!1),[c,u]=l.useState(n.content);l.useEffect(()=>{s||u(n.content)},[s,n.content]);const m=typeof o=="function",h=()=>{if(!m){a(!1);return}o(e,n.id,c),a(!1)},g=()=>{u(n.content),a(!1)};return t.jsxs(ktt,{children:[s?t.jsx(Itt,{value:c,onChange:x=>u(x.target.value),disabled:i,autoFocus:!0,maxLength:ni.promptContentMaxChars}):t.jsx($tt,{children:Gve(n.content)}),t.jsxs(Ptt,{children:[t.jsx(X_,{size:12}),n.category]}),t.jsxs(Att,{children:[m?s?t.jsxs(t.Fragment,{children:[t.jsx(n$,{type:"button","aria-label":"Save prompt",title:"Save",onClick:h,disabled:i,children:t.jsx(Zn,{size:14})}),t.jsx(n$,{type:"button","aria-label":"Cancel edit",title:"Cancel",onClick:g,disabled:i,children:t.jsx(Ei,{size:14})})]}):t.jsx(n$,{type:"button","aria-label":"Edit prompt",title:"Edit",onClick:()=>a(!0),disabled:i,children:t.jsx(Lc,{size:14})}):null,s?null:t.jsx(n$,{type:"button","aria-label":"Remove prompt",title:"Remove",onClick:()=>r(e,n.id),disabled:i,children:t.jsx(Fi,{size:14})})]})]})}const u8=["Organic Search","Brand Sentiment","Competitor Comparison"],mx=25,ztt=p.div.withConfig({displayName:"PromptsStep__LabelRow",componentId:"sc-1nj9e9l-0"})` 9403 display: flex; 9404 align-items: center; 9405 justify-content: space-between; 9406 gap: 0.75rem; 9407`,Ttt=p.span.withConfig({displayName:"PromptsStep__CounterPill",componentId:"sc-1nj9e9l-1"})` 9408 font-size: 0.75rem; 9409 font-weight: 700; 9410 color: ${z}; 9411 background: ${$e}; 9412 border: 1px solid ${V}; 9413 padding: 0.125rem 0.5rem; 9414 border-radius: 9999px; 9415 white-space: nowrap; 9416`;function Ett(){return u8.map(e=>({value:e,label:e}))}function Mtt(){const{setUser:e}=yn(),n=zn(),[i,r]=l.useState([]),[o,s]=l.useState(new Set),[a,c]=l.useState(!0),[u,m]=l.useState(!1),[h,g]=l.useState(null),[x,y]=l.useState(null),[w,j]=l.useState({content:"",category:u8[0]}),v=l.useMemo(()=>Ett(),[]),_=l.useMemo(()=>i.reduce((R,F)=>R+(Array.isArray(F.prompts)?F.prompts.length:0),0),[i]),$=_>=mx,k=l.useMemo(()=>i.map(R=>({id:String(R.id),name:R.name,prompts:(Array.isArray(R.prompts)?R.prompts:[]).map(F=>({id:String(F.id),content:F.content,category:F.category}))})),[i]);l.useEffect(()=>{let R=!1;return(async()=>{c(!0),g(null);try{const Y=await ue("/api/v1/onboarding/step_info?step_number=8",{method:"GET"});if(!Y.ok){g("Failed to load prompts");return}const H=await Y.json(),X=(Array.isArray(H?.topics)?H.topics:[]).map(Q=>({id:Number(Q?.id),name:String(Q?.name||"").trim(),prompts:(Array.isArray(Q?.prompts)?Q.prompts:[]).map(K=>({id:Number(K?.id),content:String(K?.content||"").trim(),category:String(K?.category||"").trim()}))})).filter(Q=>Number.isFinite(Q.id)&&Q.id>0);R||(r(X),s(new Set([String(X[0].id)])))}catch{R||g("Network error. Please try again.")}finally{R||c(!1)}})(),()=>{R=!0}},[]);const P=R=>{s(F=>{const Y=new Set(F);return Y.has(R)?Y.delete(R):Y.add(R),Y})},S=R=>{if($){g(`You can add up to ${mx} prompts.`);return}y(R),j({content:"",category:u8[0]})},I=()=>{y(null)},A=()=>{if(!x)return;if($){g(`You can add up to ${mx} prompts.`);return}const R=w.content.trim(),F=w.category;if(R){if(R.length>ni.promptContentMaxChars){g(`Prompt is too long (max ${ni.promptContentMaxChars} characters).`);return}r(Y=>Y.map(H=>{if(H.id!==x)return H;const U={id:Date.now(),content:R,category:F};return{...H,prompts:[...H.prompts,U]}})),s(Y=>new Set([...Y,String(x)])),g(null),I()}},E=(R,F)=>{r(Y=>Y.map(H=>H.id===R?{...H,prompts:H.prompts.filter(U=>U.id!==F)}:H))},B=(R,F,Y)=>{r(H=>H.map(U=>U.id!==R?U:{...U,prompts:U.prompts.map(X=>X.id===F?{...X,content:Y}:X)}))},T=async R=>{if(R.preventDefault(),u)return;const F=i.map(H=>({id:H.id,prompts:H.prompts.map(U=>({id:U.id>1e12?null:U.id,content:U.content.trim().toLowerCase(),category:U.category.trim().toLowerCase()})).filter(U=>U.content.trim().length>0&&U.category.trim().length>0)})),Y=F.reduce((H,U)=>H+U.prompts.length,0);if(Y===0){g("Please keep at least one prompt to continue.");return}if(Y>mx){g(`You can select a maximum of ${mx} prompts.`);return}m(!0),g(null);try{const H=await ue("/api/v1/onboarding/step",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({step_number:8,topics:F})});if(!H.ok){const X=await H.json().catch(()=>({}));g(X?.error||X?.errors?.[0]||"Failed to save prompts"),m(!1);return}const U=await H.json();
9416U?.user&&e(U.user),n("/onboarding?type=competitor_analysis",{replace:!0})}catch{g("Network error. Please try again."),m(!1)}},M=i.find(R=>R.id===x)||null;return t.jsxs(Wf,{children:[t.jsx(xa,{size:"small",topLeft:t.jsx(ph,{disabled:u||a})}),t.jsx(uh,{children:t.jsx(bl,{children:t.jsxs(vl,{children:[t.jsx(Vc,{currentStep:8,totalSteps:12}),t.jsxs(Yc,{children:[t.jsx(Wd,{children:"Review your prompts"}),t.jsx(Ud,{children:"Review and manage the prompts we generated. Add or remove prompts as needed."})]}),h&&t.jsx(Xs,{children:h}),t.jsxs(Ru,{onSubmit:T,children:[t.jsxs(Wo,{children:[t.jsxs(ztt,{children:[t.jsx(js,{children:"Topics & prompts"}),t.jsxs(Ttt,{children:[_,"/",mx]})]}),t.jsx(gde,{topics:k,expandedTopicIds:o,onToggleTopic:R=>P(R),onAddPromptClick:R=>S(Number(R)),onRemovePrompt:(R,F)=>E(Number(R),Number(F)),onEditPrompt:(R,F,Y)=>B(Number(R),Number(F),Y),isAtMax:$,isSubmitting:u,isLoading:a,loadingText:"Loading promptsâ¦",emptyText:i.length===0?"No topics found. Please complete the Topics step first.":"No topics found."})]}),t.jsx(Uf,{style:{justifyContent:"flex-end"},children:t.jsx(he,{type:"submit",variant:"nav",disabled:a||u||i.length===0,children:u?"Savingâ¦":"Continue"})})]})]})})}),t.jsx(u_,{isOpen:!!x,onClose:()=>{u||I()},title:M?`Add prompt to ${M.name}`:"Add prompt",description:"Add a new prompt and choose a category.",categoryValue:w.category,categoryOptions:v,onCategoryChange:R=>j(F=>({...F,category:R})),promptValue:w.content,onPromptChange:R=>j(F=>({...F,content:R})),onAdd:A,isSubmitting:u})]})}const Pg=10,Rtt=p.div.withConfig({displayName:"CompetitorsStep__LabelRow",componentId:"sc-sr3mix-0"})` 9417 display: flex; 9418 align-items: center; 9419 justify-content: space-between; 9420 gap: 0.75rem; 9421`,Ott=p(bl).withConfig({displayName:"CompetitorsStep__WideFormContainer",componentId:"sc-sr3mix-1"})` 9422 @media (min-width: 1024px) { 9423 max-width: 44rem; 9424 } 9425 9426 /* Keep the page from scrolling; allow only the list area to scroll. */ 9427 max-height: calc(100vh - 4rem); 9428 overflow: hidden; 9429`,Dtt=p(vl).withConfig({displayName:"CompetitorsStep__FixedHeightCard",componentId:"sc-sr3mix-2"})` 9430 display: flex; 9431 flex-direction: column; 9432 max-height: calc(100vh - 4rem); 9433`,Ltt=p(Ru).withConfig({displayName:"CompetitorsStep__FixedHeightForm",componentId:"sc-sr3mix-3"})` 9434 flex: 1; 9435 min-height: 0; 9436 gap: 1rem; 9437`,Btt=p.div.withConfig({displayName:"CompetitorsStep__ScrollArea",componentId:"sc-sr3mix-4"})` 9438 flex: 1; 9439 min-height: 0; 9440 overflow-y: auto; 9441 padding-right: 0.25rem; 9442 9443 &::-webkit-scrollbar {
9444 width: 6px; 9445 } 9446 &::-webkit-scrollbar-track { 9447 background: transparent; 9448 } 9449 &::-webkit-scrollbar-thumb { 9450 background: ${V}; 9451 border-radius: 9999px; 9452 } 9453`,Ftt=p.div.withConfig({displayName:"CompetitorsStep__AddRow",componentId:"sc-sr3mix-5"})` 9454 display: grid; 9455 grid-template-columns: minmax(0, 2.25fr) minmax(0, 1.55fr) auto; 9456 gap: 0.5rem; 9457 align-items: flex-start; 9458 9459 @media (max-width: 640px) { 9460 grid-template-columns: 1fr; 9461 } 9462`;function i$(e){try{const i=new URL(e).hostname.replace(/^www\./,""),r=i.split(".")[0]||i;return r.charAt(0).toUpperCase()+r.slice(1)}catch{return"Competitor"}}function r$(e){const n=(e||"").trim();if(!n)return null;try{return new URL(n.includes("://")?n:`https://${n}`).hostname?.toLowerCase().replace(/^www\./,"").trim()||null}catch{return null}}function Wtt(){const{setUser:e}=yn(),n=zn(),[i,r]=l.useState([]),[o,s]=l.useState([]),[a,c]=l.useState(null),[u,m]=l.useState(""),[h,g]=l.useState(""),[x,y]=l.useState(!0),[w,j]=l.useState(!1),[v,_]=l.useState(null),$="2rem",k=i.length+o.length,P=i.length>=Pg,S=l.useMemo(()=>{const T=new Set;return[...i,...o].forEach(M=>T.add(`${M.name.toLowerCase()}|${M.website.toLowerCase()}`)),T},[i,o]);l.useEffect(()=>{let T=!1;return(async()=>{y(!0),_(null);try{const R=await ue("/api/v1/onboarding/step_info?step_number=10",{method:"GET"});if(!R.ok){_("Failed to load competitors");return}const F=await R.json(),Y=Array.isArray(F?.direct)?F.direct:[],H=Array.isArray(F?.suggested)?F.suggested:[];if(!T){const U=Date.now(),X=Y.map((K,G)=>({id:Number(K?.id)>0?Number(K.id):U+G+Math.floor(Math.random()*1e6),name:String(K?.name||"").trim(),website:String(K?.website||K?.url||"").trim(),competitor_type:"direct",logo_url:K?.logo_url??null})).filter(K=>K.name&&K.website),Q=H.map((K,G)=>({id:Number(K?.id)>0?Number(K.id):U+1e5+G+Math.floor(Math.random()*1e6),name:String(K?.name||"").trim(),website:String(K?.website||K?.url||"").trim(),competitor_type:"suggested",logo_url:K?.logo_url??null})).filter(K=>K.name&&K.website);r(X),s(Q),c(typeof F?.project_website=="string"?F.project_website:null)}}catch{T||_("Network error. Please try again.")}finally{T||y(!1)}})(),()=>{T=!0}},[]);const I=()=>{if(P){_(`You can select a maximum of ${Pg} direct competitors.`);return}const T=Wl(h);if(!T){_("Please enter a valid competitor website (e.g., example.com or https://example.com)");return}const M=r$(a),R=r$(T);if(M&&R&&M===R){_("You can't add your own website as a competitor.");return}const F=String(u||"").trim();if(!F){_("Name is required."),m(i$(T));return}const Y=`${F.toLowerCase()}|${T.toLowerCase()}`;if(S.has(Y)){_("This competitor already exists.");return}r(H=>[...H,{id:Date.now(),name:F,website:T,competitor_type:"direct"}]),m(""),g(""),_(null)},A=T=>{r(M=>M.filter(R=>R.id!==T)),s(M=>M.filter(R=>R.id!==T))},E=(T,M)=>{if(T.competitor_type!==M)if(M==="direct"){if(i.length>=Pg){_(`You can select a maximum of ${Pg} direct competitors.`);return}s(R=>R.filter(F=>F.id!==T.id)),r(R=>[...R,{...T,competitor_type:"direct"}])}else r(R=>R.filter(F=>F.id!==T.id)),s(R=>[...R,{...T,competitor_type:"suggested"}])},B=async T=>{if(T.preventDefault(),w)return;const M=r$(a);if(M&&[...i,...o].some(Y=>r$(Y.website)===M)){_("Remove your own website from the competitors list before continuing.");return}if(i.length+o.length===0){_("Please keep at least one competitor.");return}if(i.length>Pg){_(`You can select a maximum of ${Pg} direct competitors.`);return}j(!0),_(null);try{const F=await ue("/api/v1/onboarding/step",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({step_number:10,direct:i.map(U=>({name:U.name.trim().toLowerCase(),website:U.website.trim().toLowerCase()})),suggested:o.map(U=>({name:U.name.trim().toLowerCase(),website:U.website.trim().toLowerCase()}))})});if(!F.ok){const U=await F.json().catch(()=>({}));_(U?.error||U?.errors?.[0]||"Failed to save competitors"),j(!1);return}const Y=await F.json();Y?.user&&e(Y.user);const H=Y?.next_step_number;if(H===12){n("/onboarding?type=report",{replace:!0});return}if(H==null){const U=Number(Y?.organization_id),X=Number(Y?.project_id);if(Number.isFinite(U)&&U>0&&Number.isFinite(X)&&X>
94620){n(`/workspaces/${U}/projects/${X}`,{replace:!0});return}n("/",{replace:!0});return}n("/onboarding?type=report",{replace:!0})}catch{_("Network error. Please try again."),j(!1)}};return t.jsxs(Wf,{children:[t.jsx(xa,{size:"small",topLeft:t.jsx(ph,{disabled:w||x})}),t.jsx(uh,{children:t.jsx(Ott,{children:t.jsxs(Dtt,{children:[t.jsx(Vc,{currentStep:10,totalSteps:12}),t.jsxs(Yc,{children:[t.jsx(Wd,{children:"Review your competitors"}),t.jsx(Ud,{children:"Review and manage the competitors we found. You can add more competitors later."})]}),v&&t.jsx(Xs,{children:v}),t.jsxs(Ltt,{onSubmit:B,children:[t.jsxs(Wo,{children:[t.jsx(Rtt,{children:t.jsx(js,{children:"Competitors"})}),t.jsxs(Ftt,{children:[t.jsx(EA,{value:h,onChange:T=>{const M=T.target.value;if(g(M),String(u||"").trim())return;const R=Wl(M);R&&m(i$(R))},placeholder:"example.com or https://example.com",iconSize:18,size:"sm",style:{height:$},disabled:x||w||P,onBlur:()=>{if(String(u||"").trim())return;const T=Wl(h);T&&m(i$(T))},onKeyDown:T=>{T.key==="Enter"&&(T.preventDefault(),I())}}),t.jsx(Xt,{value:u,onChange:T=>m(T.target.value),placeholder:"Name",disabled:x||w||P,size:"sm",style:{height:$},onBlur:()=>{if(String(u||"").trim())return;const M=Wl(h);M&&m(i$(M))}}),t.jsxs(he,{type:"button",onClick:I,disabled:!h.trim()||!u.trim()||x||w||P,size:"sm",style:{height:$},children:[t.jsx(gr,{size:16}),"Add"]})]}),t.jsx(_s,{children:"Add a competitor by website."})]}),t.jsx(Btt,{children:t.jsx(jre,{direct:i.map(T=>({...T,competitor_type:"direct"})),suggested:o.map(T=>({...T,competitor_type:"suggested"})),effectiveMax:Pg,isLoading:x,isSaving:w,scrollMode:"outer",forceLogoDev:!0,onSetType:(T,M)=>E(T,M),onRemove:T=>A(T)})}),t.jsx(Uf,{style:{justifyContent:"flex-end"},children:t.jsx(he,{type:"submit",variant:"nav",disabled:x||w||k===0,children:w?"Savingâ¦":"Continue"})})]})]})})})]})}var pK="POLAR_CHECKOUT",p8=class Kj{iframe;loader;loaded;closable;eventTarget;constructor(n,i){this.iframe=n,this.loader=i,this.loaded=!1,this.closable=!0,this.eventTarget=new EventTarget,this.initWindowListener(),this.addEventListener("loaded",this.loadedListener.bind(this)),this.addEventListener("close",this.closeListener.bind(this)),this.addEventListener("confirmed",this.confirmedListener.bind(this)),this.addEventListener("success",this.successListener.bind(this))}static postMessage(n,i){window.parent.postMessage({...n,type:pK},i)}static async create(n,i){const r=document.createElement("style");r.innerText=` 9463 .polar-loader-spinner { 9464 width: 20px; 9465 aspect-ratio: 1; 9466 border-radius: 50%; 9467 background: ${i==="dark"?"#000":"#fff"}; 9468 box-shadow: 0 0 0 0 ${i==="dark"?"#fff":"#000"}; 9469 animation: polar-loader-spinner-animation 1s infinite; 9470 } 9471 @keyframes polar-loader-spinner-animation { 9472 100% {box-shadow: 0 0 0 30px #0000} 9473 } 9474 body.polar-no-scroll { 9475 overflow: hidden; 9476 } 9477 `,document.head.appendChild(r);const o=document.createElement("div");o.style.position="absolute",o.style.top="50%",o.style.left="50%",o.style.transform="translate(-50%, -50%)",o.style.zIndex="2147483647",o.style.colorScheme="auto";const s=document.createElement("div");s.className="polar-loader-spinner",o.appendChild(s),document.body.classList.add("polar-no-scroll"),document.body.appendChild(o);const a=new URL(n);a.searchParams.set("embed","true"),a.searchParams.set("embed_origin",window.location.origin),i&&a.searchParams.set("theme",i);const c=a.toString(),u=document.createElement("iframe");u.src=c,u.style.position="fixed",u.style.top="0",u.style.left="0",u.style.width="100%",u.style.height="100%",u.style.border="none",u.style.zIndex="2147483647",u.style.backgroundColor="rgba(0, 0, 0, 0.5)",u.style.colorScheme="auto";const m="https://polar.sh,https://sandbox.polar.sh".split(",").join(" ");u.allow=`payment 'self' ${m}; publickey-credentials-get 'self' ${m};`,document.body.appendChild(u);const h=new Kj(u,o);return new Promise(g=>{h.addEventListener("loaded",()=>g(h),{once:!0})})}static init(){document.querySelectorAll("[data-polar-checkout]").forEach(n=>{n.removeEventListener("click",Kj.checkoutElementClickHandler),n.addEventListener("click",Kj.checkoutElementClickHandler)})}close(){document.body.contains(this.iframe)&&document.body.removeChild(this.iframe),document.body.classList.remove("polar-no-scroll")}addEventListener(n,i,r){this.eventTarget.addEventListener(n,i,r)}removeEventListener(n,i){this.eventTarget.removeEventListener(n,i)}static async checkoutElementClickHandler(n){n.preventDefault();let i=n.target;for(;!i.hasAttribute("data-polar-checkout");){if(!i.parentElement)return;i=i.parentElement}const r=i.getAttribute("href")||i.getAttribute("data-polar-checkout"),o=i.getAttribute("data-polar-checkout-theme");Kj.create(r,o)}loadedListener(n){n.defaultPrevented||this.loaded||(document.body.removeChild(this.loader),this.loaded=!0)}closeListener(n){n.defaultPrevented||this.closable&&this.close()}confirmedListener(n){n.defaultPrevented||(this.closable=!1)}successListener(n){n.defaultPrevented||(this.closable=!0,n.detail.redirect&&(window.location.href=n.detail.successURL))}initWindowListener(){window.addEventListener("message",({data:n,origin:i})=>{"https://polar.sh,https://sandbox.polar.sh".split(",").includes(i)&&n.type===pK&&this.eventTarget.dispatchEvent(new CustomEvent(n.event,{detail:n,cancelable:!0}))})}};if(typeof window<"u"&&(window.Polar={EmbedCheckout:p8}),typeof document<"u"){const e=document.currentScript;e&&e.hasAttribute("data-auto-init")&&document.addEventListener("DOMContentLoaded",async()=>{p8.init()})}const Utt={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_API_BASE_URL:"https://api.ceyo.ai",VITE_GOOGLE_CLIENT_ID:"3060223414-c3ngohsct14tfnijh2srgbp8vgss8rh5.apps.googleusercontent.com",VITE_LOGO_DEV_API_KEY:"pk_eOyLh-37TqSd1_-2bGUeIQ",VITE_LOGO_DEV_ONLY:"true",VITE_PRICING_URL:"https://www.ceyo.ai/pricing",VITE_PRIVACY_POLICY_URL:"https://www.ceyo.ai/privacy",VITE_SIGNUP_MODE:"open",V
9477ITE_TERMS_OF_SERVICE_URL:"https://www.ceyo.ai/terms"};async function GO(e,n,i){const r=String(e||"").trim();if(!r)throw new Error("Missing checkout URL");try{const o=await p8.create(r,n);let s=!1;const a=(()=>{try{return String(Utt?.VITE_POLAR_EMBED_DEBUG||"").trim()==="true"}catch{return!1}})(),c=(...u)=>{a&&console.info("[polar-embed]",...u)};return o.addEventListener("confirmed",()=>{c("event: confirmed")}),o.addEventListener("success",()=>{if(c("event: success"),!s){s=!0;try{o.close?.()}catch{}i.onSuccess()}}),o.addEventListener("close",()=>{c("event: close"),!s&&(s=!0,i.onClose())}),o}catch(o){throw console.warn("[polar-embed] failed to open embed, falling back",o),i.onErrorFallback?.(),o}}const Htt=Tn` 9478 to { transform: rotate(360deg); } 9479`,qtt=p.div.withConfig({displayName:"BillingConfirmOverlay__Overlay",componentId:"sc-10i5b8e-0"})` 9480 position: fixed; 9481 inset: 0; 9482 z-index: 20000; /* above modals */ 9483 background: rgba(17, 24, 39, 0.25); 9484 display: flex; 9485 align-items: center; 9486 justify-content: center; 9487 padding: 1rem; 9488`,Gtt=p.div.withConfig({displayName:"BillingConfirmOverlay__Card",componentId:"sc-10i5b8e-1"})` 9489 width: min(28rem, 92vw); 9490 background: ${Z}; 9491 border: 1px solid ${V}; 9492 border-radius: 0.9rem; 9493 padding: 1rem; 9494 box-shadow: 0 18px 45px rgba(0, 0, 0, 0.18); 9495`,Vtt=p.div.withConfig({displayName:"BillingConfirmOverlay__Row",componentId:"sc-10i5b8e-2"})` 9496 display: flex; 9497 align-items: center; 9498 gap: 0.75rem; 9499`,Ktt=p.div.withConfig({displayName:"BillingConfirmOverlay__Spinner",componentId:"sc-10i5b8e-3"})` 9500 width: 18px; 9501 height: 18px; 9502 border-radius: 9999px; 9503 border: 2px solid ${Rt}; 9504 border-top-color: ${O}; 9505 animation: ${Htt} 0.8s linear infinite; 9506`,Ytt=p.div.withConfig({displayName:"BillingConfirmOverlay__Title",componentId:"sc-10i5b8e-4"})` 9507 font-size: 0.9375rem; 9508 font-weight: 800; 9509 color: ${O}; 9510`,Xtt=p.div.withConfig({displayName:"BillingConfirmOverlay__Meta",componentId:"sc-10i5b8e-5"})` 9511 margin-top: 0.35rem; 9512 font-size: 0.8125rem; 9513 font-weight: 650; 9514 color: ${z}; 9515 line-height: 1.4; 9516`;function m8({isOpen:e,title:n="Confirming billingâ¦",message:i="This can take a few seconds. Keep this tab open while we activate your workspace."}){return e?t.jsx(qtt,{role:"status","aria-live":"polite",children:t.jsxs(Gtt,{children:[t.jsxs(Vtt,{children:[t.jsx(Ktt,{"aria-hidden":!0}),t.jsx(Ytt,{children:n})]}),t.jsx(Xtt,{children:i})]})}):null}const oy=ot,F_=Ft,Qtt=Kl,mh=O,Hf=z,mK=24e4,hK=60,Ztt=[{name:"Core",description:"For getting started",monthlyPriceUsd:49,yearlyPriceUsd:39,trialDays:0,models:[{key:"gemini",label:"Gemini",Icon:wu},{key:"chatgpt",label:"ChatGPT",Icon:ju}],promptsPerDay:30,support:"Email",projects:1,monthlyCredits:120,countries:1,googleAnalytics:!0,dataHistory:"6 months",apiAccess:!1},{name:"Grow",description:"For growing teams",featured:!0,monthlyPriceUsd:149,yearlyPriceUsd:119,trialDays:7,models:[{key:"gemini",label:"Gemini",Icon:wu},{key:"chatgpt",label:"ChatGPT",Icon:ju},{key:"aioverview",label:"AI Overview",Icon:ya}],promptsPerDay:125,support:"Email + chat",projects:5,monthlyCredits:500,countries:"Unlimited",googleAnalytics:!0,dataHistory:"Unlimited",apiAccess:!1},{name:"Pro+",description:"For advanced usage",monthlyPriceUsd:499,yearlyPriceUsd:399,trialDays:7,models:[{key:"gemini",label:"Gemini",Icon:wu},{key:"chatgpt",label:"ChatGPT",Icon:ju},{key:"aioverview",label:"AI Overview",Icon:ya},{key:"perplexity",label:"Perplexity",Icon:ih}],promptsPerDay:500,support:"Email + chat",projects:"Unlimited",monthlyCredits:1900,countries:"Unlimited",googleAnalytics:!0,dataHistory:"Unlimited",apiAccess:!0}];function fK(e){return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:e%1===0?0:2,maximumFractionDigits:e%1===0?0:2}).format(e)}function Jtt({monthly:e,yearlyPerMonth:n}){if(!e||!n||e<=0)return 0;const i=Math.round((1-n/e)*100);return Math.max(0,Math.min(99,i))}const gK=p.div.withConfig({displayName:"ReportStep__EmptyState",componentId:"sc-1euoal5-0"})` 9517 text-align: center; 9518 padding: 3rem 1rem; 9519 color: ${Hf}; 9520 font-size: 0.875rem; 9521`,ent=p.div.withConfig({displayName:"ReportStep__Page",componentId:"sc-1euoal5-1"})` 9522 min-height: 100vh; 9523 background-color: ${At}; 9524 overflow-x: hidden; 9525 9526 @media (min-width: 1024px) { 9527 height: 100vh; 9528 overflow: auto; 9529 } 9530`,tnt=p.div.withConfig({displayName:"ReportStep__PageInner",componentId:"sc-1euoal5-2"})` 9531 max-width: 72rem; 9532 margin: 0 auto; 9533 padding: 1rem 0.875rem 1.75rem; 9534 box-sizing: border-box; 9535 display: flex; 9536 flex-direction: column; 9537 gap: 0.625rem; 9538 min-width: 0; 9539 overflow-x: hidden; 9540 9541 @media (min-width: 768px) { 9542 padding: 1.25rem 1.5rem 1.25rem; 9543 } 9544 9545 @media (min-width: 1024px) { 9546 height: 100%; 9547 display: grid; 9548 grid-template-rows: auto 1fr; 9549 gap: 0.5rem; 9550 min-height: 0; 9551 } 9552`,nnt=p.div.withConfig({displayName:"ReportStep__TopBar",componentId:"sc-1euoal5-3"})` 9553 display: flex; 9554 flex-direction: column; 9555 gap: 0.75rem; 9556 flex: 0 0 auto; 9557 min-width: 0; 9558 9559 @media (min-width: 768px) { 9560 flex-direction: row; 9561 align-items: flex-start; 9562 justify-content: space-between; 9563 gap: 1.5rem; 9564 } 9565`,int=p.div.withConfig({displayName:"ReportStep__TitleBlock",componentId:"sc-1euoal5-4"})` 9566 min-width: 0; 9567`,rnt=p.h1.withConfig({displayName:"ReportStep__PageTitle",componentId:"sc-1euoal5-5"})` 9568 margin: 0; 9569 font-size: 1.5rem; 9570 font-weight: 800; 9571 letter-spacing: -0.02em; 9572 line-height: 1.15; 9573 color: ${mh}; 9574 9575 @media (min-width: 768px) { 9576 font-size: 1.875rem; 9577 } 9578`,ont=p.p.withConfig({displayName:"ReportStep__PageSubtitle",componentId:"sc-1euoal5-6"})` 9579 margin: 0.5rem 0 0 0; 9580 color: ${Hf}; 9581 font-size: 0.875rem; 9582 line-height: 1.6; 9583`,snt=p.div.withConfig({displayName:"ReportStep__Controls",componentId:"sc-1euoal5-7"})` 9584 display: flex; 9585 align-items: center; 9586 justify-content: flex-start; 9587 gap: 0.75rem; 9588 flex-wrap: wrap; 9589 width: 100%; 9590 9591 @media (min-width: 768px) { 9592 justify-content: flex-end; 9593 width: auto; 9594 } 9595`,ant=p.div.withConfig({displayName:"ReportStep__ToggleWrap",componentId:"sc-1euoal5-8"})` 9596 display: inline-flex; 9597 background: ${Z}; 9598 border: 1px solid ${V}; 9599 border-radius: 9999px; 9600 padding: 0.25rem; 9601 box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04); 9602 max-width: 100%; 9603`,yK=p.button.withConfig({displayName:"ReportStep__ToggleButton",componentId:"sc-1euoal5-9"})` 9604 border: 0; 9605 background: ${e=>e.$active?`linear-gradient(135deg, ${oy}, ${F_})`:"transparent"}; 9606 color: ${e=>e.$active?Z:Hf}; 9607 font-weight: 700; 9608 font-size: 0.75rem; 9609 padding: 0.45rem 0.7rem; 9610 border-radius: 9999px; 9611 cursor: pointer; 9612 transition: all 0.2s; 9613 font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", 9614 "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; 9615 9616 &:hover { 9617 color: ${e=>e.$active?Z:mh}; 9618 } 9619 9620 &:focus { 9621 outline: none; 9622 box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15); 9623 } 9624`,lnt=p.div.withConfig({displayName:"ReportStep__PlansGrid",componentId:"sc-1euoal5-10"})` 9625 display: grid; 9626 grid-template-columns: 1fr; 9627 gap: 0.875rem; 9628 padding-top: 0.5rem; 9629 width: 100%; 9630 min-width: 0; 9631 9632 @media (min-width: 1024px) { 9633 grid-template-columns: repeat(3, minmax(0, 1fr)); 9634 gap: 1.25rem;
9635 align-items: stretch; 9636 flex: 1 1 auto; 9637 padding-top: 0.5rem; 9638 } 9639`,cnt=p.div.withConfig({displayName:"ReportStep__PlanCard",componentId:"sc-1euoal5-11"})` 9640 background-color: ${Z}; 9641 border: 2px solid ${e=>e.$featured?oy:V}; 9642 border-radius: 1rem; 9643 padding: ${e=>e.$featured?"1.15rem 1.05rem 0.8rem 1.05rem":"0.9rem 1.05rem 0.8rem 1.05rem"}; 9644 display: flex; 9645 flex-direction: column; 9646 gap: 0.6rem; 9647 position: relative; 9648 transition: all 0.3s ease; 9649 min-width: 0; 9650 width: 100%; 9651 box-sizing: border-box; 9652 9653 &:hover { 9654 border-color: ${e=>e.$featured?F_:Rt}; 9655 box-shadow: 0 10px 20px rgba(17, 24, 39, 0.08); 9656 } 9657 9658 @media (min-width: 1024px) { 9659 min-height: 0; 9660 } 9661`,dnt=p.div.withConfig({displayName:"ReportStep__FeaturedBadge",componentId:"sc-1euoal5-12"})` 9662 position: absolute; 9663 top: 0.5rem; 9664 left: 50%; 9665 transform: translateX(-50%); 9666 background: linear-gradient(135deg, ${oy}, ${F_}); 9667 color: white; 9668 padding: 0.25rem 0.875rem; 9669 border-radius: 9999px; 9670 font-size: 0.6875rem; 9671 font-weight: 600; 9672 box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3); 9673`,unt=p.div.withConfig({displayName:"ReportStep__PlanHeader",componentId:"sc-1euoal5-13"})` 9674 display: flex; 9675 flex-direction: column; 9676 gap: 0.4rem; 9677`,pnt=p.h3.withConfig({displayName:"ReportStep__PlanName",componentId:"sc-1euoal5-14"})` 9678 font-size: 1.125rem; 9679 font-weight: 800; 9680 color: ${mh}; 9681 margin: 0; 9682`,mnt=p.p.withConfig({displayName:"ReportStep__PlanDescription",componentId:"sc-1euoal5-15"})` 9683 font-size: 0.75rem; 9684 color: ${Hf}; 9685 margin: 0; 9686`,hnt=p.div.withConfig({displayName:"ReportStep__PriceBlock",componentId:"sc-1euoal5-16"})` 9687 display: flex; 9688 align-items: center; 9689 justify-content: space-between; 9690 gap: 0.75rem; 9691 padding: 0.7rem 0.8rem; 9692 border-radius: 0.9rem; 9693 background: ${$e}; 9694 border: 1px solid ${V}; 9695`,fnt=p.div.withConfig({displayName:"ReportStep__PriceLeft",componentId:"sc-1euoal5-17"})` 9696 display: flex; 9697 flex-direction: column; 9698 gap: 0.15rem; 9699`,gnt=p.div.withConfig({displayName:"ReportStep__PriceRight",componentId:"sc-1euoal5-18"})` 9700 display: flex; 9701 align-items: center; 9702 justify-content: flex-end; 9703 gap: 0.5rem; 9704 min-width: 0; 9705`,ynt=p.div.withConfig({displayName:"ReportStep__DiscountPill",componentId:"sc-1euoal5-19"})` 9706 display: inline-flex; 9707 align-items: center; 9708 gap: 0.35rem; 9709 padding: 0.35rem 0.55rem; 9710 border-radius: 9999px; 9711 background: ${Ry}; 9712 color: ${Vt}; 9713 font-weight: 800; 9714 font-size: 0.75rem; 9715 line-height: 1; 9716 white-space: nowrap; 9717`,xnt=p.span.withConfig({displayName:"ReportStep__DiscountIcon",componentId:"sc-1euoal5-20"})` 9718 display: inline-flex; 9719 width: 14px; 9720 height: 14px; 9721 9722 svg { 9723 width: 14px; 9724 height: 14px; 9725 display: block; 9726 } 9727`,bnt=p.span.withConfig({displayName:"ReportStep__Strike",componentId:"sc-1euoal5-21"})` 9728 text-decoration: line-through; 9729 color: ${Hf}; 9730 font-weight: 700; 9731`,vnt=p.div.withConfig({displayName:"ReportStep__PriceRow",componentId:"sc-1euoal5-22"})` 9732 display: flex; 9733 align-items: baseline; 9734 gap: 0.35rem; 9735 font-weight: 900; 9736 letter-spacing: -0.02em; 9737 color: ${mh}; 9738`,wnt=p.span.withConfig({displayName:"ReportStep__PriceNumber",componentId:"sc-1euoal5-23"})` 9739 font-size: 1.65rem; 9740 line-height: 1; 9741`,jnt=p.span.withConfig({displayName:"ReportStep__PriceSuffix",componentId:"sc-1euoal5-24"})` 9742 font-size: 0.8rem; 9743 font-weight: 700; 9744 color: ${Hf}; 9745`,_nt=p.div.withConfig({displayName:"ReportStep__PriceNote",componentId:"sc-1euoal5-25"})` 9746 font-size: 0.75rem; 9747 color: ${Hf}; 9748`,Cnt=p.ul.withConfig({displayName:"ReportStep__PlanFeaturesList",componentId:"sc-1euoal5-26"})` 9749 list-style: none; 9750 padding: 0; 9751 margin: 0; 9752 display: flex; 9753 flex-direction: column; 9754 gap: 0.45rem; 9755 flex: 1; 9756`,iu=p.li.withConfig({displayName:"ReportStep__PlanFeatureItem",componentId:"sc-1euoal5-27"})` 9757 display: flex; 9758 align-items: flex-start; 9759 justify-content: space-between; 9760 gap: 1rem; 9761 font-size: 0.78rem; 9762 color: ${mh}; 9763 padding: 0.25rem 0; 9764`,ru=p.div.withConfig({displayName:"ReportStep__PlanCheckIcon",componentId:"sc-1euoal5-28"})` 9765 width: 18px; 9766 height: 18px; 9767 border-radius: 50%; 9768 background-color: #10b981; 9769 display: flex; 9770 align-items: center; 9771 justify-content: center; 9772 flex-shrink: 0; 9773 color: white; 9774`,ou=p.div.withConfig({displayName:"ReportStep__FeatureLeft",componentId:"sc-1euoal5-29"})` 9775 display: flex; 9776 align-items: center; 9777 gap: 0.65rem; 9778 min-width: 0; 9779`,su=p.span.withConfig({displayName:"ReportStep__FeatureLabel",componentId:"sc-1euoal5-30"})` 9780 font-weight: 700; 9781 color: ${Hf}; 9782 min-width: 0; 9783 letter-spacing: -0.01em; 9784`,mm=p.span.withConfig({displayName:"ReportStep__FeatureValue",componentId:"sc-1euoal5-31"})` 9785 font-weight: 700; 9786 color: ${mh}; 9787 text-align: right; 9788`,xK=p.div.withConfig({displayName:"ReportStep__ModelsRow",componentId:"sc-1euoal5-32"})` 9789 display: flex; 9790 flex-wrap: wrap; 9791 gap: 0.5rem; 9792 justify-content: flex-end; 9793`,bK=p.div.withConfig({displayName:"ReportStep__ModelPill",componentId:"sc-1euoal5-33"})` 9794 display: inline-flex; 9795 align-items: center; 9796 justify-content: center; 9797 width: 28px; 9798 height: 28px; 9799 padding: 0; 9800 border-radius: 9999px; 9801 border: 1px solid ${V}; 9802 background: ${Z}; 9803 color: ${mh}; 9804 line-height: 1; 9805`,vK=p.span.withConfig({displayName:"ReportStep__ModelIconWrap",componentId:"sc-1euoal5-34"})` 9806 display: inline-flex; 9807 width: 12px; 9808 height: 12px; 9809 color: ${mh}; 9810 9811 svg { 9812 width: 12px; 9813 height: 12px; 9814 display: block; 9815 } 9816`,Snt=p.button.withConfig({displayName:"ReportStep__PlanButton",componentId:"sc-1euoal5-35"})` 9817 width: 100%; 9818 padding: 0.65rem 0.9rem; 9819 background: ${e=>e.$featured?`linear-gradient(135deg, ${oy}, ${F_})`:Z}; 9820 color: ${e=>e.$featured?"white":oy}; 9821 border: 2px solid ${e=>e.$featured?"transparent":oy}; 9822 border-radius: 0.75rem; 9823 font-size: 0.875rem; 9824 font-weight: 600; 9825 cursor: pointer; 9826 transition: all 0.2s; 9827 font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", 9828 "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; 9829 9830 &:hover:not(:disabled) { 9831 transform: translateY(-2px); 9832 box-shadow: ${e=>e.$featured?"0 6px 16px rgba(79, 70, 229, 0.4)":"0 4px 12px rgba(79, 70, 229, 0.2)"}; 9833 background: ${e=>e.$featured?`linear-gradient(135deg, ${F_}, ${Qtt}
9833)`:oy}; 9834 color: white; 9835 } 9836 9837 &:active:not(:disabled) { 9838 transform: translateY(0); 9839 } 9840 9841 &:disabled { 9842 opacity: 0.6; 9843 cursor: not-allowed; 9844 } 9845 9846 &:focus { 9847 outline: none; 9848 box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15); 9849 } 9850 9851 @media (min-width: 1024px) { 9852 margin-top: auto; 9853 } 9854`,knt=p.button.withConfig({displayName:"ReportStep__RetryButton",componentId:"sc-1euoal5-36"})` 9855 border: 1px solid ${V}; 9856 background: ${Z}; 9857 color: ${mh}; 9858 padding: 0.55rem 0.8rem; 9859 border-radius: 0.75rem; 9860 font-size: 0.875rem; 9861 font-weight: 700; 9862 cursor: pointer; 9863 transition: all 0.2s; 9864 9865 &:hover:not(:disabled) { 9866 border-color: ${Rt}; 9867 box-shadow: 0 6px 14px rgba(17, 24, 39, 0.08); 9868 transform: translateY(-1px); 9869 } 9870 9871 &:disabled { 9872 opacity: 0.6; 9873 cursor: not-allowed; 9874 } 9875`;function $nt(){const{setUser:e,user:n}=yn(),{hydrateProjects:i,setSelectedProjectId:r}=Mr(),o=zn(),[s]=yr(),[a,c]=l.useState(!0),[u,m]=l.useState(null),[h,g]=l.useState(!1),[x,y]=l.useState(!1),[w,j]=l.useState(!1),[v,_]=l.useState(!1),[,$]=l.useState(0),[k,P]=l.useState(null),[S,I]=l.useState(null),[A,E]=l.useState(null),[B,T]=l.useState("monthly"),M=l.useRef(null);l.useEffect(()=>{if(!u||v)return;const X=window.setTimeout(()=>m(null),6500);return()=>window.clearTimeout(X)},[u,v]),l.useEffect(()=>{let X=!0;async function Q(){c(!0),m(null);try{const K=await ue("/api/v1/onboarding/step_info?step_number=12");if(!K.ok){const q=await K.json().catch(()=>({}));throw new Error(q?.error||"Failed to load plan selection")}const G=await K.json();if(!X)return;const L=G?.project||{};I(typeof L?.organization_id=="number"?L.organization_id:null),E(typeof L?.id=="number"?L.id:null)}catch(K){if(!X)return;m(K instanceof Error?K.message:"Network error. Please try again.")}finally{if(!X)return;c(!1)}}return Q(),()=>{X=!1}},[]);const R=l.useMemo(()=>{const X=(s.get("checkout")||"").toLowerCase();return X==="success"?"success":X==="cancel"?"cancel":null},[s]),F=()=>{M.current&&(M.current.cancelled=!0),M.current?.timer&&window.clearTimeout(M.current.timer),M.current=null},Y=()=>{F(),g(!0),j(!0),_(!1),$(0),m(null);const X=Date.now(),Q={cancelled:!1,timer:null};M.current=Q;const K=async G=>{if(!Q.cancelled){$(G+1);try{const L=await ue("/api/v1/onboarding/step",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({step_number:12,checkout_confirmed:!0})}),q=await L.json().catch(()=>({}));if(Q.cancelled)return;if(L.ok){q?.user&&e(q.user),y(!0),j(!1),m(null);return}const W=String(q?.error||q?.errors?.[0]||""),oe=Date.now()-X;if(!(L.status===422||W.toLowerCase().includes("billing not confirmed")||W.toLowerCase().includes("pending"))||oe>mK||G+1>=hK){m(W||"Billing confirmation is taking longer than expected. Please try again in a moment, or retry billing confirmation."),g(!1),j(!1),_(!0);return}const de=Math.min(8e3,800+G*500);Q.timer=window.setTimeout(()=>void K(G+1),de)}catch{if(Q.cancelled)return;if(Date.now()-X>mK||G+1>=hK){m("Network error while confirming billing. Please retry billing confirmation."),g(!1),j(!1),_(!0);return}Q.timer=window.setTimeout(()=>void K(G+1),2e3)}}};K(0)};async function H(X,Q){try{const K=await ue(`/api/v1/organizations/${X}/projects`,{method:"GET"}),G=await K.json().catch(()=>({}));if(K.ok){const q=(Array.isArray(G?.projects)?G.projects:[]).map(W=>({id:Number(W?.id),custom_identifier:W?.custom_identifier!=null?String(W.custom_identifier):null,name:String(W?.name||""),website:String(W?.website||""),logo_url:W?.logo_url?String(W.logo_url):null,description:W?.description!=null?String(W.description):null,description_autofetched:!!W?.description_autofetched,logo_autofetched:!!W?.logo_autofetched,city:W?.city!=null?String(W.city):null,country:W?.country!=null?String(W.country):null,country_code:W?.country_code!=null?String(W.country_code):null,language:W?.language!=null?String(W.language):null,focus:W?.focus!=null?String(W.focus):null,initial_crunching:!!W?.initial_crunching,is_crunching:!!W?.is_crunching,has_successful_run:!!W?.has_successful_run,project_role:W?.project_role==="viewer"||W?.project_role==="editor"?W.project_role:null,can:W?.can&&typeof W.can=="object"?{view:!!W.can.view,edit:!!W.can.edit,settings:!!W.can.settings,users:!!W.can.users}:void 0,site_audit:W?.site_audit&&typeof W.site_audit=="object"?{enumeration_status:W.site_audit.enumeration_status!=null?String(W.
9875site_audit.enumeration_status):null,enumeration_mode:W.site_audit.enumeration_mode!=null?String(W.site_audit.enumeration_mode):null,enumeration_started_at:W.site_audit.enumeration_started_at!=null?String(W.site_audit.enumeration_started_at):null,enumeration_finished_at:W.site_audit.enumeration_finished_at!=null?String(W.site_audit.enumeration_finished_at):null,enumeration_error_message:W.site_audit.enumeration_error_message!=null?String(W.site_audit.enumeration_error_message):null,enumeration_pages_count:Number.isFinite(Number(W.site_audit.enumeration_pages_count))?Number(W.site_audit.enumeration_pages_count):null,sitemap_url:W.site_audit.sitemap_url!=null?String(W.site_audit.sitemap_url):null,sitemap_source:W.site_audit.sitemap_source!=null?String(W.site_audit.sitemap_source):null}:null})).filter(W=>Number.isFinite(W.id)&&W.id>0&&String(W.name||"").trim()!==""&&String(W.website||"").trim()!=="");i(q),r(Q)}}catch{}o(`/workspaces/${X}/projects/${Q}`,{replace:!0})}l.useEffect(()=>()=>{F();try{k?.close?.()}catch{}},[k]),l.useEffect(()=>{if(R){if(R==="cancel"){m("Checkout canceled. Please select a plan again.");return}R==="success"&&Y()}},[R]),l.useEffect(()=>{x&&(!S||!A||H(S,A))},[x,S,A]);const U=async X=>{if(!h){g(!0),m(null);try{const Q=await ue("/api/v1/onboarding/step",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({step_number:12,plan_name:X,billing_interval:B})});if(!Q.ok){const G=await Q.json().catch(()=>({}));m(G?.error||G?.errors?.[0]||"Failed to complete onboarding"),g(!1);return}const K=await Q.json().catch(()=>({}));if(K?.checkout_url){const G=String(K.checkout_url),L=n?.theme==="dark"?"dark":"light";try{P({__opening:!0});const q=await GO(G,L,{onSuccess:()=>{P(null),Y()},onClose:()=>{P(null),g(!1),j(!1),m("Checkout closed. Please complete payment to continue.")},onErrorFallback:()=>{window.location.href=G}});P(q)}catch{P(null)}return}K?.user&&e(K.user),S&&A&&await H(S,A)}catch{m("Network error. Please try again."),g(!1)}}};return t.jsx(ent,{children:t.jsxs(tnt,{children:[t.jsxs(nnt,{children:[t.jsxs(int,{children:[t.jsx(rnt,{children:"Choose a plan"}),t.jsx(ont,{children:"Pick the plan that matches your needs. You can change it later."})]}),t.jsxs(snt,{children:[t.jsxs(ant,{role:"tablist","aria-label":"Billing interval",children:[t.jsx(yK,{type:"button",$active:B==="monthly",onClick:()=>T("monthly"),children:"Monthly"}),t.jsx(yK,{type:"button",$active:B==="yearly",onClick:()=>T("yearly"),children:"Yearly"})]}),t.jsx(ph,{disabled:a||h,onError:X=>m(X)})]})]}),u?t.jsx(Xs,{children:u}):null,t.jsx(m8,{isOpen:w,title:"Confirming billingâ¦",message:"This can take a few seconds. Keep this tab open while we finish activating your workspace."}),!w&&v?t.jsxs(gK,{children:["If checkout completed successfully, you can retry billing confirmation.",t.jsx("div",{style:{marginTop:"0.75rem"},children:t.jsx(knt,{type:"button",onClick:()=>Y(),disabled:h,children:"Retry billing confirmation"})})]}):null,a?t.jsx(gK,{children:"Loadingâ¦"}):null,t.jsx(lnt,{children:Ztt.map(X=>{const Q=B==="yearly"?X.yearlyPriceUsd:X.monthlyPriceUsd,K=B==="yearly"?"/mo billed yearly":"/mo";return t.jsxs(cnt,{$featured:X.featured,children:[X.featured?t.jsx(dnt,{children:"Most Popular"}):null,t.jsxs(unt,{children:[t.jsx(pnt,{children:X.name}),t.jsx(mnt,{children:X.description})]}),t.jsxs(hnt,{children:[t.jsxs(fnt,{children:[t.jsxs(vnt,{children:[t.jsx(wnt,{children:fK(Q)}),t.jsx(jnt,{children:K})]}),t.jsx(_nt,{children:B==="yearly"?t.jsxs(t.Fragment,{children:["Billed annually · ",t.jsxs(bnt,{children:[fK(X.monthlyPriceUsd),"/mo"]})]}):"Billed monthly"})]}),t.jsx(gnt,{children:B==="yearly"?t.jsxs(ynt,{children:[t.jsx(xnt,{children:t.jsx(ul,{})}),"Save ",Jtt({monthly:X.monthlyPriceUsd,yearlyPerMonth:X.yearlyPriceUsd}),"%"]}):null})]}),t.jsxs(Cnt,{children:[t.jsxs(iu,{children:[t.jsxs(ou,{children:[t.jsx(ru,{children:t.jsx(Zn,{size:12})}),t.jsx(su,{children:"Models"})]}),t.jsx(xK,{children:X.models.map(G=>t.jsx(at,{content:G.label,placement:"top",onlyIfTruncated:!1,children:t.jsx(bK,{"aria-label":G.label,children:t.jsx(vK,{children:t.jsx(G.Icon,{})})})},G.key))})]}),t.jsxs(iu,{children:[t.jsxs(ou,{children:[t.jsx(ru,{children:t.jsx(Zn,{size:12})}),t.jsx(su,{children:"Prompts / day"})]}),t.jsx(mm,{children:X.promptsPerDay})]}),t.jsxs(iu,{children:[t.jsxs(ou,{children:[t.jsx(ru,{children:t.jsx(Zn,{size:12})}),t.jsx(su,{children:"Projects"})]}),t.jsx(mm,{children:X.projects==="Unlimited"?"Unlimited":X.projects})]}),t.jsxs(iu,{children:[t.jsxs(ou,{children:[t.jsx(ru,{children:t.jsx(Zn,{size:12})}),t.jsx(su,{children:"Countries"})]}),t.jsx(mm,{children:X.countries==="Unlimited"?"Unlimited":X.countries})]}),t.jsxs(iu,{children:[t.jsxs(ou,{children:[t.jsx(ru,{style:{color:ot},children:t.jsx(vy,{size:12})}),t.jsx(su,{children:"Monthly credits"})]}
9875),t.jsx(mm,{children:X.monthlyCredits.toLocaleString()})]}),t.jsxs(iu,{children:[t.jsxs(ou,{children:[t.jsx(ru,{style:{color:ot},children:t.jsx(vy,{size:12})}),t.jsx(su,{children:"Actions, Audits, Chat"})]}),t.jsx(mm,{children:"Credits"})]}),t.jsxs(iu,{children:[t.jsxs(ou,{children:[t.jsx(ru,{children:t.jsx(Zn,{size:12})}),t.jsx(su,{children:"Google Analytics"})]}),t.jsx(mm,{children:X.googleAnalytics?"Included":"Not included"})]}),t.jsxs(iu,{children:[t.jsxs(ou,{children:[t.jsx(ru,{children:t.jsx(Zn,{size:12})}),t.jsx(su,{children:"Data history"})]}),t.jsx(mm,{children:X.dataHistory})]}),t.jsxs(iu,{children:[t.jsxs(ou,{children:[t.jsx(ru,{children:t.jsx(Zn,{size:12})}),t.jsx(su,{children:"API access"})]}),t.jsx(mm,{children:X.apiAccess?"Included":"Not included"})]}),t.jsxs(iu,{children:[t.jsxs(ou,{children:[t.jsx(ru,{children:t.jsx(Zn,{size:12})}),t.jsx(su,{children:"Support"})]}),t.jsx(mm,{children:X.support})]}),X.name!=="Core"?t.jsxs(iu,{children:[t.jsxs(ou,{children:[t.jsx(ru,{children:t.jsx(Zn,{size:12})}),t.jsx(su,{children:"Add-on models & top-ups"})]}),t.jsx(xK,{children:[{key:"grok",label:"Grok",Icon:Mf},{key:"claude",label:"Claude",Icon:nh},{key:"copilot",label:"Copilot",Icon:Rf}].map(G=>t.jsx(at,{content:G.label,placement:"top",onlyIfTruncated:!1,children:t.jsx(bK,{"aria-label":G.label,children:t.jsx(vK,{children:t.jsx(G.Icon,{})})})},G.key))})]}):null]}),t.jsx(Snt,{$featured:X.featured,onClick:()=>U(X.name),disabled:h||a||!S||!A,title:a||!S||!A?"Loadingâ¦":void 0,children:h?"Processing...":X.trialDays>0?`Choose ${X.name} · ${X.trialDays}-day free trial`:`Choose ${X.name}`})]},X.name)})})]})})}function Int(){const e=zn(),[n]=yr(),{user:i}=yn(),r=i?.onboarding_step||null,o=n.get("type")||"user-type";switch(l.useEffect(()=>{if(!i||!r)return;if(!HO(o)||!net(o,r)){const a=d_(r);a&&e(a,{replace:!0})}},[o,r,i,e]),o){case"user-type":return t.jsx(jet,{});case"workspace":return t.jsx(_et,{});case"website":return t.jsx($et,{});case"location":return t.jsx(zet,{});case"competitor_analysis":case"topic_analysis":case"prompt_analysis":return t.jsx(Met,{});case"topics":return t.jsx(Jet,{});case"prompts":return t.jsx(Mtt,{});case"competitors":return t.jsx(Wtt,{});case"report":return t.jsx($nt,{});default:return null}}const Pnt=p.div.withConfig({displayName:"WorkspaceBillingInactiveBanner__Banner",componentId:"sc-1k2qyms-0"})` 9876 position: sticky; 9877 top: 0; 9878 z-index: 40; 9879 height: 3.25rem; 9880 padding: 0 1rem; 9881 border-bottom: 1px solid ${Er}; 9882 background: ${kn}; 9883 color: ${Ut}; 9884`,Ant=p.div.withConfig({displayName:"WorkspaceBillingInactiveBanner__Inner",componentId:"sc-1k2qyms-1"})` 9885 display: flex; 9886 align-items: center; 9887 justify-content: space-between; 9888 gap: 0.75rem; 9889 flex-wrap: wrap; 9890 height: 100%; 9891`,Nnt=p.div.withConfig({displayName:"WorkspaceBillingInactiveBanner__Headline",componentId:"sc-1k2qyms-2"})` 9892 min-width: 0; 9893 font-size: 0.875rem; 9894 font-weight: 700; 9895 color: ${O}; 9896 display: inline-flex; 9897 align-items: baseline; 9898 gap: 0.5rem; 9899 flex-wrap: wrap; 9900`,znt=p.span.withConfig({displayName:"WorkspaceBillingInactiveBanner__Meta",componentId:"sc-1k2qyms-3"})` 9901 font-size: 0.8125rem; 9902 font-weight: 650; 9903 color: ${z}; 9904`;function Tnt(){const{workspaceId:e}=Gn(),n=vo(),i=zn(),{user:r}=yn(),o=Number(e);if(!Number.isFinite(o))return null;const s=r?.organizations?.find(h=>h.id===o)||null;if(!s||!!s.billing_active_for_spend)return null;const c=`/workspaces/${o}/settings/billing`,u=n.pathname===c||n.pathname.startsWith(`${c}/`),m=String(s?.role||"").toLowerCase()==="owner";return t.jsx(Pnt,{role:"status","aria-live":"polite",children:t.jsxs(Ant,{children:[t.jsxs(Nnt,{children:[t.jsx("span",{children:"Billing inactive"}),t.jsxs(znt,{children:["Some actions are blocked until billing is active.",m?"":" Ask your workspace owner/admin to complete billing."]})]}),u||!m?null:t.jsx(he,{size:"sm",variant:"primary",onClick:()=>{i(c)},children:"Go to Billing"})]})})}function M6(e){const n=new Date;return n.setDate(n.getDate()+e),n.toISOString().slice(0,10)}const Ent=[{id:"agents-beta-announcement",title:"Agents â Now in Beta",message:"AI Agents that automatically implement your GEO recommendations â writing content, fixing technical issues, and publishing changes â are in private beta. Get in touch directly or email [email protected] to get early access.",expiresAt:M6(14)},{id:"site-audit-v2-launch",title:"New: AI Readiness Audit",message:"See how AI-ready your site really is. Run a free audit across Structured Data, Crawlability, Performance, Metadata, Links & Security â your first run is on us.",linkText:"Run Free Audit",linkUrl:"/site-audit",expiresAt:M6(14)},{id:"competitors-v2-launch",title:"New: Compare & Merge Competitors",message:"Compare up to 5 competitors side-by-side, merge duplicates into one using aliases, and track visibility trends â all from one page.",linkText:"View Competitors",linkUrl:"/settings/compet
9904itors",expiresAt:M6(7)}],yde="dismissed-announcement-";function Mnt(e){try{return localStorage.getItem(`${yde}${e}`)==="true"}catch{return!1}}function wK(e){try{localStorage.setItem(`${yde}${e}`,"true")}catch{}}function jK(e){const n=new Date().toISOString().slice(0,10);for(const i of Ent)if(!Mnt(i.id)&&!(i.expiresAt&&i.expiresAt<n)&&!(i.pages&&i.pages.length>0&&!i.pages.some(o=>e.includes(o))))return i;return null}const Rnt=Tn` 9905 from { opacity: 0; transform: translateY(-8px); } 9906 to { opacity: 1; transform: translateY(0); } 9907`,Ont=p.div.withConfig({displayName:"FeatureAnnouncementBanner__Banner",componentId:"sc-1qa31j2-0"})` 9908 position: sticky; 9909 top: 0.75rem; 9910 z-index: 40; 9911 display: flex; 9912 align-items: center; 9913 gap: 1.125rem; 9914 padding: 1.25rem 1.5rem; 9915 margin: 0.75rem 1rem 0; 9916 border-radius: 0.75rem; 9917 border: 1px solid ${ot}; 9918 border-left: 4px solid ${ot}; 9919 background: ${cn}; 9920 animation: ${Rnt} 0.3s ease-out; 9921 9922 @media (max-width: 640px) { 9923 flex-direction: column; 9924 align-items: flex-start; 9925 gap: 0.625rem; 9926 padding: 1rem; 9927 margin: 0.5rem 0.5rem 0; 9928 } 9929`,Dnt=p.div.withConfig({displayName:"FeatureAnnouncementBanner__IconCircle",componentId:"sc-1qa31j2-1"})` 9930 display: flex; 9931 align-items: center; 9932 justify-content: center; 9933 width: 3rem; 9934 height: 3rem; 9935 border-radius: 0.625rem; 9936 background: ${ot}; 9937 flex-shrink: 0; 9938 color: ${Z}; 9939`,Lnt=p.div.withConfig({displayName:"FeatureAnnouncementBanner__Content",componentId:"sc-1qa31j2-2"})` 9940 flex: 1; 9941 min-width: 0; 9942`,Bnt=p.div.withConfig({displayName:"FeatureAnnouncementBanner__Title",componentId:"sc-1qa31j2-3"})` 9943 font-size: 1rem; 9944 font-weight: 750; 9945 color: ${O}; 9946 line-height: 1.35; 9947`,Fnt=p.div.withConfig({displayName:"FeatureAnnouncementBanner__Message",componentId:"sc-1qa31j2-4"})` 9948 font-size: 0.85rem; 9949 color: ${z}; 9950 line-height: 1.5; 9951 margin-top: 0.25rem; 9952`,Wnt=p.div.withConfig({displayName:"FeatureAnnouncementBanner__Actions",componentId:"sc-1qa31j2-5"})` 9953 display: flex; 9954 align-items: center; 9955 gap: 0.5rem; 9956 flex-shrink: 0; 9957`,Unt=p.button.withConfig({displayName:"FeatureAnnouncementBanner__CTAButton",componentId:"sc-1qa31j2-6"})` 9958 display: inline-flex; 9959 align-items: center; 9960 gap: 0.35rem; 9961 padding: 0.55rem 1.125rem; 9962 border-radius: 0.5rem; 9963 border: none; 9964 font-size: 0.85rem; 9965 font-weight: 650; 9966 color: ${Z}; 9967 background: ${ot}; 9968 cursor: pointer; 9969 white-space: nowrap; 9970 transition: opacity 0.15s; 9971 9972 &:hover { opacity: 0.9; } 9973`,Hnt=p.button.withConfig({displayName:"FeatureAnnouncementBanner__DismissBtn",componentId:"sc-1qa31j2-7"})` 9974 display: flex; 9975 align-items: center; 9976 justify-content: center; 9977 width: 1.75rem; 9978 height: 1.75rem; 9979 border-radius: 0.375rem; 9980 border: none; 9981 background: transparent; 9982 color: ${Pe}; 9983 cursor: pointer; 9984 transition: background 0.15s, color 0.15s; 9985 9986 &:hover { 9987 background: ${V}; 9988 color: ${O}; 9989 } 9990`;function qnt(){const e=vo(),n=zn(),{workspaceId:i,projectId:r}=Gn(),o=!!i,[s,a]=l.useState(()=>o?jK(e.pathname):null);l.useEffect(()=>{a(o?jK(e.pathname):null)},[e.pathname,o]);const c=l.useCallback(()=>{s&&(wK(s.id),a(null))},[s]),u=l.useCallback(()=>{if(!s?.linkUrl)return;wK(s.id),a(null);let m=s.linkUrl;m.startsWith("/")&&!m.startsWith("/workspaces")&&i&&r?m=`/workspaces/${i}/projects/${r}${m}`:m.startsWith("/")&&!m.startsWith("/workspaces")&&i&&(m=`/workspaces/${i}${m}`),m.startsWith("http")?window.open(m,"_blank","noopener"):n(m)},[s,i,r,n]);return s?t.jsxs(Ont,{children:[t.jsx(Dnt,{children:t.jsx(Sn,{size:20})}),t.jsxs(Lnt,{children:[t.jsx(Bnt,{children:s.title}),t.jsx(Fnt,{children:s.message})]}),t.jsxs(Wnt,{children:[s.linkText&&s.linkUrl&&r&&t.jsxs(Unt,{onClick:u,children:[s.linkText,t.jsx(H8,{size:13})]}),t.jsx(Hnt,{onClick:c,"aria-label":"Dismiss announcement",children:t.jsx(Ei,{size:15})})]})]}):null}const Gnt=p.div.withConfig({displayName:"Home__Shell",componentId:"sc-1m6gnxm-0"})` 9991 height: 100vh; 9992 display: flex; 9993 background: ${At}; 9994 overflow: hidden; 9995 9996 @media (max-width: 768px) { 9997 flex-direction: column; 9998 } 9999`,Vnt=p.main.withConfig({displayName:"Home__Main",componentId:"sc-1m6gnxm-1"})` 10000 flex: 1; 10001 min-width: 0; 10002 overflow: auto; 10003 -webkit-overflow-scrolling: touch; 10004 10005 @media (max-width: 768px) { 10006 /* account for top navbar height on small screens */ 10007 height: calc(100vh - 3.25rem); 10008 } 10009`;function Knt(){return t.jsxs(Gnt,{children:[t.jsx(dTe,{}),t.jsxs(Vnt,{children:[t.jsx(Tnt,{}),t.jsx(qnt,{}),t.jsx(Fte,{})]})]})}const Ynt=p.div.withConfig({displayName:"RootIndex__Wrapper",componentId:"sc-15nsnfi-0"})` 10010 height: 100%; 10011 width: 100%; 10012 display: flex; 10013 align-items: center; 10014 justify-content: center; 10015 padding: 2rem; 10016 background: ${At}; 10017 position: relative; 10018 overflow: hidden; 10019 10020 /* Onboarding-style dashed grid background */ 10021 &::before { 10022 content: ""; 10023 position: absolute; 10024 inset: 0; 10025 z-index: 0; 10026 background-image: 10027 linear-gradient(to right, ${Cf} 1px, ${hn} 1px), 10028 linear-gradient(to bottom, ${Cf} 1px, ${hn} 1px); 10029 background-size: 20px 20px; 10030 background-position: 0 0, 0 0; 10031 mask-image: 10032 repeating-linear-gradient( 10033 to right, 10034 ${mn} 0px, 10035 ${mn} 3px, 10036 ${hn} 3px, 10037 ${hn} 8px 10038 ), 10039 repeating-linear-gradient( 10040 to bottom, 10041 ${mn} 0px, 10042 ${mn} 3px, 10043 ${hn} 3px, 10044 ${hn} 8px 10045 ), 10046 linear-gradient(to bottom, ${mn} 0%, ${mn} 45%, ${hn} 80%); 10047 -webkit-mask-image: 10048 repeating-linear-gradient( 10049 to right, 10050 ${mn} 0px, 10051 ${mn} 3px, 10052 ${hn} 3px, 10053 ${hn} 8px 10054 ), 10055 repeating-linear-gradient( 10056 to bottom, 10057 ${mn} 0px, 10058 ${mn} 3px, 10059 ${hn} 3px, 10060 ${hn} 8px 10061 ), 10062 linear-gradient(to bottom, ${mn} 0%, ${mn} 45%, ${hn} 80%); 10063 mask-composite: intersect; 10064 -webkit-mask-composite: source-in; 10065 pointer-events: none; 10066 } 10067`,Xnt=p.div.withConfig({displayName:"RootIndex__EmptyState",componentId:"sc-15nsnfi-1"})` 10068 width: 100%; 10069 max-width: 32rem; 10070 display: flex; 10071 flex-direction: column; 10072 gap: 1.25rem; 10073 position: relative; 10074 z-index: 1; 10075`,Qnt=p.div.withConfig({displayName:"RootIndex__Header",componentId:"sc-15nsnfi-2"})` 10076 display: flex; 10077 align-items: center; 10078 gap: 0.75rem; 10079`,Znt=p.div.withConfig({displayName:"RootIndex__IconBadge",componentId:"sc-15nsnfi-3"})` 10080 width: 40px; 10081 height: 40px; 10082 border-radius: 0.875rem; 10083 background: ${Z}; 10084 border: 1px solid ${Rt}; 10085 display: flex; 10086 align-items: center; 10087 justify-content: center; 10088 color: ${O}; 10089 flex: 0 0 auto; 10090 box-shadow: 0 10px 24px rgba(17, 24, 39, 0.06); 10091`,Jnt=p.div.withConfig({displayName:"RootIndex__HeaderText",componentId:"sc-15nsnfi-4"})` 10092 flex: 1; 10093 min-width: 0; 10094 display: flex; 10095 flex-direction: column; 10096 gap: 0.35rem; 10097`,eit=p.h1.withConfig({displayName:"RootIndex__Title",componentId:"sc-15nsnfi-5"})` 10098 font-size: 1.5rem; 10099 font-weight: 700; 10100 color: ${O}; 10101 margin: 0; 10102`,tit=p.p.withConfig({displayName:"RootIndex__Subtitle",componentId:"sc-15nsnfi-6"})` 10103 font-size: 0.9375rem; 10104 line-height: 1.5; 10105 color: ${z}; 10106 margin: 0; 10107`,nit=p.div.withConfig({displayName:"RootIndex__Actions",componentId:"sc-15nsnfi-7"})` 10108 display: flex; 10109 gap: 0.75rem; 10110`,iit=p.div.withConfig({displayName:"RootIndex__InfoCard",componentId:"sc-15nsnfi-8"})` 10111 width: 100%; 10112 background: ${Z}; 10113 border: 1px solid ${Rt}; 10114 border-radius: 1rem; 10115 padding: 1rem 1.125rem; 10116 display: flex; 10117 gap: 0.875rem; 10118 align-items: center; 10119 box-shadow: 0 14px 30px rgba(17, 24, 39, 0.08); 10120`,rit=p.div.withConfig({displayName:"RootIndex__InfoIconWrap",componentId:"sc-15nsnfi-9"})` 10121 display: flex; 10122 align-items: center; 10123 justify-content: center; 10124 color: ${O}; 10125 flex: 0 0 auto; 10126 10127 /* Avoid SVG baseline âoff-centerâ look */ 10128 svg { 10129 display: block; 10130 } 10131`,oit=p.div.withConfig({displayName:"RootIndex__InfoText",componentId:"sc-15nsnfi-10"})` 10132 flex: 1; 10133 min-width: 0; 10134 font-size: 0.875rem; 10135 line-height: 1.45; 10136 color: ${z}; 10137`;function sit(){const e=zn(),{user:n,setUser:i}=yn(),r=n?.organizations||[],[o,s]=l.useState(!1);return l.useEffect(()=>{r.length>
101370&&e(`/workspaces/${r[0].id}`,{replace:!0})},[r,e]),r.length>0?null:t.jsx(Ynt,{children:t.jsxs(Xnt,{children:[t.jsxs(Qnt,{children:[t.jsx(Znt,{"aria-hidden":"true",children:t.jsx(by,{size:18})}),t.jsxs(Jnt,{children:[t.jsx(eit,{children:"You donât have any workspaces"}),t.jsx(tit,{children:"Create a workspace to start onboarding and set up your project."})]})]}),t.jsxs(iit,{children:[t.jsx(rit,{"aria-hidden":"true",children:t.jsx(wn,{size:16})}),t.jsx(oit,{children:"Workspaces keep your projects, competitors, and reports organized. You can create multiple workspaces later."})]}),t.jsx(nit,{style:{marginTop:"0.75rem"},children:t.jsx(he,{type:"button",variant:"nav",disabled:o,onClick:()=>{o||(s(!0),ue("/api/v1/onboarding/restart",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({skip_destroy:!0})}).then(async a=>{const c=await a.json().catch(()=>({}));if(!a.ok)throw new Error(c?.error||"Failed to start onboarding");c?.user&&i(c.user)}).catch(a=>{console.error(a)}).finally(()=>s(!1)))},children:o?"Creatingâ¦":"Create workspace"})})]})})}const ait=p.div.withConfig({displayName:"WorkspacePage__Wrapper",componentId:"sc-1vbrwcf-0"})` 10138 padding: 2rem; 10139 height: 100%; 10140 display: flex; 10141 flex-direction: column; 10142 min-height: 0; 10143`,lit=p.h1.withConfig({displayName:"WorkspacePage__Title",componentId:"sc-1vbrwcf-1"})` 10144 font-size: 1.25rem; 10145 font-weight: 700; 10146 color: ${O}; 10147 margin: 0 0 0.5rem 0; 10148`,cit=p.p.withConfig({displayName:"WorkspacePage__Subtitle",componentId:"sc-1vbrwcf-2"})` 10149 font-size: 0.875rem; 10150 color: ${z}; 10151 margin: 0; 10152`,dit=p.div.withConfig({displayName:"WorkspacePage__ControlsRow",componentId:"sc-1vbrwcf-3"})` 10153 margin-top: 1.25rem; 10154 display: flex; 10155 gap: 0.75rem; 10156 flex-wrap: wrap; 10157 align-items: center; 10158 justify-content: flex-end; 10159`,uit=p.div.withConfig({displayName:"WorkspacePage__CardsGrid",componentId:"sc-1vbrwcf-4"})` 10160 margin-top: 1.25rem; 10161 display: grid; 10162 grid-template-columns: 1fr; 10163 gap: 0.75rem; 10164 flex: 1 1 auto; 10165 align-content: start; 10166 min-height: 0; 10167 overflow: auto; 10168 -webkit-overflow-scrolling: touch; 10169 padding: 0.625rem 2px 2px; 10170 10171 @media (min-width: 640px) { 10172 grid-template-columns: repeat(2, minmax(0, 1fr)); 10173 } 10174 10175 @media (min-width: 1024px) { 10176 grid-template-columns: repeat(3, minmax(0, 1fr)); 10177 } 10178`,pit=p.a.withConfig({displayName:"WorkspacePage__CardLink",componentId:"sc-1vbrwcf-5"})` 10179 text-decoration: none; 10180 color: inherit; 10181 border: 1px solid ${V}; 10182 background: ${Z}; 10183 border-radius: 0.875rem; 10184 padding: 0.875rem; 10185 display: flex; 10186 gap: 0.75rem; 10187 align-items: flex-start; 10188 cursor: pointer; 10189 transition: background-color 140ms ease, border-color 140ms ease, transform 140ms ease; 10190 10191 &:hover { 10192 background: ${$e}; 10193 border-color: ${V}; 10194 transform: translateY(-1px); 10195 } 10196 10197 &:focus-visible { 10198 outline: none; 10199 box-shadow: 0 0 0 3px ${En}; 10200 } 10201`,mit=p.div.withConfig({displayName:"WorkspacePage__Logo",componentId:"sc-1vbrwcf-6"})` 10202 width: 38px; 10203 height: 38px; 10204 border-radius: 0.875rem; 10205 border: 1px solid ${V}; 10206 background: ${$e}; 10207 overflow: hidden; 10208 display: flex; 10209 align-items: center; 10210 justify-content: center; 10211 flex-shrink: 0; 10212`,hit=p.img.withConfig({displayName:"WorkspacePage__LogoImg",componentId:"sc-1vbrwcf-7"})` 10213 width: 100%; 10214 height: 100%; 10215 object-fit: cover; 10216 display: block; 10217`,fit=p.div.withConfig({displayName:"WorkspacePage__CardText",componentId:"sc-1vbrwcf-8"})` 10218 min-width: 0; 10219 display: flex; 10220 flex-direction: column; 10221 justify-content: ${e=>e.$center?"center":"flex-start"}; 10222 gap: 0.25rem; 10223 min-height: ${e=>e.$center?"38px":"auto"}; 10224`,git=p.div.withConfig({displayName:"WorkspacePage__CardName",componentId:"sc-1vbrwcf-9"})` 10225 font-size: 0.95rem; 10226 font-weight: 750; 10227 color: ${O}; 10228 overflow: hidden; 10229 text-overflow: ellipsis; 10230 white-space: nowrap; 10231`,_K=p.div.withConfig({displayName:"WorkspacePage__CardMeta",componentId:"sc-1vbrwcf-10"})` 10232 display: inline-flex; 10233 align-items: center; 10234 gap: 0.375rem; 10235 color: ${z}; 10236 font-size: 0.8125rem; 10237 overflow: hidden; 10238 text-overflow: ellipsis; 10239 white-space: nowrap; 10240`,CK=p.div.withConfig({displayName:"WorkspacePage__Empty",componentId:"sc-1vbrwcf-11"})` 10241 margin-top: 1.5rem; 10242 color: ${z}; 10243 font-size: 0.875rem; 10244`,yit=p.div.withConfig({displayName:"WorkspacePage__PaginationRow",componentId:"sc-1vbrwcf-12"})` 10245 margin-top: auto; 10246 display: flex; 10247 justify-content: flex-end; 10248 padding-top: 0.75rem; 10249 background: ${At}; 10250`,xit=p.div.withConfig({displayName:"WorkspacePage__CardTagsRow",componentId:"sc-1vbrwcf-13"})` 10251 position: absolute; 10252 top: -0.5rem; 10253 right: 2.5rem; 10254 display: flex; 10255 flex-wrap: nowrap; 10256 gap: 0.25rem; 10257 z-index: 1; 10258 pointer-events: none; 10259`,bit=p.span.withConfig({displayName:"WorkspacePage__MiniTagPill",componentId:"sc-1vbrwcf-14"})` 10260 display: inline-flex; 10261 align-items: center; 10262 gap: 0.25rem; 10263 padding: 0.125rem 0.45rem; 10264 border-radius: 0.25rem; 10265 font-size: 0.625rem; 10266 font-weight: 800; 10267 line-height: 1.3; 10268 color: #fff; 10269 background: ${e=>e.$bg}; 10270 white-space: nowrap; 10271 box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15); 10272`,vit=p.span.withConfig({displayName:"WorkspacePage__FolderBadge",componentId:"sc-1vbrwcf-15"})` 10273 position: absolute; 10274 top: -0.5rem; 10275 left: 0.5rem; 10276 display: inline-flex; 10277 align-items: center; 10278 gap: 0.25rem; 10279 padding: 0.125rem 0.5rem; 10280 border-radius: 0.25rem; 10281 font-size: 0.625rem; 10282 font-weight: 800; 10283 line-height: 1.3; 10284 color: ${O}; 10285 background: ${V}; 10286 white-space: nowrap; 10287 box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); 10288 z-index: 1; 10289 pointer-events: none; 10290`,wit=p.div.withConfig({displayName:"WorkspacePage__FolderGroupHeader",componentId:"sc-1vbrwcf-16"})` 10291 display: flex; 10292 align-items: center; 10293 gap: 0.5rem; 10294 padding: 0.15rem 0; 10295 color: ${O}; 10296 font-size: 0.875rem; 10297 font-weight: 750; 10298`,jit=p.span.withConfig({displayName:"WorkspacePage__FolderGroupCount",componentId:"sc-1vbrwcf-17"})` 10299 font-size: 0.75rem; 10300 font-weight: 600; 10301 color: ${z}; 10302`,_it=p.div.withConfig({displayName:"WorkspacePage__FolderSection",componentId:"sc-1vbrwcf-18"})` 10303 display: flex; 10304 flex-direction: column; 10305 gap: 0.75rem; 10306`,Cit=p.div.withConfig({displayName:"WorkspacePage__FolderSectionCards",componentId:"sc-1vbrwcf-19"})` 10307 display: grid; 10308 grid-template-columns: 1fr; 10309 gap: 0.75rem; 10310 10311 @media (min-width: 640px) { 10312 grid-template-columns: repeat(2, minmax(0, 1fr)); 10313 } 10314 10315 @media (min-width: 1024px) { 10316 grid-template-columns: repeat(3, minmax(0, 1fr)); 10317 } 10318`,Sit=p.div.withConfig({displayName:"WorkspacePage__GroupedContainer",componentId:"sc-1vbrwcf-20"})` 10319 margin-top: 1.25rem; 10320 display: flex; 10321 flex-direction: column; 10322 gap: 1.5rem; 10323 flex: 1 1 auto; 10324 min-height: 0; 10325 overflow: auto; 10326 -webkit-overflow-scrolling: touch; 10327 padding: 0.625rem 2px 2px; 10328`,kit=p.div.withConfig({displayName:"WorkspacePage__CardWrapper",componentId:"sc-1vbrwcf-21"})` 10329 position: relative; 10330 overflow: visible; 10331`,$it=p.button.withConfig({displayName:"WorkspacePage__MenuBtn",componentId:"sc-1vbrwcf-22"})` 10332 all: unset; 10333 position: absolute; 10334 top: 0.5rem; 10335 right: 0.5rem; 10336 width: 1.75rem; 10337 height: 1.75rem; 10338 display: flex; 10339 align-items: center; 10340 justify-content: center; 10341 border-radius: 0.375rem; 10342 color: ${z}; 10343 cursor: pointer; 10344 transition: background 120ms, color 120ms; 10345 z-index: 2; 10346 10347 &:hover { 10348 background: ${V}; 10349 color: ${O}; 10350 } 10351`,Iit=p.div.withConfig({displayName:"WorkspacePage__MenuDropdown",componentId:"sc-1vbrwcf-23"})` 10352 position: fixed;
10353 z-index: 10000; 10354 background: ${Z}; 10355 border: 1px solid ${V}; 10356 border-radius: 0.5rem; 10357 box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1); 10358 width: 240px; 10359 padding: 0.5rem; 10360 max-height: 420px; 10361 overflow-y: auto; 10362`,SK=p.div.withConfig({displayName:"WorkspacePage__MenuSection",componentId:"sc-1vbrwcf-24"})` 10363 &:not(:first-child) { 10364 border-top: 1px solid ${V}; 10365 margin-top: 0.35rem; 10366 padding-top: 0.35rem; 10367 } 10368`,kK=p.div.withConfig({displayName:"WorkspacePage__MenuSectionLabel",componentId:"sc-1vbrwcf-25"})` 10369 display: flex; 10370 align-items: center; 10371 font-size: 0.6875rem; 10372 font-weight: 800; 10373 color: ${z}; 10374 text-transform: uppercase; 10375 letter-spacing: 0.04em; 10376 padding: 0.2rem 0.35rem; 10377`,$K=p.div.withConfig({displayName:"WorkspacePage__TagRow",componentId:"sc-1vbrwcf-26"})` 10378 display: flex; 10379 align-items: center; 10380 gap: 0.4rem; 10381 padding: 0.3rem 0.35rem; 10382 border-radius: 0.25rem; 10383 cursor: pointer; 10384 font-size: 0.8125rem; 10385 font-weight: 600; 10386 color: ${O}; 10387 10388 &:hover { 10389 background: ${$e}; 10390 } 10391`,Pit=p.span.withConfig({displayName:"WorkspacePage__TagDot",componentId:"sc-1vbrwcf-27"})` 10392 width: 10px; 10393 height: 10px; 10394 border-radius: 50%; 10395 background: ${e=>e.$color}; 10396 flex-shrink: 0; 10397`,Ait=p.div.withConfig({displayName:"WorkspacePage__FolderInputRow",componentId:"sc-1vbrwcf-28"})` 10398 display: flex; 10399 gap: 0.25rem; 10400 padding: 0.25rem 0.35rem; 10401`,Nit=p.button.withConfig({displayName:"WorkspacePage__FolderSuggestionBtn",componentId:"sc-1vbrwcf-29"})` 10402 all: unset; 10403 cursor: pointer; 10404 padding: 0.25rem 0.5rem; 10405 font-size: 0.75rem; 10406 border-radius: 0.25rem; 10407 color: ${O}; 10408 &:hover { background: ${$e}; } 10409`,zit=[{value:"az",label:"Name AâZ"},{value:"za",label:"Name ZâA"}],Ag=3,Tit=30,Eit=25,R6=["#3b82f6","#8b5cf6","#ec4899","#ef4444","#f97316","#eab308","#22c55e","#14b8a6","#06b6d4","#6366f1","#a855f7","#d946ef","#f43f5e","#0ea5e9","#10b981","#84cc16"];function IK({project:e,orgId:n,navigate:i,showFolder:r,orgTags:o,folderSuggestions:s,onProjectUpdated:a,onOrgTagCreated:c,onOrgTagDeleted:u,canEdit:m}){const[h,g]=l.useState(!1),[x,y]=l.useState(e.folder||""),[w,j]=l.useState(!1),v=l.useRef(null),_=l.useRef(null),[$,k]=l.useState({top:-9999,left:-9999}),[P,S]=l.useState(!1),[I,A]=l.useState(""),[E,B]=l.useState(R6[0]),[T,M]=l.useState(!1),R=l.useCallback(()=>{if(!_.current)return{top:-9999,left:-9999};const L=_.current.getBoundingClientRect(),q=240,W=Math.max(8,Math.min(L.right-q,window.innerWidth-q-8));return{top:L.bottom+4,left:W}},[]),F=l.useCallback(()=>{k(R()),g(!0)},[R]);l.useEffect(()=>{h&&(y(e.folder||""),S(!1),A(""),B(R6[0]))},[h,e.folder]),l.useEffect(()=>{if(!h)return;const L=W=>{const oe=W.target;v.current?.contains(oe)||_.current?.contains(oe)||g(!1)},q=()=>k(R());return document.addEventListener("mousedown",L),window.addEventListener("scroll",q,!0),window.addEventListener("resize",q),()=>{document.removeEventListener("mousedown",L),window.removeEventListener("scroll",q,!0),window.removeEventListener("resize",q)}},[h,R]);const Y=l.useMemo(()=>new Set((e.tags||[]).map(L=>L.id)),[e.tags]),H=async L=>{j(!0);try{const q=await ue(`/api/v1/organizations/${n}/projects/${e.id}`,{method:"PATCH",body:JSON.stringify(L)}),W=await q.json().catch(()=>({}));q.ok&&W?.project&&a(W.project)}catch{}finally{j(!1)}},U=L=>{const q=(e.tags||[]).map(oe=>oe.id);if(!q.includes(L)&&q.length>=Ag)return;const W=q.includes(L)?q.filter(oe=>oe!==L):[...q,L];H({tag_ids:W})},X=()=>{const L=x.trim();if(L===(e.folder||"")){g(!1);return}H({folder:L||null}),g(!1)},Q=async()=>{if(!(!I.trim()||T)){M(!0);try{const L=await ue(`/api/v1/organizations/${n}/tags`,{method:"POST",body:JSON.stringify({name:I.trim(),color:E})}),q=await L.json().catch(()=>({}));if(L.ok&&q?.tag){c(q.tag);const W=(e.tags||[]).map(oe=>oe.id);W.length<Ag&&H({tag_ids:[...W,q.tag.id]}),A(""),S(!1)}}catch{}finally{M(!1)}}},K=async L=>{try{(await ue(`/api/v1/organizations/${n}/tags/${L}`,{method:"DELETE"})).ok&&u(L)}catch{}},G=l.useMemo(()=>{if(!x.trim())return s;const L=x.trim().toLowerCase();return s.filter(q=>q.includes(L)&&q!==(e.folder||""))},[x,s,e.folder]);return t.jsxs(kit,{children:[t.jsxs(pit,{href:"#",onClick:L=>
10409{L.preventDefault(),h||i(`/workspaces/${n}/projects/${e.id}`)},children:[t.jsx(mit,{"aria-hidden":"true",children:t.jsx(Hb,{src:e.logo_url,alt:"",Img:hit,fallback:t.jsx(To,{size:18,color:z})})}),t.jsxs(fit,{$center:!1,children:[t.jsx(at,{content:e.name,onlyIfTruncated:!0,children:t.jsx(git,{children:e.name})}),t.jsx(at,{content:e.website,onlyIfTruncated:!0,children:t.jsxs(_K,{children:[t.jsx(To,{size:14}),e.website]})}),t.jsxs(_K,{children:[t.jsx(Ss,{size:14}),Number(e.active_prompts_count)||0," active prompt",(Number(e.active_prompts_count)||0)===1?"":"s"]})]})]}),r&&e.folder&&t.jsxs(vit,{children:[t.jsx(jy,{size:10}),Qg(e.folder)]}),Array.isArray(e.tags)&&e.tags.length>0&&t.jsx(xit,{children:e.tags.slice(0,Ag).map(L=>t.jsx(bit,{$bg:L.color,children:Qg(L.name)},L.id))}),t.jsx($it,{ref:_,type:"button","aria-label":"Project options",onClick:L=>{L.stopPropagation(),h?g(!1):F()},children:t.jsx(zne,{size:16})}),h&&jr.createPortal(t.jsxs(Iit,{ref:v,style:{top:$.top,left:$.left},onClick:L=>L.stopPropagation(),children:[t.jsxs(SK,{children:[t.jsxs(kK,{children:[t.jsx(jy,{size:11,style:{marginRight:4,verticalAlign:-1}}),"Folder"]}),t.jsxs(Ait,{children:[t.jsx(Xt,{value:m?x:e.folder?Qg(e.folder):"",onChange:m?L=>y(L.target.value):()=>{},placeholder:m?"Folder name":"No folder",maxLength:Tit,style:{flex:1,fontSize:"0.8125rem",padding:"0.3rem 0.5rem",height:"auto"},onKeyDown:m?L=>{L.key==="Enter"&&X()}:void 0,autoFocus:m,disabled:!m}),m&&t.jsxs(t.Fragment,{children:[t.jsx("button",{type:"button",onClick:X,disabled:w,style:{all:"unset",cursor:"pointer",display:"inline-flex",alignItems:"center",justifyContent:"center",width:28,height:28,borderRadius:6,background:ot,color:Z},"aria-label":"Save folder",children:t.jsx(Zn,{size:14})}),e.folder&&t.jsx("button",{type:"button",onClick:()=>{H({folder:null}),g(!1)},disabled:w,style:{all:"unset",cursor:"pointer",display:"inline-flex",alignItems:"center",justifyContent:"center",width:28,height:28,borderRadius:4,color:z},"aria-label":"Remove folder",children:t.jsx(Ei,{size:14})})]})]}),m&&G.length>0&&t.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:2,padding:"0 0.35rem 0.2rem"},children:G.slice(0,5).map(L=>t.jsx(Nit,{type:"button",onClick:()=>{y(L),H({folder:L}),g(!1)},children:Qg(L)},L))})]}),t.jsxs(SK,{children:[t.jsxs(kK,{children:[t.jsx(X_,{size:11,style:{marginRight:4,verticalAlign:-1}}),"Tags",t.jsxs("span",{style:{marginLeft:"auto",fontWeight:600,fontSize:"0.625rem",letterSpacing:0},children:[Y.size,"/",Ag]})]}),o.map(L=>{const q=Y.has(L.id),W=!q&&Y.size>=Ag,oe=!m||W;return t.jsxs($K,{$active:q,onClick:()=>{m&&!W&&U(L.id)},style:oe?{opacity:.4,cursor:"default"}:void 0,children:[t.jsx(Pit,{$color:L.color}),t.jsx("span",{style:{flex:1},children:Qg(L.name)}),q&&t.jsx(Zn,{size:14,color:z}),m&&t.jsx("button",{type:"button",onClick:se=>{se.stopPropagation(),K(L.id)},style:{all:"unset",cursor:"pointer",display:"inline-flex",opacity:.35,padding:2},"aria-label":`Delete tag ${L.name}`,children:t.jsx(Fi,{size:12})})]},L.id)}),m&&(Y.size>=Ag?t.jsxs("div",{style:{padding:"0.25rem 0.35rem",fontSize:"0.75rem",color:z},children:["Max ",Ag," tags reached"]}):P?t.jsxs("div",{style:{padding:"0.25rem 0.35rem",display:"flex",flexDirection:"column",gap:4},children:[t.jsxs("div",{style:{display:"flex",gap:4},children:[t.jsx(Xt,{value:I,onChange:L=>A(L.target.value),placeholder:"Tag name",maxLength:Eit,style:{flex:1,fontSize:"0.8125rem",padding:"0.3rem 0.5rem",height:"auto"},onKeyDown:L=>{L.key==="Enter"&&Q()},autoFocus:!0}),t.jsx("button",{type:"button",onClick:Q,disabled:T||!I.trim(),style:{all:"unset",cursor:"pointer",display:"inline-flex",alignItems:"center",justifyContent:"center",width:28,height:28,borderRadius:6,background:ot,color:Z,opacity:!I.trim()||T?.5:1},"aria-label":"Create tag",children:t.jsx(Zn,{size:14})})]}),t.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:3},children:R6.map(L=>t.jsx("button",{type:"button",onClick:()=>B(L),style:{all:"unset",width:16,height:16,borderRadius:"50%",background:L,cursor:"pointer",outline:E===L?`2px solid ${L}`:"none",outlineOffset:2}},L))})]}):t.jsxs($K,{onClick:()=>S(!0),style:{color:z},children:[t.jsx(gr,{size:13}),t.jsx("span",{children:"Create tag"})]}))]})]}),document.body)]})}function Mit(){const e=zn(),{workspaceId:n}=Gn(),{user:i,setUser:r}=yn(),{hydrateProjects:o,refreshProjects:s}=Mr(),a=i?.organizations||[],c=50,[u,m]=l.useState([]),[h,g]=l.useState({page:1,per_page:c,total:0,total_pages:1}),[x,y]=l.useState(!1),[w,j]=l.useState(null),[v,_]=l.useState(null),[$,k]=l.useState(null),[P,S]=l.useState([]),[I,A]=l.useState(""),[E,B]=l.useState(!0),[T,M]=l.useState([]),R=l.useMemo(()=>{const we=Number(n);return Number.isFinite(we)?we:null},[n]),F=l.useMemo(()=>R&&a.find(we=>we.id===R)||null,[a,R]);l.useEffect(()=>{if(a.length===0){e("/",{replace:!0});return}
10409(!R||!F)&&e(`/workspaces/${a[0].id}`,{replace:!0})},[a,R,F,e]);const Y=F?.role==="owner"||F?.role==="editor",[H,U]=l.useState(!1),[X,Q]=l.useState(""),[K,G]=l.useState("az"),[L,q]=l.useState(1);l.useEffect(()=>{q(1)},[X,K,I]),l.useEffect(()=>{let we=!1;if(!F?.id)return;const Ke=Math.max(1,Number(h.total_pages)||1),ce=Math.min(Math.max(1,L),Ke);if(ce!==L){q(ce);return}return(async()=>{y(!0),j(null);try{const ie=new URLSearchParams;ie.set("page",String(ce)),ie.set("per_page",String(c)),ie.set("sort",K);const Re=X.trim();Re&&ie.set("q",Re),I&&ie.set("folder",I);const Be=await ue(`/api/v1/organizations/${F.id}/projects?${ie.toString()}`,{method:"GET"}),tt=await Be.json().catch(()=>({}));if(!Be.ok)throw new Error(tt?.error||tt?.errors?.[0]||"Failed to load projects");if(we)return;const dt=Array.isArray(tt.projects)?tt.projects:[];m(dt),Array.isArray(tt.folders)&&S(tt.folders);const je=tt?.limits&&typeof tt.limits=="object"?tt.limits:{},Me=tt?.usage&&typeof tt.usage=="object"?tt.usage:{};_(je.projects_limit==null?null:Number(je.projects_limit)),k(Me.projects_count==null?null:Number(Me.projects_count)),o(dt,{projectsLimit:je.projects_limit==null?null:Number(je.projects_limit),projectsCount:Me.projects_count==null?null:Number(Me.projects_count)});const Se=tt.pagination;g(Se&&typeof Se=="object"?{page:Number(Se.page)||ce,per_page:Number(Se.per_page)||c,total:Number(Se.total)||0,total_pages:Number(Se.total_pages)||1}:{page:ce,per_page:c,total:dt.length,total_pages:1})}catch(ie){if(we)return;m([]),g({page:ce,per_page:c,total:0,total_pages:1}),j(ie?.message||"Failed to load projects"),_(null),k(null)}finally{if(we)return;y(!1)}})(),()=>{we=!0}},[F?.id,L,X,K,I]),l.useEffect(()=>{let we=!1;if(F?.id)return(async()=>{try{const Ke=await ue(`/api/v1/organizations/${F.id}/tags`),ce=await Ke.json().catch(()=>({}));!we&&Ke.ok&&Array.isArray(ce.tags)&&M(ce.tags)}catch{}})(),()=>{we=!0}},[F?.id]);const W=l.useCallback(we=>{m(Ke=>{const ce=Ke.map(Re=>Re.id===we.id?we:Re),ie=[...new Set(ce.map(Re=>
10409Re.folder).filter(Boolean))].sort();return S(ie),ce})},[]),oe=l.useCallback(we=>{M(Ke=>Ke.some(ce=>ce.id===we.id)?Ke:[...Ke,we])},[]),se=l.useCallback(we=>{M(Ke=>Ke.filter(ce=>ce.id!==we)),m(Ke=>Ke.map(ce=>({...ce,tags:(ce.tags||[]).filter(ie=>ie.id!==we)})))},[]),de=l.useMemo(()=>Number(h.total)||0,[h.total]),le=l.useMemo(()=>Math.max(1,Number(h.total_pages)||1),[h.total_pages]),me=l.useMemo(()=>Math.min(Math.max(1,L),le),[L,le]),ee=l.useMemo(()=>v==null||$==null?!1:$>=v,[$,v]);l.useEffect(()=>{I&&!P.includes(I)&&A("")},[P,I]),l.useEffect(()=>{me!==L&&q(me)},[me]);const ne=P.length>0||u.some(we=>!!we.folder),Ae=E&&ne&&!I,_e=l.useMemo(()=>{if(!Ae)return[];const we=new Map,Ke=[];for(const Re of u)if(Re.folder){const Be=Re.folder;we.has(Be)||we.set(Be,[]),we.get(Be).push(Re)}else Ke.push(Re);const ce=[],ie=[...we.keys()].sort((Re,Be)=>Re.localeCompare(Be));for(const Re of ie)ce.push({folder:Re,label:Qg(Re),projects:we.get(Re)});return Ke.length>0&&ce.push({folder:null,label:"Other projects",projects:Ke}),ce},[u,Ae]);return F?t.jsxs(ait,{children:[t.jsx(lit,{children:F.name||`Workspace ${F.id}`}),t.jsx(cit,{children:"Projects in this workspace."}),t.jsxs(dit,{children:[t.jsx(at,{disabled:ne,content:"No folders yet. Assign folders to projects via the card menu to use filtering.",onlyIfTruncated:!1,children:t.jsx("div",{style:{width:"12rem"},children:t.jsx(Fn,{value:I,onChange:we=>A(we),options:[{value:"",label:"All folders"},...P.map(we=>({value:we,label:Qg(we)}))],placeholder:"Folder",size:"sm",disabled:!ne})})}),!I&&t.jsx(at,{disabled:ne,content:"No folders yet. Assign folders to projects via the card menu to use grouping.",onlyIfTruncated:!1,children:t.jsx("span",{style:{display:"inline-flex"},children:t.jsx(he,{type:"button",size:"sm",variant:E&&ne?"primary":"outline",leftIcon:t.jsx(jy,{size:14}),onClick:()=>{ne&&B(we=>!we)},disabled:!ne,children:"Group"})})}),Y?t.jsx(at,{disabled:!ee,content:F.role==="owner"?t.jsxs(t.Fragment,{children:["Project limit reached. ",t.jsx("button",{type:"button",onClick:()=>U(!0),style:{color:"inherit",fontWeight:850,textDecoration:"underline",background:"none",border:"none",padding:0,font:"inherit",cursor:"pointer"},children:"Upgrade your plan"})," to add more."]}):"Project limit reached. Ask your workspace owner to upgrade the plan.",onlyIfTruncated:!1,children:t.jsx("span",{style:{display:"inline-flex"},children:t.jsx(he,{type:"button",size:"sm",variant:"primary",leftIcon:t.jsx(gr,{size:16}),disabled:ee,onClick:async()=>{if(ee)return;const we=await ue(`/api/v1/organizations/${F.id}/projects/add_flow/start`,{method:"POST"}),Ke=await we.json().catch(()=>({}));if(!we.ok){const ce=String(Ke?.error||"Failed to start add-project flow");j(ce);return}Ke?.user&&r(Ke.user),e(`/workspaces/${F.id}/projects/new?step=website`)},children:"Add project"})})}):null,t.jsx("div",{style:{width:"11rem"},children:t.jsx(Fn,{value:K,onChange:we=>G(we),options:zit,placeholder:"Sort",size:"sm"})}),t.jsx(Ed,{value:X,onChange:Q,placeholder:"Searchâ¦",containerStyle:{width:"15rem",minWidth:0}})]}),w?t.jsx(CK,{children:w}):null,x?t.jsx(dAe,{cards:9}):u.length===0?t.jsx(CK,{children:"No projects found."}):Ae?t.jsx(Sit,{children:_e.map(we=>t.jsxs(_it,{children:[t.jsxs(wit,{children:[t.jsx(jy,{size:16}),we.label,t.jsx(jit,{children:we.projects.length})]}),t.jsx(Cit,{children:we.projects.map(Ke=>t.jsx(IK,{project:Ke,orgId:F.id,navigate:e,showFolder:!1,orgTags:T,folderSuggestions:P,onProjectUpdated:W,onOrgTagCreated:oe,onOrgTagDeleted:se,canEdit:Y},Ke.id))})]},we.folder??"__none"))}):t.jsx(uit,{children:u.map(we=>t.jsx(IK,{project:we,orgId:F.id,navigate:e,showFolder:!0,orgTags:T,folderSuggestions:P,onProjectUpdated:W,onOrgTagCreated:oe,onOrgTagDeleted:se,canEdit:Y},we.id))}),!x&&de>0?t.jsx(yit,{children:t.jsx(pi,{page:me,totalPages:le,total:de,onPrev:()=>q(we=>Math.max(1,we-1)),onNext:()=>q(we=>Math.min(le,we+1))})}):null,t.jsx(ec,{isOpen:H,orgId:F.id,onClose:()=>U(!1)})]}):null}const Rit=p.div.withConfig({displayName:"WorkspaceOverview__Wrapper",componentId:"sc-1u0qzs5-0"})` 10410 padding: 2rem; 10411 height: 100%; 10412 display: flex; 10413 flex-direction: column; 10414 min-height: 0; 10415`,Oit=p.h1.withConfig({displayName:"WorkspaceOverview__Title",componentId:"sc-1u0qzs5-1"})` 10416 font-size: 1.25rem; 10417 font-weight: 700; 10418 color: ${O}; 10419 margin: 0 0 0.5rem 0; 10420`,Dit=p.p.withConfig({displayName:"WorkspaceOverview__Subtitle",componentId:"sc-1u0qzs5-2"})` 10421 font-size: 0.875rem; 10422 color: ${z}; 10423 margin: 0; 10424`,Lit=p.div.withConfig({displayName:"WorkspaceOverview__TableScroll",componentId:"sc-1u0qzs5-3"})` 10425 margin-top: 1.25rem; 10426 flex: 1 1 auto; 10427 min-height: 0; 10428 width: 100%; 10429 overflow-y: auto; 10430 overflow-x: hidden; 10431 -webkit-overflow-scrolling: touch; 10432 border: 1px solid ${V}; 10433 border-radius: 0.875rem; 10434 background: ${Z}; 10435 10436 /* Only allow horizontal scrolling on mobile. */ 10437 @media (max-width: 768px) { 10438 overflow-x: auto; 10439 } 10440`,Bit=p(nr).withConfig({displayName:"WorkspaceOverview__Table",componentId:"sc-1u0qzs5-4"})` 10441 table-layout: fixed; 10442 width: 100%; 10443 min-width: auto; 10444 10445 /* Mobile: allow horizontal scroll for wide tables. */ 10446 @media (max-width: 768px) { 10447 min-width: 1120px; 10448 } 10449`,Fit=p(pr).withConfig({displayName:"WorkspaceOverview__THead",componentId:"sc-1u0qzs5-5"})` 10450 position: sticky; 10451 top: 0; 10452 z-index: 2; 10453 background: ${At}; 10454`,Wit=p(Cn).withConfig({displayName:"WorkspaceOverview__TR",componentId:"sc-1u0qzs5-6"})` 10455 cursor: ${e=>e.$clickable?"pointer":"default"}; 10456 10457 &:hover { 10458 background: ${e=>e.$clickable?$e:Z}; 10459 } 10460`,hm=p(bt).withConfig({displayName:"WorkspaceOverview__TD",componentId:"sc-1u0qzs5-7"})` 10461 overflow: hidden; 10462 min-width: 0; 10463`,Uit=p.div.withConfig({displayName:"WorkspaceOverview__NameCell",componentId:"sc-1u0qzs5-8"})` 10464 display: inline-flex; 10465 align-items: center; 10466 gap: 0.6rem; 10467 min-width: 0; 10468`,Hit=p.div.withConfig({displayName:"WorkspaceOverview__NameText",componentId:"sc-1u0qzs5-9"})` 10469 min-width: 0; 10470 overflow: hidden; 10471 text-overflow: ellipsis; 10472 white-space: nowrap; 10473 font-weight: 850; 10474 color: ${O}; 10475`,h8=p.span.withConfig({displayName:"WorkspaceOverview__Muted",componentId:"sc-1u0qzs5-10"})` 10476 color: ${z}; 10477 font-weight: 800; 10478`,qit=p.div.withConfig({displayName:"WorkspaceOverview__Trend",componentId:"sc-1u0qzs5-11"})` 10479 display: inline-flex; 10480 align-items: center; 10481 gap: 0.5rem; 10482 white-space: nowrap; 10483`,Git=p.div.withConfig({displayName:"WorkspaceOverview__SparkWrap",componentId:"sc-1u0qzs5-12"})` 10484 width: 132px; 10485 height: 36px; 10486 display: inline-flex; 10487 align-items: center; 10488 justify-content: flex-start; 10489`,Vit=p.div.withConfig({displayName:"WorkspaceOverview__PerfIcons",componentId:"sc-1u0qzs5-13"})` 10490 display: inline-flex; 10491 align-items: center; 10492 gap: 0.35rem; 10493 flex-wrap: wrap; 10494`,Kit=p.span.withConfig({displayName:"WorkspaceOverview__PerfIconChip",componentId:"sc-1u0qzs5-14"})` 10495 border: 1px solid ${V}; 10496 background: ${Z}; 10497 border-radius: 0.55rem; 10498 width: 28px; 10499 height: 28px; 10500 padding: 0; 10501 display: inline-flex; 10502 align-items: center; 10503 justify-content: center; 10504 opacity: ${e=>e.$muted?.35:1}; 10505 10506 svg { 10507 width: 16px; 10508 height: 16px; 10509 } 10510`,PK=p.span.withConfig({displayName:"WorkspaceOverview__UnknownIcon",componentId:"sc-1u0qzs5-15"})` 10511 width: 16px; 10512 height: 16px; 10513 border-radius: 999px; 10514 border: 1px solid ${V}; 10515 display: inline-flex; 10516 align-items: center; 10517 justify-content: center; 10518 font-size: 10px; 10519 font-weight: 900; 10520 color: ${z}; 10521`,AK=p.span.withConfig({displayName:"WorkspaceOverview__TrendPill",componentId:"sc-1u0qzs5-16"})` 10522 display: inline-flex; 10523 align-items: center; 10524 gap: 0.2rem; 10525 font-size: 0.55rem; 10526 font-weight: 950; 10527 padding: 0.06rem 0.3rem; 10528 border-radius: 9999px; 10529 border: 1px solid 10530 ${e=>e.$neutral?"rgba(107, 114, 128, 0.25)":e.$positive?"rgba(16, 185, 129, 0.22)":"rgba(239, 68, 68, 0.22)"}; 10531 color: ${e=>e.$neutral?z:e.$positive?"#065F46":"#991B1B"}; 10532 background: ${e=>e.$neutral?"rgba(107, 114, 128, 0.08)":e.$positive?"rgba(16, 185, 129, 0.12)":"rgba(239, 68, 68, 0.12)"}; 10533 white-space: nowrap; 10534`,Yit=p.div.withConfig({displayName:"WorkspaceOverview__PillsWrap",componentId:"sc-1u0qzs5-17"})` 10535 display: flex; 10536 align-items: center; 10537 gap: 0.3rem; 10538 flex-wrap: wrap; 10539`,Xit=p.span.withConfig({displayName:"WorkspaceOverview__FolderPill",componentId:"sc-1u0qzs5-18"})` 10540 display: inline-flex; 10541 align-items: center; 10542 gap: 0.22rem; 10543 padding: 0.1rem 0.4rem; 10544 border-radius: 0.25rem; 10545 font-size: 0.6rem; 10546 font-weight: 800; 10547 line-height: 1.35; 10548 color: ${O}; 10549 background: ${$e}; 10550 white-space: nowrap; 10551 max-width: 100%; 10552 overflow: hidden; 10553 text-overflow: ellipsis; 10554`,Qit=p.span.withConfig({displayName:"WorkspaceOverview__TagPill",componentId:"sc-1u0qzs5-19"})` 10555 display: inline-flex; 10556 align-items: center; 10557 padding: 0.1rem 0.4rem; 10558 border-radius: 0.25rem; 10559 font-size: 0.6rem; 10560 font-weight: 800; 10561 line-height: 1.35; 10562 color: #fff; 10563 background: ${e=>e.$bg}; 10564 white-space: nowrap; 10565 max-width: 100%; 10566 overflow: hidden; 10567 text-overflow: ellipsis; 10568`,Zit=p.div.withConfig({displayName:"WorkspaceOverview__TooltipList",componentId:"sc-1u0qzs5-20"})` 10569 display: flex; 10570 flex-direction: column; 10571 gap: 0.45rem; 10572 min-width: 220px; 10573`,Jit=p.div.withConfig({displayName:"WorkspaceOverview__TooltipRow",componentId:"sc-1u0qzs5-21"})` 10574 display: flex; 10575 align-items: center; 10576 justify-content: space-between; 10577 gap: 0.75rem; 10578`,ert=p.div.withConfig({displayName:"WorkspaceOverview__TooltipLeft",componentId:"sc-1u0qzs5-22"})` 10579 display: inline-flex; 10580 align-items: center; 10581 gap: 0.5rem; 10582 min-width: 0; 10583`,trt=p.div.withConfig({displayName:"WorkspaceOverview__TooltipName",componentId:"sc-1u0qzs5-23"})` 10584 min-width: 0; 10585 overflow: hidden; 10586 text-overflow: ellipsis; 10587 white-space: nowrap; 10588 font-size: 0.8125rem; 10589 font-weight: 850; 10590 color: ${O}; 10591`,nrt=p.div.withConfig({displayName:"WorkspaceOverview__TooltipVal",componentId:"sc-1u0qzs5-24"})` 10592 font-size: 0.8125rem; 10593 font-weight: 900; 10594 color: ${O}; 10595 white-space: nowrap; 10596`,irt=p.button.withConfig({displayName:"WorkspaceOverview__ReportCellBtn",componentId:"sc-1u0qzs5-25"})` 10597 display: inline-flex; 10598 align-items: center; 10599 gap: 0.3rem; 10600 padding: 0.3rem 0.6rem; 10601 font-size: 0.72rem; 10602 font-weight: 750; 10603 font-family: inherit; 10604 color: ${Z}; 10605 background: ${Ft}; 10606 border: none; 10607 border-radius: 0.325rem; 10608 cursor: pointer; 10609 white-space: nowrap; 10610 transition: background 0.15s; 10611 &:hover { background: ${Kl}; } 10612`,rrt=p.div.withConfig({displayName:"WorkspaceOverview__PaginationRow",componentId:"sc-1u0qzs5-26"})` 10613 margin-top: auto; 10614 display: flex; 10615 justify-content: flex-end; 10616 padding-top: 0.75rem; 10617 background: ${At}; 10618`;function NK(e){return e.replace(/\b\w/g,n=>n.toUpperCase())}function mb(e){if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e=="string"){const n=e.trim();if(!n)return null;const i=Number(n);return Number.isFinite(i)?i:null}return null}function zK(e){const n=mb(e);return typeof n!="number"?"â":`${Math.round(n)}%`}function ort({series:e}){const n=l.useId().replace(/[^a-zA-Z0-9_-]/g,""),r=(Array.isArray(e)?e:[]).map(S=>mb(S?.score)),o=r.filter(S=>typeof S=="number");if(o.length===0)return t.jsx(h8,{children:"â"});const s=132,a=36,c=2,u=3,m=Math.min(...o),h=Math.max(...o),g=Math.max(1e-6,h-m),x=Math.max(2,r.length),y=(s-c*2)/(x-1),w=S=>u+(a-u*2)*(1-(S-m)/g),j=Array.from({length:x}).map((S,I)=>{const A=r[I]??null;return typeof A!="number"?null:{x:c+y*I,y:w(A)}});let v="";for(const S of j)S&&(v+=v?` L ${S.x.toFixed(2)} ${S.y.toFixed(2)}`:`M ${S.x.toFixed(2)} ${S.y.toFixed(2)}`);const _=j.find(S=>!!S),$=[...j].reverse().find(S=>!!S),k=a-u,P=_&&$?`${v} L ${$.x.toFixed(2)} ${k.toFixed(2)} L ${_.x.toFixed(2)} ${k.toFixed(2)} Z`:"";return t.jsxs("svg",{width:s,height:a,viewBox:`0 0 ${s} ${a}`,role:"img","aria-label":"Visibility score trend",children:[t.jsx("defs",{children:t.jsxs("linearGradient",{id:`sparkFill-${n}`,x1:"0",x2:"0",y1:"0",y2:"1",children:[t.jsx("stop",{offset:"0%",stopColor:ot,stopOpacity:"0.35"}),t.jsx("stop",{offset:"100%",stopColor:ot,stopOpacity:"0.04"})]})}),P?t.jsx("path",{d:P,fill:`url(#sparkFill-${n})`}):null,t.jsx("path",{d:v,fill:"none",stroke:ot,strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]})}function srt(){const e=zn(),{workspaceId:n}=Gn(),{user:i}=yn(),{enabledModelKeys:r,modelByKey:o}=eC(),s=i?.organizations||[],a=25,c=l.useMemo(()=>{const T=Number(n);return Number.isFinite(T)?T:null},[n]),u=l.useMemo(()=>c&&s.find(T=>T.id===c)||null,[s,c]);l.useEffect(()=>{if(s.length===0){e("/",{replace:!0});return}
10618(!c||!u)&&e(`/workspaces/${s[0].id}/overview`,{replace:!0})},[s,c,u,e]);const[m,h]=l.useState([]),[g,x]=l.useState({page:1,per_page:a,total:0,total_pages:1}),[y,w]=l.useState(1),[j,v]=l.useState(!1),[_,$]=l.useState(null),[k,P]=l.useState(null),[S,I]=l.useState(!1),A=l.useMemo(()=>c&&i?.organizations?.find(T=>Number(T.id)===Number(c))?.role||null,[c,i?.organizations]);if(l.useEffect(()=>{let T=!1;if(!u?.id)return;const M=Math.max(1,y);if(M!==y){w(M);return}return(async()=>{v(!0),$(null);try{const R=new URLSearchParams;R.set("page",String(M)),R.set("per_page",String(a));const F=await ue(`/api/v1/organizations/${u.id}/overview?${R.toString()}`,{method:"GET"}),Y=await F.json().catch(()=>({}));if(!F.ok)throw new Error(Y?.error||Y?.errors?.[0]||"Failed to load overview");if(T)return;const H=Array.isArray(Y.projects)?Y.projects:[];h(H);const U=Y.pagination;x(U&&typeof U=="object"?{page:Number(U.page)||M,per_page:Number(U.per_page)||a,total:Number(U.total)||0,total_pages:Number(U.total_pages)||1}:{page:M,per_page:a,total:H.length,total_pages:1})}catch(R){if(T)return;h([]),x({page:M,per_page:a,total:0,total_pages:1}),$(R?.message||"Failed to load overview")}finally{if(T)return;v(!1)}})(),()=>{T=!0}},[a,u?.id,y]),!u)return null;const E=Math.max(1,Number(g.total_pages)||1),B=Math.min(Math.max(1,y),E);return t.jsxs(Rit,{children:[t.jsx(Oit,{children:"Brand comparison"}),t.jsx(Dit,{children:"Compare project visibility and LLM performance across this workspace."}),_?t.jsx("div",{style:{marginTop:"1.25rem",color:z,fontSize:"0.875rem"},children:_}):null,j?t.jsx(uAe,{}):m.length===0?t.jsx("div",{style:{marginTop:"1.25rem",color:z,fontSize:"0.875rem"},children:"No projects found."}):t.jsx(Lit,{children:t.jsxs(Bit,{children:[t.jsx(Fit,{children:t.jsxs(Cn,{children:[t.jsx(Et,{style:{width:"12%"},children:"Brand"}),t.jsx(Et,{style:{width:"7%"}}),t.jsx(Ai,{style:{width:"12%"},tooltip:"Folder and tags assigned to the project.",children:"Labels"}),t.jsx(Ai,{style:{width:"10%"},tooltip:"Visibility score trend over the last 7 days (daily).",children:"Visibility"}),t.jsx(Ai,{style:{width:"10%"},tooltip:"Current visibility score and change vs the same day last week.",children:"Weekly trend"}),t.jsx(Ai,{style:{width:"6%"},tooltip:"Project status. All projects shown here are Active.",children:"Status"}),t.jsx(Ai,{style:{width:"8%"},tooltip:"Count of active actions (Todo + In progress). Completed/skipped actions are excluded.",children:"Actions"}),t.jsx(Ai,{style:{width:"7%"},tooltip:"Count of active (non-archived) prompts in this project.",children:"Prompts"}),t.jsx(Ai,{style:{width:"15%"},tooltip:"Per-model visibility score for the latest available scan. Hover to see details.",children:"LLM performance"})]})}),t.jsx(mr,{children:m.map(T=>{const M=T?.project,R=Array.isArray(T?.visibility_series)?T.visibility_series:[],F=mb(T?.visibility_score),Y=mb(T?.weekly_trend_delta),H=T?.llm_performance&&typeof T.llm_performance=="object"?T.llm_performance:{},U=r.length>0?r:Object.keys(H),X=t.jsx(Zit,{children:U.map(Q=>{const K=o[String(Q)],G=K?.label||String(Q||"â"),L=K?.Icon,q=mb(H?.[Q]);return t.jsxs(Jit,{children:[t.jsxs(ert,{children:[L?t.jsx("span",{style:{display:"inline-flex",alignItems:"center"},"aria-hidden":"true",children:t.jsx(L,{})}):t.jsx(PK,{"aria-hidden":"true",children:String(G||"?").slice(0,1).toUpperCase()}),t.jsx(trt,{title:G,children:G})]}),t.jsx(nrt,{children:zK(q)})]},String(Q))})});return t.jsxs(Wit,{$clickable:!0,onClick:()=>{M?.id&&e(`/workspaces/${u.id}/projects/${M.id}`)},children:[t.jsx(hm,{children:t.jsxs(Uit,{children:[t.jsx(By,{logoUrl:M?.logo_url,size:20}),t.jsx(at,{content:M?.name||"",onlyIfTruncated:!0,children:t.jsx(Hit,{children:M?.name||"â"})})]})}),t.jsx(hm,{children:M?.id&&t.jsxs(irt,{onClick:Q=>{Q.stopPropagation(),P(M.id)},children:[t.jsx(W5,{size:12}),"Report"]})}),t.jsx(hm,{children:t.jsxs(Yit,{children:[M?.folder&&t.jsxs(Xit,{children:[t.jsx(jy,{size:9}),NK(M.folder)]}),Array.isArray(M?.tags)&&M.tags.slice(0,3).map(Q=>t.jsx(Qit,{$bg:Q.color,children:NK(Q.name)},Q.id)),!M?.folder&&(!Array.isArray(M?.tags)||M.tags.length===0)&&t.jsx(h8,{children:"â"})]})}),t.jsx(hm,{children:t.jsx(Git,{children:t.jsx(ort,{series:R})})}),t.jsx(hm,{children:t.jsxs(qit,{children:[t.jsx("span",{style:{fontWeight:950},children:zK(F)}),typeof Y!="number"?t.jsx(AK,{$neutral:!0,children:"â"}):t.jsxs(AK,{$positive:Y>=0,children:[Y>=0?t.jsx(qi,{size:11}):t.jsx(ul,{size:11}),Y>=0?"+":"",Y.toFixed(0),"%"]})]})}),t.jsx(hm,{children:t.jsx("span",{style:{fontWeight:900},children:"Active"})}),t.jsx(hm,{children:t.jsx("span",{style:{fontWeight:900},children:Number(T?.actions_active_count||0)})}),t.jsx(hm,{children:t.jsx("span",{style:{fontWeight:900},children:Number(T?.prompts_active_count||0)})}),t.jsx(hm,{children:U.length===0?t.jsx(h8,{children:"â"}):t.jsx(at,{content:X,size:"sm",maxWidth:360,backgroundColor:Z,textColor:O,children:t.jsx(Vit,{"aria-label":"LLM performance",children:U.map(Q=>{const K=o[String(Q)],G=K?.label||String(Q||"â"),L=K?.Icon,q=mb(H?.[Q]);return t.jsx(Kit,{$muted:typeof q!="number",title:G,"aria-label":G,children:L?t.jsx(L,{}):t.jsx(PK,{children:String(G||"?").slice(0,1).toUpperCase()})},String(Q))})})})})]},M?.id)})})]})}),!j&&(g.total||0)>
106180?t.jsx(rrt,{children:t.jsx(pi,{page:B,totalPages:E,total:Number(g.total)||0,onPrev:()=>w(T=>Math.max(1,T-1)),onNext:()=>w(T=>Math.min(E,T+1))})}):null,t.jsx(cie,{isOpen:k!==null,onClose:()=>P(null),workspaceId:u.id,projectId:k??0,reportEnabled:!!u.report_enabled,whiteLabelEnabled:!!u.report_white_label,isOwner:A==="owner",onUpgrade:()=>I(!0),orgLogoUrl:u.logo_url}),t.jsx(ec,{isOpen:S,orgId:u.id,onClose:()=>I(!1)})]})}function MA(e,n){const i=l.useContext(TM);if(!i)throw new Error("useProjectCompetitors must be used within a ProjectCompetitorsProvider");const r=Number(e),o=Number(n),s=Number.isFinite(r)&&r>0&&Number.isFinite(o)&&o>0,a=s?i.getEntry(r,o):{data:null,loading:!1,error:null},c=l.useCallback(async m=>s?i.ensureLoaded(r,o,{force:m?.force??!0}):null,[i,r,o,s]),u=l.useCallback(()=>{s&&i.ensureLoaded(r,o)},[i,r,o,s]);return{data:a.data,direct:a.data?.direct||[],suggested:a.data?.suggested||[],max_competitors:a.data?.max_competitors??null,project_website:a.data?.project_website??null,summary:a.data?.summary??null,loading:a.loading,error:a.error,ensure:u,refresh:c,createCompetitor:s?m=>i.createCompetitor(r,o,m):null,updateCompetitor:s?(m,h)=>i.updateCompetitor(r,o,m,h):null,updateCompetitorAliases:s?(m,h)=>i.updateCompetitorAliases(r,o,m,h):null,deleteCompetitor:s?m=>i.deleteCompetitor(r,o,m):null,invalidate:s?()=>i.invalidate(r,o):null}}const xde=l.createContext(null);function Iw(e,n){return`${e}:${n}`}function art({children:e}){const[n,i]=l.useState({}),r=l.useRef({}),o=120*1e3,s=l.useCallback((x,y)=>{const w=Iw(x,y);return n[w]||{topics:[],loading:!1,error:null,lastFetchedAt:null}},[n]),a=l.useCallback((x,y)=>{i(w=>{const j=w[x]||{topics:[],loading:!1,error:null,lastFetchedAt:null};return{...w,[x]:{...j,...y}}})},[]),c=l.useCallback(async(x,y,w)=>{if(!Number.isFinite(x)||x<=0||!Number.isFinite(y)||y<=0)return[];const j=Iw(x,y),v=s(x,y),_=Date.now(),$=v.lastFetchedAt&&_-v.lastFetchedAt<o;if(!w?.force&&v.topics.length>0&&$)return v.topics;const k=r.current[j];if(k)return k;a(j,{loading:!0,error:null});const P=(async()=>{try{const S=await ue(`/api/v1/organizations/${x}/projects/${y}/topics`,{method:"GET"}),I=await S.json().catch(()=>({}));if(!S.ok)throw new Error(I?.error||I?.errors?.[0]||"Failed to load topics");const A=(Array.isArray(I?.topics)?I.topics:[]).map(E=>({id:Number(E?.id),name:String(E?.name||"").trim()})).filter(E=>Number.isFinite(E.id)&&E.id>0&&E.name);return A.sort((E,B)=>E.name.localeCompare(B.name)),a(j,{topics:A,loading:!1,error:null,lastFetchedAt:Date.now()}),A}catch(S){return a(j,{topics:[],loading:!1,error:S?.message||"Failed to load topics",lastFetchedAt:Date.now()}),[]}finally{delete r.current[j]}})();return r.current[j]=P,P},[s,a]),u=l.useCallback(async(x,y,w)=>{const j=Iw(x,y);a(j,{loading:!0,error:null});const v=await ue(`/api/v1/organizations/${x}/projects/${y}/topics`,{method:"POST",body:JSON.stringify({name:w})}),_=await v.json().catch(()=>({}));if(!v.ok)throw a(j,{loading:!1,error:_?.error||_?.errors?.[0]||"Failed to create topic"}),new Error(_?.error||_?.errors?.[0]||"Failed to create topic");const $=_?.topic,k={id:Number($?.id),name:String($?.name||"").trim()};if(!Number.isFinite(k.id)||k.id<=0||!k.name)throw a(j,{loading:!1,error:"Invalid server response"}),new Error("Invalid server response");return i(P=>{const S=P[j]||{topics:[],loading:!1,error:null,lastFetchedAt:null},I=S.topics.some(A=>Number(A.id)===Number(k.id))?S.topics.map(A=>Number(A.id)===Number(k.id)?k:A):[...S.topics,k];return I.sort((A,E)=>A.name.localeCompare(E.name)),{...P,[j]:{...S,topics:I,loading:!1,error:null,lastFetchedAt:Date.now()}}}),k},[a]),m=l.useCallback(async(x,y,w)=>{const j=Iw(x,y);a(j,{loading:!0,error:null});const v=await ue(`/api/v1/organizations/${x}/projects/${y}/topics/${w}`,{method:"DELETE"}),_=await v.json().catch(()=>({}));if(!v.ok)throw a(j,{loading:!1,error:_?.error||_?.errors?.[0]||"Failed to delete topic"}),new Error(_?.error||_?.errors?.[0]||"Failed to delete topic");i($=>{const k=$[j]||{topics:[],loading:!1,error:null,lastFetchedAt:null},P=k.topics.filter(S=>Number(S.id)!==Number(w));
10618return{...$,[j]:{...k,topics:P,loading:!1,error:null,lastFetchedAt:Date.now()}}})},[a]),h=l.useCallback((x,y)=>{const w=Iw(x,y);i(j=>{const v={...j};return delete v[w],v})},[]),g=l.useMemo(()=>({getEntry:s,ensureLoaded:c,createTopic:u,deleteTopic:m,invalidate:h}),[u,m,c,s,h]);return t.jsx(xde.Provider,{value:g,children:e})}function S1(e,n){const i=l.useContext(xde);if(!i)throw new Error("useProjectTopics must be used within a ProjectTopicsProvider");const r=Number(e),o=Number(n),s=Number.isFinite(r)&&r>0&&Number.isFinite(o)&&o>0,a=s?i.getEntry(r,o):{topics:[],loading:!1,error:null},c=l.useCallback(()=>{s&&i.ensureLoaded(r,o)},[i,r,o,s]),u=l.useCallback(async m=>s?i.ensureLoaded(r,o,{force:m?.force??!0}):[],[i,r,o,s]);return{topics:a.topics,loading:a.loading,error:a.error,ensure:c,refresh:u,createTopic:s?m=>i.createTopic(r,o,m):null,deleteTopic:s?m=>i.deleteTopic(r,o,m):null,invalidate:s?()=>i.invalidate(r,o):null}}const lrt=p.div.withConfig({displayName:"WorkspaceProjectPage__Page",componentId:"sc-157hovd-0"})` 10619 padding: 1.25rem; 10620`,crt=p.button.withConfig({displayName:"WorkspaceProjectPage__ReportBtn",componentId:"sc-157hovd-1"})` 10621 display: inline-flex; 10622 align-items: center; 10623 gap: 0.4rem; 10624 padding: 0.4rem 0.85rem; 10625 font-size: 0.8rem; 10626 font-weight: 850; 10627 font-family: inherit; 10628 color: ${Z}; 10629 background: ${Ft}; 10630 border: none; 10631 border-radius: 0.375rem; 10632 cursor: pointer; 10633 white-space: nowrap; 10634 margin-left: auto; 10635 flex-shrink: 0; 10636 transition: background 0.15s; 10637 &:hover { background: ${Kl}; } 10638 & > span { @media (max-width: 768px) { display: none; } } 10639 @media (max-width: 768px) { padding: 0.4rem 0.55rem; } 10640`,drt=p.div.withConfig({displayName:"WorkspaceProjectPage__Hero",componentId:"sc-157hovd-2"})` 10641 padding: 0; 10642`,urt=p.div.withConfig({displayName:"WorkspaceProjectPage__HeroTop",componentId:"sc-157hovd-3"})` 10643 display: flex; 10644 align-items: flex-start; 10645 justify-content: space-between; 10646 gap: 1rem; 10647 flex-wrap: wrap; 10648`,prt=p.div.withConfig({displayName:"WorkspaceProjectPage__FiltersBar",componentId:"sc-157hovd-4"})` 10649 margin-top: 0.6rem; 10650 display: flex; 10651 align-items: center; 10652 justify-content: flex-start; 10653 gap: 0.75rem; 10654 flex-wrap: wrap; 10655 width: 100%; 10656`,mrt=p.div.withConfig({displayName:"WorkspaceProjectPage__FilterGroup",componentId:"sc-157hovd-5"})` 10657 display: flex; 10658 align-items: center; 10659 gap: 0.5rem; 10660 flex-wrap: wrap; 10661`,hrt=p.div.withConfig({displayName:"WorkspaceProjectPage__DashboardGrid",componentId:"sc-157hovd-6"})` 10662 margin-top: 0.5rem; 10663 display: grid; 10664 grid-template-columns: 1fr; 10665 gap: 1rem; 10666 min-height: 0; 10667 10668 @media (min-width: 1024px) { 10669 grid-template-columns: 1fr 1fr; 10670 align-items: stretch; 10671 } 10672`,frt=p.div.withConfig({displayName:"WorkspaceProjectPage__LeftStack",componentId:"sc-157hovd-7"})` 10673 display: grid; 10674 grid-template-columns: 1fr; 10675 gap: 1rem; 10676 min-height: 0; 10677 height: 100%; 10678`,grt=p.div.withConfig({displayName:"WorkspaceProjectPage__RightStack",componentId:"sc-157hovd-8"})` 10679 display: grid; 10680 grid-template-columns: 1fr; 10681 gap: 1rem; 10682 height: 100%; 10683 grid-auto-rows: 1fr; 10684 min-height: 0; 10685`,yrt=p.div.withConfig({displayName:"WorkspaceProjectPage__BottomHalfRow",componentId:"sc-157hovd-9"})` 10686 margin-top: 1rem; 10687 display: grid; 10688 grid-template-columns: 1fr; 10689 gap: 1rem; 10690 10691 @media (min-width: 640px) { 10692 grid-template-columns: 1fr 1fr; 10693 } 10694 10695 & > * { 10696 min-height: 280px; 10697 } 10698`,bde=p.div.withConfig({displayName:"WorkspaceProjectPage__Card",componentId:"sc-157hovd-10"})` 10699 border: 1px solid ${V}; 10700 background: ${Z}; 10701 border-radius: 0.875rem; 10702 padding: 1rem; 10703 min-width: 0; 10704`,TK=p(bde).withConfig({displayName:"WorkspaceProjectPage__HalfRowCard",componentId:"sc-157hovd-11"})` 10705 border: 1px solid ${V}; 10706 background: ${Z}; 10707 border-radius: 0.875rem; 10708 padding: 1rem; 10709 min-width: 0; 10710 display: flex; 10711 flex-direction: column; 10712 min-height: 0; 10713 10714 height: clamp(480px, 60vh, 820px); 10715 10716 @media (max-width: 1023px) { 10717 height: clamp(450px, 62vh, 740px); 10718 } 10719`,O6=p.div.withConfig({displayName:"WorkspaceProjectPage__CardHeader",componentId:"sc-157hovd-12"})` 10720 display: flex; 10721 align-items: flex-start; 10722 justify-content: space-between; 10723 gap: 0.75rem; 10724`,D6=p.div.withConfig({displayName:"WorkspaceProjectPage__CardTitleRow",componentId:"sc-157hovd-13"})` 10725 display: inline-flex; 10726 align-items: center; 10727 gap: 0.5rem; 10728 min-width: 0; 10729`,L6=p.div.withConfig({displayName:"WorkspaceProjectPage__CardTitle",componentId:"sc-157hovd-14"})` 10730 font-size: 1.2rem; 10731 font-weight: 900; 10732 color: ${O}; 10733`,xrt=p.div.withConfig({displayName:"WorkspaceProjectPage__CardSub",componentId:"sc-157hovd-15"})` 10734 margin-top: 0.25rem; 10735 font-size: 0.8125rem; 10736 color: ${z}; 10737`,EK=p.div.withConfig({displayName:"WorkspaceProjectPage__ActionList",componentId:"sc-157hovd-16"})` 10738 margin-top: 0.75rem; 10739 display: flex; 10740 flex-direction: column; 10741 gap: 0.5rem; 10742`,brt=p(Dn).withConfig({displayName:"WorkspaceProjectPage__ActionRow",componentId:"sc-157hovd-17"})` 10743 border: 1px solid ${V}; 10744 background: ${Z}; 10745 border-radius: 0.75rem; 10746 padding: 0.7rem 0.85rem; 10747 text-decoration: none; 10748 color: ${O}; 10749 display: flex; 10750 align-items: center; 10751 gap: 0.75rem; 10752 transition: background 0.12s ease, border-color 0.12s ease; 10753 10754 &:hover { 10755 background: ${$e}; 10756 border-color: ${Pe}; 10757 } 10758`,vrt=p.span.withConfig({displayName:"WorkspaceProjectPage__ActionColorBar",componentId:"sc-157hovd-18"})` 10759 flex-shrink: 0; 10760 width: 3px; 10761 align-self: stretch; 10762 border-radius: 999px; 10763 background: ${e=>e.$color}; 10764`,wrt=p.div.withConfig({displayName:"WorkspaceProjectPage__ActionRowBody",componentId:"sc-157hovd-19"})` 10765 min-width: 0; 10766 flex: 1; 10767 display: flex; 10768 flex-direction: column; 10769 gap: 0.2rem; 10770`,jrt=p.div.withConfig({displayName:"WorkspaceProjectPage__ActionTitle",componentId:"sc-157hovd-20"})` 10771 font-size: 0.88rem; 10772 font-weight: 900; 10773 color: ${O}; 10774 overflow: hidden; 10775 text-overflow: ellipsis; 10776 white-space: nowrap; 10777 max-width: 100%; 10778 line-height: 1.25; 10779`,_rt=p.div.withConfig({displayName:"WorkspaceProjectPage__ActionMeta",componentId:"sc-157hovd-21"})` 10780 display: flex; 10781 align-items: center; 10782 gap: 0.5rem; 10783 flex-wrap: wrap; 10784`,Crt=p.span.withConfig({displayName:"WorkspaceProjectPage__ActionTypeBadge",componentId:"sc-157hovd-22"})` 10785 font-size: 0.68rem; 10786 font-weight: 900; 10787 letter-spacing: 0.03em; 10788 color: ${e=>e.$color||z}; 10789`,Srt=p.span.withConfig({displayName:"WorkspaceProjectPage__ActionPill",componentId:"sc-157hovd-23"})` 10790 display: inline-flex; 10791 align-items: center; 10792 gap: 4px; 10793 padding: 0.1rem 0.4rem; 10794 border-radius: 999px; 10795 font-size: 0.68rem; 10796 font-weight: 950; 10797 background: ${e=>e.$bg||$e}; 10798 color: ${e=>e.$fg||O}; 10799 white-space: nowrap; 10800`,MK=p.span.withConfig({displayName:"WorkspaceProjectPage__ActionMetaDot",componentId:"sc-157hovd-24"})` 10801 width: 3px; 10802 height: 3px; 10803 border-radius: 50%; 10804 background: ${Pe}; 10805 flex-shrink: 0; 10806`,krt=Tn` 10807 from { transform: rotate(0deg); } 10808 to { transform: rotate(360deg); } 10809`,$rt=p.span.withConfig({displayName:"WorkspaceProjectPage__SpinIcon",componentId:"sc-157hovd-25"})` 10810 display: inline-flex; 10811 animation: ${krt} 1s linear infinite; 10812`,Irt=p.span.withConfig({displayName:"WorkspaceProjectPage__GuideIndicator",componentId:"sc-157hovd-26"})` 10813 display: inline-flex; 10814 align-items: center; 10815 gap: 3px; 10816 font-size: 0.66rem; 10817 font-weight: 850; 10818 color: ${e=>e.$status==="ready"?"#10b981":e.$status==="generating"?"#f59e0b":e.$status==="failed"?"#ef4444":Pe}; 10819`,RK=p.div.withConfig({displayName:"WorkspaceProjectPage__HeaderStat",componentId:"sc-157hovd-27"})` 10820 display: inline-flex; 10821 align-items: baseline; 10822 justify-content: flex-end; 10823 gap: 0.4rem; 10824 min-width: 0; 10825`,OK=p.div.withConfig({displayName:"WorkspaceProjectPage__HeaderStatLabel",componentId:"sc-157hovd-28"})` 10826 font-size: 0.7rem; 10827 font-weight: 850; 10828 color: ${z}; 10829 white-space: nowrap; 10830`,DK=p.div.withConfig({displayName:"WorkspaceProjectPage__HeaderStatValue",componentId:"sc-157hovd-29"})` 10831 font-size: 1rem; 10832 font-weight: 950; 10833 color: ${O}; 10834 white-space: nowrap; 10835`,Prt=p.div.withConfig({displayName:"WorkspaceProjectPage__ChartWrap",componentId:"sc-157hovd-30"})` 10836 margin-top: 0.75rem; 10837 border: 1px solid ${V}; 10838 background: ${Z}; 10839 border-radius: 0.75rem; 10840 flex: 1; 10841 min-height: 0; 10842 display: flex; 10843 flex-direction: column; 10844 overflow-x: hidden; /* prevent a second (full-width) horizontal scrollbar */ 10845`,Art=p.div.withConfig({displayName:"WorkspaceProjectPage__ChartArea",componentId:"sc-157hovd-31"})` 10846 width: 100%; 10847 min-width: 0; 10848 flex: 1; 10849 min-height: 0; 10850 display: flex; 10851 flex-direction: column; 10852`,Nrt=p.div.withConfig({displayName:"WorkspaceProjectPage__ChartPlotWrap",componentId:"sc-157hovd-32"})` 10853 width: 100%; 10854 min-width: 0; 10855 flex: 1 1 auto; 10856 min-height: 0; 10857 overflow: hidden; /* ensure the chart never forces overflow */ 10858`,zrt=p.div.withConfig({displayName:"WorkspaceProjectPage__ChartSkeletonWrap",componentId:"sc-157hovd-33"})` 10859 height: 100%; 10860 display: grid; 10861 grid-template-columns: 44px 1fr; 10862 gap: 0.5rem; 10863`,Trt=p.div.withConfig({displayName:"WorkspaceProjectPage__ChartSkeletonYAxis",componentId:"sc-157hovd-34"})` 10864 display: flex; 10865 flex-direction: column; 10866 justify-content: space-between; 10867 padding: 0.25rem 0; 10868`,Ert=p.div.withConfig({displayName:"WorkspaceProjectPage__ChartSkeletonPlot",componentId:"sc-157hovd-35"})` 10869 height: 100%; 10870 width: 100%; 10871`,Mrt=p.div.withConfig({displayName:"WorkspaceProjectPage__ChartNoDataWrap",componentId:"sc-157hovd-36"})` 10872 position: relative; 10873 height: 100%; 10874 width: 100%; 10875 min-width: 0; 10876 display: flex; 10877 align-items: center; 10878 justify-content: center; 10879`,Rrt=p.div.withConfig({displayName:"WorkspaceProjectPage__TableScrollX",componentId:"sc-157hovd-37"})` 10880 width: 100%; 10881 min-width: 0; 10882`,Ort=p.div.withConfig({displayName:"WorkspaceProjectPage__TableScrollFillY",componentId:"sc-157hovd-38"})` 10883 width: 100%; 10884 min-width: 0; 10885 min-height: 0; 10886 flex: 1; 10887 overflow-y: auto; 10888 10889 /* Mobile: use a single scroll container for both axes (helps sticky headers on iOS). */ 10890 @media (max-width: 720px) { 10891 overflow-x: auto; 10892 } 10893`,Drt=p.div.withConfig({displayName:"WorkspaceProjectPage__MobileMinTable",componentId:"sc-157hovd-39"})` 10894 width: 100%; 10895 10896 @media (max-width: 720px) { 10897 min-width: 720px; 10898 } 10899`,Lrt=p.div.withConfig({displayName:"WorkspaceProjectPage__TooltipCard",componentId:"sc-157hovd-40"})` 10900 background: ${Z}; 10901 border: 1px solid ${V}; 10902 color: ${O}; 10903 border-radius: 0.75rem; 10904 padding: 0.5rem 0.625rem; 10905 box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12); 10906`,Brt=p.div.withConfig({displayName:"WorkspaceProjectPage__TooltipTitle",componentId:"sc-157hovd-41"})` 10907 font-size: 0.75rem; 10908 font-weight: 900; 10909 color: ${O}; 10910 margin-bottom: 0.25rem; 10911`,Frt=p.div.withConfig({displayName:"WorkspaceProjectPage__TooltipValue",componentId:"sc-157hovd-42"})` 10912 font-size: 0.75rem; 10913 font-weight: 700; 10914 color: ${z}; 10915`,Wrt=p.div.withConfig({displayName:"WorkspaceProjectPage__TableWrap",componentId:"sc-157hovd-43"})` 10916 margin-top: 0.75rem; 10917 border: 1px solid ${V}; 10918 background: ${Z}; 10919 border-radius: 0.75rem; 10920 overflow: hidden; /* scrolling happens inside TableScrollFillY */ 10921 flex: 1; 10922 min-height: 0; 10923 overscroll-behavior: contain; 10924 position: relative; 10925 display: flex; 10926 flex-direction: column; 10927 10928 /* Match prompt detail: let the card height drive the available space (mobile included). */ 10929`,Urt=p.div.withConfig({displayName:"WorkspaceProjectPage__TableLoadingOverlay",componentId:"sc-157hovd-44"})` 10930 position: absolute; 10931 inset: 0; 10932 padding: 0; 10933 background: ${Z}; 10934 pointer-events: none; 10935`,Hrt=p.div.withConfig({displayName:"WorkspaceProjectPage__TableSkeletonGrid",componentId:"sc-157hovd-45"})` 10936 height: 100%; 10937 width: 100%; 10938 display: flex; 10939 flex-direction: column; 10940 gap: 0.6rem; 10941 padding: 0.75rem; 10942 box-sizing: border-box; 10943`,qrt=p.div.withConfig({displayName:"WorkspaceProjectPage__TableSkeletonHeader",componentId:"sc-157hovd-46"})` 10944 display: grid; 10945 grid-template-columns: 2.25rem 1fr 7.75rem 7.75rem 7.75rem; 10946 gap: 0.6rem; 10947 align-items: center; 10948`,Grt=p.div.withConfig({displayName:"WorkspaceProjectPage__TableSkeletonRows",componentId:"sc-157hovd-47"})` 10949 flex: 1; 10950 min-height: 0; 10951 display: flex; 10952 flex-direction: column; 10953 gap: 0.5rem; 10954 overflow: hidden; 10955`,Vrt=p.div.withConfig({displayName:"WorkspaceProjectPage__TableSkeletonRow",componentId:"sc-157hovd-48"})` 10956 display: grid; 10957 grid-template-columns: 2.25rem 1fr 7.75rem 7.75rem 7.75rem; 10958 gap: 0.6rem; 10959 align-items: center; 10960`,Krt=p(Cn).withConfig({displayName:"WorkspaceProjectPage__RankingTR",componentId:"sc-157hovd-49"})` 10961 border-bottom: 1px solid ${V}; 10962 10963 /* Emphasize the entire row (all cells) for "YOU" */ 10964 & > td { 10965 background: ${e=>e.$highlight?"var(--color-brand-50)":"transparent"}; 10966 font-weight: ${e=>e.$highlight?800:"inherit"}; 10967 } 10968 10969 & > td:first-child { 10970 box-shadow: ${e=>e.$highlight?"inset 3px 0 0 var(--color-brand-700)":"none"}; 10971 } 10972 10973 &:last-child { 10974 border-bottom: 0; 10975 } 10976`,Yrt=p(bt).withConfig({displayName:"WorkspaceProjectPage__TDRank",componentId:"sc-157hovd-50"})` 10977 width: 2.75rem; /* keep compact so metric columns have more room */ 10978`,B6=p(bt).withConfig({displayName:"WorkspaceProjectPage__TDMetric",componentId:"sc-157hovd-51"})` 10979 width: 7rem; /* match prompt detail ranking tables */ 10980`,Xrt=p.div.withConfig({displayName:"WorkspaceProjectPage__BrandCell",componentId:"sc-157hovd-52"})` 10981 display: inline-flex; 10982 align-items: center; 10983 gap: 0.5rem; 10984 min-width: 0; 10985 max-width: 100%; 10986 overflow: hidden; 10987`,Qrt=p.span.withConfig({displayName:"WorkspaceProjectPage__BrandName",componentId:"sc-157hovd-53"})` 10988 display: block; 10989 flex: 1 1 auto; 10990 min-width: 0; 10991 overflow: hidden; 10992 text-overflow: ellipsis; 10993 white-space: nowrap; 10994`,Zrt=p.span.withConfig({displayName:"WorkspaceProjectPage__YouPill",componentId:"sc-157hovd-54"})` 10995 margin-left: 0.5rem; 10996 font-size: 0.65rem; 10997 font-weight: 900; 10998 color: ${O}; 10999 background: ${$e}; 11000 border: 1px solid ${V}; 11001 padding: 0.05rem 0.35rem; 11002 border-radius: 9999px; 11003`,F6=p.div.withConfig({displayName:"WorkspaceProjectPage__MetricCell",componentId:"sc-157hovd-55"})` 11004 display: inline-flex; 11005 align-items: center; 11006 justify-content: flex-end; 11007 gap: 0.35rem; 11008 width: 100%; 11009`,hx=p.span.withConfig({displayName:"WorkspaceProjectPage__TrendPill",componentId:"sc-157hovd-56"})` 11010 display: inline-flex; 11011 align-items: center; 11012 gap: 0.2rem; 11013 font-size: 0.6rem; 11014 font-weight: 950; 11015 padding: 0.06rem 0.3rem; 11016 border-radius: 9999px; 11017 border: 1px solid 11018 ${e=>e.$neutral?"rgba(107, 114, 128, 0.25)":e.$positive?"rgba(16, 185, 129, 0.22)":"rgba(239, 68, 68, 0.22)"}; 11019 color: ${e=>e.$neutral?z:e.$positive?"#065F46":"#991B1B"}; 11020 background: ${e=>e.$neutral?"rgba(107, 114, 128, 0.08)":e.$positive?"rgba(16, 185, 129, 0.12)":"rgba(239, 68, 68, 0.12)"}; 11021 white-space: nowrap; 11022`;function LK(e){const n=new Date(`${e}T00:00:00`);return new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric"}).format(n)}function Pw(e){const n=[Ft,"rgba(59,130,246,0.75)","rgba(16,185,129,0.75)","rgba(168,85,247,0.65)","rgba(245,158,11,0.75)","rgba(239,68,68,0.70)","rgba(107,114,128,0.85)"];return n[Math.abs(e)%n.length]}function BK(e){return e?e.split(",").map(n=>
11022n.trim()).filter(Boolean):[]}function Jrt(e){return e?e.split(",").map(n=>Number(String(n||"").trim())).filter(n=>Number.isFinite(n)&&n>0):[]}function Aw(e,n,i){i?e.set(n,i):e.delete(n)}function eot(){const{workspaceId:e,projectId:n}=Gn(),{projects:i}=Mr(),{user:r}=yn();zn();const[o,s]=yr(),a=Number(n),c=l.useMemo(()=>i.find(Ie=>Ie.id===a)||null,[a,i]),u=!!c?.initial_crunching,m=l.useMemo(()=>{const Ie=String(c?.name||`Project ${n}`||"").trim();return Ie?Ie[0].toUpperCase()+Ie.slice(1):"Project"},[c?.name,n]),[h,g]=l.useState(()=>{const Ie=qs();return{start:hl(Ie,-6),end:Ie}}),[x,y]=l.useState([]),[w,j]=l.useState([]),[v,_]=l.useState([]),[$,k]=l.useState(null),[P,S]=l.useState(null),I=$||P,{allModelOptions:A,enabledModelKeys:E}=eC(),B=l.useMemo(()=>{const Ie=new Set(E),ae=x.filter(Fe=>Ie.has(Fe));return ae.length>0?ae:E},[E,x]),T=l.useMemo(()=>B.join(","),[B]),M=l.useMemo(()=>v.join(","),[v]),R=l.useMemo(()=>[{key:"organic search",label:"Organic Search"},{key:"brand sentiment",label:"Brand Sentiment"},{key:"competitor comparison",label:"Competitor Comparison"}],[]),F=l.useMemo(()=>R.map(Ie=>Ie.key),[R]),Y=l.useMemo(()=>v.length===0?F:v,[F,v]);l.useEffect(()=>{const Ie=o.get("end")||qs(),ae=o.get("start")||hl(Ie,-6);(h.start!==ae||h.end!==Ie)&&g({start:ae,end:Ie});const Fe=BK(o.get("models"));Fe.join(",")!==x.join(",")&&y(Fe);const Ge=Jrt(o.get("topic_ids"));Ge.join(",")!==w.join(",")&&j(Ge);const wt=BK(o.get("categories"));wt.join(",")!==v.join(",")&&_(wt)},[o]);const H=Number(e),U=Number(n),X=l.useMemo(()=>H&&r?.organizations?.find(Ie=>Number(Ie.id)===Number(H))?.role||null,[H,r?.organizations]),Q=l.useMemo(()=>H&&r?.organizations?.find(Ie=>Number(Ie.id)===Number(H))||null,[H,r?.organizations]),K=l.useMemo(()=>{const Ie=Q?.data_history_months;return Ie==null?null:Number(Ie)},[Q]),[G,L]=l.useState(!1),[q,W]=l.useState(!1),[oe,se]=l.useState(!1),de=l.useMemo(()=>K?X==="owner"?t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:()=>L(!0),style:{color:"inherit",fontWeight:850,textDecoration:"underline",background:"none",border:"none",padding:0,font:"inherit",cursor:"pointer"},children:"Upgrade your plan"})," to access older history."]}):"Ask your workspace owner to upgrade the plan.":null,[K,X]),le=MA(H,U),me=S1(H,U);l.useEffect(()=>{!H||!U||le.loading||le.data||le.error||le.ensure()},[le,H,U]),l.useEffect(()=>{!H||!U||me.loading||me.topics&&me.topics.length>0||me.error||me.ensure()},[me,H,U]);const ee=l.useMemo(()=>(me.topics||[]).map(Ie=>({id:Number(Ie?.id),label:String(Ie?.name||"").trim()})).filter(Ie=>Number.isFinite(Ie.id)&&Ie.id>0&&Ie.label),[me.topics]);l.useEffect(()=>{if(ee.length<=0)return;const Ie=new Set(ee.map(ae=>ae.id));j(ae=>ae.filter(Fe=>Ie.has(Fe)))},[ee]);const ne=l.useMemo(()=>{const Ie={};return le.direct.forEach(ae=>{const Fe=Number(ae?.id),Ge=String(ae?.name||"").trim(),wt=String(ae?.website||"").trim(),ke=ae?.logo_url?String(ae.logo_url).trim():null;!Number.isFinite(Fe)||Fe<=0||!Ge||(Ie[Fe]={name:Ge,website:wt,logo_url:ke})}),Ie},[le.direct]),[Ae,_e]=l.useState(!1),[we,Ke]=l.useState(null),[ce,ie]=l.useState(null),[Re,Be]=l.useState(null),[tt,dt]=l.useState(!1),[je,Me]=l.useState(null),[Se,it]=l.useState(0),[De,te]=l.useState([]),[ge,Je]=l.useState(0),{subscribe:Ee}=wo(),Xe=l.useRef(null),yt=l.useRef(null),Ne=l.useRef(null),[Le,Ue]=l.useState(0);l.useEffect(()=>{const Ie=Number(n);if(!Number.isFinite(Ie)||Ie<=0)return;try{Xe.current?.unsubscribe?.()}catch{}Xe.current=null;const ae=Ee({channel:"ProjectPromptsChannel",project_id:Ie},{received:Fe=>{Fe?.type==="prompt_finished"&&Number(Fe?.project_id)===Ie&&(Ne.current&&window.clearTimeout(Ne.current),Ne.current=window.setTimeout(()=>{Ne.current=null,Ue(Ge=>Ge+1)},650))}})||null;return Xe.current=ae,()=>{Ne.current&&(window.clearTimeout(Ne.current),Ne.current=null);try{Xe.current?.unsubscribe?.()}catch{}Xe.current=null}},[n,Ee]),l.useEffect(()=>{const Ie=Number(n);if(!Number.isFinite(Ie)||Ie<=0)return;try{yt.current?.unsubscribe?.()}catch{}yt.current=null;const ae=Ee({channel:"ProjectActionsChannel",project_id:Ie},{received:Fe=>{const Ge=String(Fe?.type||"");(Ge==="action_skeletons_created"||Ge==="action_guides_ready"||Ge==="generation_complete")&&Je(wt=>wt+1)}})||null;return yt.current=ae,()=>{try{yt.current?.unsubscribe?.()}catch{}yt.current=null}},[n,Ee]),l.useEffect(()=>{const Ie=Number(e),ae=Number(n);if(!Ie||!ae)return;let Fe=!1;return dt(!0),Me(null),(async()=>{try{const Ge=new URLSearchParams;Ge.set("include_completed","false"),Ge.set("include_dismissed","fal
11022se"),Ge.set("sort","impact"),Ge.set("page","1"),Ge.set("per_page","5");const wt=await ue(`/api/v1/organizations/${Ie}/projects/${ae}/actions?${Ge.toString()}`,{method:"GET"}),ke=await wt.json().catch(()=>({}));if(!wt.ok)throw new Error(ke?.error||"Failed to load actions");if(Fe)return;const Ve=Number(ke?.total||0)||0,pt=Array.isArray(ke?.actions)?ke.actions:[];it(Ve),te(pt)}catch(Ge){if(Fe)return;it(0),te([]),Me(Ge?.message||"Failed to load actions")}finally{if(Fe)return;dt(!1)}})(),()=>{Fe=!0}},[n,e,Le,ge]),l.useEffect(()=>{const Ie=Number(e),ae=Number(n);if(!Ie||!ae)return;let Fe=!1;return _e(!0),Ke(null),(async()=>{try{const Ge=new URLSearchParams;B.length>0&&Ge.set("models",B.join(",")),w.length>0&&Ge.set("topic_ids",w.join(",")),v.length>0&&Ge.set("categories",v.join(","));const wt=await ue(`/api/v1/organizations/${Ie}/projects/${ae}/scans/current?${Ge.toString()}`,{method:"GET"});if(!wt.ok){const qe=await wt.json().catch(()=>({}));throw new Error(qe?.error||"Failed to load scan status")}const ke=await wt.json(),Ve=new URLSearchParams;Ve.set("start",h.start),Ve.set("end",h.end),B.length>0&&Ve.set("models",B.join(",")),w.length>0&&Ve.set("topic_ids",w.join(",")),v.length>0&&Ve.set("categories",v.join(","));const pt=await ue(`/api/v1/organizations/${Ie}/projects/${ae}/scans?${Ve.toString()}`,{method:"GET"});if(!pt.ok){const qe=await pt.json().catch(()=>({}));throw new Error(qe?.error||"Failed to load scan history")}const Nt=await pt.json();if(Fe)return;ie(ke),Be(Nt)}catch(Ge){if(Fe)return;Ke(Ge?.message||"Failed to load scan data"),ie(null),Be(null)}finally{if(Fe)return;_e(!1)}})(),()=>{Fe=!0}},[e,n,h.end,h.start,T,w.join(","),M,Le]);const We=l.useMemo(()=>ce?.latest_bucket_start_on?String(ce.latest_bucket_start_on):null,[ce?.latest_bucket_start_on]),Qe=l.useMemo(()=>{const Ie=Re?.snapshots||[],ae=h.start,Fe=h.end;return Ie.filter(Ge=>Ge.bucket_start_on>=ae&&Ge.bucket_start_on<=Fe)},[h.end,h.start,Re]),ht=l.useMemo(()=>{const Ie=Qe;return Ie.length>0?Ie[0]:null},[Qe]),pe=Ie=>{if(!Ie)return"";if(Ie?.is_main_brand)return"__you__";const ae=Number(Ie?.competitor_id);if(Number.isFinite(ae)&&ae>0)return`c:${ae}`;const Fe=String(Ie?.name||"").trim().toLowerCase();return Fe?`n:${Fe}`:""},be=Ie=>{if(!Ie)return[];const ae=Ie.ranking_tables_by_model||{},Fe=B.map(Ve=>ae[Ve]).filter(Boolean);if(Fe.length<=0)return[];const Ge=new Map;let wt=0;if(Fe.forEach(Ve=>{wt+=Number(Ve?.max_points)||0,(Ve?.rows||[]).forEach(Nt=>{const qe=pe(Nt);if(!qe)return;const qt=Ge.get(qe)||{...Nt,mentions:0,position:null,_pos_sum:0,_pos_count:0};qt.mentions+=Number(Nt?.mentions)||0,typeof Nt?.position=="number"&&(qt._pos_sum+=Nt.position*(Number(Nt?.mentions)||0),qt._pos_count+=Number(Nt?.mentions)||0),qt.is_main_brand=!!Nt?.is_main_brand||!!qt.is_main_brand,qt.name=qt.is_main_brand?String(c?.name||"You").trim():Nt?.name||qt.name,qt.competitor_id=Nt?.competitor_id??qt.competitor_id,Ge.set(qe,qt)})}),wt<=0)return[];const ke=Array.from(Ge.values()).map(Ve=>{const pt=Ve._pos_count>0?Ve._pos_sum/Ve._pos_count:null,Nt=100*(Number(Ve.mentions)||0)/wt;return{...Ve,position:pt,visibility:Nt}});return ke.sort((Ve,pt)=>{const Nt=Number(Ve.visibility)||0,qe=Number(pt.visibility)||0;if(qe!==Nt)return qe-Nt;const qt=Number.isFinite(Ve.position)?Ve.position:9999,Mn=Number.isFinite(pt.position)?pt.position:9999;return qt-Mn}),ke.forEach((Ve,pt)=>Ve.rank=pt+1),ke},rt=Ie=>{const ae=Array.isArray(Ie)?Ie:[];if(ae.length<=0)return[];const Fe=new Map;let Ge=0;if(ae.forEach(ke=>{const Ve=ke?.ranking_tables_by_model||{},pt=B.map(Nt=>Ve[Nt]).filter(Boolean);pt.length<=0||pt.forEach(Nt=>{Ge+=Number(Nt?.max_points)||0,(Nt?.rows||[]).forEach(qt=>{const Mn=pe(qt);if(!Mn)return;const zt=Fe.get(Mn)||{...qt,mentions:0,position:null,_pos_sum:0,_pos_count:0},dn=Number(qt?.mentions)||0;zt.mentions+=dn,typeof qt?.position=="number"&&dn>0&&(zt._pos_sum+=qt.position*dn,zt._pos_count+=dn),zt.is_main_brand=!!qt?.is_main_brand||!!zt.is_main_brand,zt.name=zt.is_main_brand?String(c?.name||"You").trim():qt?.name||zt.name,zt.competitor_id=qt?.competitor_id??zt.competitor_id,Fe.set(Mn,zt)})})}),Ge<=0)return[];const wt=Array.from(Fe.values()).map(ke=>{const Ve=ke._pos_count>0?ke._pos_sum/ke._pos_count:null,pt=100*(Number(ke.mentions)||0)/Ge;return{...ke,position:Ve,visibility:pt}});return wt.sort((ke,Ve)=>{const pt=Number(ke.visibility)||0,Nt=Number(Ve.visibility)||0;if(Nt!==pt)return Nt-pt;const qe=Number.isFinite(ke.position)?ke.position:9999,qt=Number.isFinite(Ve.position)?Ve.position:9999;return qe-qt}),wt.forEach((ke,Ve)=>ke.rank=Ve+1),wt},ze=l.useMemo(()=>be(ht).filter(Fe=>
11022!Fe?.is_main_brand&&typeof Fe?.name=="string"&&Fe.name.length>0).map(Fe=>{const Ge=typeof Fe?.competitor_id=="number"?Fe.competitor_id:null,wt=Ge&&ne[Ge]?ne[Ge]:null,ke=wt?.name?String(wt.name):String(Fe.name);return{key:Ge?`c:${Ge}`:`n:${String(Fe.name).toLowerCase().replace(/[^a-z0-9]+/g,"_")}`,name:ke,competitor_id:Ge}}),[ht,ne,B]),lt=l.useMemo(()=>{const ae=[{key:"brand",label:"You",logoRecord:{name:String(c?.name||"You").trim()||"You",website:c?.website,logo_url:c?.logo_url},color:Pw(0)}];return ze.forEach((Fe,Ge)=>{const wt=Fe.competitor_id&&ne[Fe.competitor_id]?ne[Fe.competitor_id]:{name:Fe.name,website:"",logo_url:null};ae.push({key:Fe.key,label:Fe.name,logoRecord:wt,color:Pw(Ge+1)})}),ae},[ne,ze,c]),vt=l.useMemo(()=>{const Ie=new Map;return lt.forEach(ae=>{if(!ae?.key)return;const Fe=ae.color?String(ae.color):Pe;Ie.set(String(ae.key),Fe)}),Ie},[lt]),Wt=l.useMemo(()=>Qe.slice().reverse().map(Fe=>({date:Fe.bucket_start_on,brand:(()=>{const wt=be(Fe).find(ke=>!!ke?.is_main_brand);return typeof wt?.visibility=="number"?wt.visibility:null})(),...(()=>{const Ge=be(Fe),wt={};return ze.forEach(ke=>{const Ve=ke.competitor_id?Ge.find(pt=>Number(pt?.competitor_id)===Number(ke.competitor_id)):Ge.find(pt=>String(pt?.name||"")===ke.name);wt[ke.key]=typeof Ve?.visibility=="number"?Ve.visibility:null}),wt})()})),[Qe,ze,B]),Qt=l.useMemo(()=>Wt.some(Ie=>Object.keys(Ie).some(ae=>ae!=="date"&&typeof Ie[ae]=="number")),[Wt]),Yt=l.useMemo(()=>NM(h),[h]),Zt=l.useMemo(()=>!Yt&&Wt.length===1,[Yt,Wt]),tn=l.useCallback(Ie=>{if(!Ie)return[];const ae=[],Fe=Ie?.brand;return ae.push({label:"You",value:typeof Fe=="number"?`${Fe.toFixed(1)}%`:"â",color:Pw(0)}),ze.forEach((Ge,wt)=>{const ke=Ie?.[Ge.key];ae.push({label:Ge.name,value:typeof ke=="number"?`${Number(ke).toFixed(1)}%`:"â",color:vt.get(Ge.key)||Pw(wt+1)})}),ae},[ze,vt]),nn=l.useMemo(()=>{if(!Yt&&!Zt)return[];const Ie=Yt&&Wt.find(ae=>String(ae?.date||"").slice(0,10)===String(h.start||"").slice(0,10))||Wt[0];return tn(Ie)},[Wt,h.start,Yt,Zt,tn]),xn=l.useMemo(()=>{const Ie=rt(Qe)||[],ae=Ie.length>0,Fe=[],Ge=String(c?.name||"").trim();Ge&&Fe.push({key:"__you__",competitor_id:null,name:Ge,isYou:!0,logo_url:c?.logo_url??null,mentions:0,visibility:ae?0:null,position:null}),le.direct.forEach(Ve=>{const pt=Number(Ve?.id),Nt=String(Ve?.name||"").trim();!Number.isFinite(pt)||pt<=0||!Nt||Fe.push({key:`c:${pt}`,competitor_id:pt,name:Nt,isYou:!1,mentions:0,visibility:ae?0:null,position:null})});const wt=new Map;Fe.forEach(Ve=>{Ve?.key&&wt.set(Ve.key,{...Ve})}),Ie.forEach(Ve=>{const pt=pe(Ve);if(!pt)return;const Nt=pt==="__you__"||!!Ve?.is_main_brand,qe=wt.get(pt)||{key:pt,competitor_id:typeof Ve?.competitor_id=="number"?Ve.competitor_id:null,name:Nt?String(c?.name||"").trim():String(Ve?.name||"").trim(),isYou:Nt,mentions:0,visibility:ae?0:null,position:null};wt.set(pt,{...qe,competitor_id:typeof Ve?.competitor_id=="number"?Ve.competitor_id:qe.competitor_id,logo_url:Nt?Ve?.logo_url??qe.logo_url??c?.logo_url??null:qe.logo_url,name:qe.name,isYou:Nt||!!qe.isYou,mentions:typeof Ve?.mentions=="number"?Ve.mentions:qe.mentions,visibility:typeof Ve?.visibility=="number"?Ve.visibility:qe.visibility,position:typeof Ve?.position=="number"?Ve.position:qe.position})});const ke=Array.from(wt.values());return ke.sort((Ve,pt)=>{const Nt=typeof Ve.visibility=="number"?Ve.visibility:0,qe=typeof pt.visibility=="number"?pt.visibility:0;if(qe!==Nt)return qe-Nt;const qt=Number.isFinite(Ve.position)?Ve.position:9999,Mn=Number.isFinite(pt.position)?pt.position:9999;return qt!==Mn?qt-Mn:String(Ve.name||"").localeCompare(String(pt.name||""))}),ke.map((Ve,pt)=>({rank:pt+1,key:String(Ve.key||""),competitor_id:Ve.competitor_id,name:Ve.name,logo_url:Ve.logo_url??null,mentions:Ve.mentions,visibility:Ve.visibility,position:Ve.position,isYou:Ve.isYou}))},[le.direct,Qe,c?.logo_url,c?.name,B]),st=l.useMemo(()=>{const Ie=xn.find(ae=>ae?.isYou);return typeof Ie?.visibility=="number"?Ie.visibility:null},[xn]),Ct=l.useMemo(()=>{if(!Qe||Qe.length<2)return new Map;const Ie=Qe[0],ae=Qe[Qe.length-1];if(!Ie||!ae)return new Map;const Fe=be(ae)||[],Ge=be(Ie)||[],wt=new Map;Fe.forEach(Nt=>{const qe=pe(Nt);qe&&wt.set(qe,Nt)});const ke=new Map;Ge.forEach(Nt=>{const qe=pe(Nt);qe&&ke.set(qe,Nt)});const Ve=new Map;
11022return new Set([...wt.keys(),...ke.keys()]).forEach(Nt=>{const qe=wt.get(Nt),qt=ke.get(Nt),Mn=typeof qe?.mentions=="number"?qe.mentions:null,zt=typeof qt?.mentions=="number"?qt.mentions:null,dn=typeof qe?.visibility=="number"?qe.visibility:null,rn=typeof qt?.visibility=="number"?qt.visibility:null,bn=typeof qe?.position=="number"?qe.position:null,kt=typeof qt?.position=="number"?qt.position:null,Kt=typeof Mn=="number"&&typeof zt=="number"&&Mn>0?100*(zt-Mn)/Mn:null,un=typeof dn=="number"&&typeof rn=="number"?rn-dn:null,pn=typeof bn=="number"&&typeof kt=="number"?kt-bn:null;Ve.set(Nt,{mentionsPct:Kt,visibilityDelta:un,positionDelta:pn})}),Ve},[Qe,B]);return t.jsxs(lrt,{children:[t.jsx(drt,{children:t.jsxs(urt,{children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.625rem"},children:[t.jsx(Fy,{title:c?.name||"Project",subtitle:Ae?"Loading last scanâ¦":we||t.jsxs("span",{children:["Last scan:"," ",t.jsx(rr,{value:We,format:"date",timeZoneMode:"viewer",options:{month:"short",day:"numeric"}})]})}),c?.local_mode?t.jsxs("span",{style:{fontSize:"0.6875rem",fontWeight:800,padding:"2px 8px",borderRadius:6,background:$e,border:`1px solid ${V}`,color:z,whiteSpace:"nowrap"},children:["Local",c?.city?` â ${c.city}`:""]}):null]}),t.jsx("div",{style:{display:"flex",alignItems:"center",gap:"0.75rem",paddingRight:8}
11022,children:t.jsx(qr,{items:[{label:"Projects",to:e?`/workspaces/${e}`:void 0},{label:m}]})})]})}),t.jsxs(prt,{children:[t.jsxs(mrt,{children:[t.jsx(rh,{value:h,onChange:Ie=>{g(Ie);const ae=new URLSearchParams(o);Aw(ae,"start",Ie.start),Aw(ae,"end",Ie.end),s(ae,{replace:!0})},disabled:Ae,presets:[7,14,30],historyMonthsLimit:K,historyLimitMessage:de}),t.jsx(rC,{options:A,value:x,onChange:Ie=>{y(Ie);const ae=new URLSearchParams(o);Aw(ae,"models",Ie.length>0?Ie.join(","):null),s(ae,{replace:!0})},disabled:Ae||E.length<=0,onUpgradeClick:()=>L(!0),isOwner:X==="owner"}),t.jsx(u1,{options:ee,value:w,onChange:Ie=>{j(Ie);const ae=new URLSearchParams(o);Aw(ae,"topic_ids",Ie.length>0?Ie.join(","):null),s(ae,{replace:!0})},disabled:Ae}),t.jsx(_b,{label:"Categories",options:R,value:Y,onChange:Ie=>{const ae=Array.isArray(Ie)?Ie:[],Fe=ae.length===F.length?[]:ae;_(Fe);const Ge=new URLSearchParams(o);Aw(Ge,"categories",Fe.length>0?Fe.join(","):null),s(Ge,{replace:!0})},disabled:Ae})]}),t.jsxs(crt,{onClick:()=>W(!0),children:[t.jsx(W5,{size:14}),t.jsx("span",{children:"Report"})]})]}),t.jsxs(hrt,{children:[t.jsx(frt,{children:t.jsxs(TK,{children:[t.jsxs(O6,{children:[t.jsx("div",{style:{minWidth:0},children:t.jsxs(D6,{children:[t.jsx(L6,{children:"Visibility Trend"}),t.jsx(at,{content:"Brand vs selected competitors",placement:"top",onlyIfTruncated:!1,children:t.jsx("span",{style:{display:"inline-flex",alignItems:"center",color:z},children:t.jsx(wn,{size:16})})})]})}),t.jsxs(RK,{children:[t.jsx(OK,{children:"Brand Visibility"}),t.jsx(DK,{children:typeof st=="number"?`${st.toFixed(1)}%`:"â"})]})]}),t.jsx(Prt,{children:t.jsx(Art,{children:Ae?t.jsxs(zrt,{"aria-hidden":"true",children:[t.jsx(Trt,{children:[0,1,2,3,4].map(Ie=>t.jsx(nt,{height:11,width:28,radius:6},Ie))}),t.jsx(Ert,{children:t.jsx(nt,{height:"100%",radius:"0.5rem"})})]}):Qt?Yt?t.jsx(ky,{title:"Single day view",dayISO:h.start,primaryLabel:"Visibility",primaryValue:nn[0]?.value||"â",rows:nn,hint:"Select multiple days to see a trend."}):Zt?t.jsx(ky,{title:"First data point",dayISO:Wt[0]?.date||"",primaryLabel:"Visibility",primaryValue:nn[0]?.value||"â",rows:nn,hint:"Your next scan will unlock the trend chart."}):t.jsxs("div",{style:{width:"100%",flex:1,minWidth:1,minHeight:1,display:"flex",flexDirection:"column"},children:[t.jsx(Pre,{items:lt,selectedKey:$,hoverKey:P,onSelectedKeyChange:k,onHoverKeyChange:S}),t.jsx(Nrt,{children:t.jsx(Gl,{width:"100%",height:"100%",minWidth:1,minHeight:1,children:t.jsxs(C1,{data:Wt,margin:{top:6,right:10,left:0,bottom:0},children:[t.jsx(Ql,{dataKey:"date",tick:{fill:z,fontSize:11,fontWeight:700},axisLine:{stroke:V},tickLine:{stroke:V},minTickGap:12,tickFormatter:LK}),t.jsx(Zl,{domain:[0,100],tick:{fill:z,fontSize:11,fontWeight:700},axisLine:{stroke:V},tickLine:{stroke:V},width:44,tickFormatter:Ie=>`${Math.round(Ie)}%`}),t.jsx(Vl,{cursor:{stroke:Pe,strokeWidth:1},content:({active:Ie,payload:ae,label:Fe})=>{if(!Ie||!ae?.length)return null;const Ge=ae.filter(wt=>typeof wt.value=="number").map(wt=>({name:wt.name,value:wt.value}));return t.jsxs(Lrt,{children:[t.jsx(Brt,{children:LK(String(Fe||""))}),Ge.map(wt=>t.jsxs(Frt,{children:[wt.name,": ",wt.value.toFixed(1),"%"]},String(wt.name)))]})}}),t.jsx(Nd,{type:"monotone",dataKey:"brand",name:"You",stroke:Pw(0),strokeWidth:2.5,dot:!1,connectNulls:!0,strokeOpacity:!I||I==="brand"?1:.2}),ze.map((Ie,ae)=>t.jsx(Nd,{type:"monotone",dataKey:Ie.key,name:Ie.name,stroke:vt.get(Ie.key)||Pe,strokeWidth:1.75,dot:!1,connectNulls:!0,strokeDasharray:ae%2===0?"6 4":"2 6",strokeOpacity:!I||I===Ie.key?1:.2},Ie.key))]})})})]}):t.jsx(Mrt,{children:t.jsx(Sp,{initialCrunching:u,embedded:!0})})})})]})}),t.jsx(grt,{children:t.jsxs(TK,{children:[t.jsx(O6,{children:t.jsx("div",{style:{minWidth:0},children:t.jsxs(D6,{children:[t.jsx(L6,{children:"Industry Ranking"}),t.jsx(at,{content:"Brands with highest visibility",placement:"top",onlyIfTruncated:!1,children:t.jsx("span",{style:{display:"inline-flex",alignItems:"center",color:z},children:t.jsx(wn,{size:16})})})]})})}),t.jsxs(Wrt,{children:[Ae?t.jsx(Urt,{"aria-hidden":"true",children:t.jsxs(Hrt,{children:[t.jsxs(qrt,{children:[t.jsx(nt,{height:10,width:16,radius:6}),t.jsx(nt,{height:10,width:"100%",radius:6}),t.jsx(nt,{height:10,width:"100%",radius:6}),t.jsx(nt,{height:10,width:"100%",radius:6}),t.jsx(nt,{height:10,width:"100%",radius:6})]}),t.jsx(Grt,{children:Array.from({length:14}).map((Ie,ae)=>
11022t.jsxs(Vrt,{children:[t.jsx(nt,{height:12,width:18,radius:6}),t.jsx(nt,{height:12,width:`${60+ae%4*10}%`}),t.jsx(nt,{height:12,width:"100%"}),t.jsx(nt,{height:12,width:"100%"}),t.jsx(nt,{height:12,width:"100%"})]},ae))})]})}):null,!Ae&&xn.length===0?t.jsx("div",{style:{padding:"1rem"},children:t.jsx(Sp,{initialCrunching:u})}):null,t.jsx(Ort,{children:t.jsx(Rrt,{children:t.jsx(Drt,{children:t.jsxs(nr,{style:{opacity:Ae||xn.length===0?0:1,tableLayout:"fixed"},children:[t.jsx(pr,{children:t.jsxs(Cn,{children:[t.jsx(Et,{style:{width:"2.75rem"},children:"#"}),t.jsx(Et,{children:"Brand"}),t.jsx(Et,{style:{width:"7rem"},$align:"right",children:t.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:["Visibility",t.jsx(at,{content:"Visibility (%) = 100 * mentions / max_points, where max_points is the number of succeeded prompt-runs in the selected range and models.",placement:"top",onlyIfTruncated:!1,children:t.jsx("span",{style:{display:"inline-flex",alignItems:"center",color:z},children:t.jsx(wn,{size:14})})})]})}),t.jsx(Et,{style:{width:"7rem"},$align:"right",children:t.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:["Position",t.jsx(at,{content:"Average 1-based position for the brand within the ranked entity list (brands_mentioned), computed across succeeded prompt-runs where it appears. Lower is better.",placement:"top",onlyIfTruncated:!1,children:t.jsx("span",{style:{display:"inline-flex",alignItems:"center",color:z},children:t.jsx(wn,{size:14})})})]})}),t.jsx(Et,{style:{width:"7rem"},$align:"right",children:t.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:["Mentions",t.jsx(at,{content:"Count of succeeded prompt-runs where the brand appears in the extracted ranked entities (brands_mentioned) for the selected range and models.",placement:"top",onlyIfTruncated:!1,children:t.jsx("span",{style:{display:"inline-flex",alignItems:"center",color:z},children:t.jsx(wn,{size:14})})})]})})]})}),t.jsx(mr,{children:Ae||xn.length===0?null:xn.map((Ie,ae)=>t.jsxs(Krt,{$highlight:Ie.isYou,children:[t.jsx(Yrt,{$muted:!0,children:Ie.rank??"â"}),t.jsx(bt,{children:t.jsxs(Xrt,{children:[t.jsx(xo,{record:Ie.isYou?{name:Ie.name,website:c?.website,logo_url:Ie?.logo_url??c?.logo_url}:Ie.competitor_id?ne[Ie.competitor_id]||{name:Ie.name}:{name:Ie.name},size:18}),t.jsx(Qrt,{style:{fontWeight:Ie.isYou?850:700},children:Ie.name}),Ie.isYou?t.jsx(Zrt,{children:"YOU"}):null]})}),t.jsx(B6,{$align:"right",children:t.jsxs(F6,{children:[t.jsx("span",{style:{fontWeight:900,color:O},children:typeof Ie.visibility=="number"?`${Ie.visibility.toFixed(2)}%`:"â"}),(()=>{const Fe=Ct.get(String(Ie?.key||"")),Ge=typeof Fe?.visibilityDelta=="number"?Fe.visibilityDelta:null;if(Ge===null)return t.jsx(hx,{$neutral:!0,children:"â"});const wt=Ge>=0;return t.jsxs(hx,{$positive:wt,children:[wt?t.jsx(qi,{size:11}):t.jsx(ul,{size:11}),wt?"+":"",Ge.toFixed(1),"%"]})})()]})}),t.jsx(B6,{$align:"right",children:t.jsxs(F6,{children:[t.jsx("span",{style:{fontWeight:900,color:O},children:typeof Ie.position=="number"?Ie.position.toFixed(1):"â"}),(()=>{const Fe=Ct.get(String(Ie?.key||"")),Ge=typeof Fe?.positionDelta=="number"?Fe.positionDelta:null;if(Ge===null)return t.jsx(hx,{$neutral:!0,children:"â"});const wt=Ge<=0;return t.jsxs(hx,{$positive:wt,children:[wt?t.jsx(qi,{size:11}):t.jsx(ul,{size:11}),Ge>=0?"+":"",Ge.toFixed(1)]})})()]})}),t.jsx(B6,{$align:"right",style:{fontWeight:900},children:t.jsxs(F6,{children:[t.jsx("span",{style:{color:z,fontWeight:850},children:Ie.mentions}),(()=>{const Fe=Ct.get(String(Ie?.key||"")),Ge=typeof Fe?.mentionsPct=="number"?Fe.mentionsPct:null;if(Ge===null)return t.jsx(hx,{$neutral:!0,children:"â"});const wt=Ge>=0;return t.jsxs(hx,{$positive:wt,children:[wt?t.jsx(qi,{size:11}):t.jsx(ul,{size:11}),wt?"+":"",Ge.toFixed(0),"%"]})})()]})})]},`${Ie.name}-${ae}`))})]})})})})]})]})})]}),t.jsxs(yrt,{children:[t.jsxs(bde,{style:{display:"flex",flexDirection:"column"},children:[t.jsxs(O6,{children:[t.jsxs("div",{style:{minWidth:0},children:[t.jsxs(D6,{children:[t.jsx(bP,{size:16,style:{color:Ft,flexShrink:0}}),t.jsx(L6,{children:"Actions"})]}
11022),t.jsx(xrt,{children:"Highest-impact active actions across this project."})]}),t.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-end",gap:6},children:[t.jsxs(RK,{children:[t.jsx(OK,{children:"Active"}),t.jsx(DK,{children:Se})]}),e&&n?t.jsx(Dn,{to:`/workspaces/${e}/projects/${n}/actions`,style:{fontSize:"0.82rem",fontWeight:850,color:Ft,textDecoration:"none",whiteSpace:"nowrap"},children:"View all â"}):null]})]}),tt?t.jsx(EK,{children:[1,2,3].map(Ie=>t.jsx(nt,{width:"100%",height:58,style:{borderRadius:"0.75rem"}},Ie))}):je?t.jsx("div",{style:{marginTop:"0.75rem",color:z,fontSize:"0.875rem"},children:je}):De.length===0?t.jsx("div",{style:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",textAlign:"center",color:z,fontSize:"0.875rem",padding:"1rem 0"},children:"No active actions yet. Generate actions from a prompt to get started."}):t.jsx(EK,{children:De.map(Ie=>{const ae=String(Ie.title||"").trim(),Fe={earned_editorial:"#7C3AED",earned_ugc:"#8B5CF6",earned_reference:"#A78BFA",owned_content:"#2563EB",owned_technical:"#3B82F6",owned_configuration:"#60A5FA",sentiment_correction:"#F59E0B"},Ge=Ie.action_type&&Fe[Ie.action_type]||Pe,wt=Ie.action_type_label||(Ie.source_category==="earned"?"Earned":Ie.source_category==="owned"?"Owned":null)||(Ie.category==="external_authority"?"External":Ie.category==="internal_content"?"Internal":null)||"Action",ke={low:{bg:"rgba(16,185,129,0.10)",fg:"#059669"},medium:{bg:"rgba(245,158,11,0.10)",fg:"#d97706"},high:{bg:"rgba(239,68,68,0.08)",fg:"#dc2626"}},Ve=Ie.effort_level&&ke[Ie.effort_level],pt=Ie.effort_level?`${Ie.effort_level.charAt(0).toUpperCase()}${Ie.effort_level.slice(1)} effort`:null,Nt=Ie.guide_status,qe=Nt==="ready"?t.jsx(co,{size:10}):Nt==="generating"?t.jsx($rt,{children:t.jsx(Tr,{size:10})}):Nt==="failed"?t.jsx(Hc,{size:10}):Nt==="pending"?t.jsx(lye,{size:10}):null,qt=Nt==="ready"?"Guide ready":Nt==="generating"?"Generatingâ¦":Nt==="failed"?"Failed":Nt==="pending"?"Pending":null,Mn=e&&n?`/workspaces
11022/${e}/projects/${n}/actions/${Ie.id}`:"#";return t.jsxs(brt,{to:Mn,children:[t.jsx(vrt,{$color:Ge}),t.jsxs(wrt,{children:[t.jsx(at,{content:ae,onlyIfTruncated:!0,children:t.jsx(jrt,{children:ae||"â"})}),t.jsxs(_rt,{children:[t.jsx(Crt,{$color:Ge,children:wt}),pt?t.jsxs(t.Fragment,{children:[t.jsx(MK,{}),t.jsx(Srt,{$bg:Ve?.bg,$fg:Ve?.fg,children:pt})]}):null,qe&&qt?t.jsxs(t.Fragment,{children:[t.jsx(MK,{}),t.jsxs(Irt,{$status:Nt||void 0,children:[qe," ",qt]})]}):null]})]})]},String(Ie.id))})})]}),t.jsx(e6e,{orgId:Number(e),projectId:Number(n),title:"AI Readiness",headerRight:e&&n?t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.75rem"},children:[t.jsxs(he,{size:"sm",variant:"primary",onClick:()=>se(!0),children:[t.jsx(W5,{size:13}),"Report"]}),t.jsx(Dn,{to:`/workspaces/${e}/projects/${n}/site-audit`,style:{fontSize:"0.85rem",fontWeight:850,color:z,textDecoration:"none",whiteSpace:"nowrap"},children:"View in Site Audit"})]}):null})]}),t.jsx(ec,{isOpen:G,orgId:Number(e),onClose:()=>L(!1)}),t.jsx(cie,{isOpen:q,onClose:()=>W(!1),workspaceId:e,projectId:n,reportEnabled:!!Q?.report_enabled,whiteLabelEnabled:!!Q?.report_white_label,isOwner:X==="owner",onUpgrade:()=>L(!0),orgLogoUrl:Q?.logo_url}),t.jsx(die,{isOpen:oe,onClose:()=>se(!1),workspaceId:e,projectId:n,reportEnabled:!!Q?.report_enabled,whiteLabelEnabled:!!Q?.report_white_label,isOwner:X==="owner",onUpgrade:()=>L(!0),orgLogoUrl:Q?.logo_url})]})}function tot(){return t.jsx(eot,{})}const not={gemini:Ft,chatgpt:"rgba(107,114,128,0.85)",perplexity:"rgba(16,185,129,0.75)",google_ai_overview:"rgba(59,130,246,0.75)",google_ai_mode:"rgba(14,165,233,0.75)",grok:"rgba(168,85,247,0.65)",copilot:"rgba(37,99,235,0.75)",claude:"rgba(204,120,50,0.80)"};function f8(e,n){const i=String(e||"").trim();return not[i]||n}const iot=p.div.withConfig({displayName:"CitationsTabstyles__FiltersBar",componentId:"sc-xtvwen-0"})` 11023 display: flex; 11024 align-items: center; 11025 justify-content: space-between; 11026 gap: 0.75rem; 11027 flex-wrap: nowrap; 11028 width: 100%; 11029 overflow-x: auto; 11030 overflow-y: hidden; 11031 -webkit-overflow-scrolling: touch; 11032 11033 /* Keep everything on one line; allow horizontal scroll on small screens. */ 11034 11035 /* Mobile: switch to two stacked rows (left row then right row). */ 11036 @media (max-width: 640px) { 11037 flex-direction: column; 11038 align-items: stretch; 11039 justify-content: flex-start; 11040 gap: 0.6rem; 11041 overflow: visible; 11042 } 11043`,rot=p.div.withConfig({displayName:"CitationsTabstyles__FiltersLeft",componentId:"sc-xtvwen-1"})` 11044 display: flex; 11045 align-items: center; 11046 gap: 0.75rem; 11047 min-width: 0; 11048 flex: 1; 11049 flex-wrap: nowrap; 11050 11051 @media (max-width: 640px) { 11052 width: 100%; 11053 flex: 0 0 auto; 11054 /* Keep row 1 on a single line; if it overflows, scroll within the row. */ 11055 overflow-x: auto; 11056 overflow-y: hidden; 11057 -webkit-overflow-scrolling: touch; 11058 padding-bottom: 2px; 11059 } 11060`,oot=p.div.withConfig({displayName:"CitationsTabstyles__FiltersRight",componentId:"sc-xtvwen-2"})` 11061 display: flex; 11062 align-items: center; 11063 gap: 0.75rem; 11064 flex-wrap: nowrap; 11065 justify-content: flex-end; 11066 11067 /* SearchBar container (first child) should be flexible. */ 11068 & > div:first-child { 11069 flex: 0 0 auto; 11070 min-width: 0; 11071 width: 18rem; 11072 } 11073 11074 @media (max-width: 640px) { 11075 width: 100%; 11076 justify-content: flex-start; 11077 /* Row 2: only the search bar. */ 11078 display: block; 11079 11080 & > div:first-child { 11081 width: 100%; 11082 max-width: none; 11083 } 11084 } 11085`;p.button.withConfig({displayName:"CitationsTabstyles__ToggleBtn",componentId:"sc-xtvwen-3"})` 11086 border: 1px solid ${V}; 11087 background: ${e=>e.$active?V:Z}; 11088 color: ${O}; 11089 font-weight: 850; 11090 font-size: 0.75rem; 11091 height: 2rem; 11092 line-height: 1; 11093 padding: 0 0.75rem; 11094 border-radius: 0.375rem; 11095 cursor: pointer; 11096 display: inline-flex; 11097 align-items: center; 11098 gap: 0.5rem; 11099 user-select: none; 11100 white-space: nowrap; 11101 box-sizing: border-box; 11102 11103 &:hover { 11104 background: ${$e}; 11105 } 11106`;const sot=p.div.withConfig({displayName:"CitationsTabstyles__TopGrid",componentId:"sc-xtvwen-4"})` 11107 /* Keep this tight so it matches the Prompts tab spacing under the filters row. */ 11108 margin-top: 0.0rem; 11109 display: grid; 11110 grid-template-columns: 1fr; 11111 /* Mobile: stacked layout should be content-driven; don't force a single 1fr row. */ 11112 grid-auto-rows: auto; 11113 gap: 1rem; 11114 min-height: 0; 11115 flex: 1; 11116 align-items: stretch; 11117 11118 @media (min-width: 1024px) { 11119 /* Table (left) should remain wider than chart (right), same proportions as before. */ 11120 grid-template-columns: 6fr 4fr; 11121 /* Desktop: keep both columns stretching nicely within the available height. */ 11122 grid-auto-rows: minmax(0, 1fr); 11123 } 11124`;p.div.withConfig({displayName:"CitationsTabstyles__RightCol",componentId:"sc-xtvwen-5"})` 11125 min-width: 0; 11126 min-height: 0; 11127 display: flex; 11128 flex-direction: column; 11129`;const aot=p.div.withConfig({displayName:"CitationsTabstyles__ChartBox",componentId:"sc-xtvwen-6"})` 11130 /* Card container (like Overview): chart lives in its own card. */ 11131 border: 1px solid ${V}; 11132 border-radius: 0.875rem; 11133 background: ${Z}; 11134 overflow: hidden; 11135 padding: 0.85rem; 11136 display: flex; 11137 flex-direction: column; 11138 min-height: 0; 11139 /* Mobile: let the card size itself (don't rely on % heights) and give it real space. */ 11140 height: auto; 11141 11142 @media (max-width: 640px) { 11143 min-height: clamp(320px, 70dvh, 520px); 11144 } 11145 11146 /* Desktop: stretch within the grid row. */ 11147 @media (min-width: 1024px) { 11148 height: 100%; 11149 } 11150`,lot=p.div.withConfig({displayName:"CitationsTabstyles__TableCard",componentId:"sc-xtvwen-7"})` 11151 border: 1px solid ${V}; 11152 border-radius: 0.875rem; 11153 background: ${Z}; 11154 overflow: hidden; 11155 padding: 0.85rem; 11156 display: flex; 11157 flex-direction: column; 11158 min-height: 0; 11159 /* Mobile: let the card size itself (don't rely on % heights) and give it real space. */ 11160 height: auto; 11161 11162 @media (max-width: 640px) { 11163 min-height: clamp(320px, 65dvh, 520px); 11164 } 11165 11166 /* Desktop: stretch within the grid row. */ 11167 @media (min-width: 1024px) { 11168 height: 100%; 11169 } 11170`,vde=p.div.withConfig({displayName:"CitationsTabstyles__ChartHeader",componentId:"sc-xtvwen-8"})` 11171 display: flex; 11172 align-items: baseline; 11173 justify-content: space-between; 11174 gap: 0.75rem; 11175`,wde=p.div.withConfig({displayName:"CitationsTabstyles__ChartTitle",componentId:"sc-xtvwen-9"})` 11176 font-size: 1.2rem; 11177 font-weight: 900; 11178 color: ${O}; 11179`;p.div.withConfig({displayName:"CitationsTabstyles__ChartSub",componentId:"sc-xtvwen-10"})` 11180 margin-top: 0.2rem; 11181 font-size: 0.75rem; 11182 font-weight: 750; 11183 color: ${z}; 11184`;const cot=p.div.withConfig({displayName:"CitationsTabstyles__ChartBody",componentId:"sc-xtvwen-11"})` 11185 margin-top: 0.6rem; 11186 flex: 1; 11187 display: flex; 11188 flex-direction: column; 11189 min-height: 220px; 11190 11191 /* Mobile: give the chart more vertical room so it doesn't feel cramped. */ 11192 @media (max-width: 640px) { 11193 min-height: clamp(260px, 55dvh, 420px); 11194 } 11195`,jde=p.div.withConfig({displayName:"CitationsTabstyles__InnerSurface",componentId:"sc-xtvwen-12"})` 11196 margin-top: 0.75rem; 11197 border: 1px solid ${V}; 11198 background: ${Z}; 11199 border-radius: 0.75rem; 11200 padding: 0.75rem; 11201 flex: 1; 11202 min-height: 0; 11203 display: flex; 11204 flex-direction: column; 11205 overflow: hidden; 11206`,dot=p.div.withConfig({displayName:"CitationsTabstyles__TableWrap",componentId:"sc-xtvwen-13"})` 11207 /* Table scroll container lives inside TableCard. */ 11208 overflow-y: auto; 11209 overflow-x: hidden; 11210 flex: 1; 11211 min-height: 0; 11212 11213 /* Mobile: table should be comfortably tall, and allow horizontal scroll if needed. */ 11214 @media (max-width: 640px) { 11215 overflow-x: auto; 11216 } 11217`,uot=p.table.withConfig({displayName:"CitationsTabstyles__Table",componentId:"sc-xtvwen-14"})` 11218 width: 100%; 11219 /* iOS Safari: sticky table headers can fail when border-collapse is "collapse". */ 11220 border-collapse: separate; 11221 border-spacing: 0; 11222 table-layout: fixed; 11223 11224 /* Mobile: allow horizontal scrolling by making the table wider than the viewport. */ 11225 @media (max-width: 640px) { 11226 min-width: 760px; 11227 } 11228`,pot=p.thead.withConfig({displayName:"CitationsTabstyles__THead",componentId:"sc-xtvwen-15"})` 11229 background: ${$e}; 11230 border-bottom: 1px solid ${V}; 11231`,af=p.tr.withConfig({displayName:"CitationsTabstyles__TR",componentId:"sc-xtvwen-16"})``,o$=p.th.withConfig({displayName:"CitationsTabstyles__TH",componentId:"sc-xtvwen-17"})` 11232 position: sticky; 11233 top: 0; 11234 z-index: 3; 11235 background: ${$e}; 11236 text-align: left; 11237 padding: 0.55rem 0.7rem; 11238 font-size: 0.625rem; 11239 font-weight: 950; 11240 letter-spacing: 0.06em; 11241 text-transform: uppercase; 11242 color: ${z}; 11243`,bs=p.td.withConfig({displayName:"CitationsTabstyles__TD",componentId:"sc-xtvwen-18"})` 11244 padding: 0.55rem 0.7rem; 11245 font-size: 0.8125rem; 11246 font-weight: ${e=>e.$muted?750:900}; 11247 color: ${e=>e.$muted?z:O}; 11248 text-align: ${e=>e.$right?"right":"left"}; 11249 border-bottom: 1px solid ${$e}; 11250 white-space: nowrap; 11251 overflow: hidden; 11252`,mot=p.span.withConfig({displayName:"CitationsTabstyles__Truncate",componentId:"sc-xtvwen-19"})` 11253 display: block; 11254 min-width: 0; 11255 overflow: hidden; 11256 text-overflow: ellipsis; 11257 white-space: nowrap; 11258`,FK=p.a.withConfig({displayName:"CitationsTabstyles__PageLink",componentId:"sc-xtvwen-20"})` 11259 display: block; 11260 min-width: 0; 11261 overflow: hidden; 11262 text-overflow: ellipsis; 11263 white-space: nowrap; 11264 color: ${O}; 11265 font-weight: 850; 11266 text-decoration: none; 11267`,hot=p.span.withConfig({displayName:"CitationsTabstyles__DomainCell",componentId:"sc-xtvwen-21"})` 11268 display: inline-flex; 11269 align-items: center; 11270 gap: 0.5rem; 11271 min-width: 0; 11272`,fot=p.img.withConfig({displayName:"CitationsTabstyles__DomainLogo",componentId:"sc-xtvwen-22"})` 11273 width: 1rem; 11274 height: 1rem; 11275 border-radius: 0.25rem; 11276 background: ${$e}; 11277 border: 1px solid ${V}; 11278 flex: 0 0 auto; 11279 object-fit: contain; 11280`;function got(e){const n=!e.singleDay&&Array.isArray(e.citationsSeriesD
11280ata)&&e.citationsSeriesData.length===1,i=l.useMemo(()=>{if(!e.singleDay&&!n)return[];const r=Array.isArray(e.citationsSeriesData)?e.citationsSeriesData[0]:null;if(!r)return[];const o=new Map;return(e.allModelOptions||[]).forEach(a=>{const c=String(a?.key||""),u=String(a?.label||c);c&&o.set(c,u)}),(e.selectedModels||[]).map(a=>String(a)).filter(Boolean).map(a=>{const c=r?.[a];return{label:o.get(a)||a,value:typeof c=="number"?String(Number(c).toFixed(0)):"0",color:f8(a,z)}}).sort((a,c)=>Number(c.value)-Number(a.value))},[e.allModelOptions,e.citationsSeriesData,e.selectedModels,e.singleDay,n]);return t.jsxs(aot,{children:[t.jsx(vde,{children:t.jsxs("div",{style:{minWidth:0,display:"inline-flex",alignItems:"center",gap:8},children:[t.jsx(wde,{children:"Citations Over Time"}),t.jsx(at,{maxWidth:360,content:t.jsxs("div",{style:{minWidth:260},children:["Stacked area chart showing ",t.jsx("b",{children:"citation counts per model"})," over time. Hover a date bucket to see the citations for that period."]}),children:t.jsx("span",{style:{display:"inline-flex",color:z},children:t.jsx(wn,{size:14})})})]})}),t.jsx(jde,{children:t.jsx(cot,{ref:e.chartBodyRef,children:e.citationsSeriesError?t.jsx("div",{style:{height:"100%",display:"flex",alignItems:"center",justifyContent:"center",fontWeight:850,color:oi},children:e.citationsSeriesError}):e.citationsSeriesLoading||e.chartSize.w<=0||e.chartSize.h<=0?e.renderChartSkeleton():e.citationsSeriesData.length===0?t.jsx("div",{style:{height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:t.jsx(Sp,{initialCrunching:e.initialCrunching,embedded:!0})}):e.singleDay?t.jsx(ky,{title:"Single day view",dayISO:String(e.citationsSeriesData[0]?.date||""),primaryLabel:"Total citations",primaryValue:(()=>{const r=e.citationsSeriesData[0],o=r&&typeof r.total=="number"?r.total:null;return typeof o=="number"?String(o.toFixed(0)):"â"})(),rows:i.slice(0,8),hint:"Select multiple days to see a trend."}):n?t.jsx(ky,{title:"First data point",dayISO:String(e.citationsSeriesData[0]?.date||""),primaryLabel:"Total citations",primaryValue:(()=>{const r=e.citationsSeriesData[0],o=r&&typeof r.total=="number"?r.total:null;return typeof o=="number"?String(o.toFixed(0)):"â"})(),rows:i.slice(0,8),hint:"Your next scan will unlock the trend chart."}):t.jsx("div",{style:{width:"100%",flex:1,minHeight:0},children:t.jsx(Gl,{width:"100%",height:"100%",minWidth:1,minHeight:1,children:(()=>{const r=e.chartSize.w>0&&e.chartSize.w<=420;return t.jsxs(zC,{data:e.citationsSeriesData,margin:{top:10,right:10,left:10,bottom:r?46:26},onMouseMove:o=>{const s=o?.activeLabel;typeof s=="string"&&e.setHoveredCitationsDate(s)},onMouseLeave:()=>e.setHoveredCitationsDate(null),children:[t.jsx(Zm,{stroke:V,strokeDasharray:"3 3"}),t.jsx(Ql,{dataKey:"date",tick:{fill:z,fontSize:11,fontWeight:800},axisLine:{stroke:V},tickLine:{stroke:V},interval:r?0:"preserveStartEnd",angle:r?-35:0,textAnchor:r?"end":"middle",height:r?52:34,tickMargin:r?14:10,minTickGap:10,tickFormatter:o=>{const s=String(o||"");return s?j_({value:s,format:"date",timeZoneMode:"viewer",placeholder:s}):""}}),t.jsx(Zl,{tick:{fill:z,fontSize:11,fontWeight:800},axisLine:{stroke:V},tickLine:{stroke:V},width:44,allowDecimals:!1}),t.jsx(Vl,{content:o=>{const s=!!o?.active,a=o?.payload||[],c=String(o?.label||"");if(!s||!c)return null;const u=j_({value:c,format:"date",timeZoneMode:"viewer",placeholder:c}),m=a.filter(g=>g&&g.dataKey&&typeof g.value=="number").map(g=>({key:String(g.dataKey),value:Number(g.value)||0,color:g.color})).filter(g=>g.key!=="total").sort((g,x)=>x.value-g.value),h=e.groupByDomain?(e.hoveredCitationsGroups||[]).filter(g=>!e.isCompetitorDomain(g.domain)).slice().sort((g,x)=>(x.frequency||0)-(g.frequency||0)).slice(0,7).map(g=>({domain:g.domain,page:"",url:"",frequency:g.frequency,model_keys:g.model_keys})):(e.hoveredCitationsRows||[]).filter(g=>!e.isCompetitorDomain(g.domain)).slice().sort((g,x)=>(x.frequency||0)-(g.frequency||0)).slice(0,7);return t.jsxs("div",{style:{background:Z,border:`1px solid ${V}`,borderRadius:12,padding:"0.6rem 0.7rem",boxShadow:"0 18px 40px color-mix(in srgb, var(--color-gray-900) 14%, transparent)",width:"min(380px, calc(100vw - 2rem))",height:"min(320px, calc(100vh - 8rem))",display:"flex",flexDirection:"column",overflow:"hidden"},children:[t.jsx("div",{style:{fontSize:12,fontWeight:950,color:O,flex:"0 0 auto"},children:u}),t.jsxs("div",{style:{marginTop:8,minHeight:0,overflowY:"auto",paddingRight:4},children:[t.jsx("div",{style:{display:"grid",gap:4},children:m.map(g=>t.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:10},children:[t.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:8,minWidth:0},children:[t.jsx("span",{style:{width:10,height:10,borderRadius:9999,background:g.color||V,border:`1px solid ${V}`,flex:"0 0 auto"}}),t.jsx("span",{style:{fontSize:12,fontWeight:850,color:z},children:e.allModelOptions.find(x=>x.key===g.key)?.label||g.key})]}),t.jsx("div",{style:{fontSize:12,fontWeight:950,color:O},children:g.value.toFixed(0)})]},g.key))}),t.jsx("div",{style:{height:1,background:$e,marginTop:10}}),t.jsxs("div",{style:{marginTop:8,fontSize:12,fontWeight:900,color:z},children:["Top citations (",e.groupByDomain?"domains":"pages",")"]}),e.hoveredCitationsLoading?t.jsx("div",{style:{marginTop:6,fontSize:12,fontWeight:850,color:z},children:"Loadingâ¦"}):e.hoveredCitationsError?t.jsx("div",{style:{marginTop:6,fontSize:12,fontWeight:850,color:oi},children:e.hoveredCitationsError}):h.length===0?t.jsx("div",{style:{marginTop:6,fontSize:12,fontWeight:850,color:z},children:"No citations."}):t.jsx("div",{style:{marginTop:6,display:"grid",gap:6},children:h.map((g,x)=>t.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:10},children:[t.jsxs("div",{style:{minWidth:0},children:[t.jsx("div",{style:{fontSize:12,fontWeight:950,color:O,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:g.domain}),e.groupByDomain?null:t.jsx("div",{style:{marginTop:2,fontSize:12,fontWeight:750,color:z,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:240,width:"100%"},children:g.page}),t.jsx("div",{style:{marginTop:3},children:e.renderModelIcons(g.model_keys)})]}),t.jsx("div",{style:{fontSize:12,fontWeight:950,color:O,flex:"0 0 auto"},children:Number(g.frequency||0)})]},`${g.domain}-${g.url||x}`))})]})]})}}),e.selectedModels.map(o=>{const s=f8(o,z);return t.jsx(jf,{type:"monotone",dataKey:o,stackId:"1",stroke:s,fill:s,fillOpacity:.35,strokeWidth:2,connectNulls:!0,isAnimationActive:!1,name:e.allModelOptions.find(a=>a.key===o)?.label||o},o)})]})})()})})})})]})}function yot(e){return t.jsxs(lot,{children:[t.jsx(vde,{children:t.jsxs("div",{style:{minWidth:0,display:"inline-flex",alignItems:"center",gap:8},children:[t.jsx(wde,{children:e.title}),t.jsx(at,{content:"Domains/pages cited by selected models in the selected date range.",children:t.jsx("span",{style:{display:"inline-flex",color:z},children:t.jsx(wn,{size:14})})})]})}),t.jsxs("div",{style:{marginTop:"0.6rem",minHeight:0,flex:1,display:"flex",flexDirection:"column"},children:[t.jsx(jde,{style:{padding:0},children:t.jsx(dot,{children:t.jsxs(uot,{children:[t.jsx(pot,{children:t.jsxs(af,{children:[t.jsx(o$,{style:{width:"28%"},children:"Domain"}),t.jsx(o$,{style:{width:"40%"},children:"Page"}),t.jsxs(o$,{style:{width:"18%"},children:["Cited",t.jsx(at,{content:"Which models cited this page at least once in the selected range.",children:t.jsx("span",{style:{display:"inline-flex",marginLeft:6,color:z},children:t.jsx(wn,{size:12})})})]}),t.jsx(o$,{style:{width:"14%",textAlign:"right"},children:t.jsxs("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"flex-end",width:"100%",gap:6},children:["Frequency",t.jsx(at,{maxWidth:420,content:t.jsx("div",{style:{minWidth:280},children:"How many times this page was cited across the selected range/models."}),children:t.jsx("span",{style:{display:"inline-flex",color:z},children:t.jsx(wn,{size:12})})})]})})]})}),t.jsx("tbody",{children:e.citationsLoading?e.renderTableSkeletonRows():e.citationsError?t.jsx(af,{children:t.jsx(bs,{$muted:!0,colSpan:4,children:e.citationsError})}):e.groupByDomain?e.filteredCitationsGroups.length===0?t.jsx(af,{children:t.jsx(bs,{$muted:!0,colSpan:4,children:t.jsx("div",{style:{padding:"0.75rem"},children:t.jsx(Sp,{initialCrunching:e.initialCrunching})})})}
11280):e.filteredCitationsGroups.map(n=>{const i=e.citationsSearch.trim()?!0:!!e.expandedDomains[n.domain];return t.jsxs(l.Fragment,{children:[t.jsxs(af,{children:[t.jsx(bs,{children:t.jsxs("button",{type:"button",onClick:()=>e.setExpandedDomains(r=>({...r,[n.domain]:!i})),"aria-expanded":i,style:{appearance:"none",border:0,background:"transparent",padding:0,display:"inline-flex",alignItems:"center",gap:8,cursor:"pointer",fontWeight:900,color:O},children:[i?t.jsx(qn,{size:18}):t.jsx(Gi,{size:18}),e.renderDomain(n.domain)]})}),t.jsx(bs,{$muted:!0}),t.jsx(bs,{children:e.renderModelIcons(n.model_keys)}),t.jsx(bs,{$right:!0,style:{fontWeight:900},children:n.frequency})]}),i?n.pages.map(r=>t.jsxs(af,{children:[t.jsx(bs,{$muted:!0,children:e.renderDomain(r.domain,{muted:!0})}),t.jsx(bs,{children:t.jsx(at,{content:r.url,children:t.jsx(FK,{href:r.url,target:"_blank",rel:"noreferrer",children:r.page})})}),t.jsx(bs,{children:e.renderModelIcons(r.model_keys)}),t.jsx(bs,{$right:!0,style:{fontWeight:900},children:r.frequency})]},`${n.domain}-${r.url}`)):null]},n.domain)}):e.filteredCitationsRows.length===0?t.jsx(af,{children:t.jsx(bs,{$muted:!0,colSpan:4,children:t.jsx("div",{style:{padding:"0.75rem"},children:t.jsx(Sp,{initialCrunching:e.initialCrunching})})})}):e.filteredCitationsRows.map((n,i)=>t.jsxs(af,{children:[t.jsx(bs,{children:e.renderDomain(n.domain)}),t.jsx(bs,{children:t.jsx(at,{content:n.url,children:t.jsx(FK,{href:n.url,target:"_blank",rel:"noreferrer",children:n.page})})}),t.jsx(bs,{children:e.renderModelIcons(n.model_keys)}),t.jsx(bs,{$right:!0,style:{fontWeight:900},children:n.frequency})]},`${n.domain}-${n.url}-${i}`))})]})})}),t.jsx("div",{style:{marginTop:10},children:t.jsx(pi,{page:e.pagination.page||e.page,totalPages:e.pagination.total_pages||1,total:e.pagination.total||0,onPrev:e.onPrev,onNext:e.onNext})})]})]})}function _de(e){return e?e.split(",").map(n=>n.trim()).filter(Boolean):[]}function Cde(e){return e?e.split(",").map(n=>Number(String(n||"").trim())).filter(n=>Number.isFinite(n)&&n>0):[]}function Nw(e,n,i){i?e.set(n,i):e.delete(n)}function xot(e){const[n,i]=l.useState(!1),[r,o]=yr(),s=r.get("end")||qs(),c={start:r.get("start")||hl(s,-6),end:s},u=Cde(r.get("topic_ids")),m=Number(r.get("topic_id")||""),h=u.length>0?u:Number.isFinite(m)&&m>0?[m]:[],x=(r.get("group")||"domain").toLowerCase()!=="page",y=r.get("hide_comp")==="1",w=r.get("q")||"",j=Math.max(1,Number(r.get("page")||"1")||1),v=F=>{j!==1?F.set("page","1"):F.delete("page")},$=_de(r.get("models")),k=Number(e.workspaceId),P=Number(e.projectId),S=S1(k,P);l.useEffect(()=>{!k||!P||S.loading||S.topics&&S.topics.length>0||S.error||S.ensure()},[k,P,S]);const I=l.useMemo(()=>(S.topics||[]).map(F=>({id:Number(F?.id),label:String(F?.name||"").trim()})).filter(F=>Number.isFinite(F.id)&&F.id>0&&!!F.label),[S.topics]),A=F=>{const Y=new URLSearchParams(r);Nw(Y,"start",F.start),Nw(Y,"end",F.end),v(Y),o(Y,{replace:!0})},E=F=>{const Y=new URLSearchParams(r);Nw(Y,"models",F.length>0?F.join(","):null),v(Y),o(Y,{replace:!0})},B=F=>{const Y=new URLSearchParams(r);Y.delete("topic_id"),Nw(Y,"topic_ids",F.length>0?F.join(","):null),v(Y),o(Y,{replace:!0})},T=F=>{const Y=new URLSearchParams(r);Nw(Y,"q",F.trim()?F:null),v(Y),o(Y,{replace:!0})},M=()=>{const F=new URLSearchParams(r);F.set("group",x?"page":"domain"),v(F),o(F,{replace:!0})},R=()=>{const F=new URLSearchParams(r);F.set("hide_comp",y?"0":"1"),v(F),o(F,{replace:!0})};return t.jsxs(t.Fragment,{children:[t.jsxs(iot,{children:[t.jsxs(rot,{children:[t.jsx(rh,{value:c,onChange:A,historyMonthsLimit:e.historyMonthsLimit,historyLimitMessage:e.historyLimitMessage}),t.jsx(rC,{options:e.allModelOptions,value:$,onChange:E,disabled:e.enabledModelKeys.length<=0,onUpgradeClick:()=>i(!0),isOwner:e.isOwner,hideUnavailableOptions:!1}),t.jsx(u1,{options:I,value:h,onChange:B,disabled:S.loading}),t.jsx(vf,{label:"Group by domain",active:x,onClick:M}),t.jsx(vf,{label:"Hide competitors",active:y,onClick:R})]}),t.jsx(oot,{children:t.jsx(Ed,{value:w,onChange:T,placeholder:"Search citationsâ¦",containerStyle:{minWidth:0},inputStyle:{height:"2rem"}})})]}),e.workspaceId?t.jsx(ec,{isOpen:n,orgId:Number(e.workspaceId),onClose:()=>i(!1)}):null]})}function bot(){const{workspaceId:e,projectId:n,project:i,allModelOptions:r,enabledModelKeys:o,competitorOptions:s}=z8(),{modelByKey:a}=eC(),[c,u]=yr(),m=l.useRef(null),[h,g]=l.useState({w:0,h:0}),x=!!i?.initial_crunching,y=l.useMemo(()=>{const ht=be=>{const rt=String(be||"").trim().toLowerCase();return rt.startsWith("www.")?rt.slice(4):rt},pe=be=>{const rt=String(be||"").trim();if(!rt)return null;try{return ht(new URL(rt).hostname)}catch{try{return ht(new URL(`https://${rt}`).hostname)}catch{return null}}};return new Set(s.map(be=>
11280pe(be?.website)).filter(Boolean))},[s]),w=ht=>{if(!M)return!1;const pe=String(ht||"").trim().toLowerCase(),be=pe.startsWith("www.")?pe.slice(4):pe;if(!be)return!1;for(const rt of y)if(rt&&(be===rt||be.endsWith(`.${rt}`)))return!0;return!1},[j,v]=l.useState(()=>{const ht=qs();return{start:hl(ht,-6),end:ht}}),[_,$]=l.useState(()=>o);l.useEffect(()=>{$(ht=>ht.length>0?ht:o)},[o]);const[k,P]=l.useState([]),[S,I]=l.useState(""),[A,E]=l.useState(!0),[B,T]=l.useState({}),[M,R]=l.useState(!1),[F,Y]=l.useState(1),[H,U]=l.useState({page:1,per_page:50,total:0,total_pages:0});l.useEffect(()=>{const ht=c.get("end")||qs(),pe=c.get("start")||hl(ht,-6);v({start:pe,end:ht});const be=_de(c.get("models"));$(be.length>0?be:o);const rt=Cde(c.get("topic_ids")),ze=Number(c.get("topic_id")||"");P(rt.length>0?rt:Number.isFinite(ze)&&ze>0?[ze]:[]),E((c.get("group")||"domain").toLowerCase()!=="page"),R(c.get("hide_comp")==="1"),I(c.get("q")||""),Y(Math.max(1,Number(c.get("page")||"1")||1)),T({})},[o,c]);const{subscribe:X}=wo(),Q=l.useRef(null),K=l.useRef(null),[G,L]=l.useState(0);l.useEffect(()=>{const ht=Number(n);if(!Number.isFinite(ht)||ht<=0)return;try{Q.current?.unsubscribe?.()}catch{}Q.current=null;const pe=X({channel:"ProjectPromptsChannel",project_id:ht},{received:be=>{be?.type==="prompt_finished"&&Number(be?.project_id)===ht&&(K.current&&window.clearTimeout(K.current),K.current=window.setTimeout(()=>{K.current=null,L(rt=>rt+1)},650))}})||null;return Q.current=pe,()=>{K.current&&(window.clearTimeout(K.current),K.current=null);try{Q.current?.unsubscribe?.()}catch{}Q.current=null}},[n,X]);const[q,W]=l.useState(!1),[oe,se]=l.useState(null),[de,le]=l.useState([]),[me,ee]=l.useState([]),[ne,Ae]=l.useState(!1),[_e,we]=l.useState(null),[Ke,ce]=l.useState([]),[ie,Re]=l.useState(null),[Be,tt]=l.useState(!1),[dt,je]=l.useState(null),[Me,Se]=l.useState([]),[it,De]=l.useState([]),te=l.useMemo(()=>new Map,[]),ge=()=>t.jsxs("div",{style:{height:"100%",width:"100%",display:"flex",flexDirection:"column",gap:10},children:[t.jsx(nt,{height:14,width:"35%"}),t.jsx("div",{style:{flex:1,minHeight:0},children:t.jsx(nt,{height:"100%",width:"100%",radius:14})})]}),Je=(ht=8)=>Array.from({length:ht}).map((pe,be)=>t.jsxs(af,{children:[t.jsx(bs,{children:t.jsx(nt,{height:14,width:`${45+be%3*10}%`})}),t.jsx(bs,{children:t.jsx(nt,{height:14,width:`${65+be%2*12}%`})}),t.jsx(bs,{children:t.jsx(nt,{height:14,width:"55%"})}),t.jsx(bs,{$right:!0,children:t.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:t.jsx(nt,{height:14,width:42})})})]},`sk-${be}`)),Ee=ht=>{const pe=Array.from(new Set((ht||[]).map(be=>String(be).trim()).filter(Boolean)));return pe.length===0?t.jsx("span",{style:{color:z,fontWeight:700},children:"â"}):t.jsx("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:pe.map(be=>{const rt=a[be],ze=rt?.Icon;if(!ze)return null;const lt=rt?.label||be;return t.jsx("span",{title:lt,"aria-label":lt,children:t.jsx(ze,{})},be)})})},Xe=l.useMemo(()=>{const ht=M?de.filter(be=>!w(be.domain)):de,pe=S.trim().toLowerCase();return pe?ht.filter(be=>`${be.domain} ${be.page} ${be.url} ${(be.model_keys||[]).join(" ")}`.toLowerCase().includes(pe)):ht},[de,S,M,y]),yt=l.useMemo(()=>{const ht=M?me.map(be=>{if(w(be.domain))return null;const rt=(be.pages||[]).filter(ze=>!w(ze.domain));return{...be,pages:rt}}).filter(Boolean):me,pe=S.trim().toLowerCase();return pe?ht.map(be=>{const rt=be.domain.toLowerCase().includes(pe),ze=(be.pages||[]).filter(lt=>`${lt.domain} ${lt.page} ${lt.url} ${(lt.model_keys||[]).join(" ")}`.toLowerCase().includes(pe));return rt?be:ze.length>0?{...be,pages:ze}:null}).filter(Boolean):ht},[me,S,M,y]),Ne=l.useMemo(()=>Ke.map(ht=>({date:ht.date,...ht.totals,total:ht.total})),[Ke]),Le=l.useMemo(()=>NM(j),[j]);l.useEffect(()=>{const ht=m.current;if(!ht||typeof ResizeObserver>"u")return;const pe=new ResizeObserver(be=>{const ze=be[0]?.contentRect,lt=Math.max(0,Number(ze?.width||0)),vt=Math.max(0,Number(ze?.height||0));g({w:lt,h:vt})});return pe.observe(ht),()=>pe.disconnect()},[]);const Ue=(ht,pe)=>t.jsxs(hot,{children:[t.jsx($u,{domain:ht,Img:fot,fallback:t.jsx("span",{style:{width:"1rem",he
11280ight:"1rem",display:"inline-flex",alignItems:"center",justifyContent:"center",color:pe?.muted?z:O},children:t.jsx(To,{size:14})})}),t.jsx(mot,{title:ht,children:ht})]});l.useEffect(()=>{const ht=Number(e),pe=Number(n);if(!ht||!pe)return;let be=!1;return W(!0),se(null),(async()=>{try{const rt=new URLSearchParams;rt.set("start",j.start),rt.set("end",j.end),_.length>0&&rt.set("models",_.join(",")),rt.set("group",A?"domain":"page"),rt.set("page",String(F)),k.length>0&&rt.set("topic_ids",k.join(","));const ze=await ue(`/api/v1/organizations/${ht}/projects/${pe}/citations?${rt.toString()}`,{method:"GET"}),lt=await ze.json().catch(()=>({}));if(!ze.ok)throw new Error(lt?.error||lt?.errors?.[0]||"Failed to load citations");const vt=Array.isArray(lt?.rows)?lt.rows:[],Wt=Array.isArray(lt?.groups)?lt.groups:[],Qt=vt.map(tn=>({domain:String(tn?.domain||""),page:String(tn?.page||"/"),url:String(tn?.url||""),frequency:Number(tn?.frequency)||0,model_keys:Array.isArray(tn?.model_keys)?tn.model_keys.map(nn=>String(nn)):[],model_frequencies:tn?.model_frequencies&&typeof tn.model_frequencies=="object"?tn.model_frequencies:void 0})).filter(tn=>tn.domain&&tn.url),Yt=Wt.map(tn=>({domain:String(tn?.domain||""),frequency:Number(tn?.frequency)||0,model_keys:Array.isArray(tn?.model_keys)?tn.model_keys.map(nn=>String(nn)):[],model_frequencies:tn?.model_frequencies&&typeof tn.model_frequencies=="object"?tn.model_frequencies:void 0,pages:(Array.isArray(tn?.pages)?tn.pages:[]).map(nn=>({domain:String(nn?.domain||""),page:String(nn?.page||"/"),url:String(nn?.url||""),frequency:Number(nn?.frequency)||0,model_keys:Array.isArray(nn?.model_keys)?nn.model_keys.map(xn=>String(xn)):[],model_frequencies:nn?.model_frequencies&&typeof nn.model_frequencies=="object"?nn.model_frequencies:void 0})).filter(nn=>nn.domain&&nn.url)})).filter(tn=>tn.domain);if(be)return;le(Qt),ee(Yt);const Zt=lt?.pagination;U(Zt&&typeof Zt=="object"?{page:Number(Zt?.page)||F,per_page:Number(Zt?.per_page)||50,total:Number(Zt?.total)||0,total_pages:Number(Zt?.total_pages)||0}:{page:F,per_page:50,total:Qt.length+Yt.length,total_pages:1})}catch(rt){if(be)return;le([]),ee([]),U({page:F,per_page:50,total:0,total_pages:0}),se(rt?.message||"Failed to load citations")}finally{if(be)return;W(!1)}})(),()=>{be=!0}},[e,n,j.end,j.start,_.join(","),A,k.join(","),F,G]),l.useEffect(()=>{const ht=Number(e),pe=Number(n);if(!ht||!pe)return;let be=!1;return Ae(!0),we(null),(async()=>{try{const rt=new URLSearchParams;rt.set("start",j.start),rt.set("end",j.end),_.length>0&&rt.set("models",_.join(",")),k.length>0&&rt.set("topic_ids",k.join(","));const ze=await ue(`/api/v1/organizations/${ht}/projects/${pe}/citations/timeseries?${rt.toString()}`,{method:"GET"}),lt=await ze.json().catch(()=>({}));if(!ze.ok)throw new Error(lt?.error||lt?.errors?.[0]||"Failed to load citations timeseries");const Wt=(Array.isArray(lt?.points)?lt.points:[]).map(Qt=>({date:String(Qt?.date||""),totals:Qt?.totals&&typeof Qt.totals=="object"?Qt.totals:{},total:Number(Qt?.total)||0})).filter(Qt=>Qt.date);if(be)return;ce(Wt)}catch(rt){if(be)return;ce([]),we(rt?.message||"Failed to load citations timeseries")}finally{if(be)return;Ae(!1)}})(),()=>{be=!0}},[e,n,j.end,j.start,_.join(","),k.join(","),G]),l.useEffect(()=>{const ht=Number(e),pe=Number(n);if(!ht||!pe||!ie)return;const be=A?"domain":"page",rt=`${ie}|${be}|${_.join(",")}|${k.join(",")}`,ze=te.get(rt);if(ze){je(null),Se(ze.rows),De(ze.groups),tt(!1);return}let lt=!1;return tt(!0),je(null),(async()=>{try{const vt=new URLSearchParams;vt.set("start",ie),vt.set("end",ie),_.length>0&&vt.set("models",_.join(",")),vt.set("group",be),k.length>0&&vt.set("topic_ids",k.join(","));const Wt=await ue(`/api/v1/organizations/${ht}/projects/${pe}/citations?${vt.toString()}`,{method:"GET"}),Qt=await Wt.json().catch(()=>({}));if(!Wt.ok)throw new Error(Qt?.error||Qt?.errors?.[0]||"Failed to load citations for hovered date");const Yt=Array.isArray(Qt?.rows)?Qt.rows:[],Zt=Array.isArray(Qt?.groups)?Qt.groups:[],tn=Yt.map(st=>({domain:String(st?.domain||""),page:String(st?.page||"/"),url:String(st?.url||""),frequency:Number(st?.frequency)||0,model_keys:Array.isArray(st?.model_keys)?st.model_keys.map(Ct=>String(Ct)):[],model_frequencies:st?.model_frequencies&&typeof st.model_frequencies=="object"?st.model_frequencies:void 0})).filter(st=>st.domain&&st.url),nn=Zt.map(st=>({domain:String(st?.domain||""),frequency:Number(st?.frequency)||0,model_keys:Array.isArray(st?.model_keys)?st.model_keys.map(Ct=>String(Ct)):[],model_frequencies:st?.model_frequencies&&typeof st.model_frequencies=="object"?st.model_frequencies:void 0,pages:(Array.isArray(st?.pages)?st.pages:[]).map(Ct=>({domain:String(Ct?.domain||""),page:String(Ct?.page||"/"),url:String(Ct?.url||""),frequency:Number(Ct?.frequency)||0,model_keys:Array.isArray(Ct?.model_keys)?Ct.model_keys.map(Ie=>String(Ie)):[],model_frequencies:Ct?.model_frequencies&&typeof Ct.model_frequencies=="object"?Ct.model_frequencies:void 0})).filter(Ct=>Ct.domain&&Ct.url)})).filter(st=>st.domain),xn={rows:tn,groups:nn};if(te.set(rt,xn),lt)return;Se(tn),De(nn)}catch(vt){if(lt)return;Se([]),De([]),je(vt?.message||"Failed to load citations for hovered date")}finally{if(lt)return;tt(!1)}})(),()=>{lt=!0}},[e,n,ie,_.join(","),k.join(","),A,te]);const We=()=>{const ht=H.page||F;if(ht<=1)return;
11280const pe=new URLSearchParams(c),be=Math.max(1,ht-1);be===1?pe.delete("page"):pe.set("page",String(be)),u(pe,{replace:!0})},Qe=()=>{const ht=H.page||F,pe=Math.max(1,H.total_pages||1);if(ht>=pe)return;const be=new URLSearchParams(c),rt=ht+1;be.set("page",String(rt)),u(be,{replace:!0})};return t.jsxs(sot,{children:[t.jsx(yot,{title:A?"Top Cited Domains":"Top Cited Pages",initialCrunching:x,citationsLoading:q,citationsError:oe,groupByDomain:A,citationsSearch:S,filteredCitationsGroups:yt,filteredCitationsRows:Xe,expandedDomains:B,setExpandedDomains:T,renderDomain:Ue,renderModelIcons:Ee,renderTableSkeletonRows:Je,pagination:H,page:F,onPrev:We,onNext:Qe}),t.jsx(got,{initialCrunching:x,allModelOptions:r,selectedModels:_,groupByDomain:A,singleDay:Le,citationsSeriesError:_e,citationsSeriesLoading:ne,citationsSeriesData:Ne,chartBodyRef:m,chartSize:h,renderChartSkeleton:ge,setHoveredCitationsDate:Re,hoveredCitationsGroups:it,hoveredCitationsRows:Me,hoveredCitationsLoading:Be,hoveredCitationsError:dt,isCompetitorDomain:w,renderModelIcons:Ee})]})}const vot=p.div.withConfig({displayName:"ProjectPromptsPage__Page",componentId:"sc-1k9vk2q-0"})` 11281 padding: 1.25rem; 11282 height: 100vh; 11283 box-sizing: border-box; 11284 overflow: hidden; 11285 display: flex; 11286 flex-direction: column; 11287 gap: 0.85rem; 11288 11289 @media (max-width: 640px) { 11290 height: auto; 11291 min-height: 100dvh; 11292 overflow: visible; 11293 } 11294`,wot=p.div.withConfig({displayName:"ProjectPromptsPage__Header",componentId:"sc-1k9vk2q-1"})` 11295 border: 0; 11296 background: transparent; 11297 border-radius: 0; 11298 padding: 0; 11299`,jot=p.div.withConfig({displayName:"ProjectPromptsPage__HeroTop",componentId:"sc-1k9vk2q-2"})` 11300 display: flex; 11301 align-items: flex-start; 11302 justify-content: space-between; 11303 gap: 1rem; 11304 flex-wrap: wrap; 11305`,_ot=p.div.withConfig({displayName:"ProjectPromptsPage__Panel",componentId:"sc-1k9vk2q-3"})` 11306 border: ${e=>e.$plain?"0":`1px solid ${V}`}; 11307 background: ${e=>e.$plain?"transparent":Z}; 11308 border-radius: 0.875rem; 11309 padding: ${e=>e.$plain||e.$flush?"0":"1rem"}; 11310 color: ${z}; 11311 font-size: 0.875rem; 11312 flex: 1; 11313 min-height: 0; 11314 display: flex; 11315 flex-direction: column; 11316 /* Page uses overflow: hidden; make Panel the scroll container even when "plain". */ 11317 overflow: ${e=>e.$plain?"auto":"hidden"}; 11318`;function Cot(){const{workspaceId:e,projectId:n}=Gn(),{projects:i}=Mr(),{user:r}=yn(),o=Number(n),s=l.useMemo(()=>i.find(I=>I.id===o)||null,[o,i]),a=l.useMemo(()=>{const I=String(s?.name||`Project ${n}`||"").trim();return I?I[0].toUpperCase()+I.slice(1):"Project"},[s?.name,n]),c=vo(),u=l.useMemo(()=>`/workspaces/${e}/projects/${n}`,[n,e]),m=l.useMemo(()=>`/workspaces/${e}/projects/${n}/prompts`,[n,e]),h=l.useMemo(()=>{const I=c.pathname;return I.includes("/prompts/citations")?"citations":I.includes("/prompts/fanout")?"fanout":"prompts"},[c.pathname]),{allModelOptions:g,enabledModelKeys:x}=eC(),y=Number(e),w=Number(n),j=l.useMemo(()=>y&&r?.organizations?.find(I=>Number(I.id)===Number(y))?.role||null,[y,r?.organizations]),v=l.useMemo(()=>{if(!y)return null;const I=r?.organizations?.find(A=>Number(A.id)===Number(y))?.data_history_months;return I==null?null:Number(I)},[y,r?.organizations]),[_,$]=l.useState(!1),k=l.useMemo(()=>v?j==="owner"?t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:()=>$(!0),style:{color:"inherit",fontWeight:850,textDecoration:"underline",background:"none",border:"none",padding:0,font:"inherit",cursor:"pointer"},children:"Upgrade your plan"})," to access older history."]}):"Ask your workspace owner to upgrade the plan.":null,[v,j]),P=MA(y,w);l.useEffect(()=>{!y||!w||P.loading||P.data||P.error||P.ensure()},[P,y,w]);const S=l.useMemo(()=>P.direct.map(I=>({id:Number(I?.id),label:String(I?.name||"").trim(),website:I?.website?String(I.website).trim():null,...I?.logo_url?{logo_url:String(I.logo_url)}:null})).filter(I=>Number.isFinite(I.id)&&I.id>0&&I.label),[P.direct]);return t.jsxs(vot,{children:[t.jsx(wot,{children:t.jsxs(jot,{children:[t.jsxs(UO,{role:"tablist","aria-label":"Prompts tabs",children:[t.jsxs(hy,{as:Dn,to:m,$active:h==="prompts",role:"tab","aria-selected":h==="prompts",children:[t.jsx(Ss,{size:16}),"Prompts"]}),t.jsxs(hy,{as:Dn,to:`${m}/fanout`,$active:h==="fanout",role:"tab","aria-selected":h==="fanout",children:[t.jsx(CP,{size:16}),"Fan-out queries"]}),t.jsxs(hy,{as:Dn,to:`${m}/citations`,$active:h==="citations",role:"tab","aria-selected":h==="citations",children:[t.jsx(pxe,{size:16}),"Citations"]})]}),t.jsx("div",{style:{paddingRight:8}
11318,children:t.jsx(qr,{items:[{label:"Projects",to:e?`/workspaces/${e}`:void 0},{label:a,to:e&&n?u:void 0},{label:h==="prompts"?"Prompts":h==="fanout"?"Fan-out queries":"Citations"}]})})]})}),h==="prompts"||h==="fanout"?t.jsx("div",{id:"project-prompts-filters-slot"}):null,h==="citations"?t.jsx(xot,{workspaceId:String(e||""),projectId:String(n||""),allModelOptions:g,enabledModelKeys:x,historyMonthsLimit:v,historyLimitMessage:k,isOwner:j==="owner"}):null,t.jsx(_ot,{$flush:h==="prompts"||h==="fanout",$plain:h==="citations",children:t.jsx(Fte,{context:{workspaceId:String(e||""),projectId:String(n||""),project:s,allModelOptions:g,enabledModelKeys:x,competitorOptions:S,isOwner:j==="owner"}})}),t.jsx(ec,{isOpen:_,orgId:Number(e),onClose:()=>$(!1)})]})}function Sot(e){return e?e.split(",").map(n=>n.trim()).filter(Boolean):[]}function W6(e,n,i){i?e.set(n,i):e.delete(n)}function kot(e){const[n,i]=yr(),r=n.get("end")||qs(),o=n.get("start")||hl(r,-6),s=l.useMemo(()=>({start:o,end:r}),[o,r]),a=l.useMemo(()=>Sot(n.get("models")),[n]);return{dateRange:s,models:a,setDateRange:m=>{const h=new URLSearchParams(n);W6(h,"start",m.start),W6(h,"end",m.end),i(h,{replace:!0})},setModels:m=>{const h=new URLSearchParams(n);W6(h,"models",m.length>0?m.join(","):null),i(h,{replace:!0})}}}function zw(e){return e.json().catch(()=>({}))}function $ot(e){return Array.from(new Set((e||[]).map(n=>String(n||"").trim()).filter(Boolean)))}function _c(e){if(e==null||typeof e=="string"&&e.trim()==="")return null;const n=typeof e=="number"?e:Number(e);return Number.isFinite(n)?n:null}function Iot(e){const{organizationId:n,projectId:i,promptId:r,start:o,end:s}=e,a=l.useMemo(()=>$ot(e.models),[e.models]),c=Math.max(1,Number(e.citationsPage||1)),u=50,m=Math.max(1,Number(e.responsesPage||1)),h=50,g=e.refreshKey,[x,y]=l.useState(!1),[w,j]=l.useState(null),[v,_]=l.useState(null),[$,k]=l.useState(!1),[P,S]=l.useState(null),[I,A]=l.useState([]),[E,B]=l.useState([]),[T,M]=l.useState(!1),[R,F]=l.useState(null),[Y,H]=l.useState([]),[U,X]=l.useState(!1),[Q,K]=l.useState(null),[G,L]=l.useState([]),[q,W]=l.useState({page:1,per_page:u,total:0,total_pages:0}),[oe,se]=l.useState(!1),[de,le]=l.useState(null),[me,ee]=l.useState([]),[ne,Ae]=l.useState({page:1,per_page:h,total:0,total_pages:0});return l.useEffect(()=>{let _e=!1;return(async()=>{const we=Number(n),Ke=Number(i),ce=Number(r);
11318if(!(!we||!Ke||!ce)){y(!0),j(null);try{const ie=new URLSearchParams;ie.set("start",o),ie.set("end",s),a.length>0&&ie.set("models",a.join(","));const Re=await ue(`/api/v1/organizations/${we}/projects/${Ke}/prompts/${ce}?${ie.toString()}`,{method:"GET"}),Be=await zw(Re);if(!Re.ok)throw new Error(Be?.error||Be?.errors?.[0]||"Failed to load prompt");const tt=Be?.prompt;if(_e)return;if(!tt){_(null),j("Prompt not found");return}const dt=tt?.topic,je=dt&&typeof dt=="object"?{id:Number(dt?.id),name:String(dt?.name||"")}:null;_({id:Number(tt.id),topic_id:Number(tt.topic_id),content:String(tt.content||""),category:tt.category?String(tt.category):null,created_at:tt.created_at?String(tt.created_at):null,archived_at:tt.archived_at?String(tt.archived_at):null,has_any_prompt_runs:!!tt?.has_any_prompt_runs,prompt_actions_count:_c(tt?.prompt_actions_count),avg_monthly_searches:_c(tt.avg_monthly_searches),visibility_score:_c(tt.visibility_score),city_override:tt.city_override?String(tt.city_override):null,country_override:tt.country_override?String(tt.country_override):null,country_code_override:tt.country_code_override?String(tt.country_code_override):null,sentiment_score:_c(tt.sentiment_score),total_scans:_c(tt.total_scans),last_scanned_at:tt.last_scanned_at?String(tt.last_scanned_at):null,topic:je&&Number.isFinite(je.id)&&je.name?je:null})}catch(ie){if(_e)return;_(null),j(ie?.message||"Failed to load prompt")}finally{if(_e)return;y(!1)}}})(),()=>{_e=!0}},[n,i,r,o,s,a.join(","),g]),l.useEffect(()=>{let _e=!1;return(async()=>{const we=Number(n),Ke=Number(i),ce=Number(r);
11318if(!(!we||!Ke||!ce)){k(!0),S(null);try{const ie=new URLSearchParams;ie.set("start",o),ie.set("end",s),a.length>0&&ie.set("models",a.join(","));const Re=await ue(`/api/v1/organizations/${we}/projects/${Ke}/prompts/${ce}/competitors_timeseries?${ie.toString()}`,{method:"GET"}),Be=await zw(Re);if(!Re.ok)throw new Error(Be?.error||Be?.errors?.[0]||"Failed to load competitor trend");const dt=(Array.isArray(Be?.competitors)?Be.competitors:[]).map(Se=>({key:String(Se?.key||"").trim(),competitor_id:Se?.competitor_id==null?null:Number(Se?.competitor_id),name:String(Se?.name||"").trim(),website:Se?.website?String(Se.website).trim():null,is_main_brand:!!Se?.is_main_brand,logo_url:Se?.logo_url?String(Se.logo_url).trim():null})).filter(Se=>!!Se?.key&&!!Se?.name),Me=(Array.isArray(Be?.points)?Be.points:[]).map(Se=>{const it=String(Se?.date||""),De=Se?.totals&&typeof Se.totals=="object"?Se.totals:{},te={};Object.entries(De).forEach(([Ne,Le])=>{te[String(Ne)]=_c(Le)});const ge=Se?.mentions&&typeof Se.mentions=="object"?Se.mentions:{},Je={};Object.entries(ge).forEach(([Ne,Le])=>{const Ue=_c(Le);Je[String(Ne)]=typeof Ue=="number"?Math.max(0,Math.trunc(Ue)):0});const Ee=Se?.avg_positions&&typeof Se.avg_positions=="object"?Se.avg_positions:{},Xe={};Object.entries(Ee).forEach(([Ne,Le])=>{Xe[String(Ne)]=_c(Le)});const yt=_c(Se?.denominator);return{date:it,totals:te,mentions:Je,avg_positions:Xe,denominator:yt}}).filter(Se=>!!Se?.date).sort((Se,it)=>String(Se.date).localeCompare(String(it.date)));if(_e)return;B(dt),A(Me)}catch(ie){if(_e)return;B([]),A([]),S(ie?.message||"Failed to load competitor trend")}finally{if(_e)return;k(!1)}}})(),()=>{_e=!0}},[n,i,r,o,s,a.join(",")]),l.useEffect(()=>{let _e=!1;return(async()=>{const we=Number(n),Ke=Number(i),ce=Number(r);
11318if(!(!we||!Ke||!ce)){M(!0),F(null);try{const ie=new URLSearchParams;ie.set("start",o),ie.set("end",s),a.length>0&&ie.set("models",a.join(","));const Re=await ue(`/api/v1/organizations/${we}/projects/${Ke}/prompts/${ce}/competitors?${ie.toString()}`,{method:"GET"}),Be=await zw(Re);if(!Re.ok)throw new Error(Be?.error||Be?.errors?.[0]||"Failed to load competitors");const dt=(Array.isArray(Be?.rows)?Be.rows:[]).map(je=>{const Me=Number(je?.rank),Se=String(je?.name||"").trim();return{rank:Number.isFinite(Me)?Me:0,competitor_id:je?.competitor_id==null?null:Number(je?.competitor_id),name:Se,website:je?.website?String(je.website).trim():null,is_main_brand:!!je?.is_main_brand,logo_url:je?.logo_url?String(je.logo_url).trim():null,visibility:_c(je?.visibility),avg_position:_c(je?.avg_position),mentions:Math.max(0,Number(je?.mentions)||0)}}).filter(je=>!!je?.name).sort((je,Me)=>(je.rank||9999)-(Me.rank||9999));if(_e)return;H(dt)}catch(ie){if(_e)return;H([]),F(ie?.message||"Failed to load competitors")}finally{if(_e)return;M(!1)}}})(),()=>{_e=!0}},[n,i,r,o,s,a.join(",")]),l.useEffect(()=>{let _e=!1;return(async()=>{const we=Number(n),Ke=Number(i),ce=Number(r);
11318if(!(!we||!Ke||!ce)){X(!0),K(null);try{const ie=new URLSearchParams;ie.set("start",o),ie.set("end",s),ie.set("page",String(c)),ie.set("per_page",String(u)),a.length>0&&ie.set("models",a.join(","));const Re=await ue(`/api/v1/organizations/${we}/projects/${Ke}/prompts/${ce}/citations?${ie.toString()}`,{method:"GET"}),Be=await zw(Re);if(!Re.ok)throw new Error(Be?.error||Be?.errors?.[0]||"Failed to load citations");const dt=(Array.isArray(Be?.rows)?Be.rows:[]).map(Se=>({domain:String(Se?.domain||"").trim(),page:String(Se?.page||"").trim(),url:String(Se?.url||"").trim(),frequency:Math.max(0,Number(Se?.frequency)||0),model_keys:Array.isArray(Se?.model_keys)?Se.model_keys.map(it=>String(it).trim()).filter(Boolean):[],model_frequencies:Se?.model_frequencies&&typeof Se.model_frequencies=="object"?Se.model_frequencies:void 0})).filter(Se=>!!Se?.url),je=Be?.pagination,Me={page:Math.max(1,Number(je?.page)||c),per_page:Math.max(1,Number(je?.per_page)||u),total:Math.max(0,Number(je?.total)||0),total_pages:Math.max(0,Number(je?.total_pages)||0)};if(_e)return;L(dt),W(Me)}catch(ie){if(_e)return;L([]),W({page:c,per_page:u,total:0,total_pages:0}),K(ie?.message||"Failed to load citations")}finally{if(_e)return;X(!1)}}})(),()=>{_e=!0}},[n,i,r,o,s,a.join(","),c]),l.useEffect(()=>{let _e=!1;return(async()=>{const we=Number(n),Ke=Number(i),ce=Number(r);
11318if(!(!we||!Ke||!ce)){se(!0),le(null);try{const ie=new URLSearchParams;ie.set("start",o),ie.set("end",s),ie.set("page",String(m)),ie.set("per_page",String(h)),a.length>0&&ie.set("models",a.join(","));const Re=await ue(`/api/v1/organizations/${we}/projects/${Ke}/prompts/${ce}/responses?${ie.toString()}`,{method:"GET"}),Be=await zw(Re);if(!Re.ok)throw new Error(Be?.error||Be?.errors?.[0]||"Failed to load responses");const dt=(Array.isArray(Be?.rows)?Be.rows:[]).map(Se=>{const it=Array.isArray(Se?.citations)?Se.citations:[];return{id:Number(Se?.id),model_key:String(Se?.model_key||"").trim(),status:String(Se?.status||"").trim().toLowerCase(),finished_at:Se?.finished_at?String(Se.finished_at):null,position:_c(Se?.position),brand_present:!!Se?.brand_present,sentiment_score:_c(Se?.sentiment_score),response_text:typeof Se?.response_text=="string"?Se.response_text:null,citations_count:Math.max(0,Number(Se?.citations_count)||0),citations:it.map(De=>({domain:String(De?.domain||"").trim(),url:String(De?.url||"").trim()})).filter(De=>!!De?.domain&&!!De?.url)}}).filter(Se=>Number.isFinite(Se.id)&&Se.id>0&&Se.model_key),je=Be?.pagination,Me={page:Math.max(1,Number(je?.page)||m),per_page:Math.max(1,Number(je?.per_page)||h),total:Math.max(0,Number(je?.total)||0),total_pages:Math.max(0,Number(je?.total_pages)||0)};if(_e)return;ee(dt),Ae(Me)}catch(ie){if(_e)return;ee([]),le(ie?.message||"Failed to load responses"),Ae({page:m,per_page:h,total:0,total_pages:0})}finally{if(_e)return;se(!1)}}})(),()=>{_e=!0}},[n,i,r,o,s,a.join(","),m]),{prompt:{loading:x,error:w,data:v},competitorsTrend:{loading:$,error:P,competitors:E,points:I},competitors:{loading:T,error:R,rows:Y},citations:{loading:U,error:Q,rows:G,pagination:q},responses:{loading:oe,error:de,rows:me,pagination:ne}}}const Pot=p.div.withConfig({displayName:"ResponseModal__MetaRow",componentId:"sc-1f3plni-0"})` 11319 display: flex; 11320 flex-wrap: wrap; 11321 gap: 10px; 11322 color: ${z}; 11323 font-weight: 800; 11324 font-size: 12px; 11325`,Aot=p.div.withConfig({displayName:"ResponseModal__LegendRow",componentId:"sc-1f3plni-1"})` 11326 display: flex; 11327 align-items: center; 11328 gap: 10px; 11329 flex-wrap: wrap; 11330 color: ${z}; 11331 font-weight: 800; 11332 font-size: 12px; 11333`,Not=p.span.withConfig({displayName:"ResponseModal__LegendLabel",componentId:"sc-1f3plni-2"})` 11334 font-weight: 900; 11335`,zot=p.span.withConfig({displayName:"ResponseModal__DividerDot",componentId:"sc-1f3plni-3"})` 11336 opacity: 0.7; 11337`,U6=p.span.withConfig({displayName:"ResponseModal__BrandHighlight",componentId:"sc-1f3plni-4"})` 11338 display: inline; 11339 padding: 0.05em 0.32em; 11340 border-radius: 0.45em; 11341 font-weight: 900; 11342 line-height: 1.2; 11343 white-space: nowrap; 11344 11345 /* Fallback (no color-mix): keep it theme-safe with tokens */ 11346 border: 1px solid ${e=>e.$tone==="main"?Ft:Rt}; 11347 background: ${e=>e.$tone==="main"?"rgba(79,70,229,0.10)":"rgba(148,163,184,0.18)"}; 11348 box-shadow: ${e=>e.$tone==="main"?`0 0 0 2px ${En}`:"none"}; 11349 11350 /* Enhanced styling when supported */ 11351 @supports (background: color-mix(in srgb, white 50%, black)) { 11352 border-color: ${e=>e.$tone==="main"?`color-mix(in srgb, ${Ft} 75%, transparent)`:`color-mix(in srgb, ${Rt} 75%, transparent)`}; 11353 background: ${e=>e.$tone==="main"?`color-mix(in srgb, ${Ft} 28%, transparent)`:`color-mix(in srgb, ${Rt} 22%, transparent)`}; 11354 } 11355`;function s$(e){return Array.from(new Set(e.map(n=>n.trim()).filter(Boolean)))}function Tot(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Eot(e){const n=String(e||"").trim();if(!n)return null;const i=/[A-Za-z0-9]/.test(n[0]||""),r=/[A-Za-z0-9]/.test(n[n.length-1]||""),o=Tot(n).replace(/\s+/g,"\\s+"),s=i?"(^|[^A-Za-z0-9])":"(^|)",a=r?"(?=$|[^A-Za-z0-9])":"";return new RegExp(`${s}(${o})${a}`,"gi")}function Mot({isOpen:e,response:n,onClose:i,allModelOptions:r,brands:o}){const s=n?`Response #${n.id}`:"Response",a=l.useMemo(()=>n?r.find(h=>h.key===String(n.model_key||""))?.label||String(n.model_key||""):"â",[r,n]),c=l.useMemo(()=>{const h=String(o.main||"").trim(),g=s$(o.mainAliases||[]),x=s$(o.others||[]),y=s$([h,...g,...x]).filter(Boolean),w=new Set(s$([h,...g]).map(v=>v.toLowerCase()));return y.sort((v,_)=>_.length-v.length).map(v=>{const _=Eot(v);
11355if(!_)return null;const $=w.has(v.toLowerCase());return{re:_,tone:$?"main":"other",name:v}}).filter(Boolean)},[o.main,o.mainAliases,o.others]),u=h=>{if(!h||c.length===0)return h;const g=[];for(const j of c){const v=j.re;let _;for(;_=v.exec(h);){const $=_[1]||"",k=_[2]||"";if(!k||$==="."&&/^[A-Za-z]{2}$/.test(k))continue;const P=_.index+$.length,S=P+k.length;S<=P||g.push({start:P,end:S,tone:j.tone})}}if(g.length===0)return h;g.sort((j,v)=>j.start!==v.start?j.start-v.start:v.end-v.start-(j.end-j.start));const x=[];let y=0,w=0;for(const j of g)j.start<y||(j.start>y&&x.push(h.slice(y,j.start)),x.push(t.jsx(U6,{$tone:j.tone,children:h.slice(j.start,j.end)},`bh-${w++}-${j.start}`)),y=j.end);return y<h.length&&x.push(h.slice(y)),t.jsx(t.Fragment,{children:x})},m=h=>typeof h=="string"?u(h):typeof h=="number"||typeof h=="boolean"||h==null?h:Array.isArray(h)?h.map(g=>m(g)):h;return t.jsx(Hn,{isOpen:e,onClose:i,title:s,size:"lg",children:t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[n?t.jsxs(Pot,{children:[t.jsxs("span",{children:["Model: ",a]}),t.jsx("span",{children:"â¢"}),t.jsxs("span",{children:["Position: ",typeof n.position=="number"?n.position:"â"]}),t.jsx("span",{children:"â¢"}),t.jsxs("span",{children:["Mentions: ",n.brand_present?"Yes":"No"]}),t.jsx("span",{children:"â¢"}),t.jsxs("span",{children:["Citations: ",Number(n.citations_count||0)]})]}):null,(o.main||(o.others||[]).length>0)&&t.jsxs(Aot,{children:[t.jsx(Not,{children:"Legend:"}),t.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[t.jsx(U6,{$tone:"main",children:o.main||"You"}),t.jsx("span",{children:"(you)"})]}),t.jsx(zot,{children:"â¢"}),t.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[t.jsx(U6,{$tone:"other",children:"Competitor"}),t.jsx("span",{children:"(others)"})]})]}),t.jsx(X5,{wrap:"card",markdown:String(n?.response_text||""),transformChildren:m,empty:t.jsx("span",{style:{color:z,fontWeight:800},children:"No response text available."})})]})})}const Rot=p.div.withConfig({displayName:"ProjectPromptPage__Page",componentId:"sc-1rdd762-0"})` 11356 padding: 1.25rem; 11357`,Oot=p.div.withConfig({displayName:"ProjectPromptPage__HeroTop",componentId:"sc-1rdd762-1"})` 11358 display: flex; 11359 align-items: flex-start; 11360 justify-content: space-between; 11361 gap: 1.25rem; 11362 flex-wrap: wrap; 11363`,Dot=p.div.withConfig({displayName:"ProjectPromptPage__HeroMiddle",componentId:"sc-1rdd762-2"})` 11364 display: flex; 11365 align-items: flex-end; 11366 justify-content: flex-start; 11367 flex: 1 1 520px; 11368 min-width: min(520px, 100%); 11369 padding-top: 0.5rem; 11370`,Lot=p.div.withConfig({displayName:"ProjectPromptPage__HeroFilters",componentId:"sc-1rdd762-3"})` 11371 display: flex; 11372 align-items: center; 11373 justify-content: flex-start; 11374 gap: 0.75rem; 11375 flex-wrap: wrap; 11376`,Sde=p.div.withConfig({displayName:"ProjectPromptPage__Card",componentId:"sc-1rdd762-4"})` 11377 border: 1px solid ${V}; 11378 background: ${Z}; 11379 border-radius: 0.875rem; 11380 padding: 1rem; 11381 min-width: 0; 11382`,Bot=p(Sde).withConfig({displayName:"ProjectPromptPage__InfoCard",componentId:"sc-1rdd762-5"})` 11383 /* Keep this section compact (it used to share space with the pie chart). */ 11384 padding: 0.75rem; 11385`,Fot=p.div.withConfig({displayName:"ProjectPromptPage__InfoGrid",componentId:"sc-1rdd762-6"})` 11386 margin-top: 1rem; 11387 display: grid; 11388 grid-template-columns: 1fr; 11389 gap: 0.75rem; 11390`,Wot=p.div.withConfig({displayName:"ProjectPromptPage__InfoTitle",componentId:"sc-1rdd762-7"})` 11391 font-size: 0.75rem; 11392 font-weight: 900; 11393 color: ${z}; 11394 text-transform: uppercase; 11395 letter-spacing: 0.06em; 11396`,Uot=p.div.withConfig({displayName:"ProjectPromptPage__PromptText",componentId:"sc-1rdd762-8"})` 11397 margin-top: 0.25rem; 11398 font-size: 1.05rem; 11399 font-weight: 900; 11400 color: ${O}; 11401 line-height: 1.3; 11402 overflow-wrap: anywhere; 11403`,Hot=p.div.withConfig({displayName:"ProjectPromptPage__PromptInfoSkeleton",componentId:"sc-1rdd762-9"})` 11404 display: flex; 11405 flex-direction: column; 11406 gap: 0.75rem; 11407`,qot=p.div.withConfig({displayName:"ProjectPromptPage__PromptInfoSkeletonChips",componentId:"sc-1rdd762-10"})` 11408 display: flex; 11409 align-items: center; 11410 gap: 0.5rem; 11411 flex-wrap: wrap; 11412`,Got=p.div.withConfig({displayName:"ProjectPromptPage__TopicSubText",componentId:"sc-1rdd762-11"})` 11413 margin-top: 0.25rem; 11414 /* Add a bit more breathing room under the topic line. */ 11415 margin-bottom: 0.4rem; 11416 font-size: 0.85rem; 11417 font-weight: 850; 11418 color: ${z}; 11419 line-height: 1.25;
11420 overflow-wrap: anywhere; 11421`,Vot=p.div.withConfig({displayName:"ProjectPromptPage__ChipsRow",componentId:"sc-1rdd762-12"})` 11422 margin-top: 1rem; 11423 display: flex; 11424 flex-wrap: wrap; 11425 gap: 0.45rem; 11426`,a$=p.span.withConfig({displayName:"ProjectPromptPage__Chip",componentId:"sc-1rdd762-13"})` 11427 display: inline-flex; 11428 align-items: center; 11429 gap: 0.4rem; 11430 padding: 0.28rem 0.6rem; 11431 border-radius: 999px; 11432 font-size: 0.75rem; 11433 font-weight: 900; 11434 border: 1px solid ${V}; 11435 background: ${$e}; 11436 color: ${O}; 11437 11438 ${e=>e.$tone==="success"?` 11439 border-color: rgba(34,197,94,0.25); 11440 background: rgba(34,197,94,0.10); 11441 `:""} 11442`,WK=p.div.withConfig({displayName:"ProjectPromptPage__MetaGrid",componentId:"sc-1rdd762-14"})` 11443 margin-top: 0.45rem; 11444 display: flex; 11445 flex-wrap: wrap; 11446 gap: 0.75rem; 11447`,UK=p.div.withConfig({displayName:"ProjectPromptPage__MetaItem",componentId:"sc-1rdd762-15"})` 11448 display: flex; 11449 align-items: baseline; 11450 justify-content: space-between; 11451 gap: 0.75rem; 11452`,HK=p.div.withConfig({displayName:"ProjectPromptPage__MetaLabel",componentId:"sc-1rdd762-16"})` 11453 font-size: 0.75rem; 11454 font-weight: 800; 11455 color: ${z}; 11456`,qK=p.div.withConfig({displayName:"ProjectPromptPage__MetaValue",componentId:"sc-1rdd762-17"})` 11457 font-size: 0.75rem; 11458 font-weight: 900; 11459 color: ${O}; 11460 text-align: right; 11461`,GK=p.div.withConfig({displayName:"ProjectPromptPage__StatsGrid",componentId:"sc-1rdd762-18"})` 11462 margin-top: 0.6rem; 11463 display: grid; 11464 grid-template-columns: 1fr 1fr; 11465 gap: 0.6rem 0.75rem; 11466 11467 @media (min-width: 900px) { 11468 grid-template-columns: repeat(4, minmax(0, 1fr)); 11469 } 11470`,Tw=p.div.withConfig({displayName:"ProjectPromptPage__StatCard",componentId:"sc-1rdd762-19"})` 11471 border: 0; 11472 background: transparent; 11473 border-radius: 0; 11474 padding: 0; 11475 min-width: 0; 11476`,l$=p.div.withConfig({displayName:"ProjectPromptPage__StatLabel",componentId:"sc-1rdd762-20"})` 11477 font-size: 0.7rem; 11478 font-weight: 900; 11479 color: ${z}; 11480 text-transform: uppercase; 11481 letter-spacing: 0.06em; 11482`,Ew=p.div.withConfig({displayName:"ProjectPromptPage__StatLabelRow",componentId:"sc-1rdd762-21"})` 11483 display: inline-flex; 11484 align-items: center; 11485 gap: 6px; 11486`,c$=p.div.withConfig({displayName:"ProjectPromptPage__StatValue",componentId:"sc-1rdd762-22"})` 11487 margin-top: 0.2rem; 11488 font-size: 0.95rem; 11489 font-weight: 950; 11490 color: ${O}; 11491 line-height: 1.15; 11492`,Kot=p.div.withConfig({displayName:"ProjectPromptPage__DashboardGrid",componentId:"sc-1rdd762-23"})` 11493 margin-top: 1rem; 11494 display: grid; 11495 grid-template-columns: 1fr; 11496 gap: 1rem; 11497 min-height: 0; 11498 11499 @media (min-width: 1024px) { 11500 grid-template-columns: 1fr 1fr; 11501 align-items: stretch; 11502 } 11503`,g8=p(Sde).withConfig({displayName:"ProjectPromptPage__ChartCard",componentId:"sc-1rdd762-24"})` 11504 display: flex; 11505 flex-direction: column; 11506 min-height: 0; 11507`,VK=p(g8).withConfig({displayName:"ProjectPromptPage__HalfRowCard",componentId:"sc-1rdd762-25"})` 11508 /* Make the top row (graph + competitors) more compact. */ 11509 height: clamp(480px, 60vh, 820px); 11510 11511 /* Mobile/tablet: still keep a consistent height, just a bit smaller. */ 11512 @media (max-width: 1023px) { 11513 height: clamp(450px, 62vh, 740px); 11514 } 11515`,d$=p.div.withConfig({displayName:"ProjectPromptPage__CardHeader",componentId:"sc-1rdd762-26"})` 11516 display: flex; 11517 align-items: flex-start; 11518 justify-content: space-between; 11519 gap: 0.75rem; 11520`,Yot=p.div.withConfig({displayName:"ProjectPromptPage__HeaderKpi",componentId:"sc-1rdd762-27"})` 11521 display: inline-flex; 11522 align-items: center; 11523 gap: 0.5rem; 11524 white-space: nowrap; 11525 padding-top: 2px; 11526`,Xot=p.div.withConfig({displayName:"ProjectPromptPage__HeaderKpiLabel",componentId:"sc-1rdd762-28"})` 11527 font-size: 0.7rem; 11528 font-weight: 900; 11529 color: ${z}; 11530 text-transform: uppercase; 11531 letter-spacing: 0.06em; 11532`,Qot=p.div.withConfig({displayName:"ProjectPromptPage__HeaderKpiValue",componentId:"sc-1rdd762-29"})` 11533 font-size: 1rem; 11534 font-weight: 950; 11535 color: ${O}; 11536 line-height: 1.1; 11537`,KK=p.span.withConfig({displayName:"ProjectPromptPage__TrendPill",componentId:"sc-1rdd762-30"})` 11538 display: inline-flex; 11539 align-items: center; 11540 gap: 0.25rem; 11541 padding: 0.18rem 0.38rem; 11542 border-radius: 999px; 11543 font-size: 0.7rem; 11544 font-weight: 900; 11545 line-height: 1; 11546 border: 1px solid ${V}; 11547 color: ${z}; 11548 background: ${$e}; 11549 11550 ${e=>e.$positive?` 11551 color: rgba(21,128,61,1); 11552 background: rgba(34,197,94,0.12); 11553 border-color: rgba(34,197,94,0.25); 11554 `:""} 11555 11556 ${e=>e.$neutral?` 11557 color: ${z}; 11558 `:""} 11559`,u$=p.div.withConfig({displayName:"ProjectPromptPage__CardTitleRow",componentId:"sc-1rdd762-31"})` 11560 display: inline-flex; 11561 align-items: center; 11562 gap: 0.5rem; 11563 min-width: 0; 11564`,p$=p.div.withConfig({displayName:"ProjectPromptPage__CardTitle",componentId:"sc-1rdd762-32"})` 11565 font-size: 1.2rem; 11566 font-weight: 900; 11567 color: ${O}; 11568 line-height: 1.15; 11569`,m$=p.span.withConfig({displayName:"ProjectPromptPage__TitleInfoIcon",componentId:"sc-1rdd762-33"})` 11570 display: inline-flex; 11571 align-items: center; 11572 justify-content: center; 11573 line-height: 1; 11574`,h$=p.div.withConfig({displayName:"ProjectPromptPage__ChartWrap",componentId:"sc-1rdd762-34"})` 11575 margin-top: 0.75rem; 11576 border: 1px solid ${V}; 11577 background: ${Z}; 11578 border-radius: 0.75rem; 11579 // padding: 0.75rem; 11580 flex: 1; 11581 min-height: 0; 11582 display: flex; 11583 flex-direction: column; 11584 overflow-x: hidden; /* prevent a second (full-width) horizontal scrollbar */ 11585`,Zot=p.div.withConfig({displayName:"ProjectPromptPage__ChartPlotWrap",componentId:"sc-1rdd762-35"})` 11586 width: 100%; 11587 min-width: 0; 11588 flex: 1 1 auto; 11589 min-height: 0; 11590 overflow: hidden; /* ensure the chart never forces overflow */ 11591`,H6=p.div.withConfig({displayName:"ProjectPromptPage__TableScrollX",componentId:"sc-1rdd762-36"})` 11592 width: 100%; 11593 min-width: 0; 11594`,YK=p.div.withConfig({displayName:"ProjectPromptPage__TableScrollY",componentId:"sc-1rdd762-37"})` 11595 width: 100%; 11596 min-width: 0; 11597 min-height: 0; 11598 11599 /* Roughly ~10 table rows visible, then scroll. */ 11600 max-height: clamp(20rem, 44vh, 26rem); 11601 overflow-y: auto; 11602 11603 /* Mobile: use a single scroll container for both axes (helps sticky headers on iOS). */ 11604 @media (max-width: 720px) { 11605 overflow-x: auto; 11606 } 11607`,Jot=p.div.withConfig({displayName:"ProjectPromptPage__TableScrollFillY",componentId:"sc-1rdd762-38"})` 11608 width: 100%; 11609 min-width: 0; 11610 min-height: 0; 11611 flex: 1; 11612 overflow-y: auto; 11613 11614 /* Mobile: use a single scroll container for both axes (helps sticky headers on iOS). */ 11615 @media (max-width: 720px) { 11616 overflow-x: auto; 11617 } 11618`,q6=p.div.withConfig({displayName:"ProjectPromptPage__MobileMinTable",componentId:"sc-1rdd762-39"})` 11619 width: 100%; 11620 11621 @media (max-width: 720px) { 11622 min-width: 720px; 11623 } 11624`,XK=p.div.withConfig({displayName:"ProjectPromptPage__NameCell",componentId:"sc-1rdd762-40"})` 11625 display: inline-flex; 11626 align-items: center; 11627 gap: 0.5rem; 11628 min-width: 0; 11629`,est=p.span.withConfig({displayName:"ProjectPromptPage__ModelDot",componentId:"sc-1rdd762-41"})` 11630 width: 0.65rem; 11631 height: 0.65rem; 11632 border-radius: 999px; 11633 background: ${e=>e.$color}; 11634 border: 1px solid ${V}; 11635 flex: 0 0 auto; 11636`,tst=p.span.withConfig({displayName:"ProjectPromptPage__Mono",componentId:"sc-1rdd762-42"})` 11637 font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; 11638 font-size: 0.75rem; 11639 font-weight: 850; 11640`,nst=p.a.withConfig({displayName:"ProjectPromptPage__Anchor",componentId:"sc-1rdd762-43"})` 11641 color: ${O}; 11642 font-weight: 850; 11643 text-decoration: none; 11644 11645 &:hover { 11646 text-decoration: underline; 11647 } 11648`,ist=p(nst).withConfig({displayName:"ProjectPromptPage__PageAnchor",componentId:"sc-1rdd762-44"})` 11649 display: block; 11650 min-width: 0; 11651 overflow: hidden; 11652 text-overflow: ellipsis; 11653 white-space: nowrap; 11654`,rst=p.button.withConfig({displayName:"ProjectPromptPage__ResponseSnippet",componentId:"sc-1rdd762-45"})` 11655 width: 100%; 11656 border: 0; 11657 background: transparent; 11658 padding: 0; 11659 margin: 0; 11660 cursor: pointer; 11661 text-align: left; 11662 min-width: 0; 11663 color: ${O}; 11664 font-weight: 750; 11665 font-size: 0.875rem; 11666 11667 &:hover:not(:disabled) { 11668 text-decoration: underline; 11669 } 11670 11671 &:focus-visible { 11672 outline: none; 11673 box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.12); 11674 border-radius: 0.5rem; 11675 } 11676 11677 &:disabled { 11678 cursor: default; 11679 text-decoration: none; 11680 } 11681`,QK=p.span.withConfig({displayName:"ProjectPromptPage__Trunc",componentId:"sc-1rdd762-46"})` 11682 display: block; 11683 min-width: 0; 11684 overflow: hidden; 11685 text-overflow: ellipsis; 11686 white-space: nowrap; 11687`,ost=p(Dn).withConfig({displayName:"ProjectPromptPage__ActionsCountLink",componentId:"sc-1rdd762-47"})` 11688 display: inline-flex; 11689 align-items: center; 11690 gap: 6px; 11691 color: ${z}; 11692 font-weight: 850; 11693 font-size: 0.75rem; 11694 text-decoration: none; 11695 11696 &:hover { 11697 color: ${O}; 11698 text-decoration: underline; 11699 } 11700 11701 &:focus-visible { 11702 outline: none; 11703 box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.12); 11704 border-radius: 0.5rem; 11705 } 11706`;function ZK(e){const n=new Date(`${e}T00:00:00`);return Number.isNaN(n.getTime())?e:new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric"}).format(n)}function sst(e){const n=String(e||"").trim().toUpperCase();if(!/^[A-Z]{2}$/.test(n))return null;const i=127462,r=65,o=i+(n.charCodeAt(0)-r),s=i+(n.charCodeAt(1)-r);return String.fromCodePoint(o,s)}function ast(e){const{prompt:n,projectName:i,countryLabel:r,selectedModels:o,competitors:s,citations:a,responses:c,dateRange:u}=e,m=[];
11706m.push(`I want to discuss this prompt and understand how to improve its AI visibility. 11707`),i&&m.push(`**Project:** ${i}`),m.push(`**Prompt:** ${n?.content||"Unknown prompt"}`),n?.topic?.name&&m.push(`**Topic:** ${n.topic.name}`),n?.category&&m.push(`**Category:** ${n.category}`),r&&m.push(`**Location:** ${r}`),m.push(`**Date range:** ${u.start} to ${u.end}`),o.length&&m.push(`**Models shown:** ${o.join(", ")}`);const h=[];typeof n?.visibility_score=="number"&&h.push(`Visibility: ${n.visibility_score.toFixed(1)}%`),typeof n?.sentiment_score=="number"&&h.push(`Sentiment: ${n.sentiment_score.toFixed(1)}/10`),typeof n?.total_scans=="number"&&h.push(`Total scans: ${n.total_scans}`),typeof n?.avg_monthly_searches=="number"&&h.push(`Keyword volume: ${n.avg_monthly_searches}`),h.length&&m.push(`**Current metrics:** ${h.join(" · ")}`);const g=s.slice(0,5);g.length&&(m.push(` 11708**Top visibility rows:**`),g.forEach(w=>{const j=w.is_main_brand?`${w.name} (my brand)`:w.name,v=w.visibility==null?"N/A":`${w.visibility.toFixed(1)}%`,_=w.avg_position==null?"N/A":w.avg_position.toFixed(1);m.push(`- ${j}: visibility ${v}, average position ${_}, mentions ${w.mentions}`)}));const x=a.slice(0,5);x.length&&(m.push(` 11709**Top cited domains for this prompt:**`),x.forEach(w=>m.push(`- ${w.domain||w.page}: ${w.frequency} citation${w.frequency===1?"":"s"}`)));const y=c.slice(0,3);return y.length&&(m.push(` 11710**Recent model responses summary:**`),y.forEach(w=>{const j=w.brand_present?"brand mentioned":"brand absent",v=w.position==null?"no position":`position ${w.position}`;m.push(`- ${w.model_key}: ${j}, ${v}, ${w.citations_count} citation${w.citations_count===1?"":"s"}`)})),m.push(` 11711Help me understand what is driving this prompt's performance and what I should do next.`),m.join(` 11712`)}function lst(e){const n=String(e?.content||"Prompt").trim();return`Prompt: ${n.length>60?`${n.slice(0,57)}â¦`:n}`}function cst(){const{workspaceId:e,projectId:n,promptId:i}=Gn(),{projects:r}=Mr(),{user:o}=yn(),{subscribe:s}=wo(),a=l.useRef(null),c=l.useRef(null),u=l.useRef(null),m=l.useMemo(()=>{const te=Number(n);return r.find(ge=>ge.id===te)||null},[n,r]),h=`/workspaces/${e}/projects/${n}`,g=`${h}/prompts`,x=l.useMemo(()=>String(m?.language||"").trim(),[m?.language]),{allModelOptions:y,enabledModelKeys:w,modelByKey:j}=eC(),v=kot(),[_,$]=l.useState(1);l.useEffect(()=>{$(1)},[v.dateRange.start,v.dateRange.end,v.models.join(",")]);const[k,P]=l.useState(1);l.useEffect(()=>{P(1)},[v.dateRange.start,v.dateRange.end,v.models.join(",")]);const S=Number(e),I=Number(n),A=Number(i),[E,B]=l.useState(0),T=l.useMemo(()=>S&&o?.organizations?.find(te=>Number(te.id)===Number(S))?.role||null,[S,o?.organizations]),M=l.useMemo(()=>{if(!S)return null;const te=o?.organizations?.find(ge=>Number(ge.id)===Number(S))?.data_history_months;return te==null?null:Number(te)},[S,o?.organizations]),[R,F]=l.useState(!1),Y=l.useMemo(()=>M?T==="owner"?t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:()=>F(!0),style:{color:"inherit",fontWeight:850,textDecoration:"underline",background:"none",border:"none",padding:0,font:"inherit",cursor:"pointer"},children:"Upgrade your plan"})," to access older history."]}):"Ask your workspace owner to upgrade the plan.":null,[M,T]),H=MA(S,I);l.useEffect(()=>{!S||!I||H.loading||H.data||H.error||H.ensure()},[S,I,H]);const U=Iot({organizationId:S,projectId:I,promptId:A,start:v.dateRange.start,end:v.dateRange.end,models:v.models,citationsPage:_,responsesPage:k,refreshKey:E}),X=l.useMemo(()=>U.prompt.data?.has_any_prompt_runs===!1,[U.prompt.data?.has_any_prompt_runs]);l.useEffect(()=>{const te=Number(n),ge=Number(i);if(!Number.isFinite(te)||te<=0||!Number.isFinite(ge)||ge<=0)return;try{a.current?.unsubscribe?.()}catch{}a.current=null;const Je=s({channel:"ProjectPromptChannel",project_id:te,prompt_id:ge},{received:Ee=>{if(!Ee)return;String(Ee?.type||"")==="prompt_actions_created"&&B(Date.now())}})||null;return a.current=Je,()=>{try{a.current?.unsubscribe?.()}catch{}a.current=null}},[n,i,s]),l.useEffect(()=>{const te=Number(n),ge=Number(i);if(!Number.isFinite(te)||te<=0||!Number.isFinite(ge)||ge<=0)return;try{c.current?.unsubscribe?.()}catch{}c.current=null;const Je=s({channel:"ProjectPromptsChannel",project_id:te},{received:Ee=>{Ee?.type==="prompt_finished"&&Number(Ee?.project_id)===te&&Number(Ee?.prompt_id)===ge&&(u.current&&window.clearTimeout(u.current),u.current=window.setTimeout(()=>{u.current=null,B(Date.now())},650))}})||null;return c.current=Je,()=>{u.current&&(window.clearTimeout(u.current),u.current=null);try{c.current?.unsubscribe?.()}catch{}c.current=null}},[n,i,s]);const Q=l.useMemo(()=>{const te=String(U.prompt.data?.city_override||"").trim(),ge=String(m?.city||"").trim(),Je=te||ge,Ee=String(U.prompt.data?.country_override||"").trim(),Xe=String(m?.country||"").trim(),yt=Ee||Xe,Ne=String(U.prompt.data?.country_code_override||"").trim().toUpperCase(),Le=String(m?.country_code||"").trim().toUpperCase();return{city:Je,name:yt,code:Ne||Le}},[U.prompt.data?.city_override,U.prompt.data?.country_code_override,U.prompt.data?.country_override,m]),K=l.useMemo(()=>{const te=U.competitorsTrend.points||[];return te.length===0?[]:te.map(ge=>{const Je={date:ge.date};
11712return(U.competitorsTrend.competitors||[]).forEach(Xe=>{const yt=String(Xe?.key||"");if(!yt)return;const Ne=ge?.totals?.[yt];typeof Ne=="number"&&(Je[yt]=Ne)}),Je})},[U.competitorsTrend.competitors,U.competitorsTrend.points]),G=l.useMemo(()=>(U.competitorsTrend.competitors||[]).map(ge=>({key:String(ge?.key||"").trim(),name:String(ge?.name||"").trim(),is_main_brand:!!ge?.is_main_brand,website:ge?.website?String(ge.website).trim():null,logo_url:ge?.logo_url?String(ge.logo_url).trim():null})).filter(ge=>!!ge?.key&&!!ge?.name),[U.competitorsTrend.competitors]),L=l.useMemo(()=>G.length===0?!1:(K||[]).some(te=>Object.keys(te||{}).some(ge=>ge!=="date")),[K,G]),q=l.useMemo(()=>NM(v.dateRange),[v.dateRange]),W=l.useMemo(()=>!q&&(K||[]).length===1,[q,K]),oe=l.useCallback(te=>te?G.map((ge,Je)=>{const Ee=te?.[ge.key];return{label:ge.is_main_brand?`${ge.name} (you)`:ge.name,value:typeof Ee=="number"?`${Number(Ee).toFixed(2)}%`:"â",color:ne(Je)}}):[],[G]),se=l.useMemo(()=>{if(!q&&!W)return[];const te=q&&K.find(ge=>String(ge?.date||"").slice(0,10)===String(v.dateRange.start||"").slice(0,10))||K[0];return oe(te)},[K,v.dateRange.start,q,W,oe]),de=l.useMemo(()=>{const te=Je=>String(Je||"").trim().toLowerCase(),ge=new Map;return G.forEach(Je=>{const Ee=te(Je.name);Ee&&ge.set(Ee,Je.key)}),ge},[G]),le=l.useMemo(()=>{const ge=(U.competitorsTrend.points||[]).filter(yt=>Number(yt?.denominator||0)>0),Je=ge[0],Ee=ge[ge.length-1],Xe=new Map;return G.forEach(yt=>{const Ne=yt.key;if(!Je||!Ee){Xe.set(Ne,{vis_pp:null,mentions_pct:null,pos_delta:null});return}const Le=Je?.totals?.[Ne],Ue=Ee?.totals?.[Ne],We=typeof Le=="number"&&typeof Ue=="number"?Ue-Le:null,Qe=typeof Je?.mentions?.[Ne]=="number"?Je.mentions[Ne]:0,ht=typeof Ee?.mentions?.[Ne]=="number"?Ee.mentions[Ne]:0,pe=Qe>0?100*(ht-Qe)/Qe:null,be=Je?.avg_positions?.[Ne],rt=Ee?.avg_positions?.[Ne],ze=typeof be=="number"&&typeof rt=="number"?rt-be:null;Xe.set(Ne,{vis_pp:We===null?null:Number(We.toFixed(2)),mentions_pct:pe===null?null:Number(pe.toFixed(1)),pos_delta:ze===null?null:Number(ze.toFixed(2))})}),Xe},[G,U.competitorsTrend.points]),me=(te,ge,Je=!0,Ee="%")=>{if(typeof te!="number"||!Number.isFinite(te))return t.jsx(KK,{$neutral:!0,children:"â"});const Xe=Je?te>=0:te<=0;return t.jsxs(KK,{$positive:Xe,children:[Xe?t.jsx(qi,{size:11}):t.jsx(ul,{size:11}),te>=0?"+":"",te.toFixed(ge),Ee]})},ee=l.useMemo(()=>{const te=U.competitorsTrend.points||[],ge=new Map;return te.forEach(Je=>{Je?.date&&ge.set(String(Je.date),Je)}),ge},[U.competitorsTrend.points]);function ne(te){const ge=[Ft,"rgba(59,130,246,0.75)","rgba(16,185,129,0.75)","rgba(168,85,247,0.65)","rgba(245,158,11,0.75)","rgba(239,68,68,0.70)","rgba(107,114,128,0.85)"];return ge[Math.abs(te)%ge.length]}const Ae=te=>te.is_main_brand?{name:te.name,website:te.website??m?.website,logo_url:te.logo_url??m?.logo_url}:{name:te.name,website:te.website??null,logo_url:te.logo_url??null},[_e,we]=l.useState(null),[Ke,ce]=l.useState(null),ie=_e||Ke,Re=l.useMemo(()=>G.map((te,ge)=>({key:te.key,label:te.is_main_brand?`${te.name} (you)`:te.name,logoRecord:Ae(te),color:ne(ge)})),[G,m]),Be=l.useMemo(()=>U.competitors.rows||[],[U.competitors.rows]),tt=l.useMemo(()=>{const te=Be.find(ge=>!!ge.is_main_brand)||null;return typeof te?.visibility=="number"?te.visibility:null},[Be]),dt=l.useMemo(()=>U.citations.rows||[],[U.citations.rows]),je=l.useMemo(()=>U.responses.rows||[],[U.responses.rows]),Me=l.useMemo(()=>{if(!U.prompt.data)return"";const te=Q.name||Q.code||x||"";return ast({prompt:U.prompt.data,projectName:m?.name,countryLabel:te,selectedModels:v.models,competitors:Be,citations:dt,responses:je,dateRange:v.dateRange})},[U.prompt.data,m?.name,Q.name,Q.code,x,v.models,v.dateRange,Be,dt,je]),[Se,it]=l.useState(null),De=l.useMemo(()=>{const te=m?.name??Be.find(Ue=>!!Ue.is_main_brand)?.name??"",ge=String(te||"").trim(),Je=Array.isArray(m?.brand_aliases)?m.brand_aliases.map(Ue=>String(Ue||"").trim()).filter(Boolean):[],Ee=[];(H.direct||[]).forEach(Ue=>{const We=String(Ue?.name||"").trim();We&&Ee.push(We),(Array.isArray(Ue?.aliases)?Ue.aliases:[]).forEach(ht=>{const pe=String(ht||"").trim();pe&&Ee.push(pe)})});const Xe=Ue=>Array.from(new Set(Ue.map(We=>
11712We.trim()).filter(Boolean))),yt=Xe(Ee),Ne=new Set(Xe([ge,...Je]).map(Ue=>Ue.toLowerCase())),Le=yt.filter(Ue=>!Ne.has(String(Ue).toLowerCase()));return{main:ge,mainAliases:Xe(Je),others:Le,all:Xe([ge,...Je,...Le])}},[Be,m,H.direct]);return t.jsxs(Rot,{children:[t.jsxs(Oot,{children:[t.jsx(Fy,{title:"Prompt",subtitle:`Prompt ID: ${String(i||"â")}`}),t.jsx(Dot,{children:t.jsxs(Lot,{children:[t.jsx(rh,{value:v.dateRange,onChange:v.setDateRange,historyMonthsLimit:M,historyLimitMessage:Y}),t.jsx(rC,{options:y,value:v.models,onChange:v.setModels,disabled:w.length<=0,onUpgradeClick:()=>F(!0),isOwner:T==="owner",hideUnavailableOptions:!1})]})}),t.jsx("div",{style:{paddingRight:8},children:t.jsx(qr,{items:[{label:"Projects",to:e?`/workspaces/${e}`:void 0},{label:m?.name||"Project",to:e&&n?h:void 0},{label:"Prompts",to:g},{label:"Prompt"}]})})]}),t.jsx(Fot,{children:t.jsxs(Bot,{children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:12},children:[t.jsx(Wot,{children:"Prompt"}),t.jsxs(ost,{to:`${h}/actions/prompt/${A}`,children:[t.jsx(Lm,{size:13}),typeof U.prompt.data?.prompt_actions_count=="number"?`${U.prompt.data.prompt_actions_count} action${U.prompt.data.prompt_actions_count===1?"":"s"}`:"Actions"," â Manage"]})]}),U.prompt.loading?t.jsxs(Hot,{children:[t.jsxs("div",{children:[t.jsx(nt,{height:14,width:"86%",radius:10}),t.jsx("div",{style:{height:8}}),t.jsx(nt,{height:14,width:"62%",radius:10})]}),t.jsx(nt,{height:12,width:"32%",radius:10}),t.jsxs(qot,{children:[t.jsx(nt,{height:22,width:74,radius:999}),t.jsx(nt,{height:22,width:86,radius:999}),t.jsx(nt,{height:22,width:120,radius:999})]}),t.jsx(WK,{children:t.jsxs(UK,{children:[t.jsx(HK,{children:"Created"}),t.jsx(qK,{children:t.jsx(nt,{height:12,width:140,radius:10})})]})}),t.jsx(GK,{children:Array.from({length:4}).map((te,ge)=>t.jsxs(Tw,{children:[t.jsx(Ew,{children:t.jsx(nt,{height:10,width:86,radius:8})}),t.jsx("div",{style:{height:10}}),t.jsx(nt,{height:18,width:"72%",radius:10})]},ge))})]}):t.jsxs(t.Fragment,{children:[t.jsx(Uot,{children:U.prompt.data?.content||"â"}),U.prompt.data?.topic?.name?t.jsx(Got,{children:String(U.prompt.data.topic.name)}):null,t.jsxs(Vot,{children:[U.prompt.data?.archived_at?t.jsx(a$,{children:"Archived"}):t.jsx(a$,{$tone:"success",children:"Active"}),U.prompt.data?.category?t.jsx(a$,{children:String(U.prompt.data.category)}):null,t.jsx(a$,{children:(()=>{const te=sst(Q.code);if(Q.city){const ge=Q.code||Q.name;return`${te?`${te} `:""}${Q.city}${ge?`, ${ge}`:""}`}return Q.name?`${te?`${te} `:""}${Q.name}`:te&&Q.code?`${te} ${Q.code}`:x?t.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[t.jsx(To,{size:14,style:{color:z}}),x]}):"â"})()})]}),t.jsx(WK,{children:t.jsxs(UK,{children:[t.jsx(HK,{children:"Created"}),t.jsx(qK,{children:t.jsx(rr,{value:U.prompt.data?.created_at?String(U.prompt.data.created_at):null,format:"date",timeZoneMode:"viewer",options:{month:"short",day:"numeric"}})})]})}),t.jsxs(GK,{children:[t.jsxs(t.Fragment,{children:[t.jsxs(Tw,{children:[t.jsxs(Ew,{children:[t.jsx(l$,{children:"Sentiment"}),t.jsx(at,{content:"Average sentiment score of the model responses for this prompt across the selected range and models.",children:t.jsx("span",{style:{display:"inline-flex",color:z},children:t.jsx(wn,{size:14})})})]}),t.jsx(c$,{children:typeof U.prompt.data?.sentiment_score=="number"&&Number.isFinite(U.prompt.data.sentiment_score)?t.jsx(l_,{score:U.prompt.data.sentiment_score}):null})]}),t.jsxs(Tw,{children:[t.jsxs(Ew,{children:[t.jsx(l$,{children:"Keywords volume"}),t.jsx(at,{content:"Estimated search volume in LLMs for this promptâs keywords for the current month. This does not change when you adjust the date range. Refreshed monthly.",children:t.jsx("span",{style:{display:"inline-flex",color:z},children:t.jsx(wn,{size:14})})})]}),t.jsx(c$,{children:t.jsx(S5,{value:U.prompt.data?.avg_monthly_searches??null})})]})]}),t.jsxs(Tw,{children:[t.jsxs(Ew,{children:[t.jsx(l$,{children:"Total scans"}),t.jsx(at,{content:"Number of distinct scans recorded for this prompt across the selected range/models.",children:t.jsx("span",{style:{display:"inline-flex",color:z},children:t.jsx(wn,{size:14})})})]}),t.jsx(c$,{children:typeof U.prompt.data?.total_scans=="number"?U.prompt.data.total_scans.toLocaleStr
11712ing():"â"})]}),t.jsxs(Tw,{children:[t.jsxs(Ew,{children:[t.jsx(l$,{children:"Last scanned"}),t.jsx(at,{content:"Timestamp of the most recent scan for this prompt across the selected range/models.",children:t.jsx("span",{style:{display:"inline-flex",color:z},children:t.jsx(wn,{size:14})})})]}),t.jsx(c$,{children:t.jsx(rr,{value:U.prompt.data?.last_scanned_at?String(U.prompt.data.last_scanned_at):null,format:"datetime",showTimeZone:!0,timeZoneMode:"viewer"})})]})]})]})]})}),U.prompt.data&&Me?t.jsx(EC,{orgId:S,projectId:I,sessionTitle:lst(U.prompt.data),initialMessage:Me,metadata:{resource_type:"prompt",resource_id:U.prompt.data.id},placeholder:"Ask about this promptâ¦",variant:"overlay",launcher:"floating"}):null,t.jsxs(Kot,{children:[t.jsxs(VK,{children:[t.jsxs(d$,{children:[t.jsx("div",{style:{minWidth:0},children:t.jsxs(u$,{children:[t.jsx(p$,{children:"Visibility Trend"}),t.jsx(at,{content:"Visibility score by competitor (brand + direct competitors) across the selected range.",size:"sm",maxWidth:420,children:t.jsx(m$,{style:{color:z},"aria-label":"Info",children:t.jsx(wn,{size:16})})})]})}),t.jsxs(Yot,{children:[t.jsx(Xot,{children:"Avg visibility (you)"}),t.jsx(Qot,{children:typeof tt=="number"?`${tt.toFixed(2)}%`:"â"}),t.jsx(at,{content:"Average visibility of your brand for this prompt over the selected date range and models. This matches the Visibility % shown in the competitor ranking table.",size:"sm",maxWidth:420,children:t.jsx("span",{style:{display:"inline-flex",color:z},"aria-label":"Info",children:t.jsx(wn,{size:14})})})]})]}),t.jsx(h$,{children:U.competitorsTrend.error?t.jsx("div",{style:{width:"100%",flex:1,minWidth:1,minHeight:1,display:"flex",alignItems:"center",justifyContent:"center"},children:t.jsx("span",{style:{color:z,fontWeight:800},children:U.competitorsTrend.error})}):U.competitorsTrend.loading?t.jsx("div",{style:{width:"100%",flex:1,minWidth:1,minHeight:1},children:t.jsx(nt,{width:"100%",height:"100%",radius:14})}):L?q?t.jsx(ky,{title:"Single day view",dayISO:v.dateRange.start,primaryLabel:"Visibility (you)",primaryValue:se.find(te=>te.label.toLowerCase().includes("(you)"))?.value||se[0]?.value||"â",rows:se,hint:"Select multiple days to see a trend."}):W?t.jsx(ky,{title:"First data point",dayISO:K[0]?.date||"",primaryLabel:"Visibility (you)",primaryValue:se.find(te=>te.label.toLowerCase().includes("(you)"))?.value||se[0]?.value||"â",rows:se,hint:"Your next scan will unlock the trend chart."}):t.jsxs("div",{style:{width:"100%",flex:1,minWidth:1,minHeight:1,display:"flex",flexDirection:"column"},children:[t.jsx(Pre,{items:Re,selectedKey:_e,hoverKey:Ke,onSelectedKeyChange:we,onHoverKeyChange:ce}),t.jsx(Zot,{children:t.jsx(Gl,{width:"100%",height:"100%",minWidth:1,minHeight:1,children:t.jsxs(C1,{data:K,margin:{top:6,right:10,left:0,bottom:0},children:[t.jsx(Ql,{dataKey:"date",tick:{fill:z,fontSize:11,fontWeight:700},axisLine:{stroke:V},tickLine:{stroke:V},minTickGap:12,tickFormatter:ZK}),t.jsx(Zl,{domain:[0,100],tick:{fill:z,fontSize:11,fontWeight:700},axisLine:{stroke:V},tickLine:{stroke:V},width:44,tickFormatter:te=>`${Math.round(te)}%`}),t.jsx(Vl,{cursor:{stroke:Pe,strokeWidth:1},content:({active:te,label:ge})=>{if(!te)return null;const Je=String(ge||""),Ee=ee.get(Je),Xe=Ee?.totals&&typeof Ee.totals=="object"?Ee.totals:{},yt=G.map((Ne,Le)=>{const Ue=Xe?.[Ne.key];return{name:Ne.is_main_brand?`${Ne.name} (you)`:Ne.name,value:typeof Ue=="number"?Ue:null,color:ne(Le),rec:Ae(Ne)}});return t.jsxs("div",{style:{background:Z,border:`1px solid ${V}`,borderRadius:12,padding:"0.6rem 0.7rem",boxShadow:"0 18px 40px rgba(17, 24, 39, 0.14)",minWidth:180},children:[t.jsx("div",{style:{fontSize:12,fontWeight:900,color:O},children:ZK(String(ge||""))}),t.jsx("div",{style:{height:6}}),yt.map(Ne=>t.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:10},children:[t.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:8,minWidth:0},children:[t.jsx("span",{style:{width:10,height:10,borderRadius:999,background:Ne.color||Ft}}),t.jsx("span",{style:{display:"inline-flex",alignItems:"center"},children:t.jsx(xo,{record:Ne.rec,size:16})}),t.jsx("div",{style:{fontSize:12,fontWeight:800,color:z,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:Ne.name})]}),t.jsx("div",{style:{fontSize:12,fontWeight:900,color:O},children:typeof Ne.value=="number"?`${Ne.value.toFixed(2)}%`:"â"})]}
11712,Ne.name))]})}}),G.map((te,ge)=>t.jsx(Nd,{type:"monotone",dataKey:te.key,name:te.is_main_brand?`${te.name} (you)`:te.name,stroke:ne(ge),strokeWidth:2.25,dot:!1,connectNulls:!0,activeDot:{r:3.5},strokeOpacity:!ie||ie===te.key?1:.2},te.key))]})})})]}):t.jsx(Sp,{initialCrunching:X,embedded:!0,subtitle:"Try adjusting your date range or filters."})})]}),t.jsxs(VK,{children:[t.jsx(d$,{children:t.jsx("div",{style:{minWidth:0},children:t.jsxs(u$,{children:[t.jsx(p$,{children:"Competitor Ranking"}),t.jsx(at,{content:"Brand + direct competitors in the selected range.",size:"sm",maxWidth:360,children:t.jsx(m$,{style:{color:z},"aria-label":"Info",children:t.jsx(wn,{size:16})})})]})})}),t.jsx(h$,{children:U.competitors.loading?t.jsx($p,{columns:[{width:"3.5rem"},{},{width:"7rem"},{width:"7rem"},{width:"7rem"}],rows:10}):t.jsx(Jot,{children:t.jsx(H6,{children:t.jsx(q6,{children:t.jsxs(nr,{children:[t.jsx(pr,{children:t.jsxs(Cn,{children:[t.jsx(Et,{style:{width:"3.5rem"},children:"Rank"}),t.jsx(Et,{children:"Competitor"}),t.jsx(Et,{style:{width:"7rem"},$align:"right",children:t.jsxs("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"flex-end",gap:6,width:"100%"},children:[t.jsx("span",{children:"Visibility"}),t.jsx(at,{content:"Visibility (%) = 100 * mentions / denominator, where denominator is the number of succeeded prompt-runs in the selected range and models.",size:"sm",maxWidth:420,children:t.jsx("span",{style:{display:"inline-flex",alignItems:"center",color:z},"aria-label":"Visibility info",children:t.jsx(wn,{size:14})})})]})}),t.jsx(Et,{style:{width:"7rem"},$align:"right",children:t.jsxs("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"flex-end",gap:6,width:"100%"},children:[t.jsx("span",{children:"Position"}),t.jsx(at,{content:"Average 1-based position for this competitor within the ranked entity list (brands_mentioned), computed across succeeded prompt-runs where it appears. Lower is better.",size:"sm",maxWidth:420,children:t.jsx("span",{style:{display:"inline-flex",alignItems:"center",color:z},"aria-label":"Average position info",children:t.jsx(wn,{size:14})})})]})}),t.jsx(Et,{style:{width:"7rem"},$align:"right",children:t.jsxs("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"flex-end",gap:6,width:"100%"},children:[t.jsx("span",{children:"Mentions"}),t.jsx(at,{content:"Count of succeeded prompt-runs where this competitor appears in the extracted ranked entities (brands_mentioned) for the selected range and models.",size:"sm",maxWidth:420,children:t.jsx("span",{style:{display:"inline-flex",alignItems:"center",color:z},"aria-label":"Mentions info",children:t.jsx(wn,{size:14})})})]})})]})}),t.jsx(mr,{children:Be.length===0?t.jsx(Cn,{children:t.jsx(bt,{colSpan:5,$muted:!0,children:U.competitors.error?t.jsx("span",{style:{color:z,fontWeight:800},children:U.competitors.error}):t.jsx(Sp,{initialCrunching:X})})}):Be.map(te=>t.jsxs(Cn,{children:[t.jsx(bt,{children:te.rank}),t.jsx(bt,{children:t.jsxs(XK,{children:[t.jsx(xo,{record:te.is_main_brand?{name:te.name,website:te.website??m?.website,logo_url:te.logo_url??m?.logo_url}:{name:te.name,website:te.website,logo_url:te.logo_url},size:28}),t.jsx("span",{style:{fontWeight:900},children:te.name}),te.is_main_brand?t.jsx("span",{style:{marginLeft:8,fontSize:11,fontWeight:900,color:z},children:"(you)"}):null]})}),(()=>{const ge=de.get(String(te.name||"").trim().toLowerCase())||null,Je=ge?le.get(ge):null;return t.jsxs(t.Fragment,{children:[t.jsx(bt,{$align:"right",children:t.jsxs("div",{style:{display:"inline-flex",alignItems:"center",justifyContent:"flex-end",gap:8,width:"100%",whiteSpace:"nowrap"},children:[t.jsx("span",{children:typeof te.visibility=="number"?`${te.visibility.toFixed(2)}%`:"â"}),me(typeof Je?.vis_pp=="number"?Je.vis_pp:null,1,!0)]})}),t.jsx(bt,{$align:"right",children:t.jsxs("div",{style:{display:"inline-flex",alignItems:"center",justifyContent:"flex-end",gap:8,width:"100%",whiteSpace:"nowrap"},children:[t.jsx("span",{children:typeof te.avg_position=="number"?te.avg_position.toFixed(1):"â"}),me(typeof Je?.pos_delta=="number"?Je.pos_delta:null,1,!1,"")]})}),t.jsx(bt,{$align:"right",children:t.jsxs("div",{style:{display:"inline-flex",alignItems:"center",justifyContent:"flex-end",gap:8,width:"100%",whiteSpace:"nowrap"},children:[t.jsx("span",{children:Number(te.mentions||0)}),me(typeof Je?.mentions_pct=="number"?Je.mentions_pct:null,0,!0)]})})]})})()]},`${te.rank}-${te.name}`))})]})})})})})]}),t.jsxs(g8,{style:{gridColumn:"1 / -1"},children:[t.jsx(d$,{children:t.jsx("div",{style:{minWidth:0},children:t.jsxs(u$,{children:[t.jsx(p$,{children:"Citations"}),t.jsx(at,{content:"Top cited pages for this prompt in the selected range.",size:"sm",maxWidth:360,children:t.jsx(m$,{style:{color:z},"aria-label":"Info",children:t.jsx(wn,{size:16})})})]})})}),t.jsxs(h$,{children:[U.citations.loading?t.jsx($p,{columns:[{width:"26%"},{width:"44%"},{width:"18%"},{width:"12%"}],rows:10,minWidth:"720px"}):t.jsx(YK,{children:t.jsx(H6,{children:t.jsx(q6,{children:t.jsxs(nr,{style:{tableLayout:"fixed"},children:[t.jsx(pr,{children:t.jsxs(Cn,{children:[t.jsx(Et,{style:{width:"26%"},children:"Domain"}),t.jsx(Et,{style:{width:"44%"},children:"Page"}),t.jsx(Et,{style:{width:"14%"},children:t.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[t.jsx("span",{children:"Cited"}),t.jsx(at,{content:"Which models cited this page at least once in the selected range.",size:"sm",maxWidth:360,children:t.jsx("span",{style:{display:"inline-flex",color:z},"aria-label":"Info",children:t.jsx(wn,{size:14})})})]})}),t.jsx(Et,{style:{width:"16%"},$align:"right",children:t.jsxs("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"flex-end",gap:6,width:"100%"},children:[t.jsx("span",{children:"Frequency"}),t.jsx(at,{content:"How many times this page was cited across the selected range/models.",size:"sm",maxWidth:340,children:t.jsx("span",{style:{display:"inline-flex",color:z},"aria-label":"Info",children:t.jsx(wn,{size:14})})})]})})]})}),t.jsx(mr,{children:dt.length===0?t.jsx(Cn,{children:t.jsx(bt,{colSpan:4,$muted:!0,children:U.citations.error?t.jsx("span",{style:{color:z,fontWeight:800},children:U.citations.error}):t.jsx(Sp,{initialCrunching:X})})}):dt.map(te=>t.jsxs(Cn,{children:[t.jsx(bt,{children:t.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:8,minWidth:0},children:[t.jsx($u,{domain:te.domain,size:16}),t.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis"},children:te.domain})]})}),t.jsx(bt,{style:{maxWidth:0},children:t.jsx(at,{content:te.page,onlyIfTruncated:!0,size:"sm",maxWidth:720,children:t.jsx(ist,{href:te.url,target:"_blank",rel:"noreferrer",title:te.url,children:t.jsx(tst,{children:te.page})})})}),t.jsx(bt,{children:t.jsx("div",{style:{display:"inline-flex",gap:8,flexWrap:"wrap"},children:(te.model_keys||[]).map(ge=>t.jsx("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:(()=>{const Je=j[ge],Ee=Je?.label||ge,Xe=Je?.Icon;return Xe?t.jsx("span",{title:Ee,"aria-label":Ee,style:{display:"inline-flex"},children:t.jsx(Xe,{})}):null})()},ge))})}),t.jsx(bt,{$align:"right",children:Number(te.frequency||0)})]},`${te.domain}-${te.url}`))})]})})})}),t.jsx("div",{style:{marginTop:10},children:t.jsx(pi,{page:Math.min(Math.max(1,U.citations.pagination?.page||_),Math.max(1,U.citations.pagination?.total_pages||1)),totalPages:Math.max(1,U.citations.pagination?.total_pages||1),total:U.citations.pagination?.total||0,onPrev:()=>$(te=>Math.max(1,te-1)),onNext:()=>$(te=>Math.min(Math.max(1,U.citations.pagination?.total_pages||1),te+1))})})]})]}),t.jsxs(g8,{style:{gridColumn:"1 / -1"},children:[t.jsx(d$,{children:t.jsx("div",{style:{minWidth:0},children:t.jsxs(u$,{children:[t.jsx(p$,{children:"Responses"}),t.jsx(at,{content:"Model responses for this prompt in the selected range/models. Click a response to view the full text.",size:"sm",maxWidth:420,children:t.jsx(m$,{style:{color:z},"aria-label":"Info",children:t.jsx(wn,{size:16})})})]})})}),t.jsxs(h$,{children:[U.responses.loading?t.jsx($p,{columns:[{width:"10rem"},{width:"9rem"},{width:"6.5rem"},{width:"7.5rem"},{width:"7rem"},{width:"6.5rem"},{width:"18rem"},{}],rows:10,minWidth:"1240px"}):t.jsx(YK,{children:t.jsx(H6,{children:t.jsx(q6,{style:{minWidth:1240},children:t.jsxs(nr,{children:[t.jsx(pr,{children:t.jsxs(Cn,{children:[t.jsx(Et,{style:{width:"10rem"},children:"Model"}),t.jsx(Et,{style:{width:"9rem"},children:"Date"}),t.jsx(Et,{style:{width:"6.5rem"},$align:"right",children:t.jsxs("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"flex-end",gap:6,width:"100%"},children:[t.jsx("span",{children:"Position"}
11712),t.jsx(at,{content:"Position of your brand in the response (if present).",size:"sm",maxWidth:320,children:t.jsx("span",{style:{display:"inline-flex",color:z},"aria-label":"Info",children:t.jsx(wn,{size:14})})})]})}),t.jsx(Et,{style:{width:"7.5rem"},children:t.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[t.jsx("span",{children:"Sentiment"}),t.jsx(at,{content:"Sentiment of this specific model response.",size:"sm",maxWidth:320,children:t.jsx("span",{style:{display:"inline-flex",color:z},"aria-label":"Info",children:t.jsx(wn,{size:14})})})]})}),t.jsx(Et,{style:{width:"7rem"},children:t.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[t.jsx("span",{children:"Mentions"}),t.jsx(at,{content:"Whether your brand is mentioned in the response.",size:"sm",maxWidth:320,children:t.jsx("span",{style:{display:"inline-flex",color:z},"aria-label":"Info",children:t.jsx(wn,{size:14})})})]})}),t.jsx(Et,{style:{width:"6.5rem"},$align:"right",children:t.jsxs("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"flex-end",gap:6,width:"100%"},children:[t.jsx("span",{children:"Citations #"}),t.jsx(at,{content:"Total citations extracted for this response.",size:"sm",maxWidth:360,children:t.jsx("span",{style:{display:"inline-flex",color:z},"aria-label":"Info",children:t.jsx(wn,{size:14})})})]})}),t.jsx(Et,{style:{width:"18rem",maxWidth:"18rem"},children:t.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[t.jsx("span",{children:"Citations"}),t.jsx(at,{content:"Top cited domains for this response.",size:"sm",maxWidth:360,children:t.jsx("span",{style:{display:"inline-flex",color:z},"aria-label":"Info",children:t.jsx(wn,{size:14})})})]})}),t.jsx(Et,{style:{width:"24rem",minWidth:"18rem"},children:"Response"})]})}),t.jsx(mr,{children:je.length===0?t.jsx(Cn,{children:t.jsx(bt,{colSpan:8,$muted:!0,children:U.responses.error?t.jsx("span",{style:{color:z,fontWeight:800},children:U.responses.error}):t.jsx(Sp,{initialCrunching:X})})}):je.map(te=>t.jsxs(Cn,{children:[t.jsx(bt,{children:(()=>{const ge=String(te.model_key||""),Je=j[ge],Ee=Je?.label||ge||"â",Xe=Je?.Icon;return t.jsxs(XK,{children:[t.jsx(est,{$color:f8(ge,Ft)}),Xe?t.jsx("span",{title:Ee,"aria-label":Ee,style:{display:"inline-flex"},children:t.jsx(Xe,{})}):null]})})()}),t.jsx(bt,{style:{whiteSpace:"nowrap"},children:t.jsx(rr,{value:te.finished_at,timeZoneMode:"viewer",options:{month:"short",day:"numeric"}})}),t.jsx(bt,{$align:"right",children:typeof te.position=="number"?te.position:t.jsx("span",{style:{color:z,fontWeight:800},children:"â"})}),t.jsx(bt,{children:String(te?.status||"").toLowerCase()==="succeeded"&&typeof te.sentiment_score=="number"&&Number.isFinite(te.sentiment_score)?t.jsx(l_,{score:te.sentiment_score}):t.jsx("span",{style:{color:z,fontWeight:800},children:"â"})}),t.jsx(bt,{children:te.brand_present?t.jsx("span",{title:"Mentioned","aria-label":"Mentioned",style:{display:"inline-flex",alignItems:"center"},children:t.jsx(Zn,{size:16,color:Ft})}):t.jsx("span",{style:{color:z,fontWeight:800},children:"â"})}),t.jsx(bt,{$align:"right",children:t.jsx("span",{style:{color:z,fontWeight:850},children:Number(te.citations_count||0)})}),t.jsx(bt,{children:t.jsx("div",{style:{display:"inline-flex",alignItems:"center",gap:10,width:"100%",minWidth:0},children:(()=>{const ge=te.citations.length>0?te.citations.map(Je=>String(Je.domain||"")).filter(Boolean).join(", "):"";return t.jsx(at,{content:ge||"â",onlyIfTruncated:!0,size:"sm",maxWidth:520,children:t.jsx(QK,{style:{flex:"1 1 auto"},children:ge||t.jsx("span",{style:{color:z,fontWeight:800},children:"â"})})})})()})}),t.jsx(bt,{style:{maxWidth:0},children:t.jsx(at,{content:(String(te?.status||"").toLowerCase()!=="succeeded"?"No Answer":String(te.response_text||"").trim())||"â",onlyIfTruncated:!0,size:"sm",maxWidth:760,children:t.jsx(rst,{type:"button",onClick:()=>{const ge=String(te?.status||"").toLowerCase();ge&&ge!=="succeeded"||String(te.response_text||"").trim()&&it(te)},"aria-label":"Open full response",disabled:String(te?.status||"").toLowerCase()!=="succeeded"||!String(te.response_text||"").trim(),children:t.jsx(QK,{children:String(te?.status||"").toLowerCase()!=="succeeded"?t.jsx("span",{style:{color:z,fontWeight:900},children:"No Answer"}):String(te.response_text||"").trim()?String(te.response_text).trim():t.jsx("span",{style:{color:z,fontWeight:800},children:`Response #${String(te.id)}`})})})})})]},te.id))})]})})})}),t.jsx("div",{style:{marginTop:10},children:t.jsx(pi,{page:Math.min(Math.max(1,U.responses.pagination?.page||k),Math.max(1,U.responses.pagination?.total_pages||1)),totalPages:Math.max(1,U.responses.pagination?.total_pages||1),total:U.responses.pagination?.total||0,onPrev:()=>P(te=>Math.max(1,te-1)),onNext:()=>P(te=>Math.min(Math.max(1,U.responses.pagination?.total_pages||1),te+1))})})]})]})]}),t.jsx(Mot,{isOpen:!!Se,response:Se,onClose:()=>it(null),allModelOptions:y,brands:{main:De.main,mainAliases:De.mainAliases,others:De.others}}),t.jsx(ec,{isOpen:R,orgId:Number(e),onClose:()=>F(!1)})]})}const dst=new Set(["active_prompts_limit_reached","daily_prompt_runs_quota_reached_today","projects_limit_reached","countries_limit_reached","insufficient_credits"]);function ust(e){switch(e){case"active_prompts_limit_reached":return{title:"Prompt limit reached",limitName:"active prompts"};case"daily_prompt_runs_quota_reached_today":return{title:"Daily runs limit reached",limitName:"daily prompt runs"};case"projects_limit_reached":return{title:"Projects limit reached",limitName:"projects"};case"countries_limit_reached":return{title:"Country limit reached",limitName:"countries"};case"insufficient_credits":return{title:"Insufficient credits",limitName:"credits"};default:return{title:"Limit reached",limitName:"plan limit"}}}function pst(e,n){const i=e,r=i?.limitDetails??i?.details??n?.errors,o=r?.error_code;if(o&&dst.has(o)){const{title:a,limitName:c}=ust(o),u=typeof r?.limit=="number"?r.limit:typeof r?.credits_remaining=="number"?r.credits_remaining:void 0,m=typeof r?.used=="number"?r.used:typeof r?.credits_required=="number"?r.credits_required:void 0;return{title:a,message:(e instanceof Error?e.message:null)??n?.error??(o==="insufficient_credits"?`Not enough credits. You need ${m??"more"} credits but only have ${u??0} remaining.`:`You've reached the ${c} limit for your current plan.`),limitName:c,limit:u,used:m}}const s=(e instanceof Error?e.message:String(e??"")).toLowerCase();return s.includes("limit reached")||s.includes("limit would be exceeded")||s.includes("limit exceeded")||s.includes("quota reached")?{title:"Limit reached",message:e instanceof Error?e.message:String(e)}:null}function k1(){const[e,n]=l.useState(null),i=l.useCallback((o,s)=>{const a=pst(o,s);return a?(n(a),!0):!1},[]),r=l.useCallback(()=>n(null),[]);return{overlayState:e,isOpen:e!==null,handleApiError:i,closeOverlay:r}}const $1={earned_editorial:"Earned - Editorial",earned_ugc:"Earned - UGC",earned_reference:"Earned - Reference",owned_content:"Owned - Content",owned_technical:"Owned - Technical",owned_configuration:"Owned - Configuration",sentiment_correction:"Sentiment Correction"},VO={earned_editorial:"#7C3AED",earned_ugc:"#8B5CF6",earned_reference:"#A78BFA",owned_content:"#2563EB",owned_technical:"#3B82F6",owned_configuration:"#60A5FA",sentiment_correction:"#F59E0B"},mst={earned:"Earned",owned:"Owned"},kde={listicle:"Listicle",article:"Article",how_to_guide:"How-To Guide",comparison:"Comparison",faq_page:"FAQ Page",product_page:"Product Page",category_page:"Category Page",data_resource:"Data Resource"},KO={low:"Low",medium:"Medium",high:"High"},$de={low:"#10b981",medium:"#f59e0b",high:"#ef4444"},Ide={high:"#10b981",medium:"#f59e0b",low:"#ef4444"},hst={todo:"To Do",in_progress:"In Progress",completed:"Completed",dismissed:"Dismissed"},Pde={low_visibility:{label:"Low Visibility",color:"#ef4444"},declining_visibility:{label:"Declining",color:"#f59e0b"},brand_absent:{label:"Brand Absent",color:"#dc2626"},no_client_citation:{label:"Not Cited",color:"#e11d48"},citation_gap:{label:"Citation Gap",color:"#8b5cf6"},site_audit_issues:{label:"Site Issues",color:"#f97316"},competitor_outperforming:{label:"Competitor Lead",color:"#6366f1"}},G6={high:{label:"High impact",color:"#10b981"},medium:{label:"Med impact",color:"#f59e0b"},low:{label:"Low impact",color:"#ef4444"}};function Ade(e){return e==null?null:e>=35?G6.high:e>
11712=15?G6.medium:G6.low}const fst=p.span.withConfig({displayName:"ImpactLabel__Badge",componentId:"sc-7eihn6-0"})` 11713 display: inline-flex; 11714 align-items: center; 11715 font-size: 0.675rem; 11716 font-weight: 600; 11717 padding: 0.125rem 0.4rem; 11718 border-radius: 4px; 11719 color: ${e=>e.$color}; 11720 background: ${e=>`${e.$color}14`}; 11721 white-space: nowrap; 11722 line-height: 1.4; 11723`;function gst({impact:e,className:n}){const i=Ade(e);return i?t.jsx(fst,{$color:i.color,className:n,children:i.label}):null}const yst=p(Dn).withConfig({displayName:"ActionCard__Card",componentId:"sc-mmr5qj-0"})` 11724 border: 1px solid ${V}; 11725 background: ${Z}; 11726 border-radius: 0.625rem; 11727 padding: ${e=>e.$kanban?"0.6rem 0.7rem":"0.75rem 0.875rem"}; 11728 display: flex; 11729 flex-direction: ${e=>e.$kanban?"column":"row"}; 11730 align-items: ${e=>e.$kanban?"stretch":"center"}; 11731 gap: ${e=>e.$kanban?"0.4rem":"0.75rem"}; 11732 text-decoration: none; 11733 transition: box-shadow 0.15s ease, border-color 0.15s ease; 11734 &:hover { 11735 border-color: #d1d5db; 11736 box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04); 11737 } 11738`,xst=p.div.withConfig({displayName:"ActionCard__Info",componentId:"sc-mmr5qj-1"})` 11739 flex: 1; 11740 min-width: 0; 11741 display: flex; 11742 flex-direction: column; 11743 gap: 0.25rem; 11744`,bst=p.div.withConfig({displayName:"ActionCard__Title",componentId:"sc-mmr5qj-2"})` 11745 font-size: ${e=>e.$kanban?"0.775rem":"0.825rem"}; 11746 font-weight: 600; 11747 color: ${O}; 11748 line-height: 1.35; 11749 ${e=>e.$kanban?"display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;":"white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 32rem;"} 11750`,vst=p.div.withConfig({displayName:"ActionCard__Meta",componentId:"sc-mmr5qj-3"})` 11751 display: flex; 11752 align-items: center; 11753 gap: ${e=>e.$kanban?"0.35rem":"0.5rem"}; 11754 flex-wrap: wrap; 11755 ${e=>e.$kanban&&"row-gap: 0.25rem;"} 11756`,V6=p.span.withConfig({displayName:"ActionCard__Tag",componentId:"sc-mmr5qj-4"})` 11757 font-size: 0.65rem; 11758 font-weight: 500; 11759 color: ${e=>e.$color||Pe}; 11760 white-space: nowrap; 11761`,K6=p.span.withConfig({displayName:"ActionCard__Pill",componentId:"sc-mmr5qj-5"})` 11762 display: inline-flex; 11763 align-items: center; 11764 font-size: 0.625rem; 11765 font-weight: 600; 11766 padding: 0.1rem 0.35rem; 11767 border-radius: 4px; 11768 color: ${e=>e.$color}; 11769 background: ${e=>`${e.$color}14`}; 11770 white-space: nowrap; 11771 line-height: 1.4; 11772`,fx=p.span.withConfig({displayName:"ActionCard__Dot",componentId:"sc-mmr5qj-6"})` 11773 width: 3px; 11774 height: 3px; 11775 border-radius: 50%; 11776 background: ${V}; 11777 flex-shrink: 0; 11778`,wst=p.span.withConfig({displayName:"ActionCard__TypeIndicator",componentId:"sc-mmr5qj-7"})` 11779 display: inline-flex; 11780 align-items: center; 11781 gap: 0.25rem; 11782 font-size: 0.65rem; 11783 font-weight: 600; 11784 color: ${e=>e.$color}; 11785 white-space: nowrap; 11786`,jst=p.span.withConfig({displayName:"ActionCard__TypeDot",componentId:"sc-mmr5qj-8"})` 11787 width: 6px; 11788 height: 6px; 11789 border-radius: 50%; 11790 background: ${e=>e.$color}; 11791 flex-shrink: 0; 11792`,_st=p.div.withConfig({displayName:"ActionCard__Right",componentId:"sc-mmr5qj-9"})` 11793 display: flex; 11794 align-items: center; 11795 gap: ${e=>e.$kanban?"0.35rem":"0.5rem"}; 11796 flex-shrink: 0; 11797 ${e=>e.$kanban&&`border-top: 1px solid ${V}; padding-top: 0.35rem; margin-top: 0.05rem; flex-wrap: wrap;`} 11798`,Cst=p.span.withConfig({displayName:"ActionCard__ModelIconWrap",componentId:"sc-mmr5qj-10"})` 11799 display: inline-flex; 11800 align-items: center; 11801 justify-content: center; 11802 width: 18px; 11803 height: 18px; 11804 color: ${Pe}; 11805 flex-shrink: 0; 11806 & > svg { width: 16px; height: 16px; } 11807`,Sst=p.span.withConfig({displayName:"ActionCard__LinkedChip",componentId:"sc-mmr5qj-11"})` 11808 display: inline-flex; 11809 align-items: center; 11810 gap: 0.15rem; 11811 font-size: 0.6rem; 11812 font-weight: 500; 11813 color: ${Pe}; 11814 white-space: nowrap; 11815 margin-right: 0.5rem; 11816`,kst=p(Gi).withConfig({displayName:"ActionCard__Arrow",componentId:"sc-mmr5qj-12"})` 11817 color: ${V}; 11818 flex-shrink: 0; 11819`,$st=p.span.withConfig({displayName:"ActionCard__KanbanSpacer",componentId:"sc-mmr5qj-13"})` 11820 flex: 1; 11821`,Ist=Tn`from { transform: rotate(0deg); } to { transform: rotate(360deg); }`,Pst=p.span.withConfig({displayName:"ActionCard__GeneratingChip",componentId:"sc-mmr5qj-14"})` 11822 display: inline-flex; 11823 align-items: center; 11824 gap: 0.2rem; 11825 font-size: 0.6rem; 11826 font-weight: 600; 11827 color: #8b5cf6; 11828 background: #8b5cf614; 11829 padding: 0.1rem 0.35rem; 11830 border-radius: 4px; 11831 white-space: nowrap; 11832 & > svg { animation: ${Ist} 1s linear infinite; } 11833`,Ast=p.a.withConfig({displayName:"ActionCard__ActionableLinkChip",componentId:"sc-mmr5qj-15"})` 11834 display: inline-flex; 11835 align-items: center; 11836 gap: 0.3rem; 11837 font-size: 0.6rem; 11838 font-weight: 500; 11839 color: ${Pe}; 11840 text-decoration: none; 11841 padding: 0.15rem 0.4rem; 11842 border-radius: 4px; 11843 border: 1px solid ${V}; 11844 background: ${Z}; 11845 white-space: nowrap; 11846 transition: border-color 0.15s ease, color 0.15s ease; 11847 &:hover { 11848 border-color: #d1d5db; 11849 color: ${O}; 11850 } 11851`,Nst=p.span.withConfig({displayName:"ActionCard__ActionableLinkHost",componentId:"sc-mmr5qj-16"})` 11852 max-width: 7rem; 11853 overflow: hidden; 11854 text-overflow: ellipsis; 11855 white-space: nowrap; 11856`;function zst(e){const n=e.toLowerCase();return If.find(i=>n.includes(i.key))||null}function Tst(e){if(!e)return null;try{return new URL(e).hostname.replace(/^www\./,"")}catch{return null}}function RA({action:e,basePath:n,variant:i="list"}){const r=i==="kanban",o=(e.related_prompt_ids||[]).length,s=l.useMemo(()=>Tst(e.target_url),[e.target_url]),a=e.action_type&&VO[e.action_type]||"#6b7280",c=e.action_type?$1[e.action_type]||e.action_type:null,u=e.effort_level?KO[e.effort_level]||e.effort_level:null,m=e.effort_level&&$de[e.effort_level]||"#6b7280",h=e.content_format?kde[e.content_format]||e.content_format:null,g=Ade(e.estimated_impact),x=e.feasibility?Ide[e.feasibility]||"#6b7280":null;return t.jsxs(yst,{to:`${n}/actions/${e.id}`,$kanban:r,children:[t.jsxs(xst,{children:[t.jsx(bst,{$kanban:r,children:e.title}),t.jsxs(vst,{$kanban:r,children:[c&&t.jsxs(wst,{$color:a,children:[t.jsx(jst,{$color:a}),c]}),g&&t.jsxs(t.Fragment,{children:[t.jsx(fx,{}),t.jsx(K6,{$color:g.color,children:g.label})]}),u&&t.jsxs(t.Fragment,{children:[t.jsx(fx,{}),t.jsxs(K6,{$color:m,children:[u," effort"]})]}),x&&e.feasibility&&t.jsxs(t.Fragment,{children:[t.jsx(fx,{}),t.jsxs(K6,{$color:x,children:[e.feasibility.charAt(0).toUpperCase()+e.feasibility.slice(1)," feasibility"]})]}),!r&&e.target_platform&&t.jsxs(t.Fragment,{children:[t.jsx(fx,{}),t.jsx(V6,{children:e.target_platform})]}),!r&&h&&t.jsxs(t.Fragment,{children:[t.jsx(fx,{}),t.jsx(V6,{children:h})]}),!r&&e.created_at&&t.jsxs(t.Fragment,{children:[t.jsx(fx,{}),t.jsx(V6,{children:new Date(e.created_at).toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})})]})]})]}),t.jsxs(_st,{$kanban:r,children:[s&&e.target_url&&t.jsx(at,{content:s,size:"sm",children:t.jsxs(Ast,{href:e.target_url,target:"_blank",rel:"noopener noreferrer",onClick:y=>y.stopPropagation(),children:[t.jsx($u,{domain:e.target_url,size:14}),t.jsx(Nst,{children:s}),t.jsx(as,{size:9,style:{flexShrink:0,opacity:.5}})]})}),(e.guide_status==="generating"||e.guide_status==="pending")&&t.jsx(at,{content:"Implementation guide is being generated",size:"sm",children:t.jsxs(Pst,{children:[t.jsx(Tr,{size:10}),"Generating"]})}),o>1&&t.jsx(at,{content:`Linked to ${o} prompts`,size:"sm",children:t.jsxs(Sst,{children:[t.jsx(xu,{size:10}),o]})}),r&&t.jsx($st,{}),e.ai_models&&e.ai_models.length>0&&e.ai_models.slice(0,r?3:4).map(y=>{const w=zst(y);if(!w)return null;const j=w.Icon;return t.jsx(at,{content:w.label,size:"sm",children:t.jsx(Cst,{children:t.jsx(j,{})})},y)}),!r&&t.jsx(kst,{size:14})]})]})}const Est=Tn` 11857 0% { background-position: -200% 0; } 11858 100% { background-position: 200% 0; } 11859`,Mst=p.div.withConfig({displayName:"ActionSkeletonCard__Card",componentId:"sc-19766l-0"})` 11860 border: 1px solid ${V}; 11861 background: ${Z}; 11862 border-radius: 0.625rem; 11863 padding: 0.75rem 0.875rem; 11864 display: flex; 11865 align-items: center; 11866 gap: 0.75rem; 11867`,Mw=p.div.withConfig({displayName:"ActionSkeletonCard__ShimmerBar",componentId:"sc-19766l-1"})` 11868 width: ${e=>e.$w||"100%"}; 11869 height: ${e=>e.$h||"0.75rem"}; 11870 border-radius: 4px; 11871 background: linear-gradient( 11872 90deg, 11873 ${$e} 25%, 11874 ${V} 50%, 11875 ${$e} 75% 11876 ); 11877 background-size: 200% 100%; 11878 animation: ${Est} 1.5s ease-in-out infinite; 11879`,Rst=p.div.withConfig({displayName:"ActionSkeletonCard__Row",componentId:"sc-19766l-2"})` 11880 display: flex; 11881 gap: 0.5rem; 11882 align-items: center; 11883`,Ost=p.div.withConfig({displayName:"ActionSkeletonCard__InfoBlock",componentId:"sc-19766l-3"})` 11884 flex: 1; 11885 min-width: 0; 11886 display: flex; 11887 flex-direction: column; 11888 gap: 0.25rem; 11889`;function Nde(){return t.jsxs(Mst,{children:[t.jsxs(Ost,{children:[t.jsx(Mw,{$w:"65%",$h:"0.8rem"}),t.jsxs(Rst,{children:[t.jsx(Mw,{$w:"4rem",$h:"0.6rem"}),t.jsx(Mw,{$w:"3.5rem",$h:"0.6rem"}),t.jsx(Mw,{$w:"2rem",$h:"0.6rem"})]})]}),t.jsx(Mw,{$w:"2.5rem",$h:"0.6rem"})]})}const Dst=Tn` 11890 0%, 100% { opacity: 1; } 11891 50% { opacity: 0.4; } 11892`,Lst=Tn` 11893 from { transform: rotate(0deg); } 11894 to { transform: rotate(360deg); } 11895`,Bst=p.div.withConfig({displayName:"AISummaryBanner__Banner",componentId:"sc-9agmr8-0"})` 11896 display: flex; 11897 gap: 0.75rem; 11898 padding: 1rem 1.25rem; 11899 margin: 0.75rem 0 1.25rem; 11900 border-radius: 0.75rem; 11901 border: 1px solid ${V}; 11902 background: ${Z}; 11903 color: ${O}; 11904 ${e=>e.$generating?"border-left: 3px solid var(--color-brand-600);":""} 11905 ${e=>e.$hasMetrics?"align-items: center;":""} 11906 @media (max-width: 640px) { 11907 flex-direction: column; 11908 align-items: stretch; 11909 } 11910`,Fst=p.div.withConfig({displayName:"AISummaryBanner__MetricsRow",componentId:"sc-9agmr8-1"})` 11911 display: flex; 11912 gap: 0.5rem; 11913 flex-shrink: 0; 11914 @media (max-width: 640px) { 11915 justify-content: space-between; 11916 } 11917`,Wst=p.div.withConfig({displayName:"AISummaryBanner__TextSide",componentId:"sc-9agmr8-2"})` 11918 display: flex; 11919 gap: 0.75rem; 11920 margin-left: 1.5rem; 11921 padding-left: 1.5rem; 11922 border-left: 1px solid ${V}; 11923 align-items: flex-start; 11924 flex: 1; 11925 min-width: 0; 11926 @media (max-width: 640px) { 11927 margin-left: 0; 11928 padding-left: 0; 11929 border-left: none; 11930 padding-top: 0.75rem; 11931 border-top: 1px solid ${V}; 11932 } 11933`,Ust=p.div.withConfig({displayName:"AISummaryBanner__MetricBox",componentId:"sc-9agmr8-3"})` 11934 display: flex; 11935 flex-direction: column; 11936 align-items: center; 11937 justify-content: center; 11938 padding: 0.25rem 0.75rem; 11939 text-align: center; 11940 width: 80px; 11941 flex: 0 0 80px; 11942 @media (max-width: 640px) { 11943 flex: 1 1 0; 11944 width: auto; 11945 } 11946`,Hst=p.div.withConfig({displayName:"AISummaryBanner__MetricValue",componentId:"sc-9agmr8-4"})` 11947 font-size: 1.75rem; 11948 font-weight: 800; 11949 color: ${e=>e.$color||O}; 11950 line-height: 1; 11951`,qst=p.div.withConfig({displayName:"AISummaryBanner__MetricLabel",componentId:"sc-9agmr8-5"})` 11952 font-size: 0.65rem; 11953 font-weight: 500; 11954 color: ${Pe}; 11955 text-transform: uppercase; 11956 letter-spacing: 0.04em; 11957 margin-top: 0.25rem; 11958 line-height: 1; 11959 white-space: nowrap; 11960`,JK=p.span.withConfig({displayName:"AISummaryBanner__IconWrap",componentId:"sc-9agmr8-6"})` 11961 display: flex; 11962 align-items: flex-start; 11963 padding-top: 0.1rem; 11964 flex-shrink: 0; 11965 color: var(--color-brand-600); 11966 ${e=>e.$generating?Pp`animation: ${Dst} 1.5s ease-in-out infinite;`:""}
11967`,eY=p.div.withConfig({displayName:"AISummaryBanner__Content",componentId:"sc-9agmr8-7"})` 11968 flex: 1; 11969 display: flex; 11970 flex-direction: column; 11971 gap: 0.375rem; 11972`,tY=p.span.withConfig({displayName:"AISummaryBanner__Title",componentId:"sc-9agmr8-8"})` 11973 font-size: 0.825rem; 11974 font-weight: 600; 11975 line-height: 1.4; 11976`,nY=p.ul.withConfig({displayName:"AISummaryBanner__BulletList",componentId:"sc-9agmr8-9"})` 11977 margin: 0; 11978 padding: 0 0 0 1rem; 11979 display: flex; 11980 flex-direction: column; 11981 gap: 0.15rem; 11982`,iY=p.li.withConfig({displayName:"AISummaryBanner__Bullet",componentId:"sc-9agmr8-10"})` 11983 font-size: 0.775rem; 11984 font-weight: 400; 11985 color: ${Pe}; 11986 line-height: 1.5; 11987`,rY=p.div.withConfig({displayName:"AISummaryBanner__ProgressWrap",componentId:"sc-9agmr8-11"})` 11988 margin-top: 0.35rem; 11989 display: flex; 11990 align-items: center; 11991 gap: 0.5rem; 11992`,oY=p.div.withConfig({displayName:"AISummaryBanner__ProgressTrack",componentId:"sc-9agmr8-12"})` 11993 flex: 1; 11994 height: 4px; 11995 border-radius: 2px; 11996 background: ${V}; 11997 overflow: hidden; 11998`,sY=p.div.withConfig({displayName:"AISummaryBanner__ProgressFill",componentId:"sc-9agmr8-13"})` 11999 height: 100%; 12000 border-radius: 2px; 12001 background: var(--color-brand-600); 12002 width: ${e=>Math.min(100,Math.max(0,e.$pct))}%; 12003 transition: width 0.4s ease; 12004`,aY=p.span.withConfig({displayName:"AISummaryBanner__ProgressLabel",componentId:"sc-9agmr8-14"})` 12005 font-size: 0.7rem; 12006 font-weight: 600; 12007 color: ${Pe}; 12008 white-space: nowrap; 12009 flex-shrink: 0; 12010`,lY=p(One).withConfig({displayName:"AISummaryBanner__SpinnerIcon",componentId:"sc-9agmr8-15"})` 12011 animation: ${Lst} 1.2s linear infinite; 12012`;function YO({message:e,bullets:n,generating:i,progress:r,progressLabel:o,metrics:s,className:a}){const c=i&&r!=null;return t.jsx(Bst,{className:a,$generating:i,$hasMetrics:!!s?.length,children:s&&s.length>0?t.jsxs(t.Fragment,{children:[t.jsx(Fst,{children:s.map((u,m)=>t.jsxs(Ust,{children:[t.jsx(Hst,{$color:u.color,children:u.value}),t.jsx(qst,{children:u.label})]},m))}),t.jsxs(Wst,{children:[t.jsx(JK,{$generating:i,children:i?t.jsx(lY,{size:16}):t.jsx(Sn,{size:16})}),t.jsxs(eY,{children:[t.jsx(tY,{children:e}),n&&n.length>0&&t.jsx(nY,{children:n.map((u,m)=>t.jsx(iY,{children:u},m))}),c&&t.jsxs(rY,{children:[t.jsx(oY,{children:t.jsx(sY,{$pct:r})}),o&&t.jsx(aY,{children:o})]})]})]})]}):t.jsxs(t.Fragment,{children:[t.jsx(JK,{$generating:i,children:i?t.jsx(lY,{size:16}):t.jsx(Sn,{size:16})}),t.jsxs(eY,{children:[t.jsx(tY,{children:e}),n&&n.length>0&&t.jsx(nY,{children:n.map((u,m)=>t.jsx(iY,{children:u},m))}),c&&t.jsxs(rY,{children:[t.jsx(oY,{children:t.jsx(sY,{$pct:r})}),o&&t.jsx(aY,{children:o})]})]})]})})}const Gst=p.span.withConfig({displayName:"CategoryBadge__Badge",componentId:"sc-14box3w-0"})` 12013 display: inline-flex; 12014 align-items: center; 12015 gap: 0.25rem; 12016 font-size: 0.7rem; 12017 font-weight: 600; 12018 padding: 0.15rem 0.5rem; 12019 border-radius: 9999px; 12020 color: #fff; 12021 background: ${e=>e.$bg}; 12022 white-space: nowrap; 12023 line-height: 1.4; 12024`,Vst=p.span.withConfig({displayName:"CategoryBadge__Dot",componentId:"sc-14box3w-1"})` 12025 width: 6px; 12026 height: 6px; 12027 border-radius: 50%; 12028 background: rgba(255, 255, 255, 0.6); 12029 flex-shrink: 0; 12030`;function zde({actionType:e,className:n}){if(!e)return null;const i=$1[e]||e,r=VO[e]||"#6b7280";return t.jsxs(Gst,{$bg:r,className:n,children:[t.jsx(Vst,{$color:r}),i]})}const Kst=p.div.withConfig({displayName:"CategoryTabs__TabsRow",componentId:"sc-1jd5bie-0"})` 12031 display: flex; 12032 gap: 0.35rem; 12033 flex-wrap: nowrap; 12034`,cY=p.button.withConfig({displayName:"CategoryTabs__Tab",componentId:"sc-1jd5bie-1"})` 12035 display: inline-flex; 12036 align-items: center; 12037 gap: 0.3rem; 12038 padding: 0.35rem 0.65rem; 12039 border-radius: 6px; 12040 border: 1px solid ${e=>e.$active?e.$color:V}; 12041 background: ${e=>e.$active?`${e.$color}14`:Z}; 12042 color: ${e=>e.$active?e.$color:Pe}; 12043 font-size: 0.725rem; 12044 font-weight: 600; 12045 cursor: pointer; 12046 transition: all 0.15s ease; 12047 white-space: nowrap; 12048 12049 &:hover { 12050 border-color: ${e=>e.$color}; 12051 color: ${e=>e.$color}; 12052 } 12053`,Yst=p.span.withConfig({displayName:"CategoryTabs__Dot",componentId:"sc-1jd5bie-2"})` 12054 width: 6px; 12055 height: 6px; 12056 border-radius: 50%; 12057 background: ${e=>e.$color}; 12058 flex-shrink: 0;
12059`,Xst=p.span.withConfig({displayName:"CategoryTabs__CountBadge",componentId:"sc-1jd5bie-3"})` 12060 font-size: 0.625rem; 12061 font-weight: 700; 12062 opacity: ${e=>e.$active?1:.6}; 12063`;function Tde({types:e,selected:n,counts:i,onSelect:r,className:o}){return t.jsxs(Kst,{className:o,children:[t.jsx(cY,{$active:n===null,$color:O,onClick:()=>r(null),children:"All"}),e.map(s=>{const a=VO[s]||"#6b7280",c=i?.[s];return t.jsxs(cY,{$active:n===s,$color:a,onClick:()=>r(n===s?null:s),children:[t.jsx(Yst,{$color:a}),$1[s]||s,c!=null&&t.jsx(Xst,{$active:n===s,children:c})]},s)})]})}const Qst=p.span.withConfig({displayName:"ContentFormatTag__Tag",componentId:"sc-qirpef-0"})` 12064 display: inline-flex; 12065 align-items: center; 12066 font-size: 0.65rem; 12067 font-weight: 500; 12068 padding: 0.1rem 0.35rem; 12069 border-radius: 3px; 12070 color: ${Pe}; 12071 background: ${$e}; 12072 white-space: nowrap; 12073 line-height: 1.4; 12074`;function Zst({format:e,className:n}){return e?t.jsx(Qst,{className:n,children:kde[e]||e}):null}const Jst=p.span.withConfig({displayName:"EffortBadge__Badge",componentId:"sc-3nde4-0"})` 12075 display: inline-flex; 12076 align-items: center; 12077 font-size: 0.675rem; 12078 font-weight: 600; 12079 padding: 0.125rem 0.4rem; 12080 border-radius: 4px; 12081 color: ${e=>e.$color}; 12082 background: ${e=>`${e.$color}14`}; 12083 white-space: nowrap; 12084 line-height: 1.4; 12085`;function Ede({effort:e,className:n}){if(!e)return null;const i=$de[e]||"#6b7280";return t.jsxs(Jst,{$color:i,className:n,children:[KO[e]||e," effort"]})}const eat=p.span.withConfig({displayName:"FeasibilityBadge__Badge",componentId:"sc-pn9bhs-0"})` 12086 display: inline-flex; 12087 align-items: center; 12088 font-size: 0.675rem; 12089 font-weight: 600; 12090 padding: 0.125rem 0.4rem; 12091 border-radius: 4px; 12092 color: ${e=>e.$color}; 12093 background: ${e=>`${e.$color}14`}; 12094 white-space: nowrap; 12095 line-height: 1.4; 12096`;function tat({feasibility:e,className:n}){if(!e)return null;const i=Ide[e]||"#6b7280";return t.jsxs(eat,{$color:i,className:n,children:[e.charAt(0).toUpperCase()+e.slice(1)," feasibility"]})}function nat(){for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];return l.useMemo(()=>r=>{n.forEach(o=>o(r))},n)}const OA=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function I1(e){const n=Object.prototype.toString.call(e);return n==="[object Window]"||n==="[object global]"}function XO(e){return"nodeType"in e}function wl(e){var n,i;return e?I1(e)?e:XO(e)&&(n=(i=e.ownerDocument)==null?void 0:i.defaultView)!=null?n:window:window}function QO(e){const{Document:n}=wl(e);return e instanceof n}function MC(e){return I1(e)?!1:e instanceof wl(e).HTMLElement}function Mde(e){return e instanceof wl(e).SVGElement}function P1(e){return e?I1(e)?e.document:XO(e)?QO(e)?e:MC(e)||Mde(e)?e.ownerDocument:document:document:document}const Au=OA?l.useLayoutEffect:l.useEffect;function DA(e){const n=l.useRef(e);return Au(()=>{n.current=e}),l.useCallback(function(){for(var i=arguments.length,r=new Array(i),o=0;o<i;o++)r[o]=arguments[o];return n.current==null?void 0:n.current(...r)},[])}function iat(){const e=l.useRef(null),n=l.useCallback((r,o)=>{e.current=setInterval(r,o)},[]),i=l.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[n,i]}function W_(e,n){n===void 0&&(n=[e]);const i=l.useRef(e);return Au(()=>{i.current!==e&&(i.current=e)},n),i}function RC(e,n){const i=l.useRef();return l.useMemo(()=>{const r=e(i.current);return i.current=r,r},[...n])}function YI(e){const n=DA(e),i=l.useRef(null),r=l.useCallback(o=>{o!==i.current&&n?.(o,i.current),i.current=o},[]);return[i,r]}function XI(e){const n=l.useRef();return l.useEffect(()=>{n.current=e},[e]),n.current}let Y6={};function OC(e,n){return l.useMemo(()=>{if(n)return n;const i=Y6[e]==null?0:Y6[e]+1;return Y6[e]=i,e+"-"+i},[e,n])}function Rde(e){return function(n){for(var i=arguments.length,r=new Array(i>1?i-1:0),o=1;o<i;o++)r[o-1]=arguments[o];return r.reduce((s,a)=>{const c=Object.entries(a);for(const[u,m]of c){const h=s[u];h!=null&&(s[u]=h+e*m)}return s},{...n})}}const $b=Rde(1),QI=Rde(-1);function rat(e){return"clientX"in e&&"clientY"in e}function LA(e){if(!e)return!1;const{KeyboardEvent:n}=wl(e.target);return n&&e instanceof n}function oat(e){if(!e)return!1;const{TouchEvent:n}=wl(e.target);return n&&e instanceof n}function ZI(e){if(oat(e)){if(e.touches&&e.touches.length){const{clientX:n,clientY:i}=e.touches[0];return{x:n,y:i}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:n,clientY:i}=e.changedTouches[0];return{x:n,y:i}}}return rat(e)?{x:e.clientX,y:e.clientY}:null}const Tf=Object.freeze({Translate:{toString(e){if(!e)return;const{x:n,y:i}=e;return"translate3d("+(n?Math.round(n):0)+"px, "+(i?Math.round(i):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:n,scaleY:i}=e;return"scaleX("+n+") scaleY("+i+")"}},Transform:{toString(e){if(e)return[Tf.Translate.toString(e),Tf.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:n,duration:i,easing:r}=e;return n+" "+i+"ms "+r}}}),dY="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function sat(e){return e.matches(dY)?e:e.querySelector(dY)}const aat={display:"none"};function lat(e){let{id:n,value:i}=e;return fr.createElement("div",{id:n,style:aat},i)}function cat(e){let{id:n,announcement:i,ariaLiveType:r="assertive"}=e;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return fr.createElement("div",{id:n,style:o,role:"status","aria-live":r,"aria-atomic":!0},i)}function dat(){const[e,n]=l.useState("");return{announce:l.useCallback(r=>{r!=null&&n(r)},[]),announcement:e}}const Ode=l.createContext(null);function uat(e){const n=l.useContext(Ode);l.useEffect(()=>{if(!n)throw new Error("useDndMonitor must be used within a children of <DndContext>");return n(e)},[e,n])}function pat(){const[e]=l.useState(()=>new Set),n=l.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[l.useCallback(r=>{let{type:o,event:s}=r;e.forEach(a=>{var c;return(c=a[o])==null?void 0:c.call(a,s)})},[e]),n]}const mat={draggable:` 12097 To pick up a draggable item, press the space bar. 12098 While dragging, use the arrow keys to move the item. 12099 Press space again to drop the item in its new position, or press escape to cancel. 12100 `},hat={onDragStart(e){let{active:n}=e;return"Picked up draggable item "+n.id+"."},onDragOver(e){let{active:n,over:i}=e;return i?"Draggable item "+n.id+" was moved over droppable area "+i.id+".":"Draggable item "+n.id+" is no longer over a droppable area."},onDragEnd(e){let{active:n,over:i}=e;return i?"Draggable item "+n.id+" was dropped over droppable area "+i.id:"Draggable item "+n.id+" was dropped."},onDragCancel(e){let{active:n}=e;return"Dragging was cancelled. Draggable item "+n.id+" was dropped."}};function fat(e){let{announcements:n=hat,container:i,hiddenTextDescribedById:r,screenReaderInstructions:o=mat}=e;const{announce:s,announcement:a}=dat(),c=OC("DndLiveRegion"),[u,m]=l.useState(!1);if(l.useEffect(()=>{m(!0)},[]),uat(l.useMemo(()=>({onDragStart(g){let{active:x}=g;s(n.onDragStart({active:x}))},onDragMove(g){let{active:x,over:y}=g;n.onDragMove&&s(n.onDragMove({active:x,over:y}))},onDragOver(g){let{active:x,over:y}=g;s(n.onDragOver({active:x,over:y}))},onDragEnd(g){let{active:x,over:y}=g;s(n.onDragEnd({active:x,over:y}))},onDragCancel(g){let{active:x,over:y}=g;s(n.onDragCancel({active:x,over:y}))}}),[s,n])),!u)return null;const h=fr.createElement(fr.Fragment,null,fr.createElement(lat,{id:r,value:o.draggable}),fr.createElement(cat,{id:c,announcement:a}));return i?jr.createPortal(h,i):h}var ws;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(ws||(ws={}));function JI(){}function gat(e,n){return l.useMemo(()=>({sensor:e,options:n??{}}),[e,n])}function yat(){for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];return l.useMemo(()=>[...n].filter(r=>r!=null),[...n])}const Nu=Object.freeze({x:0,y:0});function xat(e,n){return Math.sqrt(Math.pow(e.x-n.x,2)+Math.pow(e.y-n.y,2))}function bat(e,n){const i=ZI(e);if(!i)return"0 0";const r={x:(i.x-n.left)/n.width*100,y:(i.y-n.top)/n.height*100};return r.x+"% "+r.y+"%"}function vat(e,n){let{data:{value:i}}=e,{data:{value:r}}=n;return i-r}function wat(e,n){let{data:{value:i}}=e,{data:{value:r}}=n;return r-i}function uY(e){let{left:n,top:i,height:r,width:o}=e;return[{x:n,y:i},{x:n+o,y:i},{x:n,y:i+r},{x:n+o,y:i+r}]}function jat(e,n){if(!e||e.length===0)return null;const[i]=e;return i[n]}const _at=e=>{let{collisionRect:n,droppableRects:i,droppableContainers:r}=e;const o=uY(n),s=[];for(const a of r){const{id:c}=a,u=i.get(c);if(u){const m=uY(u),h=o.reduce((x,y,w)=>x+xat(m[w],y),0),g=Number((h/4).toFixed(4));s.push({id:c,data:{droppableContainer:a,value:g}})}}return s.sort(vat)};function Cat(e,n){const i=Math.max(n.top,e.top),r=Math.max(n.left,e.left),o=Math.min(n.left+n.width,e.left+e.width),s=Math.min(n.top+n.height,e.top+e.height),a=o-r,c=s-i;if(r<o&&i<s){const u=n.width*n.height,m=e.width*e.height,h=a*c,g=h/(u+m-h);return Number(g.toFixed(4))}return 0}const Sat=e=>{let{collisionRect:n,droppableRects:i,droppableContainers:r}=e;const o=[];for(const s of r){const{id:a}=s,c=i.get(a);if(c){const u=Cat(c,n);u>0&&o.push({id:a,data:{droppableContainer:s,value:u}})}}return o.sort(wat)};function kat(e,n,i){return{...e,scaleX:n&&i?n.width/i.width:1,scaleY:n&&i?n.height/i.height:1}}function Dde(e,n){return e&&n?{x:e.left-n.left,y:e.top-n.top}:Nu}function $at(e){return function(i){for(var r=arguments.length,o=new Array(r>1?r-1:0),s=1;s<r;s++)o[s-1]=arguments[s];return o.reduce((a,c)=>({...a,top:a.top+e*c.y,bottom:a.bottom+e*c.y,left:a.left+e*c.x,right:a.right+e*c.x}),{...i})}}const Iat=$at(1);function Lde(e){if(e.startsWith("matrix3d(")){const n=e.slice(9,-1).split(/, /);return{x:+n[12],y:+n[13],scaleX:+n[0],scaleY:+n[5]}}else if(e.startsWith("matrix(")){const n=e.slice(7,-1).split(/, /);return{x:+n[4],y:+n[5],scaleX:+n[0],scaleY:+n[3]}}return null}function Pat(e,n,i){const r=Lde(n);if(!r)return e;const{scaleX:o,scaleY:s,x:a,y:c}=r,u=e.left-a-(1-o)*parseFloat(i),m=e.top-c-(1-s)*parseFloat(i.slice(i.indexOf(" ")+1)),h=o?e.width/o:e.width,g=s?e.height/s:e.height;return{width:h,height:g,top:m,right:u+h,bottom:m+g,left:u}}const Aat={ignoreTransform:!1};function A1(e,n){n===void 0&&(n=Aat);let i=e.getBoundingClientRect();if(n.ignoreTransform){const{transform:m,transformOrigin:h}=wl(e).getComputedStyle(e);m&&(i=Pat(i,m,h))}const{top:r,left:o,width:s,height:a,bottom:c,right:u}=i;return{top:r,left:o,width:s,height:a,bottom:c,right:u}}function pY(e){return A1(e,{ignoreTransform:!0})}
12100function Nat(e){const n=e.innerWidth,i=e.innerHeight;return{top:0,left:0,right:n,bottom:i,width:n,height:i}}function zat(e,n){return n===void 0&&(n=wl(e).getComputedStyle(e)),n.position==="fixed"}function Tat(e,n){n===void 0&&(n=wl(e).getComputedStyle(e));const i=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{const s=n[o];return typeof s=="string"?i.test(s):!1})}function ZO(e,n){const i=[];function r(o){if(n!=null&&i.length>=n||!o)return i;if(QO(o)&&o.scrollingElement!=null&&!i.includes(o.scrollingElement))return i.push(o.scrollingElement),i;if(!MC(o)||Mde(o)||i.includes(o))return i;const s=wl(e).getComputedStyle(o);return o!==e&&Tat(o,s)&&i.push(o),zat(o,s)?i:r(o.parentNode)}return e?r(e):i}function Bde(e){const[n]=ZO(e,1);return n??null}function X6(e){return!OA||!e?null:I1(e)?e:XO(e)?QO(e)||e===P1(e).scrollingElement?window:MC(e)?e:null:null}function Fde(e){return I1(e)?e.scrollX:e.scrollLeft}function Wde(e){return I1(e)?e.scrollY:e.scrollTop}function y8(e){return{x:Fde(e),y:Wde(e)}}var Us;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Us||(Us={}));function Ude(e){return!OA||!e?!1:e===document.scrollingElement}function Hde(e){const n={x:0,y:0},i=Ude(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-i.width,y:e.scrollHeight-i.height},o=e.scrollTop<=n.y,s=e.scrollLeft<=n.x,a=e.scrollTop>=r.y,c=e.scrollLeft>=r.x;return{isTop:o,isLeft:s,isBottom:a,isRight:c,maxScroll:r,minScroll:n}}const Eat={x:.2,y:.2};function Mat(e,n,i,r,o){let{top:s,left:a,right:c,bottom:u}=i;r===void 0&&(r=10),o===void 0&&(o=Eat);const{isTop:m,isBottom:h,isLeft:g,isRight:x}=Hde(e),y={x:0,y:0},w={x:0,y:0},j={height:n.height*o.y,width:n.width*o.x};return!m&&s<=n.top+j.height?(y.y=Us.Backward,w.y=r*Math.abs((n.top+j.height-s)/j.height)):!h&&u>=n.bottom-j.height&&(y.y=Us.Forward,w.y=r*Math.abs((n.bottom-j.height-u)/j.height)),!x&&c>=n.right-j.width?(y.x=Us.Forward,w.x=r*Math.abs((n.right-j.width-c)/j.width)):!g&&a<=n.left+j.width&&(y.x=Us.Backward,w.x=r*Math.abs((n.left+j.width-a)/j.width)),{direction:y,speed:w}}function Rat(e){if(e===document.scrollingElement){const{innerWidth:s,innerHeight:a}=window;return{top:0,left:0,right:s,bottom:a,width:s,height:a}}const{top:n,left:i,right:r,bottom:o}=e.getBoundingClientRect();return{top:n,left:i,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function qde(e){return e.reduce((n,i)=>$b(n,y8(i)),Nu)}function Oat(e){return e.reduce((n,i)=>n+Fde(i),0)}function Dat(e){return e.reduce((n,i)=>n+Wde(i),0)}function Gde(e,n){if(n===void 0&&(n=A1),!e)return;const{top:i,left:r,bottom:o,right:s}=n(e);Bde(e)&&(o<=0||s<=0||i>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const Lat=[["x",["left","right"],Oat],["y",["top","bottom"],Dat]];class JO{constructor(n,i){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=ZO(i),o=qde(r);this.rect={...n},this.width=n.width,this.height=n.height;for(const[s,a,c]of Lat)for(const u of a)Object.defineProperty(this,u,{get:()=>{const m=c(r),h=o[s]-m;return this.rect[u]+h},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class p_{constructor(n){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(i=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...i)})},this.target=n}add(n,i,r){var o;(o=this.target)==null||o.addEventListener(n,i,r),this.listeners.push([n,i,r])}}function Bat(e){const{EventTarget:n}=wl(e);return e instanceof n?e:P1(e)}function Q6(e,n){const i=Math.abs(e.x),r=Math.abs(e.y);return typeof n=="number"?Math.sqrt(i**2+r**2)>n:"x"in n&&"y"in n?i>n.x&&r>n.y:"x"in n?i>n.x:"y"in n?r>n.y:!1}var Cd;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Cd||(Cd={}));function mY(e){e.preventDefault()}function Fat(e){e.stopPropagation()}var Hi;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(Hi||(Hi={}));const Vde={start:[Hi.Space,Hi.Enter],cancel:[Hi.Esc],end:[Hi.Space,Hi.Enter,Hi.Tab]}
12100,Wat=(e,n)=>{let{currentCoordinates:i}=n;switch(e.code){case Hi.Right:return{...i,x:i.x+25};case Hi.Left:return{...i,x:i.x-25};case Hi.Down:return{...i,y:i.y+25};case Hi.Up:return{...i,y:i.y-25}}};class Kde{constructor(n){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=n;const{event:{target:i}}=n;this.props=n,this.listeners=new p_(P1(i)),this.windowListeners=new p_(wl(i)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Cd.Resize,this.handleCancel),this.windowListeners.add(Cd.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Cd.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:n,onStart:i}=this.props,r=n.node.current;r&&Gde(r),i(Nu)}handleKeyDown(n){if(LA(n)){const{active:i,context:r,options:o}=this.props,{keyboardCodes:s=Vde,coordinateGetter:a=Wat,scrollBehavior:c="smooth"}=o,{code:u}=n;if(s.end.includes(u)){this.handleEnd(n);return}if(s.cancel.includes(u)){this.handleCancel(n);return}const{collisionRect:m}=r.current,h=m?{x:m.left,y:m.top}:Nu;this.referenceCoordinates||(this.referenceCoordinates=h);const g=a(n,{active:i,context:r.current,currentCoordinates:h});if(g){const x=QI(g,h),y={x:0,y:0},{scrollableAncestors:w}=r.current;for(const j of w){const v=n.code,{isTop:_,isRight:$,isLeft:k,isBottom:P,maxScroll:S,minScroll:I}=Hde(j),A=Rat(j),E={x:Math.min(v===Hi.Right?A.right-A.width/2:A.right,Math.max(v===Hi.Right?A.left:A.left+A.width/2,g.x)),y:Math.min(v===Hi.Down?A.bottom-A.height/2:A.bottom,Math.max(v===Hi.Down?A.top:A.top+A.height/2,g.y))},B=v===Hi.Right&&!$||v===Hi.Left&&!k,T=v===Hi.Down&&!P||v===Hi.Up&&!_;if(B&&E.x!==g.x){const M=j.scrollLeft+x.x,R=v===Hi.Right&&M<=S.x||v===Hi.Left&&M>=I.x;if(R&&!x.y){j.scrollTo({left:M,behavior:c});return}R?y.x=j.scrollLeft-M:y.x=v===Hi.Right?j.scrollLeft-S.x:j.scrollLeft-I.x,y.x&&j.scrollBy({left:-y.x,behavior:c});break}else if(T&&E.y!==g.y){const M=j.scrollTop+x.y,R=v===Hi.Down&&M<=S.y||v===Hi.Up&&M>=I.y;if(R&&!x.x){j.scrollTo({top:M,behavior:c});return}R?y.y=j.scrollTop-M:y.y=v===Hi.Down?j.scrollTop-S.y:j.scrollTop-I.y,y.y&&j.scrollBy({top:-y.y,behavior:c});break}}this.handleMove(n,$b(QI(g,this.referenceCoordinates),y))}}}handleMove(n,i){const{onMove:r}=this.props;n.preventDefault(),r(i)}handleEnd(n){const{onEnd:i}=this.props;n.preventDefault(),this.detach(),i()}handleCancel(n){const{onCancel:i}=this.props;n.preventDefault(),this.detach(),i()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Kde.activators=[{eventName:"onKeyDown",handler:(e,n,i)=>{let{keyboardCodes:r=Vde,onActivation:o}=n,{active:s}=i;const{code:a}=e.nativeEvent;if(r.start.includes(a)){const c=s.activatorNode.current;return c&&e.target!==c?!1:(e.preventDefault(),o?.({event:e.nativeEvent}),!0)}return!1}}];function hY(e){return!!(e&&"distance"in e)}function fY(e){return!!(e&&"delay"in e)}class eD{constructor(n,i,r){var o;r===void 0&&(r=Bat(n.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=n,this.events=i;const{event:s}=n,{target:a}=s;this.props=n,this.events=i,this.document=P1(a),this.documentListeners=new p_(this.document),this.listeners=new p_(r),this.windowListeners=new p_(wl(a)),this.initialCoordinates=(o=ZI(s))!=null?o:Nu,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:n,props:{options:{activationConstraint:i,bypassActivationConstraint:r}}}=this;if(this.listeners.add(n.move.name,this.handleMove,{passive:!1}),this.listeners.add(n.end.name,this.handleEnd),n.cancel&&this.listeners.add(n.cancel.name,this.handleCancel),this.windowListeners.add(Cd.Resize,this.handleCancel),this.windowListeners.add(Cd.DragStart,mY),this.windowListeners.add(Cd.VisibilityChange,this.handleCancel),this.windowListeners.add(Cd.ContextMenu,mY),this.documentListeners.add(Cd.Keydown,this.handleKeydown),i){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(fY(i)){this.timeoutId=setTimeout(this.handleStart,i.delay),this.handlePending(i);return}if(hY(i)){this.handlePending(i);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(n,i){const{active:r,onPending:o}=this.props;o(r,n,this.initialCoordinates,i)}handleStart(){const{initialCoordinates:n}=this,{onStart:i}=this.props;n&&(this.activated=!0,this.documentListeners.add(Cd.Click,Fat,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Cd.SelectionChange,this.removeTextSelection),i(n))}handleMove(n){var i;const{activated:r,initialCoordinates:o,props:s}=this,{onMove:a,options:{activationConstraint:c}}=s;
12100if(!o)return;const u=(i=ZI(n))!=null?i:Nu,m=QI(o,u);if(!r&&c){if(hY(c)){if(c.tolerance!=null&&Q6(m,c.tolerance))return this.handleCancel();if(Q6(m,c.distance))return this.handleStart()}if(fY(c)&&Q6(m,c.tolerance))return this.handleCancel();this.handlePending(c,m);return}n.cancelable&&n.preventDefault(),a(u)}handleEnd(){const{onAbort:n,onEnd:i}=this.props;this.detach(),this.activated||n(this.props.active),i()}handleCancel(){const{onAbort:n,onCancel:i}=this.props;this.detach(),this.activated||n(this.props.active),i()}handleKeydown(n){n.code===Hi.Esc&&this.handleCancel()}removeTextSelection(){var n;(n=this.document.getSelection())==null||n.removeAllRanges()}}const Uat={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class tD extends eD{constructor(n){const{event:i}=n,r=P1(i.target);super(n,Uat,r)}}tD.activators=[{eventName:"onPointerDown",handler:(e,n)=>{let{nativeEvent:i}=e,{onActivation:r}=n;return!i.isPrimary||i.button!==0?!1:(r?.({event:i}),!0)}}];const Hat={move:{name:"mousemove"},end:{name:"mouseup"}};var x8;(function(e){e[e.RightClick=2]="RightClick"})(x8||(x8={}));class qat extends eD{constructor(n){super(n,Hat,P1(n.event.target))}}qat.activators=[{eventName:"onMouseDown",handler:(e,n)=>{let{nativeEvent:i}=e,{onActivation:r}=n;return i.button===x8.RightClick?!1:(r?.({event:i}),!0)}}];const Z6={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Gat extends eD{constructor(n){super(n,Z6)}static setup(){return window.addEventListener(Z6.move.name,n,{capture:!1,passive:!1}),function(){window.removeEventListener(Z6.move.name,n)};function n(){}}}Gat.activators=[{eventName:"onTouchStart",handler:(e,n)=>{let{nativeEvent:i}=e,{onActivation:r}=n;const{touches:o}=i;return o.length>1?!1:(r?.({event:i}),!0)}}];var m_;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(m_||(m_={}));var eP;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(eP||(eP={}));function Vat(e){let{acceleration:n,activator:i=m_.Pointer,canScroll:r,draggingRect:o,enabled:s,interval:a=5,order:c=eP.TreeOrder,pointerCoordinates:u,scrollableAncestors:m,scrollableAncestorRects:h,delta:g,threshold:x}=e;const y=Yat({delta:g,disabled:!s}),[w,j]=iat(),v=l.useRef({x:0,y:0}),_=l.useRef({x:0,y:0}),$=l.useMemo(()=>{switch(i){case m_.Pointer:return u?{top:u.y,bottom:u.y,left:u.x,right:u.x}:null;case m_.DraggableRect:return o}},[i,o,u]),k=l.useRef(null),P=l.useCallback(()=>{const I=k.current;if(!I)return;const A=v.current.x*_.current.x,E=v.current.y*_.current.y;I.scrollBy(A,E)},[]),S=l.useMemo(()=>c===eP.TreeOrder?[...m].reverse():m,[c,m]);l.useEffect(()=>{if(!s||!m.length||!$){j();return}for(const I of S){if(r?.(I)===!1)continue;const A=m.indexOf(I),E=h[A];if(!E)continue;const{direction:B,speed:T}=Mat(I,E,$,n,x);for(const M of["x","y"])y[M][B[M]]||(T[M]=0,B[M]=0);if(T.x>0||T.y>0){j(),k.current=I,w(P,a),v.current=T,_.current=B;return}}v.current={x:0,y:0},_.current={x:0,y:0},j()},[n,P,r,j,s,a,JSON.stringify($),JSON.stringify(y),w,m,S,h,JSON.stringify(x)])}const Kat={x:{[Us.Backward]:!1,[Us.Forward]:!1},y:{[Us.Backward]:!1,[Us.Forward]:!1}};function Yat(e){let{delta:n,disabled:i}=e;const r=XI(n);return RC(o=>
12100{if(i||!r||!o)return Kat;const s={x:Math.sign(n.x-r.x),y:Math.sign(n.y-r.y)};return{x:{[Us.Backward]:o.x[Us.Backward]||s.x===-1,[Us.Forward]:o.x[Us.Forward]||s.x===1},y:{[Us.Backward]:o.y[Us.Backward]||s.y===-1,[Us.Forward]:o.y[Us.Forward]||s.y===1}}},[i,n,r])}function Xat(e,n){const i=n!=null?e.get(n):void 0,r=i?i.node.current:null;return RC(o=>{var s;return n==null?null:(s=r??o)!=null?s:null},[r,n])}function Qat(e,n){return l.useMemo(()=>e.reduce((i,r)=>{const{sensor:o}=r,s=o.activators.map(a=>({eventName:a.eventName,handler:n(a.handler,r)}));return[...i,...s]},[]),[e,n])}var U_;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(U_||(U_={}));var b8;(function(e){e.Optimized="optimized"})(b8||(b8={}));const gY=new Map;function Zat(e,n){let{dragging:i,dependencies:r,config:o}=n;const[s,a]=l.useState(null),{frequency:c,measure:u,strategy:m}=o,h=l.useRef(e),g=v(),x=W_(g),y=l.useCallback(function(_){_===void 0&&(_=[]),!x.current&&a($=>$===null?_:$.concat(_.filter(k=>!$.includes(k))))},[x]),w=l.useRef(null),j=RC(_=>{if(g&&!i)return gY;if(!_||_===gY||h.current!==e||s!=null){const $=new Map;for(let k of e){if(!k)continue;if(s&&s.length>0&&!s.includes(k.id)&&k.rect.current){$.set(k.id,k.rect.current);continue}const P=k.node.current,S=P?new JO(u(P),P):null;k.rect.current=S,S&&$.set(k.id,S)}return $}return _},[e,s,i,g,u]);return l.useEffect(()=>{h.current=e},[e]),l.useEffect(()=>{g||y()},[i,g]),l.useEffect(()=>{s&&s.length>0&&a(null)},[JSON.stringify(s)]),l.useEffect(()=>{g||typeof c!="number"||w.current!==null||(w.current=setTimeout(()=>{y(),w.current=null},c))},[c,g,y,...r]),{droppableRects:j,measureDroppableContainers:y,measuringScheduled:s!=null};function v(){switch(m){case U_.Always:return!1;case U_.BeforeDragging:return i;default:return!i}}}function nD(e,n){return RC(i=>e?i||(typeof n=="function"?n(e):e):null,[n,e])}function Jat(e,n){return nD(e,n)}function elt(e){let{callback:n,disabled:i}=e;const r=DA(n),o=l.useMemo(()=>{if(i||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:s}=window;return new s(r)},[r,i]);return l.useEffect(()=>()=>o?.disconnect(),[o]),o}function BA(e){let{callback:n,disabled:i}=e;const r=DA(n),o=l.useMemo(()=>{if(i||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:s}=window;return new s(r)},[i]);return l.useEffect(()=>()=>o?.disconnect(),[o]),o}function tlt(e){return new JO(A1(e),e)}function yY(e,n,i){n===void 0&&(n=tlt);const[r,o]=l.useState(null);function s(){o(u=>{if(!e)return null;if(e.isConnected===!1){var m;return(m=u??i)!=null?m:null}const h=n(e);return JSON.stringify(u)===JSON.stringify(h)?u:h})}const a=elt({callback(u){if(e)for(const m of u){const{type:h,target:g}=m;if(h==="childList"&&g instanceof HTMLElement&&g.contains(e)){s();break}}}}),c=BA({callback:s});return Au(()=>{s(),e?(c?.observe(e),a?.observe(document.body,{childList:!0,subtree:!0})):(c?.disconnect(),a?.disconnect())},[e]),r}function nlt(e){const n=nD(e);return Dde(e,n)}const xY=[];function ilt(e){const n=l.useRef(e),i=RC(r=>e?r&&r!==xY&&e&&n.current&&e.parentNode===n.current.parentNode?r:ZO(e):xY,[e]);return l.useEffect(()=>{n.current=e},[e]),i}function rlt(e){const[n,i]=l.useState(null),r=l.useRef(e),o=l.useCallback(s=>{const a=X6(s.target);a&&i(c=>c?(c.set(a,y8(a)),new Map(c)):null)},[]);return l.useEffect(()=>{const s=r.current;if(e!==s){a(s);const c=e.map(u=>{const m=X6(u);return m?(m.addEventListener("scroll",o,{passive:!0}),[m,y8(m)]):null}).filter(u=>u!=null);i(c.length?new Map(c):null),r.current=e}return()=>{a(e),a(s)};function a(c){c.forEach(u=>{const m=X6(u);m?.removeEventListener("scroll",o)})}},[o,e]),l.useMemo(()=>e.length?n?Array.from(n.values()).reduce((s,a)=>$b(s,a),Nu):qde(e):Nu,[e,n])}function bY(e,n){n===void 0&&(n=[]);const i=l.useRef(null);return l.useEffect(()=>{i.current=null},n),l.useEffect(()=>{const r=e!==Nu;r&&!i.current&&(i.current=e),!r&&i.current&&(i.current=null)},[e]),i.current?QI(e,i.current):Nu}function olt(e){l.useEffect(()=>{if(!OA)return;const n=e.map(i=>{let{sensor:r}=i;return r.setup==null?void 0:r.setup()});return()=>{for(const i of n)i?.()}},e.map(n=>{let{sensor:i}=n;return i}))}function slt(e,n){return l.useMemo(()=>e.reduce((i,r)=>{let{eventName:o,handler:s}
12100=r;return i[o]=a=>{s(a,n)},i},{}),[e,n])}function Yde(e){return l.useMemo(()=>e?Nat(e):null,[e])}const vY=[];function alt(e,n){n===void 0&&(n=A1);const[i]=e,r=Yde(i?wl(i):null),[o,s]=l.useState(vY);function a(){s(()=>e.length?e.map(u=>Ude(u)?r:new JO(n(u),u)):vY)}const c=BA({callback:a});return Au(()=>{c?.disconnect(),a(),e.forEach(u=>c?.observe(u))},[e]),o}function Xde(e){if(!e)return null;if(e.children.length>1)return e;const n=e.children[0];return MC(n)?n:e}function llt(e){let{measure:n}=e;const[i,r]=l.useState(null),o=l.useCallback(m=>{for(const{target:h}of m)if(MC(h)){r(g=>{const x=n(h);return g?{...g,width:x.width,height:x.height}:x});break}},[n]),s=BA({callback:o}),a=l.useCallback(m=>{const h=Xde(m);s?.disconnect(),h&&s?.observe(h),r(h?n(h):null)},[n,s]),[c,u]=YI(a);return l.useMemo(()=>({nodeRef:c,rect:i,setRef:u}),[i,c,u])}const clt=[{sensor:tD,options:{}},{sensor:Kde,options:{}}],dlt={current:{}},z5={draggable:{measure:pY},droppable:{measure:pY,strategy:U_.WhileDragging,frequency:b8.Optimized},dragOverlay:{measure:A1}};class h_ extends Map{get(n){var i;return n!=null&&(i=super.get(n))!=null?i:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(n=>{let{disabled:i}=n;return!i})}getNodeFor(n){var i,r;return(i=(r=this.get(n))==null?void 0:r.node.current)!=null?i:void 0}}const ult={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new h_,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:JI},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:z5,measureDroppableContainers:JI,windowRect:null,measuringScheduled:!1},Qde={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:JI,draggableNodes:new Map,over:null,measureDroppableContainers:JI},DC=l.createContext(Qde),Zde=l.createContext(ult);function plt(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new h_}}}function mlt(e,n){switch(n.type){case ws.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:n.initialCoordinates,active:n.active}};case ws.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:n.coordinates.x-e.draggable.initialCoordinates.x,y:n.coordinates.y-e.draggable.initialCoordinates.y}}};case ws.DragEnd:case ws.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case ws.RegisterDroppable:{const{element:i}=n,{id:r}=i,o=new h_(e.droppable.containers);return o.set(r,i),{...e,droppable:{...e.droppable,containers:o}}}case ws.SetDroppableDisabled:{const{id:i,key:r,disabled:o}=n,s=e.droppable.containers.get(i);if(!s||r!==s.key)return e;const a=new h_(e.droppable.containers);return a.set(i,{...s,disabled:o}),{...e,droppable:{...e.droppable,containers:a}}}case ws.UnregisterDroppable:{const{id:i,key:r}=n,o=e.droppable.containers.get(i);if(!o||r!==o.key)return e;const s=new h_(e.droppable.containers);return s.delete(i),{...e,droppable:{...e.droppable,containers:s}}}default:return e}}function hlt(e){let{disabled:n}=e;const{active:i,activatorEvent:r,draggableNodes:o}=l.useContext(DC),s=XI(r),a=XI(i?.id);return l.useEffect(()=>{if(!n&&!r&&s&&a!=null){if(!LA(s)||document.activeElement===s.target)return;const c=o.get(a);if(!c)return;const{activatorNode:u,node:m}=c;if(!u.current&&!m.current)return;requestAnimationFrame(()=>{for(const h of[u.current,m.current]){if(!h)continue;const g=sat(h);if(g){g.focus();break}}})}},[r,n,o,a,s]),null}function Jde(e,n){let{transform:i,...r}=n;return e!=null&&e.length?e.reduce((o,s)=>s({transform:o,...r}),i):i}function flt(e){return l.useMemo(()=>({draggable:{...z5.draggable,...e?.draggable},droppable:{...z5.droppable,...e?.droppable},dragOverlay:{...z5.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function glt(e){let{activeNode:n,measure:i,initialRect:r,config:o=!0}=e;const s=l.useRef(!1),{x:a,y:c}=typeof o=="boolean"?{x:o,y:o}:o;Au(()=>{if(!a&&!c||!n){s.current=!1;return}if(s.current||!r)return;const m=n?.node.current;if(!m||m.isConnected===!1)return;const h=i(m),g=Dde(h,r);if(a||(g.x=0),c||(g.y=0),s.current=!0,Math.abs(g.x)>0||Math.abs(g.y)>0){const x=Bde(m);x&&x.scrollBy({top:g.y,left:g.x})}},[n,a,c,r,i])}const FA=l.createContext({...Nu,scaleX:1,scaleY:1}
12100);var df;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(df||(df={}));const ylt=l.memo(function(n){var i,r,o,s;let{id:a,accessibility:c,autoScroll:u=!0,children:m,sensors:h=clt,collisionDetection:g=Sat,measuring:x,modifiers:y,...w}=n;const j=l.useReducer(mlt,void 0,plt),[v,_]=j,[$,k]=pat(),[P,S]=l.useState(df.Uninitialized),I=P===df.Initialized,{draggable:{active:A,nodes:E,translate:B},droppable:{containers:T}}=v,M=A!=null?E.get(A):null,R=l.useRef({initial:null,translated:null}),F=l.useMemo(()=>{var lt;return A!=null?{id:A,data:(lt=M?.data)!=null?lt:dlt,rect:R}:null},[A,M]),Y=l.useRef(null),[H,U]=l.useState(null),[X,Q]=l.useState(null),K=W_(w,Object.values(w)),G=OC("DndDescribedBy",a),L=l.useMemo(()=>T.getEnabled(),[T]),q=flt(x),{droppableRects:W,measureDroppableContainers:oe,measuringScheduled:se}=Zat(L,{dragging:I,dependencies:[B.x,B.y],config:q.droppable}),de=Xat(E,A),le=l.useMemo(()=>X?ZI(X):null,[X]),me=ze(),ee=Jat(de,q.draggable.measure);glt({activeNode:A!=null?E.get(A):null,config:me.layoutShiftCompensation,initialRect:ee,measure:q.draggable.measure});const ne=yY(de,q.draggable.measure,ee),Ae=yY(de?de.parentElement:null),_e=l.useRef({activatorEvent:null,active:null,activeNode:de,collisionRect:null,collisions:null,droppableRects:W,draggableNodes:E,draggingNode:null,draggingNodeRect:null,droppableContainers:T,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),we=T.getNodeFor((i=_e.current.over)==null?void 0:i.id),Ke=llt({measure:q.dragOverlay.measure}),ce=(r=Ke.nodeRef.current)!=null?r:de,ie=I?(o=Ke.rect)!=null?o:ne:null,Re=!!(Ke.nodeRef.current&&Ke.rect),Be=nlt(Re?null:ne),tt=Yde(ce?wl(ce):null),dt=ilt(I?we??de:null),je=alt(dt),Me=Jde(y,{transform:{x:B.x-Be.x,y:B.y-Be.y,scaleX:1,scaleY:1},activatorEvent:X,active:F,activeNodeRect:ne,containerNodeRect:Ae,draggingNodeRect:ie,over:_e.current.over,overlayNodeRect:Ke.rect,scrollableAncestors:dt,scrollableAncestorRects:je,windowRect:tt}),Se=le?$b(le,B):null,it=rlt(dt),De=bY(it),te=bY(it,[ne]),ge=$b(Me,De),Je=ie?Iat(ie,Me):null,Ee=F&&Je?g({active:F,collisionRect:Je,droppableRects:W,droppableContainers:L,pointerCoordinates:Se}):null,Xe=jat(Ee,"id"),[yt,Ne]=l.useState(null),Le=Re?Me:$b(Me,te),Ue=kat(Le,(s=yt?.rect)!=null?s:null,ne),We=l.useRef(null),Qe=l.useCallback((lt,vt)=>{let{sensor:Wt,options:Qt}=vt;if(Y.current==null)return;const Yt=E.get(Y.current);if(!Yt)return;const Zt=lt.nativeEvent,tn=new Wt({active:Y.current,activeNode:Yt,event:Zt,options:Qt,context:_e,onAbort(xn){if(!E.get(xn))return;const{onDragAbort:Ct}=K.current,Ie={id:xn};Ct?.(Ie),$({type:"onDragAbort",event:Ie})},onPending(xn,st,Ct,Ie){if(!E.get(xn))return;const{onDragPending:Fe}=K.current,Ge={id:xn,constraint:st,initialCoordinates:Ct,offset:Ie};Fe?.(Ge),$({type:"onDragPending",event:Ge})},onStart(xn){const st=Y.current;if(st==null)return;const Ct=E.get(st);if(!Ct)return;const{onDragStart:Ie}=K.current,ae={activatorEvent:Zt,active:{id:st,data:Ct.data,rect:R}};jr.unstable_batchedUpdates(()=>{Ie?.(ae),S(df.Initializing),_({type:ws.DragStart,initialCoordinates:xn,active:st}),$({type:"onDragStart",event:ae}),U(We.current),Q(Zt)})},onMove(xn){_({type:ws.DragMove,coordinates:xn})},onEnd:nn(ws.DragEnd),onCancel:nn(ws.DragCancel)});We.current=tn;function nn(xn){return async function(){const{active:Ct,collisions:Ie,over:ae,scrollAdjustedTranslate:Fe}=_e.current;let Ge=null;if(Ct&&Fe){const{cancelDrop:wt}=K.current;Ge={activatorEvent:Zt,active:Ct,collisions:Ie,delta:Fe,over:ae},xn===ws.DragEnd&&typeof wt=="function"&&await Promise.resolve(wt(Ge))&&(xn=ws.DragCancel)}Y.current=null,jr.unstable_batchedUpdates(()=>{_({type:xn}),S(df.Uninitialized),Ne(null),U(null),Q(null),We.current=null;const wt=xn===ws.DragEnd?"onDragEnd":"onDragCancel";if(Ge){const ke=K.current[wt];ke?.(Ge),$({type:wt,event:Ge})}})}}},[E]),ht=l.useCallback((lt,vt)=>(Wt,Qt)=>{const Yt=Wt.nativeEvent,Zt=E.get(Qt);if(Y.current!==null||!Zt||Yt.dndKit||Yt.defaultPrevented)return;const tn={active:Zt};lt(Wt,vt.options,tn)===!0&&(Yt.dndKit={capturedBy:vt.sensor},Y.current=Qt,Qe(Wt,vt))},[E,Qe]),pe=Qat(h,ht);olt(h),Au(()=>{ne&&P===df.Initializing&&S(df.Initialized)},[ne,P]),l.useEffect(()=>{const{onDragMove:lt}
12100=K.current,{active:vt,activatorEvent:Wt,collisions:Qt,over:Yt}=_e.current;if(!vt||!Wt)return;const Zt={active:vt,activatorEvent:Wt,collisions:Qt,delta:{x:ge.x,y:ge.y},over:Yt};jr.unstable_batchedUpdates(()=>{lt?.(Zt),$({type:"onDragMove",event:Zt})})},[ge.x,ge.y]),l.useEffect(()=>{const{active:lt,activatorEvent:vt,collisions:Wt,droppableContainers:Qt,scrollAdjustedTranslate:Yt}=_e.current;if(!lt||Y.current==null||!vt||!Yt)return;const{onDragOver:Zt}=K.current,tn=Qt.get(Xe),nn=tn&&tn.rect.current?{id:tn.id,rect:tn.rect.current,data:tn.data,disabled:tn.disabled}:null,xn={active:lt,activatorEvent:vt,collisions:Wt,delta:{x:Yt.x,y:Yt.y},over:nn};jr.unstable_batchedUpdates(()=>{Ne(nn),Zt?.(xn),$({type:"onDragOver",event:xn})})},[Xe]),Au(()=>{_e.current={activatorEvent:X,active:F,activeNode:de,collisionRect:Je,collisions:Ee,droppableRects:W,draggableNodes:E,draggingNode:ce,draggingNodeRect:ie,droppableContainers:T,over:yt,scrollableAncestors:dt,scrollAdjustedTranslate:ge},R.current={initial:ie,translated:Je}},[F,de,Ee,Je,E,ce,ie,W,T,yt,dt,ge]),Vat({...me,delta:B,draggingRect:Je,pointerCoordinates:Se,scrollableAncestors:dt,scrollableAncestorRects:je});const be=l.useMemo(()=>({active:F,activeNode:de,activeNodeRect:ne,activatorEvent:X,collisions:Ee,containerNodeRect:Ae,dragOverlay:Ke,draggableNodes:E,droppableContainers:T,droppableRects:W,over:yt,measureDroppableContainers:oe,scrollableAncestors:dt,scrollableAncestorRects:je,measuringConfiguration:q,measuringScheduled:se,windowRect:tt}),[F,de,ne,X,Ee,Ae,Ke,E,T,W,yt,oe,dt,je,q,se,tt]),rt=l.useMemo(()=>({activatorEvent:X,activators:pe,active:F,activeNodeRect:ne,ariaDescribedById:{draggable:G},dispatch:_,draggableNodes:E,over:yt,measureDroppableContainers:oe}),[X,pe,F,ne,_,G,E,yt,oe]);return fr.createElement(Ode.Provider,{value:k},fr.createElement(DC.Provider,{value:rt},fr.createElement(Zde.Provider,{value:be},fr.createElement(FA.Provider,{value:Ue},m)),fr.createElement(hlt,{disabled:c?.restoreFocus===!1})),fr.createElement(fat,{...c,hiddenTextDescribedById:G}));function ze(){const lt=H?.autoScrollEnabled===!1,vt=typeof u=="object"?u.enabled===!1:u===!1,Wt=I&&!lt&&!vt;return typeof u=="object"?{...u,enabled:Wt}:{enabled:Wt}}}),xlt=l.createContext(null),wY="button",blt="Draggable";function vlt(e){let{id:n,data:i,disabled:r=!1,attributes:o}=e;const s=OC(blt),{activators:a,activatorEvent:c,active:u,activeNodeRect:m,ariaDescribedById:h,draggableNodes:g,over:x}=l.useContext(DC),{role:y=wY,roleDescription:w="draggable",tabIndex:j=0}=o??{},v=u?.id===n,_=l.useContext(v?FA:xlt),[$,k]=YI(),[P,S]=YI(),I=slt(a,n),A=W_(i);Au(()=>(g.set(n,{id:n,key:s,node:$,activatorNode:P,data:A}),()=>{const B=g.get(n);B&&B.key===s&&g.delete(n)}),[g,n]);const E=l.useMemo(()=>({role:y,tabIndex:j,"aria-disabled":r,"aria-pressed":v&&y===wY?!0:void 0,"aria-roledescription":w,"aria-describedby":h.draggable}),[r,y,j,v,w,h.draggable]);return{active:u,activatorEvent:c,activeNodeRect:m,attributes:E,isDragging:v,listeners:r?void 0:I,node:$,over:x,setNodeRef:k,setActivatorNodeRef:S,transform:_}}function eue(){return l.useContext(Zde)}const wlt="Droppable",jlt={timeout:25};function tue(e){let{data:n,disabled:i=!1,id:r,resizeObserverConfig:o}=e;const s=OC(wlt),{active:a,dispatch:c,over:u,measureDroppableContainers:m}=l.useContext(DC),h=l.useRef({disabled:i}),g=l.useRef(!1),x=l.useRef(null),y=l.useRef(null),{disabled:w,updateMeasurementsFor:j,timeout:v}={...jlt,...o},_=W_(j??r),$=l.useCallback(()=>{if(!g.current){g.current=!0;return}y.current!=null&&clearTimeout(y.current),y.current=setTimeout(()=>{m(Array.isArray(_.current)?_.current:[_.current]),y.current=null},v)},[v]),k=BA({callback:$,disabled:w||!a}),P=l.useCallback((E,B)=>{k&&(B&&(k.unobserve(B),g.current=!1),E&&k.observe(E))},[k]),[S,I]=YI(P),A=W_(n);return l.useEffect(()=>{!k||!S.current||(k.disconnect(),g.current=!1,k.observe(S.current))},[S,k]),l.useEffect(()=>(c({type:ws.RegisterDroppable,element:{id:r,key:s,disabled:i,node:S,rect:x,data:A}}),()=>c({type:ws.UnregisterDroppable,key:s,id:r})),[r]),l.useEffect(()=>{i!==h.current.disabled&&(c({type:ws.SetDroppableDisabled,id:r,key:s,disabled:i}),h.current.disabled=i)},[r,s,i,c]),{active:a,rect:x,isOver:u?.id===r,node:S,over:u,setNodeRef:I}}function _lt(e){let{animation:n,children:i}=e;const[r,o]=l.useState(null),[s,a]=l.useState(null),c=XI(i);return!i&&!r&&c&&o(c),Au(()=>{if(!s)return;const u=r?.key,m=r?.props.id;if(u==null||m==null){o(null);return}Promise.resolve(n(m,s)).then(()=>{o(null)})},[n,r,s]),fr.createElement(fr.Fragment,null,i,r?l.cloneElement(r,{ref:a}):null)}const Clt={x:0,y:0,scaleX:1,scaleY:1};function Slt(e){let{children:n}=e;return fr.createElement(DC.Provider,{value:Qde},fr.createElement(FA.Provider,{value:Clt},n))}const klt={position:"fixed",touchAction:"none"},$lt=e=>
12100LA(e)?"transform 250ms ease":void 0,Ilt=l.forwardRef((e,n)=>{let{as:i,activatorEvent:r,adjustScale:o,children:s,className:a,rect:c,style:u,transform:m,transition:h=$lt}=e;if(!c)return null;const g=o?m:{...m,scaleX:1,scaleY:1},x={...klt,width:c.width,height:c.height,top:c.top,left:c.left,transform:Tf.Transform.toString(g),transformOrigin:o&&r?bat(r,c):void 0,transition:typeof h=="function"?h(r):h,...u};return fr.createElement(i,{className:a,style:x,ref:n},s)}),Plt=e=>n=>{let{active:i,dragOverlay:r}=n;const o={},{styles:s,className:a}=e;if(s!=null&&s.active)for(const[c,u]of Object.entries(s.active))u!==void 0&&(o[c]=i.node.style.getPropertyValue(c),i.node.style.setProperty(c,u));if(s!=null&&s.dragOverlay)for(const[c,u]of Object.entries(s.dragOverlay))u!==void 0&&r.node.style.setProperty(c,u);return a!=null&&a.active&&i.node.classList.add(a.active),a!=null&&a.dragOverlay&&r.node.classList.add(a.dragOverlay),function(){for(const[u,m]of Object.entries(o))i.node.style.setProperty(u,m);a!=null&&a.active&&i.node.classList.remove(a.active)}},Alt=e=>{let{transform:{initial:n,final:i}}=e;return[{transform:Tf.Transform.toString(n)},{transform:Tf.Transform.toString(i)}]},Nlt={duration:250,easing:"ease",keyframes:Alt,sideEffects:Plt({styles:{active:{opacity:"0"}}})};function zlt(e){let{config:n,draggableNodes:i,droppableContainers:r,measuringConfiguration:o}=e;return DA((s,a)=>{if(n===null)return;const c=i.get(s);if(!c)return;const u=c.node.current;if(!u)return;const m=Xde(a);if(!m)return;const{transform:h}=wl(a).getComputedStyle(a),g=Lde(h);if(!g)return;const x=typeof n=="function"?n:Tlt(n);return Gde(u,o.draggable.measure),x({active:{id:s,data:c.data,node:u,rect:o.draggable.measure(u)},draggableNodes:i,dragOverlay:{node:a,rect:o.dragOverlay.measure(m)},droppableContainers:r,measuringConfiguration:o,transform:g})})}function Tlt(e){const{duration:n,easing:i,sideEffects:r,keyframes:o}={...Nlt,...e};return s=>{let{active:a,dragOverlay:c,transform:u,...m}=s;if(!n)return;const h={x:c.rect.left-a.rect.left,y:c.rect.top-a.rect.top},g={scaleX:u.scaleX!==1?a.rect.width*u.scaleX/c.rect.width:1,scaleY:u.scaleY!==1?a.rect.height*u.scaleY/c.rect.height:1},x={x:u.x-h.x,y:u.y-h.y,...g},y=o({...m,active:a,dragOverlay:c,transform:{initial:u,final:x}}),[w]=y,j=y[y.length-1];if(JSON.stringify(w)===JSON.stringify(j))return;const v=r?.({active:a,dragOverlay:c,...m}),_=c.node.animate(y,{duration:n,easing:i,fill:"forwards"});return new Promise($=>{_.onfinish=()=>{v?.(),$()}})}}let jY=0;function Elt(e){return l.useMemo(()=>{if(e!=null)return jY++,jY},[e])}const Mlt=fr.memo(e=>
12100{let{adjustScale:n=!1,children:i,dropAnimation:r,style:o,transition:s,modifiers:a,wrapperElement:c="div",className:u,zIndex:m=999}=e;const{activatorEvent:h,active:g,activeNodeRect:x,containerNodeRect:y,draggableNodes:w,droppableContainers:j,dragOverlay:v,over:_,measuringConfiguration:$,scrollableAncestors:k,scrollableAncestorRects:P,windowRect:S}=eue(),I=l.useContext(FA),A=Elt(g?.id),E=Jde(a,{activatorEvent:h,active:g,activeNodeRect:x,containerNodeRect:y,draggingNodeRect:v.rect,over:_,overlayNodeRect:v.rect,scrollableAncestors:k,scrollableAncestorRects:P,transform:I,windowRect:S}),B=nD(x),T=zlt({config:r,draggableNodes:w,droppableContainers:j,measuringConfiguration:$}),M=B?v.setRef:void 0;return fr.createElement(Slt,null,fr.createElement(_lt,{animation:T},g&&A?fr.createElement(Ilt,{key:A,id:g.id,ref:M,as:c,activatorEvent:h,adjustScale:n,className:u,transition:s,rect:B,style:{zIndex:m,...o},transform:E},i):null))});function nue(e,n,i){const r=e.slice();return r.splice(i<0?r.length+i:i,0,r.splice(n,1)[0]),r}function Rlt(e,n){return e.reduce((i,r,o)=>{const s=n.get(r);return s&&(i[o]=s),i},Array(e.length))}function f$(e){return e!==null&&e>=0}function Olt(e,n){if(e===n)return!0;if(e.length!==n.length)return!1;for(let i=0;i<e.length;i++)if(e[i]!==n[i])return!1;return!0}function Dlt(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const iue=e=>{let{rects:n,activeIndex:i,overIndex:r,index:o}=e;const s=nue(n,r,i),a=n[o],c=s[o];return!c||!a?null:{x:c.left-a.left,y:c.top-a.top,scaleX:c.width/a.width,scaleY:c.height/a.height}},g$={scaleX:1,scaleY:1},Llt=e=>{var n;let{activeIndex:i,activeNodeRect:r,index:o,rects:s,overIndex:a}=e;const c=(n=s[i])!=null?n:r;if(!c)return null;if(o===i){const m=s[a];return m?{x:0,y:i<a?m.top+m.height-(c.top+c.height):m.top-c.top,...g$}:null}const u=Blt(s,o,i);return o>i&&o<=a?{x:0,y:-c.height-u,...g$}:o<i&&o>=a?{x:0,y:c.height+u,...g$}:{x:0,y:0,...g$}};function Blt(e,n,i){const r=e[n],o=e[n-1],s=e[n+1];return r?i<n?o?r.top-(o.top+o.height):s?s.top-(r.top+r.height):0:s?s.top-(r.top+r.height):o?r.top-(o.top+o.height):0:0}const rue="Sortable",oue=fr.createContext({activeIndex:-1,containerId:rue,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:iue,disabled:{draggable:!1,droppable:!1}});function Flt(e){let{children:n,id:i,items:r,strategy:o=iue,disabled:s=!1}=e;const{active:a,dragOverlay:c,droppableRects:u,over:m,measureDroppableContainers:h}=eue(),g=OC(rue,i),x=c.rect!==null,y=l.useMemo(()=>r.map(I=>typeof I=="object"&&"id"in I?I.id:I),[r]),w=a!=null,j=a?y.indexOf(a.id):-1,v=m?y.indexOf(m.id):-1,_=l.useRef(y),$=!Olt(y,_.current),k=v!==-1&&j===-1||$,P=Dlt(s);Au(()=>{$&&w&&h(y)},[$,y,w,h]),l.useEffect(()=>{_.current=y},[y]);const S=l.useMemo(()=>({activeIndex:j,containerId:g,disabled:P,disableTransforms:k,items:y,overIndex:v,useDragOverlay:x,sortedRects:Rlt(y,u),strategy:o}),[j,g,P.draggable,P.droppable,k,y,v,u,x,o]);return fr.createElement(oue.Provider,{value:S},n)}const Wlt=e=>{let{id:n,items:i,activeIndex:r,overIndex:o}=e;return nue(i,r,o).indexOf(n)},Ult=e=>{let{containerId:n,isSorting:i,wasDragging:r,index:o,items:s,newIndex:a,previousItems:c,previousContainerId:u,transition:m}=e;return!m||!r||c!==s&&o===a?!1:i?!0:a!==o&&n===u},Hlt={duration:200,easing:"ease"},sue="transform",qlt=Tf.Transition.toString({property:sue,duration:0,easing:"linear"}),Glt={roleDescription:"sortable"};function Vlt(e){let{disabled:n,index:i,node:r,rect:o}=e;const[s,a]=l.useState(null),c=l.useRef(i);return Au(()=>{if(!n&&i!==c.current&&r.current){const u=o.current;if(u){const m=A1(r.current,{ignoreTransform:!0}),h={x:u.left-m.left,y:u.top-m.top,scaleX:u.width/m.width,scaleY:u.height/m.height};(h.x||h.y)&&a(h)}}i!==c.current&&(c.current=i)},[n,i,r,o]),l.useEffect(()=>{s&&a(null)},[s]),s}function Klt(e){let{animateLayoutChanges:n=Ult,attributes:i,disabled:r,data:o,getNewIndex:s=Wlt,id:a,strategy:c,resizeObserverConfig:u,transition:m=Hlt}=e;const{items:h,containerId:g,activeIndex:x,disabled:y,disableTransforms:w,sortedRects:j,overIndex:v,useDragOverlay:_,strategy:$}=l.useContext(oue),k=Ylt(r,y),P=h.indexOf(a),S=l.useMemo(()=>({sortable:{containerId:g,index:P,items:h},...o}),[g,o,P,h]),I=l.useMemo(()=>h.slice(h.indexOf(a)),[h,a]),{rect:A,node:E,isOver:B,setNodeRef:T}=tue({id:a,data:S,disabled:k.droppable,resizeObserverConfig:{updateMeasurementsFor:I,...u}}),{active:M,activatorEvent:R,activeNodeRect:F,attributes:Y,setNodeRef:H,listeners:U,isDragging:X,over:Q,setActivatorNodeRef:K,transform:G}=vlt({id:a,data:S,attributes:{...Glt,...i},disabled:k.draggable}),L=nat(T,H),q=!!M,W=q&&!w&&f$(x)&&f$(v),oe=!_&&X,se=oe&&W?G:null,le=W?se??(c??$)({rects:j,activeNodeRect:F,activeIndex:x,overIndex:v,index:P}):null,me=f$(x)&&f$(v)?s({id:a,items:h,activeIndex:x,overIndex:v}):P,ee=M?.id,ne=l.useRef({activeId:ee,items:h,newIndex:me,containerId:g}),Ae=h!==ne.current.items,_e=n({active:M,containerId:g,isDragging:X,isSorting:q,id:a,index:P,items:h,newIndex:ne.current.newIndex,previousItems:ne.current.items,previousContainerId:ne.current.containerId,transition:m,wasDragging:ne.current.activeId!=null}),we=Vlt({disabled:!_e,index:P,node:E,rect:A});return l.useEffect(()=>{q&&ne.current.newIndex!==me&&(ne.current.newIndex=me),g!==ne.current.containerId&&(ne.current.containerId=g),h!==ne.current.items&&(ne.current.items=h)},[q,me,g,h]),l.useEffect(()=>{if(ee===ne.current.activeId)return;if(ee!=null&&ne.current.activeId==null){ne.current.activeId=ee;return}const ce=setTimeout(()=>{ne.current.activeId=ee},50);return()=>clearTimeout(ce)},[ee]),{active:M,activeIndex:x,attributes:Y,data:S,rect:A,index:P,newIndex:me,items:h,isOver:B,isSorting:q,isDragging:X,listeners:U,node:E,overIndex:v,over:Q,setNodeRef:L,setActivatorNodeRef:K,setDroppableNodeRef:T,setDraggableNodeRef:H,transform:we??le,transition:Ke()};function Ke(){if(we||Ae&&ne.current.newIndex===P)return qlt;if(!(oe&&!LA(R)||!m)&&(q||_e))return Tf.Transition.toString({...m,property:sue})}}function Ylt(e,n){var i,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(i=e?.draggable)!=null?i:n.draggable,droppable:(r=e?.droppable)!=null?r:n.droppable}}Hi.Down,Hi.Right,Hi.Up,Hi.Left;const Rw=[{id:"todo",label:"To Do",color:"#6b7280"},{id:"in_progress",label:"In Progress",color:"#3b82f6"},{id:"completed",label:"Completed",color:"#10b981"}],Xlt=p.div.withConfig({displayName:"KanbanBoard__Board",componentId:"sc-q16hxg-0"})` 12101 display: grid; 12102 grid-template-columns: repeat(3, 1fr); 12103 gap: 0.75rem; 12104 min-height: 320px; 12105 @media (max-width: 900px) { 12106 grid-template-columns: 1fr; 12107 } 12108`,Qlt=p.div.withConfig({displayName:"KanbanBoard__Col",componentId:"sc-q16hxg-1"})` 12109 display: flex; 12110 flex-direction: column; 12111 border: 1px solid ${V}; 12112 border-radius: 0.75rem; 12113 background: ${$e}; 12114 overflow: hidden; 12115 min-height: 200px; 12116`,Zlt=p.div.withConfig({displayName:"KanbanBoard__ColHeader",componentId:"sc-q16hxg-2"})` 12117 display: flex; 12118 align-items: center; 12119 gap: 0.4rem; 12120 padding: 0.6rem 0.75rem; 12121 font-size: 0.75rem; 12122 font-weight: 700; 12123 color: ${e=>e.$color}; 12124 background: ${Z}; 12125 border-bottom: 2px solid ${e=>e.$color}; 12126 flex-shrink: 0; 12127`,Jlt=p.span.withConfig({displayName:"KanbanBoard__ColCount",componentId:"sc-q16hxg-3"})` 12128 font-size: 0.65rem; 12129 font-weight: 600; 12130 color: ${Pe}; 12131 margin-left: auto; 12132`,ect=p.div.withConfig({displayName:"KanbanBoard__ColBody",componentId:"sc-q16hxg-4"})` 12133 flex: 1; 12134 padding: 0.5rem; 12135 display: flex; 12136 flex-direction: column; 12137 gap: 0.5rem; 12138 overflow-y: auto; 12139 max-height: 600px; 12140 overscroll-behavior: contain; 12141`,tct=p.div.withConfig({displayName:"KanbanBoard__EmptyCol",componentId:"sc-q16hxg-5"})` 12142 text-align: center; 12143 padding: 2rem 0.5rem; 12144 font-size: 0.75rem; 12145 color: ${Pe}; 12146`,nct=p.div.withConfig({displayName:"KanbanBoard__DragHandle",componentId:"sc-q16hxg-6"})` 12147 opacity: ${e=>e.$isDragging?.5:1}; 12148 cursor: grab; 12149 &:active { cursor: grabbing; } 12150`,ict=p.div.withConfig({displayName:"KanbanBoard__OverlayCard",componentId:"sc-q16hxg-7"})` 12151 opacity: 0.9; 12152 transform: rotate(2deg); 12153 box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15); 12154 pointer-events: none; 12155`,rct=Tn` 12156 from { transform: rotate(0deg); } 12157 to { transform: rotate(360deg); } 12158`,_Y=p.div.withConfig({displayName:"KanbanBoard__Spinner",componentId:"sc-q16hxg-8"})` 12159 width: 18px; 12160 height: 18px; 12161 border: 2px solid ${V}; 12162 border-top-color: ${Pe}; 12163 border-radius: 50%; 12164 animation: ${rct} 0.6s linear infinite; 12165 margin: 0.5rem auto; 12166`,oct=p.div.withConfig({displayName:"KanbanBoard__Sentinel",componentId:"sc-q16hxg-9"})` 12167 min-height: 1px; 12168 flex-shrink: 0; 12169`;function sct({action:e,basePath:n}){const{attributes:i,listeners:r,setNodeRef:o,transform:s,transition:a,isDragging:c}=Klt({id:e.id,data:{action:e}}),u={transform:Tf.Transform.toString(s),transition:a,zIndex:c?10:void 0};return t.jsx("div",{ref:o,style:u,...i,...r,children:t.jsx(nct,{$isDragging:c,children:t.jsx(RA,{action:e,basePath:n,variant:"kanban"})})})}function act({id:e,children:n}){const{setNodeRef:i,isOver:r}=tue({id:e});return t.jsx(ect,{ref:i,style:{background:r?"rgba(59,130,246,0.04)":void 0},children:n})}const gx={items:[],page:0,hasMore:!0,loading:!1,initialLoaded:!1};function aue({fetchPage:e,basePath:n,onStatusChange:i,refreshKey:r}){const[o,s]=l.useState(null),[a,c]=l.useState({todo:{...gx},in_progress:{...gx}
12169,completed:{...gx}}),u=yat(gat(tD,{activationConstraint:{distance:8}})),m=l.useRef(a);m.current=a;const h=l.useCallback(async k=>{const P=m.current[k];if(P.loading||!P.hasMore)return;const S=P.page+1;c(I=>({...I,[k]:{...I[k],loading:!0}}));try{const I=await e(k,S);c(A=>{const E=A[k],B=new Set(E.items.map(M=>M.id)),T=I.actions.filter(M=>!B.has(M.id));return{...A,[k]:{items:[...E.items,...T],page:S,hasMore:I.hasMore,loading:!1,initialLoaded:!0}}})}catch{c(I=>({...I,[k]:{...I[k],loading:!1}}))}},[e]),g=l.useRef(r);l.useEffect(()=>{if(!m.current.todo.initialLoaded&&!m.current.in_progress.initialLoaded&&!m.current.completed.initialLoaded||g.current!==r){g.current=r;const P={todo:{...gx},in_progress:{...gx},completed:{...gx}};c(P),m.current=P;for(const S of Rw.map(I=>I.id))h(S)}},[r,h]);const x=l.useRef({todo:null,in_progress:null,completed:null});l.useEffect(()=>{const k=new IntersectionObserver(P=>{P.forEach(S=>{if(!S.isIntersecting)return;const I=S.target.dataset.col;if(!I)return;const A=m.current[I];A&&!A.loading&&A.hasMore&&A.initialLoaded&&h(I)})},{rootMargin:"100px"});for(const P of Rw.map(S=>S.id)){const S=x.current[P];S&&k.observe(S)}return()=>k.disconnect()},[a,h]);const y=[...a.todo.items,...a.in_progress.items,...a.completed.items],w=o?y.find(k=>k.id===o)??null:null,j=l.useCallback(k=>{for(const P of Rw.map(S=>S.id))if(a[P].items.some(S=>S.id===k))return P;return null},[a]),v=l.useCallback(k=>{s(Number(k.active.id))},[]),_=l.useCallback(k=>{},[]),$=l.useCallback(k=>{s(null);const{active:P,over:S}=k;if(!S)return;const I=Number(P.id);let A=null;if(Rw.some(B=>B.id===S.id)?A=S.id:A=j(Number(S.id)),!A)return;const E=j(I);E!==A&&(c(B=>{if(!E||!A)return B;const T=B[E].items.find(R=>R.id===I);if(!T)return B;const M={...T,status:A};return{...B,[E]:{...B[E],items:B[E].items.filter(R=>R.id!==I)},[A]:{...B[A],items:[M,...B[A].items]}}}),i?.(I,A))},[j,i]);return t.jsxs(ylt,{sensors:u,collisionDetection:_at,onDragStart:v,onDragOver:_,onDragEnd:$,children:[t.jsx(Xlt,{children:Rw.map(k=>{const P=a[k.id],S=P.items;return t.jsxs(Qlt,{children:[t.jsxs(Zlt,{$color:k.color,children:[k.label,t.jsxs(Jlt,{children:[S.length,P.hasMore?"+":""]})]}),t.jsx(Flt,{id:k.id,items:S.map(I=>I.id),strategy:Llt,children:t.jsx(act,{id:k.id,children:!P.initialLoaded&&P.loading?t.jsx(_Y,{}):S.length===0?t.jsx(tct,{children:"Drop actions here"}):t.jsxs(t.Fragment,{children:[S.map(I=>t.jsx(sct,{action:I,basePath:n},I.id)),P.loading&&t.jsx(_Y,{}),P.hasMore&&t.jsx(oct,{ref:I=>{x.current[k.id]=I},"data-col":k.id})]})})})]},k.id)})}),t.jsx(Mlt,{children:w?t.jsx(ict,{children:t.jsx(RA,{action:w,basePath:n,variant:"kanban"})}):null})]})}const lct=p.div.withConfig({displayName:"SourceTree__TreeContainer",componentId:"sc-ujflm0-0"})` 12170 display: flex; 12171 flex-direction: column; 12172 gap: 0.75rem; 12173`,cct=p.div.withConfig({displayName:"SourceTree__CategoryNode",componentId:"sc-ujflm0-1"})` 12174 border: 1px solid ${V}; 12175 border-radius: 0.75rem; 12176 background: ${Z}; 12177 overflow: hidden; 12178`,dct=p.button.withConfig({displayName:"SourceTree__CategoryHeader",componentId:"sc-ujflm0-2"})` 12179 width: 100%; 12180 display: flex; 12181 align-items: center; 12182 gap: 0.625rem; 12183 padding: 0.875rem 1.125rem; 12184 background: none; 12185 border: none; 12186 cursor: pointer; 12187 text-align: left; 12188 transition: background 0.1s ease; 12189 &:hover { background: ${$e}; } 12190`,CY=p.span.withConfig({displayName:"SourceTree__CatIcon",componentId:"sc-ujflm0-3"})` 12191 display: flex; 12192 align-items: center; 12193 color: ${Pe}; 12194 flex-shrink: 0; 12195`,uct=p.span.withConfig({displayName:"SourceTree__CatLabel",componentId:"sc-ujflm0-4"})` 12196 font-size: 0.875rem; 12197 font-weight: 700; 12198 color: ${O}; 12199`,pct=p.span.withConfig({displayName:"SourceTree__CatCount",componentId:"sc-ujflm0-5"})` 12200 margin-left: auto; 12201 font-size: 0.7rem; 12202 font-weight: 600; 12203 color: ${Pe}; 12204 background: ${$e}; 12205 padding: 0.1rem 0.45rem; 12206 border-radius: 9999px; 12207`,mct=p.div.withConfig({displayName:"SourceTree__SubList",componentId:"sc-ujflm0-6"})` 12208 display: flex; 12209 flex-direction: column; 12210`,hct=p.div.withConfig({displayName:"SourceTree__SubTypeRow",componentId:"sc-ujflm0-7"})` 12211 border-top: 1px solid ${V}; 12212`,fct=p.button.withConfig({displayName:"SourceTree__SubTypeHeader",componentId:"sc-ujflm0-8"})` 12213 width: 100%; 12214 display: flex; 12215 align-items: center; 12216 gap: 0.5rem; 12217 padding: 0.65rem 1.125rem 0.65rem 1.75rem; 12218 background: none; 12219 border: none; 12220 cursor: pointer; 12221 text-align: left; 12222 transition: background 0.1s ease; 12223 &:hover { background: ${$e}; } 12224`,gct=p.span.withConfig({displayName:"SourceTree__ChevronWrap",componentId:"sc-ujflm0-9"})` 12225 display: flex; 12226 align-items: center; 12227 color: ${Pe}; 12228 flex-shrink: 0; 12229`,yct=p.span.withConfig({displayName:"SourceTree__ColorDot",componentId:"sc-ujflm0-10"})` 12230 width: 7px; 12231 height: 7px; 12232 border-radius: 50%; 12233 background: ${e=>e.$color}; 12234 flex-shrink: 0; 12235`,xct=p.span.withConfig({displayName:"SourceTree__SubLabel",componentId:"sc-ujflm0-11"})` 12236 font-size: 0.8rem; 12237 font-weight: 500; 12238 color: ${O}; 12239 flex: 1; 12240 min-width: 0; 12241`,bct=p.span.withConfig({displayName:"SourceTree__SubMeta",componentId:"sc-ujflm0-12"})` 12242 display: flex; 12243 align-items: center; 12244 gap: 0.5rem; 12245 flex-shrink: 0; 12246`,vct=p.span.withConfig({displayName:"SourceTree__SubCount",componentId:"sc-ujflm0-13"})` 12247 font-size: 0.65rem; 12248 font-weight: 600; 12249 color: ${z}; 12250 white-space: nowrap; 12251`,wct=p.div.withConfig({displayName:"SourceTree__ProgressBar",componentId:"sc-ujflm0-14"})` 12252 display: flex; 12253 height: 3px; 12254 width: 48px; 12255 border-radius: 2px; 12256 overflow: hidden; 12257 background: ${$e}; 12258 flex-shrink: 0; 12259`,J6=p.div.withConfig({displayName:"SourceTree__ProgressSegment",componentId:"sc-ujflm0-15"})` 12260 width: ${e=>e.$pct}%; 12261 background: ${e=>e.$color}; 12262 min-width: ${e=>e.$pct>0?"2px":"0"}; 12263`,jct=p.div.withConfig({displayName:"SourceTree__ActionsList",componentId:"sc-ujflm0-16"})` 12264 display: flex; 12265 flex-direction: column; 12266 gap: 0.375rem; 12267 padding: 0.5rem 1rem 0.75rem 1.75rem; 12268`,_ct=p.div.withConfig({displayName:"SourceTree__EmptySub",componentId:"sc-ujflm0-17"})` 12269 padding: 0.5rem 1rem 0.75rem 1.75rem; 12270 font-size: 0.75rem; 12271 color: ${Pe}; 12272`;function Cct({tree:e,basePath:n,onStatusChange:i}){const[r,o]=l.useState({earned:!0,owned:!0}),[s,a]=l.useState({}),c=l.useCallback(m=>o(h=>({...h,[m]:!h[m]})),[]),u=l.useCallback(m=>a(h=>({...h,[m]:!h[m]})),[]);return t.jsx(lct,{children:Object.entries(e).map(([m,h])=>{const g=Object.values(h).reduce((w,j)=>w+j.counts.total,0),x=r[m]!==!1,y=m==="owned"?Ss:To;return t.jsxs(cct,{children:[t.jsxs(dct,{onClick:()=>c(m),children:[t.jsx(CY,{children:x?t.jsx(qn,{size:14}):t.jsx(Gi,{size:14})}),t.jsx(CY,{children:t.jsx(y,{size:15})}),t.jsx(uct,{children:mst[m]||m}),t.jsx(pct,{children:g})]}),x&&t.jsx(mct,{children:Object.entries(h).map(([w,j])=>{const v=`${m}.${w}`,_=s[v]===!0,{counts:$,actions:k}=j,P=$.total||1,S=$.completed/P*100,I=$.in_progress/P*100,A=100-S-I;return $.total===0?null:t.jsxs(hct,{children:[t.jsxs(fct,{onClick:()=>u(v),children:[t.jsx(gct,{children:_?t.jsx(qn,{size:12}):t.jsx(Gi,{size:12})}),t.jsx(yct,{$color:j.color}),t.jsx(xct,{children:j.label}),t.jsxs(bct,{children:[t.jsxs(wct,{children:[t.jsx(J6,{$color:"#10b981",$pct:S}),t.jsx(J6,{$color:"#3b82f6",$pct:I}),t.jsx(J6,{$color:V,$pct:A})]}),t.jsxs(vct,{children:[$.total," action",$.total!==1?"s":""]})]})]}),_&&(k.length>0?t.jsx(jct,{children:k.map(E=>t.jsx(RA,{action:E,basePath:n,onStatusChange:i},E.id))}):t.jsx(_ct,{children:"No actions in this category."}))]},v)})})]},m)})})}const Sct=p.div.withConfig({displayName:"ActionsOverviewPage__Page",componentId:"sc-999zz6-0"})` 12273 padding: 1.25rem; 12274 max-width: 1200px; 12275 margin: 0 auto; 12276`,kct=p.div.withConfig({displayName:"ActionsOverviewPage__HeroTo
12276p",componentId:"sc-999zz6-1"})` 12277 display: flex; 12278 align-items: flex-start; 12279 justify-content: space-between; 12280 gap: 1rem; 12281 flex-wrap: wrap; 12282 margin-bottom: 0.75rem; 12283`,$ct=p.div.withConfig({displayName:"ActionsOverviewPage__ControlsRow",componentId:"sc-999zz6-2"})` 12284 display: flex; 12285 align-items: center; 12286 gap: 0.5rem; 12287 flex-wrap: wrap; 12288`,Ict=p($ct).withConfig({displayName:"ActionsOverviewPage__TabsRow",componentId:"sc-999zz6-3"})` 12289 margin-bottom: 1rem; 12290 justify-content: flex-start; 12291`,Pct=p.div.withConfig({displayName:"ActionsOverviewPage__FiltersPush",componentId:"sc-999zz6-4"})` 12292 display: flex; 12293 align-items: center; 12294 gap: 0.5rem; 12295 flex-wrap: wrap; 12296 margin-left: auto; 12297 @media (max-width: 768px) { 12298 margin-left: 0; 12299 width: 100%; 12300 } 12301`,Act=p.div.withConfig({displayName:"ActionsOverviewPage__ViewToggle",componentId:"sc-999zz6-5"})` 12302 display: inline-flex; 12303 border: 1px solid ${V}; 12304 border-radius: 8px; 12305 overflow: hidden; 12306`,e7=p.button.withConfig({displayName:"ActionsOverviewPage__ToggleBtn",componentId:"sc-999zz6-6"})` 12307 display: flex; 12308 align-items: center; 12309 gap: 0.3rem; 12310 padding: 0.5rem 0.85rem; 12311 background: ${e=>e.$active?$e:Z}; 12312 border: none; 12313 cursor: pointer; 12314 font-size: 0.8rem; 12315 font-weight: 600; 12316 color: ${e=>e.$active?O:Pe}; 12317 &:hover { 12318 background: ${$e}; 12319 } 12320`,Nct=p.div.withConfig({displayName:"ActionsOverviewPage__BoardTabs",componentId:"sc-999zz6-7"})` 12321 display: flex; 12322 gap: 0; 12323 border: 1px solid ${V}; 12324 border-radius: 8px; 12325 overflow: hidden; 12326`,t7=p.button.withConfig({displayName:"ActionsOverviewPage__BoardTabBtn",componentId:"sc-999zz6-8"})` 12327 padding: 0.5rem 0.85rem; 12328 background: ${e=>e.$variant==="completed"?e.$active?"rgba(16, 185, 129, 0.06)":"rgba(16, 185, 129, 0.18)":e.$active?$e:Z}; 12329 border: none; 12330 cursor: pointer; 12331 font-size: 0.8rem; 12332 font-weight: 600; 12333 color: ${e=>e.$variant==="completed"?e.$active?"#10b981":"#047857":e.$active?O:Pe}; 12334 &:hover { 12335 background: ${e=>e.$variant==="completed"?"rgba(16, 185, 129, 0.14)":$e}; 12336 } 12337`,n7=p.div.withConfig({displayName:"ActionsOverviewPage__ActionsList",componentId:"sc-999zz6-9"})` 12338 display: flex; 12339 flex-direction: column; 12340 gap: 0.25rem; 12341`,zct=p(YO).withConfig({displayName:"ActionsOverviewPage__StyledBanner",componentId:"sc-999zz6-10"})``,Tct=p.div.withConfig({displayName:"ActionsOverviewPage__BannerSkeleton",componentId:"sc-999zz6-11"})` 12342 display: flex; 12343 align-items: center; 12344 gap: 0.75rem; 12345 padding: 1rem 1.25rem; 12346 margin: 0.75rem 0 1.25rem; 12347 border-radius: 0.75rem; 12348 border: 1px solid ${V}; 12349 background: ${Z}; 12350`,SY=p.div.withConfig({displayName:"ActionsOverviewPage__NoActionsCard",componentId:"sc-999zz6-12"})` 12351 display: flex; 12352 align-items: center; 12353 gap: 0.75rem; 12354 padding: 0.65rem 1rem; 12355 border: 1px dashed ${V}; 12356 border-radius: 0.75rem; 12357 background: ${Z}; 12358 margin-bottom: 0.25rem; 12359`,kY=p.span.withConfig({displayName:"ActionsOverviewPage__NoActionsPromptText",componentId:"sc-999zz6-13"})` 12360 font-size: 0.825rem; 12361 font-weight: 500; 12362 color: ${O}; 12363 flex: 1; 12364 min-width: 0; 12365 overflow: hidden; 12366 text-overflow: ellipsis; 12367 white-space: nowrap; 12368 &::first-letter { text-transform: uppercase; } 12369`,$Y=p.span.withConfig({displayName:"ActionsOverviewPage__NoActionsVis",componentId:"sc-999zz6-14"})` 12370 font-size: 0.7rem; 12371 font-weight: 600; 12372 color: ${e=>e.$color}; 12373 flex-shrink: 0; 12374 width: 3.5rem; 12375 text-align: right; 12376 margin-right: 1rem; 12377`,IY=p.span.withConfig({displayName:"ActionsOverviewPage__ActionCountBadge",componentId:"sc-999zz6-15"})` 12378 font-size: 0.65rem; 12379 font-weight: 600; 12380 padding: 0.1rem 0.35rem; 12381 border-radius: 4px; 12382 color: ${e=>e.$color}; 12383 background: ${e=>`${e.$color}14`}; 12384`,Ect=p.span.withConfig({displayName:"ActionsOverviewPage__LinkedChip",componentId:"sc-999zz6-16"})` 12385 display: inline-flex; 12386 align-items: center; 12387 gap: 0.15rem; 12388 font-size: 0.6rem; 12389 font-weight: 600; 12390 color: ${Pe}; 12391 flex-shrink: 0; 12392`,Mct=Tn`from { transform: rotate(0deg); } to { transform: rotate(360deg); }`,Rct=p.span.withConfig({displayName:"ActionsOverviewPage__GeneratingChip",componentId:"sc-999zz6-17"})` 12393 display: inline-flex; 12394 align-items: center; 12395 gap: 0.2rem; 12396 font-size: 0.6rem; 12397 font-weight: 600; 12398 color: #8b5cf6; 12399 background: #8b5cf614; 12400 padding: 0.15rem 0.4rem; 12401 border-radius: 4px; 12402 white-space: nowrap; 12403 flex-shrink: 0; 12404 & > svg { animation: ${Mct} 1s linear infinite; } 12405`,Oct=p.button.withConfig({displayName:"ActionsOverviewPage__GenerateBtn",componentId:"sc-999zz6-18"})` 12406 display: inline-flex; 12407 align-items: center; 12408 gap: 0.3rem; 12409 padding: 0.35rem 0.7rem; 12410 font-size: 0.7rem; 12411 font-weight: 600; 12412 color: ${Z}; 12413 background: var(--color-brand-600); 12414 border: none; 12415 border-radius: 6px; 12416 cursor: pointer; 12417 flex-shrink: 0; 12418 &:hover { opacity: 0.9; } 12419 &:disabled { opacity: 0.5;
12419 cursor: not-allowed; } 12420`,PY=p.div.withConfig({displayName:"ActionsOverviewPage__NoActionsSectionTitle",componentId:"sc-999zz6-19"})` 12421 display: flex; 12422 align-items: center; 12423 justify-content: space-between; 12424 font-size: 0.75rem; 12425 font-weight: 600; 12426 color: ${Pe}; 12427 text-transform: uppercase; 12428 letter-spacing: 0.05em; 12429 margin-bottom: 0.5rem; 12430 padding: 0.75rem 0 0.25rem; 12431 margin-top: 0.5rem; 12432`,AY=p.span.withConfig({displayName:"ActionsOverviewPage__SectionColHeader",componentId:"sc-999zz6-20"})` 12433 font-size: 0.65rem; 12434 font-weight: 600; 12435 color: ${Pe}; 12436 text-transform: uppercase; 12437 letter-spacing: 0.04em; 12438 width: 3.5rem; 12439 text-align: right; 12440 flex-shrink: 0; 12441 margin-right: 1rem; 12442`,Dct=p.div.withConfig({displayName:"ActionsOverviewPage__ConfirmFooter",componentId:"sc-999zz6-21"})` 12443 display: flex; 12444 justify-content: flex-end; 12445 gap: 0.5rem; 12446`,Lct=p.div.withConfig({displayName:"ActionsOverviewPage__ConfirmBody",componentId:"sc-999zz6-22"})` 12447 display: flex; 12448 flex-direction: column; 12449 gap: 0.5rem; 12450 font-size: 0.85rem; 12451 color: ${O}; 12452 line-height: 1.5; 12453`,i7=p.div.withConfig({displayName:"ActionsOverviewPage__EmptyMsg",componentId:"sc-999zz6-23"})` 12454 text-align: center; 12455 padding: 3rem; 12456 color: ${Pe}; 12457 font-size: 0.85rem; 12458`,Bct=p.div.withConfig({displayName:"ActionsOverviewPage__FilterSelect",componentId:"sc-999zz6-24"})` 12459 min-width: ${e=>e.$minWidth??120}px; 12460 12461 /* Match Button outline variant colors */ 12462 button { 12463 border-color: ${V}; 12464 font-weight: 600; 12465 color: ${O}; 12466 } 12467 /* Darken icon + caret to match the topics button */ 12468 button > span:last-child, 12469 div[class] { 12470 color: ${O}; 12471 } 12472`;function Fct(){const{workspaceId:e,projectId:n}=Gn(),[i,r]=yr(),o=Number(e),s=Number(n),a=`/workspaces/${e}/projects/${n}`,{projects:c}=Mr(),{user:u}=yn(),m=l.useMemo(()=>c?.find(ae=>ae.id===s),[c,s]),h=!!(m?.can?.edit||m?.can?.settings),g=S1(o,s),x=g.topics,{subscribe:y}=wo(),w=Uo(),j=k1(),v=l.useMemo(()=>o&&u?.organizations?.find(ae=>Number(ae.id)===o)||null,[o,u?.organizations]),_=v?.role||null,$=!!v?.partner_managed;l.useEffect(()=>{g.topics&&g.topics.length>0||g.error||g.ensure()},[o,s,g]);const k=i.get("view"),P=k==="source"?"source":k==="kanban"?"kanban":"prompt",S=P==="kanban",I=i.get("tab")||"todo",A=l.useCallback(ae=>{const Fe=new URLSearchParams(i);ae==="todo"?Fe.delete("tab"):Fe.set("tab",ae),r(Fe,{replace:!0})},[i,r]),E=i.get("action_type")||null,B=i.get("topics")||"",T=l.useMemo(()=>B?B.split(",").map(Number).filter(Boolean):[],[B]),M=l.useCallback(ae=>{const Fe=new URLSearchParams(i);ae.length>0?Fe.set("topics",ae.join(",")):Fe.delete("topics"),r(Fe,{replace:!0})},[i,r]),R=i.get("source_cat")||"",F=l.useCallback(ae=>{const Fe=new URLSearchParams(i);ae?Fe.set("source_cat",ae):Fe.delete("source_cat"),r(Fe,{replace:!0})},[i,r]),Y=[{value:"",label:"All Sources"},{value:"earned",label:"Earned"},{value:"owned",label:"Owned"}],H=l.useMemo(()=>Object.entries($1).map(([ae,Fe])=>({id:ae,label:Fe})),[]),U=i.get("action_types")||"",X=l.useMemo(()=>U?U.split(",").filter(Boolean):[],[U]),Q=l.useCallback(ae=>{const Fe=new URLSearchParams(i);ae.length>0?Fe.set("action_types",ae.join(",")):Fe.delete("action_types"),r(Fe,{replace:!0})},[i,r]),[K,G]=l.useState(0),[L,q]=l.useState(!0),[W,oe]=l.useState([]),[se,de]=l.useState(null),le=1,[me,ee]=l.useState(!1),[ne,Ae]=l.useState([]),[_e,we]=l.useState(0),[Ke,ce]=l.useState(0),[ie,Re]=l.useState({total:0,todo:0,in_progress:0,completed:0}),[Be,tt]=l.useState(new Set),dt=l.useRef({}),je=l.useRef({}),Me=l.useRef(null),[Se,it]=l.useState([]),[De,te]=l.useState(1),[ge,Je]=l.useState(1),[Ee,Xe]=l.useState(0),[yt,Ne]=l.useState([]),[Le,Ue]=l.useState(1),[We,Qe]=l.useState(1),[ht,pe]=l.useState(0),[be,rt]=l.useState(null),ze=l.useCallback(ae=>{ae&&(ee(!!ae.is_generating),Ae(Array.isArray(ae.prompts)?ae.prompts:[]))},[]),lt=l.useMemo(()=>{const ae=new Set(Be);return ne.forEach(Fe=>ae.add(Fe.prompt_id)),ae},[Be,ne]),vt=l.useCallback(ae=>{const Fe=new URLSearchParams(i);ae==="prompt"?Fe.delete("view"):Fe.set("view",ae),r(Fe,{replace:!0}),ae!=="kanban"&&localStorage.setItem("actions_view_pref",ae)},[i,r]);l.useEffect(()=>{if(i.has("view"))return;localStorage.getItem("actions_view_pref")==="source"&&vt("source")},[]);const Wt=l.useCallback(async()=>
12472{if(!(!o||!s)){q(!0);try{const ae=new URLSearchParams;ae.set("page",String(le)),ae.set("per_page","50"),ae.set("sort","newest"),ae.set("include_completed",I==="completed"?"true":"false"),ae.set("include_dismissed","false"),E&&ae.set("action_type",E),T.length>0&&ae.set("topic_ids",T.join(",")),R&&ae.set("source_category",R);const Fe=await ue(`/api/v1/organizations/${o}/projects/${s}/actions?${ae.toString()}`),Ge=await Fe.json().catch(()=>({}));if(!Fe.ok)throw new Error(Ge?.error||`Failed (HTTP ${Fe.status})`);let wt=Ge.actions||[];wt=wt.filter(ke=>ke.status===I),oe(wt),Ge.total_prompts!=null&&we(Ge.total_prompts),Ge.prompts_with_actions!=null&&ce(Ge.prompts_with_actions),Ge.status_counts&&Re(Ge.status_counts),ze(Ge.generation_status)}catch(ae){w.showToast(ae?.message||"Failed to load actions",{tone:"error"})}finally{q(!1)}}},[o,s,le,I,E,T,R,w,ze]),Qt=l.useCallback(async()=>{if(!(!o||!s)){q(!0);try{const ae=new URLSearchParams;ae.set("include_completed",I==="completed"?"true":"false"),ae.set("include_dismissed","false"),ae.set("status",I),T.length>0&&ae.set("topic_ids",T.join(",")),R&&ae.set("source_category",R),X.length>0&&ae.set("action_types",X.join(","));const Fe=await ue(`/api/v1/organizations/${o}/projects/${s}/actions/by_source?${ae.toString()}`),Ge=await Fe.json().catch(()=>({}));if(!Fe.ok)throw new Error(Ge?.error||`Failed (HTTP ${Fe.status})`);de(Ge.tree||null),ze(Ge.generation_status)}catch(ae){w.showToast(ae?.message||"Failed to load actions",{tone:"error"})}finally{q(!1)}}},[o,s,I,T,R,X,w,ze]),Yt=l.useCallback(async(ae,Fe)=>{if(!o||!s)return{actions:[],hasMore:!1};const Ge=new URLSearchParams;Ge.set("page",String(Fe)),Ge.set("per_page","25"),Ge.set("status",ae),Ge.set("include_completed",ae==="completed"?"true":"false"),Ge.set("include_dismissed","false"),T.length>0&&Ge.set("topic_ids",T.join(",")),R&&Ge.set("source_category",R),X.length>0&&Ge.set("action_types",X.join(","));const wt=await ue(`/api/v1/organizations/${o}/projects/${s}/actions?${Ge.toString()}`),ke=await wt.json().catch(()=>({}));if(!wt.ok)throw new Error(ke?.error||`Failed (HTTP ${wt.status})`);const Ve=ke.actions||[],pt=ke.total_pages||1;return{actions:Ve,hasMore:Fe<pt}},[o,s,T,R,X]),Zt=l.useCallback(async()=>{if(!(!o||!s))try{const ae=new URLSearchParams;ae.set("page",String(De)),ae.set("per_page","10"),ae.set("has_actions","true"),T.length>0&&ae.set("topic_ids",T.join(",")),I&&ae.set("status",I),R&&ae.set("source_category",R);const Fe=await ue(`/api/v1/organizations/${o}/projects/${s}/actions/prompts_list?${ae.toString()}`),Ge=await Fe.json().catch(()=>({}));if(!Fe.ok)return;it(Ge.prompts||[]),Je(Ge.total_pages||1),Xe(Ge.total||0)}catch{}},[o,s,De,T,I,R]),tn=l.useCallback(async()=>{if(!(!o||!s))try{const ae=new URLSearchParams;ae.set("page",String(Le)),ae.set("per_page","10"),ae.set("has_actions","false"),T.length>0&&ae.set("topic_ids",T.join(",")),I&&ae.set("status",I),R&&ae.set("source_category",R);const Fe=await ue(`/api/v1/organizations/${o}/projects/${s}/actions/prompts_list?${ae.toString()}`),Ge=await Fe.json().catch(()=>({}));if(!Fe.ok)return;Ne(Ge.prompts||[]),Qe(Ge.total_pages||1),pe(Ge.total||0)}catch{}},[o,s,Le,T,I,R]);l.useEffect(()=>{P==="source"?Qt():Wt()},[P,Wt,Qt]),l.useEffect(()=>{S&&G(ae=>ae+1)},[T,R,X]),l.useEffect(()=>{te(1),Ue(1)},[I,R,T]),l.useEffect(()=>{P==="prompt"&&(Zt(),tn())},[P,Zt,tn]),l.useEffect(()=>{if(s)return Me.current=y({channel:"ProjectActionsChannel",project_id:s},{received:ae=>{const Fe=String(ae?.type||"");if(Fe==="action_skeletons_created"){const Ge=ae.actions||[],wt=ae.prompt_id;if(oe(ke=>{const Ve=new Set(ke.map(qe=>qe.id)),pt=ke.map(qe=>Ge.find(Mn=>Mn.id===qe.id)||qe);return[...Ge.filter(qe=>!Ve.has(qe.id)),...pt]}),ee(!0),wt){dt.current[wt]||(dt.current[wt]=new Set),je.current[wt]||(je.current[wt]=new Set);const ke=dt.current[wt],Ve=Ge.filter(pt=>!ke.has(pt.id));Ve.forEach(pt=>ke.add(pt.id)),Ve.length>0&&Ae(pt=>{if(pt.find(qt=>qt.prompt_id===wt))return pt.map(qt=>qt.prompt_id===wt?{...qt,total:ke.size,pending:ke.size-(je.current[wt]?.size||0)}:qt);const qe=Ge[0]?.evidence?.prompt?.content||`Prompt #${wt}`;return[...pt,{prompt_id:wt,prompt_content:typeof qe=="string"?qe.slice(0,100):`Prompt #${wt}`,total:ke.size,ready:0,generating:0,pending:ke.size,failed:0}]})}}if(Fe==="action_guides_ready"){const Ge=ae.actions||[],wt=ae.prompt_id;if(oe(ke=>ke.map(Ve=>Ge.find(Nt=>Nt.id===Ve.id)||Ve)),wt){je.current[wt]||(je.current[wt]=new Set);const ke=je.current[wt];Ge.forEach(pt=>ke.add(pt.id));const Ve=dt.current[wt]?.size||0;Ae(pt=>pt.map(Nt=>
12472Nt.prompt_id===wt?{...Nt,total:Math.max(Nt.total,Ve),ready:ke.size,pending:Math.max(0,(Ve||Nt.total)-ke.size),generating:0}:Nt))}}if(Fe==="generation_complete"){const Ge=ae.prompt_id;Ge&&(delete dt.current[Ge],delete je.current[Ge],tt(wt=>{const ke=new Set(wt);return ke.delete(Ge),ke})),Ae(wt=>{const ke=wt.filter(Ve=>Ve.prompt_id!==Ge);return ke.length===0&&ee(!1),ke}),S?(G(wt=>wt+1),Wt()):P==="source"?Qt():Wt(),Zt(),tn()}if(Fe==="action_status_changed"&&(S?(G(Ge=>Ge+1),Wt()):P==="source"?Qt():Wt(),Zt(),tn()),Fe==="generation_failed"){const Ge=ae.prompt_id;Ge&&(delete dt.current[Ge],delete je.current[Ge]),Ae(wt=>{const ke=wt.filter(Ve=>Ve.prompt_id!==Ge);return ke.length===0&&ee(!1),ke}),w.showToast("Action generation failed",{tone:"error"})}}}),()=>{Me.current?.unsubscribe?.()}},[s,y,P,S,Wt,Qt,Zt,tn,w]);const nn=l.useCallback(async(ae,Fe)=>{try{if(!(await ue(`/api/v1/organizations/${o}/projects/${s}/actions/${ae}/status`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:Fe})})).ok)throw new Error("Failed to update status");S||(P==="source"?Qt():Wt())}catch(Ge){w.showToast(Ge?.message||"Failed to update",{tone:"error"})}},[o,s,P,S,Wt,Qt,w]),xn=l.useCallback(ae=>{ae.action_count>0?rt(ae):st(ae.id)},[]),st=l.useCallback(async ae=>{rt(null),tt(Fe=>new Set(Fe).add(ae));try{const Fe=await ue(`/api/v1/organizations/${o}/projects/${s}/prompts/${ae}/generate_actions`,{method:"POST"});if(!Fe.ok){const Ge=await Fe.json().catch(()=>({})),wt=new Error(Ge?.error||"Failed to generate");throw Ge?.errors&&typeof Ge.errors=="object"&&(wt.limitDetails=Ge.errors),wt}Fo(),ee(!0),setTimeout(()=>{Zt(),tn()},2e3)}catch(Fe){j.handleApiError(Fe)||w.showToast(Fe?.message||"Failed to generate actions",{tone:"error"}),tt(Ge=>{const wt=new Set(Ge);return wt.delete(ae),wt})}},[o,s,w,Zt,tn,j]),Ct=l.useMemo(()=>
12472[{label:"Projects",to:e?`/workspaces/${e}`:void 0},{label:m?.name||"Project",to:a},{label:"Actions"}],[m,a,e]),Ie=l.useMemo(()=>(x||[]).map(ae=>({id:ae.id,label:ae.name})),[x]);return t.jsxs(Sct,{children:[t.jsxs(kct,{children:[t.jsxs(UO,{children:[t.jsxs(hy,{$active:!0,children:[t.jsx(Ks,{size:16}),"Actions"]}),t.jsxs(hy,{as:Dn,to:`${a}/actions/impact`,$active:!1,children:[t.jsx(qi,{size:16}),"Impact"]})]}),t.jsx("div",{style:{paddingRight:8},children:t.jsx(qr,{items:Ct})})]}),L&&!me?t.jsxs(Tct,{children:[t.jsx("div",{style:{display:"flex",gap:"0.5rem"},children:Array.from({length:4}).map((ae,Fe)=>t.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",width:80,padding:"0.25rem 0.75rem"},children:[t.jsx(nt,{height:"1.75rem",width:"2.5rem",style:{marginBottom:"0.25rem"}}),t.jsx(nt,{height:"0.55rem",width:"3.5rem"})]},Fe))}),t.jsxs("div",{style:{marginLeft:"1.5rem",paddingLeft:"1.5rem",borderLeft:"1px solid var(--color-gray-200, #e5e7eb)",flex:1},children:[t.jsx(nt,{height:"0.8rem",width:"60%",style:{marginBottom:"0.4rem"}}),t.jsx(nt,{height:"0.6rem",width:"80%"})]})]}):(()=>{const ae=[];let Fe=0,Ge=0;me&&ne.length>0&&ne.forEach(zt=>{Fe+=zt.total,Ge+=zt.ready;const dn=`${zt.ready}/${zt.total} guides ready`,rn=zt.prompt_content.length>70?zt.prompt_content.slice(0,67)+"...":zt.prompt_content;ae.push(`"${rn}" â ${dn}`)});const wt=Fe>0?Math.round(Ge/Fe*100):0,ke=Ee>0||ht>0?Ee:Ke,Ve=Ee>0||ht>0?Ee+ht:_e,pt=I==="in_progress"?"in-progress":I==="completed"?"completed":"to-do",Nt=me?[]:ke===0?I==="todo"?["Generate actions from the prompts table below to start improving visibility.","Each prompt can produce up to 5 targeted actions with implementation guides."]:I==="in_progress"?["No actions are currently in progress.","Move to-do actions to in progress to start tracking your work."]:["No actions completed yet.","Complete actions to improve your visibility scores over time."]:ke<Ve?[`${Ve-ke} prompt${Ve-ke!==1?"s":""} have no ${pt} actions.`,`${W.length} ${pt} action${W.length!==1?"s":""} currently in view.`]:I==="completed"?[`All ${Ve} prompts have completed actions.`,"Track your progress on the Impact page to see how visibility changes over time."]:[`${W.length} ${pt} action${W.length!==1?"s":""} currently in view. Focus on completing high-impact items first.`,"Track your progress on the Impact page to see how visibility changes over time."],qe=me?ne.length===0?"Generating actions â hang tight...":ne.length===1?"Generating actions for 1 prompt...":`Generating actions for ${ne.length} prompts...`:ke===0?I==="todo"?"No actions generated yet.":I==="in_progress"?"No actions in progress.":"No completed actions yet.":ke<Ve?`${ke} of ${Ve} prompts have ${pt} actions.`:I==="completed"?`All ${Ve} prompts have completed actions.`:`All ${Ve} prompts have ${pt} actions.`,qt=me||Ve>0,Mn=!me&&ie.total>0?[{value:ie.total,label:"Total"},{value:ie.completed,label:"Completed",color:"#10b981"},{value:ie.in_progress,label:"In Progress",color:"#3b82f6"},{value:ie.todo,label:"To Do",color:"#6b7280"}]:[];return qt?t.jsx(zct,{message:qe,bullets:me?ae:Nt,generating:me,progress:me&&ne.length>0?wt:void 0,progressLabel:me&&ne.length>0?`${Ge}/${Fe} guides`:void 0,metrics:Mn}):null})(),t.jsxs(Ict,{children:[t.jsxs(Act,{children:[t.jsxs(e7,{$active:P==="prompt",onClick:()=>vt("prompt"),children:[t.jsx(_0e,{size:14})," By Prompt"]}),t.jsxs(e7,{$active:P==="source",onClick:()=>vt("source"),children:[t.jsx(m0e,{size:14})," By Source"]}),t.jsxs(e7,{$active:S,onClick:()=>vt(S?"prompt":"kanban"),children:[t.jsx(a0e,{size:14})," Kanban"]})]}),!S&&t.jsxs(Nct,{children:[t.jsx(t7,{$active:I==="todo",onClick:()=>A("todo"),children:"To Do"}),t.jsx(t7,{$active:I==="in_progress",onClick:()=>A("in_progress"),children:"In Progress"}),t.jsx(t7,{$active:I==="completed",$variant:"completed",onClick:()=>A("completed"),children:"Completed"})]}),t.jsxs(Pct,{children:[Ie.length>0&&t.jsx(u1,{options:Ie,value:T,onChange:M}),t.jsx(Bct,{$minWidth:120,children:t.jsx(Fn,{options:Y,value:R,onChange:ae=>F(ae),size:"sm",fullWidth:!0,leftIcon:t.jsx(CP,{size:14})})}),(P==="source"||S)&&t.jsx(_re,{options:H,value:X,onChange:Q,allLabel:"All Types",noun:"type",icon:t.jsx(X_,{size:14}),searchPlaceholder:"Search typesâ¦"})]})]}),S?t.jsx(aue,{fetchPage:Yt,basePath:a,onStatusChange:h?nn:void 0,refreshKey:K}):L?t.jsx(n7,{children:Array.from({length:5}).map((ae,Fe)=>t.jsx(Nde,{},Fe))}):P==="source"?se?t.jsx(Cct,{tree:se,basePath:a,onStatusChange:h?nn:void 0}):t.jsx(i7,{children:"No actions to display for the current filters."}):t.jsxs(t.Fragment,{children:[t.jsxs(PY,{children:[t.jsxs("span",{children:["Prompts with actions (",Ee,")"]}),t.jsx(AY,{children:"Visibility"})]}),Se.length===0?t.jsx(i7,{children:"No prompts with actions yet."}):t.jsx(n7,{children:Se.map(ae=>{const Fe=ae.visibility_score,Ge=Fe==null?Pe:Fe<20?"#ef4444":Fe<40?"#f59e0b":"#10b981",wt=lt.has(ae.id);return t.jsxs(SY,{as:Dn,to:`${a}/actions/prompt/${ae.id}`,style:{textDecoration:"none",cursor:"pointer"},children:[t.jsx(kY,{children:ae.content}),wt&&t.jsxs(Rct,{children:[t.jsx(Tr,{size:10}),"Generatingâ¦"]}),ae.linked_action_count>0&&t.jsx(at,{content:`${ae.linked_action_count} action${ae.linked_action_count!==1?"s":""} linked from other prompts`,size:"sm",children:t.jsxs(Ect,{children:[t.jsx(xu,{size:10}),ae.linked_action_count]})}),ae.earned_count>0&&t.jsxs(IY,{$color:"#7C3AED",children:[ae.earned_count," earned"]}),ae.owned_count>0&&t.jsxs(IY,{$color:"#2563EB",children:[ae.owned_count," owned"]}),t.jsx($Y,{$color:Ge,children:Fe!=null?`${Fe.toFixed(1)}%`:"â"})]},ae.id)})}),t.jsx(pi,{page:De,totalPages:ge,total:Ee,onPrev:()=>te(ae=>Math.max(1,ae-1)),onNext:()=>te(ae=>Math.min(ge,ae+1))}),t.jsxs(PY,{children:[t.jsxs("span",{children:["Prompts without actions (",ht,")"]}),t.jsx(AY,{children:"Visibility"})]}),yt.length===0?t.jsx(i7,{children:"All prompts have actions."}):t.jsx(n7,{children:yt.map(ae=>{const Fe=ae.visibility_score,Ge=Fe==null?Pe:Fe<20?"#ef4444":Fe<40?"#f59e0b":"#10b981",wt=lt.has(ae.id);return t.jsxs(SY,{as:Dn,to:`${a}/actions/prompt/${ae.id}`,style:{textDecoration:"none",cursor:"pointer"},children:[t.jsx(kY,{children:ae.content}),h&&t.jsxs(Oct,{disabled:wt||!ae.has_completed_run,title:ae.run_status==="running"?"Scan is still running":ae.has_completed_run?void 0:"Run a scan first",onClick:ke=>{ke.preventDefault(),ke.stopPropagation(),xn(ae)},children:[t.jsx(Sn,{size:12}),ae.run_status==="running"&&!ae.has_completed_run?"Scan runningâ¦":ae.has_completed_run?wt?"Generating...":"Generate":"No scan data"]}),t.jsx($Y,{$color:Ge,children:Fe!=null?`${Fe.toFixed(1)}%`:"â"})]},ae.id)})}),t.jsx(pi,{page:Le,totalPages:We,total:ht,onPrev:()=>Ue(ae=>Math.max(1,ae-1)),onNext:()=>Ue(ae=>Math.min(We,ae+1))}),t.jsx(Hn,{isOpen:!!be,onClose:()=>rt(null),title:"Regenerate actions?",description:"This will regenerate actions for this prompt. Only to-do actions will be replaced â actions that are in progress or completed will be kept.",size:"sm",footer:t.jsxs(Dct,{children:[t.jsx(he,{variant:"outline",size:"sm",onClick:()=>rt(null),children:"Cancel"}),t.jsxs(he,{variant:"danger",size:"sm",onClick:()=>be&&st(be.id),children:[t.jsx(Sn,{size:13,style:{marginRight:4}}),"Regenerate"]})]}),children:t.jsxs(Lct,{children:[t.jsx("strong",{children:be?.content}
12472),t.jsx("span",{children:"To-do actions will be replaced with new ones. In-progress and completed actions will be kept."})]})})]}),t.jsx(l1,{isOpen:j.isOpen,onClose:j.closeOverlay,title:j.overlayState?.title,message:j.overlayState?.message,limitName:j.overlayState?.limitName,limit:j.overlayState?.limit,used:j.overlayState?.used,isOwner:_==="owner",partnerManaged:$,workspaceId:e||""})]})}const Wct=p.div.withConfig({displayName:"PromptActionDetailPage__Page",componentId:"sc-7hn62o-0"})` 12473 padding: 1.25rem; 12474 max-width: 1200px; 12475 margin: 0 auto; 12476`,Uct=p.div.withConfig({displayName:"PromptActionDetailPage__HeroTop",componentId:"sc-7hn62o-1"})` 12477 display: flex; 12478 align-items: flex-start; 12479 justify-content: space-between; 12480 gap: 1rem; 12481 flex-wrap: wrap; 12482 margin-bottom: 0.75rem; 12483`,Hct=p.div.withConfig({displayName:"PromptActionDetailPage__HeroCard",componentId:"sc-7hn62o-2"})` 12484 display: flex; 12485 align-items: flex-start; 12486 gap: 1rem; 12487 margin-bottom: 1.25rem; 12488 border: 1px solid ${V}; 12489 background: ${Z}; 12490 border-radius: 0.875rem; 12491 padding: 1.25rem; 12492`,qct=p.div.withConfig({displayName:"PromptActionDetailPage__HeroCardLeft",componentId:"sc-7hn62o-3"})` 12493 flex: 1; 12494 min-width: 0; 12495 display: flex; 12496 flex-direction: column; 12497 gap: 0.625rem; 12498`,Gct=p(Dn).withConfig({displayName:"PromptActionDetailPage__PromptContent",componentId:"sc-7hn62o-4"})` 12499 font-size: 1rem; 12500 font-weight: 600; 12501 color: ${O}; 12502 line-height: 1.4; 12503 text-decoration: none; 12504 &::first-letter { text-transform: uppercase; } 12505 &:hover { text-decoration: underline; } 12506`,Vct=p.div.withConfig({displayName:"PromptActionDetailPage__StatsRow",componentId:"sc-7hn62o-5"})` 12507 display: flex; 12508 gap: 1.5rem; 12509 flex-wrap: wrap; 12510`,Ow=p.div.withConfig({displayName:"PromptActionDetailPage__Stat",componentId:"sc-7hn62o-6"})` 12511 display: flex; 12512 flex-direction: column; 12513`,Dw=p.span.withConfig({displayName:"PromptActionDetailPage__StatLabel",componentId:"sc-7hn62o-7"})` 12514 font-size: 0.65rem; 12515 font-weight: 500; 12516 color: ${Pe}; 12517 text-transform: uppercase; 12518 letter-spacing: 0.05em; 12519`,Lw=p.span.withConfig({displayName:"PromptActionDetailPage__StatValue",componentId:"sc-7hn62o-8"})` 12520 font-size: 1.25rem; 12521 font-weight: 700; 12522 color: ${e=>e.$color||O}; 12523`,Kct=p(Dn).withConfig({displayName:"PromptActionDetailPage__BackBtn",componentId:"sc-7hn62o-9"})` 12524 display: inline-flex; 12525 align-items: center; 12526 justify-content: center; 12527 width: 28px; 12528 height: 28px; 12529 border-radius: 6px; 12530 color: ${Pe}; 12531 text-decoration: none; 12532 flex-shrink: 0; 12533 transition: all 0.15s ease; 12534 &:hover { 12535 color: ${O}; 12536 background: ${$e}; 12537 } 12538`,Yct=p.div.withConfig({displayName:"PromptActionDetailPage__Controls",componentId:"sc-7hn62o-10"})` 12539 display: flex; 12540 align-items: center; 12541 gap: 0.5rem; 12542 flex-wrap: wrap; 12543 margin-bottom: 0.75rem; 12544`,Xct=p.div.withConfig({displayName:"PromptActionDetailPage__ScrollableTabs",componentId:"sc-7hn62o-11"})` 12545 overflow-x: auto; 12546 overflow-y: hidden; 12547 -webkit-overflow-scrolling: touch; 12548 scrollbar-width: none; 12549 &::-webkit-scrollbar { display: none; } 12550 flex: 1; 12551 min-width: 0; 12552`,Qct=p.div.withConfig({displayName:"PromptActionDetailPage__BoardTabs",componentId:"sc-7hn62o-12"})` 12553 display: flex; 12554 gap: 0; 12555 border: 1px solid ${V}; 12556 border-radius: 8px; 12557 overflow: hidden; 12558`,r7=p.button.withConfig({displayName:"PromptActionDetailPage__BoardTabBtn",componentId:"sc-7hn62o-13"})` 12559 padding: 0.5rem 0.85rem; 12560 background: ${e=>e.$variant==="completed"?e.$active?"rgba(16, 185, 129, 0.06)":"rgba(16, 185, 129, 0.18)":e.$active?$e:Z}; 12561 border: none; 12562 cursor: pointer; 12563 font-size: 0.8rem; 12564 font-weight: 600; 12565 color: ${e=>e.$variant==="completed"?e.$active?"#10b981":"#047857":e.$active?O:Pe}; 12566 &:hover { 12567 background: ${e=>e.$variant==="completed"?"rgba(16, 185, 129, 0.14)":$e}; 12568 } 12569`,Zct=p.button.withConfig({displayName:"PromptActionDetailPage__KanbanToggle",componentId:"sc-7hn62o-14"})` 12570 display: flex; 12571 align-items: center; 12572 justify-content: center; 12573 width: 34px; 12574 height: 34px; 12575 border-radius: 8px; 12576 border: 1px solid ${e=>e.$active?"#3b82f6":V}; 12577 background: ${e=>e.$active?"rgba(59,130,246,0.08)":Z}; 12578 color: ${e=>e.$active?"#3b82f6":Pe}; 12579 cursor: pointer; 12580 transition: all 0.15s ease; 12581 &:hover { 12582 border-color: #3b82f6; 12583 color: #3b82f6; 12584 background: rgba(59, 130, 246, 0.06); 12585 } 12586`,NY=p.div.withConfig({displayName:"PromptActionDetailPage__ActionsList",componentId:"sc-7hn62o-15"})` 12587 display: flex; 12588 flex-direction: column; 12589 gap: 0.625rem; 12590`,Jct=p.div.withConfig({displayName:"PromptActionDetailPage__EmptyMsg",componentId:"sc-7hn62o-16"})` 12591 text-align: center; 12592 padding: 3rem; 12593 color: ${Pe}; 12594 font-size: 0.85rem; 12595`,edt=p.div.withConfig({displayName:"PromptActionDetailPage__FilterSelect",componentId:"sc-7hn62o-17"})` 12596 min-width: ${e=>e.$minWidth??120}px; 12597`,tdt=[{value:"newest",label:"Newest"},{value:"impact",label:"High Impact"},{value:"effort",label:"Low Effort"},{value:"priority",label:"Priority"}],ndt=p(he).withConfig({displayName:"PromptActionDetailPage__GenerateBtn",componentId:"sc-7hn62o-18"})` 12598 white-space: nowrap; 12599 flex-shrink: 0; 12600`,idt=p.div.withConfig({displayName:"PromptActionDetailPage__ConfirmFooter",componentId:"sc-7hn62o-19"})` 12601 display: flex; 12602 justify-content: flex-end; 12603 gap: 0.5rem; 12604`,rdt=p.div.withConfig({displayName:"PromptActionDetailPage__ConfirmBody",componentId:"sc-7hn62o-20"})` 12605 display: flex; 12606 flex-direction: column; 12607 gap: 0.5rem; 12608 font-size: 0.85rem; 12609`;
12609function odt(){const{workspaceId:e,projectId:n,promptId:i}=Gn(),r=Number(e),o=Number(n),s=Number(i),a=`/workspaces/${e}/projects/${n}`,{projects:c}=Mr(),{user:u}=yn(),m=l.useMemo(()=>c?.find(De=>De.id===o),[c,o]),h=!!(m?.can?.edit||m?.can?.settings),{subscribe:g}=wo(),x=Uo(),y=k1(),w=l.useMemo(()=>r&&u?.organizations?.find(De=>Number(De.id)===r)||null,[r,u?.organizations]),j=w?.role||null,v=!!w?.partner_managed,[_,$]=l.useState(!1),[k,P]=l.useState(!0),[S,I]=l.useState([]),[A,E]=l.useState(1),[B,T]=l.useState(1),[M,R]=l.useState(0),[F,Y]=l.useState("todo"),[H,U]=l.useState(null),[X,Q]=l.useState("newest"),[K,G]=l.useState(!1),[L,q]=l.useState(null),[W,oe]=l.useState(!0),[se,de]=l.useState(!1),[le,me]=l.useState(!1),[ee,ne]=l.useState(`Prompt #${s}`),Ae=l.useRef(null),_e=l.useMemo(()=>{const De=S.length,te=S.filter(yt=>yt.source_category==="earned").length,ge=S.filter(yt=>yt.source_category==="owned").length,Je=S.filter(yt=>yt.estimated_impact!=null),Ee=Je.length>0?Je.reduce((yt,Ne)=>yt+(Ne.estimated_impact||0),0)/Je.length:null,Xe=Ee!=null?Ee>=35?{label:"High",color:"#10b981"}:Ee>=15?{label:"Med",color:"#f59e0b"}:{label:"Low",color:"#ef4444"}:null;return{total:De,earnedCount:te,ownedCount:ge,impactLevel:Xe}},[S]);l.useEffect(()=>{!r||!o||!s||ue(`/api/v1/organizations/${r}/projects/${o}/prompts/${s}`).then(De=>De.json().catch(()=>({}))).then(De=>{const te=De?.prompt?.visibility_score;q(te!=null?Number(te):null),oe(!!De?.prompt?.has_any_prompt_runs),de(!!De?.prompt?.scan_running),De?.prompt?.content&&ne(De.prompt.content)}).catch(()=>{})},[r,o,s]);const we=l.useCallback(()=>{S.length>0?me(!0):Ke()},[S.length]),Ke=l.useCallback(async()=>{me(!1),G(!0);try{const De=await ue(`/api/v1/organizations/${r}/projects/${o}/prompts/${s}/generate_actions`,{method:"POST"});if(!De.ok){const te=await De.json().catch(()=>({})),ge=new Error(te?.error||"Failed to generate");throw te?.errors&&typeof te.errors=="object"&&(ge.limitDetails=te.errors),ge}Fo()}catch(De){y.handleApiError(De)||x.showToast(De?.message||"Failed to generate actions",{tone:"error"}),G(!1)}},[r,o,s,x,y]),ce=l.useCallback(async()=>{if(!(!r||!o)){P(!0);try{const De=new URLSearchParams;De.set("page",String(A)),De.set("per_page","25"),De.set("sort",X),De.set("include_completed","true"),De.set("include_dismissed","false"),De.set("prompt_id",String(s));const te=await ue(`/api/v1/organizations/${r}/projects/${o}/actions?${De.toString()}`),ge=await te.json().catch(()=>({}));if(!te.ok)throw new Error(ge?.error||"Failed");I(ge.actions||[]),T(ge.total_pages||1),R(ge.total||0)}catch(De){x.showToast(De?.message||"Failed to load",{tone:"error"})}finally{P(!1)}}},[r,o,s,A,X,x]);l.useEffect(()=>{E(1)},[F,H,X]),l.useEffect(()=>{ce()},[ce]),l.useEffect(()=>{if(o)return Ae.current=g({channel:"ProjectActionsChannel",project_id:o},{received:De=>{const te=String(De?.type||"");if(te==="action_skeletons_created"&&De.prompt_id===s){const ge=De.actions||[];I(Je=>{const Ee=new Set(Je.map(Ne=>Ne.id)),Xe=Je.map(Ne=>ge.find(Ue=>Ue.id===Ne.id)||Ne);return[...ge.filter(Ne=>!Ee.has(Ne.id)),...Xe]}),G(!0)}if(te==="action_guides_ready"&&De.prompt_id===s){const ge=De.actions||[];I(Je=>Je.map(Ee=>ge.find(Xe=>Xe.id===Ee.id)||Ee))}te==="generation_complete"&&De.prompt_id===s&&(G(!1),ce(),Me(ge=>ge+1)),te==="action_status_changed"&&De.prompt_id===s&&(ce(),Me(ge=>ge+1))}}),()=>{Ae.current?.unsubscribe?.()}},[o,s,g,ce]);const ie=l.useMemo(()=>{let De=S;return F==="todo"?De=De.filter(te=>te.status==="todo"):F==="in_progress"?De=De.filter(te=>te.status==="in_progress"):F==="completed"&&(De=De.filter(te=>te.status==="completed")),H&&(De=De.filter(te=>te.action_type===H)),De},[S,F,H]),Re=l.useMemo(()=>F==="todo"?S.filter(De=>De.status==="todo"):F==="in_progress"?S.filter(De=>De.status==="in_progress"):F==="completed"?S.filter(De=>De.status==="completed"):S,[S,F]),Be=l.useMemo(()=>{const De={};return Re.forEach(te=>{te.action_type&&(De[te.action_type]=(De[te.action_type]||0)+1)}),De},[Re]),tt=l.useMemo(()=>Array.from(new Set(Re.filter(De=>De.action_type).map(De=>De.action_type))),[Re]),dt=l.useCallback(async(De,te)=>{try{if(!(await ue(`/api/v1/organizations/${r}/projects/${o}/actions/${De}/status`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:te})})).ok)throw new Error("Failed to update status");I(Je=>Je.map(Ee=>Ee.id===De?{...Ee,status:te}:Ee))}catch(ge){x.showToast(ge?.message||"Failed to update",{tone:"error"})}},[r,o,x]),[je,Me]=l.useState(0),Se=l.useCallback(async(De,te)=>{if(!r||!o)return{actions:[],hasMore:!1};const ge=new URLSearchParams;ge.set("page",String(te)),ge.set("per_page","25"),ge.set("status",De),ge.set("include_completed",De==="completed"?"true":"false"),ge.set("include_dismissed","fal
12609se"),ge.set("prompt_id",String(s));const Je=await ue(`/api/v1/organizations/${r}/projects/${o}/actions?${ge.toString()}`),Ee=await Je.json().catch(()=>({}));if(!Je.ok)throw new Error(Ee?.error||`Failed (HTTP ${Je.status})`);const Xe=Ee.actions||[],yt=Ee.total_pages||1;return{actions:Xe,hasMore:te<yt}},[r,o,s]),it=l.useMemo(()=>[{label:"Projects",to:e?`/workspaces/${e}`:void 0},{label:m?.name||"Project",to:a},{label:"Actions",to:`${a}/actions`},{label:`Prompt #${i??"â"}`}],[m,a,i,e]);return t.jsxs(Wct,{children:[t.jsxs(Uct,{children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem"},children:[t.jsx(Kct,{to:`${a}/actions`,children:t.jsx(xy,{size:15})}),t.jsx(Fy,{title:"Prompt Actions"})]}),t.jsx("div",{style:{paddingRight:8},children:t.jsx(qr,{items:it})})]}),t.jsxs(Hct,{children:[t.jsxs(qct,{children:[t.jsx(Gct,{to:`${a}/prompts/${i}`,children:ee}),t.jsxs(Vct,{children:[t.jsxs(Ow,{children:[t.jsx(Dw,{children:"Visibility Score"}),t.jsx(Lw,{$color:L==null?void 0:L<20?"#ef4444":L<40?"#f59e0b":"#10b981",children:L!=null?`${L.toFixed(1)}%`:"â"})]}),t.jsxs(Ow,{children:[t.jsx(Dw,{children:"Total Actions"}),t.jsx(Lw,{children:_e.total})]}),t.jsxs(Ow,{children:[t.jsx(Dw,{children:"Earned"}),t.jsx(Lw,{$color:"#7C3AED",children:_e.earnedCount})]}),t.jsxs(Ow,{children:[t.jsx(Dw,{children:"Owned"}),t.jsx(Lw,{$color:"#2563EB",children:_e.ownedCount})]}),_e.impactLevel&&t.jsxs(Ow,{children:[t.jsx(Dw,{children:"Est. Impact"}),t.jsx(Lw,{$color:_e.impactLevel.color,children:_e.impactLevel.label})]})]})]}),h&&t.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-end",gap:"0.5rem",flexShrink:0},children:[t.jsxs(ndt,{variant:"primary",size:"sm",onClick:we,disabled:K||!W,title:se?"Scan is still running":W?void 0:"Run a scan first to generate actions",children:[t.jsx(Sn,{size:13}),K?"Generatingâ¦":S.length>0?"Generate New Actions":"Generate Actions"]}),!W&&t.jsx("span",{style:{fontSize:"0.7rem",color:"#9ca3af",fontWeight:600},children:se?"Scan runningâ¦":"No scan data yet"})]})]}),K&&t.jsx(YO,{message:"Guides generating â they'll appear as each batch completes."}),t.jsxs(Yct,{children:[!_&&t.jsxs(Qct,{children:[t.jsx(r7,{$active:F==="todo",onClick:()=>Y("todo"),children:"To Do"}),t.jsx(r7,{$active:F==="in_progress",onClick:()=>Y("in_progress"),children:"In Progress"}),t.jsx(r7,{$active:F==="completed",$variant:"completed",onClick:()=>Y("completed"),children:"Completed"})]}),t.jsx(Zct,{$active:_,onClick:()=>$(De=>!De),title:"Kanban board view",children:t.jsx(mye,{size:16})}),!_&&t.jsx(edt,{$minWidth:130,children:t.jsx(Fn,{options:tdt,value:X,onChange:De=>Q(De),size:"sm",fullWidth:!0,leftIcon:t.jsx(q8,{size:14})})}),!_&&tt.length>0&&t.jsx(Xct,{children:t.jsx(Tde,{types:tt,selected:H,counts:Be,onSelect:U})})]}),_?t.jsx(aue,{fetchPage:Se,basePath:a,onStatusChange:h?dt:void 0,refreshKey:je}):t.jsx(t.Fragment,{children:k?t.jsx(NY,{children:Array.from({length:4}).map((De,te)=>t.jsx(Nde,{},te))}):ie.length===0?t.jsx(Jct,{children:"No actions for this filter."}):t.jsx(NY,{children:ie.map(De=>t.jsx(RA,{action:De,basePath:a,onStatusChange:h?dt:void 0,promptVisScore:L},De.id))})}),!_&&t.jsx(pi,{page:A,totalPages:B,total:M,onPrev:()=>E(De=>Math.max(1,De-1)),onNext:()=>E(De=>Math.min(B,De+1))}),t.jsx(Hn,{isOpen:le,onClose:()=>me(!1),title:"Regenerate actions?",description:"This will regenerate actions for this prompt. Only to-do actions will be replaced â actions that are in progress or completed will be kept.",size:"sm",footer:t.jsxs(idt,{children:[t.jsx(he,{variant:"outline",size:"sm",onClick:()=>me(!1),children:"Cancel"}),t.jsxs(he,{variant:"danger",size:"sm",onClick:Ke,children:[t.jsx(Sn,{size:13,style:{marginRight:4}}),"Regenerate"]})]}),children:t.jsx(rdt,{children:t.jsxs("span",{children:[S.filter(De=>De.status==="todo").length," to-do action",S.filter(De=>De.status==="todo").length!==1?"s":""," will be replaced with new ones.",S.filter(De=>De.status==="in_progress"||De.status==="completed").length>0&&` ${S.filter(De=>De.status==="in_progress"||De.status==="completed").length} in-progress or completed action${S.filter(De=>De.status==="in_progress"||De.status==="completed").length!==1?"s":""} will be kept.`]})})}),t.jsx(l1,{isOpen:y.isOpen,onClose:y.closeOverlay,title:y.overlayState?.title,message:y.overlayState?.message,limitName:y.overlayState?.limitName,limit:y.overlayState?.limit,used:y.overlayState?.used,isOwner:j==="owner",partnerManaged:v,workspaceId:e||""})]})}function sdt(e,n){const i=[];
12609i.push(`I'm looking at an action item and want to discuss it with you. Here's the full context: 12610`),i.push(`**Action:** ${e.title}`),e.action_type&&i.push(`**Type:** ${$1[e.action_type]??e.action_type}`),i.push(`**Status:** ${hst[e.status]??e.status}`);const r=[];if(e.effort_level&&r.push(`Effort: ${KO[e.effort_level]??e.effort_level}`),e.estimated_impact!=null&&r.push(`Estimated Impact: ${e.estimated_impact}%`),e.feasibility&&r.push(`Feasibility: ${e.feasibility}`),e.impact_timeline_days!=null&&r.push(`Timeline: ${e.impact_timeline_days} days`),e.target_platform&&r.push(`Platform: ${e.target_platform}`),e.content_format_label&&r.push(`Format: ${e.content_format_label}`),r.length&&i.push(`**Metrics:** ${r.join(" · ")}`),e.detail&&i.push(` 12611**Rationale:** ${e.detail}`),e.trigger_signals?.length){i.push(` 12612**Trigger Signals:**`);for(const s of e.trigger_signals){const a=Pde[s.type]?.label??s.type;i.push(`- ${a}: ${s.detail}`)}}const o=e.implementation_guide;if(o&&(i.push(` 12613**Implementation Guide Summary:**`),o.diagnosis&&i.push(`- Diagnosis: ${Bw(o.diagnosis,200)}`),o.gap_analysis&&i.push(`- Gap: ${Bw(o.gap_analysis,200)}`),o.action_steps&&i.push(`- Steps: ${Bw(o.action_steps,300)}`),o.impact_prediction&&i.push(`- Predicted Impact: ${Bw(o.impact_prediction,150)}`)),n.length){i.push(` 12614**Related Prompts:**`);for(const s of n.slice(0,5)){const a=s.visibility_score!=null?` (visibility: ${s.visibility_score.toFixed(1)}%)`:"";i.push(`- "${Bw(s.content,120)}"${a}`)}}return i.push(` 12615Help me understand this action better and advise on how to execute it effectively.`),i.join(` 12616`)}function adt(e){return`Action: ${e.title.length>60?e.title.slice(0,57)+"â¦":e.title}`}function Bw(e,n){const i=e.replace(/\n+/g," ").trim();return i.length<=n?i:i.slice(0,n-1)+"â¦"}const o7=p.div.withConfig({displayName:"ActionDetailPage__Page",componentId:"sc-j6zi7c-0"})` 12617 padding: 1.25rem; 12618 max-width: 1100px; 12619 margin: 0 auto; 12620 overflow-x: hidden; 12621 min-width: 0; 12622`,ldt=p.div.withConfig({displayName:"ActionDetailPage__HeroTop",componentId:"sc-j6zi7c-1"})` 12623 display: flex; 12624 align-items: flex-start; 12625 justify-content: space-between; 12626 gap: 1rem; 12627 flex-wrap: wrap; 12628 margin-bottom: 0.75rem; 12629`,cdt=p.div.withConfig({displayName:"ActionDetailPage__Hero",componentId:"sc-j6zi7c-2"})` 12630 display: flex; 12631 align-items: flex-start; 12632 gap: 1rem; 12633 margin-bottom: 1.5rem; 12634 border: 1px solid ${V}; 12635 background: ${Z}; 12636 border-radius: 0.875rem; 12637 padding: 1.25rem; 12638 @media (max-width: 640px) { 12639 flex-direction: column; 12640 } 12641`,ddt=p.div.withConfig({displayName:"ActionDetailPage__HeroLeft",componentId:"sc-j6zi7c-3"})` 12642 flex: 1; 12643 min-width: 0; 12644 display: flex; 12645 flex-direction: column; 12646 gap: 0.625rem; 12647`,zY=p(Dn).withConfig({displayName:"ActionDetailPage__BackBtn",componentId:"sc-j6zi7c-4"})` 12648 display: inline-flex; 12649 align-items: center; 12650 justify-content: center; 12651 width: 28px; 12652 height: 28px; 12653 border-radius: 6px; 12654 color: ${Pe}; 12655 text-decoration: none; 12656 flex-shrink: 0; 12657 transition: all 0.15s ease; 12658 &:hover { 12659 color: ${O}; 12660 background: ${$e}; 12661 } 12662`,udt=p.h1.withConfig({displayName:"ActionDetailPage__HeroTitle",componentId:"sc-j6zi7c-5"})` 12663 font-size: 1.15rem; 12664 font-weight: 700; 12665 color: ${O}; 12666 margin: 0; 12667 line-height: 1.35; 12668 overflow-wrap: anywhere; 12669 word-break: break-word; 12670`,pdt=p.div.withConfig({displayName:"ActionDetailPage__BadgesRow",componentId:"sc-j6zi7c-6"})` 12671 display: flex; 12672 align-items: center; 12673 gap: 0.5rem; 12674 flex-wrap: wrap; 12675`,mdt=p.div.withConfig({displayName:"ActionDetailPage__MetaRow",componentId:"sc-j6zi7c-7"})` 12676 display: flex; 12677 gap: 1.5rem; 12678 flex-wrap: wrap; 12679 align-items: center; 12680 @media (max-width: 640px) { 12681 gap: 0.75rem; 12682 } 12683`,y$=p.div.withConfig({displayName:"ActionDetailPage__MetaItem",componentId:"sc-j6zi7c-8"})` 12684 display: flex; 12685 align-items: center; 12686 gap: 0.25rem; 12687 font-size: 0.725rem; 12688 color: ${z}; 12689`,hdt=p.span.withConfig({displayName:"ActionDetailPage__StatusBadge",componentId:"sc-j6zi7c-9"})` 12690 font-size: 0.7rem; 12691 font-weight: 600; 12692 padding: 0.15rem 0.5rem; 12693 border-radius: 4px; 12694 color: #fff; 12695 background: ${e=>e.$color}; 12696`,fdt=p.div.withConfig({displayName:"ActionDetailPage__StatusActions",componentId:"sc-j6zi7c-10"})` 12697 display: flex; 12698 gap: 0.35rem; 12699 flex-shrink: 0; 12700 align-items: center; 12701 margin-left: 0.75rem; 12702`,gdt=p.div.withConfig({displayName:"ActionDetailPage__ContentGrid",componentId:"sc-j6zi7c-11"})` 12703 display: grid; 12704 grid-template-columns: 1fr 280px; 12705 gap: 1.25rem; 12706 min-width: 0; 12707 @media (max-width: 768px) { 12708 grid-template-columns: 1fr; 12709 } 12710`,ydt=p.div.withConfig({displayName:"ActionDetailPage__MainContent",componentId:"sc-j6zi7c-12"})` 12711 display: flex; 12712 flex-direction: column; 12713 gap: 1rem; 12714 min-width: 0; 12715`,fm=p.div.withConfig({displayName:"ActionDetailPage__Section",componentId:"sc-j6zi7c-13"})` 12716 border: 1px solid ${V}; 12717 background: ${Z}; 12718 border-radius: 0.75rem; 12719 padding: 1rem; 12720 min-width: 0; 12721 overflow: hidden; 12722`,up=p.h2.withConfig({displayName:"ActionDetailPage__SectionTitle",componentId:"sc-j6zi7c-14"})` 12723 display: flex; 12724 align-items: center; 12725 gap: 0.35rem; 12726 font-size: 0.85rem; 12727 font-weight: 700; 12728 color: ${O}; 12729 margin: 0 0 0.5rem; 12730`,cu=p(wn).withConfig({displayName:"ActionDetailPage__InfoIcon",componentId:"sc-j6zi7c-15"})` 12731 color: ${Pe}; 12732 flex-shrink: 0; 12733 cursor: help; 12734`,yx=p.div.withConfig({displayName:"ActionDetailPage__GuideContent",componentId:"sc-j6zi7c-16"})` 12735 font-size: 0.825rem; 12736 color: ${O}; 12737 line-height: 1.6;
12738 overflow-wrap: anywhere; 12739 word-break: break-word; 12740 min-width: 0; 12741 12742 h2 { 12743 font-size: 0.95rem; 12744 font-weight: 700; 12745 margin: 1rem 0 0.5rem; 12746 color: ${O}; 12747 } 12748 h3 { 12749 font-size: 0.875rem; 12750 font-weight: 600; 12751 margin: 0.75rem 0 0.375rem; 12752 color: ${O}; 12753 } 12754 p { margin: 0.375rem 0; } 12755 ul, ol { 12756 margin: 0.375rem 0; 12757 padding-left: 1.25rem; 12758 } 12759 li { margin: 0.2rem 0; } 12760 code { 12761 font-size: 0.8em; 12762 background: ${$e}; 12763 padding: 0.1rem 0.3rem; 12764 border-radius: 3px; 12765 word-break: break-all; 12766 } 12767 pre { 12768 background: ${$e}; 12769 padding: 0.75rem; 12770 border-radius: 6px; 12771 overflow-x: auto; 12772 font-size: 0.8em; 12773 max-width: 100%; 12774 } 12775 table { 12776 display: block; 12777 overflow-x: auto; 12778 max-width: 100%; 12779 } 12780 img { 12781 max-width: 100%; 12782 height: auto; 12783 } 12784`,xdt=p.div.withConfig({displayName:"ActionDetailPage__EvidenceGrid",componentId:"sc-j6zi7c-17"})` 12785 display: flex; 12786 flex-direction: column; 12787 gap: 0.75rem; 12788 margin-top: 0.5rem; 12789`,bdt=p.div.withConfig({displayName:"ActionDetailPage__EvidenceRow",componentId:"sc-j6zi7c-18"})` 12790 display: flex; 12791 flex-direction: column; 12792 gap: 0.15rem; 12793`,vdt=p.span.withConfig({displayName:"ActionDetailPage__EvidenceLabel",componentId:"sc-j6zi7c-19"})` 12794 font-size: 0.65rem; 12795 font-weight: 600; 12796 color: ${Pe}; 12797 text-transform: uppercase; 12798 letter-spacing: 0.04em; 12799`,wdt=p.div.withConfig({displayName:"ActionDetailPage__EvidenceValue",componentId:"sc-j6zi7c-20"})` 12800 font-size: 0.8rem; 12801 color: ${O}; 12802 line-height: 1.5; 12803`,qh=p.span.withConfig({displayName:"ActionDetailPage__EvidenceTag",componentId:"sc-j6zi7c-21"})` 12804 display: inline-block; 12805 font-size: 0.7rem; 12806 font-weight: 500; 12807 padding: 0.15rem 0.45rem; 12808 border-radius: 4px; 12809 background: ${$e}; 12810 color: ${O}; 12811 margin: 0.1rem 0.2rem 0.1rem 0; 12812`,Fw=p.span.withConfig({displayName:"ActionDetailPage__EvidenceBadge",componentId:"sc-j6zi7c-22"})` 12813 display: inline-block; 12814 font-size: 0.7rem; 12815 font-weight: 600; 12816 padding: 0.15rem 0.45rem; 12817 border-radius: 4px; 12818 color: ${e=>e.$color||O}; 12819 background: ${e=>e.$color?`${e.$color}14`:$e}; 12820`,jdt={Type:"The category of evidence used to generate this action.","Client Cited":"Whether your brand was cited as a source in AI model responses for related queries.","Open Issues":"Number of unresolved technical issues found in the latest site audit.","Bot Access":"Whether AI crawlers and bots can access your site content.","Gap Domains":"Competitor domains that are cited by AI models where your brand is not.","Top Domains":"Most frequently cited domains in AI responses for your topics.","Source Types":"Breakdown of citation source types (e.g. official docs, blogs, forums) found in AI responses.","Issues by Severity":"Site audit issues grouped by severity level (critical, warning, notice).","Issues by Category":"Site audit issues grouped by category (e.g. SEO, performance, accessibility, security).","Related Queries":"Queries used to probe AI models during analysis â these reflect how users might ask about your topic.","Competitor Data":"Competitors identified from AI model responses and citation analysis.","Model Sentiment":"Sentiment scores from different AI models regarding your brand or product."};function _dt(e){if(!e||typeof e!="object")return null;const n=e.type||"general",i=[];return i.push({label:"Type",content:t.jsx(Fw,{$color:"#3b82f6",children:Cdt(n)})}),e.client_cited!=null&&i.push({label:"Client Cited",content:e.client_cited?t.jsx(Fw,{$color:"#10b981",children:"Yes"}):t.jsx(Fw,{$color:"#ef4444",children:"No"})}),e.open_issues!=null&&i.push({label:"Open Issues",content:t.jsx(Fw,{$color:e.open_issues>0?"#f59e0b":"#10b981",children:e.open_issues})}),e.bot_access!=null&&i.push({label:"Bot Access",content:t.jsx(Fw,{$color:e.bot_access?"#10b981":"#ef4444",children:e.bot_access?"Allowed":"Blocked"})}),e.gap_domains?.length>0&&i.push({label:"Gap Domains",content:t.jsx("div",{children:e.gap_domains.map((r,o)=>t.jsx(qh,{children:typeof r=="object"?r.domain||JSON.stringify(r):r},o))})}),e.top_domains?.length>0&&i.push({label:"Top Domains",content:t.jsx("div",{children:e.top_domains.map((r,o)=>t.jsx(qh,{children:typeof r=="object"?`${r.domain}${r.frequency?` (${r.frequency}x)`:""}`:r},o))})}),e.source_types&&Object.keys(e.source_types).length>0&&i.push({label:"Source Types",content:t.jsx("div",{children:Object.entries(e.source_types).map(([r,o])=>t.jsxs(qh,{children:[r,": ",String(o)]},r))})}),e.by_severity&&Object.keys(e.by_severity).length>0&&i.push({label:"Issues by Severity",content:t.jsx("div",{children:Object.entries(e.by_severity).map(([r,o])=>t.jsxs(qh,{children:[r,": ",String(o)]},r))})}),e.by_category&&Object.keys(e.by_category).length>0&&i.push({label:"Issues by Category",content:t.jsx("div",{children:Object.entries(e.by_category).map(([r,o])=>t.jsxs(qh,{children:[r,": ",String(o)]},r))})}),e.fanout_queries?.length>
128200&&i.push({label:"Related Queries",content:t.jsx("div",{children:e.fanout_queries.map((r,o)=>t.jsx(qh,{children:typeof r=="object"?r.query||JSON.stringify(r):r},o))})}),e.competitor_data?.length>0&&i.push({label:"Competitor Data",content:t.jsx("div",{children:e.competitor_data.map((r,o)=>t.jsx(qh,{children:r.domain||r.name||JSON.stringify(r)},o))})}),e.models?.length>0&&i.push({label:"Model Sentiment",content:t.jsx("div",{children:e.models.map((r,o)=>t.jsxs(qh,{children:[r.model||r.name,": ",r.sentiment_score!=null?`${r.sentiment_score}%`:"N/A"]},o))})}),i.length===0?null:i.map((r,o)=>{const s=jdt[r.label];return t.jsxs(bdt,{children:[t.jsxs(vdt,{children:[r.label,s&&t.jsx(at,{content:s,size:"sm",children:t.jsx(cu,{size:11,style:{marginLeft:4,verticalAlign:"middle"}})})]}),t.jsx(wdt,{children:r.content})]},o)})}function Ww(e){if(!e)return e;let n=e;return n=n.replace(/([^\n])(\d+\.\s)/g,`$1 12821 12822$2`),n=n.replace(/([^\n])([-*]\s)/g,`$1 12823 12824$2`),n=n.replace(/([^\n])(#{1,6}\s)/g,`$1 12825 12826$2`),n=n.replace(/^[ \t]*[-*][ \t]*$/gm,""),n=n.replace(/(^|[-\d.]\s)\*([^*\n]+)\*/gm,"$1**$2**"),n=n.replace(/\n{3,}/g,` 12827 12828`),n.trim()}function Cdt(e){return e.replace(/_/g," ").replace(/\b\w/g,n=>n.toUpperCase())}const Sdt=p.div.withConfig({displayName:"ActionDetailPage__Sidebar",componentId:"sc-j6zi7c-23"})` 12829 display: flex; 12830 flex-direction: column; 12831 gap: 1rem; 12832 min-width: 0; 12833`,x$=p.div.withConfig({displayName:"ActionDetailPage__SidebarCard",componentId:"sc-j6zi7c-24"})` 12834 border: 1px solid ${V}; 12835 background: ${Z}; 12836 border-radius: 0.75rem; 12837 padding: 0.875rem; 12838 min-width: 0; 12839 overflow: hidden; 12840`,kdt=p(Dn).withConfig({displayName:"ActionDetailPage__LinkedPromptItem",componentId:"sc-j6zi7c-25"})` 12841 display: flex; 12842 flex-direction: column; 12843 gap: 0.15rem; 12844 padding: 0.4rem 0; 12845 border-bottom: 1px solid ${$e}; 12846 text-decoration: none; 12847 &:last-child { border-bottom: none; } 12848 &:hover { background: ${$e}; margin: 0 -0.25rem; padding-left: 0.25rem; padding-right: 0.25rem; border-radius: 4px; } 12849`,$dt=p.span.withConfig({displayName:"ActionDetailPage__LinkedPromptText",componentId:"sc-j6zi7c-26"})` 12850 font-size: 0.775rem; 12851 color: ${O}; 12852 font-weight: 500; 12853 display: -webkit-box; 12854 -webkit-line-clamp: 2; 12855 -webkit-box-orient: vertical; 12856 overflow: hidden; 12857`,Idt=p.span.withConfig({displayName:"ActionDetailPage__LinkedPromptVis",componentId:"sc-j6zi7c-27"})` 12858 font-size: 0.675rem; 12859 color: ${Pe}; 12860`,b$=p.div.withConfig({displayName:"ActionDetailPage__GeneratingMsg",componentId:"sc-j6zi7c-28"})` 12861 text-align: center; 12862 padding: 2rem; 12863 color: ${Pe}; 12864 font-size: 0.85rem; 12865`,Pdt=p.div.withConfig({displayName:"ActionDetailPage__SignalItem",componentId:"sc-j6zi7c-29"})` 12866 display: flex; 12867 flex-direction: column; 12868 gap: 0.1rem; 12869 padding: 0.4rem 0; 12870 border-bottom: 1px solid ${$e}; 12871 &:last-child { border-bottom: none; } 12872`,Adt=p.span.withConfig({displayName:"ActionDetailPage__SignalLabel",componentId:"sc-j6zi7c-30"})` 12873 font-size: 0.7rem; 12874 font-weight: 600; 12875 color: ${e=>e.$color}; 12876`,Ndt=p.span.withConfig({displayName:"ActionDetailPage__SignalDetail",componentId:"sc-j6zi7c-31"})` 12877 font-size: 0.7rem; 12878 color: ${z}; 12879 line-height: 1.4; 12880`,zdt=p.a.withConfig({displayName:"ActionDetailPage__TargetUrlLink",componentId:"sc-j6zi7c-32"})` 12881 display: flex; 12882 align-items: center; 12883 gap: 0.5rem; 12884 padding: 0.5rem 0; 12885 text-decoration: none; 12886 color: ${O}; 12887 font-size: 0.775rem; 12888 font-weight: 500; 12889 overflow: hidden; 12890 &:hover { text-decoration: underline; } 12891`,Tdt=p.span.withConfig({displayName:"ActionDetailPage__TargetUrlHost",componentId:"sc-j6zi7c-33"})` 12892 overflow: hidden; 12893 text-overflow: ellipsis; 12894 white-space: nowrap; 12895 min-width: 0; 12896`,Edt=p.span.withConfig({displayName:"ActionDetailPage__TargetUrlHint",componentId:"sc-j6zi7c-34"})` 12897 display: flex; 12898 align-items: center; 12899 gap: 0.25rem; 12900 font-size: 0.65rem; 12901 color: ${Pe}; 12902 margin-top: 0.25rem; 12903`,Mdt=p.button.withConfig({displayName:"ActionDetailPage__SameUrlToggle",componentId:"sc-j6zi7c-35"})` 12904 display: flex; 12905 align-items: center; 12906 gap: 0.3rem; 12907 margin-top: 0.5rem; 12908 padding: 0.3rem 0; 12909 border: none; 12910 background: none; 12911 cursor: pointer; 12912 font-size: 0.7rem; 12913 font-weight: 500; 12914 color: ${z}; 12915 transition: color 0.15s ease; 12916 &:hover { color: ${O}; } 12917`,Rdt=p.div.withConfig({displayName:"ActionDetailPage__SameUrlList",componentId:"sc-j6zi7c-36"})` 12918 display: flex; 12919 flex-direction: column; 12920 gap: 0.35rem; 12921 margin-top: 0.35rem; 12922 padding-top: 0.35rem; 12923 border-top: 1px solid ${V}; 12924`,Odt=p(Dn).withConfig({displayName:"ActionDetailPage__SameUrlItem",componentId:"sc-j6zi7c-37"})` 12925 display: flex; 12926 align-items: center; 12927 gap: 0.4rem; 12928 text-decoration: none; 12929 padding: 0.3rem 0.4rem; 12930 border-radius: 0.375rem; 12931 transition: background 0.1s ease; 12932 &:hover { background: ${$e}; } 12933`,Ddt=p.span.withConfig({displayName:"ActionDetailPage__SameUrlDot",componentId:"sc-j6zi7c-38"})` 12934 width: 6px; 12935 height: 6px; 12936 border-radius: 50%; 12937 background: ${e=>e.$color}; 12938 flex-shrink: 0; 12939`,Ldt=p.span.withConfig({displayName:"ActionDetailPage__SameUrlTitle",componentId:"sc-j6zi7c-39"})` 12940 font-size: 0.7rem; 12941 font-weight: 500; 12942 color: ${O}; 12943 overflow: hidden; 12944 text-overflow: ellipsis; 12945 white-space: nowrap; 12946 min-width: 0; 12947 flex: 1; 12948`;function TY(e){switch(e){case"todo":return"#6b7280";case"in_progress":return"#3b82f6";case"completed":return"#10b981";case"dismissed":return"#ef4444";default:return"#6b7280"}}function Bdt(){const{workspaceId:e,projectId:n,actionId:i}
12948=Gn(),r=Number(e),o=Number(n),s=Number(i),a=`/workspaces/${e}/projects/${n}`,{projects:c}=Mr(),u=l.useMemo(()=>c?.find(M=>M.id===o),[c,o]),m=!!(u?.can?.edit||u?.can?.settings),h=Uo(),[g,x]=l.useState(!0),[y,w]=l.useState(null),[j,v]=l.useState([]),[_,$]=l.useState([]),[k,P]=l.useState(!1),S=l.useCallback(async()=>{if(!(!r||!o||!s)){x(!0);try{const M=await ue(`/api/v1/organizations/${r}/projects/${o}/actions/${s}`),R=await M.json().catch(()=>({}));if(!M.ok)throw new Error(R?.error||"Failed");w(R.action||null),v(R.linked_prompts||[]),$(R.same_url_actions||[])}catch(M){h.showToast(M?.message||"Failed to load action",{tone:"error"})}finally{x(!1)}}},[r,o,s,h]);l.useEffect(()=>{S()},[S]);const I=l.useCallback(async M=>{if(y)try{if(!(await ue(`/api/v1/organizations/${r}/projects/${o}/actions/${y.id}/status`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:M})})).ok)throw new Error("Failed to update status");S()}catch(R){h.showToast(R?.message||"Failed",{tone:"error"})}},[y,r,o,S,h]),{subscribe:A}=wo(),E=l.useRef(null);l.useEffect(()=>{if(o)return E.current=A({channel:"ProjectActionsChannel",project_id:o},{received:M=>{const R=String(M?.type||"");R==="action_status_changed"&&M.action_id===s&&S(),R==="action_guides_ready"&&(M.action_ids||[]).includes(s)&&S(),R==="generation_complete"&&y?.prompt_id&&M.prompt_id===y.prompt_id&&S()}}),()=>{E.current?.unsubscribe?.()}},[o,s,y?.prompt_id,A,S]);const B=l.useMemo(()=>
12948[{label:"Projects",to:e?`/workspaces/${e}`:void 0},{label:u?.name||"Project",to:a},{label:"Actions",to:`${a}/actions`},{label:`#${y?.id??"â"}`}],[u,a,y,e]);if(g)return t.jsxs(o7,{children:[t.jsx(nt,{height:"1.5rem",width:"60%"}),t.jsx(nt,{height:"3rem",width:"100%",style:{marginTop:"1rem"}}),t.jsx(nt,{height:"15rem",width:"100%",style:{marginTop:"1rem"}})]});if(!y)return t.jsxs(o7,{children:[t.jsx(zY,{to:`${a}/actions`,children:t.jsx(xy,{size:15})}),t.jsx(b$,{children:"Action not found."})]});const T=y.implementation_guide;return t.jsxs(o7,{children:[t.jsxs(ldt,{children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem"},children:[t.jsx(zY,{to:y.prompt_id?`${a}/actions/prompt/${y.prompt_id}`:`${a}/actions`,children:t.jsx(xy,{size:15})}),t.jsx(Fy,{title:"Action Detail"}),m&&y.status!=="completed"&&y.status!=="dismissed"&&t.jsxs(fdt,{children:[y.status!=="in_progress"&&t.jsxs(he,{variant:"primary",size:"sm",onClick:()=>I("in_progress"),children:[t.jsx(eh,{size:12})," Start"]}),t.jsxs(he,{variant:"outline",size:"sm",onClick:()=>I("completed"),children:[t.jsx(Zn,{size:12})," Complete"]}),t.jsxs(he,{variant:"ghost",size:"sm",onClick:()=>I("dismissed"),children:[t.jsx(Ei,{size:12})," Dismiss"]})]})]}),t.jsx("div",{style:{paddingRight:8},children:t.jsx(qr,{items:B})})]}),t.jsx(cdt,{children:t.jsxs(ddt,{children:[t.jsxs(pdt,{children:[t.jsx(zde,{actionType:y.action_type}),t.jsx(Zst,{format:y.content_format}),y.self_healing_fixable&&t.jsx(at,{content:"This action relates to technical issues found in your site audit that can be fixed directly on your own site",size:"sm",children:t.jsxs(y$,{children:[t.jsx(Ef,{size:11})," Fixable"]})})]}),t.jsx(udt,{children:y.title}),t.jsxs(mdt,{children:[t.jsx(at,{content:"Estimated visibility improvement if this action is completed",size:"sm",children:t.jsx("span",{children:t.jsx(gst,{impact:y.estimated_impact})})}),t.jsx(at,{content:"How much time and resources are needed to complete this action",size:"sm",children:t.jsx("span",{children:t.jsx(Ede,{effort:y.effort_level})})}),t.jsx(at,{content:"Likelihood of successfully executing this action",size:"sm",children:t.jsx("span",{children:t.jsx(tat,{feasibility:y.feasibility})})}),y.impact_timeline_days!=null&&t.jsx(at,{content:"Estimated number of days until the impact becomes measurable",size:"sm",children:t.jsxs(y$,{children:[t.jsx(qc,{size:11})," ",y.impact_timeline_days," days"]})}),y.target_platform&&t.jsx(at,{content:"The AI platform or search engine this action targets",size:"sm",children:t.jsxs(y$,{children:[t.jsx(as,{size:11})," ",y.target_platform]})}),t.jsx(at,{content:"Date this action was created",size:"sm",children:t.jsxs(y$,{children:[t.jsx(a1,{size:11})," ",new Date(y.created_at).toLocaleDateString()]})}),t.jsx(at,{content:`Current status: ${y.status.replace("_"," ")}`,size:"sm",children:t.jsx(hdt,{$color:TY(y.status),children:y.status.replace("_"," ").toUpperCase()})})]})]})}),t.jsxs(gdt,{children:[t.jsxs(ydt,{children:[T?t.jsxs(t.Fragment,{children:[T.diagnosis&&t.jsxs(fm,{children:[t.jsxs(up,{children:["Why This Matters",t.jsx(at,{content:"Explains why this action is important for your AI visibility, based on data from your project",size:"sm",children:t.jsx(cu,{size:13})})]}),t.jsx(yx,{children:t.jsx(rb,{remarkPlugins:[sb],children:Ww(T.diagnosis)})})]}),T.gap_analysis&&t.jsxs(fm,{children:[t.jsxs(up,{children:["Gap Analysis",t.jsx(at,{content:"Identifies what your brand is currently missing compared to competitors and citation sources",size:"sm",children:t.jsx(cu,{size:13})})]}),t.jsx(yx,{children:t.jsx(rb,{remarkPlugins:[sb],children:Ww(T.gap_analysis)})})]}),T.action_steps&&t.jsxs(fm,{children:[t.jsxs(up,{children:["Action Steps",t.jsx(at,{content:"Step-by-step instructions to implement this action, tailored to the content format and target platform",size:"sm",children:t.jsx(cu,{size:13})})]}),t.jsx(yx,{children:t.jsx(rb,{remarkPlugins:[sb],children:Ww(T.action_steps)})})]}),T.self_healing_note&&T.self_healing_note!=="N/A"&&t.jsxs(fm,{children:[t.jsxs(up,{children:["Site Audit Connection",t.jsx(at,{content:"Links this action to technical issues found in your site audit that may affect AI visibility",size:"sm",children:t.jsx(cu,{size:13})})]}),t.jsx(yx,{children:t.jsx(rb,{remarkPlugins:[sb],children:Ww(T.self_healing_note)})})]}),T.impact_prediction&&t.jsxs(fm,{children:[t.jsxs(up,{children:["Expected Impact",t.jsx(at,{content:"Predicted visibility improvement and how to measure success after completing this action",size:"sm",children:t.jsx(cu,{size:13})})]}),t.jsx(yx,{children:t.jsx(rb,{remarkPlugins:[sb],children:Ww(T.impact_prediction)})})]})]}):y.guide_status==="generating"||y.guide_status==="pending"?t.jsx(fm,{children:t.jsx(b$,{children:"Guide is being generated... It will appear here once complete."})}):y.guide_status==="failed"?t.jsx(fm,{children:t.jsx(b$,{children:"Guide generation failed. You can retry from the overview page."})}):t.jsx(fm,{children:t.jsx(b$,{children:"No implementation guide available for this action."})}),y.evidence_section&&t.jsxs(fm,{children:[t.jsxs(up,{children:["Evidence",t.jsx(at,{content:"Data and signals used to generate this action",size:"sm",children:t.jsx(cu,{size:13})})]}),t.jsx(xdt,{children:_dt(y.evidence_section)})]})]}),t.jsxs(Sdt,{children:[t.jsx(EC,{orgId:r,projectId:o,sessionTitle:adt(y),initialMessage:sdt(y,j),metadata:{resource_type:"project_action",resource_id:y.id},placeholder:"Ask about this actionâ¦"}),y.target_url&&t.jsxs(x$,{children:[t.jsxs(up,{children:["Actionable Link",t.jsx(at,{content:"A suggested starting point for this action based on the recommendation context.",size:"sm",children:t.jsx(cu,{size:13})})]}),t.jsxs(zdt,{href:y.target_url,target:"_blank",rel:"noopener noreferrer",children:[t.jsx($u,{domain:y.target_url,size:20}),t.jsx(Tdt,{children:(()=>{try{return new URL(y.target_url).hostname.replace(/^www\./,"")}catch{return y.target_url}})()}),t.jsx(as,{size:12,style:{flexShrink:0,color:Pe}})]}),t.jsxs(Edt,{children:[t.jsx(wn,{size:10})," Suggested destination"]}),_.length>0&&t.jsxs(t.Fragment,{children:[t.jsxs(Mdt,{onClick:()=>P(M=>!M),children:[k?t.jsx(qn,{size:12}):t.jsx(Gi,{size:12}),_.length," other action",_.length!==1?"s":""," share this link"]}),k&&t.jsx(Rdt,{children:_.map(M=>t.jsxs(Odt,{to:`${a}/actions/${M.id}`,children:[t.jsx(Ddt,{$color:TY(M.status)}),t.jsx(Ldt,{children:M.title})]},M.id))})]})]}),j.length>0&&t.jsxs(x$,{children:[t.jsxs(up,{children:["Related Prompts",t.jsx(at,{content:"Other prompts that also generated or are linked to this same action",size:"sm",children:t.jsx(cu,{size:13})})]}),j.map(M=>t.jsxs(kdt,{to:`${a}/actions/prompt/${M.id}`,children:[t.jsx($dt,{children:M.content}),t.jsxs(Idt,{children:["Visibility: ",M.visibility_score!=null?`${M.visibility_score.toFixed(1)}%`:"N/A"]})]},M.id))]}),y.trigger_signals&&y.trigger_signals.length>0&&t.jsxs(x$,{children:[t.jsxs(up,{children:["Why This Action",t.jsx(at,{content:"Data-driven signals that triggered the creation of this action",size:"sm",children:t.jsx(cu,{size:13})})]}),y.trigger_signals.map((M,R)=>{const F=Pde[M.type]||{label:M.type,color:Pe};return t.jsxs(Pdt,{children:[t.jsx(Adt,{$color:F.color,children:F.label}),t.jsx(Ndt,{children:M.detail})]},R)})]}),y.detail&&t.jsxs(x$,{children:[t.jsxs(up,{children:["Rationale",t.jsx(at,{content:"The reasoning behind why this action was recommended for your project",size:"sm",children:t.jsx(cu,{size:13})})]}),t.jsx(yx,{style:{fontSize:"0.775rem"},children:y.detail})]})]})]})]})}const Fdt=p.div.withConfig({displayName:"ActionsImpactPage__Page",componentId:"sc-uskmto-0"})` 12949 padding: 1.25rem; 12950 max-width: 1200px; 12951 margin: 0 auto;
12952`,Wdt=p.div.withConfig({displayName:"ActionsImpactPage__HeroTop",componentId:"sc-uskmto-1"})` 12953 display: flex; 12954 align-items: flex-start; 12955 justify-content: space-between; 12956 gap: 1rem; 12957 flex-wrap: wrap; 12958 margin-bottom: 0.75rem; 12959`,Udt=p.div.withConfig({displayName:"ActionsImpactPage__BannerSkeleton",componentId:"sc-uskmto-2"})` 12960 display: flex; 12961 align-items: center; 12962 gap: 0.75rem; 12963 padding: 1rem 1.25rem; 12964 margin: 0.75rem 0 1.25rem; 12965 border-radius: 0.75rem; 12966 border: 1px solid ${V}; 12967 background: ${Z}; 12968`,Hdt=p.div.withConfig({displayName:"ActionsImpactPage__Controls",componentId:"sc-uskmto-3"})` 12969 display: flex; 12970 align-items: center; 12971 gap: 0.5rem; 12972 flex-wrap: wrap; 12973 margin-bottom: 1rem; 12974`,qdt=p.div.withConfig({displayName:"ActionsImpactPage__ScrollableTabs",componentId:"sc-uskmto-4"})` 12975 overflow-x: auto; 12976 overflow-y: hidden; 12977 -webkit-overflow-scrolling: touch; 12978 scrollbar-width: none; 12979 &::-webkit-scrollbar { display: none; } 12980 flex: 1; 12981 min-width: 0; 12982`,Gdt=p.div.withConfig({displayName:"ActionsImpactPage__TableSection",componentId:"sc-uskmto-5"})` 12983 border: 1px solid ${V}; 12984 background: ${Z}; 12985 border-radius: 0.75rem; 12986 overflow: hidden; 12987 margin-bottom: 1.5rem; 12988`,Vdt=p.div.withConfig({displayName:"ActionsImpactPage__TableHeader",componentId:"sc-uskmto-6"})` 12989 display: flex; 12990 align-items: center; 12991 gap: 0.5rem; 12992 padding: 0.75rem 1rem; 12993 border-bottom: 1px solid ${V}; 12994 font-size: 0.85rem; 12995 font-weight: 700; 12996 color: ${O}; 12997`,Kdt=p.table.withConfig({displayName:"ActionsImpactPage__Table",componentId:"sc-uskmto-7"})` 12998 width: 100%; 12999 border-collapse: collapse; 13000`,xx=p.th.withConfig({displayName:"ActionsImpactPage__Th",componentId:"sc-uskmto-8"})` 13001 text-align: left; 13002 padding: 0.5rem 0.75rem; 13003 font-size: 0.65rem; 13004 font-weight: 600; 13005 color: ${Pe}; 13006 text-transform: uppercase; 13007 letter-spacing: 0.04em; 13008 border-bottom: 1px solid ${$e}; 13009 white-space: nowrap; 13010`,bx=p.td.withConfig({displayName:"ActionsImpactPage__Td",componentId:"sc-uskmto-9"})` 13011 padding: 0.6rem 0.75rem; 13012 font-size: 0.775rem; 13013 color: ${O}; 13014 border-bottom: 1px solid ${$e}; 13015 vertical-align: middle; 13016`,Ydt=p(Dn).withConfig({displayName:"ActionsImpactPage__TitleCell",componentId:"sc-uskmto-10"})` 13017 color: ${O}; 13018 text-decoration: none; 13019 font-weight: 500; 13020 display: -webkit-box; 13021 -webkit-line-clamp: 2; 13022 -webkit-box-orient: vertical; 13023 overflow: hidden; 13024 line-height: 1.35; 13025 &:hover { text-decoration: underline; } 13026`,Xdt=p.span.withConfig({displayName:"ActionsImpactPage__DateCell",componentId:"sc-uskmto-11"})` 13027 font-size: 0.7rem; 13028 color: ${z}; 13029 white-space: nowrap; 13030`,EY=p.div.withConfig({displayName:"ActionsImpactPage__MetricCell",componentId:"sc-uskmto-12"})` 13031 display: inline-flex; 13032 align-items: center; 13033 gap: 0.35rem; 13034`,v$=p.span.withConfig({displayName:"ActionsImpactPage__TrendPill",componentId:"sc-uskmto-13"})` 13035 display: inline-flex; 13036 align-items: center; 13037 gap: 0.2rem; 13038 font-size: 0.55rem; 13039 font-weight: 950; 13040 padding: 0.06rem 0.3rem; 13041 border-radius: 9999px; 13042 border: 1px solid 13043 ${e=>e.$neutral?"rgba(107, 114, 128, 0.25)":e.$positive?"rgba(16, 185, 129, 0.22)":"rgba(239, 68, 68, 0.22)"}; 13044 color: ${e=>e.$neutral?z:e.$positive?"#065F46":"#991B1B"}; 13045 background: ${e=>e.$neutral?"rgba(107, 114, 128, 0.08)":e.$positive?"rgba(16, 185, 129, 0.12)":"rgba(239, 68, 68, 0.12)"}; 13046 white-space: nowrap; 13047`,Qdt=p.div.withConfig({displayName:"ActionsImpactPage__TableEmpty",componentId:"sc-uskmto-14"})` 13048 text-align: center; 13049 padding: 2rem; 13050 color: ${Pe}; 13051 font-size: 0.8rem; 13052`,Zdt=p.div.withConfig({displayName:"ActionsImpactPage__ChartSection",componentId:"sc-uskmto-15"})` 13053 border: 1px solid ${V}; 13054 background: ${Z}; 13055 border-radius: 0.75rem; 13056 padding: 1rem; 13057 margin-bottom: 1.5rem; 13058`,Jdt=p.div.withConfig({displayName:"ActionsImpactPage__ChartTitle",componentId:"sc-uskmto-16"})` 13059 font-size: 0.85rem; 13060 font-weight: 700; 13061 color: ${O}; 13062 margin-bottom: 0.75rem; 13063`,eut=p.div.withConfig({displayName:"ActionsImpactPage__ChartEmpty",componentId:"sc-uskmto-17"})` 13064 text-align: center; 13065 padding: 2rem; 13066 color: ${Pe}; 13067 font-size: 0.8rem; 13068`,tut=p.div.withConfig({displayName:"ActionsImpactPage__ChartLegend",componentId:"sc-uskmto-18"})` 13069 display: flex; 13070 gap: 1.25rem; 13071 justify-content: center; 13072 margin-top: 0.5rem; 13073`,MY=p.span.withConfig({displayName:"ActionsImpactPage__LegendItem",componentId:"sc-uskmto-19"})` 13074 display: inline-flex; 13075 align-items: center; 13076 gap: 0.375rem; 13077 font-size: 0.7rem; 13078 font-weight: 600; 13079 color: ${Pe}; 13080`,RY=p.span.withConfig({displayName:"ActionsImpactPage__LegendSwatch",componentId:"sc-uskmto-20"})` 13081 display: inline-block; 13082 width: 1.25rem; 13083 height: 3px; 13084 background: ${e=>e.$dashed?"transparent":e.$color}; 13085 border-top: ${e=>e.$dashed?`2px dashed ${e.$color}`:"none"}; 13086 border-radius: 2px; 13087`,nut=p.div.withConfig({displayName:"ActionsImpactPage__EmptyMsg",componentId:"sc-uskmto-21"})` 13088 text-align: center; 13089 padding: 3rem; 13090 color: ${Pe}; 13091 font-size: 0.85rem; 13092`;function iut(){const{workspaceId:e,projectId:n}
13092=Gn(),i=Number(e),r=Number(n),o=`/workspaces/${e}/projects/${n}`,{projects:s}=Mr(),a=l.useMemo(()=>s?.find(ne=>ne.id===r),[s,r]),c=S1(i,r),u=c.topics,{subscribe:m}=wo(),h=l.useRef(null);l.useEffect(()=>{c.topics&&c.topics.length>0||c.error||c.ensure()},[i,r,c]);const[g,x]=l.useState(!0),[y,w]=l.useState([]),[j,v]=l.useState(null),[_,$]=l.useState(()=>{const ne=new Date,Ae=ne.toISOString().slice(0,10),_e=new Date(ne);return _e.setDate(_e.getDate()-89),{start:_e.toISOString().slice(0,10),end:Ae}}),[k,P]=l.useState({total:0,completed:0,inProgress:0,todo:0,earned:0,owned:0}),S=l.useCallback(async()=>{if(!(!i||!r)){x(!0);try{const ne=new URLSearchParams;ne.set("per_page","1"),ne.set("include_completed","true"),ne.set("include_dismissed","false");const Ae=await ue(`/api/v1/organizations/${i}/projects/${r}/actions?${ne.toString()}`),_e=await Ae.json().catch(()=>({}));if(!Ae.ok)return;const we=_e.status_counts||{};P({total:we.total||0,completed:we.completed||0,inProgress:we.in_progress||0,todo:we.todo||0,earned:we.earned||0,owned:we.owned||0})}catch{}finally{x(!1)}}},[i,r]);l.useEffect(()=>{S()},[S]);const[I,A]=l.useState([]),[E,B]=l.useState(!0),T=l.useCallback(async()=>{if(!(!i||!r)){B(!0);try{const ne=new URLSearchParams;ne.set("limit","180"),y.length>0&&ne.set("topic_ids",y.join(",")),j&&ne.set("action_type",j),_.start&&ne.set("date_from",_.start),_.end&&ne.set("date_to",_.end);const Ae=await ue(`/api/v1/organizations/${i}/projects/${r}/actions/visibility_timeseries?${ne.toString()}`),_e=await Ae.json().catch(()=>({}));Ae.ok&&_e.series&&A(_e.series)}catch{}finally{B(!1)}}},[i,r,y,j,_]);l.useEffect(()=>{T()},[T]);const[M,R]=l.useState([]),[F,Y]=l.useState(1),[H,U]=l.useState(1),[X,Q]=l.useState(0),[K,G]=l.useState(!1),[L,q]=l.useState({}),W=l.useCallback(async()=>{if(!(!i||!r)){G(!0);try{const ne=new URLSearchParams;ne.set("page",String(F)),ne.set("per_page","10"),ne.set("status","completed"),ne.set("include_completed","true"),ne.set("include_dismissed","false"),ne.set("sort","newest"),y.length>0&&ne.set("topic_ids",y.join(",")),j&&ne.set("action_type",j),_.start&&ne.set("date_from",_.start),_.end&&ne.set("date_to",_.end);const Ae=await ue(`/api/v1/organizations/${i}/projects/${r}/actions?${ne.toString()}`),_e=await Ae.json().catch(()=>({}));if(!Ae.ok)throw new Error(_e?.error||"Failed");R(_e.actions||[]),U(_e.total_pages||1),Q(_e.total||0),q(_e.prompt_summaries||{})}catch{}finally{G(!1)}}},[i,r,F,y,j,_]);l.useEffect(()=>{W()},[W]),l.useEffect(()=>{Y(1)},[y,j,_]),l.useEffect(()=>{if(r)return h.current=m({channel:"ProjectActionsChannel",project_id:r},{received:ne=>{const Ae=String(ne?.type||"");(Ae==="generation_complete"||Ae==="action_status_changed"||Ae==="action_guides_ready")&&(S(),T(),W())}}),()=>{h.current?.unsubscribe?.()}},[r,m,S,T,W]);const oe=l.useMemo(()=>{const{total:ne,completed:Ae,inProgress:_e,todo:we,earned:Ke,owned:ce}=k,ie=ne>0?Ae/ne*100:0,Re=ne>0?(Ae+_e)/ne*100:0;return{total:ne,completed:Ae,inProgress:_e,todo:we,earned:Ke,owned:ce,completionRate:ie,activeRate:Re}},[k]),se=l.useMemo(()=>{if(oe.total===0)return[];const ne=[],Ae=[];oe.inProgress>0&&Ae.push(`${oe.inProgress} in progress`),oe.todo>0&&Ae.push(`${oe.todo} to do`),Ae.length>0&&ne.push(Ae.join(", ")+".");const _e=[];if(oe.earned>0||oe.owned>0){const we=[];oe.earned>
130920&&we.push(`${oe.earned} earned`),oe.owned>0&&we.push(`${oe.owned} owned`),_e.push(we.join(", "))}return _e.length>0&&ne.push(_e.join(" · ")+"."),ne},[oe]),de=l.useMemo(()=>I.length===0?null:I[I.length-1].visibility_score??null,[I]),le=l.useMemo(()=>Object.keys($1),[]),me=l.useMemo(()=>(u||[]).map(ne=>({id:ne.id,label:ne.name})),[u]),ee=l.useMemo(()=>[{label:"Projects",to:e?`/workspaces/${e}`:void 0},{label:a?.name||"Project",to:o},{label:"Actions",to:`${o}/actions`},{label:"Impact"}],[a,o,e]);return t.jsxs(Fdt,{children:[t.jsxs(Wdt,{children:[t.jsxs(UO,{children:[t.jsxs(hy,{as:Dn,to:`${o}/actions`,$active:!1,children:[t.jsx(Ks,{size:16}),"Actions"]}),t.jsxs(hy,{$active:!0,children:[t.jsx(qi,{size:16}),"Impact"]})]}),t.jsx("div",{style:{paddingRight:8},children:t.jsx(qr,{items:ee})})]}),g?t.jsxs(Udt,{children:[t.jsx("div",{style:{display:"flex",gap:"0.5rem"},children:Array.from({length:4}).map((ne,Ae)=>t.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",width:80,padding:"0.25rem 0.75rem"},children:[t.jsx(nt,{height:"1.75rem",width:"2.5rem",style:{marginBottom:"0.25rem"}}),t.jsx(nt,{height:"0.55rem",width:"3.5rem"})]},Ae))}),t.jsxs("div",{style:{marginLeft:"1.5rem",paddingLeft:"1.5rem",borderLeft:"1px solid var(--color-gray-200, #e5e7eb)",flex:1},children:[t.jsx(nt,{height:"0.8rem",width:"60%",style:{marginBottom:"0.4rem"}}),t.jsx(nt,{height:"0.6rem",width:"80%"})]})]}):t.jsx(YO,{message:`${oe.completionRate.toFixed(0)}% complete â ${oe.completed} of ${oe.total} actions done`,bullets:se,metrics:oe.total>0?[{value:oe.total,label:"Total"},{value:oe.completed,label:"Completed",color:"#10b981"},{value:oe.inProgress,label:"In Progress",color:"#3b82f6"},{value:oe.todo,label:"To Do",color:"#6b7280"}]:void 0}),t.jsxs(Hdt,{children:[t.jsx(rh,{value:_,onChange:$,presets:[7,30,90],historyMonthsLimit:6}),me.length>0&&t.jsx(u1,{options:me,value:y,onChange:w}),t.jsx(qdt,{children:t.jsx(Tde,{types:le,selected:j,onSelect:v})})]}),g?t.jsx(nt,{height:"12rem",width:"100%"}):oe.total===0?t.jsx(nut,{children:"No actions yet. Generate actions from your prompts to track progress."}):t.jsxs(t.Fragment,{children:[t.jsxs(Zdt,{children:[t.jsx(Jdt,{children:"Visibility Over Time"}),E?t.jsx(nt,{height:"12rem",width:"100%"}):I.length===0?t.jsx(eut,{children:"No visibility data for the selected date range."}):I.length===1?t.jsx(ky,{title:"First data point",dayISO:I[0]?.run_date||"",primaryLabel:"Visibility",primaryValue:I[0]?.visibility_score!=null?`${Number(I[0].visibility_score).toFixed(1)}%`:"â",rows:[{label:"Prompts tracked",value:String(I[0]?.prompt_count??0)},...I[0]?.actions_completed_total!=null?[{label:"Actions completed",value:String(I[0].actions_completed_total)}]:[]],hint:"Your next scan will unlock the trend chart."}):t.jsxs(t.Fragment,{children:[t.jsx(Gl,{width:"100%",height:220,children:t.jsxs(zC,{data:I,margin:{top:5,right:10,left:-10,bottom:0},children:[t.jsx("defs",{children:t.jsxs("linearGradient",{id:"visGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[t.jsx("stop",{offset:"5%",stopColor:"#3b82f6",stopOpacity:.2}),t.jsx("stop",{offset:"95%",stopColor:"#3b82f6",stopOpacity:0})]})}),t.jsx(Zm,{strokeDasharray:"3 3",stroke:$e}),t.jsx(Ql,{dataKey:"run_date",tick:{fontSize:11,fill:Pe},tickFormatter:ne=>{const Ae=new Date(ne);return`${Ae.getMonth()+1}/${Ae.getDate()}`},axisLine:{stroke:V},tickLine:!1}),t.jsx(Zl,{domain:[0,100],tick:{fontSize:11,fill:Pe},tickFormatter:ne=>`${ne}%`,axisLine:!1,tickLine:!1}),t.jsx(Vl,{content:({active:ne,payload:Ae,label:_e})=>{if(!ne||!Ae?.length||!_e)return null;const Ke=new Date(_e).toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"}),ce=Ae[0]?.payload,ie=ce?.visibility_score??0,Re=ce?.actions_completed_titles??[];return t.jsxs("div",{style:{background:Z,border:`1px solid ${V}`,borderRadius:"6px",fontSize:"0.75rem",padding:"0.5rem 0.75rem",color:O,maxWidth:280},children:[t.jsx("div",{style:{color:z,marginBottom:"0.25rem"},children:Ke}),t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.35rem"},children:[t.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:"#3b82f6",display:"inline-block",flexShrink:0}}),"Visibility: ",ie.toFixed(1),"%"]}),Re.length>0&&t.jsxs("div",{style:{marginTop:"0.35rem",borderTop:`1px solid ${$e}`,paddingTop:"0.35rem"},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.35rem",marginBottom:"0.2rem",fontWeight:600},children:[t.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:"#10b981",display:"inline-block",flexShrink:0}}),"Completed"]}),Re.map((Be,tt)=>t.jsx("a",{href:`${o}/actions/${Be.id}`,style:{display:"block",fontSize:"0.675rem",color:z,paddingLeft:"1.1rem",lineHeight:1.35,marginTop:tt>0?"0.15rem":0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",textDecoration:"none"},onMouseEnter:dt=>{dt.target.style.textDecoration="underline",dt.target.style.color=O},onMouseLeave:dt=>{dt.target.style.textDecoration="none",dt.target.style.color=z},children:Be.title},tt))]})]})}}),t.jsx(jf,{type:"monotone",dataKey:"visibility_score",stroke:"#3b82f6",strokeWidth:2,fill:"url(#visGradient)",dot:ne=>{const{cx:Ae,cy:_e,payload:we,index:Ke}=ne;return(we?.actions_completed_on_date??0)>0?t.jsxs("g",{children:[t.jsx("circle",{cx:Ae,cy:_e,r:7,fill:"#10b981",fillOpacity:.2,stroke:"none"}),t.jsx("circle",{cx:Ae,cy:_e,r:4,fill:"#10b981",stroke:"#fff",strokeWidth:2})]},`dot-${Ke}`):t.jsx("circle",{cx:Ae,cy:_e,r:3,fill:"#3b82f6",stroke:"#fff",strokeWidth:2},`dot-${Ke}`)},activeDot:{r:5,fill:"#3b82f6",stroke:Z,strokeWidth:2}})]})}),t.jsxs(tut,{children:[t.jsxs(MY,{children:[t.jsx(RY,{$color:"#3b82f6"}),"Visibility score"]}),t.jsxs(MY,{children:[t.jsx(RY,{$color:"#10b981"}),"Action completed"]})]})]})]}),t.jsxs(Gdt,{children:[t.jsxs(Vdt,{children:[t.jsx(Pne,{size:15,style:{color:"#10b981"}}),"Completed Actions (",X,")"]}),K&&M.length===0?t.jsxs("div",{style:{padding:"1rem"},children:[t.jsx(nt,{height:"2rem",width:"100%",style:{marginBottom:"0.5rem"}}),t.jsx(nt,{height:"2rem",width:"100%",style:{marginBottom:"0.5rem"}}),t.jsx(nt,{height:"2rem",width:"100%"})]}):M.length===0?t.jsx(Qdt,{children:"No completed actions yet."}):t.jsx("div",{style:{overflowX:"auto"},children:t.jsxs(Kdt,{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx(xx,{children:"Action"}),t.jsx(xx,{children:"Type"}),t.jsx(xx,{children:"Effort"}),t.jsx(xx,{children:"Completed"}),t.jsx(xx,{children:t.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"0.3rem"},children:["Prompt Visibility",t.jsx(at,{content:"The visibility score of the specific prompt linked to this action. Shows the score at completion time and the change compared to the current score.",size:"sm",children:t.jsx(wn,{size:11,style:{color:Pe,cursor:"help"}})})]})}),t.jsx(xx,{children:t.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"0.3rem"},children:["Overall Visibility",t.jsx(at,{content:"The project-wide visibility score across all prompts. Shows the score at completion time and the change compared to the current overall score.",size:"sm",children:t.jsx(wn,{size:11,style:{color:Pe,cursor:"help"}})})]})})]})}),t.jsx("tbody",{children:M.map(ne=>{const Ae=ne.vis_score_at_completion,_e=ne.project_vis_score_at_completion,we=ne.updated_at?new Date(ne.updated_at).toDateString()===new Date().toDateString():!1,Ke=ne.prompt_id!=null?L[ne.prompt_id]?.visibility_score??null:null,ie=Ae!=null&&Ke!=null&&!we?Ke-Ae:null,Be=_e!=null&&de!=null&&!we?de-_e:null;return t.jsxs("tr",{children:[t.jsx(bx,{style:{maxWidth:360},children:t.jsx(Ydt,{to:`${o}/actions/${ne.id}`,children:ne.title})}),t.jsx(bx,{children:t.jsx(zde,{actionType:ne.action_type})}),t.jsx(bx,{children:t.jsx(Ede,{effort:ne.effort_level})}),t.jsx(bx,{children:t.jsx(Xdt,{children:ne.updated_at?new Date(ne.updated_at).toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"}):"â"})}),t.jsx(bx,{children:Ae!=null?t.jsxs(EY,{children:[t.jsxs("span",{style:{fontWeight:600},children:[Ae.toFixed(1),"%"]}),ie!=null?t.jsxs(v$,{$positive:ie>=0,children:[ie>=0?t.jsx(qi,{size:11}):t.jsx(ul,{size:11}),ie>=0?"+":"",ie.toFixed(1),"%"]}):t.jsx(v$,{$neutral:!0,children:"â"})]}):t.jsx("span",{style:{color:Pe},children:"â"})}),t.jsx(bx,{children:_e!=null?t.jsxs(EY,{children:[t.jsxs("span",{style:{fontWeight:600},children:[_e.toFixed(1),"%"]}),Be!=null?t.jsxs(v$,{$positive:Be>=0,children:[Be>=0?t.jsx(qi,{size:11}):t.jsx(ul,{size:11}),Be>=0?"+":"",Be.toFixed(1),"%"]}):t.jsx(v$,{$neutral:!0,children:"â"})]}):t.jsx("span",{style:{color:Pe},children:"â"})})]},ne.id)})})]})})]}),t.jsx(pi,{page:F,totalPages:H,total:X,onPrev:()=>Y(ne=>Math.max(1,ne-1)),onNext:()=>Y(ne=>Math.min(H,ne+1))})]})]})}const lb=["performance","crawlability","security","structured_data","content_quality","content_structure","meta_onpage","aeo_readiness"],OY=["performance","crawlability","security","structured_data"],DY=["content_quality","content_structure","meta_onpage","aeo_readiness"],rut=25;function out(e){if(!e)return"â";const n=new Date(e);return Number.isNaN(n.getTime())?"â":new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(n)}function sut(e){return e==="high"?"danger":e==="medium"?"warn":"ok"}function os(e){return e==null?"var(--color-gray-400, #94A3B8)":e>=75?"var(--color-green-500, #10B981)":e>=50?"var(--color-yellow-500, #F59E0B)":"var(--color-red-500, #EF4444)"}const Dl={technical:{label:"Technical",weight:.45,color:"#6366F1"},content:{label:"Content",weight:.55,color:"#6366F1"}},aut={performance:"Performance",crawlability:"Crawlability",security:"Security",structured_data:"Structured Data",content_quality:"Content Quality",content_structure:"Structure",meta_onpage:"Meta & On-Page",aeo_readiness:"AEO Readiness"},tP={performance:{icon:Ks,bg:"#FEF3C7",fg:"#D97706"},crawlability:{icon:Cs,bg:"#DBEAFE",fg:"#2563EB"},security:{icon:th,bg:"#FEE2E2",fg:"#DC2626"},structured_data:{icon:Ine,bg:"#EDE9FE",fg:"#7C3AED"},content_quality:{icon:vP,bg:"#D1FAE5",fg:"#059669"},content_structure:{icon:f0e,bg:"#E0E7FF",fg:"#4338CA"},meta_onpage:{icon:Ss,bg:"#FCE7F3",fg:"#DB2777"},aeo_readiness:{icon:Sn,bg:"#FEF9C3",fg:"#CA8A04"}},Yj={performance:"technical",crawlability:"technical",security:"technical",structured_data:"technical",content_quality:"content",content_structure:"content",meta_onpage:"content",aeo_readiness:"content"};function gu(e){return aut[e]||e}function lut({size:e=16,stroke:n="rgba(107,114,128,0.85)"}){const i=Math.max(10,e),r=i/2,o=r-2;return t.jsx("svg",{width:i,height:i,viewBox:`0 0 ${i} ${i}`,"aria-label":"Loading",role:"img",style:{display:"inline-block"},children:t.jsxs("g",{children:[t.jsx("animateTransform",{attributeName:"transform",type:"rotate",from:`0 ${r} ${r}`,to:`360 ${r} ${r}
13092`,dur:"0.9s",repeatCount:"indefinite"}),t.jsx("circle",{cx:r,cy:r,r:o,fill:"none",stroke:n,strokeWidth:"2",strokeLinecap:"round",strokeDasharray:`${Math.max(10,o*3)} ${Math.max(6,o*1.6)}`})]})})}const cut=p.button.withConfig({displayName:"SiteAuditPageDetail__BackLink",componentId:"sc-jtaa5c-0"})` 13093 appearance: none; 13094 border: 0; 13095 background: transparent; 13096 padding: 0; 13097 margin: 0; 13098 cursor: pointer; 13099 display: inline-flex; 13100 align-items: center; 13101 gap: 6px; 13102 font-size: 0.8rem; 13103 font-weight: 700; 13104 color: ${z}; 13105 transition: color 120ms ease; 13106 &:hover { color: ${O}; } 13107`,dut=p.div.withConfig({displayName:"SiteAuditPageDetail__HeroCard",componentId:"sc-jtaa5c-1"})` 13108 margin-top: 0.75rem; 13109 background: ${Z}; 13110 border: 1px solid ${V}; 13111 border-radius: 0.875rem; 13112 padding: 1.25rem 1.5rem; 13113 display: flex; 13114 align-items: center; 13115 gap: 1.25rem; 13116 flex-wrap: wrap; 13117 position: relative; 13118`,uut=p.div.withConfig({displayName:"SiteAuditPageDetail__PillarScoresCenter",componentId:"sc-jtaa5c-2"})` 13119 display: flex; 13120 gap: 16px; 13121 align-items: center; 13122 flex-shrink: 0; 13123 13124 @media (min-width: 769px) { 13125 position: absolute; 13126 left: 50%; 13127 transform: translateX(-50%); 13128 pointer-events: auto; 13129 } 13130`,put=p.div.withConfig({displayName:"SiteAuditPageDetail__HeroPillarRing",componentId:"sc-jtaa5c-3"})` 13131 text-align: center; cursor: pointer; border-radius: 8px; padding: 4px 6px; 13132 transition: background 120ms ease; 13133 &:hover { background: ${$e}; } 13134`,mut=p.div.withConfig({displayName:"SiteAuditPageDetail__ScoreRing",componentId:"sc-jtaa5c-4"})` 13135 position: relative; 13136 width: 72px; 13137 height: 72px; 13138 flex: 0 0 72px; 13139`,hut=p.div.withConfig({displayName:"SiteAuditPageDetail__PageInfo",componentId:"sc-jtaa5c-5"})` 13140 flex: 1 1 0; 13141 min-width: 120px; 13142 overflow: hidden; 13143 @media (min-width: 769px) { 13144 max-width: min(35%, 320px); 13145 } 13146`,fut=p.div.withConfig({displayName:"SiteAuditPageDetail__PageTitleText",componentId:"sc-jtaa5c-6"})` 13147 font-size: 1.1rem; 13148 font-weight: 900; 13149 color: ${O}; 13150 line-height: 1.2; 13151 white-space: nowrap; 13152 overflow: hidden; 13153 text-overflow: ellipsis; 13154`,gut=p.div.withConfig({displayName:"SiteAuditPageDetail__PageUrl",componentId:"sc-jtaa5c-7"})` 13155 margin-top: 2px; 13156 font-size: 0.75rem; 13157 font-weight: 600; 13158 color: ${z}; 13159 white-space: nowrap; 13160 overflow: hidden; 13161 text-overflow: ellipsis; 13162`,yut=p.div.withConfig({displayName:"SiteAuditPageDetail__MetaRow",componentId:"sc-jtaa5c-8"})` 13163 margin-top: 6px; 13164 display: flex; 13165 align-items: center; 13166 gap: 12px; 13167 flex-wrap: wrap; 13168`,xut=p.span.withConfig({displayName:"SiteAuditPageDetail__TrendText",componentId:"sc-jtaa5c-9"})` 13169 font-size: 0.7rem; 13170 font-weight: 800; 13171 color: ${e=>e.$dir==="up"?"#10B981":e.$dir==="down"?"#EF4444":z}; 13172`,but=p.span.withConfig({displayName:"SiteAuditPageDetail__MetaLabel",componentId:"sc-jtaa5c-10"})` 13173 font-size: 0.7rem; 13174 font-weight: 600; 13175 color: ${z}; 13176`,vut=p.div.withConfig({displayName:"SiteAuditPageDetail__HeroActions",componentId:"sc-jtaa5c-11"})` 13177 flex: 0 0 auto; 13178 display: flex; 13179 align-items: center; 13180 gap: 8px; 13181 margin-left: auto; 13182`,wut=p.div.withConfig({displayName:"SiteAuditPageDetail__DetailColumns",componentId:"sc-jtaa5c-12"})` 13183 margin-top: 1rem; 13184 display: flex; 13185 align-items: flex-start; 13186 gap: 1rem; 13187 @media (max-width: 768px) { flex-direction: column; } 13188`,jut=p.div.withConfig({displayName:"SiteAuditPageDetail__DetailLeft",componentId:"sc-jtaa5c-13"})` 13189 flex: 1 1 0; 13190 min-width: 0; 13191 @media (max-width: 768px) { 13192 width: 100%; 13193 max-width: 100%; 13194 } 13195`,_ut=p.div.withConfig({displayName:"SiteAuditPageDetail__DetailRight",componentId:"sc-jtaa5c-14"})` 13196 flex: 1 1 0; 13197 min-width: 0; 13198 display: flex; 13199 flex-direction: column; 13200 @media (max-width: 768px) { 13201 width: 100%; 13202 max-width: 100%; 13203 } 13204`,Cut=p.div.withConfig({displayName:"SiteAuditPageDetail__ScoresCard",componentId:"sc-jtaa5c-15"})` 13205 background: ${Z}; 13206 border: 1px solid ${V}; 13207 border-radius: 0.875rem; 13208 padding: 1.25rem 1.5rem; 13209`,Sut=p.div.withConfig({displayName:"SiteAuditPageDetail__ScoresCardTitle",componentId:"sc-jtaa5c-16"})` 13210 font-size: 1rem; 13211 font-weight: 900; 13212 color: ${O}; 13213 margin-bottom: 0.75rem; 13214`,kut=p.div.withConfig({displayName:"SiteAuditPageDetail__PillarSection",componentId:"sc-jtaa5c-17"})` 13215 &:not(:first-of-type) { margin-top: 0.75rem; } 13216`,$ut=p.div.withConfig({displayName:"SiteAuditPageDetail__PillarLabel",componentId:"sc-jtaa5c-18"})` 13217 font-size: 0.65rem; 13218 font-weight: 800; 13219 text-transform: uppercase; 13220 letter-spacing: 0.06em; 13221 color: ${e=>e.$color}; 13222 margin-bottom: 0.5rem; 13223`,Iut=p.div.withConfig({displayName:"SiteAuditPageDetail__ScoreTileGrid",componentId:"sc-jtaa5c-19"})` 13224 display: grid; 13225 grid-template-columns: 1fr 1fr; 13226 gap: 8px; 13227`,Put=p.div.withConfig({displayName:"SiteAuditPageDetail__ScoreTile",componentId:"sc-jtaa5c-20"})` 13228 display: flex; 13229 align-items: center; 13230 gap: 10px; 13231 padding: 8px 10px; 13232 border-radius: 8px; 13233 background: ${$e}; 13234 ${e=>e.$clickable?`cursor: pointer; transition: background 120ms ease; &:hover { background: ${V}; }`:""} 13235`,Aut=p.span.withConfig({displayName:"SiteAuditPageDetail__TileIconWrap",componentId:"sc-jtaa5c-21"})` 13236 flex-shrink: 0; 13237 width: 28px; height: 28px; 13238 border-radius: 6px; 13239 background: ${e=>e.$bg}; 13240 display: flex; align-items: center; justify-content: center; 13241`,Nut=p.div.withConfig({displayName:"SiteAuditPageDetail__TileInfo",componentId:"sc-jtaa5c-22"})` 13242 flex: 1; min-width: 0; 13243`,zut=p.div.withConfig({displayName:"SiteAuditPageDetail__TileName",componentId:"sc-jtaa5c-23"})` 13244 font-size: 0.72rem; 13245 font-weight: 700; 13246 color: ${O}; 13247 line-height: 1.2; 13248`,Tut=p.div.withConfig({displayName:"SiteAuditPageDetail__TileScore",componentId:"sc-jtaa5c-24"})` 13249 font-size: 0.68rem; 13250 font-weight: 800; 13251 color: ${e=>e.$color};
13252 margin-top: 1px; 13253`,Eut=p.div.withConfig({displayName:"SiteAuditPageDetail__TileMiniRing",componentId:"sc-jtaa5c-25"})` 13254 flex-shrink: 0; 13255 position: relative; 13256 width: 32px; height: 32px; 13257`,Mut=p.div.withConfig({displayName:"SiteAuditPageDetail__IssuesCard",componentId:"sc-jtaa5c-26"})` 13258 background: ${Z}; 13259 border: 1px solid ${V}; 13260 border-radius: 0.875rem; 13261 padding: 1.25rem 1.5rem; 13262 display: flex; 13263 flex-direction: column; 13264 height: 600px; 13265 min-width: 0; 13266 max-width: 100%; 13267 overflow: hidden; 13268 @media (max-width: 768px) { 13269 height: auto; 13270 min-height: 400px; 13271 } 13272`,Rut=p.div.withConfig({displayName:"SiteAuditPageDetail__IssuesHeader",componentId:"sc-jtaa5c-27"})` 13273 display: flex; 13274 align-items: center; 13275 justify-content: space-between; 13276 margin-bottom: 0.5rem; 13277`,Out=p.div.withConfig({displayName:"SiteAuditPageDetail__IssuesTitle",componentId:"sc-jtaa5c-28"})` 13278 font-size: 1rem; 13279 font-weight: 900; 13280 color: ${O}; 13281`,Dut=p.button.withConfig({displayName:"SiteAuditPageDetail__ToggleLink",componentId:"sc-jtaa5c-29"})` 13282 appearance: none; 13283 border: 0; 13284 background: transparent; 13285 padding: 0; 13286 cursor: pointer; 13287 font-size: 0.7rem; 13288 font-weight: 700; 13289 color: ${z}; 13290 display: inline-flex; 13291 align-items: center; 13292 gap: 4px; 13293 transition: color 100ms ease; 13294 &:hover { color: ${O}; } 13295`,Lut=p.div.withConfig({displayName:"SiteAuditPageDetail__PillarTabRow",componentId:"sc-jtaa5c-30"})` 13296 display: flex; 13297 gap: 0; 13298 border-bottom: 1px solid ${V}; 13299 margin-bottom: 0; 13300`,LY=p.button.withConfig({displayName:"SiteAuditPageDetail__PillarTab",componentId:"sc-jtaa5c-31"})` 13301 appearance: none; 13302 border: none; 13303 background: transparent; 13304 display: inline-flex; 13305 align-items: center; 13306 gap: 4px; 13307 padding: 8px 14px; 13308 font-size: 0.74rem; 13309 font-weight: ${e=>e.$active?800:600}; 13310 color: ${e=>e.$active?e.$color||O:z}; 13311 cursor: ${e=>e.$active?"default":"pointer"}; 13312 border-bottom: 2px solid ${e=>e.$active?e.$color||O:"transparent"}; 13313 white-space: nowrap; 13314 transition: color 100ms ease, border-color 100ms ease; 13315 &:hover { color: ${e=>e.$active&&e.$color||O}; } 13316`,BY=p.span.withConfig({displayName:"SiteAuditPageDetail__PillarTabCount",componentId:"sc-jtaa5c-32"})` 13317 font-size: 0.6rem; font-weight: 700; padding: 1px 5px; border-radius: 8px; 13318 background: ${e=>e.$active?"rgba(107,114,128,0.12)":$e}; 13319 color: ${z}; 13320`,But=p.div.withConfig({displayName:"SiteAuditPageDetail__TabStrip",componentId:"sc-jtaa5c-33"})` 13321 display: flex; 13322 gap: 0; 13323 border-bottom: 1px solid ${V}; 13324 margin-bottom: 0.75rem; 13325 overflow-x: auto; 13326 scrollbar-width: none; 13327 &::-webkit-scrollbar { display: none; } 13328`,FY=p.button.withConfig({displayName:"SiteAuditPageDetail__Tab",componentId:"sc-jtaa5c-34"})` 13329 appearance: none; 13330 border: none; 13331 background: transparent; 13332 display: inline-flex; 13333 align-items: center; 13334 gap: 3px; 13335 padding: 7px 10px; 13336 font-size: 0.72rem; 13337 font-weight: ${e=>e.$active?700:500}; 13338 color: ${e=>e.$active?"var(--color-brand-700, #4F46E5)":z}; 13339 cursor: ${e=>e.$active?"default":"pointer"}; 13340 border-bottom: 2px solid ${e=>e.$active?"var(--color-brand-700, #4F46E5)":"transparent"}; 13341 white-space: nowrap; 13342 transition: color 100ms ease, border-color 100ms ease; 13343 &:hover { color: ${e=>e.$active?"var(--color-brand-700, #4F46E5)":O}; } 13344`,WY=p.span.withConfig({displayName:"SiteAuditPageDetail__TabCount",componentId:"sc-jtaa5c-35"})` 13345 font-size: 0.6rem; 13346 font-weight: 600; 13347 padding: 1px 5px; 13348 border-radius: 8px; 13349 margin-left: 3px; 13350 background: ${e=>e.$active?"rgba(79,70,229,0.1)":$e}; 13351 color: ${e=>e.$active?"var(--color-brand-700, #4F46E5)":z}; 13352`,Fut=p.div.withConfig({displayName:"SiteAuditPageDetail__IssueItem",componentId:"sc-jtaa5c-36"})` 13353 background: ${Z}; 13354 border: 1px solid ${e=>e.$borderColor||V}; 13355 border-radius: 8px; 13356 margin-bottom: 8px; 13357 overflow: hidden; 13358`,Wut=p.div.withConfig({displayName:"SiteAuditPageDetail__IssueHeader",componentId:"sc-jtaa5c-37"})` 13359 display: flex; 13360 align-items: center; 13361 gap: 10px; 13362 padding: 10px 14px; 13363 min-height: 40px; 13364 cursor: pointer; 13365 transition: background 100ms ease; 13366 &:hover { background: ${$e}; } 13367`,Uut=p.span.withConfig({displayName:"SiteAuditPageDetail__IssueText",componentId:"sc-jtaa5c-38"})` 13368 flex: 1; 13369 min-width: 0; 13370 font-size: 0.8rem; 13371 font-weight: 500; 13372 color: ${O}; 13373 line-height: 1.3; 13374 display: flex; 13375 align-items: center; 13376 flex-wrap: wrap; 13377 gap: 2px; 13378`,Hut=p.span.withConfig({displayName:"SiteAuditPageDetail__Chevron",componentId:"sc-jtaa5c-39"})` 13379 color: ${z}; 13380 flex-shrink: 0; 13381 display: inline-flex; 13382 align-items: center; 13383 align-self: center; 13384`,qut=p.div.withConfig({displayName:"SiteAuditPageDetail__IssueBody",componentId:"sc-jtaa5c-40"})` 13385 padding: 0 14px 14px; 13386 border-top: 1px solid ${$e}; 13387`,Gut=p.p.withConfig({displayName:"SiteAuditPageDetail__IssueDesc",componentId:"sc-jtaa5c-41"})` 13388 font-size: 0.75rem; 13389 color: ${z}; 13390 margin: 8px 0; 13391 line-height: 1.5; 13392`,Vut=p.div.withConfig({displayName:"SiteAuditPageDetail__FixLabel",componentId:"sc-jtaa5c-42"})` 13393 font-size: 0.72rem; 13394 font-weight: 800; 13395 color: ${O}; 13396 letter-spacing: 0.02em; 13397 margin-bottom: 6px; 13398 margin-top: 14px; 13399`,Kut=p.pre.withConfig({displayName:"SiteAuditPageDetail__CodeBlock",componentId:"sc-jtaa5c-43"})` 13400 background: #1E293B; 13401 color: #E2E8F0; 13402 border-radius: 8px; 13403 padding: 12px 14px; 13404 font-family: 'Fira Code', ui-monospace, SFMono-Regular, Menlo, monospace; 13405 font-size: 0.72rem; 13406 line-height: 1.6; 13407 overflow-x: auto; 13408 margin: 0; 13409 white-space: pre-wrap; 13410 word-break: break-word; 13411`,Yut=p.div.withConfig({displayName:"SiteAuditPageDetail__IssueFooter",componentId:"sc-jtaa5c-44"})` 13412 display: flex; 13413 align-items: center; 13414 gap: 12px; 13415 margin-top: 10px; 13416`,w$=p.button.withConfig({displayName:"SiteAuditPageDetail__FooterAction",componentId:"sc-jtaa5c-45"})` 13417 appearance: none; 13418 border: 0; 13419 background: transparent; 13420 padding: 0; 13421 cursor: pointer; 13422 font-size: 0.72rem; 13423 font-weight: 600; 13424 color: ${e=>
13424e.$color||"var(--color-brand-700, #4F46E5)"}; 13425 display: inline-flex; 13426 align-items: center; 13427 gap: 4px; 13428 transition: opacity 100ms ease; 13429 &:hover { opacity: 0.8; } 13430 &:disabled { opacity: 0.4; cursor: not-allowed; } 13431`,Xut=p.a.withConfig({displayName:"SiteAuditPageDetail__FooterLink",componentId:"sc-jtaa5c-46"})` 13432 text-decoration: none; 13433 font-size: 0.72rem; 13434 font-weight: 600; 13435 color: ${e=>e.$color||"var(--color-brand-700, #4F46E5)"}; 13436 display: inline-flex; 13437 align-items: center; 13438 gap: 4px; 13439 transition: opacity 100ms ease; 13440 &:hover { opacity: 0.8; } 13441`,Qut=p.span.withConfig({displayName:"SiteAuditPageDetail__Pill",componentId:"sc-jtaa5c-47"})` 13442 display: inline-flex; 13443 align-items: center; 13444 flex-shrink: 0; 13445 gap: 0.25rem; 13446 border-radius: 9999px; 13447 padding: 0.12rem 0.5rem; 13448 font-size: 0.67rem; 13449 font-weight: 700; 13450 white-space: nowrap; 13451 background: ${e=>e.$tone==="danger"?kn:e.$tone==="warn"?"rgba(249,115,22,0.08)":e.$tone==="ok"?"rgba(234,179,8,0.08)":$e}; 13452 color: ${e=>e.$tone==="danger"?Ut:e.$tone==="warn"?"#F97316":e.$tone==="ok"?"#CA8A04":O}; 13453`,Zut=p.div.withConfig({displayName:"SiteAuditPageDetail__IssuesList",componentId:"sc-jtaa5c-48"})` 13454 flex: 1 1 0; 13455 min-height: 0; 13456 overflow-y: auto; 13457 scrollbar-width: thin; 13458 @media (max-width: 768px) { 13459 min-height: 200px; 13460 max-height: 60vh; 13461 } 13462`,UY=p.div.withConfig({displayName:"SiteAuditPageDetail__FixText",componentId:"sc-jtaa5c-49"})` 13463 font-size: 0.73rem; 13464 color: ${O}; 13465 line-height: 1.45; 13466 word-break: break-word; 13467`,Jut=p.div.withConfig({displayName:"SiteAuditPageDetail__EvidenceWrap",componentId:"sc-jtaa5c-50"})` 13468 margin-top: 10px; 13469 border: 1px solid ${V}; 13470 border-radius: 8px; 13471 padding: 10px 12px; 13472 background: ${$e}; 13473`,ept=p.div.withConfig({displayName:"SiteAuditPageDetail__EvidenceLabel",componentId:"sc-jtaa5c-51"})` 13474 font-size: 0.62rem; 13475 font-weight: 700; 13476 color: ${z}; 13477 text-transform: uppercase; 13478 letter-spacing: 0.04em; 13479 margin-bottom: 6px; 13480`,tpt=p.div.withConfig({displayName:"SiteAuditPageDetail__EvidenceRow",componentId:"sc-jtaa5c-52"})` 13481 display: flex; 13482 gap: 8px; 13483 align-items: baseline; 13484 padding: 2px 0; 13485 font-size: 0.7rem; 13486 line-height: 1.4; 13487`,npt=p.span.withConfig({displayName:"SiteAuditPageDetail__EvidenceKey",componentId:"sc-jtaa5c-53"})` 13488 font-weight: 700; 13489 color: ${z}; 13490 white-space: nowrap; 13491 flex-shrink: 0; 13492`,ipt=p.span.withConfig({displayName:"SiteAuditPageDetail__EvidenceVal",componentId:"sc-jtaa5c-54"})` 13493 font-weight: 600; 13494 color: ${O}; 13495 word-break: break-word; 13496 min-width: 0; 13497`,rpt=p.div.withConfig({displayName:"SiteAuditPageDetail__EmptyState",componentId:"sc-jtaa5c-55"})` 13498 text-align: center; 13499 padding: 2rem 0; 13500 font-size: 0.8rem; 13501 font-weight: 600; 13502 color: ${z}; 13503`,opt=p.span.withConfig({displayName:"SiteAuditPageDetail__CompletedBadge",componentId:"sc-jtaa5c-56"})` 13504 font-size: 0.62rem; 13505 font-weight: 700; 13506 color: ${Vt}; 13507 background: ${si}; 13508 padding: 2px 6px; 13509 border-radius: 9999px; 13510 margin-left: 6px; 13511`;function spt(e){const n=(e||"").trim();if(!n)return null;const i=n.split("```");return t.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6},children:i.map((r,o)=>{if(o%2===1){const u=r.replace(/\r\n/g,` 13512`).split(` 13513`),m=u[0]||"",h=m.trim(),g=(u.slice(1).join(` 13514`)||m).trimEnd();return t.jsx(Kut,{title:h?`code (${h})`:"code",children:g},o)}const a=r.replace(/\r\n/g,` 13515`).trim();if(!a)return null;const c=a.split(` 13516`);return t.jsx("div",{style:{display:"flex",flexDirection:"column",gap:4},children:c.map((u,m)=>{const h=u.trim();return h?h.startsWith("- ")?t.jsxs("div",{style:{display:"flex",gap:6,alignItems:"flex-start"},children:[t.jsx("div",{style:{marginTop:5,width:4,height:4,borderRadius:99,background:z,flexShrink:0}}),t.jsx(UY,{children:HY(h.slice(2))})]},m):t.jsx(UY,{children:HY(h)},m):null})},o)})})}function HY(e){return e.split(/(`[^`]+`)/).map((i,r)=>i.startsWith("`")&&i.endsWith("`")?t.jsx("code",{style:{fontSize:"0.68rem",fontWeight:600,background:$e,padding:"1px 4px",borderRadius:4},children:i.slice(1,-1)},r):t.jsx("span",{children:i},r))}function apt({evidence:e}){if(!e||typeof e!="object")return null;const n=[];return typeof e.url=="string"&&n.push({label:"URL",value:e.url}),typeof e.final_url=="string"&&n.push({label:"Final URL",value:e.final_url}),typeof e.canonical=="string"&&n.push({label:"Canonical",value:e.canonical}),typeof e.content_type=="string"&&n.push({label:"Content-Type",value:e.content_type}
13516),typeof e.description=="string"&&n.push({label:"Description",value:e.description}),Array.isArray(e.h1s)&&e.h1s.length>0&&n.push({label:"H1 tags found",value:t.jsx("ol",{style:{margin:0,paddingLeft:16},children:e.h1s.map((i,r)=>t.jsx("li",{children:String(i)},r))})}),Array.isArray(e.titles)&&e.titles.length>0&&n.push({label:"Title tags found",value:t.jsx("ol",{style:{margin:0,paddingLeft:16},children:e.titles.map((i,r)=>t.jsx("li",{children:String(i)},r))})}),Array.isArray(e.directives)&&e.directives.length>0&&n.push({label:"Directives",value:e.directives.join(", ")}),Array.isArray(e.missing_headers)&&e.missing_headers.length>0&&n.push({label:"Missing headers",value:e.missing_headers.join(", ")}),Array.isArray(e.hints)&&e.hints.length>0&&n.push({label:"Hints",value:e.hints.join(", ")}),Array.isArray(e.skips)&&e.skips.length>0&&n.push({label:"Skipped levels",value:e.skips.join(", ")}),typeof e.first_heading=="string"&&n.push({label:"First heading",value:e.first_heading}),typeof e.count=="number"&&n.push({label:"Count",value:String(e.count)}),typeof e.length=="number"&&n.push({label:"Length",value:`${e.length} chars`}),typeof e.bytes=="number"&&n.push({label:"Size",value:`${e.bytes.toLocaleString()} bytes`}),typeof e.fetch_ms=="number"&&n.push({label:"Fetch time",value:`${e.fetch_ms}ms`}),typeof e.non_lazy=="number"&&n.push({label:"Images without lazy",value:String(e.non_lazy)}),typeof e.raster=="number"&&n.push({label:"Legacy format images",value:`${e.raster}/${e.total||"?"}`}),typeof e.missing_dimensions=="number"&&n.push({label:"Missing dimensions",value:`${e.missing_dimensions}/${e.total||"?"}`}),typeof e.missing=="number"&&n.push({label:"Missing alt text",value:`${e.missing}/${e.total||"?"}`}),typeof e.url_count=="number"&&n.push({label:"Sitemap URLs",value:String(e.url_count)}),(typeof e.http_status=="number"||typeof e.http_status=="string")&&n.push({label:"HTTP status",value:String(e.http_status)}),n.length===0?null:t.jsxs(Jut,{children:[t.jsx(ept,{children:"Detected"}),n.map((i,r)=>t.jsxs(tpt,{children:[t.jsx(npt,{children:i.label}),t.jsx(ipt,{children:i.value})]},r)),e.truncated&&t.jsx("div",{style:{fontSize:"0.65rem",color:z,marginTop:4},children:"Showing first items only."})]})}function lpt({page:e,previousScore:n,onBack:i,onRunAudit:r,canManage:o,enumRunning:s,actions:a,actionsLoading:c,showCompletedActions:u,onToggleCompleted:m,onCompleteAction:h,onReopenAction:g,onNavigateToCategory:x,onPillarClick:y,onSendToContentAgent:w,agentsContentHref:j}){const[v,_]=l.useState(!1),[$,k]=l.useState("all"),[P,S]=l.useState("all"),[I,A]=l.useState(null),[E,B]=l.useState(null),[T,M]=l.useState(()=>new Set),R=l.useRef(null);l.useEffect(()=>()=>{R.current&&clearTimeout(R.current)},[]);const F=e.score,Y=os(F),H=!!e.audit_finished_at,U=n!=null&&F!=null?Math.round(F-n):null,X=async()=>{_(!0);try{await r(e.id)}finally{_(!1)}},Q=e.status==="running"||v,K=2*Math.PI*28,G=F!=null?F/100:0,L=K-K*G,q=l.useMemo(()=>{const me={all:0,technical:0,content:0};for(const ee of lb)me[ee]=0;for(const ee of a){me.all++,me[ee.category]!==void 0&&me[ee.category]++;const ne=Yj[ee.category];ne&&me[ne]++}return me},[a]),W=l.useMemo(()=>$==="all"?lb:lb.filter(me=>Yj[me]===$),[$]),oe=l.useMemo(()=>{const me={high:0,medium:1,low:2};let ee=a;if($!=="all"){const ne=new Set(lb.filter(Ae=>Yj[Ae]===$));ee=ee.filter(Ae=>ne.has(Ae.category))}return P!=="all"&&(ee=ee.filter(ne=>ne.category===P)),[...ee].sort((ne,Ae)=>(me[ne.severity]??3)-(me[Ae.severity]??3))},[a,$,P]),se=me=>{if(!(!w||!o)&&me.status==="open"&&me.content_fixable&&!me.content_drafting_id){M(ee=>{const ne=new Set(ee);return ne.add(me.id),ne});try{w(me.id)}finally{setTimeout(()=>{M(ee=>{if(!ee.has(me.id))return ee;const ne=new Set(ee);return ne.delete(me.id),ne})},1500)}}},de=me=>{if(!me.fix_markdown)return;const ne=me.fix_markdown.split("```").filter((_e,we)=>we%2===1).map(_e=>{const we=_e.replace(/\r\n/g,` 13517`).split(` 13518`),Ke=we[0]?.trim()||"";return(we.length>1?we.slice(1).join(` 13519`):Ke).trim()}).filter(Boolean),Ae=ne.length>0?ne.join(` 13520 13521`):me.fix_markdown;navigator.clipboard.writeText(Ae).then(()=>{B(me.id),R.current&&clearTimeout(R.current),R.current=setTimeout(()=>B(_e=>_e===me.id?null:_e),2e3)})},le=me=>me==="high"?kn:me==="medium"?"rgba(249,115,22,0.15)":me==="low"?"rgba(234,179,8,0.15)":V;return t.jsxs("div",{children:[t.jsxs(cut,{type:"button",onClick:i,children:[t.jsx(xy,{size:14}),"Back"]}),t.jsxs(dut,{children:[t.jsxs(mut,{children:[t.jsxs("svg",{viewBox:"0 0 72 72",style:{width:"100%",height:"100%"},children:[t.jsx("circle",{cx:"36",cy:"36",r:"28",fill:"none",stroke:V,strokeWidth:"6"}),F!=null&&t.jsx("circle",{cx:"36",cy:"36",r:"28",fill:"none",stroke:Y,strokeWidth:"6",strokeLinecap:"round",strokeDasharray:K,strokeDashoffset:L,transform:"rotate(-90 36 36)",style:{transition:"stroke-dashoffset 0.5s ease"}})]}),t.jsx("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",fontWeight:950,fontSize:"1.25rem",color:Y},children:F!=null?Math.round(F):"â"})]}),t.jsxs(hut,{children:[t.jsx(fut,{children:e.path==="/"?"Homepage":e.path}),t.jsx(gut,{children:e.url}),t.jsxs(yut,{children:[U!=null&&U!==0&&t.jsxs(xut,{$dir:U>0?"up":"down",children:[U>0?"â²":"â¼"," ",U>0?`+${U}`:U," since last audit"]}),t.jsxs(but,{children:["Last audited: ",out(e.audit_finished_at||e.audit_started_at)]})]})]}),t.jsx(uut,{children:[["technical",e.technical_score],["content",e.content_score]].map(([me,ee])=>{const ne=Dl[me],Ae=os(ee),_e=ee!=null?ee/100:0,we=2*Math.PI*18;return t.jsxs(put,{onClick:()=>y?.(me),children:[t.jsxs("div",{style:{position:"relative",width:42,he
13521ight:42,margin:"0 auto"},children:[t.jsxs("svg",{viewBox:"0 0 46 46",style:{width:"100%",height:"100%"},children:[t.jsx("circle",{cx:"23",cy:"23",r:"18",fill:"none",stroke:V,strokeWidth:"4"}),ee!=null&&t.jsx("circle",{cx:"23",cy:"23",r:"18",fill:"none",stroke:Ae,strokeWidth:"4",strokeLinecap:"round",strokeDasharray:we,strokeDashoffset:we-we*_e,transform:"rotate(-90 23 23)",style:{transition:"stroke-dashoffset 0.5s ease"}})]}),t.jsx("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",fontWeight:900,fontSize:"0.7rem",color:Ae},children:ee!=null?Math.round(ee):"â"})]}),t.jsx("div",{style:{fontSize:"0.6rem",fontWeight:800,color:ne.color,marginTop:2,textTransform:"uppercase",letterSpacing:"0.04em"},children:ne.label})]},me)})}),t.jsx(vut,{children:o&&t.jsx(he,{type:"button",size:"sm",leftIcon:Q?t.jsx(lut,{size:14}):t.jsx(Sn,{size:14}),onClick:()=>void X(),disabled:s||Q,children:H?"Re-run":"Run"})})]}),t.jsxs(wut,{children:[t.jsx(jut,{children:t.jsxs(Cut,{children:[t.jsx(Sut,{children:"Subcategory Scores"}),["technical","content"].map(me=>{const ee=Dl[me],ne=lb.filter(Ae=>Yj[Ae]===me);return t.jsxs(kut,{children:[t.jsx($ut,{$color:ee.color,children:ee.label}),t.jsx(Iut,{children:ne.map(Ae=>{const we=(e.subcategory_scores||e.category_scores)?.[Ae]??null,Ke=tP[Ae],ce=Ke.icon,ie=we!=null?os(we):Pe,Re=we!=null?we/100:0,Be=2*Math.PI*12;return t.jsxs(Put,{$clickable:!!x,onClick:x?()=>x(Ae):void 0,children:[t.jsx(Aut,{$bg:Ke.bg,children:t.jsx(ce,{size:14,color:Ke.fg})}),t.jsxs(Nut,{children:[t.jsx(zut,{children:gu(Ae)}),t.jsxs(Tut,{$color:ie,children:[we!=null?Math.round(we):"â"," / 100"]})]}),t.jsxs(Eut,{children:[t.jsxs("svg",{viewBox:"0 0 32 32",style:{width:"100%",height:"100%"},children:[t.jsx("circle",{cx:"16",cy:"16",r:"12",fill:"none",stroke:V,strokeWidth:"3"}),we!=null&&t.jsx("circle",{cx:"16",cy:"16",r:"12",fill:"none",stroke:ie,strokeWidth:"3",strokeLinecap:"round",strokeDasharray:Be,strokeDashoffset:Be-Be*Re,transform:"rotate(-90 16 16)",style:{transition:"stroke-dashoffset 0.4s ease"}})]}),t.jsx("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",fontWeight:900,fontSize:"0.55rem",color:ie},children:we!=null?Math.round(we):"â"})]})]},Ae)})})]},me)})]})}),t.jsx(_ut,{children:t.jsxs(Mut,{children:[t.jsxs(Rut,{children:[t.jsxs(Out,{children:["Issues (",q.all,")"]}),t.jsxs(Dut,{type:"button",onClick:m,children:[u?t.jsx(jP,{size:12}):t.jsx(Dc,{size:12}),u?"Hide completed":"Show completed"]})]}),t.jsxs(Lut,{children:[t.jsxs(LY,{$active:$==="all",onClick:()=>{k("all"),S("all")},children:["All ",t.jsx(BY,{$active:$==="all",children:q.all})]}),["technical","content"].map(me=>t.jsxs(LY,{$active:$===me,$color:Dl[me].color,onClick:()=>{k(me),S("all")},children:[Dl[me].label," ",t.jsx(BY,{$active:$===me,children:q[me]})]},me))]}),$!=="all"&&t.jsxs(But,{children:[t.jsxs(FY,{$active:P==="all",onClick:()=>S("all"),children:["All",t.jsx(WY,{$active:P==="all",children:q[$]})]}),W.map(me=>{const ee=tP[me].icon;return t.jsxs(FY,{$active:P===me,onClick:()=>S(me),children:[t.jsx(ee,{size:12}),gu(me),t.jsx(WY,{$active:P===me,children:q[me]})]},me)})]}),t.jsx(Zut,{children:c?t.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:Array.from({length:4}).map((me,ee)=>t.jsx(nt,{height:42,radius:8},ee))}):oe.length===0?t.jsx(rpt,{children:P==="all"?"No issues found on this page.":`No ${gu(P)} issues.`}):oe.map(me=>{const ee=I===me.id,ne=!!me.fix_markdown;return t.jsxs(Fut,{$borderColor:me.status==="completed"?V:le(me.severity),children:[t.jsxs(Wut,{onClick:()=>A(ee?null:me.id),children:[t.jsxs(Qut,{$tone:sut(me.severity),children:[me.severity==="high"?t.jsx(ei,{size:11}):me.severity==="medium"?t.jsx(ei,{size:11}):null,me.severity==="high"?"High":me.severity==="medium"?"Med":"Low"]}),t.jsxs(Uut,{children:[me.message,me.status==="completed"&&t.jsx(opt,{children:"Done"})]}),t.jsx(Hut,{children:ee?t.jsx(qn,{size:14}):t.jsx(Gi,{size:14})})]}),ee&&t.jsxs(qut,{children:[me.code&&t.jsxs(Gut,{children:[t.jsx("span",{style:{fontWeight:700,color:z},children:me.code})," · ",gu(me.category)]}),ne&&t.jsxs(t.Fragment,{children:[t.jsx(Vut,{children:"Recommended Fix"}),spt(me.fix_markdown)]}),t.jsx(apt,{evidence:me.evidence}),t.jsxs(Yut,{children:[o&&me.status==="open"&&t.jsxs(w$,{type:"button",onClick:()=>h(me.id),children:[t.jsx(Zn,{size:13})," Mark complete"]}),o&&me.status==="completed"&&g&&t.jsxs(w$,{type:"button",onClick:()=>g(me.id),children:[t.jsx(vb,{size:13})," Reopen"]}),ne&&t.jsxs(w$,{type:"button",$color:z,onClick:()=>de(me),children:[t.jsx(so,{size:12})," ",E===me.id?"Copied!":"Copy"]}),me.content_drafting_id&&j?t.jsxs(Xut,{href:j,$color:Vt,children:[t.jsx(Lc,{size:12})," View draft ",t.jsx(H8,{size:11})]}):o&&me.status==="open"&&me.content_fixable&&w&&t.jsxs(w$,{type:"button",$color:Vt,disabled:T.has(me.id),onClick:()=>se(me),children:[t.jsx(Sn,{size:12}),T.has(me.id)?"Sendingâ¦":"Send to Content Agent"]})]})]})]},me.id)})})]})})]})]})}const qY=p.div.withConfig({displayName:"SiteAuditDashboard__Wrap",componentId:"sc-1m8iau1-0"})`display: flex; flex-direction: column; gap: 1.25rem;`,GY=p.div.withConfig({displayName:"SiteAuditDashboard__TopRow",componentId:"sc-1m8iau1-1"})` 13522 display: flex; gap: 1.25rem; align-items: stretch; 13523 @media (max-width: 860px) { flex-direction: column; } 13524`,VY=p.div.withConfig({displayName:"SiteAuditDashboard__ScoreCard",componentId:"sc-1m8iau1-2"})` 13525 background: ${Z}; border: 1px solid ${V}; border-radius: 0.875rem; 13526 padding: 1.5rem 1.75rem; display: flex; align-items: center; gap: 2rem; flex: 1; 13527 @media (max-width: 600px) { flex-direction: column; text-align: center; } 13528`,KY=p.div.withConfig({displayName:"SiteAuditDashboard__ScoreDetails",componentId:"sc-1m8iau1-3"})`flex: 1 1 auto; max-width: 320px;`,cpt=p.div.withConfig({displayName:"SiteAuditDashboard__ScoreTitle",componentId:"sc-1m8iau1-4"})`font-size: 1.2rem; font-weight: 800; color: ${O};`,YY=p.div.withConfig({displayName:"SiteAuditDashboard__SeverityPills",componentId:"sc-1m8iau1-5"})`display: flex; gap: 0.75rem; margin-top: 0.75rem; flex-wrap: wrap;`,s7=p.span.withConfig({displayName:"SiteAuditDashboard__SevPill",componentId:"sc-1m8iau1-6"})`display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.75rem; font-weight: 750; color: ${O};`,a7=p.span.withConfig({displayName:"SiteAuditDashboard__SevDot",componentId:"sc-1m8iau1-7"})`width: 8px; height: 8px; border-radius: 50%; background: ${e=>e.$c};`,dpt=p.div.withConfig({displayName:"SiteAuditDashboard__PillarRingsWrap",componentId:"sc-1m8iau1-8"})` 13529 display: flex; gap: 1.25rem; align-items: center; flex-shrink: 0; 13530 @media (max-width: 600px) { justify-content: center; } 13531`,XY=p.div.withConfig({displayName:"SiteAuditDashboard__PillarRingClickable",componentId:"sc-1m8iau1-9"})` 13532 cursor: pointer; border-radius: 10px; padding: 6px; transition: background 120ms ease; 13533 &:hover { background: ${At}; } 13534`,QY=p.div.withConfig({displayName:"SiteAuditDashboard__PillarRingLabel",componentId:"sc-1m8iau1-10"})`text-align: center; margin-top: 4px;`,ZY=p.div.withConfig({displayName:"SiteAuditDashboard__PillarRingTitle",componentId:"sc-1m8iau1-11"})`font-size: 0.65rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.4px; color: ${e=>e.$c};`,upt=p.div.withConfig({displayName:"SiteAuditDashboard__MiddleRow",componentId:"sc-1m8iau1-12"})` 13535 display: flex; gap: 1.25rem; 13536 @media (max-width: 860px) { flex-direction: column; } 13537`,ppt=p.div.withConfig({displayName:"SiteAuditDashboard__ChartCard",componentId:"sc-1m8iau1-13"})` 13538 background: ${Z}; border: 1px solid ${V}; border-radius: 0.875rem; 13539 padding: 1.25rem; flex: 1; min-width: 260px; 13540`,mpt=p.div.withConfig({displayName:"SiteAuditDashboard__ChartFilters",componentId:"sc-1m8iau1-14"})`display: flex; gap: 0.35rem; margin-left: auto;`,hpt=p.button.withConfig({displayName:"SiteAuditDashboard__ChartFilterBtn",componentId:"sc-1m8iau1-15"})` 13541 border: 1px solid ${e=>e.$active?"rgba(79,70,229,0.4)":V}; 13542 background: ${e=>e.$active?"rgba(79,70,229,0.06)":"transparent"}; 13543 color: ${e=>e.$active?"rgb(79,70,229)":z}; 13544 font-size: 0.675rem; font-weight: 700; padding: 3px 8px; border-radius: 5px; 13545 cursor: pointer; transition: all 0.12s; 13546 &:hover { border-color: rgba(79,70,229,0.3); } 13547`,fpt=p.div.withConfig({displayName:"SiteAuditDashboard__SeverityCard",componentId:"sc-1m8iau1-16"})` 13548 background: ${Z}; border: 1px solid ${V}; border-radius: 0.875rem; 13549 padding: 1.25rem; flex: 1; min-width: 260px; 13550`,l7=p.div.withConfig({displayName:"SiteAuditDashboard__CardTitle",componentId:"sc-1m8iau1-17"})`font-size: 0.875rem; font-weight: 800; color: ${O};`,c7=p.div.withConfig({displayName:"SiteAuditDashboard__CardSub",componentId:"sc-1m8iau1-18"})`font-size: 0.75rem; color: ${z}; margin-top: 0.15rem;`,d7=p.div.withConfig({displayName:"SiteAuditDashboard__SevRow",componentId:"sc-1m8iau1-19"})`display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.75rem;`,u7=p.span.withConfig({displayName:"SiteAuditDashboard__SevLabel",componentId:"sc-1m8iau1-20"})`font-size: 0.75rem; font-weight: 700; width: 55px; color: ${e=>e.$c};`,p7=p.div.withConfig({displayName:"SiteAuditDashboard__SevBarBg",componentId:"sc-1m8iau1-21"})`flex: 1; height: 22px; background: ${$e}; border-radius: 6px; overflow: hidden;`,m7=p.div.withConfig({displayName:"SiteAuditDashboard__SevBarFill",componentId:"sc-1m8iau1-22"})` 13551 height: 100%; width: ${e=>e.$w>0?Math.max(e.$w,2):0}%; border-radius: 6px; 13552 background: ${e=>e.$gradient}; 13553 display: flex; align-items: center; padding-left: 8px; 13554 font-size: 0.65rem; font-weight: 800; color: ${Z}; 13555 ${e=>e.$w>
135550?"min-width: 20px;":"min-width: 0; padding: 0;"} 13556`,gpt=p.div.withConfig({displayName:"SiteAuditDashboard__PrioritiesCard",componentId:"sc-1m8iau1-23"})` 13557 background: ${Z}; border: 1px solid ${V}; border-radius: 0.875rem; 13558 padding: 1.25rem; flex: 2; 13559`,ypt=p.div.withConfig({displayName:"SiteAuditDashboard__PriorityItem",componentId:"sc-1m8iau1-24"})` 13560 display: flex; align-items: flex-start; gap: 0.75rem; 13561 padding: 0.6rem 0.75rem; border-radius: 0.5rem; transition: background 0.12s; 13562 ${e=>e.$clickable?"cursor: pointer;":""} 13563 &:hover { background: ${At}; } 13564`,xpt=p.div.withConfig({displayName:"SiteAuditDashboard__PriorityRank",componentId:"sc-1m8iau1-25"})` 13565 width: 22px; height: 22px; border-radius: 6px; background: ${$e}; 13566 display: flex; align-items: center; justify-content: center; 13567 font-size: 0.65rem; font-weight: 800; color: ${z}; flex-shrink: 0; margin-top: 2px; 13568`,bpt=p.div.withConfig({displayName:"SiteAuditDashboard__PriorityText",componentId:"sc-1m8iau1-26"})`flex: 1; min-width: 0;`,vpt=p.div.withConfig({displayName:"SiteAuditDashboard__PriorityTitle",componentId:"sc-1m8iau1-27"})`font-size: 0.8125rem; font-weight: 700; color: ${O};`,wpt=p.div.withConfig({displayName:"SiteAuditDashboard__PriorityMeta",componentId:"sc-1m8iau1-28"})`display: flex; gap: 0.5rem; align-items: center; margin-top: 0.3rem; flex-wrap: wrap;`,jpt=p.span.withConfig({displayName:"SiteAuditDashboard__SeverityBadge",componentId:"sc-1m8iau1-29"})` 13569 padding: 2px 6px; border-radius: 4px; font-size: 0.58rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.3px; 13570 ${e=>e.$s==="high"?`background: ${kn}; color: ${Ut};`:e.$s==="medium"?"background: rgba(249,115,22,0.08); color: #F97316;":"background: rgba(234,179,8,0.08); color: #CA8A04;"} 13571`,_pt=p.span.withConfig({displayName:"SiteAuditDashboard__PillarBadge",componentId:"sc-1m8iau1-30"})` 13572 padding: 1px 6px; border-radius: 4px; font-size: 0.6rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.3px; 13573 background: rgba(99,102,241,0.1); 13574 color: #6366F1; 13575`,Cpt=p.span.withConfig({displayName:"SiteAuditDashboard__CatBadge",componentId:"sc-1m8iau1-31"})`font-size: 0.625rem; color: ${z}; background: ${$e}; padding: 1px 5px; border-radius: 4px;`,Spt=p.span.withConfig({displayName:"SiteAuditDashboard__PagesBadge",componentId:"sc-1m8iau1-32"})`font-size: 0.625rem; color: ${z};`,kpt=p.div.withConfig({displayName:"SiteAuditDashboard__SummaryBox",componentId:"sc-1m8iau1-33"})` 13576 background: rgba(79,70,229,0.04); border: 1px solid rgba(79,70,229,0.12); border-radius: 0.75rem; 13577 padding: 1rem 1.15rem; font-size: 0.8125rem; color: ${O}; line-height: 1.5; 13578`,h7=p.div.withConfig({displayName:"SiteAuditDashboard__EmptyState",componentId:"sc-1m8iau1-34"})` 13579 text-align: center; padding: 3rem 1rem; color: ${z}; font-size: 0.875rem; 13580`,$pt=p.div.withConfig({displayName:"SiteAuditDashboard__SpinIcon",componentId:"sc-1m8iau1-35"})` 13581 display: inline-flex; 13582 @keyframes dash-spin { to { transform: rotate(360deg); } } 13583 animation: dash-spin 1.2s linear infinite; 13584`,Ipt=p.div.withConfig({displayName:"SiteAuditDashboard__ProgressBar",componentId:"sc-1m8iau1-36"})` 13585 width: 220px; max-width: 80%; height: 4px; border-radius: 2px; 13586 background: ${$e}; overflow: hidden; margin: 0 auto; 13587 @keyframes progress-indeterminate { 13588 0% { transform: translateX(-100%); } 13589 100% { transform: translateX(220%); } 13590 } 13591 &::after { 13592 content: ''; display: block; height: 100%; width: 40%; border-radius: 2px; 13593 background: rgb(79,70,229); 13594 animation: progress-indeterminate 1.5s ease-in-out infinite; 13595 } 13596`;function f7({score:e,size:n=130,label:i,labelColor:r}){const o=(n-12)/2,s=Math.PI*2*o,a=e!=null?e/100:0,c=s*(1-a),u=os(e);return t.jsxs("div",{style:{position:"relative",width:n,height:n,flexShrink:0},children:[t.jsxs("svg",{width:n,height:n,viewBox:`0 0 ${n} ${n}`,style:{transform:"rotate(-90deg)"},children:[t.jsx("circle",{cx:n/2,cy:n/2,r:o,fill:"none",stroke:$e,strokeWidth:n>80?10:6}),e!=null&&t.jsx("circle",{cx:n/2,cy:n/2,r:o,fill:"none",stroke:u,strokeWidth:n>80?10:6,strokeLinecap:"round",strokeDasharray:s,strokeDashoffset:c,style:{transition:"stroke-dashoffset 0.5s"}})]}),t.jsxs("div",{style:{position:"absolute",inset:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},children:[t.jsx("span",{style:{fontSize:n*.28,fontWeight:900,lineHeight:1,color:e!=null?u:z},children:e!=null?Math.round(e):"â"}),i&&t.jsx("span",{style:{fontSize:Math.max(n*.09,8),fontWeight:700,color:r||z,textTransform:"uppercase",letterSpacing:"0.4px",marginTop:2},children:i})]})]})}function Ppt({loading:e,siteScore:n,siteTechnicalScore:i,siteContentScore:r,issueCounts:o,topIssues:s,llmSummary:a,pagesAudited:c,totalPages:u,scoreHistory:m=[],onPriorityClick:h,onRunInitialAudit:g,initialAuditLoading:x,enumRunning:y,enumMode:w,enumError:j,onPillarClick:v}){const _=o.high+o.medium+o.low,[$,k]=l.useState(90),P=l.useMemo(()=>
13596{if(!m.length)return[];const S=new Date;return S.setDate(S.getDate()-$),m.filter(I=>new Date(I.date)>=S).map(I=>({date:new Date(I.date).toLocaleDateString("en-US",{month:"short",day:"numeric"}),technical:I.technical_score!=null?Math.round(I.technical_score):null,content:I.content_score!=null?Math.round(I.content_score):null}))},[m,$]);if(e)return t.jsx(qY,{children:t.jsx(GY,{children:t.jsxs(VY,{children:[t.jsx(nt,{width:130,height:130,radius:65}),t.jsxs(KY,{children:[t.jsx(nt,{width:180,height:20,radius:6}),t.jsx("div",{style:{marginTop:8},children:t.jsx(nt,{width:260,height:14,radius:4})}),t.jsxs(YY,{children:[t.jsx(nt,{width:70,height:16,radius:4}),t.jsx(nt,{width:85,height:16,radius:4}),t.jsx(nt,{width:65,height:16,radius:4})]})]})]})})});if(n==null&&c===0){if(y||x){const S=w==="sync";return t.jsxs(h7,{children:[t.jsx($pt,{children:t.jsx(One,{size:32,style:{opacity:.6}})}),t.jsx("div",{style:{fontWeight:700,marginTop:12},children:S?"Syncing pages":"Audit in progress"}),t.jsx("div",{style:{marginTop:6,fontSize:"0.8rem",maxWidth:340,marginInline:"auto"},children:S?"Discovering and updating your site pages. This may take a few minutes.":"Discovering pages and running checks across your site. This may take a few minutes."}),t.jsx("div",{style:{marginTop:16},children:t.jsx(Ipt,{})})]})}return t.jsxs(h7,{children:[j?t.jsxs(t.Fragment,{children:[t.jsx(ei,{size:32,style:{marginBottom:8,color:$i}}),t.jsx("div",{style:{fontWeight:700},children:"Page discovery failed"}),t.jsx("div",{style:{marginTop:4,fontSize:"0.8rem",maxWidth:400,marginInline:"auto"},children:j})]}):t.jsxs(t.Fragment,{children:[t.jsx(Cs,{size:32,style:{marginBottom:8,opacity:.5}}),t.jsx("div",{style:{fontWeight:700},children:"No audit data yet"}),t.jsx("div",{style:{marginTop:4,fontSize:"0.8rem"},children:"Run your first audit to discover technical issues and get your AI Readiness Score."})]}),g&&t.jsx("div",{style:{marginTop:16},children:t.jsx(he,{onClick:g,disabled:x,size:"sm",children:j?"Retry Audit":"Run Free Audit"})})]})}return t.jsxs(qY,{children:[t.jsx(GY,{children:t.jsxs(VY,{children:[t.jsx(f7,{score:n,label:"Score"}),t.jsxs(KY,{children:[t.jsx(cpt,{children:"AI Readiness Score"}),t.jsxs(YY,{children:[t.jsxs(s7,{children:[t.jsx(a7,{$c:"#DC2626"})," ",o.high," High"]}),t.jsxs(s7,{children:[t.jsx(a7,{$c:"#F97316"})," ",o.medium," Medium"]}),t.jsxs(s7,{children:[t.jsx(a7,{$c:"#EAB308"})," ",o.low," Low"]})]})]}),t.jsxs(dpt,{children:[t.jsxs(XY,{onClick:()=>v?.("technical"),children:[t.jsx(f7,{score:i??null,size:80,label:"Tech",labelColor:Dl.technical.color}),t.jsx(QY,{children:t.jsx(ZY,{$c:Dl.technical.color,children:"Technical"})})]}),t.jsxs(XY,{onClick:()=>v?.("content"),children:[t.jsx(f7,{score:r??null,size:80,label:"Content",labelColor:Dl.content.color}),t.jsx(QY,{children:t.jsx(ZY,{$c:Dl.content.color,children:"Content"})})]})]})]})}),t.jsxs(upt,{children:[t.jsxs(ppt,{children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",marginBottom:"1rem"},children:[t.jsxs("div",{style:{flex:1},children:[t.jsx(l7,{children:"Score Over Time"}),t.jsx(c7,{children:"Technical and Content score trends"})]}),t.jsx(mpt,{children:[30,60,90].map(S=>t.jsxs(hpt,{$active:$===S,onClick:()=>k(S),children:[S,"d"]},S))})]}),P.length>=2?t.jsx(Gl,{width:"100%",height:200,children:t.jsxs(C1,{data:P,margin:{top:4,right:8,bottom:0,left:-20},children:[t.jsx(Ql,{dataKey:"date",tick:{fontSize:10,fill:"var(--color-gray-500, #6B7280)"},axisLine:!1,tickLine:!1}),t.jsx(Zl,{domain:[0,100],tick:{fontSize:10,fill:"var(--color-gray-500, #6B7280)"},axisLine:!1,tickLine:!1}),t.jsx(Vl,{contentStyle:{borderRadius:8,border:`1px solid ${V}`,fontSize:12,padding:"6px 10px"}}),t.jsx(rA,{verticalAlign:"top",height:28,iconType:"circle",iconSize:8,wrapperStyle:{fontSize:11,fontWeight:700}}),t.jsx(Nd,{type:"monotone",dataKey:"technical",name:"Technical",stroke:Dl.technical.color,strokeWidth:2.5,dot:{r:3,fill:Dl.technical.color},activeDot:{r:5},connectNulls:!0}),t.jsx(Nd,{type:"monotone",dataKey:"content",name:"Content",stroke:Dl.content.color,strokeWidth:2.5,strokeDasharray:"6 3",dot:{r:3,fill:Dl.content.color},activeDot:{r:5},connectNulls:!0})]})}):t.jsx("div",{style:{height:200,display:"flex",alignItems:"center",justifyContent:"center",color:z,fontSize:"0.8125rem"},children:P.length===1?"Score recorded â chart appears after your next audit.":"No score data yet. Run an audit to start tracking."})]}),t.jsxs(fpt,{children:[t.jsxs("div",{style:{marginBottom:"1rem"},children:[t.jsx(l7,{children:"Issue Distribution"}),t.jsx(c7,{children:u&&u>c?`Across your top ${c} of ${u} discovered pages`:`Across ${c} audited page${c!==1?"s":""}`})]}),t.jsxs(d7,{children:[t.jsx(u7,{$c:"#DC2626",children:"High"}),t.jsx(p7,{children:t.jsx(m7,{$w:_>0?o.high/_*100:0,$gradient:"linear-gradient(90deg, #DC2626, #EF4444)",children:o.high>0?o.high:""})})]}),t.jsxs(d7,{children:[t.jsx(u7,{$c:"#F97316",children:"Medium"}),t.jsx(p7,{children:t.jsx(m7,{$w:_>0?o.medium/_*100:0,$gradient:"linear-gradient(90deg, #EA580C, #F97316)",children:o.medium>0?o.medium:""})})]}),t.jsxs(d7,{children:[t.jsx(u7,{$c:"#EAB308",children:"Low"}),t.jsx(p7,{children:t.jsx(m7,{$w:_>0?o.low/_*100:0,$gradient:"linear-gradient(90deg, #CA8A04, #EAB308)",children:o.low>0?o.low:""})})]}),t.jsxs("div",{style:{marginTop:"1rem",paddingTop:"0.75rem",borderTop:`1px solid ${$e}`,display:"flex",justifyContent:"space-between",fontSize:"0.8125rem"},children:[t.jsx("span",{style:{color:z},children:"Total issues"}),t.jsx("span",{style:{fontWeight:800,color:O},children:_})]})]})]}),t.jsxs(gpt,{children:[t.jsxs("div",{style:{marginBottom:"0.75rem"},children:[t.jsx(l7,{children:"Top Priorities"}),t.jsx(c7,{children:"Most impactful open issues ranked by severity"})]}),a&&t.jsxs(kpt,{style:{marginBottom:"0.75rem"},children:[t.jsx(qi,{size:14,style:{marginRight:6,verticalAlign:"middle",opacity:.6}}),a]}),s.length===0?t.jsx(h7,{style:{padding:"2rem 1rem"},children:"No issues found yet. They appear after an audit completes."}):s.slice(0,8).map((S,I)=>t.jsxs(ypt,{$clickable:!!h,onClick:()=>h?.(S.category,S.code),children:[t.jsx(xpt,{children:I+1}),t.jsxs(bpt,{children:[t.jsx(vpt,{children:S.message}),t.jsxs(wpt,{children:[t.jsx(jpt,{$s:S.severity,children:S.severity==="high"?"High":S.severity==="medium"?"Medium":"Low"}),t.jsx(_pt,{$pillar:S.pillar,children:S.pillar}),t.jsx(Cpt,{children:gu(S.category)}),S.affected_pages>0&&t.jsxs(Spt,{children:[S.affected_pages," page",S.affected_pages!==1?"s":""]})]})]})]},`${S.code}-${I}`))]})]})}const Apt=p.div.withConfig({displayName:"SiteAuditCategories__Wrap",componentId:"sc-whae17-0"})`display: flex; flex-direction: column; gap: 1rem;
13596`,Npt=p.div.withConfig({displayName:"SiteAuditCategories__CatTabs",componentId:"sc-whae17-1"})` 13597 display: flex; gap: 0; border-bottom: 1px solid ${V}; 13598 overflow-x: auto; scrollbar-width: none; 13599 &::-webkit-scrollbar { display: none; } 13600`,zpt=p.button.withConfig({displayName:"SiteAuditCategories__CatTabBtn",componentId:"sc-whae17-2"})` 13601 padding: 0.5rem 0.6rem; font-size: 0.78rem; font-weight: 700; 13602 color: ${e=>e.$active?"#4F46E5":z}; 13603 border: none; background: transparent; cursor: ${e=>e.$active?"default":"pointer"}; border-bottom: 2px solid ${e=>e.$active?"#4F46E5":"transparent"}; 13604 transition: color 0.12s, border-color 0.12s; font-family: inherit; 13605 display: inline-flex; align-items: center; gap: 3px; 13606 white-space: nowrap; 13607 &:hover { color: ${e=>e.$active?"#4F46E5":O}; } 13608`,Tpt=p.span.withConfig({displayName:"SiteAuditCategories__TabLabel",componentId:"sc-whae17-3"})``,Ept=p.div.withConfig({displayName:"SiteAuditCategories__Header",componentId:"sc-whae17-4"})` 13609 display: flex; align-items: flex-start; gap: 1rem; padding: 0.5rem 0; 13610`,Mpt=p.div.withConfig({displayName:"SiteAuditCategories__IconBox",componentId:"sc-whae17-5"})` 13611 width: 52px; height: 52px; border-radius: 0.75rem; flex-shrink: 0; 13612 background: ${e=>e.$bg}; color: ${e=>e.$fg}; 13613 display: flex; align-items: center; justify-content: center; font-size: 1.5rem; 13614`,Rpt=p.div.withConfig({displayName:"SiteAuditCategories__HeaderText",componentId:"sc-whae17-6"})`flex: 1;`,Opt=p.div.withConfig({displayName:"SiteAuditCategories__ScoreRow",componentId:"sc-whae17-7"})`display: flex; align-items: baseline; gap: 0.75rem;`,Dpt=p.span.withConfig({displayName:"SiteAuditCategories__BigScore",componentId:"sc-whae17-8"})`font-size: 2rem; font-weight: 900; color: ${e=>e.$c};`,Lpt=p.div.withConfig({displayName:"SiteAuditCategories__CatName",componentId:"sc-whae17-9"})`font-size: 1.1rem; font-weight: 800; color: ${O}; margin: 0.15rem 0;`,Bpt=p.div.withConfig({displayName:"SiteAuditCategories__CatDesc",componentId:"sc-whae17-10"})`font-size: 0.85rem; font-weight: 500; color: ${O}; line-height: 1.5; opacity: 0.7;`,is=p.div.withConfig({displayName:"SiteAuditCategories__Card",componentId:"sc-whae17-11"})` 13615 background: ${Z}; border: 1px solid ${V}; border-radius: 0.875rem; padding: 1.15rem; 13616`,Fpt=p(is).withConfig({displayName:"SiteAuditCategories__IssuesCard",componentId:"sc-whae17-12"})` 13617 max-width: 720px; 13618 @media (max-width: 768px) { max-width: 100%; } 13619`,ts=p.div.withConfig({displayName:"SiteAuditCategories__CardTitle",componentId:"sc-whae17-13"})`font-size: 0.875rem; font-weight: 800; color: ${O};`,ns=p.div.withConfig({displayName:"SiteAuditCategories__CardSub",componentId:"sc-whae17-14"})`font-size: 0.75rem; color: ${z}; margin-top: 0.1rem;`,g7=p.div.withConfig({displayName:"SiteAuditCategories__SevRow",componentId:"sc-whae17-15"})`display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.5rem;`,y7=p.span.withConfig({displayName:"SiteAuditCategories__SevLabel",componentId:"sc-whae17-16"})`font-size: 0.7rem; font-weight: 700; width: 55px; color: ${e=>e.$c};`,x7=p.div.withConfig({displayName:"SiteAuditCategories__SevBarBg",componentId:"sc-whae17-17"})`flex: 1; height: 20px; background: ${$e}; border-radius: 5px; overflow: hidden;`,b7=p.div.withConfig({displayName:"SiteAuditCategories__SevBarFill",componentId:"sc-whae17-18"})` 13620 height: 100%; width: ${e=>e.$w>0?Math.max(e.$w,2):0}%; border-radius: 5px; 13621 background: ${e=>e.$gradient}; 13622 display: flex; align-items: center; padding-left: 6px; 13623 font-size: 0.6rem; font-weight: 800; color: ${Z}; 13624 ${e=>e.$w>0?"min-width: 16px;":"min-width: 0; padding: 0;"} 13625`,v7=p.span.withConfig({displayName:"SiteAuditCategories__SevCount",componentId:"sc-whae17-19"})`font-size: 0.75rem; font-weight: 700; width: 28px; text-align: right;`,Wpt=p.span.withConfig({displayName:"SiteAuditCategories__SevBadge",componentId:"sc-whae17-20"})` 13626 padding: 2px 7px; border-radius: 4px; font-size: 0.6rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.3px; 13627 ${e=>e.$s==="high"?`background: ${kn}; color: ${Ut};`:e.$s==="medium"?"background: rgba(249,115,22,0.08); color: #F97316;":"background: rgba(234,179,8,0.08); color: #CA8A04;"} 13628`,Upt=p.div.withConfig({displayName:"SiteAuditCategories__SevFilterRow",componentId:"sc-whae17-21"})`display: flex; align-items: center; gap: 6px; flex-wrap: wrap;`,Hpt=p.button.withConfig({displayName:"SiteAuditCategories__SevFilterBtn",componentId:"sc-whae17-22"})` 13629 display: inline-flex; align-items: center; gap: 5px; 13630 padding: 4px 10px; border-radius: 6px; font-size: 0.68rem; font-weight: 700; 13631 cursor: pointer; transition: all 120ms ease; 13632 border: 1.5px solid ${e=>e.$active?e.$accent:V}; 13633 background: ${e=>e.$active?e.$bg:"transparent"}; 13634 color: ${e=>e.$active?e.$accent:z}; 13635 opacity: ${e=>e.$active?1:.6}; 13636 &:hover { opacity: 1; background: ${e=>e.$bg}; } 13637`,qpt=p.span.withConfig({displayName:"SiteAuditCategories__SevDot",componentId:"sc-whae17-23"})` 13638 width: 7px; height: 7px; border-radius: 50%; background: ${e=>e.$c}; flex-shrink: 0; 13639`,Gpt=p.span.withConfig({displayName:"SiteAuditCategories__SevFilterCount",componentId:"sc-whae17-24"})` 13640 font-size: 0.6rem; font-weight: 800; min-width: 16px; text-align: center; 13641 padding: 0 4px; border-radius: 4px; 13642 background: ${e=>e.$active?e.$accent:V}; 13643 color: ${e=>e.$active?Z:z}; 13644`,Vpt=p.div.withConfig({displayName:"SiteAuditCategories__TableWrap",componentId:"sc-whae17-25"})`border: 1px solid ${V}; border-radius: 0.75rem; overflow: auto;`,Kpt=p.div.withConfig({displayName:"SiteAuditCategories__IssueRow",componentId:"sc-whae17-26"})` 13645 border: 1px solid ${e=>e.$open?"rgba(79,70,229,0.2)":V}; 13646 border-radius: 8px; margin-bottom: 8px; overflow: hidden; 13647 background: ${Z}; 13648`,Ypt=p.div.withConfig({displayName:"SiteAuditCategories__IssueHeader",componentId:"sc-whae17-27"})` 13649 display: flex; align-items: center; gap: 10px; padding: 10px 14px; min-height: 42px; 13650 cursor: pointer; transition: background 100ms ease; 13651 &:hover { background: ${$e}; } 13652`,Xpt=p.span.withConfig({displayName:"SiteAuditCategories__IssueMsg",componentId:"sc-whae17-28"})` 13653 flex: 1; min-width: 0; font-size: 0.8rem; font-weight: 600; color: ${O}; line-height: 1.3; 13654`,Qpt=p.span.withConfig({displayName:"SiteAuditCategories__AffectedBadge",componentId:"sc-whae17-29"})` 13655 flex-shrink: 0; font-size: 0.62rem; font-weight: 700; color: ${z}; 13656 padding: 1px 6px; border-radius: 8px; background: ${$e}; 13657`,Zpt=p.span.withConfig({displayName:"SiteAuditCategories__Chevron",componentId:"sc-whae17-30"})` 13658 color: ${z}; flex-shrink: 0; display: inline-flex; align-items: center; 13659`,Jpt=p.div.withConfig({displayName:"SiteAuditCategories__PagesList",componentId:"sc-whae17-31"})` 13660 border-top: 1px solid ${$e}; padding: 6px 14px 10px; 13661`,emt=p.div.withConfig({displayName:"SiteAuditCategories__PagesListHeader",componentId:"sc-whae17-32"})` 13662 display: flex; align-items: center; justify-content: space-between; 13663 gap: 8px; margin-bottom: 4px; 13664`,tmt=p.button.withConfig({displayName:"SiteAuditCategories__PageLink",componentId:"sc-whae17-33"})` 13665 appearance: none; border: 0; background: transparent; padding: 5px 0; 13666 cursor: pointer; display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; 13667 font-size: 0.72rem; font-weight: 600;
13667 color: var(--color-brand-700, #4F46E5); 13668 transition: opacity 100ms ease; 13669 &:hover { opacity: 0.7; } 13670 &:disabled { cursor: default; } 13671`,nmt=p.div.withConfig({displayName:"SiteAuditCategories__PageRow",componentId:"sc-whae17-34"})` 13672 display: flex; align-items: center; gap: 8px; width: 100%; 13673`,imt=p.div.withConfig({displayName:"SiteAuditCategories__RowActions",componentId:"sc-whae17-35"})` 13674 display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; margin-left: auto; 13675`,rmt=p.a.withConfig({displayName:"SiteAuditCategories__ContentAgentAnchor",componentId:"sc-whae17-36"})` 13676 display: inline-flex; align-items: center; gap: 4px; 13677 font-size: 0.65rem; font-weight: 700; color: ${Vt}; text-decoration: none; 13678 padding: 3px 8px; border-radius: 6px; border: 1px solid ${Mo}; background: ${si}; 13679 white-space: nowrap; 13680 &:hover { opacity: 0.85; } 13681`,omt=p.button.withConfig({displayName:"SiteAuditCategories__ContentAgentBtn",componentId:"sc-whae17-37"})` 13682 display: inline-flex; align-items: center; gap: 4px; 13683 font-size: 0.65rem; font-weight: 700; color: ${Vt}; 13684 padding: 3px 8px; border-radius: 6px; border: 1px solid ${Mo}; background: ${si}; 13685 cursor: pointer; font-family: inherit; white-space: nowrap; 13686 &:disabled { opacity: 0.55; cursor: default; } 13687 &:hover:not(:disabled) { opacity: 0.85; } 13688`,smt=p.span.withConfig({displayName:"SiteAuditCategories__PagePath",componentId:"sc-whae17-38"})`font-size: 0.72rem; font-weight: 600;`,amt=p.span.withConfig({displayName:"SiteAuditCategories__StatusDot",componentId:"sc-whae17-39"})` 13689 width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; 13690 background: ${e=>e.$open?"#DC2626":"#059669"}; 13691`,Sd=p.div.withConfig({displayName:"SiteAuditCategories__EmptyState",componentId:"sc-whae17-40"})` 13692 text-align: center; padding: 2rem 1rem; color: ${z}; font-size: 0.8125rem; 13693`,lmt=p.div.withConfig({displayName:"SiteAuditCategories__IssueContext",componentId:"sc-whae17-41"})` 13694 padding: 8px 14px 4px; 13695 font-size: 0.75rem; 13696 line-height: 1.5; 13697 color: ${z}; 13698 border-top: 1px solid ${$e}; 13699`,cmt=p.button.withConfig({displayName:"SiteAuditCategories__ShowMoreBtn",componentId:"sc-whae17-42"})` 13700 appearance: none; border: 0; background: ${At}; padding: 5px 10px; 13701 cursor: pointer; font-size: 0.68rem; font-weight: 700; color: var(--color-brand-700, #4F46E5); 13702 border-radius: 6px; margin-top: 4px; transition: background 100ms ease; 13703 &:hover { background: ${$e}; } 13704 &:disabled { opacity: 0.5; cursor: default; } 13705`,JY={charset_missing:"Without a declared character encoding, browsers may misinterpret special characters, causing garbled text. AI crawlers also rely on this to parse content accurately.",low_readability:"Content with a low Flesch Reading Ease score is harder for both users and AI models to understand. Simpler language improves comprehension and citation likelihood.",no_schema_detected:"Schema.org markup helps AI models and search engines understand what your page is about. Pages with structured data are significantly more likely to be cited in AI responses.",images_not_lazy:"Images that load eagerly slow down the initial page render. Lazy-loading defers off-screen images, improving performance scores and user experience.",images_no_modern_format:"Modern formats like WebP and AVIF are significantly smaller than JPEG/PNG while maintaining quality. Serving legacy formats wastes bandwidth and hurts performance.",images_missing_dimensions:"Images without explicit width and height attributes cause layout shifts as they load, which degrades both CLS scores and perceived performance.",viewport_missing:"Without a viewport meta tag, mobile browsers render the page at desktop width and then scale down. This breaks mobile usability and can lower AI visibility.",excessive_dom_size:"A DOM with too many nodes slows rendering, increases memory usage, and can cause janky interactions. This impacts both Core Web Vitals and crawl efficiency.",faq_content_without_schema:"FAQ-style content exists on the page but isn't marked up with FAQPage schema. Adding it makes the content directly eligible for rich results and AI-featured answers.",multiple_title_tags:"Multiple <title> tags confuse both search engines and AI crawlers about the page's actual title. Only one title tag should exist per page.",http_status_not_ok:"Pages that return non-200 HTTP status codes cannot be reliably indexed or cited. This signals a broken or inaccessible page.",no_direct_answer:"AI models prefer content that provides concise, direct answers to questions. Pages without clear answer formatting are less likely to be quoted in AI responses.",author_attribution_missing:"Author attribution is a key E-E-A-T signal. Pages without identified authors may rank lower for trustworthiness in AI evaluation.",meta_refresh_redirect:"Meta-refresh redirects are considered harmful for SEO and confuse crawlers. Use server-side 301/302 redirects instead.",html_large:"Excessively large HTML documents take longer to download and parse, directly impacting time-to-first-byte and rendering speed.",security_headers_missing:"Missing security headers (like X-Frame-Options, CSP, X-Content-Type-Options) expose the site to common web vulnerabilities and reduce trust signals.",html_lang_missing:"The lang attribute tells browsers and AI crawlers what language the page is in. Without it, content may not be served or cited for the correct language.",no_lists_used:"Structured lists (ul/ol) help both readers and AI models scan and extract key information. Unstructured prose is harder to parse for featured answers.",title_missing:"The title tag is one of the most important on-page signals. Without it, search engines and AI models have no clear summary of the page's topic.",title_too_short:"Very short titles don't convey enough information for search engines and AI to understand the page's content and relevance.",title_too_long:"Titles longer than ~60 characters get truncated in search results and may dilute the page's topical focus for AI evaluation.",empty_anchor_text:"Links with empty or missing anchor text provide no context about the linked page, weakening the internal linking signal for both SEO and AI crawlers.",main_missing:"The <main> landmark helps screen readers and crawlers identify primary content. Without it, AI may struggle to distinguish content from navigation/boilerplate.",multiple_main:"Multiple <main> elements confuse the document structure. There should be exactly one main landmark per page.",ai_bots_blocked:"One or more AI crawlers (C
13705hatGPT, Gemini, etc.) are blocked by robots.txt. This prevents your content from being included in AI-generated responses.",hsts_missing:"Without HSTS, browsers may connect over insecure HTTP on the first visit, exposing users to man-in-the-middle attacks and reducing trust signals.",schema_incomplete:"Some schema types are present but lack required properties. Incomplete schemas won't qualify for rich results and may confuse AI interpretation.",no_external_links:"Pages without outbound links appear isolated. External references to authoritative sources boost credibility and E-E-A-T signals.",publication_date_missing:"Content without a visible publication or update date is harder for AI to assess for freshness. Date signals affect citation priority in time-sensitive queries.",generic_anchor_text:"Links using generic text like 'click here' or 'read more' waste a major SEO signal. Descriptive anchor text helps AI understand link context.",twitter_card_missing:"Without Twitter Card meta tags, shared links display poorly on social platforms. This affects click-through rates and indirect visibility.",h1_missing:"The H1 heading is the primary content signal for the page. Without it, AI and search engines have less clarity about the page topic.",multiple_h1:"Multiple H1 headings dilute the primary topic signal and can confuse heading hierarchy for both AI and screen readers.",canonical_relative:"Relative canonical URLs can be misinterpreted across environments. Always use absolute URLs to ensure consistent canonicalization.",slow_fetch:"Slow server response times directly impact page experience scores and may cause AI crawlers to time out before indexing the full content.",og_image_missing:"Pages without an Open Graph image display a blank preview when shared on social media, reducing engagement and click-through rates.",thin_content:"Pages with very little text content are unlikely to rank well or be cited by AI models. They lack the depth needed to answer user queries.",json_ld_invali
13705d:"Invalid JSON-LD markup is ignored by search engines and AI. Fix syntax errors to ensure structured data is properly parsed.",content_to_code_ratio:"A low content-to-code ratio means the page has more HTML/JS overhead than actual content. AI crawlers may view this as low-value.",multiple_meta_descriptions:"Multiple meta descriptions confuse search engines about which description to use. Only one meta description should exist per page.",favicon_missing:"A missing favicon looks unprofessional in browser tabs and bookmarks. While minor, it affects perceived trustworthiness.",robots_blocks_indexing:"A noindex directive prevents this page from appearing in search results entirely. Ensure this is intentional.",meta_description_missing:"The meta description provides a summary for search results and AI context. Without it, engines generate their own, which may not represent the page well.",meta_description_too_short:"Very short meta descriptions don't convey enough information. Aim for 120â160 characters to provide a useful summary.",meta_description_too_long:"Meta descriptions over ~160 characters get truncated in search results. Keep them concise but descriptive.",canonical_off_domain:"The canonical tag points to a different domain, telling search engines this is a copy. Ensure this is intentional.",no_internal_links:"Pages with no internal links are orphaned â hard for crawlers and users to discover. Internal linking distributes authority and aids navigation.",images_missing_alt:"Images without alt text are invisible to screen readers and AI crawlers. Descriptive alt text improves accessibility and content understanding.",resource_hints_missing:"Preconnect, prefetch, and preload hints help browsers load critical resources faster. Without them, render-blocking delays are more likely.",no_media_content:"Pages without images, videos, or other media feel thin to both users and AI. Rich media signals a higher-quality, more comprehensive resource.",canonical_multiple:"Multiple canonical tags create conflicting signals about which URL is authoritative. Use exactly one canonical per page.",canonical_missing:"Without a canonical tag, search engines may index duplicate versions of this page, diluting ranking signals.",doctype_missing:"Without a DOCTYPE declaration, browsers render in quirks mode, causing inconsistent rendering and potential parsing issues.",no_table_of_contents:"Long-form content without a table of contents is harder to navigate. A TOC also helps AI models understand the content structure.",low_alt_text_coverage:"Only a small percentage of images have alt text. Improving coverage makes the page more accessible and more understandable to AI.",organization_schema_missing:"Organization schema helps AI models understand your brand identity. Without it, your organization may not be properly attributed in AI responses.",non_html_content_type:"The response content type is not HTML. AI crawlers and indexers may skip non-HTML resources.",https_not_enforced:"The page is served over HTTP instead of HTTPS. This is a security risk and a negative ranking signal for search engines and AI.",possible_blocking_detected:"The page appears to detect and block automated requests. AI crawlers may not be able to access your content for indexing.",sitemap_sparse:"The sitemap contains very few URLs relative to the site's pages. A comprehensive sitemap helps crawlers discover all important content.",sitemap_missing:"No sitemap was found. Sitemaps are essential for helping search engines and AI crawlers discover and prioritize your pages.",sitemap_empty:"The sitemap exists but contains
13705no URLs. This is treated the same as not having a sitemap.",sitemap_error:"The sitemap returned an error or could not be parsed. Fix this to ensure crawlers can discover your pages.",og_title_missing:"Without an Open Graph title, social shares use a fallback that may not represent the page well.",og_description_missing:"Without an Open Graph description, social shares lack a descriptive preview, reducing engagement.",long_paragraphs:"Very long paragraphs are difficult to scan. Breaking content into shorter paragraphs improves readability for both users and AI extraction.",no_eeat_signals:"No E-E-A-T (Experience, Expertise, Authoritativeness, Trustworthiness) signals were detected. These signals significantly influence AI citation decisions.",heading_levels_skipped:"Heading levels jump (e.g., H2 to H4), breaking the document outline. A proper hierarchy helps AI understand content structure.",heading_no_h1_first:"The first heading is not an H1. The document should start with an H1 as the primary topic signal.",robots_nofollow:"A nofollow robots directive tells crawlers not to follow links on this page, weakening internal link equity flow. The page itself can still be indexed.",redirect_loop:"The URL redirected too many times before reaching a final page, which usually indicates a redirect loop. Crawlers give up and the page becomes unreachable.",redirect_chain:"Multiple redirect hops slow down users, waste crawl budget, and dilute link equity. Each redirect should point directly at the final URL.",page_redirects:"The audited URL redirects to a different page, meaning your sitemap or internal links point at a stale address. Update them to reference the final URL directly.",lcp_slow:"Largest Contentful Paint measures how fast the main content renders. Slow LCP frustrates users and is a negative Core Web Vitals ranking signal.",cls_high:"Cumulative Layout Shift measures visual stability. Content that jumps around during load hurts user experience and the Core Web Vitals assessment.",inp_slow:"Interaction to Next Paint measures responsiveness to clicks and taps from real-user data. Slow INP fails the Core Web Vitals assessment.",mixed_content_active:"Scripts or stylesheets are loaded over insecure HTTP on an HTTPS page. Browsers block these entirely, which usually breaks the page.",mixed_content_passive:"Images or media are loaded over insecure HTTP on an HTTPS page. Browsers block or auto-upgrade them and remove the secure padlock.",search_bots_blocked:"robots.txt blocks Googlebot or Bingbot. This removes the site from organic search and from the indexes AI assistants use for citations (AI Overviews use Google's index; ChatGPT and Perplexity rely on Bing's).",llms_txt_missing:"llms.txt is an emerging standard that gives AI crawlers a curated overview of your most important content, making accurate citations easier.",duplicate_titles:"Multiple pages share the same title tag, so they compete with each other in search and AI retrieval. Each page should have a unique, descriptive title.",duplicate_meta_descriptions:"Multiple pages share the same meta description, wasting the chance to give each page a unique, compelling summary in search results and AI citations.",requires_js_rendering:"The page content is rendered entirely by JavaScript. Most AI crawlers (GPTBot, ClaudeBot, PerplexityBot) don't execute JavaScript, so they see an empty page. Enable server-side rendering or prerendering.",robots_txt_disallowed:"This page is blocked by a Disallow rule in robots.txt, so search engines and AI crawlers can never fetch it â it can't rank or be cited. If unintentional, remove or narrow the matching rule."},dmt=p.button.withConfig({displayName:"SiteAuditCategories__MetricsToggle",componentId:"sc-whae17-43"})` 13706 display: inline-flex; align-items: center; gap: 6px; 13707 background: none; border: 1px solid ${V}; border-radius: 8px; 13708 padding: 6px 12px; cursor: pointer; font-size: 0.78rem; font-weight: 700; 13709 color: ${z}; transition: all 0.15s; 13710 &:hover { color: ${O}; border-color: rgba(79,70,229,0.3); } 13711`,umt=p.div.withConfig({displayName:"SiteAuditCategories__PageDistGrid",componentId:"sc-whae17-44"})` 13712 display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; 13713 @media (max-width: 700px) { grid-template-columns: 1fr; } 13714`,w7=p.div.withConfig({displayName:"SiteAuditCategories__DistCard",componentId:"sc-whae17-45"})` 13715 border: 1px solid ${e=>e.$border}; border-radius: 0.6rem; padding: 0.75rem 0.85rem; text-align: center; 13716`,j7=p.div.withConfig({displayName:"SiteAuditCategories__DistCount",componentId:"sc-whae17-46"})`font-size: 1.4rem; font-weight: 900; color: ${e=>e.$c};`,_7=p.div.withConfig({displayName:"SiteAuditCategories__DistLabel",componentId:"sc-whae17-47"})`font-size: 0.7rem; color: ${z}; margin-top: 0.1rem;`,pmt=p.div.withConfig({displayName:"SiteAuditCategories__CoverageRow",componentId:"sc-whae17-48"})` 13717 display: flex; align-items: center; gap: 12px; margin-bottom: 8px; 13718`,mmt=p.span.withConfig({displayName:"SiteAuditCategories__CoveragePct",componentId:"sc-whae17-49"})`font-size: 1.5rem; font-weight: 900;`,hmt=p.span.withConfig({displayName:"SiteAuditCategories__CoverageMeta",componentId:"sc-whae17-50"})`font-size: 0.8rem; color: ${z}; font-weight: 500;`,eX=p.div.withConfig({displayName:"SiteAuditCategories__CoverageBarBg",componentId:"sc-whae17-51"})`height: 32px; background: ${$e}; border-radius: 8px; overflow: hidden; position: relative;`,tX=p.div.withConfig({displayName:"SiteAuditCategories__CoverageBarFill",componentId:"sc-whae17-52"})` 13719 height: 100%; width: ${e=>Math.max(e.$w,1)}%; border-radius: 8px; 13720 background: linear-gradient(90deg, #7C3AED, #A78BFA); 13721 display: flex; align-items: center; padding-left: 12px; 13722 font-size: 0.72rem; font-weight: 600; color: ${Z}; 13723 white-space: nowrap; overflow: hidden; 13724`,fmt=p.div.withConfig({displayName:"SiteAuditCategories__SchemaGrid",componentId:"sc-whae17-53"})` 13725 display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; 13726 @media (max-width: 700px) { grid-template-columns: repeat(2, 1fr); }
13727`,nX=p.div.withConfig({displayName:"SiteAuditCategories__SchemaTypeCard",componentId:"sc-whae17-54"})` 13728 background: ${e=>e.$missing?kn:Z}; 13729 border: 1px solid ${e=>e.$missing?Er:V}; 13730 border-radius: 8px; padding: 14px; text-align: center; 13731`,iX=p.div.withConfig({displayName:"SiteAuditCategories__SchemaTypeCount",componentId:"sc-whae17-55"})` 13732 font-size: 1.5rem; font-weight: 800; color: ${e=>e.$c||"#7C3AED"}; 13733`,rX=p.div.withConfig({displayName:"SiteAuditCategories__SchemaTypeName",componentId:"sc-whae17-56"})`font-size: 0.68rem; color: ${z}; margin-top: 2px; font-weight: 600;`,gmt=p.table.withConfig({displayName:"SiteAuditCategories__GapTable",componentId:"sc-whae17-57"})` 13734 width: 100%; border-collapse: collapse; 13735 th { font-size: 0.65rem; font-weight: 700; color: ${z}; text-transform: uppercase; letter-spacing: 0.4px; text-align: left; padding: 0.55rem 0.6rem; border-bottom: 1px solid ${V}; background: ${Z}; } 13736 td { font-size: 0.78rem; font-weight: 600; color: ${O}; padding: 0.55rem 0.6rem; border-bottom: 1px solid ${$e}; vertical-align: middle; } 13737 tr:last-child td { border-bottom: none; } 13738 tr:hover td { background: ${At}; } 13739`,ymt=p.span.withConfig({displayName:"SiteAuditCategories__MissingBadge",componentId:"sc-whae17-58"})` 13740 display: inline-block; padding: 1px 6px; border-radius: 4px; font-size: 0.62rem; font-weight: 700; 13741 background: ${kn}; color: ${Ut}; margin: 1px 2px; 13742`,xmt=p.span.withConfig({displayName:"SiteAuditCategories__DetectedBadge",componentId:"sc-whae17-59"})` 13743 display: inline-block; padding: 1px 6px; border-radius: 4px; font-size: 0.62rem; font-weight: 700; 13744 background: ${si}; color: #059669; margin: 1px 2px; 13745`,bmt=p.div.withConfig({displayName:"SiteAuditCategories__BotGrid",componentId:"sc-whae17-60"})` 13746 display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; 13747 @media (max-width: 900px) { grid-template-columns: repeat(3, 1fr); } 13748 @media (max-width: 600px) { grid-template-columns: repeat(2, 1fr); } 13749`,vmt=p.div.withConfig({displayName:"SiteAuditCategories__BotCard",componentId:"sc-whae17-61"})` 13750 border: 1px solid ${e=>e.$status==="blocked"?Er:e.$status==="allowed"?Mo:V}; 13751 background: ${e=>e.$status==="blocked"?kn:e.$status==="allowed"?si:e.$status==="unknown"?At:Z}; 13752 border-radius: 10px; padding: 14px 12px; text-align: center; 13753`,wmt=p.div.withConfig({displayName:"SiteAuditCategories__BotName",componentId:"sc-whae17-62"})`font-size: 0.8rem; font-weight: 700; color: ${O}; margin-bottom: 4px;`,jmt=p.div.withConfig({displayName:"SiteAuditCategories__BotNote",componentId:"sc-whae17-63"})`font-size: 0.62rem; color: ${z}; font-weight: 500; margin-bottom: 6px; line-height: 1.3;`,_mt=p.span.withConfig({displayName:"SiteAuditCategories__BotStatus",componentId:"sc-whae17-64"})` 13754 display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 6px; font-size: 0.68rem; font-weight: 700; 13755 ${e=>e.$status==="allowed"?`background: ${Ry}; color: ${Vt};`:e.$status==="blocked"?`background: ${kn}; color: ${Ut};`:e.$status==="unknown"?`background: ${$e}; color: ${z};`:`background: ${Oy}; color: ${$i};`} 13756`,Cmt=p.div.withConfig({displayName:"SiteAuditCategories__DirectiveBlock",componentId:"sc-whae17-65"})` 13757 background: #0F172A; border-radius: 8px; padding: 12px 14px; font-family: monospace; font-size: 0.78rem; line-height: 1.7; color: #E2E8F0; 13758`,Smt=p.span.withConfig({displayName:"SiteAuditCategories__DirectiveUA",componentId:"sc-whae17-66"})`color: #7DD3FC; font-weight: 600;`,kmt=p.span.withConfig({displayName:"SiteAuditCategories__DirectiveAllow",componentId:"sc-whae17-67"})`color: #34D399;`,$mt=p.span.withConfig({displayName:"SiteAuditCategories__DirectiveDisallow",componentId:"sc-whae17-68"})`color: #F87171;`,Imt=p.button.withConfig({displayName:"SiteAuditCategories__DirectiveToggleBtn",componentId:"sc-whae17-69"})` 13759 display: inline-flex; align-items: center; gap: 5px; 13760 margin-top: 16px; padding: 6px 12px; border-radius: 6px; 13761 background: ${$e}; border: 1px solid ${V}; 13762 color: ${O}; font-size: 0.72rem; font-weight: 700; 13763 cursor: pointer; font-family: inherit; transition: background 0.12s; 13764 &:hover { background: ${V}; } 13765`;function Pmt({directives:e}){const[n,i]=l.useState(!1);return t.jsxs("div",{children:[t.jsxs(Imt,{type:"button",onClick:()=>i(r=>!r),children:[n?t.jsx(qn,{size:13}):t.jsx(Gi,{size:13}),"robots.txt directives (",e.length,")"]}),n&&t.jsx("div",{style:{marginTop:8},children:t.jsx(Cmt,{children:e.map(r=>
13765t.jsxs("div",{children:[t.jsxs(Smt,{children:["User-agent: ",r.user_agent]})," â ",r.directive==="Disallow"?t.jsxs($mt,{children:[r.directive,": ",r.path]}):t.jsxs(kmt,{children:[r.directive,": ",r.path]})]},r.user_agent))})})]})}const oX=p.div.withConfig({displayName:"SiteAuditCategories__HealthRow",componentId:"sc-whae17-70"})` 13766 display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid ${$e}; font-size: 0.82rem; 13767 &:last-child { border-bottom: none; } 13768`,sX=p.span.withConfig({displayName:"SiteAuditCategories__HealthLabel",componentId:"sc-whae17-71"})`color: ${z}; font-weight: 500;`,aX=p.span.withConfig({displayName:"SiteAuditCategories__HealthValue",componentId:"sc-whae17-72"})`font-weight: 700; color: ${O};`,lX=p.span.withConfig({displayName:"SiteAuditCategories__PathPill",componentId:"sc-whae17-73"})` 13769 display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 0.68rem; font-weight: 600; font-family: monospace; 13770 margin: 2px 3px; 13771 ${e=>e.$type==="missing"?`background: ${kn}; color: ${Ut};`:`background: ${Oy}; color: ${$i};`} 13772`,Amt=p.div.withConfig({displayName:"SiteAuditCategories__CwvGrid",componentId:"sc-whae17-74"})` 13773 display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; 13774 @media (max-width: 900px) { grid-template-columns: repeat(3, 1fr); } 13775 @media (max-width: 700px) { grid-template-columns: repeat(2, 1fr); } 13776`,Uw=p.div.withConfig({displayName:"SiteAuditCategories__CwvCard",componentId:"sc-whae17-75"})` 13777 border: 1px solid ${e=>e.$tone==="good"?Mo:e.$tone==="poor"?Er:e.$tone==="needs_improvement"?K_:V}; 13778 background: ${e=>e.$tone==="good"?si:e.$tone==="poor"?kn:e.$tone==="needs_improvement"?Jl:Z}; 13779 border-radius: 10px; padding: 14px 12px; text-align: center; 13780`,Hw=p.div.withConfig({displayName:"SiteAuditCategories__CwvValue",componentId:"sc-whae17-76"})`font-size: 1.4rem; font-weight: 900; color: ${e=>e.$c||O};`,qw=p.div.withConfig({displayName:"SiteAuditCategories__CwvLabel",componentId:"sc-whae17-77"})`font-size: 0.68rem; color: ${z}; margin-top: 2px; font-weight: 600;`,Gw=p.div.withConfig({displayName:"SiteAuditCategories__CwvThreshold",componentId:"sc-whae17-78"})`font-size: 0.58rem; color: ${z}; margin-top: 2px;`,Nmt=p.div.withConfig({displayName:"SiteAuditCategories__ResourceGrid",componentId:"sc-whae17-79"})` 13781 display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; 13782 @media (max-width: 700px) { grid-template-columns: repeat(2, 1fr); } 13783`,j$=p.div.withConfig({displayName:"SiteAuditCategories__ResourceCard",componentId:"sc-whae17-80"})` 13784 border: 1px solid ${V}; border-radius: 10px; padding: 14px 12px; text-align: center; 13785`,_$=p.div.withConfig({displayName:"SiteAuditCategories__ResourceValue",componentId:"sc-whae17-81"})`font-size: 1.5rem; font-weight: 900; color: ${e=>e.$c||O};`,C$=p.div.withConfig({displayName:"SiteAuditCategories__ResourceLabel",componentId:"sc-whae17-82"})`font-size: 0.68rem; color: ${z}; margin-top: 2px; font-weight: 600;`,zmt=p.div.withConfig({displayName:"SiteAuditCategories__SpeedDistGrid",componentId:"sc-whae17-83"})` 13786 display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; 13787 @media (max-width: 600px) { grid-template-columns: 1fr; } 13788`,C7=p.div.withConfig({displayName:"SiteAuditCategories__SpeedDistCard",componentId:"sc-whae17-84"})` 13789 border: 1px solid ${e=>e.$tone==="good"?Mo:e.$tone==="poor"?Er:K_}; 13790 background: ${e=>e.$tone==="good"?si:e.$tone==="poor"?kn:Jl}; 13791 border-radius: 10px; padding: 14px 12px; text-align: center; 13792`,S7=p.div.withConfig({displayName:"SiteAuditCategories__SpeedDistVal",componentId:"sc-whae17-85"})`font-size: 1.3rem; font-weight: 900; color: ${e=>e.$c||O};`,k7=p.div.withConfig({displayName:"SiteAuditCategories__SpeedDistLbl",componentId:"sc-whae17-86"})`font-size: 0.68rem; color: ${z}; margin-top: 2px; font-weight: 600;`,$7=p.div.withConfig({displayName:"SiteAuditCategories__SpeedDistPct",componentId:"sc-whae17-87"})`font-size: 0.62rem; color: ${e=>e.$c||z};
13792 margin-top: 1px; font-weight: 700;`,Tmt=p.div.withConfig({displayName:"SiteAuditCategories__MetaCoverageRow",componentId:"sc-whae17-88"})` 13793 display: flex; flex-direction: column; gap: 14px; 13794`,cX=p.div.withConfig({displayName:"SiteAuditCategories__MetaCoverageItem",componentId:"sc-whae17-89"})``,dX=p.div.withConfig({displayName:"SiteAuditCategories__MetaCoverageHeader",componentId:"sc-whae17-90"})` 13795 display: flex; justify-content: space-between; margin-bottom: 5px; font-size: 0.82rem; font-weight: 600; color: ${O}; 13796`,uX=p.div.withConfig({displayName:"SiteAuditCategories__MetaCoverageBarBg",componentId:"sc-whae17-91"})`height: 22px; background: ${$e}; border-radius: 6px; overflow: hidden;`,pX=p.div.withConfig({displayName:"SiteAuditCategories__MetaCoverageBarFill",componentId:"sc-whae17-92"})` 13797 height: 100%; width: ${e=>Math.max(e.$w,1)}%; border-radius: 6px; 13798 background: ${e=>e.$bg}; 13799 display: flex; align-items: center; padding-left: 8px; 13800 font-size: 0.64rem; font-weight: 600; color: ${Z}; 13801`,Emt=p.div.withConfig({displayName:"SiteAuditCategories__HeadingStatsGrid",componentId:"sc-whae17-93"})` 13802 display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; 13803 @media (max-width: 600px) { grid-template-columns: 1fr; } 13804`,I7=p.div.withConfig({displayName:"SiteAuditCategories__HeadingStatCard",componentId:"sc-whae17-94"})` 13805 border: 1px solid ${V}; border-radius: 10px; padding: 16px; text-align: center; 13806`,P7=p.div.withConfig({displayName:"SiteAuditCategories__HeadingStatValue",componentId:"sc-whae17-95"})`font-size: 1.5rem; font-weight: 900; color: ${e=>e.$c};`,A7=p.div.withConfig({displayName:"SiteAuditCategories__HeadingStatLabel",componentId:"sc-whae17-96"})`font-size: 0.72rem; color: ${z}; margin-top: 4px; font-weight: 600;`;p.div.withConfig({displayName:"SiteAuditCategories__LinkStatGrid",componentId:"sc-whae17-97"})` 13807 display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; 13808 @media (max-width: 700px) { grid-template-columns: repeat(2, 1fr); } 13809`;p.div.withConfig({displayName:"SiteAuditCategories__LinkStatCard",componentId:"sc-whae17-98"})` 13810 border: 1px solid ${V}; border-radius: 10px; padding: 14px 12px; text-align: center; 13811`;p.div.withConfig({displayName:"SiteAuditCategories__LinkStatValue",componentId:"sc-whae17-99"})`font-size: 1.5rem; font-weight: 900; color: ${e=>e.$c||O};`;p.div.withConfig({displayName:"SiteAuditCategories__LinkStatLabel",componentId:"sc-whae17-100"})`font-size: 0.68rem; color: ${z}; margin-top: 2px; font-weight: 600;`;p.div.withConfig({displayName:"SiteAuditCategories__AnchorRow",componentId:"sc-whae17-101"})` 13812 display: flex; justify-content: space-between; align-items: center; 13813 padding: 12px 0; border-bottom: 1px solid ${$e}; font-size: 0.82rem; 13814 &:last-child { border-bottom: none; } 13815`;p.span.withConfig({displayName:"SiteAuditCategories__AnchorType",componentId:"sc-whae17-102"})`flex: 1; font-weight: 600; color: ${O};`;p.span.withConfig({displayName:"SiteAuditCategories__AnchorCount",componentId:"sc-whae17-103"})`font-weight: 700; width: 100px; text-align: right; color: ${O}; margin-right: 12px;`;p.span.withConfig({displayName:"SiteAuditCategories__AnchorStatus",componentId:"sc-whae17-104"})` 13816 display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 6px; font-size: 0.68rem; font-weight: 700; 13817 ${e=>e.$tone==="good"?`background: ${Ry}; color: ${Vt};`:e.$tone==="warning"?`background: ${Oy}; color: ${$i};`:`background: ${kn}; color: ${Ut};`} 13818`;const Mmt={structured_data:"Validates Schema.org markup, JSON-LD syntax, and rich snippet eligibility. Proper schema has 2.5x higher chance of AI citation.",crawlability:"Evaluates robots.txt configuration, AI bot permissions, sitemap health, internal/external links, and page-level crawl directives.",performance:"Measures loading speed, DOM complexity, image optimization, and resource hints. Slow sites get deprioritized by AI agents.",security:"Checks security headers, HTTPS enforcement, and access patterns. Secure sites build trust with AI agents and search engines.",content_quality:"Evaluates word count, readability, media presence, content-to-code ratio, publication dates, and author attribution.",content_structure:"Checks heading hierarchy, paragraph structure, list usage, and table of contents for long content.",meta_onpage:"Checks titles, meta descriptions, Open Graph, Twitter Cards, alt text coverage, and language attributes.",aeo_readiness:"Evaluates direct answer formatting, concise definitions, FAQ schema, E-E-A-T signals, source citations, summaries, and Q&A patterns for AI answer eligibility."};function mX({workspaceId:e,projectId:n,pillar:i,siteCategoryScores:r,categoryBreakdown:o,pages:s,onNavigateToPage:a,initialCategory:c,highlightIssueCode:u,onHighlightConsumed:m,schemaData:h,crawlabilityData:g,performanceData:x,metadataData:y,linksData:w,securityData:j,contentQualityData:v,contentStructureData:_,aeoData:$,canManageSiteAudit:k=!1,agentsContentTabHref:P=null}){const S=i==="technical"?OY:i==="content"?DY:[...OY,...DY],I=c&&S.includes(c)?c:S[0],[A,E]=l.useState(I),[B,T]=l.useState([]),[M,R]=l.useState(!1),[F,Y]=l.useState(null),[H,U]=l.useState(new Set(["high","medium","low"])),[X,Q]=l.useState(!1),K=l.useRef(new Map),G=l.useRef(void 0),[L,q]=l.useState({}),[W,oe]=l.useState({}),[se,de]=l.useState({}),le=20,me=Uo(),[ee,ne]=l.useState(0),[Ae,_e]=l.useState(()=>
13818new Set),{stateFor:we,triggerFix:Ke,triggerFixBatch:ce,primeFromActions:ie}=Z6e({organizationId:e,projectId:n}),Re=l.useCallback((ze,lt)=>{lt?K.current.set(ze,lt):K.current.delete(ze)},[]);l.useEffect(()=>{c&&c!==A&&S.includes(c)&&E(c)},[c]),l.useEffect(()=>{u&&(G.current=u)},[u]),l.useEffect(()=>{Y(null),U(new Set(["high","medium","low"])),Q(!1),q({}),oe({}),de({})},[A]),l.useEffect(()=>{let ze=!1;if(T([]),R(!0),!e||!n){R(!1);return}const lt=new URLSearchParams({category:A});return ue(`/api/v1/organizations/${e}/projects/${n}/site_audit_actions/grouped?${lt}`).then(async vt=>{if(ze)return;if(!vt.ok){const Qt=await vt.json().catch(()=>null);throw new Error(Qt?.error||`Failed to load issues (HTTP ${vt.status})`)}const Wt=await vt.json().catch(()=>null);ze||!Wt||T(Array.isArray(Wt.issues)?Wt.issues:[])}).catch(vt=>{ze||console.warn("[SiteAuditCategories] issues fetch error:",vt?.message)}).finally(()=>{ze||R(!1)}),()=>{ze=!0}},[A,e,n,ee]);const Be=l.useCallback((ze,lt=!1)=>{if(!e||!n)return;oe(Yt=>({...Yt,[ze]:!0}));const vt=lt?L[ze]||[]:[],Wt=Math.floor(vt.length/le)+1,Qt=new URLSearchParams({category:A,code:ze,page:String(Wt),per_page:String(le)});ue(`/api/v1/organizations/${e}/projects/${n}/site_audit_actions?${Qt}`).then(async Yt=>{if(!Yt.ok)return;const Zt=await Yt.json().catch(()=>null);if(!Zt)return;const tn=Array.isArray(Zt.actions)?Zt.actions:[];q(nn=>({...nn,[ze]:[...vt,...tn]})),de(nn=>({...nn,[ze]:Wt<(Zt.total_pages??1)})),ie(tn)}).catch(()=>{}).finally(()=>oe(Yt=>({...Yt,[ze]:!1})))},[e,n,A,L,ie]),tt=l.useCallback(async(ze,lt)=>{if(!(!k||!e||!n)){_e(vt=>new Set(vt).add(ze));try{const vt=await ue(`/api/v1/organizations/${e}/projects/${n}/content_drafts/generate_from_audit_action`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({site_audit_action_id:Number(ze)})}),Wt=await vt.json().catch(()=>({}));if(!vt.ok)throw new Error(Wt?.error||Wt?.message||`Failed to start draft (HTTP ${vt.status})`);me.showToast("Sent to Content Agent. Drafting nowâ¦",{tone:"success"}),ne(Qt=>Qt+1),Be(lt,!1)}catch(vt){me.showToast(vt?.message||"Failed to start draft",{tone:"error"})}finally{_e(vt=>{const Wt=new Set(vt);return Wt.delete(ze),Wt})}}},[k,e,n,me,Be]),dt=l.useCallback(ze=>{Y(lt=>lt===ze?null:(L[ze]||Be(ze),ze))},[L,Be]);l.useEffect(()=>{if(M||!G.current)return;const ze=G.current;G.current=void 0,m?.(),L[ze]||Be(ze),Y(ze),requestAnimationFrame(()=>{const lt=K.current.get(ze);lt&<.scrollIntoView({behavior:"smooth",block:"center"})})},[M,m,L,Be]);const je=h??{total_audited:0,with_schema:0,without_schema:0,coverage_pct:0,types:[],recommended_gap:[]},Me=g??{bot_matrix:[],robots_directives:[],sitemap:{status:"unknown",url_count:0,total_pages:0,coverage_pct:0,in_sitemap_not_found:[],found_not_in_sitemap:[]}},Se={pages_measured:0,avg_performance_score:null,avg_lcp_ms:null,avg_fcp_ms:null,avg_cls:null,avg_inp_ms:null,avg_tbt_ms:null,avg_speed_index_ms:null,avg_tti_ms:null,avg_total_byte_weight:null,total_render_blocking:0,total_unoptimized_images:0,total_offscreen_images:0,total_legacy_formats:0,score_distribution:{good:0,needs_improvement:0,poor:0},per_page:[]}
13818,it=x?.score_distribution?x:Se,De={count:0,pct:0},te={total_pages:0,coverage:{title:De,description:De,og_tags:De,twitter_card:De,canonical:De,social_preview:De},images:{total:0,with_alt:0,pct:0},headings:{proper_h1:0,h1_missing:0,hierarchy_issues:0}},ge=y?.coverage?y:te,Je={};w?.anchors;const Ee={total_pages:0,checklist:[],headers:[]},Xe=j?.checklist?j:Ee,yt=r?.[A]??null,Ne=tP[A],Le=o.find(ze=>ze.category===A),Ue=Le?.total??0,We=Le?.high??0,Qe=Le?.medium??0,ht=Le?.low??0,pe=l.useMemo(()=>{let ze=0,lt=0,vt=0,Wt=0;for(const Qt of s){const Yt=Qt.category_scores?.[A];if(Yt==null){Wt++;continue}Yt>=80?ze++:Yt>=50?lt++:vt++}return{healthy:ze,needsWork:lt,critical:vt,noData:Wt,total:s.length}},[s,A]),be=l.useMemo(()=>{const ze={high:0,medium:1,low:2};return B.filter(lt=>H.has(lt.severity)).sort((lt,vt)=>(ze[lt.severity]??3)-(ze[vt.severity]??3))},[B,H]),rt=l.useMemo(()=>{const ze={high:0,medium:0,low:0};for(const lt of B)ze[lt.severity]=(ze[lt.severity]||0)+1;return ze},[B]);return t.jsxs(Apt,{children:[t.jsx(Npt,{children:S.map(ze=>t.jsxs(zpt,{$active:ze===A,onClick:()=>E(ze),children:[(()=>{const lt=tP[ze].icon;return t.jsx(lt,{size:13})})(),t.jsx(Tpt,{"data-text":gu(ze),children:gu(ze)})]},ze))}),t.jsxs(Ept,{children:[t.jsx(Mpt,{$bg:Ne.bg,$fg:Ne.fg,children:t.jsx(Ne.icon,{size:24})}),t.jsxs(Rpt,{children:[t.jsxs(Opt,{children:[t.jsx(Dpt,{$c:os(yt),children:yt!=null?Math.round(yt):"â"}),t.jsx("span",{style:{fontSize:"0.75rem",fontWeight:700,color:z},children:"/ 100"})]}),t.jsx(Lpt,{children:gu(A)}),t.jsx(Bpt,{children:Mmt[A]})]})]}),t.jsxs(dmt,{onClick:()=>Q(ze=>!ze),children:[X?t.jsx(qn,{size:14}):t.jsx(Gi,{size:14}),X?"Hide detailed metrics":"Show detailed metrics"]}),X&&(A==="structured_data"?t.jsxs(t.Fragment,{children:[t.jsxs(N1,{children:[t.jsxs(is,{style:{flex:1,minWidth:0},children:[t.jsxs("div",{style:{marginBottom:"0.75rem"},children:[t.jsx(ts,{children:"Schema Coverage"}),t.jsx(ns,{children:"How many pages have structured data"})]}),t.jsxs(pmt,{children:[t.jsxs(mmt,{style:{color:je.coverage_pct>=60?"var(--color-green-500, #059669)":je.coverage_pct>=30?"var(--color-yellow-500, #D97706)":"var(--color-red-500, #DC2626)"},children:[Math.round(je.coverage_pct),"%"]}),t.jsxs(hmt,{children:[je.with_schema," of ",je.total_audited," audited page",je.total_audited!==1?"s":""," have schema markup"]})]}),t.jsx(eX,{children:t.jsx(tX,{$w:je.coverage_pct,children:je.with_schema>0?`${je.with_schema} page${je.with_schema!==1?"s":""}`:""})})]}),t.jsxs(is,{style:{flex:1,minWidth:0},children:[t.jsxs("div",{style:{marginBottom:"0.75rem"},children:[t.jsx(ts,{children:"Schema Types Found"}),t.jsx(ns,{children:"Distribution of schema types across the site"})]}),je.types.length===0&&je.without_schema===0?t.jsx(Sd,{children:"Run an audit to detect schema types on your pages."}):t.jsxs(fmt,{children:[je.types.map(ze=>t.jsxs(nX,{children:[t.jsx(iX,{children:ze.count}),t.jsx(rX,{children:ze.type})]},ze.type)),je.without_schema>0&&t.jsxs(nX,{$missing:!0,children:[t.jsx(iX,{$c:"var(--color-red-500, #DC2626)",children:je.without_schema}),t.jsx(rX,{children:"No Schema"})]})]})]})]}),t.jsxs(is,{children:[t.jsxs("div",{style:{marginBottom:"0.75rem"},children:[t.jsx(ts,{children:t.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[t.jsx(ei,{size:14,style:{color:"var(--color-yellow-500, #D97706)"}}),"Missing Recommended Schema"]})}),t.jsx(ns,{children:"Pages where recommended schema types are not yet implemented"})]}),je.recommended_gap.length===0?t.jsx(Sd,{children:je.total_audited>0?"All pages have their recommended schema implemented.":"Run an audit to analyze schema gaps."}):t.jsxs(t.Fragment,{children:[t.jsx(Vpt,{children:t.jsxs(gmt,{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx("th",{children:"Page"}),t.jsx("th",{children:"Detected"}),t.jsx("th",{children:"Missing"})]})}),t.jsx("tbody",{children:je.recommended_gap.slice(0,15).map(ze=>t.jsxs("tr",{children:[t.jsxs("td",{style:{maxWidth:200},children:[t.jsx("div",{style:{fontWeight:700,fontSize:"0.78rem",color:O},children:ze.path==="/"?"Homepage":ze.path}),ze.page_type&&t.jsx("div",{style:{fontSize:"0.62rem",color:z,fontWeight:600},children:ze.page_type})]}),t.jsx("td",{children:ze.detected.length>0?ze.detected.map(lt=>t.jsx(xmt,{children:lt},lt)):t.jsx("span",{style:{fontSize:"0.68rem",color:z},children:"None"})}),t.jsx("td",{children:ze.missing.map(lt=>t.jsx(ymt,{children:lt},lt))})]},ze.page_id))})]})}),je.recommended_gap.length>15&&t.jsxs("div",{style:{textAlign:"center",padding:"0.5rem 0",fontSize:"0.72rem",color:z},children:["+",je.recommended_gap.length-15," more page",je.recommended_gap.length-15!==1?"s":""]})]})]})]}):A==="performance"?t.jsx(Omt,{pd:it}):A==="meta_onpage"?t.jsx(Dmt,{md:ge}):A==="content_quality"?t.jsx(Ymt,{data:v}):A==="content_structure"?t.jsx(Xmt,{data:_}):A==="aeo_readiness"?t.jsx(Qmt,{data:$}):A==="security"?t.jsx(Kmt,{sd:Xe}):A==="crawlability"?t.jsxs(t.Fragment,{children:[t.jsxs(is,{children:[t.jsxs("div",{style:{marginBottom:"0.75rem"},children:[t.jsx(ts,{children:"Bot Access Matrix"}),t.jsx(ns,{children:"Which search engines and AI crawlers can access your site"})]}),Me.bot_matrix.length===0?t.jsx(Sd,{children:"Run an audit to analyze bot access permissions."}):t.jsxs(t.Fragment,{children:[Me.bot_matrix_unverifiable_reason==="site_blocked"&&t.jsxs("div",{style:{marginBottom:12,padding:"10px 16px",borderRadius:8,background:"var(--color-yellow-50, #FFF7ED)",border:"1px solid var(--color-yellow-200, #FED7AA)",display:"flex",alignItems:"flex-start",ga
13818p:10,fontSize:"0.78rem"},children:[t.jsx(ei,{size:16,style:{color:"var(--color-yellow-500, #D97706)",flexShrink:0,marginTop:2}}),t.jsxs("span",{style:{color:"var(--color-yellow-500, #D97706)",fontWeight:500,lineHeight:1.5},children:[t.jsx("strong",{children:"Bot access can't be verified"})," â your firewall / WAF blocked our auditor from reaching your pages. Even if your ",t.jsx("code",{children:"robots.txt"})," allows these bots, your firewall may be filtering them out at the network layer. Allowlist our auditor (see the firewall issue in the Issues tab) and re-run the audit to get an accurate matrix."]})]}),t.jsx(bmt,{children:Me.bot_matrix.map(ze=>t.jsxs(vmt,{$status:ze.status,children:[t.jsx(wmt,{children:ze.name}),ze.note&&t.jsx(jmt,{children:ze.note}),t.jsx(_mt,{$status:ze.status,children:ze.status==="allowed"?"â Allowed":ze.status==="blocked"?"â Blocked":ze.status==="unknown"?"â Unknown":"â Not Set"})]},ze.key))}),(()=>{const ze=Me.bot_matrix.filter(lt=>lt.status==="blocked"&<.category==="ai");return ze.length===0?null:t.jsxs("div",{style:{marginTop:12,padding:"10px 16px",borderRadius:8,background:"var(--color-yellow-50, #FFF7ED)",border:"1px solid var(--color-yellow-200, #FED7AA)",display:"flex",alignItems:"center",gap:10,fontSize:"0.78rem"},children:[t.jsx(ei,{size:16,style:{color:"var(--color-yellow-500, #D97706)",flexShrink:0}}),t.jsxs("span",{style:{color:"var(--color-yellow-500, #D97706)",fontWeight:500},children:[ze.length," AI crawler",ze.length!==1?"s are":" is"," blocked â ",ze.map(lt=>lt.name).join(", ")," cannot access your website content."]})]})})(),Me.robots_directives.length>0&&t.jsx(Pmt,{directives:Me.robots_directives})]})]}),t.jsxs(is,{children:[t.jsxs("div",{style:{marginBottom:"0.75rem"},children:[t.jsx(ts,{children:"Sitemap Health"}),t.jsx(ns,{children:"Coverage and status analysis"})]}),Me.sitemap.status==="unknown"||!Me.bot_matrix.length&&Me.sitemap.url_count===0?t.jsx(Sd,{children:"Run an audit to analyze sitemap health."}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{style:{marginBottom:12},children:[t.jsxs(oX,{children:[t.jsx(sX,{children:"Sitemap"}),t.jsx(aX,{children:Me.sitemap.status==="ok"?t.jsx("span",{style:{color:"var(--color-green-500, #059669)"},children:"sitemap.xml â Found â"}):Me.sitemap.status==="not_found"?t.jsx("span",{style:{color:"var(--color-red-500, #DC2626)"},children:"sitemap.xml â Not Found â"}):t.jsx("span",{style:{color:"var(--color-yellow-500, #D97706)"},children:"sitemap.xml â Error"})})]}),t.jsxs(oX,{children:[t.jsx(sX,{children:"Pages in sitemap"}),t.jsxs(aX,{children:[Me.sitemap.url_count,Me.sitemap.total_pages>0&&t.jsxs(t.Fragment,{children:[" / ",Me.sitemap.total_pages,Me.sitemap.total_pages>Me.sitemap.url_count&&t.jsxs("span",{style:{color:"var(--color-red-500, #DC2626)",fontWeight:600,marginLeft:6,fontSize:"0.75rem"},children:["(",Me.sitemap.total_pages-Me.sitemap.url_count," missing)"]})]})]})]})]}),Me.sitemap.status==="ok"&&Me.sitemap.total_pages>0&&t.jsxs("div",{style:{marginBottom:12},children:[t.jsxs("div",{style:{fontSize:"0.78rem",fontWeight:700,marginBottom:6,color:O},children:["Coverage: ",Math.round(Me.sitemap.coverage_pct),"%"]}),t.jsx(eX,{children:t.jsx(tX,{$w:Me.sitemap.coverage_pct,style:{background:Me.sitemap.coverage_pct>=80?"linear-gradient(90deg,#059669,#34D399)":Me.sitemap.coverage_pct>=50?"linear-gradient(90deg,#D97706,#FBBF24)":"linear-gradient(90deg,#DC2626,#EF4444)"},children:Me.sitemap.url_count>0?`${Me.sitemap.url_count} page${Me.sitemap.url_count!==1?"s":""}`:""})})]}),Me.sitemap.found_not_in_sitemap.length>0&&t.jsxs("div",{style:{marginTop:12},children:[t.jsxs("div",{style:{fontSize:"0.72rem",fontWeight:700,color:z,textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:6},children:["Found on site but missing from sitemap (",Me.sitemap.found_not_in_sitemap.length,")"]}),t.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:2},children:[Me.sitemap.found_not_in_sitemap.slice(0,15).map(ze=>t.jsx(lX,{$type:"extra",children:ze==="/"?"/":ze},ze)),Me.sitemap.found_not_in_sitemap.length>15&&t.jsxs("span",{style:{fontSize:"0.68rem",color:z,alignSelf:"center",marginLeft:4},children:["+",Me.sitemap.found_not_in_sitemap.length-15," more"]})]})]}),Me.sitemap.in_sitemap_not_found.length>0&&t.jsxs("div",{style:{marginTop:12},children:[t.jsxs("div",{style:{fontSize:"0.72rem",fontWeight:700,color:z,textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:6},children:["In sitemap but not discovered on site (",Me.sitemap.in_sitemap_not_found.length,")"]}),t.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:2},children:[Me.sitemap.in_sitemap_not_found.slice(0,15).map(ze=>t.jsx(lX,{$type:"missing",children:ze==="/"?"/":ze},ze)),Me.sitemap.in_sitemap_not_found.length>15&&t.jsxs("span",{style:{fontSize:"0.68rem",color:z,alignSelf:"center",marginLeft:4},children:["+",Me.sitemap.in_sitemap_not_found.length-15," more"]})]})]})]})]})]}):t.jsxs(t.Fragment,{children:[t.jsxs(is,{children:[t.jsxs("div",{style:{marginBottom:"0.75rem"},children:[t.jsx(ts,{children:"Page Score Distribution"}),t.jsx(ns,{children:"How pages score in this category"})]}),t.jsxs(umt,{children:[t.jsxs(w7,{$border:"rgba(16,185,129,0.3)",children:[t.jsx(j7,{$c:"#059669",children:pe.healthy}),t.jsx(_7,{children:"Healthy (⥠80)"})]}),t.jsxs(w7,{$border:"rgba(245,158,11,0.3)",children:[t.jsx(j7,{$c:"#D97706",children:pe.needsWork}),t.jsx(_7,{children:"Needs Work (50â79)"})]}),t.jsxs(w7,{$border:"rgba(239,68,68,0.3)",children:[t.jsx(j7,{$c:"#DC2626",children:pe.critical}),t.jsx(_7,{children:"Critical (< 50)"})]})]})]}),t.jsxs(is,{children:[t.jsxs("div",{style:{marginBottom:"0.75rem"},children:[t.jsx(ts,{children:"Issue Breakdown"}),t.jsxs(ns,{children:[Ue," open issue",Ue!==1?"s":""," in ",gu(A)]})]}),Ue===0?t.jsx(Sd,{children:"No open issues in this category."}):t.jsxs(t.Fragment,{children:[t.jsxs(g7,{children:[t.jsx(y7,{$c:"#DC2626",children:"High"}),t.jsx(x7,{children:t.jsx(b7,{$w:Ue>0?We/Ue*100:0,$gradient:"linear-gradient(90deg,#DC2626,#EF4444)",children:We>0?String(We):""})}),t.jsx(v7,{children:We})]}),t.jsxs(g7,{children:[t.jsx(y7,{$c:"#F97316",children:"Medium"}),t.jsx(x7,{children:t.jsx(b7,{$w:Ue>0?Qe/Ue*100:0,$gradient:"linear-gradient(90deg,#EA580C,#F97316)",children:Qe>0?String(Qe):""})}),t.jsx(v7,{children:Qe})]}),t.jsxs(g7,{children:[t.jsx(y7,{$c:"#EAB308",children:"Low"}),t.jsx(x7,{children:t.jsx(b7,{$w:Ue>0?ht/Ue*100:0,$gradient:"linear-gradient(90deg,#CA8A04,#EAB308)",children:ht>0?String(ht):""})}),t.jsx(v7,{children:ht})]})]})]})]})),t.jsxs(Fpt,{children:[t.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:12,marginBottom:"0.75rem",flexWrap:"wrap"},children:[t.jsxs("div",{children:[t.jsx(ts,{children:"Issues"}),t.jsxs(ns,{children:[be.length," issue type",be.length!==1?"s":""," in ",gu(A)]})]}),t.jsx(Upt,{children:[["high","High","#DC2626","#fef2f2"],["medium","Medium","#F97316","#FFF7ED"],["low","Low","#EAB308","#FEF9C3"]].map(([ze,lt,vt,Wt])=>t.jsxs(Hpt,{$active:H.has(ze),$accent:vt,$bg:Wt,onClick:()=>
13818U(Qt=>{const Yt=new Set(Qt);return Yt.has(ze)?Yt.size>1&&Yt.delete(ze):Yt.add(ze),Yt}),children:[t.jsx(qpt,{$c:vt}),lt,t.jsx(Gpt,{$active:H.has(ze),$accent:vt,children:rt[ze]||0})]},ze))})]}),M?t.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:Array.from({length:4}).map((ze,lt)=>t.jsx(nt,{height:42,radius:8},lt))}):be.length===0?t.jsx(Sd,{children:"No issues found for this category."}):t.jsx(t.Fragment,{children:be.map(ze=>{const lt=F===ze.code,vt=L[ze.code]||[],Wt=W[ze.code]||!1,Qt=se[ze.code]||!1;return t.jsxs(Kpt,{$open:lt,ref:Yt=>Re(ze.code,Yt),children:[t.jsxs(Ypt,{onClick:()=>dt(ze.code),children:[t.jsx(Wpt,{$s:ze.severity||"low",children:ze.severity==="high"?"High":ze.severity==="medium"?"Med":"Low"}),t.jsx(Xpt,{children:ze.message}),ze.affected_count>1&&t.jsxs(Qpt,{children:[ze.affected_count," pages"]}),ze.open_count>0?t.jsxs("span",{style:{fontSize:"0.6rem",fontWeight:700,color:"var(--color-red-500, #DC2626)",padding:"1px 5px",borderRadius:4,background:"var(--color-red-50, #fef2f2)",flexShrink:0},children:[ze.open_count," open"]}):t.jsx("span",{style:{fontSize:"0.6rem",fontWeight:700,color:"var(--color-green-500, #059669)",padding:"1px 5px",borderRadius:4,background:"var(--color-green-50, #ecfdf5)",flexShrink:0},children:"Done"}),(ze.open_content_drafts_count??0)>0&&t.jsxs("span",{style:{fontSize:"0.6rem",fontWeight:700,color:Vt,padding:"1px 5px",borderRadius:4,background:si,flexShrink:0},children:[ze.open_content_drafts_count," drafting"]}),t.jsx(Zpt,{children:lt?t.jsx(qn,{size:14}):t.jsx(Gi,{size:14})})]}),lt&&t.jsxs(t.Fragment,{children:[JY[ze.code]&&t.jsxs(lmt,{children:[t.jsx("div",{style:{fontSize:"0.62rem",fontWeight:700,color:z,textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:3},children:"Why it matters"}),JY[ze.code]]}),t.jsxs(Jpt,{children:[t.jsxs(emt,{children:[t.jsxs("span",{style:{fontSize:"0.62rem",fontWeight:700,color:z,textTransform:"uppercase",letterSpacing:"0.04em"},children:["Affected pages (",ze.affected_count,")"]}),(()=>{const Yt=[];let Zt=!1;for(const tn of vt){const nn=tn.self_healing;if(tn.status!=="open"||!nn?.supported||(nn.connector_alive&&(Zt=!0),nn.not_fixable_reason))continue;const xn=we(tn.id);xn.status==="queued"||xn.status==="dispatched"||xn.status==="succeeded"||Yt.push(String(tn.id))}return Yt.length<2?null:t.jsx(i7e,{eligibleCount:Yt.length,totalAffected:ze.affected_count,connectorAlive:Zt,onTrigger:()=>ce(Yt)})})()]}),vt.map(Yt=>{const Zt=Yt.self_healing;return t.jsxs(nmt,{children:[t.jsxs(tmt,{type:"button",onClick:()=>Yt.page_id?a?.(Yt.page_id):void 0,disabled:!a||!Yt.page_id,children:[t.jsx(amt,{$open:Yt.status==="open"}),t.jsx(smt,{children:Yt.page_path?Yt.page_path==="/"?"Homepage":Yt.page_path:"Site-wide"})]}),t.jsxs(imt,{children:[Yt.status==="open"&&k&&Yt.content_fixable&&t.jsx(t.Fragment,{children:typeof Yt.content_drafting_id=="number"&&Yt.content_drafting_id>0&&P?t.jsxs(rmt,{href:P,children:[t.jsx(Lc,{size:11})," Draft"]}):t.jsxs(omt,{type:"button",disabled:Ae.has(Yt.id),onClick:()=>{tt(Yt.id,ze.code)},children:[t.jsx(Sn,{size:11}),Ae.has(Yt.id)?"â¦":"Content"]})}),Yt.status==="open"&&t.jsx(t7e,{supported:!!Zt?.supported,requiresReview:!!Zt?.requires_review,connectorAlive:!!Zt?.connector_alive,notFixableReason:Zt?.not_fixable_reason??null,state:we(Yt.id),onTrigger:()=>{Ke(Yt.id)}})]})]},Yt.id)}),Wt&&t.jsx(nt,{height:24,radius:6}),!Wt&&Qt&&t.jsx(cmt,{onClick:()=>Be(ze.code,!0),children:"Show more pages..."}),!Wt&&vt.length===0&&t.jsx(Sd,{style:{padding:"0.5rem"},children:"Loading..."})]})]})]},ze.code)})})]})]})}function hX(e){return e==null?"neutral":e<=2500?"good":e<=4e3?"needs_improvement":"poor"}function fX(e){return e==null?"neutral":e<=1800?"good":e<=3e3?"needs_improvement":"poor"}function gX(e){return e==null?"neutral":e<=.1?"good":e<=.25?"needs_improvement":"poor"}function yX(e){return e==null?"neutral":e<=200?"good":e<=600?"needs_improvement":"poor"}function xX(e){return e==null?"neutral":e<=200?"good":e<=500?"needs_improvement":"poor"}function Vw(e){return e==="good"?"var(--color-green-500, #059669)":e==="needs_improvement"?"var(--color-yellow-500, #D97706)":e==="poor"?"var(--color-red-500, #DC2626)":O}function S$(e){return e==null?"â":e>=1e3?`${(e/1e3).toFixed(1)}s`:`${Math.round(e)}ms`}function Rmt(e){return e==null?"â":e>=1048576?`${(e/1048576).toFixed(1)} MB`:e>=1024?`${(e/1024).toFixed(0)} KB`:`${e} B`}function Omt({pd:e}){const n=e.pages_measured>0,i=e.score_distribution.good+e.score_distribution.needs_improvement+e.score_distribution.poor;return t.jsxs(t.Fragment,{children:[t.jsxs(is,{children:[t.jsxs("div",{style:{marginBottom:"0.75rem"},children:[t.jsx(ts,{children:"Core Web Vitals"}),t.jsx(ns,{children:n?"Averaged across audited pages":"Run an audit to measure Core Web Vitals via PageSpeed Insights"})]}),t.jsxs(Amt,{children:[t.jsx(at,{content:"Largest Contentful Paint â how long it takes for the largest visible element to render. Directly impacts perceived load speed.",placement:"top",onlyIfTruncated:!1,maxWidth:280,children:t.jsxs(Uw,{$tone:hX(e.avg_lcp_ms),children:[t.jsx(Hw,{$c:Vw(hX(e.avg_lcp_ms)),children:S$(e.avg_lcp_ms)}),t.jsx(qw,{children:"LCP"}),t.jsx(Gw,{children:"Good ⤠2.5s"})]})}),t.jsx(at,{content:"First Contentful Paint â how long until the browser renders the first piece of content. Indicates when users start seeing something on screen.",placement:"top",onlyIfTruncated:!1,maxWidth:280,children:t.jsxs(Uw,{$tone:fX(e.avg_fcp_ms),children:[t.jsx(Hw,{$c:Vw(fX(e.avg_fcp_ms)),children:S$(e.avg_fcp_ms)}),t.jsx(qw,{children:"FCP"}),t.jsx(Gw,{children:"Good ⤠1.8s"})]})}),t.jsx(at,{content:"Cumulative Layout Shift â measures visual stability. A low CLS means page elements don't jump around unexpectedly as the page loads.",placement:"top",onlyIfTruncated:!1,maxWidth:280,children:t.jsxs(Uw,{$tone:gX(e.avg_cls),children:[t.jsx(Hw,{$c:Vw(gX(e.avg_cls)),children:e.avg_cls!=null?e.avg_cls.toFixed(3):"â"}),t.jsx(qw,{children:"CLS"}),t.jsx(Gw,{children:"Good ⤠0.1"})]})}),t.jsx(at,{content:"Interaction to Next Paint â how quickly the page responds to clicks and taps, measured from real users (Chrome UX Report). Only available for sites with enough real-user traffic.",placement:"top",onlyIfTruncated:!1,maxWidth:280,children:t.jsxs(Uw,{$tone:xX(e.avg_inp_ms),children:[t.jsx(Hw,{$c:Vw(xX(e.avg_inp_ms)),children:S$(e.avg_inp_ms??null)}),t.jsx(qw,{children:"INP"}),t.jsx(Gw,{children:"Good ⤠200ms"})]})}),t.jsx(at,{content:"Total Blocking Time â total time the main thread was blocked and couldn't respond to user input. Affects how responsive the page feels.",placement:"top",onlyIfTruncated:!1,maxWidth:280,children:t.jsxs(Uw,{$tone:yX(e.avg_tbt_ms),children:[t.jsx(Hw,{$c:Vw(yX(e.avg_tbt_ms)),children:S$(e.avg_tbt_ms)}),t.jsx(qw,{children:"TBT"}),t.jsx(Gw,{children:"Good ⤠200ms"})]})})]}),i>0&&t.jsxs("div",{style:{marginTop:16},children:[t.jsx("div",{style:{fontSize:"0.72rem",fontWeight:700,color:z,textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:10},children:"Page Speed Distribution"}),t.jsxs(zmt,{children:[t.jsxs(C7,{$tone:"good",children:[t.jsx(S7,{$c:"var(--color-green-500, #059669)",children:e.score_distribution.good}),t.jsx(k7,{children:"Good (90+)"}),t.jsxs($7,{$c:"var(--color-green-500, #059669)",children:[Math.round(e.score_distribution.good/i*100),"%"]})]}),t.jsxs(C7,{$tone:"warn",children:[t.jsx(S7,{$c:"var(--color-yellow-500, #D97706)",children:e.score_distribution.needs_improvement}),t.jsx(k7,{children:"Needs Work (50â89)"}),t.jsxs($7,{$c:"var(--color-yellow-500, #D97706)",children:[Math.round(e.score_distribution.needs_improvement/i*100),"%"]})]}),t.jsxs(C7,{$tone:"poor",children:[t.jsx(S7,{$c:"var(--color-red-500, #DC2626)",children:e.score_distribution.poor}),t.jsx(k7,{children:"Poor (<50)"}),t.jsxs($7,{$c:"var(--color-red-500, #DC2626)",children:[Math.round(e.score_distribution.poor/i*100),"%"]})]})]})]})]}),t.jsxs(is,{children:[t.jsxs("div",{style:{marginBottom:"0.75rem"},children:[t.jsx(ts,{children:"Resource Analysis"}),t.jsx(ns,{children:n?"Site-wide resource optimization opportunities":"Run an audit to analyze resource usage"})]}),t.jsxs(Nmt,{children:[t.jsx(at,{content:"Average total transfer size per page including HTML, CSS, JS, images, and fonts. Lighter pages load faster and use less bandwidth.",placement:"top",onlyIfTruncated:!1,maxWidth:280,children:t.jsxs(j$,{children:[t.jsx(_$,{children:Rmt(e.avg_total_byte_weight)}),t.jsx(C$,{children:"Avg. Page Weight"})]})}),t.jsx(at,{content:"Number of CSS/JS resources that block the initial render of the page. Reducing these improves First Contentful Paint and time to interactive.",placement:"top",onlyIfTruncated:!1,maxWidth:280,children:t.jsxs(j$,{children:[t.jsx(_$,{$c:e.total_render_blocking>0?"var(--color-yellow-500, #D97706)":"var(--color-green-500, #059669)",children:e.total_render_blocking}),t.jsx(C$,{children:"Render-Blocking Resources"})]})}),t.jsx(at,{content:"Images that could be compressed or resized to reduce file size without visible quality loss. Optimizing them speeds up page load.",placement:"top",onlyIfTruncated:!1,maxWidth:280,children:t.jsxs(j$,{children:[t.jsx(_$,{$c:e.total_unoptimized_images>0?"var(--color-yellow-500, #D97706)":"var(--color-green-500, #059669)",children:e.total_unoptimized_images}),t.jsx(C$,{children:"Unoptimized Images"})]})}),t.jsx(at,{content:"Images served in older formats (JPEG, PNG, GIF) instead of modern formats like WebP or AVIF, which offer better compression and quality.",placement:"top",onlyIfTruncated:!1,maxWidth:280,children:t.jsxs(j$,{children:[t.jsx(_$,{$c:e.total_legacy_formats>0?"var(--color-yellow-500, #D97706)":"var(--color-green-500, #059669)",children:e.total_legacy_formats}),t.jsx(C$,{children:"Legacy Image Formats"})]})})]})]})]})}
13818function bX(e,n){return n!=null&&n===0?V:e>=80?"var(--color-green-500, #059669)":e>=50?"var(--color-yellow-500, #D97706)":"var(--color-red-500, #DC2626)"}function Dmt({md:e}){const n=e.total_pages,i=e.coverage,r=[{label:"Title tags",item:i.title},{label:"Meta descriptions",item:i.description},{label:"Canonical URLs",item:i.canonical},{label:"Open Graph tags",item:i.og_tags},{label:"Twitter Card",item:i.twitter_card},{label:"Social Preview (OG + Twitter)",item:i.social_preview}];return t.jsxs(N1,{children:[t.jsxs(is,{style:{flex:1,minWidth:0},children:[t.jsxs("div",{style:{marginBottom:"0.75rem"},children:[t.jsx(ts,{children:"Metadata Coverage"}),t.jsx(ns,{children:n>0?`Percentage of ${n} audited page${n!==1?"s":""} with proper metadata`:"Run an audit to analyze metadata coverage"})]}),t.jsxs(Tmt,{children:[r.map(o=>t.jsxs(cX,{children:[t.jsxs(dX,{children:[t.jsx("span",{children:o.label}),t.jsxs("span",{children:[o.item.count,"/",n," (",Math.round(o.item.pct),"%)"]})]}),t.jsx(uX,{children:t.jsx(pX,{$w:o.item.pct,$bg:bX(o.item.pct,n),children:o.item.count>0?`${o.item.count} page${o.item.count!==1?"s":""}`:""})})]},o.label)),t.jsxs(cX,{children:[t.jsxs(dX,{children:[t.jsx("span",{children:"Image alt text"}),t.jsxs("span",{children:[e.images.with_alt,"/",e.images.total," (",Math.round(e.images.pct),"%)"]})]}),t.jsx(uX,{children:t.jsx(pX,{$w:e.images.pct,$bg:bX(e.images.pct,e.images.total),children:e.images.with_alt>0?`${e.images.with_alt} image${e.images.with_alt!==1?"s":""}`:""})})]})]})]}),t.jsxs(is,{style:{flex:1,minWidth:0},children:[t.jsxs("div",{style:{marginBottom:"0.75rem"},children:[t.jsx(ts,{children:"Heading Structure"}),t.jsx(ns,{children:"H1 tags and heading hierarchy across audited pages"})]}),t.jsxs(Emt,{children:[t.jsx(at,{content:"Pages that have exactly one H1 tag â the primary heading search engines and AI models use to understand page topic.",placement:"top",onlyIfTruncated:!1,maxWidth:260,children:t.jsxs(I7,{children:[t.jsxs(P7,{$c:"var(--color-green-500, #059669)",children:[e.headings.proper_h1,n>0?`/${n}`:""]}),t.jsx(A7,{children:"Pages with proper H1"})]})}),t.jsx(at,{content:"Pages where heading levels are skipped (e.g. H2 â H4). A clean hierarchy helps AI models parse content structure correctly.",placement:"top",onlyIfTruncated:!1,maxWidth:260,children:t.jsxs(I7,{children:[t.jsx(P7,{$c:e.headings.hierarchy_issues>0?"var(--color-yellow-500, #D97706)":"var(--color-green-500, #059669)",children:e.headings.hierarchy_issues}),t.jsx(A7,{children:"Pages with hierarchy issues"})]})}),t.jsx(at,{content:"Pages with no H1 tag at all. Every page should have exactly one H1 that clearly describes the page content.",placement:"top",onlyIfTruncated:!1,maxWidth:260,children:t.jsxs(I7,{children:[t.jsx(P7,{$c:e.headings.h1_missing>0?"var(--color-red-500, #DC2626)":"var(--color-green-500, #059669)",children:e.headings.h1_missing}),t.jsx(A7,{children:"Pages missing H1"})]})})]})]})]})}const N1=p.div.withConfig({displayName:"SiteAuditCategories__SideBySideRow",componentId:"sc-whae17-105"})` 13819 display: flex; gap: 1rem; align-items: flex-start; 13820 @media (max-width: 768px) { flex-direction: column; & > * { width: 100%; } } 13821`,Lmt=p.div.withConfig({displayName:"SiteAuditCategories__ChecklistGrid",componentId:"sc-whae17-106"})`display: flex; flex-direction: column; gap: 0;`,Bmt=p.div.withConfig({displayName:"SiteAuditCategories__CheckRow",componentId:"sc-whae17-107"})` 13822 display: flex; align-items: center; gap: 0.75rem; padding: 0.65rem 0.75rem; 13823 border-bottom: 1px solid ${$e}; 13824 &:last-child { border-bottom: none; } 13825`,Fmt=p.span.withConfig({displayName:"SiteAuditCategories__CheckIcon",componentId:"sc-whae17-108"})` 13826 width: 22px; height: 22px; border-radius: 50%; 13827 display: flex; align-items: center; justify-content: center; 13828 font-size: 0.7rem; font-weight: 700; flex-shrink: 0; 13829 background: ${e=>e.$pass?Ry:kn}; 13830 color: ${e=>e.$pass?Vt:Ut}; 13831`,Wmt=p.span.withConfig({displayName:"SiteAuditCategories__CheckLabel",componentId:"sc-whae17-109"})`flex: 1; font-size: 0.82rem; font-weight: 600; color: ${O};`,Umt=p.span.withConfig({displayName:"SiteAuditCategories__CheckCount",componentId:"sc-whae17-110"})` 13832 font-size: 0.72rem; font-weight: 600; color: ${e=>e.$pass?Vt:Ut}; 13833 white-space: nowrap; 13834`,Hmt=p.pre.withConfig({displayName:"SiteAuditCategories__HeaderCodeBlock",componentId:"sc-whae17-111"})` 13835 background: ${$e}; border-radius: 0.5rem; padding: 0.75rem 1rem; 13836 font-family: "SF Mono", "Fira Code", "Consolas", monospace; font-size: 0.78rem; 13837 color: ${O}; overflow-x: auto; margin: 0; line-height: 1.7; 13838 white-space: pre-wrap; word-break: break-word; 13839`,qmt=p.span.withConfig({displayName:"SiteAuditCategories__HeaderName",componentId:"sc-whae17-112"}
13839)`color: var(--color-brand-600, #4F46E5); font-weight: 700;`,Gmt=p.span.withConfig({displayName:"SiteAuditCategories__HeaderValue",componentId:"sc-whae17-113"})`color: ${O};`,Vmt=p.span.withConfig({displayName:"SiteAuditCategories__HeaderMissing",componentId:"sc-whae17-114"})`color: ${Ut}; font-style: italic; opacity: 0.7;`;function Kmt({sd:e}){const n=e.checklist.length>0;return t.jsxs(N1,{children:[t.jsxs(is,{style:{flex:1,minWidth:0},children:[t.jsxs("div",{style:{marginBottom:"0.75rem"},children:[t.jsx(ts,{children:"Security Overview"}),t.jsx(ns,{children:n?`Checklist of security headers and protocols across ${e.total_pages} page(s)`:"Run an audit to analyze security configuration"})]}),n?t.jsx(Lmt,{children:e.checklist.map(i=>t.jsxs(Bmt,{$pass:i.pass,children:[t.jsx(Fmt,{$pass:i.pass,children:i.pass?"â":"â"}),t.jsx(Wmt,{children:i.item}),t.jsxs(Umt,{$pass:i.pass,children:[i.pages_pass,"/",i.total," pages"]})]},i.item))}):t.jsx(Sd,{children:"No security data available yet."})]}),t.jsxs(is,{style:{flex:1,minWidth:0},children:[t.jsxs("div",{style:{marginBottom:"0.75rem"},children:[t.jsx(ts,{children:"HTTP Security Headers"}),t.jsx(ns,{children:n?"Header values detected across your pages":"Run an audit to inspect HTTP headers"})]}),e.headers.length===0?t.jsx(Sd,{children:"No header data available yet."}):t.jsx(Hmt,{children:e.headers.map(i=>t.jsxs("span",{children:[t.jsx(qmt,{children:i.header}),": ",i.sample_value?t.jsx(Gmt,{children:i.sample_value}):t.jsx(Vmt,{children:"not set"}),` 13840`]},i.header))})]})]})}const Nc=p.div.withConfig({displayName:"SiteAuditCategories__SignalRow",componentId:"sc-whae17-115"})` 13841 display: flex; align-items: center; gap: 10px; 13842 padding: 0.55rem 0; border-bottom: 1px solid ${$e}; 13843 &:last-child { border-bottom: none; } 13844`,zc=p.span.withConfig({displayName:"SiteAuditCategories__SignalIcon",componentId:"sc-whae17-116"})` 13845 width: 22px; height: 22px; border-radius: 6px; flex-shrink: 0; 13846 display: flex; align-items: center; justify-content: center; 13847 font-size: 0.7rem; font-weight: 900; 13848 background: ${e=>e.$pass?si:kn}; 13849 color: ${e=>e.$pass?Vt:Ut}; 13850`,Tc=p.span.withConfig({displayName:"SiteAuditCategories__SignalLabel",componentId:"sc-whae17-117"})`flex: 1; font-size: 0.82rem; font-weight: 700; color: ${O};`,Ec=p.span.withConfig({displayName:"SiteAuditCategories__SignalValue",componentId:"sc-whae17-118"})`font-size: 0.78rem; font-weight: 800; color: ${z}; white-space: nowrap;`,iD=p.div.withConfig({displayName:"SiteAuditCategories__StatGrid",componentId:"sc-whae17-119"})` 13851 display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; 13852 @media (min-width: 900px) { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); } 13853`,ll=p.div.withConfig({displayName:"SiteAuditCategories__StatBox",componentId:"sc-whae17-120"})` 13854 border: 1px solid ${V}; border-radius: 0.75rem; padding: 0.75rem; 13855 text-align: center; 13856`,cl=p.div.withConfig({displayName:"SiteAuditCategories__StatNumber",componentId:"sc-whae17-121"})` 13857 font-size: 1.6rem; font-weight: 950; color: ${e=>e.$c||O}; line-height: 1.1; 13858`,dl=p.div.withConfig({displayName:"SiteAuditCategories__StatLabel",componentId:"sc-whae17-122"})` 13859 margin-top: 4px; font-size: 0.68rem; font-weight: 700; color: ${z}; 13860 text-transform: uppercase; letter-spacing: 0.04em; 13861`;function Ymt({data:e}){const n=e&&e.total_pages>0?e:null;return t.jsxs(N1,{style:{alignItems:"stretch"},children:[t.jsxs(is,{style:{flex:1,minWidth:0},children:[t.jsxs("div",{style:{marginBottom:"0.75rem"},children:[t.jsx(ts,{children:"Content Metrics"}),t.jsx(ns,{children:n?"Averaged across audited pages":"Run an audit to see content metrics"})]}),n?t.jsxs(iD,{children:[t.jsx(at,{content:"Average number of words per page. Pages with 300+ words tend to perform better in AI-generated responses.",placement:"top",onlyIfTruncated:!1,maxWidth:260,children:t.jsxs(ll,{children:[t.jsx(cl,{children:n.avg_word_count}),t.jsx(dl,{children:"Avg Words"})]})}),t.jsx(at,{content:"Pages with fewer than 300 words. Thin content is less likely to be cited by AI engines and may hurt overall site quality.",placement:"top",onlyIfTruncated:!1,maxWidth:260,children:t.jsxs(ll,{children:[t.jsx(cl,{$c:n.thin_pages>0?Ut:Vt,children:n.thin_pages}),t.jsx(dl,{children:"Thin Pages"})]})}),n.avg_flesch_score!=null&&t.jsx(at,{content:"Flesch Reading Ease score (0â100). Higher is easier to read. Scores above 50 are generally accessible; AI models favor clear, well-structured prose.",placement:"top",onlyIfTruncated:!1,maxWidth:260,children:t.jsxs(ll,{children:[t.jsx(cl,{$c:n.avg_flesch_score>=50?Vt:n.avg_flesch_score>=30?"#D97706":Ut,children:n.avg_flesch_score}),t.jsx(dl,{children:"Readability"})]})}),n.avg_content_ratio!=null&&t.jsx(at,{content:"Ratio of visible text to total HTML code. Higher ratios (15%+) indicate content-rich pages with less bloat, which AI crawlers parse more efficiently.",placement:"top",onlyIfTruncated:!1,maxWidth:260,children:t.jsxs(ll,{children:[t.jsxs(cl,{$c:n.avg_content_ratio>=15?Vt:"#D97706",children:[n.avg_content_ratio,"%"]}),t.jsx(dl,{children:"Text Ratio"})]})})]}):t.jsx(Sd,{children:"No content data available yet."})]}),n&&t.jsxs(is,{style:{flex:1,minWidth:0},children:[t.jsxs("div",{style:{marginBottom:"0.5rem"},children:[t.jsx(ts,{children:"Content Signals"}),t.jsx(ns,{children:"Presence of key content quality indicators"})]}),t.jsxs("div",{children:[t.jsxs(Nc,{children:[t.jsx(zc,{$pass:n.signals.media.pct>=50,children:n.signals.media.pct>=50?"â":"â"}),t.jsx(Tc,{children:"Media (images/video)"}),t.jsxs(Ec,{children:[n.signals.media.pass,"/",n.total_pages," pages (",n.signals.media.pct,"%)"]})]}),t.jsxs(Nc,{children:[t.jsx(zc,{$pass:n.signals.author.pct>=50,children:n.signals.author.pct>=50?"â":"â"}),t.jsx(Tc,{children:"Author attribution"}),t.jsxs(Ec,{children:[n.signals.author.pass,"/",n.total_pages," pages (",n.signals.author.pct,"%)"]})]}),t.jsxs(Nc,{children:[t.jsx(zc,{$pass:n.signals.date.pct>=50,children:n.signals.date.pct>=50?"â":"â"}),t.jsx(Tc,{children:"Publication date"}),t.jsxs(Ec,{children:[n.signals.date.pass,"/",n.total_pages," pages (",n.signals.date.pct,"%)"]})]})]})]})]})}function Xmt({data:e}){const n=e&&e.total_pages>0?e:null;return t.jsxs(N1,{style:{alignItems:"stretch"},children:[t.jsxs(is,{style:{flex:1,minWidth:0},children:[t.jsxs("div",{style:{marginBottom:"0.75rem"},children:[t.jsx(ts,{children:"Heading Health"}),t.jsx(ns,{children:n?`H1 and heading hierarchy across ${n.total_pages} page(s)`:"Run an audit to analyze heading structure"})]}),n?t.jsxs(iD,{children:[t.jsxs(ll,{children:[t.jsxs(cl,{$c:n.headings.h1_pct>=80?Vt:n.headings.h1_pct>=50?"#D97706":Ut,children:[n.headings.h1_pct,"%"]}),t.jsx(dl,{children:"Have H1"})]}),t.jsxs(ll,{children:[t.jsx(cl,{$c:n.headings.h1_missing>0?Ut:Vt,children:n.headings.h1_missing}),t.jsx(dl,{children:"Missing H1"})]}),t.jsxs(ll,{children:[t.jsx(cl,{$c:n.headings.hierarchy_issues>0?"#D97706":Vt,children:n.headings.hierarchy_issues}),t.jsx(dl,{children:"Hierarchy Issues"})]})]}):t.jsx(Sd,{children:"No structure data available yet."})]}),n&&t.jsxs(is,{style:{flex:1,minWidth:0},children:[t.jsxs("div",{style:{marginBottom:"0.5rem"},children:[t.jsx(ts,{children:"Structure Signals"}),t.jsx(ns,{children:"Content formatting best practices"})]}),t.jsxs("div",{children:[t.jsxs(Nc,{children:[t.jsx(zc,{$pass:n.structure_signals.long_paragraphs.pct_pass>=80,children:n.structure_signals.long_paragraphs.pct_pass>=80?"â":"â"}),t.jsx(Tc,{children:"No wall-of-text paragraphs"}),t.jsxs(Ec,{children:[n.structure_signals.long_paragraphs.pct_pass,"% pass (",n.structure_signals.long_paragraphs.fail," flagged)"]})]}),t.jsxs(Nc,{children:[t.jsx(zc,{$pass:n.structure_signals.lists_used.pct_pass>=60,children:n.structure_signals.lists_used.pct_pass>=60?"â":"â"}),t.jsx(Tc,{children:"Lists used for scannable content"}),t.jsxs(Ec,{children:[n.structure_signals.lists_used.pct_pass,"% pass (",n.structure_signals.lists_used.fail," without)"]})]}),t.jsxs(Nc,{children:[t.jsx(zc,{$pass:n.structure_signals.table_of_contents.pct_pass>=60,children:n.structure_signals.table_of_contents.pct_pass>=60?"â":"â"}),t.jsx(Tc,{children:"Table of contents on long pages"}),t.jsxs(Ec,{children:[n.structure_signals.table_of_contents.pct_pass,"% pass (",n.structure_signals.table_of_contents.fail," missing)"]})]})]})]})]})}function Qmt({data:e}){const n=e&&e.total_pages>0?e:null,i=7,r=n?[n.signals.direct_answer.pct>=50,n.signals.faq_content_no_schema===0,n.signals.eeat_signals.pct>=50,(n.signals.concise_definition?.pct??0)>=50,(n.signals.summary_present?.pct??0)>=50,(n.signals.source_attribution?.pct??0)>=50,(n.signals.qa_patterns?.pct??0)>
13861=50].filter(Boolean).length:0,o=s=>s>=50?Vt:s>=25?"#D97706":Ut;return t.jsxs(N1,{style:{alignItems:"stretch"},children:[t.jsxs(is,{style:{flex:1,minWidth:0},children:[t.jsxs("div",{style:{marginBottom:"0.75rem"},children:[t.jsx(ts,{children:"AEO Overview"}),t.jsx(ns,{children:n?"How well your content is optimized for AI engines":"Run an audit to evaluate AEO readiness"})]}),n?t.jsxs(iD,{children:[t.jsx(at,{content:`Number of AEO checks passing out of ${i} total. Aim for ${i}/${i}.`,placement:"top",onlyIfTruncated:!1,maxWidth:260,children:t.jsxs(ll,{children:[t.jsxs(cl,{$c:r>=6?Vt:r>=4?"#D97706":Ut,children:[r,"/",i]}),t.jsx(dl,{children:"Checks Passing"})]})}),t.jsx(at,{content:"Percentage of pages that provide a concise answer within the first paragraph after the H1 heading â the format AI models prefer to cite.",placement:"top",onlyIfTruncated:!1,maxWidth:260,children:t.jsxs(ll,{children:[t.jsxs(cl,{$c:o(n.signals.direct_answer.pct),children:[n.signals.direct_answer.pct,"%"]}),t.jsx(dl,{children:"Direct Answers"})]})}),t.jsx(at,{content:"Percentage of pages where the opening paragraph is 20â60 words â a concise, citable definition AI models can quote directly.",placement:"top",onlyIfTruncated:!1,maxWidth:260,children:t.jsxs(ll,{children:[t.jsxs(cl,{$c:o(n.signals.concise_definition?.pct??0),children:[n.signals.concise_definition?.pct??0,"%"]}),t.jsx(dl,{children:"Concise Definitions"})]})}),t.jsx(at,{content:"Percentage of pages with E-E-A-T signals (author, credentials, dates, sources). These trust signals increase the likelihood of AI citation.",placement:"top",onlyIfTruncated:!1,maxWidth:260,children:t.jsxs(ll,{children:[t.jsxs(cl,{$c:o(n.signals.eeat_signals.pct),children:[n.signals.eeat_signals.pct,"%"]}),t.jsx(dl,{children:"E-E-A-T Coverage"})]})}),t.jsx(at,{content:"Percentage of long-form pages with inline citations, a references section, or <cite>/<blockquote> elements. Source-backed content is more likely to be cited by AI.",placement:"top",onlyIfTruncated:!1,maxWidth:260,children:t.jsxs(ll,{children:[t.jsxs(cl,{$c:o(n.signals.source_attribution?.pct??0),children:[n.signals.source_attribution?.pct??0,"%"]}),t.jsx(dl,{children:"Source Citations"})]})}),t.jsx(at,{content:"Percentage of long-form pages with a summary, key takeaways, or TL;DR section. AI engines often pull from clearly labelled summary blocks.",placement:"top",onlyIfTruncated:!1,maxWidth:260,children:t.jsxs(ll,{children:[t.jsxs(cl,{$c:o(n.signals.summary_present?.pct??0),children:[n.signals.summary_present?.pct??0,"%"]}),t.jsx(dl,{children:"Summaries"})]})}),t.jsx(at,{content:"Pages with FAQ-style content that have matching FAQPage schema markup, helping AI models surface your answers directly.",placement:"top",onlyIfTruncated:!1,maxWidth:260,children:t.jsxs(ll,{children:[t.jsx(cl,{$c:n.signals.faq_content_no_schema===0?Vt:Ut,children:n.signals.faq_schema.pass}),t.jsx(dl,{children:"FAQ Schema"})]})}),t.jsx(at,{content:"Percentage of pages with question headings followed by substantive answers (15+ words). Well-structured Q&A patterns are highly extractable by AI.",placement:"top",onlyIfTruncated:!1,maxWidth:260,children:t.jsxs(ll,{children:[t.jsxs(cl,{$c:o(n.signals.qa_patterns?.pct??0),children:[n.signals.qa_patterns?.pct??0,"%"]}),t.jsx(dl,{children:"Q&A Patterns"})]})})]}):t.jsx(Sd,{children:"No AEO data available yet."})]}),n&&t.jsxs(is,{style:{flex:1,minWidth:0},children:[t.jsxs("div",{style:{marginBottom:"0.75rem"},children:[t.jsx(ts,{children:"AEO Signals"}),t.jsxs(ns,{children:["AI answer eligibility signals across ",n.total_pages," page(s)"]})]}),t.jsxs("div",{children:[t.jsxs(Nc,{children:[t.jsx(zc,{$pass:n.signals.direct_answer.pct>=50,children:n.signals.direct_answer.pct>=50?"â":"â"}),t.jsx(Tc,{children:"Direct answer after H1"}),t.jsxs(Ec,{children:[n.signals.direct_answer.pass,"/",n.total_pages," pages (",n.signals.direct_answer.pct,"%)"]})]}),t.jsxs(Nc,{children:[t.jsx(zc,{$pass:(n.signals.concise_definition?.pct??0)>=50,children:(n.signals.concise_definition?.pct??0)>=50?"â":"â"}),t.jsx(Tc,{children:"Concise definition paragraph (20â60 words)"}),t.jsxs(Ec,{children:[n.signals.concise_definition?.pass??0,"/",n.total_pages," pages (",n.signals.concise_definition?.pct??0,"%)"]})]}),t.jsxs(Nc,{children:[t.jsx(zc,{$pass:n.signals.faq_content_no_schema===0,children:n.signals.faq_content_no_schema===0?"â":"â"}),t.jsx(Tc,{children:"FAQ content has matching schema"}),t.jsx(Ec,{children:n.signals.faq_content_no_schema>0?`${n.signals.faq_content_no_schema} page(s) missing schema`:n.signals.faq_schema.pass>0?`${n.signals.faq_schema.pass} with FAQPage`:"No FAQ content detected"})]}),t.jsxs(Nc,{children:[t.jsx(zc,{$pass:n.signals.eeat_signals.pct>=50,children:n.signals.eeat_signals.pct>=50?"â":"â"}),t.jsx(Tc,{children:"E-E-A-T signals present"}),t.jsxs(Ec,{children:[n.signals.eeat_signals.pass,"/",n.total_pages," pages (",n.signals.eeat_signals.pct,"%)"]})]}),t.jsxs(Nc,{children:[t.jsx(zc,{$pass:(n.signals.source_attribution?.pct??0)>=50,children:(n.signals.source_attribution?.pct??0)>=50?"â":"â"}),t.jsx(Tc,{children:"Source citations & references"}),t.jsxs(Ec,{children:[n.signals.source_attribution?.pass??0,"/",n.total_pages," pages (",n.signals.source_attribution?.pct??0,"%)"]})]}),t.jsxs(Nc,{children:[t.jsx(zc,{$pass:(n.signals.summary_present?.pct??0)>=50,children:(n.signals.summary_present?.pct??0)>=50?"â":"â"}),t.jsx(Tc,{children:"Summary / key takeaways section"}),t.jsxs(Ec,{children:[n.signals.summary_present?.pass??0,"/",n.total_pages," pages (",n.signals.summary_present?.pct??0,"%)"]})]}),t.jsxs(Nc,{children:[t.jsx(zc,{$pass:(n.signals.qa_patterns?.pct??0)>=50,children:(n.signals.qa_patterns?.pct??0)>=50?"â":"â"}),t.jsx(Tc,{children:"Q&A content with substantive answers"}),t.jsxs(Ec,{children:[n.signals.qa_patterns?.pass??0,"/",n.total_pages," pages (",n.signals.qa_patterns?.pct??0,"%)"]})]})]})]})]})}function T5({size:e=16,stroke:n="currentColor"}){return t.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"none",style:{animation:"spin 0.7s linear infinite",flexShrink:0},children:[t.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:n,strokeWidth:"3",strokeDasharray:"31.4 31.4",strokeLinecap:"round"}),t.jsx("style",{children:"@keyframes spin { to { transform: rotate(360deg) } }"})]})}const N7=p.div.withConfig({displayName:"SiteAuditCompetitors__Wrap",componentId:"sc-10qwq76-0"})` 13862 display: flex; 13863 flex-direction: column; 13864 gap: 1.25rem; 13865`,Zmt=p.div.withConfig({displayName:"SiteAuditCompetitors__Header",componentId:"sc-10qwq76-1"})` 13866 display: flex; 13867 align-items: center; 13868 justify-content: space-between; 13869 gap: 1rem; 13870 flex-wrap: wrap; 13871`,Jmt=p.h3.withConfig({displayName:"SiteAuditCompetitors__HeaderTitle",componentId:"sc-10qwq76-2"})` 13872 font-size: 1rem; 13873 font-weight: 800; 13874 color: ${O}; 13875 margin: 0; 13876`,eht=p.p.withConfig({displayName:"SiteAuditCompetitors__HeaderSub",componentId:"sc-10qwq76-3"})` 13877 font-size: 0.8rem; 13878 color: ${z}; 13879 margin: 0.15rem 0 0; 13880`,tht=p.div.withConfig({displayName:"SiteAuditCompetitors__TableScroll",componentId:"sc-10qwq76-4"})` 13881 overflow: auto; 13882 -webkit-overflow-scrolling: touch; 13883 border: 1px solid ${V}; 13884 border-radius: 0.75rem; 13885 background: ${Z}; 13886 max-height: 340px; 13887`,nht=p.table.withConfig({displayName:"SiteAuditCompetitors__Table",componentId:"sc-10qwq76-5"})` 13888 width: 100%; 13889 border-collapse: collapse; 13890 min-width: 720px; 13891`,vx=p.th.withConfig({displayName:"SiteAuditCompetitors__Th",componentId:"sc-10qwq76-6"})` 13892 padding: 0.6rem 0.75rem; 13893 text-align: left; 13894 font-size: 0.72rem; 13895 font-weight: 700; 13896 text-transform: uppercase; 13897 letter-spacing: 0.04em; 13898 color: ${z}; 13899 background: ${$e}; 13900 white-space: nowrap; 13901 position: sticky; 13902 top: 0; 13903 z-index: 2; 13904 ${e=>e.$w?`width: ${e.$w};`:""} 13905 13906 &:first-child { border-top-left-radius: 0.75rem; } 13907 &:last-child { border-top-right-radius: 0.75rem; } 13908`,yd=p.td.withConfig({displayName:"SiteAuditCompetitors__Td",componentId:"sc-10qwq76-7"})` 13909 padding: 0.65rem 0.75rem; 13910 font-size: 0.825rem; 13911 color: ${O}; 13912 border-top: 1px solid ${V}; 13913 vertical-align: middle; 13914 ${e=>e.$bold?"font-weight: 700;":""} 13915`,iht=p.tr.withConfig({displayName:"SiteAuditCompetitors__AuditingRow",componentId:"sc-10qwq76-8"})` 13916 @keyframes rowPulse { 13917 0%, 100% { opacity: 1; } 13918 50% { opacity: 0.55; } 13919 } 13920 animation: rowPulse 1.8s ease-in-out infinite; 13921 pointer-events: none; 13922`,du=p.span.withConfig({displayName:"SiteAuditCompetitors__ScoreBadge",componentId:"sc-10qwq76-9"})` 13923 display: inline-flex; 13924 align-items: center; 13925 justify-content: center; 13926 min-width: 2.5rem; 13927 padding: 0.2rem 0.5rem; 13928 border-radius: 999px; 13929 font-size: 0.78rem; 13930 font-weight: 800; 13931 color: ${Z}; 13932 background: ${e=>e.$c}; 13933`,vX=p.div.withConfig({displayName:"SiteAuditCompetitors__NameCell",componentId:"sc-10qwq76-10"})` 13934 display: flex; 13935 align-items: center; 13936 gap: 0.5rem; 13937`,rht=p.span.withConfig({displayName:"SiteAuditCompetitors__OwnBadge",componentId:"sc-10qwq76-11"})` 13938 display: inline-flex; 13939 align-items: center; 13940 gap: 0.25rem; 13941 padding: 0.1rem 0.45rem; 13942 border-radius: 999px; 13943 font-size: 0.65rem; 13944 font-weight: 800; 13945 color: ${ot}; 13946 background: rgba(99,102,241,0.08); 13947 border: 1px solid rgba(99,102,241,0.2); 13948 text-transform: uppercase; 13949 letter-spacing: 0.04em;
13950`,wX=p.div.withConfig({displayName:"SiteAuditCompetitors__EmptyWrap",componentId:"sc-10qwq76-12"})` 13951 padding: 3rem 1rem; 13952 text-align: center; 13953 color: ${z}; 13954 font-size: 0.875rem; 13955`,oht=p.div.withConfig({displayName:"SiteAuditCompetitors__IssueRow",componentId:"sc-10qwq76-13"})` 13956 display: flex; 13957 align-items: flex-start; 13958 gap: 0.5rem; 13959 padding: 0.5rem 0; 13960 border-bottom: 1px solid ${$e}; 13961 13962 &:last-child { border-bottom: none; } 13963`,sht=p.span.withConfig({displayName:"SiteAuditCompetitors__IssueSev",componentId:"sc-10qwq76-14"})` 13964 flex-shrink: 0; 13965 width: 6px; 13966 height: 6px; 13967 border-radius: 50%; 13968 margin-top: 0.4rem; 13969 background: ${e=>e.$s==="high"?Ut:e.$s==="medium"?"#F97316":"#EAB308"}; 13970`,aht=p.span.withConfig({displayName:"SiteAuditCompetitors__IssueMsg",componentId:"sc-10qwq76-15"})` 13971 font-size: 0.78rem; 13972 color: ${O}; 13973 line-height: 1.4; 13974`,lht=p.span.withConfig({displayName:"SiteAuditCompetitors__IssueCnt",componentId:"sc-10qwq76-16"})` 13975 flex-shrink: 0; 13976 font-size: 0.7rem; 13977 font-weight: 700; 13978 color: ${z}; 13979 margin-left: auto; 13980 white-space: nowrap; 13981`,jX=p.div.withConfig({displayName:"SiteAuditCompetitors__DetailCard",componentId:"sc-10qwq76-17"})` 13982 border: 1px solid ${V}; 13983 border-radius: 0.75rem; 13984 background: ${Z}; 13985 padding: 1rem; 13986`,_X=p.h4.withConfig({displayName:"SiteAuditCompetitors__DetailTitle",componentId:"sc-10qwq76-18"})` 13987 font-size: 0.9rem; 13988 font-weight: 800; 13989 color: ${O}; 13990 margin: 0 0 0.75rem; 13991`,cht=p.div.withConfig({displayName:"SiteAuditCompetitors__BarChartWrap",componentId:"sc-10qwq76-19"})` 13992 display: flex; 13993 flex-direction: column; 13994 gap: 10px; 13995 padding: 0.25rem 0; 13996`,dht=p.div.withConfig({displayName:"SiteAuditCompetitors__BarRow",componentId:"sc-10qwq76-20"})` 13997 display: flex; 13998 align-items: center; 13999 gap: 8px; 14000`,uht=p.span.withConfig({displayName:"SiteAuditCompetitors__BarLabel",componentId:"sc-10qwq76-21"})` 14001 flex-shrink: 0; 14002 width: 100px; 14003 font-size: 0.72rem; 14004 font-weight: 700; 14005 color: ${z}; 14006 text-align: right; 14007`,pht=p.div.withConfig({displayName:"SiteAuditCompetitors__BarTrack",componentId:"sc-10qwq76-22"})` 14008 flex: 1; 14009 display: flex; 14010 flex-direction: column; 14011 gap: 3px; 14012`,CX=p.div.withConfig({displayName:"SiteAuditCompetitors__BarFillOuter",componentId:"sc-10qwq76-23"})` 14013 height: 10px; 14014 border-radius: 3px; 14015 background: ${$e}; 14016 position: relative; 14017 overflow: hidden; 14018`,SX=p.div.withConfig({displayName:"SiteAuditCompetitors__BarFill",componentId:"sc-10qwq76-24"})` 14019 position: absolute; 14020 left: 0; top: 0; bottom: 0; 14021 width: ${e=>e.$w}%; 14022 background: ${e=>e.$color}; 14023 border-radius: 3px; 14024 transition: width 0.3s ease; 14025`,kX=p.span.withConfig({displayName:"SiteAuditCompetitors__BarScore",componentId:"sc-10qwq76-25"})` 14026 flex-shrink: 0; 14027 width: 28px; 14028 font-size: 0.7rem; 14029 font-weight: 800; 14030 color: ${e=>e.$color}; 14031 text-align: right; 14032`,lue=p.div.withConfig({displayName:"SiteAuditCompetitors__LegendRow",componentId:"sc-10qwq76-26"})` 14033 display: flex; 14034 align-items: center; 14035 gap: 1.25rem; 14036 justify-content: center; 14037 margin-top: 0.35rem; 14038 flex-wrap: wrap; 14039`,nP=p.span.withConfig({displayName:"SiteAuditCompetitors__LegendItem",componentId:"sc-10qwq76-27"})` 14040 display: inline-flex; 14041 align-items: center; 14042 gap: 0.35rem; 14043 font-size: 0.72rem; 14044 font-weight: 700; 14045 color: ${O}; 14046`,iP=p.span.withConfig({displayName:"SiteAuditCompetitors__LegendDot",componentId:"sc-10qwq76-28"})` 14047 width: 10px; height: 4px; 14048 border-radius: 2px; 14049 background: ${e=>e.$c}; 14050`,mht=p.div.withConfig({displayName:"SiteAuditCompetitors__DetailGrid",componentId:"sc-10qwq76-29"})` 14051 display: grid; 14052 grid-template-columns: 1fr; 14053 gap: 1rem; 14054 14055 @media (min-width: 768px) { 14056 grid-template-columns: 1fr 1fr; 14057 } 14058`,hht=p.div.withConfig({displayName:"SiteAuditCompetitors__CompareSec",componentId:"sc-10qwq76-30"})` 14059 border: 1px solid ${V}; 14060 border-radius: 0.75rem; 14061 background: ${Z}; 14062 overflow: hidden; 14063`,fht=p.div.withConfig({displayName:"SiteAuditCompetitors__CompareSecHeader",componentId:"sc-10qwq76-31"})` 14064 padding: 0.85rem 1rem; 14065 border-bottom: 1px solid ${V}; 14066 background: ${cn}; 14067 display: flex; 14068 align-items: flex-start; 14069 gap: 0.6rem; 14070`,ght=p.h3.withConfig({displayName:"SiteAuditCompetitors__CompareSecTitle",componentId:"sc-10qwq76-32"})` 14071 font-size: 0.9rem; 14072 font-weight: 800; 14073 color: ${O}; 14074 margin: 0; 14075`,yht=p.p.withConfig({displayName:"SiteAuditCompetitors__CompareSecSub",componentId:"sc-10qwq76-33"})` 14076 font-size: 0.78rem; 14077 color: ${z}; 14078 margin: 0.1rem 0 0;
14079`,xht=p.div.withConfig({displayName:"SiteAuditCompetitors__CompareForm",componentId:"sc-10qwq76-34"})` 14080 padding: 0.9rem 1rem; 14081 display: grid; 14082 grid-template-columns: 1fr 1fr auto; 14083 grid-template-rows: auto auto auto; 14084 column-gap: 0.65rem; 14085 row-gap: 0.3rem; 14086 border-bottom: 1px solid ${V}; 14087 14088 /* On mobile: single column, re-order items into logical groups: 14089 your label â your input â your error â comp label â comp input â comp error â button */ 14090 @media (max-width: 600px) { 14091 grid-template-columns: 1fr; 14092 grid-template-rows: repeat(7, auto); 14093 14094 > *:nth-child(1) { grid-row: 1; } /* Your URL label */ 14095 > *:nth-child(2) { grid-row: 4; } /* Competitor URL label */ 14096 > *:nth-child(3) { display: none; } /* col-3 placeholder */ 14097 > *:nth-child(4) { grid-row: 2; } /* Your URL input */ 14098 > *:nth-child(5) { grid-row: 5; } /* Competitor URL input */ 14099 > *:nth-child(6) { grid-row: 7; width: 100%; justify-content: center; } /* Button */ 14100 > *:nth-child(7) { grid-row: 3; } /* Your URL error */ 14101 > *:nth-child(8) { grid-row: 6; } /* Competitor URL error */ 14102 > *:nth-child(9) { display: none; } /* col-3 placeholder */ 14103 } 14104`,$X=p.label.withConfig({displayName:"SiteAuditCompetitors__CompareLabel",componentId:"sc-10qwq76-35"})` 14105 font-size: 0.7rem; 14106 font-weight: 700; 14107 color: ${z}; 14108 text-transform: uppercase; 14109 letter-spacing: 0.04em; 14110`,IX=p.input.withConfig({displayName:"SiteAuditCompetitors__CompareInput",componentId:"sc-10qwq76-36"})` 14111 padding: 0.44rem 0.65rem; 14112 border: 1px solid ${e=>e.$invalid?sr:Rt}; 14113 border-radius: 0.5rem; 14114 font-size: 0.825rem; 14115 color: ${O}; 14116 background: ${Z}; 14117 outline: none; 14118 width: 100%; 14119 box-sizing: border-box; 14120 14121 &::placeholder { color: ${Pe}; } 14122 &:focus { border-color: ${e=>e.$invalid?sr:ot}; } 14123`,PX=p.span.withConfig({displayName:"SiteAuditCompetitors__CompareFieldError",componentId:"sc-10qwq76-37"})` 14124 display: block; 14125 font-size: 0.7rem; 14126 line-height: 1.4; 14127 min-height: 1em; 14128 color: ${sr}; 14129 margin-top: 0.15rem; 14130`,bht=p.div.withConfig({displayName:"SiteAuditCompetitors__CompareErrorMsg",componentId:"sc-10qwq76-38"})` 14131 padding: 0.55rem 1rem; 14132 font-size: 0.8rem; 14133 color: ${sr}; 14134 border-bottom: 1px solid ${V}; 14135`,vht=p.div.withConfig({displayName:"SiteAuditCompetitors__CompareResultList",componentId:"sc-10qwq76-39"})``,AX=p.div.withConfig({displayName:"SiteAuditCompetitors__CompareResultItem",componentId:"sc-10qwq76-40"})` 14136 padding: 1rem; 14137 border-top: 1px solid ${V}; 14138`,wht=p.span.withConfig({displayName:"SiteAuditCompetitors__CompareResultTs",componentId:"sc-10qwq76-41"})` 14139 font-size: 0.7rem; 14140 color: ${Pe}; 14141 flex-shrink: 0; 14142 14143 @media (max-width: 600px) { 14144 display: none; 14145 } 14146`,jht=p.div.withConfig({displayName:"SiteAuditCompetitors__CompareColumns",componentId:"sc-10qwq76-42"})` 14147 display: grid; 14148 grid-template-columns: 1fr 1fr; 14149 gap: 0.75rem; 14150 14151 @media (max-width: 600px) { 14152 grid-template-columns: 1fr; 14153 } 14154`,NX=p.div.withConfig({displayName:"SiteAuditCompetitors__CompareCol",componentId:"sc-10qwq76-43"})` 14155 border: 1px solid ${V}; 14156 border-radius: 0.5rem; 14157 overflow: hidden; 14158`,zX=p.div.withConfig({displayName:"SiteAuditCompetitors__CompareColHeader",componentId:"sc-10qwq76-44"})` 14159 padding: 0.45rem 0.6rem; 14160 background: ${e=>e.$side==="yours"?cn:kn}; 14161 border-bottom: 1px solid ${V}; 14162 display: flex; 14163 align-items: center; 14164 gap: 0.4rem; 14165 min-width: 0; 14166`,k$=p.span.withConfig({displayName:"SiteAuditCompetitors__CompareColLabel",componentId:"sc-10qwq76-45"})` 14167 flex-shrink: 0; 14168 font-size: 0.65rem; 14169 font-weight: 800; 14170 text-transform: uppercase; 14171 letter-spacing: 0.05em; 14172 color: ${e=>e.$side==="yours"?ot:Ut}; 14173`,TX=p.span.withConfig({displayName:"SiteAuditCompetitors__CompareColUrl",componentId:"sc-10qwq76-46"})` 14174 font-size: 0.7rem; 14175 color: ${z}; 14176 overflow: hidden; 14177 text-overflow: ellipsis; 14178 white-space: nowrap; 14179 min-width: 0; 14180`,EX=p.div.withConfig({displayName:"SiteAuditCompetitors__CompareColBody",componentId:"sc-10qwq76-47"})` 14181 padding: 0.7rem 0.65rem; 14182`,z7=p.div.withConfig({displayName:"SiteAuditCompetitors__CompareScoreRow",componentId:"sc-10qwq76-48"})` 14183 display: flex; 14184 align-items: center; 14185 gap: 0.5rem; 14186 margin-bottom: 0.4rem; 14187`,T7=p.span.withConfig({displayName:"SiteAuditCompetitors__CompareScoreLabel",componentId:"sc-10qwq76-49"})` 14188 font-size: 0.7rem; 14189 font-weight: 700; 14190 color: ${z}; 14191 text-transform: uppercase; 14192 letter-spacing: 0.04em; 14193 min-width: 62px; 14194`,_ht=p.div.withConfig({displayName:"SiteAuditCompetitors__RunningOverlay",componentId:"sc-10qwq76-50"})` 14195 padding: 1.5rem; 14196 text-align: center; 14197 color: ${z}; 14198 font-size: 0.825rem; 14199 display: flex; 14200 align-items: center; 14201 justify-content: center; 14202 gap: 0.5rem; 14203`,E7=p.div.withConfig({displayName:"SiteAuditCompetitors__ColFailedMsg",componentId:"sc-10qwq76-51"})` 14204 padding: 0.5rem 0.65rem; 14205 font-size: 0.78rem; 14206 color: ${sr}; 14207`,Cht=p.div.withConfig({displayName:"SiteAuditCompetitors__FindingsList",componentId:"sc-10qwq76-52"})` 14208 margin-top: 0.6rem; 14209`,Sht=p.div.withConfig({displayName:"SiteAuditCompetitors__FindingItem",componentId:"sc-10qwq76-53"})` 14210 display: flex; 14211 align-items: flex-start; 14212 gap: 0.4rem; 14213 padding: 0.3rem 0; 14214 border-bottom: 1px solid ${$e}; 14215 &:last-child { border-bottom: none; } 14216`,kht=p.span.withConfig({displayName:"SiteAuditCompetitors__FindingDot",componentId:"sc-10qwq76-54"})` 14217 flex-shrink: 0; 14218 width: 5px; 14219 height: 5px; 14220 border-radius: 50%; 14221 margin-top: 0.35rem; 14222 background: ${e=>e.$s==="high"?Ut:e.$s==="medium"?"#F97316":"#EAB308"}; 14223`,$ht=p.span.withConfig({displayName:"SiteAuditCompetitors__FindingText",componentId:"sc-10qwq76-55"})` 14224 font-size: 0.72rem; 14225 color: ${O}; 14226 line-height: 1.4; 14227`,Iht=p.button.withConfig({displayName:"SiteAuditCompetitors__CompareRowSummary",componentId:"sc-10qwq76-56"})` 14228 width: 100%; 14229 display: flex; 14230 align-items: center; 14231 gap: 0.75rem; 14232 padding: 0.75rem 1rem; 14233 background: none; 14234 border: none; 14235 cursor: pointer; 14236 text-align: left; 14237 border-top: 1px solid ${V}; 14238 14239 &:hover { background: ${$e}; } 14240`,MX=p.div.withConfig({displayName:"SiteAuditCompetitors__CompareRowSide",componentId:"sc-10qwq76-57"})` 14241 flex: 1; 14242 min-width: 0; 14243 display: flex; 14244 align-items: center; 14245 gap: 0.5rem; 14246`,RX=p.span.withConfig({displayName:"SiteAuditCompetitors__CompareRowUrl",componentId:"sc-10qwq76-58"})` 14247 font-size: 0.78rem; 14248 color: ${O}; 14249 font-weight: 600; 14250 overflow: hidden; 14251 text-overflow: ellipsis; 14252 white-space: nowrap; 14253 min-width: 0; 14254 flex: 1; 14255`,Pht=p.span.withConfig({displayName:"SiteAuditCompetitors__CompareRowVs",componentId:"sc-10qwq76-59"})` 14256 flex-shrink: 0; 14257 font-size: 0.68rem; 14258 font-weight: 800; 14259 color: ${Pe}; 14260 text-transform: uppercase; 14261 letter-spacing: 0.06em; 14262 padding: 0 0.25rem; 14263`,OX=p.span.withConfig({displayName:"SiteAuditCompetitors__CompareRowLabel",componentId:"sc-10qwq76-60"})` 14264 flex-shrink: 0; 14265 14266 @media (max-width: 600px) { 14267 display: none; 14268 } 14269`,Aht=p.span.withConfig({displayName:"SiteAuditCompetitors__CompareChevron",componentId:"sc-10qwq76-61"})` 14270 flex-shrink: 0; 14271 color: ${Pe}; 14272 transition: transform 0.15s ease; 14273 transform: rotate(${e=>
14273e.$open?"180deg":"0deg"}); 14274 display: flex; 14275 align-items: center; 14276`;function Nht({workspaceId:e,projectId:n,canManage:i,refreshTick:r=0}){const o=Uo(),s=k1(),a=l.useRef([]),[c,u]=l.useState(!0),[m,h]=l.useState(null),[g,x]=l.useState(null),[y,w]=l.useState(new Map),[j,v]=l.useState(null),[_,$]=l.useState(null),[k,P]=l.useState([]),[S,I]=l.useState(new Set),[A,E]=l.useState(""),[B,T]=l.useState(""),[M,R]=l.useState(!1),[F,Y]=l.useState(!1),[H,U]=l.useState(!1),[X,Q]=l.useState(null),[K,G]=l.useState(5),L=l.useRef(null),q=ce=>I(ie=>{const Re=new Set(ie);return Re.has(ce)?Re.delete(ce):Re.add(ce),Re});l.useEffect(()=>()=>{a.current.forEach(clearTimeout)},[]);const W=l.useCallback(async ce=>{if(!(!e||!n)){u(!0),h(null);try{const ie=await ue(`/api/v1/organizations/${e}/projects/${n}/site_audit_pages/competitor_comparison`,{signal:ce});if(ce?.aborted)return;const Re=await ie.json().catch(()=>({}));if(!ie.ok)throw new Error(Re?.error||"Failed to load");const Be=Re;x(Be),w(tt=>{if(tt.size===0)return tt;const dt=Be.competitors||[],je=new Map(tt);for(const[Me,Se]of tt){const it=dt.find(te=>te.id===Me);if(!it){je.delete(Me);continue}it.audit_status!=="running"&&(it.audit_status==="failed"||it.audited_at&&it.audited_at!==Se)&&(je.delete(Me),it.audit_status==="failed"&&o.showToast(`Audit for "${it.name}" failed${it.audit_error?`: ${it.audit_error}`:". Please try again."}`,{tone:"error",durationMs:6e3}))}return je})}catch(ie){if(ce?.aborted)return;h(ie?.message||"Failed to load competitor data")}finally{ce?.aborted||u(!1)}}},[e,n]);l.useEffect(()=>{const ce=new AbortController;return W(ce.signal),()=>{ce.abort()}},[W,r]);const oe=l.useCallback(async ce=>{$(null);const ie=(g?.competitors||[]).find(Re=>Re.id===ce)?.audited_at??null;w(Re=>new Map(Re).set(ce,ie));try{const Re=await ue(`/api/v1/organizations/${e}/projects/${n}/site_audit_pages/competitor_audit`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project_competitor_id:ce})}),Be=await Re.json().catch(()=>({}));if(!Re.ok){if(w(tt=>{const dt=new Map(tt);return dt.delete(ce),dt}),!s.handleApiError({message:Be?.error,status:Re.status},Be))throw new Error(Be?.error||"Audit failed");return}Fo(),o.showToast("Competitor audit started â results will appear shortly.",{tone:"success"}),a.current.forEach(clearTimeout),a.current=[setTimeout(()=>W(),15e3),setTimeout(()=>W(),4e4),setTimeout(()=>W(),7e4)]}catch(Re){w(Be=>{const tt=new Map(Be);return tt.delete(ce),tt}),o.showToast(Re?.message||"Failed to start audit",{tone:"error"})}},[e,n,g,W,o,s]),se=l.useCallback(async()=>{if(!(!e||!n))try{const ce=await ue(`/api/v1/organizations/${e}/projects/${n}/site_audit_pages/page_comparisons`),ie=await ce.json().catch(()=>({}));if(!ce.ok)return;P(ie.comparisons||[]),G(ie.credit_cost??5)}catch{}},[e,n]);l.useEffect(()=>{se()},[se,r]),l.useEffect(()=>{if(!L.current)return;const ce=k.find(ie=>ie.id===L.current);ce&&ce.status!=="running"&&(U(!1),I(ie=>new Set([...ie,ce.id])),L.current=null,a.current.forEach(clearTimeout),a.current=[])},[k]);const de=ce=>{const ie=ce.trim();if(!ie)return!1;const Re=ie.startsWith("http://")||ie.startsWith("https://")?ie:`https://${ie}`;try{const Be=new URL(Re);return(Be.protocol==="http:"||Be.protocol==="https:")&&Be.hostname.includes(".")}catch{return!1}},le=M&&!de(A)?"Enter a valid URL (e.g. https://yoursite.com/page)":null,me=F&&!de(B)?"Enter a valid URL (e.g. https://competitor.com/page)":null,ee=l.useCallback(async()=>{const ce=A.trim(),ie=B.trim();if(R(!0),Y(!0),!ce||!ie||H)return;const Re=ce.startsWith("http")?ce:`https://${ce}`,Be=ie.startsWith("http")?ie:`https://${ie}`,tt=(()=>{try{return new URL(Re).hostname.includes(".")}catch{return!1}})(),dt=(()=>{try{return new URL(Be).hostname.includes(".")}catch{return!1}})();if(!(!tt||!dt)){U(!0),Q(null);try{const je=await ue(`/api/v1/organizations/${e}/projects/${n}/site_audit_pages/page_comparisons`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({your_url:ce,competitor_url:ie})}),Me=await je.json().catch(()=>({}));if(!je.ok){if(!s.handleApiError({message:Me?.error,status:je.status},Me))throw new Error(Me?.error||"Failed to start comparison");U(!1);return}Fo(),o.showToast("Page comparison started â results will appear in ~30 seconds.",{tone:"success"});const Se=Me.comparison_id;L.current=Se,I(ge=>new Set([...ge,Se])),await se();let it=0;const De=15,te=()=>{if(it>=De){U(!1),L.current=null;return}it++;const ge=setTimeout(async()=>{try{const Ee=await(await ue(`/api/v1/organizations/${e}/projects/${n}/site_audit_pages/page_comparisons`)).json().catch(()=>({})),Xe=Ee.comparisons||[];P(Xe),G(Ee.credit_cost??5);const yt=Xe.find(Ne=>Ne.id===Se);!yt||yt.status!=="running"?(U(!1),L.current=null):te()}catch{U(!1),L.current=null}},12e3);a.current.push(ge)};te()}catch(je){Q(je?.message||"Failed to start comparison"),U(!1)}}},[A,B,H,e,n,se,s,o]),ne=g?.your_site,Ae=g?.competitors||[],_e=g?.credit_cost??15,we=l.useMemo(()=>j==null?null:Ae.find(ce=>ce.id===j)||null,[j,Ae]);if(c)return t.jsxs(N7,{children:[t.jsx(nt,{width:"100%",height:48,radius:10}),t.jsx(nt,{width:"100%",height:280,radius:10})]});if(m)return t.jsxs(wX,{style:{color:Ut},children:[m,t.jsx("div",{style:{marginTop:12},children:t.jsx(he,{size:"sm",variant:"outline",onClick:()=>W(),children:"Retry"})})]});if(Ae.length===0)return t.jsx(N7,{children:t.jsxs(wX,{children:["No direct competitors tracked yet."," ",t.jsx(Dn,{to:`/workspaces
14276/${e}/projects/${n}/settings/competitors`,style:{color:Ft,fontWeight:700,textDecoration:"none"},children:"Manage competitors â"})]})});const Ke=[...ne?[{type:"own",data:ne}]:[],...Ae.map(ce=>({type:"comp",data:ce}))];return t.jsxs(N7,{children:[t.jsx(l1,{isOpen:s.isOpen,onClose:s.closeOverlay,title:s.overlayState?.title,message:s.overlayState?.message,limitName:s.overlayState?.limitName,limit:s.overlayState?.limit,used:s.overlayState?.used,isOwner:!1,workspaceId:e}),t.jsxs(Zmt,{children:[t.jsxs("div",{children:[t.jsx(Jmt,{children:"Competitor Benchmark"}),t.jsx(eht,{children:"Compare your AI readiness against direct competitors. Audits check 3 pages per competitor."})]}),t.jsxs(Dn,{to:`/workspaces/${e}/projects/${n}/settings/competitors`,style:{display:"inline-flex",alignItems:"center",gap:4,fontSize:"0.8rem",fontWeight:700,color:z,textDecoration:"none"},children:[t.jsx(Bc,{size:14})," Manage competitors"]})]}),t.jsx(tht,{children:t.jsxs(nht,{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx(vx,{$w:"22%",children:"Site"}),t.jsx(vx,{$w:"8%",children:"Overall"}),t.jsx(vx,{$w:"8%",children:t.jsx("span",{style:{color:Dl.technical.color,fontWeight:800},children:"Technical"})}),t.jsx(vx,{$w:"8%",children:t.jsx("span",{style:{color:Dl.content.color,fontWeight:800},children:"Content"})}),t.jsx(vx,{$w:"7%",children:"Issues"}),t.jsx(vx,{$w:"10%"})]})}),t.jsx("tbody",{children:Ke.map(ce=>{if(ce.type==="own"){const Me=ce.data;return t.jsxs("tr",{style:{background:"rgba(99,102,241,0.03)"},children:[t.jsx(yd,{$bold:!0,children:t.jsxs(vX,{children:[t.jsx(xo,{record:{name:Me.name,website:Me.website},size:20,shape:"rounded"}),t.jsx("span",{style:{maxWidth:160,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:Me.name}),t.jsxs(rht,{children:[t.jsx(ebe,{size:10})," You"]})]})}),t.jsx(yd,{children:Me.page_score!=null?t.jsx(du,{$c:os(Me.page_score),children:Math.round(Me.page_score)}):t.jsx("span",{style:{color:Pe},children:"â"})}),t.jsx(yd,{children:Me.technical_score!=null?t.jsx(du,{$c:os(Me.technical_score),children:Math.round(Me.technical_score)}):t.jsx("span",{style:{color:Pe},children:"â"})}),t.jsx(yd,{children:Me.content_score!=null?t.jsx(du,{$c:os(Me.content_score),children:Math.round(Me.content_score)}):t.jsx("span",{style:{color:Pe},children:"â"})}),t.jsx(yd,{children:Me.findings_summary?t.jsxs("div",{style:{display:"flex",gap:4,alignItems:"center"},children:[Me.findings_summary.high>0&&t.jsxs("span",{style:{color:Ut,fontWeight:800,fontSize:"0.75rem"},children:[Me.findings_summary.high,"H"]}),Me.findings_summary.medium>0&&t.jsxs("span",{style:{color:"#F97316",fontWeight:800,fontSize:"0.75rem"},children:[Me.findings_summary.medium,"M"]}),Me.findings_summary.low>0&&t.jsxs("span",{style:{color:"#EAB308",fontWeight:800,fontSize:"0.75rem"},children:[Me.findings_summary.low,"L"]}),Me.findings_summary.high===0&&Me.findings_summary.medium===0&&Me.findings_summary.low===0&&t.jsx("span",{style:{color:Pe},children:"â"})]}):t.jsx("span",{style:{color:Pe},children:"â"})}),t.jsx(yd,{})]},"own")}const ie=ce.data,Re=ie.audited_at!=null,Be=y.has(ie.id)||ie.audit_status==="running",tt=ie.audit_status==="failed",dt=j===ie.id,je=Be?iht:"tr";return t.jsxs(je,{style:{cursor:Re&&!Be?"pointer":void 0,background:dt?"rgba(99,102,241,0.05)":void 0},onClick:()=>!Be&&Re&&v(dt?null:ie.id),children:[t.jsx(yd,{$bold:!0,children:t.jsxs(vX,{children:[t.jsx(xo,{record:{name:ie.name,website:ie.website},size:20,shape:"rounded"}),t.jsx("span",{style:{maxWidth:160,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:ie.name}),!Be&&t.jsx("a",{href:ie.website.startsWith("http")?ie.website:`https://${ie.website}`,target:"_blank",rel:"noopener noreferrer",onClick:Me=>Me.stopPropagation(),children:t.jsx(as,{size:12,style:{color:Pe}})})]})}),t.jsx(yd,{children:Be?t.jsxs("span",{style:{color:Pe,fontSize:"0.75rem",fontWeight:600,display:"inline-flex",alignItems:"center",gap:5},children:[t.jsx(T5,{size:12})," Auditingâ¦"]}):tt?t.jsx("span",{title:ie.audit_error||"Audit failed",style:{color:Ut,fontSize:"0.72rem",fontWeight:700},children:"Failed"}):Re&&ie.page_score!=null?t.jsx(du,{$c:os(ie.page_score),children:Math.round(ie.page_score)}):t.jsx("span",{style:{color:Pe},children:"â"})}),t.jsx(yd,{children:Be||tt?null:Re&&ie.technical_score!=null?t.jsx(du,{$c:os(ie.technical_score),children:Math.round(ie.technical_score)}):t.jsx("span",{style:{color:Pe},children:"â"})}),t.jsx(yd,{children:Be||tt?null:Re&&ie.content_score!=null?t.jsx(du,{$c:os(ie.content_score),children:Math.round(ie.content_score)}):t.jsx("span",{style:{color:Pe},children:"â"})}),t.jsx(yd,{children:Re&&!Be&&!tt&&ie.findings_summary?t.jsxs("div",{style:{display:"flex",gap:4,alignItems:"center"},children:[ie.findings_summary.high>0&&t.jsxs("span",{style:{color:Ut,fontWeight:800,fontSize:"0.75rem"},children:[ie.findings_summary.high,"H"]}),ie.findings_summary.medium>0&&t.jsxs("span",{style:{color:"#F97316",fontWeight:800,fontSize:"0.75rem"},children:[ie.findings_summary.medium,"M"]}),ie.findings_summary.low>0&&t.jsxs("span",{style:{color:"#EAB308",fontWeight:800,fontSize:"0.75rem"},children:[ie.findings_summary.low,"L"]})]}):Be?null:t.jsx("span",{style:{color:Pe},children:"â"})}),t.jsx(yd,{children:i&&t.jsx(he,{type:"button",size:"sm",variant:tt?"primary":Re?"outline":"primary",disabled:Be,onClick:Me=>{Me.stopPropagation(),$(ie.id)},leftIcon:Be?t.jsx(T5,{size:13}):t.jsx(Sn,{size:12}),children:Be?"Runningâ¦":tt?`Retry · ${_e}cr`:Re?`Re-audit · ${_e}cr`:`Audit · ${_e}cr`})})]},ie.id)})})]})}),we&&t.jsxs(mht,{children:[t.jsxs(jX,{children:[t.jsxs(_X,{children:["Score Comparison â ",we.name]}),t.jsx(cue,{yourScores:ne?.subcategory_scores||ne?.category_scores||{},compScores:we.subcategory_scores||we.category_scores||{}}),t.jsxs(lue,{children:[t.jsxs(nP,{children:[t.jsx(iP,{$c:ot})," ",ne?.name||"Your site"]}),t.jsxs(nP,{children:[t.jsx(iP,{$c:Ut})," ",we.name]})]})]}),t.jsxs(jX,{children:[t.jsxs(_X,{children:["Top Issues â ",we.name]}),we.top_issues&&we.top_issues.length>0?we.top_issues.slice(0,8).map((ce,ie)=>t.jsxs(oht,{children:[t.jsx(sht,{$s:ce.severity}),t.jsx(aht,{children:ce.message}),ce.count>1&&t.jsxs(lht,{children:[ce.count," pages"]})]},`${ce.message}-${ce.severity}-${ie}`)):t.jsx("div",{style:{padding:"1.5rem 0",textAlign:"center",color:Pe,fontSize:"0.825rem"},children:"No issues found"}),we.schemas_detected&&we.schemas_detected.length>0&&t.jsxs("div",{style:{marginTop:"0.75rem",paddingTop:"0.75rem",borderTop:`1px solid ${V}`},children:[t.jsx("div",{style:{fontSize:"0.72rem",fontWeight:700,color:z,textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"0.35rem"},children:"Schemas detected"}),t.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"0.35rem"},children:we.schemas_detected.map(ce=>t.jsx("span",{style:{fontSize:"0.72rem",fontWeight:700,padding:"0.15rem 0.5rem",borderRadius:999,background:$e,color:O},children:ce},ce))})]}),we.crawlability?.bot_matrix&&t.jsxs("div",{style:{marginTop:"0.75rem",paddingTop:"0.75rem",borderTop:`1px solid ${V}`},children:[t.jsx("div",{style:{fontSize:"0.72rem",fontWeight:700,color:z,textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"0.35rem"},children:"AI Bot Access"}),t.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"0.35rem"},children:we.crawlability.bot_matrix.filter(ce=>ce.category==="ai").map(ce=>t.jsxs("span",{style:{fontSize:"0.72rem",fontWeight:700,padding:"0.15rem 0.5rem",borderRadius:999,background:ce.status==="allowed"?si:ce.status==="blocked"?kn:$e,color:ce.status==="allowed"?Vt:ce.status==="blocked"?Ut:z,border:`1px solid ${ce.status==="allowed"?Mo:ce.status==="blocked"?Er:V}`},children:[ce.name,": ",ce.status]},ce.key))})]})]})]}),t.jsxs(hht,{children:[t.jsxs(fht,{children:[t.jsx(Sge,{size:16,style:{color:ot,flexShrink:0}}),t.jsxs("div",{children:[t.jsx(ght,{children:"Compare Specific Pages"}),t.jsx(yht,{children:"Audit any two URLs side-by-side â your page vs a competitor's."})]})]}),t.jsxs(xht,{children:[t.jsx($X,{children:"Your page URL"}),t.jsx($X,{children:"Competitor page URL"}),t.jsx("div",{}),t.jsx(IX,{type:"url",placeholder:"https://yoursite.com/about",value:A,$invali
14276d:!!le,onChange:ce=>{E(ce.target.value),R(!0)},onBlur:()=>R(!0),onKeyDown:ce=>{ce.key==="Enter"&&ee()},disabled:H}),t.jsx(IX,{type:"url",placeholder:"https://competitor.com/about",value:B,$invalid:!!me,onChange:ce=>{T(ce.target.value),Y(!0)},onBlur:()=>Y(!0),onKeyDown:ce=>{ce.key==="Enter"&&ee()},disabled:H}),t.jsx(he,{type:"button",size:"sm",variant:"primary",className:"compare-btn",disabled:H||!A.trim()||!B.trim(),onClick:()=>void ee(),leftIcon:H?t.jsx(T5,{size:13}):t.jsx(Sn,{size:12}),children:H?"Runningâ¦":`Compare · ${K}cr`}),t.jsx(PX,{children:le||""}),t.jsx(PX,{children:me||""}),t.jsx("div",{})]}),X&&t.jsx(bht,{children:X}),k.length>0&&t.jsx(vht,{children:k.map(ce=>t.jsx(zht,{comparison:ce,isOpen:S.has(ce.id),onToggle:()=>q(ce.id)},ce.id))})]}),t.jsx(Hn,{isOpen:_!=null,onClose:()=>$(null),title:"Run Competitor Audit",footer:t.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.5rem"},children:[t.jsx(he,{type:"button",size:"sm",variant:"outline",onClick:()=>$(null),children:"Cancel"}),t.jsx(he,{type:"button",size:"sm",variant:"primary",leftIcon:t.jsx(Sn,{size:13}),onClick:()=>{_!=null&&oe(_)},children:"Run Audit"})]}),children:t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[t.jsx("div",{style:{fontSize:"0.875rem",color:z,lineHeight:1.6},children:"This will audit 3 pages of the competitor's site and compare results with yours."}),t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"0.5rem 0.65rem",background:"rgba(79, 70, 229, 0.06)",borderRadius:8,border:"1px solid rgba(79, 70, 229, 0.15)"},children:[t.jsx(Sn,{size:14,style:{color:"rgb(79, 70, 229)",flexShrink:0}}),t.jsxs("span",{style:{fontSize:"0.8rem",fontWeight:700,color:O},children:["Cost: ",t.jsxs("strong",{children:[_e," credits"]})]})]})]})})]})}function $$(e){try{const n=new URL(e),i=n.pathname+n.search;return i.length>1?n.host+i:n.host}catch{return e}}function DX({result:e}){const n=(e.findings||[]).filter(i=>i.severity==="high"||i.severity==="medium").slice(0,5);return t.jsxs("div",{children:[t.jsxs(z7,{children:[t.jsx(T7,{children:"Overall"}),e.page_score!=null?t.jsx(du,{$c:os(e.page_score),children:Math.round(e.page_score)}):t.jsx("span",{style:{color:Pe},children:"â"})]}),t.jsxs(z7,{children:[t.jsx(T7,{children:"Technical"}),e.technical_score!=null?t.jsx(du,{$c:os(e.technical_score),children:Math.round(e.technical_score)}):t.jsx("span",{style:{color:Pe},children:"â"})]}),t.jsxs(z7,{children:[t.jsx(T7,{children:"Content"}),e.content_score!=null?t.jsx(du,{$c:os(e.content_score),children:Math.round(e.content_score)}):t.jsx("span",{style:{color:Pe},children:"â"})]}),n.length>0&&t.jsxs(Cht,{children:[t.jsx("div",{style:{fontSize:"0.68rem",fontWeight:700,color:z,textTransform:"uppercase",letterSpacing:"0.04em",marginBottom:"0.2rem"},children:"Issues"}),n.map((i,r)=>t.jsxs(Sht,{children:[t.jsx(kht,{$s:i.severity}),t.jsx($ht,{children:i.message})]},`${i.code}-${r}`))]})]})}function zht({comparison:e,isOpen:n,onToggle:i}){const r=(()=>{try{return new Date(e.created_at).toLocaleString()}catch{return""}})();if(e.status==="running")return t.jsx(AX,{children:t.jsxs(_ht,{children:[t.jsx(T5,{size:14}),"Auditing pages⦠usually takes around 2 minutes"]})});const o=e.your_result?.page_score,s=e.competitor_result?.page_score;return t.jsxs(t.Fragment,{children:[t.jsxs(Iht,{onClick:i,"aria-expanded":n,children:[t.jsxs(MX,{children:[t.jsx(OX,{children:t.jsx(k$,{$side:"yours",children:"Your page"})}),t.jsx(RX,{title:e.your_url,children:$$(e.your_url)}),o!=null&&t.jsx(du,{$c:os(o),style:{flexShrink:0},children:Math.round(o)})]}),t.jsx(Pht,{children:"vs"}),t.jsxs(MX,{children:[s!=null&&t.jsx(du,{$c:os(s),style:{flexShrink:0},children:Math.round(s)}),t.jsx(RX,{title:e.competitor_url,children:$$(e.competitor_url)}),t.jsx(OX,{children:t.jsx(k$,{$side:"theirs",children:"Competitor"})})]}),e.status==="failed"&&t.jsx("span",{style:{flexShrink:0,fontSize:"0.7rem",fontWeight:700,color:Ut},children:"Failed"}),t.jsx(wht,{children:r}),t.jsx(Aht,{$open:n,children:t.jsx(qn,{size:14})})]}),n&&t.jsx(AX,{children:e.status==="failed"?t.jsx(E7,{children:e.error_message||"An error occurred. Please try again."}):t.jsxs(t.Fragment,{children:[t.jsxs(jht,{children:[t.jsxs(NX,{children:[t.jsxs(zX,{$side:"yours",children:[t.jsx(k$,{$side:"yours",children:"Your page"}),t.jsx(TX,{title:e.your_url,children:$$(e.your_url)})]}),t.jsx(EX,{children:e.your_result?t.jsx(DX,{result:e.your_result}):t.jsx(E7,{children:"Could not fetch page"})})]}),t.jsxs(NX,{children:[t.jsxs(zX,{$side:"theirs",children:[t.jsx(k$,{$side:"theirs",children:"Competitor page"}),t.jsx(TX,{title:e.competitor_url,children:$$(e.competitor_url)})]}),t.jsx(EX,{children:e.competitor_result?t.jsx(DX,{result:e.competitor_result}):t.jsx(E7,{children:"Could not fetch page"})})]})]}),e.your_result&&e.competitor_result&&t.jsxs("div",{style:{marginTop:"0.75rem"},children:[t.jsx(cue,{yourScores:e.your_result.subcategory_scores||{},compScores:e.competitor_result.subcategory_scores||{}}),t.jsxs(lue,{style:{marginTop:"0.5rem"},children:[t.jsxs(nP,{children:[t.jsx(iP,{$c:ot})," Your page"]}),t.jsxs(nP,{children:[t.jsx(iP,{$c:Ut})," Competitor page"]})]})]})]})})]})}function cue({yourScores:e,compScores:n}){return t.jsx(cht,{children:lb.map(i=>{const r=e[i]??0,o=n[i]??0;return t.jsxs(dht,{children:[t.jsx(uht,{children:gu(i)}),t.jsxs(pht,{children:[t.jsx(CX,{children:t.jsx(SX,{$w:Math.min(r,100),$color:ot})}),t.jsx(CX,{children:t.jsx(SX,{$w:Math.min(o,100),$color:Ut})})]}),t.jsx(kX,{$color:ot,children:Math.round(r)}),t.jsx(kX,{$color:Ut,children:Math.round(o)})]},i)})})}const Tht=p.div.withConfig({displayName:"ProjectSiteAuditstyles__Page",componentId:"sc-mu3nyg-0"})` 14277 padding: 1.25rem; 14278 min-height: 100%; 14279 display: flex; 14280 flex-direction: column; 14281`,Eht=p.div.withConfig({displayName:"ProjectSiteAuditstyles__HeroTop",componentId:"sc-mu3nyg-1"})` 14282 display: flex; 14283 align-items: flex-start; 14284 justify-content: space-between; 14285 gap: 1rem; 14286 flex-wrap: wrap; 14287`,Mht=p.div.withConfig({displayName:"ProjectSiteAuditstyles__Card",componentId:"sc-mu3nyg-2"})` 14288 border: 1px solid ${V}; 14289 background: ${Z}; 14290 border-radius: 0.875rem; 14291 padding: 1rem; 14292 min-width: 0; 14293 min-height: 0; 14294`,Rht=p.div.withConfig({displayName:"ProjectSiteAuditstyles__TableToolbar",componentId:"sc-mu3nyg-3"})` 14295 margin-top: 0.75rem; 14296 display: flex; 14297 align-items: center; 14298 justify-content: space-between; 14299 gap: 0.75rem; 14300 flex-wrap: wrap; 14301`,Oht=p.div.withConfig({displayName:"ProjectSiteAuditstyles__ToolbarLeft",componentId:"sc-mu3nyg-4"})` 14302 display: inline-flex; 14303 align-items: center; 14304 gap: 0.5rem; 14305 flex-wrap: wrap; 14306`,Dht=p.div.withConfig({displayName:"ProjectSiteAuditstyles__ToolbarRight",componentId:"sc-mu3nyg-5"})` 14307 display: inline-flex; 14308 align-items: center; 14309 gap: 0.5rem; 14310 flex-wrap: wrap; 14311`,Lht=p.div.withConfig({displayName:"ProjectSiteAuditstyles__CardHeader",componentId:"sc-mu3nyg-6"})` 14312 display: flex; 14313 align-items: flex-start; 14314 justify-content: space-between; 14315 gap: 0.75rem; 14316`,Bht=p.div.withConfig({displayName:"ProjectSiteAuditstyles__CardTitle",componentId:"sc-mu3nyg-7"})` 14317 font-size: 1.2rem; 14318 font-weight: 950; 14319 color: ${O}; 14320 line-height: 1.15; 14321`;p.div.withConfig({displayName:"ProjectSiteAuditstyles__CardSub",componentId:"sc-mu3nyg-8"})` 14322 margin-top: 0.25rem; 14323 font-size: 0.75rem; 14324 font-weight: 650; 14325 color: ${z}; 14326`;const Fht=p.div.withConfig({displayName:"ProjectSiteAuditstyles__TableWrap",componentId:"sc-mu3nyg-9"})` 14327 margin-top: 0.75rem; 14328 border: 1px solid ${V}; 14329 border-radius: 0.75rem; 14330 overflow: auto; 14331`,Wht=p(nr).withConfig({displayName:"ProjectSiteAuditstyles__Table",componentId:"sc-mu3nyg-10"})` 14332 width: 100%; 14333 border-collapse: collapse; 14334 min-width: 860px; 14335 table-layout: fixed; 14336`,Gh=p(Et).withConfig({displayName:"ProjectSiteAuditstyles__TH",componentId:"sc-mu3nyg-11"})` 14337 font-size: 0.7rem; 14338 font-weight: 900; 14339 color: ${z}; 14340 text-transform: uppercase; 14341 letter-spacing: 0.06em; 14342 text-align: left; 14343 padding: 0.65rem 0.5rem; 14344 border-bottom: 1px solid ${V}; 14345 background: ${Z}; 14346 position: sticky; 14347 top: 0; 14348 z-index: 1; 14349 overflow: visible; 14350`,Kw=p.button.withConfig({displayName:"ProjectSiteAuditstyles__THSortButton",componentId:"sc-mu3nyg-12"})` 14351 appearance: none; 14352 border: 0; 14353 background: transparent; 14354 padding: 0; 14355 margin: 0; 14356 cursor: pointer; 14357 display: inline-flex; 14358 align-items: center; 14359 gap: 0.25rem; 14360 font-size: inherit; 14361 font-weight: inherit; 14362 letter-spacing: inherit; 14363 text-transform: inherit; 14364 color: ${e=>e.$active?O:"inherit"}; 14365 transition: color 120ms ease; 14366 user-select: none; 14367 14368 & > svg { 14369 flex: 0 0 auto; 14370 line-height: 0; 14371 } 14372 14373 &:hover { 14374 color: ${O}; 14375 } 14376`,Ms=p(bt).withConfig({displayName:"ProjectSiteAuditstyles__TD",componentId:"sc-mu3nyg-13"})` 14377 font-size: 0.8125rem; 14378 font-weight: 800; 14379 color: ${O}; 14380 padding: 0.6rem 0.6rem; 14381 border-bottom: 1px solid ${$e}; 14382 text-align: ${e=>e.$right?"right":"left"}; 14383 vertical-align: middle; 14384`,Uht=p.tr.withConfig({displayName:"ProjectSiteAuditstyles__ClickableTR",componentId:"sc-mu3nyg-14"})` 14385 background: ${e=>e.$selected?"rgba(79,70,229,0.04)":"transparent"}; 14386 cursor: pointer; 14387 14388 &:hover { 14389 background: ${e=>e.$selected?"rgba(79,70,229,0.06)":"rgba(17,24,39,0.03)"}; 14390 } 14391 14392 &:focus-visible { 14393 outline: 2px solid rgba(79, 70, 229, 0.35); 14394 outline-offset: -2px; 14395 } 14396`,Hht=p.span.withConfig({displayName:"ProjectSiteAuditstyles__Pill",componentId:"sc-mu3nyg-15"})` 14397 display: inline-flex; 14398 align-items: center; 14399 gap: 0.35rem; 14400 border-radius: 9999px; 14401 padding: 0.15rem 0.5rem; 14402 font-size: 0.7rem; 14403 font-weight: 900; 14404 border: 1px solid 14405 ${e=>e.$tone==="danger"?"rgba(239,68,68,0.35)":e.$tone==="warn"?"rgba(249,115,22,0.35)":e.$tone==="ok"?"rgba(234,179,8,0.35)":Rt}; 14406 background: 14407 ${e=>e.$tone==="danger"?"rgba(239,68,68,0.06)":e.$tone==="warn"?"rgba(249,115,22,0.06)":e.$tone==="ok"?"rgba(234,179,8,0.06)":$e}; 14408 color: ${O}; 14409`,xd=p.div.withConfig({displayName:"ProjectSiteAuditstyles__Muted",componentId:"sc-mu3nyg-16"})` 14410 font-size: 0.75rem; 14411 font-weight: 650; 14412 color: ${z}; 14413`;p.div.withConfig({displayName:"ProjectSiteAuditstyles__SummaryStrip",componentId:"sc-mu3nyg-17"})` 14414 display: flex; 14415 gap: 0.75rem; 14416 margin-bottom: 0.75rem; 14417 14418 @media (max-width: 860px) { 14419 flex-wrap: wrap; 14420 } 14421`;p.div.withConfig({displayName:"ProjectSiteAuditstyles__SummaryStatCard",componentId:"sc-mu3nyg-18"})` 14422 background: ${Z}; 14423 border: 1px solid ${V}; 14424 border-radius: 0.75rem; 14425 padding: 0.85rem 1rem; 14426 flex: 1; 14427 min-width: 120px; 14428`;p.div.withConfig({displayName:"ProjectSiteAuditstyles__SummaryStatValue",componentId:"sc-mu3nyg-19"})` 14429 font-size: 1.5rem; 14430 font-weight: 900; 14431 color: ${e=>e.$c||O}; 14432 line-height: 1.15; 14433`;p.div.withConfig({displayName:"ProjectSiteAuditstyles__SummaryStatLabel",componentId:"sc-mu3nyg-20"})` 14434 font-size: 0.7rem; 14435 font-weight: 700; 14436 color: ${z}; 14437 margin-top: 0.15rem; 14438`;p.div.withConfig({displayName:"ProjectSiteAuditstyles__SummaryStatSub",componentId:"sc-mu3nyg-21"})` 14439 font-size: 0.65rem; 14440 font-weight: 600; 14441 color: ${e=>e.$c||z}; 14442 margin-top: 0.1rem; 14443`;p.div.withConfig({displayName:"ProjectSiteAuditstyles__CatDotsRow",componentId:"sc-mu3nyg-22"})` 14444 display: flex; 14445 gap: 3px; 14446 align-items: center; 14447`;p.span.withConfig({displayName:"ProjectSiteAuditstyles__CatDot",componentId:"sc-mu3nyg-23"})` 14448 display: inline-flex; 14449 align-items: center; 14450 justify-content: center; 14451 width: 22px; 14452 height: 18px; 14453 border-radius: 3px; 14454 font-size: 0.55rem; 14455 font-weight: 900; 14456 color: ${Z}; 14457 background: ${e=>e.$c}; 14458 text-transform: uppercase; 14459 letter-spacing: 0.2px; 14460`;const qht=p.div.withConfig({displayName:"ProjectSiteAuditstyles__IssuesCell",componentId:"sc-mu3nyg-24"})` 14461 display: flex; 14462 align-items: center; 14463 gap: 4px; 14464`,Ght=p.span.withConfig({displayName:"ProjectSiteAuditstyles__IssuesTotalBadge",componentId:"sc-mu3nyg-25"})` 14465 font-size: 0.8125rem; 14466 font-weight: 900; 14467 color: ${O};
14468 min-width: 20px; 14469`,M7=p.span.withConfig({displayName:"ProjectSiteAuditstyles__IssueMini",componentId:"sc-mu3nyg-26"})` 14470 font-size: 0.6rem; 14471 font-weight: 800; 14472 padding: 1px 4px; 14473 border-radius: 3px; 14474 ${e=>e.$tone==="danger"?"background: rgba(239,68,68,0.1); color: #DC2626;":e.$tone==="warn"?"background: rgba(249,115,22,0.1); color: #F97316;":"background: rgba(234,179,8,0.1); color: #CA8A04;"} 14475`,LX=p.span.withConfig({displayName:"ProjectSiteAuditstyles__BtnText",componentId:"sc-mu3nyg-27"})` 14476 @media (max-width: 640px) { 14477 display: none; 14478 } 14479`,Vht=p.div.withConfig({displayName:"ProjectSiteAuditstyles__RunningBanner",componentId:"sc-mu3nyg-28"})` 14480 display: flex; 14481 align-items: center; 14482 gap: 0.6rem; 14483 padding: 0.55rem 0.85rem; 14484 margin-top: 0.75rem; 14485 border-radius: 0.5rem; 14486 background: rgba(79, 70, 229, 0.05); 14487 border: 1px solid rgba(79, 70, 229, 0.15); 14488 font-size: 0.8125rem; 14489 font-weight: 600; 14490 color: ${O}; 14491`,Kht=p.div.withConfig({displayName:"ProjectSiteAuditstyles__RunningBannerBar",componentId:"sc-mu3nyg-29"})` 14492 flex: 1; 14493 max-width: 160px; 14494 height: 3px; 14495 border-radius: 1.5px; 14496 background: ${$e}; 14497 overflow: hidden; 14498 14499 @keyframes running-bar-slide { 14500 0% { transform: translateX(-100%); } 14501 100% { transform: translateX(260%); } 14502 } 14503 14504 &::after { 14505 content: ''; 14506 display: block; 14507 height: 100%; 14508 width: 40%; 14509 border-radius: 1.5px; 14510 background: rgb(79, 70, 229); 14511 animation: running-bar-slide 1.4s ease-in-out infinite; 14512 } 14513`,BX=p.div.withConfig({displayName:"ProjectSiteAuditstyles__PartialBanner",componentId:"sc-mu3nyg-30"})` 14514 display: flex; 14515 align-items: center; 14516 gap: 0.6rem; 14517 padding: 0.55rem 0.85rem; 14518 margin-top: 0.5rem; 14519 border-radius: 0.5rem; 14520 background: rgba(245, 158, 11, 0.07); 14521 border: 1px solid rgba(245, 158, 11, 0.2); 14522 font-size: 0.8125rem; 14523 font-weight: 500; 14524 color: ${O}; 14525 line-height: 1.5; 14526 14527 svg { flex-shrink: 0; color: #D97706; } 14528`,FX=p.button.withConfig({displayName:"ProjectSiteAuditstyles__PartialBannerClose",componentId:"sc-mu3nyg-31"})` 14529 all: unset; 14530 margin-left: auto; 14531 cursor: pointer; 14532 padding: 0.15rem; 14533 border-radius: 0.25rem; 14534 display: flex; 14535 align-items: center; 14536 justify-content: center; 14537 color: ${z}; 14538 flex-shrink: 0; 14539 14540 &:hover { color: ${O}; background: rgba(255, 255, 255, 0.06); } 14541`,Yht=p.button.withConfig({displayName:"ProjectSiteAuditstyles__ThemedCheckbox",componentId:"sc-mu3nyg-32"})` 14542 width: 1rem; 14543 height: 1rem; 14544 border-radius: 0.25rem; 14545 border: 2px solid ${e=>e.$checked?ot:Rt}; 14546 background: ${e=>e.$checked?ot:"transparent"}; 14547 display: inline-flex; 14548 align-items: center; 14549 justify-content: center; 14550 flex-shrink: 0; 14551 cursor: ${e=>e.$disabled?"not-allowed":"pointer"}; 14552 opacity: ${e=>e.$disabled?.4:1}; 14553 transition: background 0.15s, border-color 0.15s, opacity 0.15s; 14554 padding: 0; 14555 14556 &:hover { 14557 border-color: ${e=>e.$disabled?Rt:ot}; 14558 } 14559`;function Ng({size:e=16,stroke:n="rgba(107,114,128,0.85)"}){const i=Math.max(10,e),r=i/2,o=r-2;return t.jsx("svg",{width:i,height:i,viewBox:`0 0 ${i} ${i}`,"aria-label":"Loading",role:"img",style:{display:"inline-block"},children:t.jsxs("g",{children:[t.jsx("animateTransform",{attributeName:"transform",type:"rotate",from:`0 ${r} ${r}`,to:`360 ${r} ${r}`,dur:"0.9s",repeatCount:"indefinite"}),t.jsx("circle",{cx:r,cy:r,r:o,fill:"none",stroke:n,strokeWidth:"2",strokeLinecap:"round",strokeDasharray:`${Math.max(10,o*3)} ${Math.max(6,o*1.6)}`})]})})}function Xht({label:e,info:n}){return t.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:3,flexShrink:0},children:[t.jsx("span",{children:e}),t.jsx(at,{content:n,placement:"top",onlyIfTruncated:!1,children:t.jsx("span",{style:{display:"inline-flex",alignItems:"center",color:"rgba(107,114,128,0.9)",flexShrink:0},"aria-label":`${e} info`,children:t.jsx(wn,{size:12})})})]})}function Qht(e){const n=[];n.push(`I want to discuss this site audit and prioritize what to fix for better AI visibility. 14560`),e.projectName&&n.push(`**Project:** ${e.projectName}`),n.push(`**Current tab:** ${e.activeTab}`),e.siteScore!=null&&n.push(`**Overall site audit score:** ${e.siteScore}`);const i=[];e.siteTechnicalScore!=null&&i.push(`Technical: ${e.siteTechnicalScore}`),e.siteContentScore!=null&&i.push(`Content: ${e.siteContentScore}`),i.length&&n.push(`**Pillar scores:** ${i.join(" · ")}`),n.push(`**Pages audited:** ${e.pagesAudited} of ${e.totalPages||e.pagesAudited}`),n.push(`**Open issues:** high ${e.issueCounts.high}
14560, medium ${e.issueCounts.medium}, low ${e.issueCounts.low}`),e.summary&&n.push(` 14561**Audit summary:** ${e.summary}`);const r=e.topIssues.slice(0,5);return r.length&&(n.push(` 14562**Top priority issues:**`),r.forEach(o=>{const s=String(o.title||o.label||o.code||"Issue"),a=String(o.severity||"").trim(),c=Number(o.count||0);n.push(`- ${s}${a?` (${a})`:""}${c?`: ${c} occurrence${c===1?"":"s"}`:""}`)})),n.push(` 14563Help me decide the highest-impact fixes and explain how to approach them.`),n.join(` 14564`)}function Zht(e){const n=String(e||"Project").trim();return`Site audit: ${n.length>48?`${n.slice(0,45)}â¦`:n}`}function Jht(e){const n=e?.diagnostic_headers||{},i=[["cf-ray","Cloudflare Ray ID"],["x-amzn-requestid","AWS request ID"],["x-amzn-waf-action","AWS WAF action"],["x-sucuri-block","Sucuri block ID"],["x-datadome-cid","DataDome ID"],["x-px-block","PerimeterX block"],["x-iinfo","Imperva / Incapsula ID"],["retry-after","Retry after"]];for(const[r,o]of i){const s=String(n[r]||r==="cf-ray"&&e?.ray_id||"").trim();if(s)return{label:o,value:s}}return null}const eft=p.div.withConfig({displayName:"ProjectSiteAuditPage__AuditToolbarActions",componentId:"sc-25exbr-0"})` 14565 padding-bottom: 0.35rem; 14566 display: flex; 14567 gap: 0.5rem; 14568 align-items: center; 14569 flex-shrink: 0; 14570 flex-wrap: wrap; 14571 14572 @media (max-width: 720px) { 14573 width: 100%; 14574 } 14575`;function tft(){const{workspaceId:e,projectId:n}=Gn(),[i,r]=yr(),{projects:o}=Mr(),{user:s}=yn(),a=Uo(),{subscribe:c}=wo(),u=k1(),m=l.useRef(null),h=l.useMemo(()=>{const It=Number(e);return It&&s?.organizations?.find(Dt=>Number(Dt.id)===It)||null},[e,s?.organizations]),g=h?.role||null,x=!!h?.partner_managed,y=l.useMemo(()=>{const It=Number(n);return o.find(Dt=>Dt.id===It)||null},[n,o]),w=!!(y?.can?.edit||y?.can?.settings),j=y?.site_audit?.enumeration_status,v=y?.site_audit?.enumeration_finished_at,_=y?.site_audit?.enumeration_pages_count,$=y?.site_audit?.enumeration_error_message,k=y?.site_audit?.enumeration_mode,[P,S]=l.useState(j?String(j):null),[I,A]=l.useState(k?String(k):null),[E,B]=l.useState($?String($):null),[T,M]=l.useState(!1),[R,F]=l.useState(!1),[Y,H]=l.useState(!1),U=String(P||j||"").toLowerCase(),X=String(I||k||"").toLowerCase(),Q=U==="running"||U==="synthesizing",K=E||$||null,G=j==="running"&&!v&&_==null,L=j==="failed"&&_==null;l.useEffect(()=>{S(It=>{const Dt=j?String(j).toLowerCase():null,ut=(It||"").toLowerCase();return(ut==="running"||ut==="synthesizing")&&(!Dt||Dt==="succeeded"||Dt==="failed")?It:j?String(j):null})},[j]),l.useEffect(()=>{A(k?String(k):null)},[k]),l.useEffect(()=>{y?.site_audit?.sitemap_url!=null&&Va(y.site_audit.sitemap_url),y?.site_audit?.sitemap_source!=null&&Kr(y.site_audit.sitemap_source)},[y?.site_audit?.sitemap_url,y?.site_audit?.sitemap_source]);const q=`/workspaces/${e}/projects/${n}`,[W,oe]=l.useState(1),[se,de]=l.useState(0),[le,me]=l.useState(1),[ee,ne]=l.useState(0),[Ae,_e]=l.useState(null),[we,Ke]=l.useState(0),[ce,ie]=l.useState([]),[Re,Be]=l.useState(null),[tt,dt]=l.useState("asc"),[je,Me]=l.useState(""),[Se,it]=l.useState(""),[De,te]=l.useState(""),[ge,Je]=l.useState({}),[Ee,Xe]=l.useState(null),yt=i.get("page")||null,Ne=l.useRef("pages"),Le=It=>{if(It)Ne.current=We,r(Dt=>{const ut=new URLSearchParams(Dt);return ut.set("page",It),ut});else{const Dt=Ne.current;r(ut=>{const Lt=new URLSearchParams(ut);return Lt.delete("page"),Lt.set("tab",Dt),Lt},{replace:!0}),Qe(Dt)}},Ue=i.get("tab"),[We,Qe]=l.useState(Ue&&["dashboard","pages","technical","content","competitors"].includes(Ue)?Ue:"dashboard"),[ht,pe]=l.useState(!1),be=It=>{Qe(It),r(Dt=>{const ut=new URLSearchParams(Dt);return It==="dashboard"?ut.delete("tab"):ut.set("tab",It),ut})};l.useEffect(()=>{const Dt=Ue&&["dashboard","pages","technical","content","competitors"].includes(Ue)?Ue:"dashboard";Qe(Dt)},[Ue]);const[rt,ze]=l.useState(void 0),[lt,vt]=l.useState(void 0),[Wt,Qt]=l.useState(null),[Yt,Zt]=l.useState(null),[tn,nn]=l.useState(null),[xn,st]=l.useState(null),[Ct,Ie]=l.useState({high:0,medium:0,low:0}),[ae,Fe]=l.useState([]),[Ge,wt]=l.useState([]),[ke,Ve]=l.useState(null),[pt,Nt]=l.useState(null),[qe,qt]=l.useState(0),[Mn,zt]=l.useState([]),[dn,rn]=l.useState(null),[bn,kt]=l.useState(null),[Kt,un]=l.useState(null),[pn,$n]=l.useState(null),[Ii,_i]=l.useState(null),[di,Co]=l.useState(null),[Gr,Go]=l.useState(null),[Qc,Zs]=l.useState(null),[jl,Vo]=l.useState(null),[Ro,So]=l.useState(!1),[ic,cs]=l.useState(!1),[rc,_l]=l.useState(!1),[Ns,Ti]=l.useState(12),[ds,Cl]=l.useState(!1),[Sl,Ko]=l.useState(null),[Zc,us]=l.useState([]),[Js,Fp]=l.useState(!1),[oc,va]=l.useState(0),sc=l.useRef(null),wa=l.useRef(!1);l.useEffect(()=>{sc.current=Ee},[Ee]),l.useEffect(()=>{wa.current=Js},[Js]);const[Wp,ac]=l.useState(0),[Vr,Jc]=l.useState(!1),[Oo,qa]=l.useState(null),[Kn,Ga]=l.useState(!1),[an,Va]=l.useState(y?.site_audit?.sitemap_url??null),[Ka,Kr]=l.useState(y?.site_audit?.sitemap_source??null),[mo,ja]=l.useState(""),[g
14575i,Or]=l.useState(!1),[ea,Hd]=l.useState([]),[_a,kl]=l.useState(""),[Ca,to]=l.useState(!1),[zs,Sa]=l.useState(!1),[ta,Du]=l.useState(""),[ps,lc]=l.useState("other"),[na,Ya]=l.useState(!1),[Yo,Up]=l.useState(!1),[ed,Xa]=l.useState(null);l.useEffect(()=>{const It=Number(n);if(!Number.isFinite(It)||It<=0)return;try{m.current?.unsubscribe?.()}catch{}m.current=null;const Dt=c({channel:"ProjectSiteAuditChannel",project_id:It},{received:ut=>{if(!ut)return;if(ut.type==="site_audit_pages_enumeration_updated"){const Jt=String(ut?.enumeration_status||"").trim();Jt&&S(Jt),ut.enumeration_mode!=null&&A(String(ut.enumeration_mode)),typeof ut.enumeration_partial=="boolean"&&M(ut.enumeration_partial),typeof ut.enumeration_error_message=="string"?B(ut.enumeration_error_message):ut.enumeration_error_message===null&&B(null),(Jt.toLowerCase()==="succeeded"||Jt.toLowerCase()==="failed")&&Ke(Qn=>Qn+1),ut.site_score!=null&&_e(ut.site_score),ut.site_subcategory_scores?Qt(ut.site_subcategory_scores):ut.site_category_scores&&Qt(ut.site_category_scores),ut.site_technical_score!=null&&nn(ut.site_technical_score),ut.site_content_score!=null&&st(ut.site_content_score),ut.issue_counts&&Ie({high:ut.issue_counts.high??0,medium:ut.issue_counts.medium??0,low:ut.issue_counts.low??0}),Array.isArray(ut.score_history)&&zt(ut.score_history),Array.isArray(ut.top_issues)&&wt(ut.top_issues),ut.blocking_details&&typeof ut.blocking_details=="object"?Ve(ut.blocking_details):ut.blocking_details===null&&Ve(null),typeof ut.llm_summary=="string"&&Nt(ut.llm_summary),typeof ut.pages_audited=="number"&&qt(ut.pages_audited),ut.schema_data&&typeof ut.schema_data=="object"&&rn(ut.schema_data),ut.crawlability_data&&typeof ut.crawlability_data=="object"&&kt(ut.crawlability_data),ut.performance_data&&typeof ut.performance_data=="object"&&un(ut.performance_data),ut.metadata_data&&typeof ut.metadata_data=="object"&&$n(ut.metadata_data),ut.links_data&&typeof ut.links_data=="object"&&_i(ut.links_data),ut.security_data&&typeof ut.security_data=="object"&&Co(ut.security_data),ut.content_quality_data&&typeof ut.content_quality_data=="object"&&Go(ut.content_quality_data),ut.content_structure_data&&typeof ut.content_structure_data=="object"&&Zs(ut.content_structure_data),ut.aeo_data&&typeof ut.aeo_data=="object"&&Vo(ut.aeo_data),typeof ut.sitemap_url=="string"&&Va(ut.sitemap_url),typeof ut.sitemap_source=="string"&&Kr(ut.sitemap_source);return}if(ut.type==="site_audit_competitor_finished"||ut.type==="site_audit_page_comparison_updated"){ac(Jt=>Jt+1);return}if(ut.type!=="site_audit_page_run_finished")return;const Lt=ut.page||{},gt=String(Lt.id||ut.page_id||"");if(!gt)return;ie(Jt=>Jt.map(Qn=>{if(String(Qn.id)!==gt)return Qn;const Ja=String(Lt.audit_status||"").toLowerCase(),ms=Lt.audit_started_at||Qn.audit_started_at||null,xe=Lt.audit_finished_at||Qn.audit_finished_at||null,Oe=xe||ms||Qn.last_audited_at||null,He=typeof Lt.score=="number"?Lt.score:Qn.score,Ye=typeof Lt.open_actions_count=="number"?Lt.open_actions_count:Qn.open_actions_count,ft=typeof Lt.kind=="string"?Lt.kind:Qn.kind,Ot=typeof Lt.in_home_nav=="boolean"?Lt.in_home_nav:Qn.in_home_nav;return{...Qn,score:He,open_actions_count:Ye,open_actions_by_severity:Lt.open_actions_by_severity??Qn.open_actions_by_severity,technical_score:Lt.technical_score??Qn.technical_score,content_score:Lt.content_score??Qn.content_score,subcategory_scores:Lt.subcategory_scores??Qn.subcategory_scores,category_scores:Lt.subcategory_scores??Lt.category_scores??Qn.category_scores,kind:ft,in_home_nav:Ot,audit_started_at:ms,audit_finished_at:xe,audit_error_message:Lt.audit_error_message||null,last_audited_at:Oe,status:Ja==="running"?"running":"idle",detected_schemas:Array.isArray(Lt.detected_schemas)?Lt.detected_schemas:Qn.detected_schemas}}));const Ln=sc.current,yi=Array.isArray(ut.touched_actions)?ut.touched_actions:[];if(Ln&&yi.length>0){const Jt=yi.filter(Qn=>String(Qn?.page_id??"")===Ln);if(Jt.length>0){const Qn=wa.current;us(Ja=>{const ms=new Map(Ja.map(Oe=>[Oe.id,Oe]));for(const Oe of Jt){const He=String(Oe?.id??"");if(!He)continue;const Ye=ms.get(He);ms.set(He,{...Ye||{},id:He,page_id:Ln,code:String(Oe?.code||Ye?.code||""),fingerprint:typeof Oe?.fingerprint=="string"?Oe.fingerprint:Ye?.fingerprint,severity:Oe?.severity==="high"||Oe?.severity==="medium"||Oe?.severity==="low"?Oe.severity:Ye?.severity||"low",category:String(Oe?.category||Ye?.category||"metadata"),message:String(Oe?.message||Ye?.message||""),status:Oe?.status==="completed"?"completed":"open",completed_at:typeof Oe?.completed_at=="string"?Oe.completed_at:null,completion_reason:typeof Oe?.completion_reason=="str
14575ing"?Oe.completion_reason:null,fix_markdown:typeof Oe?.fix_markdown=="string"?Oe.fix_markdown:Ye?.fix_markdown??null,evidence:Oe?.evidence??Ye?.evidence??null})}let xe=Array.from(ms.values());return Qn||(xe=xe.filter(Oe=>Oe.status!=="completed")),xe})}}typeof ut?.overall_score=="number"&&Number.isFinite(ut.overall_score)&&_e(ut.overall_score),Ke(Jt=>Jt+1),va(Jt=>Jt+1)}})||null;return m.current=Dt,()=>{try{Dt?.unsubscribe?.()}catch{}m.current===Dt&&(m.current=null)}},[n,c]),l.useEffect(()=>{const It=e,Dt=n;if(!It||!Dt)return;let ut=!1;Jc(!0),qa(null);const Lt=new URLSearchParams;return Lt.set("page",String(W)),Lt.set("per_page",String(rut)),Lt.set("sort",Re||"importance"),Re&&Lt.set("sort_dir",tt),De.trim()&&Lt.set("q",De.trim()),je&&Lt.set("score_range",je),Se&&Lt.set("severity",Se),ue(`/api/v1/organizations/${It}/projects/${Dt}/site_audit_pages?${Lt.toString()}`).then(async gt=>{if(!gt.ok){const Ln=await gt.json().catch(()=>null);throw new Error(Ln?.error||Ln?.message||`Failed to load pages (HTTP ${gt.status})`)}return gt.json()}).then(gt=>{if(ut)return;const Ln=Array.isArray(gt?.pages)?gt.pages:[];de(typeof gt?.total=="number"?gt.total:0),me(typeof gt?.total_pages=="number"?gt.total_pages:1),typeof gt?.unfiltered_total=="number"&&ne(gt.unfiltered_total),_e(typeof gt?.overall_score=="number"&&Number.isFinite(gt.overall_score)?gt.overall_score:null),gt?.site_score!=null&&_e(gt.site_score),gt?.site_subcategory_scores?Qt(gt.site_subcategory_scores):gt?.site_category_scores&&Qt(gt.site_category_scores),gt?.previous_site_subcategory_scores?Zt(gt.previous_site_subcategory_scores):gt?.previous_site_category_scores&&Zt(gt.previous_site_category_scores),gt?.site_technical_score!=null&&nn(gt.site_technical_score),gt?.site_content_score!=null&&st(gt.site_content_score),Array.isArray(gt?.score_history)&&zt(gt.score_history),Array.isArray(gt?.top_issues)&&wt(gt.top_issues),gt?.blocking_details&&typeof gt.blocking_details=="object"?Ve(gt.blocking_details):Ve(null),typeof gt?.auto_audit_page_count=="number"&>.auto_audit_page_count>0&&Ti(gt.auto_audit_page_count),typeof gt?.llm_summary=="string"&&Nt(gt.llm_summary),gt?.schema_data&&typeof gt.schema_data=="object"&&rn(gt.schema_data),gt?.crawlability_data&&typeof gt.crawlability_data=="object"&&kt(gt.crawlability_data),gt?.performance_data&&typeof gt.performance_data=="object"&&un(gt.performance_data),gt?.metadata_data&&typeof gt.metadata_data=="object"&&$n(gt.metadata_data),gt?.links_data&&typeof gt.links_data=="object"&&_i(gt.links_data),gt?.security_data&&typeof gt.security_data=="object"&&Co(gt.security_data),gt?.content_quality_data&&typeof gt.content_quality_data=="object"&&Go(gt.content_quality_data),gt?.content_structure_data&&typeof gt.content_structure_data=="object"&&Zs(gt.content_structure_data),gt?.aeo_data&&typeof gt.aeo_data=="object"&&Vo(gt.aeo_data),typeof gt?.sitemap_url=="string"?Va(gt.sitemap_url):gt?.sitemap_url===null&&Va(null),typeof gt?.sitemap_source=="string"?Kr(gt.sitemap_source):gt?.sitemap_source===null&&Kr(null),Array.isArray(gt?.auto_audit_exclusion_patterns)&&Hd(gt.auto_audit_exclusion_patterns.map(String)),typeof gt?.enumeration_status=="string"&&S(gt.enumeration_status),typeof gt?.enumeration_partial=="boolean"&&M(gt.enumeration_partial);const yi=Ln.map(Jt=>{const Qn=typeof Jt?.path=="string"?Jt.path:"/",Ja=typeof Jt?.url=="string"?Jt.url:"",ms=Qn==="/"?"Home":Qn.replace(/^\//,"").replace(/\//g," ").split(/[-\s]+/).map(on=>on.charAt(0).toUpperCase()+on.slice(1)).join(" "),xe=typeof Jt?.open_actions_count=="number"?Jt.open_actions_count:0,Oe=typeof Jt?.audit_status=="string"?Jt.audit_status:"idle",He=typeof Jt?.score=="number"&&Number.isFinite(Jt.score)?Math.max(0,Math.min(100,Jt.score)):null,Ye=typeof Jt?.audit_started_at=="string"?Jt.audit_started_at:null,ft=typeof Jt?.audit_finished_at=="string"?Jt.audit_finished_at:null,Ot=Jt?.kind==="main"||Jt?.kind==="content"||Jt?.kind==="docs"||Jt?.kind==="other"?Jt.kind:"other",ln=!!Jt?.in_home_nav;return{id:String(Jt?.id??Qn),url:Ja,path:Qn,title:ms,score:He,open_actions_count:xe,open_actions_by_severity:Jt?.open_actions_by_severity||void 0,last_audited_at:ft||Ye||null,kind:Ot,in_home_nav:ln,status:Oe==="running"?"running":"idle",audit_started_at:Ye,audit_finished_at:ft,audit_error_message:typeof Jt?.audit_error_message=="string"?Jt.audit_error_message:null,technical_score:typeof Jt?.technical_score=="number"?Jt.technical_score:null,content_score:typeof Jt?.content_score=="number"?Jt.content_score:null,subcategory_scores:Jt?.subcategory_scores||null,category_scores:Jt?.subcategory_scores||Jt?.category_scores||null,page_type:Jt?.page_type||null,recommended_schemas:Array.isArray(Jt?.recommended_schemas)?Jt.recommended_schemas:[],detected_schemas:Array.isArray(Jt?.detected_schemas)?Jt.detected_schemas:[]}});ie(yi),Je({})}).catch(gt=>{ut||(ie([]),Xe(null),de(0),me(1),_e(null),qa(gt?.message||"Failed to load pages"))}).finally(()=>{ut||Jc(!1)}),()=>{ut=!0}},[n,e,W,we,Re,tt,De,je,Se]),l.useEffect(()=>{if(!e||!n)return;let It=!1;return ue(`/api/v1/organizations/${e}/projects/${n}/site_audit_actions/summary`).then(async Dt=>{if(It)return;if(!Dt.ok){const gt=await Dt.json().catch(()=>null);console.warn("[SiteAudit] actions summary fetch error:",gt?.error||`HTTP ${Dt.status}`);return}const ut=await Dt.json().catch(()=>null);if(It||!ut)return;Array.isArray(ut.by_category)&&Fe(ut.by_category);const Lt=ut.issue_counts||ut.counts;Lt&&Ie({high:Lt.high??0,medium:Lt.medium??0,low:Lt.low??0}),typeof ut.pages_audited=="number"&&qt(ut.pages_audited)}).catch(Dt=>{It||console.warn("[SiteAudit] actions summary fetch error:",Dt?.message)}),()=>{It=!0}},[n,e,we]);const $l=async It=>{if(!w)return;const Dt=e,ut=n;if(!(!Dt||!ut)&&It)try{const Lt=await ue(`/api/v1/organizations/${Dt}/projects/${ut}/site_audit_actions/${It}/complete`,{method:"PATCH"});if(!Lt.ok){const gt=await Lt.json().catch(()=>null);throw new Error(gt?.error||gt?.message||"Failed to complete action")}a.showToast("Action marked complete.",{tone:"success"}),va(gt=>gt+1),Ke(gt=>gt+1)}catch(Lt){a.showToast(Lt?.message||"Failed to complete action",{tone:"error"})}},Lu=async It=>{if(!w)return;const Dt=e,ut=n;if(!(!Dt||!ut)&&It)try{const Lt=await ue(`/api/v1/organizations/${Dt}/projects/${ut}/site_audit_actions/${It}/reopen`,{method:"PATCH"});if(!Lt.ok){const gt=await Lt.json().catch(()=>null);throw new Error(gt?.error||gt?.message||"Failed to reopen action")}a.showToast("Action reopened.",{tone:"success"}),va(gt=>gt+1),Ke(gt=>gt+1)}catch(Lt){a.showToast(Lt?.message||"Failed to reopen action",{tone:"error"})}},td=async It=>{if(!w)return;const Dt=e,ut=n;if(!(!Dt||!ut||!It))try{const Lt=await ue(`/api/v1/organizations/${Dt}/projects/${ut}/content_drafts/generate_from_audit_action`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({site_audit_action_id:Number(It)})}),gt=await Lt.json().catch(()=>({}));if(!Lt.ok)throw new Error(gt?.error||gt?.message||`Failed to start draft (HTTP ${Lt.status})`);a.showToast("Sent to Content Agent. Drafting nowâ¦",{tone:"success"}),va(Ln=>
14575Ln+1)}catch(Lt){a.showToast(Lt?.message||"Failed to start draft",{tone:"error"})}},nd=l.useMemo(()=>!e||!n?null:`/workspaces/${e}/projects/${n}/agents?agent=content`,[e,n]);l.useEffect(()=>{yt&&yt!==Ee&&(Xe(yt),us([]),Cl(!0))},[yt]);const qd=l.useMemo(()=>yt&&ce.find(It=>It.id===yt)||null,[ce,yt]),id=l.useMemo(()=>Object.keys(ge).filter(It=>!!ge[It]),[ge]),Qa=id.length,ka=l.useMemo(()=>ce.length>0&&ce.every(It=>!!ge[It.id]),[ce,ge]),_r=It=>{Je(()=>{const Dt={};return It&&ce.forEach(ut=>{Dt[ut.id]=!0}),Dt})},Gd=(It,Dt)=>{Je(ut=>{const Lt={...ut};return Dt?Lt[It]=!0:delete Lt[It],Lt})},Cr=l.useMemo(()=>ce.map(It=>({type:"page",page:It})),[ce]),ti=It=>{Re===It?tt==="asc"?dt("desc"):(Be(null),dt("asc")):(Be(It),dt("asc")),oe(1)},Ts=It=>Re!==It?t.jsx(q8,{size:11,style:{opacity:.4}}):tt==="asc"?t.jsx($ne,{size:11}):t.jsx(kne,{size:11}),cc=l.useMemo(()=>[{value:"",label:"Score: All"},{value:"healthy",label:"Score: Healthy (80-100)",color:Vt},{value:"needs_work",label:"Score: Needs work (50-79)",color:$i},{value:"critical",label:"Score: Critical (0-49)",color:Ut}],[]),hh=l.useMemo(()=>[{value:"",label:"Severity: All"},{value:"high",label:"Severity: High"},{value:"medium",label:"Severity: Medium"},{value:"low",label:"Severity: Low"}],[]),Hp=l.useMemo(()=>[{value:"main",label:"Main"},{value:"content",label:"Content"},{value:"docs",label:"Docs"},{value:"other",label:"Other"}],[]),dc=It=>{Le(It),Xe(It),us([]),Cl(!0)};l.useEffect(()=>{const It=e,Dt=n;if(!yt||!It||!Dt||!Ee)return;let ut=!1;return Cl(!0),Ko(null),ue(`/api/v1/organizations/${It}/projects/${Dt}/site_audit_pages/${Ee}/actions?include_completed=${Js?"true":"false"}`).then(async gt=>{if(!gt.ok){const Ln=await gt.json().catch(()=>null);throw new Error(Ln?.error||Ln?.message||`Failed to load actions (HTTP ${gt.status})`)}return gt.json()}).then(gt=>{if(ut)return;const yi=(Array.isArray(gt?.actions)?gt.actions:[]).map(Jt=>({id:String(Jt?.id),page_id:String(Ee),code:String(Jt?.code||""),fingerprint:typeof Jt?.fingerprint=="string"?Jt.fingerprint:String(Jt?.fingerprint||""),severity:Jt?.severity==="high"||Jt?.severity==="medium"||Jt?.severity==="low"?Jt.severity:"low",category:String(Jt?.category||"metadata")||"metadata",message:String(Jt?.message||""),status:Jt?.status==="open"||Jt?.status==="completed"?Jt.status:"open",completed_at:typeof Jt?.completed_at=="string"?Jt.completed_at:null,completion_reason:typeof Jt?.completion_reason=="string"?Jt.completion_reason:null,fix_markdown:typeof Jt?.fix_markdown=="string"?Jt.fix_markdown:null,evidence:Jt?.evidence??null,content_fixable:typeof Jt?.content_fixable=="boolean"?Jt.content_fixable:null,content_drafting_id:typeof Jt?.content_drafting_id=="number"?Jt.content_drafting_id:null}));us(yi)}).catch(gt=>{ut||(us([]),Ko(gt?.message||"Failed to load actions"))}).finally(()=>{ut||Cl(!1)}),()=>{ut=!0}},[yt,n,Ee,Js,e,oc]);const Vd=w?9:8,$a=It=>Array.from({length:It}).map((Dt,ut)=>t.jsxs("tr",{children:[w&&t.jsx(Ms,{children:t.jsx(nt,{height:14,width:14,radius:4})}),t.jsx(Ms,{children:t.jsxs("div",{style:{display:"grid",gap:6},children:[t.jsx(nt,{height:12,width:`${60+ut%4*8}%`,radius:8}),t.jsx(nt,{height:10,width:`${45+ut%4*10}%`,radius:8})]})}),t.jsx(Ms,{children:t.jsx(nt,{height:12,width:36,radius:8})}),t.jsx(Ms,{children:t.jsx("div",{style:{display:"flex",gap:3},children:Array.from({length:6}).map((Lt,gt)=>t.jsx(nt,{height:18,width:22,radius:3},gt))})}),t.jsx(Ms,{children:t.jsxs("div",{style:{display:"flex",gap:4,alignItems:"center"},children:[t.jsx(nt,{height:12,width:20,radius:4}),t.jsx(nt,{height:14,width:22,radius:3}),t.jsx(nt,{height:14,width:22,radius:3})]})}),t.jsx(Ms,{children:t.jsx(nt,{height:12,width:48,radius:8})}),t.jsx(Ms,{$right:!0,children:w&&t.jsxs("div",{style:{display:"inline-flex",gap:6,justifyContent:"flex-end"},children:[t.jsx(nt,{height:28,width:52,radius:10}),t.jsx(nt,{height:28,width:62,radius:10})]})})]},`sk_page_${ut}`)),Bu=async It=>{if(!w||Q)return!1;const Dt=e,ut=n;if(!Dt||!ut)return!1;ie(Lt=>Lt.map(gt=>gt.id===It?{...gt,status:"running"}:gt));try{const Lt=await ue(`/api/v1/organizations/${Dt}/projects/${ut}/site_audit_pages/${It}/run`,{method:"POST"});if(!Lt.ok){const gt=await Lt.json().catch(()=>null),Ln=new Error(gt?.error||gt?.message||`Failed to run page (HTTP ${Lt.status})`);throw gt?.errors&&typeof gt.errors=="object"&&(Ln.limitDetails=gt.errors),Ln}return Fo(),a.showToast("Page run queued.",{tone:"success"}),Ke(gt=>gt+1),!0}catch(Lt){return ie(gt=>gt.map(Ln=>Ln.id===It?{...Ln,status:"idle"}:Ln)),u.handleApiError(Lt)||a.showToast(Lt?.message||"Failed to run page",{tone:"error"}),!1}},Za=async()=>
14575{if(!w||Q||Qa<=0)return;const It=e,Dt=n;if(!It||!Dt)return;const ut=id.map(Lt=>Number(Lt)).filter(Lt=>Number.isFinite(Lt)&&Lt>0);if(ut.length!==0){ie(Lt=>Lt.map(gt=>ge[gt.id]?{...gt,status:"running"}:gt));try{const Lt=await ue(`/api/v1/organizations/${It}/projects/${Dt}/site_audit_pages/run_bulk`,{method:"POST",body:JSON.stringify({page_ids:ut})});if(!Lt.ok){const gt=await Lt.json().catch(()=>null),Ln=new Error(gt?.error||gt?.message||`Failed to run selected pages (HTTP ${Lt.status})`);throw gt?.errors&&typeof gt.errors=="object"&&(Ln.limitDetails=gt.errors),Ln}Fo(),a.showToast(`Queued ${ut.length} page run${ut.length===1?"":"s"}.`,{tone:"success"}),Je({}),Ke(gt=>gt+1)}catch(Lt){const gt=new Set(ut.map(String));ie(Ln=>Ln.map(yi=>gt.has(String(yi.id))?{...yi,status:"idle"}:yi)),u.handleApiError(Lt)||a.showToast(Lt?.message||"Failed to run selected pages",{tone:"error"})}}},Il=async()=>{if(!w||Q||Kn)return;const It=e,Dt=n;if(!(!It||!Dt)){Ga(!0);try{const ut=await ue(`/api/v1/organizations/${It}/projects/${Dt}/site_audit_pages/sync_pages`,{method:"POST"}),Lt=await ut.json().catch(()=>({}));if(!ut.ok){const gt=new Error(Lt?.error||Lt?.message||`Failed to sync pages (HTTP ${ut.status})`);throw Lt?.errors&&typeof Lt.errors=="object"&&(gt.limitDetails=Lt.errors),gt.status=ut.status,gt}Lt?.credits_charged&&Lt.credits_charged>0&&Fo(),S("running"),A("sync"),B(null),M(!1),H(!1),a.showToast("Syncing pages⦠this can take a few minutes.",{tone:"info",durationMs:4500})}catch(ut){u.handleApiError(ut)||a.showToast(ut?.message||"Failed to sync pages",{tone:"error"})}finally{Ga(!1)}}},Pl=async()=>{const It=e,Dt=n;if(!(!It||!Dt)){Or(!0);try{const ut=mo.trim()||null,Lt=await ue(`/api/v1/organizations/${It}/projects/${Dt}/site_audit_pages/update_sitemap`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({sitemap_url:ut})}),gt=await Lt.json().catch(()=>({}));if(!Lt.ok){a.showToast(gt?.error||"Failed to update sitemap",{tone:"error"});return}Va(gt.sitemap_url??ut),Kr(gt.sitemap_source??(ut?"manual":null)),ja(""),a.showToast(ut?"Sitemap updated. Sync pages to refresh.":"Sitemap removed.",{tone:"success",durationMs:4e3})}catch(ut){a.showToast(ut?.message||"Failed to update sitemap",{tone:"error"})}finally{Or(!1)}}},Kd=async()=>{const It=e,Dt=n;if(!(!It||!Dt)){Or(!0);try{const ut=await ue(`/api/v1/organizations/${It}/projects/${Dt}/site_audit_pages/update_sitemap`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({sitemap_url:null})}),Lt=await ut.json().catch(()=>({}));if(!ut.ok){a.showToast(Lt?.error||"Failed to remove sitemap",{tone:"error"});return}Va(null),Kr(null),ja(""),a.showToast("Sitemap removed.",{tone:"success",durationMs:3e3})}catch(ut){a.showToast(ut?.message||"Failed to remove sitemap",{tone:"error"})}finally{Or(!1)}}},Ki=async()=>{const It=e,Dt=n;if(!(!It||!Dt)){to(!0);try{const ut=_a.split(` 14576`).map(yi=>yi.trim()).filter(Boolean),Lt=await ue(`/api/v1/organizations/${It}/projects/${Dt}/site_audit_pages/update_auto_audit_exclusions`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({patterns:ut})}),gt=await Lt.json().catch(()=>({}));if(!Lt.ok){a.showToast(gt?.error||"Failed to update exclusions",{tone:"error"});return}const Ln=Array.isArray(gt?.auto_audit_exclusion_patterns)?gt.auto_audit_exclusion_patterns.map(String):ut;Hd(Ln),kl(Ln.join(` 14577`)),a.showToast("Automatic audit exclusions updated.",{tone:"success"})}catch(ut){a.showToast(ut instanceof Error?ut.message:"Failed to update exclusions",{tone:"error"})}finally{to(!1)}}},Ia=async(It=!1)=>{if(!w)return;const Dt=e,ut=n;if(!(!Dt||!ut)){It?So(!0):_l(!0);try{const gt=await ue(`/api/v1/organizations/${Dt}/projects/${ut}/site_audit_pages/run_audit${It?"?free=true":""}`,{method:"POST"}),Ln=await gt.json().catch(()=>({}));if(!gt.ok){u.handleApiError({message:Ln?.error,status:gt.status})||a.showToast(Ln?.error||"Failed to start audit",{tone:"error"});return}S("running"),B(null),M(!1),H(!1),It||Fo(),a.showToast("Audit started â discovering pages and running checks. This may take a few minutes.",{tone:"info",durationMs:6e3})}catch(Lt){a.showToast(Lt?.message||"Failed to start audit",{tone:"error"})}finally{It?So(!1):_l(!1)}}},Pa=l.useMemo(()=>Qht({projectName:y?.name,activeTab:We,siteScore:Ae,siteTechnicalScore:tn,siteContentScore:xn,pagesAudited:qe,totalPages:ee||se,issueCounts:Ct,topIssues:Ge,summary:pt}),[y?.name,We,Ae,tn,xn,qe,ee,se,Ct,Ge,pt]),Aa=async()=>
14577{if(!w)return!1;const It=e,Dt=n;if(!It||!Dt)return!1;const ut=ta.trim();if(!ut)return Xa("URL is required."),!1;const Lt=yi=>String(yi||"").trim().toLowerCase().replace(/^www\./,""),gt=y?.website?String(y.website):"",Ln=(()=>{if(!gt)return"";try{const yi=new URL(gt.match(/^https?:\/\//i)?gt:`https://${gt}`);return Lt(yi.hostname||"")}catch{return""}})();if(ut.startsWith("/")){if(!Ln)return Xa("Project website is required to add pages by path (e.g. /pricing)."),!1}else{if(!Ln)return Xa("Project website is invalid; please update it before adding pages."),!1;try{const yi=ut.match(/^https?:\/\//i)?ut:`https://${ut}`,Jt=new URL(yi),Qn=Lt(Jt.hostname||"");if(Qn&&Qn!==Ln){const Ja=`URL must be on the project domain (${Ln}).`;return Xa(Ja),!1}}catch{}}Up(!0),Xa(null);try{const yi=await ue(`/api/v1/organizations/${It}/projects/${Dt}/site_audit_pages`,{method:"POST",body:JSON.stringify({url:ut,kind:ps,in_home_nav:na})}),Jt=await yi.json().catch(()=>({}));if(!yi.ok){const Qn=new Error(Jt?.error||Jt?.message||`Failed to create page (HTTP ${yi.status})`);throw Jt?.errors&&typeof Jt.errors=="object"&&(Qn.limitDetails=Jt.errors),Qn}return a.showToast("Page added.",{tone:"success"}),Sa(!1),Du(""),lc("other"),Ya(!1),Ke(Qn=>Qn+1),!0}catch(yi){if(!u.handleApiError(yi)){const Jt=yi?.message||"Failed to create page";Xa(Jt),a.showToast(Jt,{tone:"error"})}return!1}finally{Up(!1)}};return t.jsxs(Tht,{children:[t.jsxs(Eht,{children:[t.jsx(Fy,{title:"Site Audit"}),t.jsx("div",{style:{paddingRight:8}
14577,children:t.jsx(qr,{items:[{label:"Projects",to:e?`/workspaces/${e}`:void 0},{label:y?.name||"Project",to:e&&n?q:void 0},{label:"Site Audit"}]})})]}),yt?qd?t.jsx("div",{style:{marginTop:"0.75rem"},children:t.jsx(lpt,{page:qd,previousScore:null,onBack:()=>Le(null),onRunAudit:Bu,canManage:w,enumRunning:Q,actions:Zc,actionsLoading:ds,showCompletedActions:Js,onToggleCompleted:()=>Fp(It=>!It),onCompleteAction:$l,onReopenAction:Lu,onSendToContentAgent:td,agentsContentHref:nd,onNavigateToCategory:It=>{const Dt=Yj[It];ze(It),Qe(Dt),r(ut=>{const Lt=new URLSearchParams(ut);return Lt.delete("page"),Lt.set("tab",Dt),Lt})},onPillarClick:It=>{Qe(It),r(Dt=>{const ut=new URLSearchParams(Dt);return ut.delete("page"),ut.set("tab",It),ut})}})}):Vr?t.jsxs("div",{style:{marginTop:"1.5rem",display:"flex",flexDirection:"column",gap:"1rem"},children:[t.jsx(nt,{height:"2rem",width:"8rem"}),t.jsx(nt,{height:"8rem"}),t.jsx(nt,{height:"16rem"})]}):t.jsxs("div",{style:{marginTop:"1.5rem",textAlign:"center",color:z,fontSize:"0.85rem"},children:[t.jsx("p",{children:"Page not found."}),t.jsx(he,{size:"sm",variant:"ghost",onClick:()=>Le(null),style:{marginTop:"0.5rem"},children:"Back"})]}):t.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",minHeight:0},children:[t.jsxs("div",{style:{display:"flex",alignItems:"flex-end",justifyContent:"space-between",gap:"1rem",marginTop:"0.35rem",borderBottom:`1px solid ${V}`},children:[t.jsx("div",{style:{flex:"1 1 0",minWidth:0},children:t.jsx(RP,{ariaLabel:"Site Audit sub-navigation",activeKey:We,onChange:It=>be(It),marginTop:"0",showDivider:!1,tabs:[{key:"dashboard",label:"Dashboard"},{key:"pages",label:`Pages${ee?` (${ee})`:""}`},{key:"technical",label:"Technical"},{key:"content",label:"Content"},{key:"competitors",label:"Competitors"}]})}),!(Ae==null&&qe===0&&!Vr)&&t.jsxs(eft,{children:[t.jsxs(he,{type:"button",size:"sm",variant:"outline",onClick:()=>pe(!0),children:[t.jsx(W5,{size:13}),t.jsx(LX,{children:"Report"})]}),w&&t.jsx(he,{type:"button",size:"sm",variant:"primary",leftIcon:rc||Q?t.jsx(Ng,{size:14}):t.jsx(Sn,{size:14}),onClick:()=>cs(!0),disabled:rc||Q,title:Q?"Audit is runningâ¦":"Run full site audit",children:t.jsx(LX,{children:Q?"Audit runningâ¦":"Run Audit"})})]})]}),Q&&t.jsxs(Vht,{children:[t.jsx(Ng,{size:15,stroke:"rgb(79,70,229)"}),t.jsx("span",{children:U==="synthesizing"?"Almost done â generating insights and top prioritiesâ¦":X==="sync"?"Syncing pages â discovering and updating your site pagesâ¦":"Audit in progress â running checks across your pagesâ¦"}),t.jsx(Kht,{})]}),!Q&&T&&!R&&se>0&&t.jsxs(BX,{children:[t.jsx(ei,{size:15}),t.jsxs("span",{children:["Not all pages could be discovered â the crawl timed out before finishing. The ",se," page",se!==1?"s":""," shown may not represent your full site. Try running the audit again, or add missing pages manually."]}),t.jsx(FX,{onClick:()=>F(!0),children:t.jsx(Ei,{size:14})})]}),We==="dashboard"&&t.jsxs("div",{style:{marginTop:"1rem"},children:[!Q&&!Vr&&Ae==null&&se>0&&!Y&&(()=>{const It=Ge.some(yi=>yi.code==="possible_blocking_detected"),Dt=Ge.some(yi=>yi.code==="ssl_certificate_invalid"),ut=String(ke?.vendor||"").trim(),Lt=ut&&!/unknown/i.test(ut),gt=ke?.http_status?`HTTP ${ke.http_status}`:null,Ln=Jht(ke);return t.jsxs(BX,{style:{marginBottom:"1rem",marginTop:0},children:[t.jsx(ei,{size:15}),t.jsx("span",{children:It?t.jsxs(t.Fragment,{children:[t.jsx("strong",{children:Lt?`${ut} is blocking our auditor.`:"Your site is blocking our auditor (firewall / WAF detected)."})," ","Scores can't be calculated until our scanner can reach your pages",gt?` (${gt})`:"","."," ",Ln?t.jsxs(t.Fragment,{children:[Ln.label,": ",t.jsx("code",{children:Ln.value}),". "]}):null,"Allowlist our auditor in ",Lt?ut:"your firewall / WAF"," and re-run the audit."]}):Dt?t.jsxs(t.Fragment,{children:[t.jsx("strong",{children:"Your site's SSL certificate is invalid."})," ","Scores can't be calculated until we can connect securely. See the Issues tab for details."]}):t.jsx(t.Fragment,{children:"Scores are unavailable â we couldn't access any of your pages during the audit. Check the Issues tab for details on what went wrong."})}),t.jsx(FX,{onClick:()=>H(!0),children:t.jsx(Ei,{size:14})})]})})(),t.jsx(Ppt,{loading:Vr,siteScore:Ae,siteTechnicalScore:tn,siteContentScore:xn,siteSubcategoryScores:Wt,previousSiteSubcategoryScores:Yt,issueCounts:Ct,categoryBreakdown:ae,topIssues:Ge,llmSummary:pt,pagesAudited:qe??ee,totalPages:ee||se,scoreHistory:Mn,onPriorityClick:(It,Dt)=>{const ut=["performance","crawlability","security","structured_data"].includes(It)?"technical":"content";ze(It),vt(Dt),be(ut)},onRunInitialAudit:w?()=>Ia(!0):void 0,initialAuditLoading:Ro,enumRunning:Q,enumMode:X,enumError:K,onPillarClick:It=>be(It)})]}),We==="technical"&&t.jsx("div",{style:{marginTop:"1rem"},children:t.jsx(mX,{workspaceId:e||"",projectId:n||"",pillar:"technical",siteCategoryScores:Wt,categoryBreakdown:ae,pages:ce,initialCategory:rt,highlightIssueCode:lt,onHighlightConsumed:()=>vt(void 0),schemaData:dn,crawlabilityData:bn,performanceData:Kt,metadataData:pn,linksData:Ii,securityData:di,contentQualityData:Gr,contentStructureData:Qc,aeoData:jl,onNavigateToPage:It=>{dc(It)},canManageSiteAudit:w,agentsContentTabHref:nd})}),We==="content"&&t.jsx("div",{style:{marginTop:"1rem"},children:t.jsx(mX,{workspaceId:e||"",projectId:n||"",pillar:"content",siteCategoryScores:Wt,categoryBreakdown:ae,pages:ce,initialCategory:rt,highlightIssueCode:lt,onHighlightConsumed:()=>vt(void 0),schemaData:dn,crawlabilityData:bn,performanceData:Kt,metadataData:pn,linksData:Ii,securityData:di,contentQualityData:Gr,contentStructureData:Qc,aeoData:jl,onNavigateToPage:It=>{dc(It)},canManageSiteAudit:w,agentsContentTabHref:nd})}),We==="competitors"&&t.jsx("div",{style:{marginTop:"1rem"},children:t.jsx(Nht,{workspaceId:e||"",projectId:n||"",canManage:w,refreshTick:Wp})}),We==="pages"&&t.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",minHeight:0},children:t.jsxs(Mht,{style:{marginTop:"1rem",display:"flex",flexDirection:"column",flex:1,minHeight:0,overflow:"hidden"},children:[t.jsx(Lht,{children:t.jsx("div",{style:{minWidth:0},children:t.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[t.jsxs(Bht,{children:["Pages",se>0?` (${se})`:""]}),t.jsx(at,{content:"Run audits on individual pages or all pages at once to get fresh findings.",size:"sm",maxWidth:360,children:t.jsx("span",{style:{display:"inline-flex",alignItems:"center",color:"rgba(107,114,128,0.9)"},"aria-label":"About Pages",children:t.jsx(wn,{size:16})})})]})})}),t.jsxs(Rht,{children:[t.jsxs(Oht,{children:[Oo?t.jsx(Hht,{$tone:"danger",title:Oo,children:t.jsx("span",{style:{fontSize:12,fontWeight:900,color:Ut},children:"Failed to load pages"})}):null,t.jsx("div",{style:{width:180,flex:"0 0 180px"},children:t.jsx(Fn,{options:cc,value:je,onChange:It=>{oe(1),Me(It)},size:"sm",dropdownPortal:!0})}),t.jsx("div",{style:{width:140,flex:"0 0 140px"},children:t.jsx(Fn,{options:hh,value:Se,onChange:It=>{oe(1),it(It)},size:"sm",dropdownPortal:!0})}),t.jsx(Ed,{value:De,onChange:It=>{oe(1),te(It)},placeholder:"Search pagesâ¦",containerStyle:{width:"16rem",minWidth:0}})]}),t.jsx(Dht,{children:w?t.jsxs(t.Fragment,{children:[t.jsx(he,{type:"button",size:"sm",variant:"primary",leftIcon:t.jsx($xe,{size:14}),onClick:()=>{ja(""),kl(ea.join(` 14578`)),Xa(null),Du(""),lc("other"),Ya(!1),Sa(!0)},title:"Manage sitemap & add pages",children:"Manage pages"}),t.jsx(at,{content:Qa>0?`Run audit on ${Qa} selected page(s)`:"Select pages to run",placement:"top",onlyIfTruncated:!1,children:t.jsx("span",{style:{display:"inline-flex"},children:t.jsxs(he,{type:"button",size:"sm",variant:"outline",leftIcon:t.jsx(eh,{size:14}),onClick:()=>void Za(),disabled:Q||Qa<=0,children:["Run selected",Qa>0?` (${Qa})`:""]})})})]}):null})]}),t.jsx(Fht,{style:{flex:1,minHeight:200},children:t.jsxs(Wht,{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[w&&t.jsx(Gh,{style:{width:40},children:t.jsx("input",{type:"checkbox","aria-label":"Select all visible pages",checked:ka,onChange:It=>_r(It.target.checked)})}),t.jsx(Gh,{style:{width:240},children:t.jsxs(Kw,{type:"button",$active:Re==="path",onClick:()=>ti("path"),"aria-label":"Sort by page path",children:["Page ",Ts("path")]})}),t.jsx(Gh,{style:{width:90,minWidth:90},children:t.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:3,flexShrink:0},children:[t.jsxs(Kw,{type:"button",$active:Re==="score",onClick:()=>ti("score"),"aria-label":"Sort by score",children:["Score ",Ts("score")]}),t.jsx(at,{content:"Overall page health score (0â100) from the latest completed run.",placement:"top",onlyIfTruncated:!1,children:t.jsx("span",{style:{display:"inline-flex",alignItems:"center",color:"rgba(107,114,128,0.9)",flexShrink:0},"aria-label":"Score info",children:t.jsx(wn,{size:12})})})]})}),t.jsx(Gh,{style:{width:90,minWidth:85},children:t.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:3,flexShrink:0},children:[t.jsxs(Kw,{type:"button",$active:Re==="technical_score",onClick:()=>ti("technical_score"),"aria-label":"Sort by technical score",children:["Tech ",Ts("technical_score")]}),t.jsx(at,{content:"Technical pillar score (Performance, Crawlability, Security, Structured Data)",placement:"top",onlyIfTruncated:!1,children:t.jsx("span",{style:{display:"inline-flex",alignItems:"center",color:"rgba(107,114,128,0.9)",flexShrink:0},"aria-label":"Tech info",children:t.jsx(wn,{size:12})})})]})}),t.jsx(Gh,{style:{width:100,minWidth:95},children:t.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:3,flexShrink:0},children:[t.jsxs(Kw,{type:"button",$active:Re==="content_score",onClick:()=>ti("content_score"),"aria-label":"Sort by content score",children:["Content ",Ts("content_score")]}),t.jsx(at,{content:"Content pillar score (Quality, Structure, Meta & On-Page, AEO Readiness)",placement:"top",onlyIfTruncated:!1,children:t.jsx("span",{style:{display:"inline-flex",alignItems:"center",color:"rgba(107,114,128,0.9)",flexShrink:0},"aria-label":"Content info",children:t.jsx(wn,{size:12})})})]})}),t.jsx(Gh,{style:{width:120},children:t.jsx(Xht,{label:"Issues",info:"Open issues by severity (High, Medium, Low)."})}),t.jsx(Gh,{style:{width:100},children:t.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:3,flexShrink:0},children:[t.jsxs(Kw,{type:"button",$active:Re==="last_run",onClick:()=>ti("last_run"),"aria-label":"Sort by last run",children:["Last run ",Ts("last_run")]}),t.jsx(at,{content:"Timestamp of the most recent run (viewer timezone).",placement:"top",onlyIfTruncated:!1,children:t.jsx("span",{style:{display:"inline-flex",alignItems:"center",color:"rgba(107,114,128,0.9)",flexShrink:0},"aria-label":"Last run info",children:t.jsx(wn,{size:12})})})]})}),t.jsx(Gh,{style:{width:100,textAlign:"right"},children:"Actions"})]})}),t.jsx("tbody",{children:Vr&&ce.length===0?$a(8):Oo?t.jsx("tr",{children:t.jsx(Ms,{colSpan:Vd,style:{whiteSpace:"normal"},children:t.jsx("div",{style:{padding:"0.75rem 0.6rem"},children:t.jsx(xd,{style:{color:Ut},children:Oo})})})}):ce.length===0&&ee>0&&(je||Se||De.trim())?t.jsx("tr",{children:t.jsx(Ms,{colSpan:Vd,style:{whiteSpace:"normal"},children:t.jsxs("div",{style:{padding:"2rem 0.6rem",textAlign:"center"},children:[t.jsx(xd,{style:{fontSize:"0.85rem",fontWeight:700},children:"No pages match your filters."}),t.jsx(xd,{style:{marginTop:4}
14578,children:"Try adjusting or clearing your filters to see results."})]})})}):ce.length===0?t.jsx("tr",{children:t.jsx(Ms,{colSpan:Vd,style:{whiteSpace:"normal"},children:t.jsx("div",{style:{padding:"0.75rem 0.6rem"},children:t.jsx(Sp,{initialCrunching:!!G,failed:!!L,crunchingTitle:"Enumerating pages",crunchingSubtitle:"Finding pages on your site. This can take up to 20 minutes on large sites.",failedTitle:"Page enumeration failed",failedSubtitle:$?`We couldnât enumerate your pages. ${$}`:"We couldnât enumerate your pages.",subtitle:String(P||j||"").toLowerCase()==="succeeded"&&_===0?"We werenât able to find any pages on your site. Add a page manually or try syncing again.":"We werenât able to find any pages on your site. Add a page manually to get started."})})})}):Cr.map(It=>{const Dt=It.page,ut=typeof Dt.score=="number"&&Number.isFinite(Dt.score)?Dt.score:null;return t.jsxs(Uht,{$selected:!1,role:"button",tabIndex:0,"aria-label":`Open page details: ${Dt.path}`,onClick:()=>dc(Dt.id),onKeyDown:Lt=>{(Lt.key==="Enter"||Lt.key===" ")&&(Lt.preventDefault(),dc(Dt.id))},children:[w&&t.jsx(Ms,{children:t.jsx("input",{type:"checkbox","aria-label":`Select ${Dt.path}`,checked:!!ge[Dt.id],onClick:Lt=>Lt.stopPropagation(),onChange:Lt=>Gd(Dt.id,Lt.target.checked)})}),t.jsx(Ms,{children:t.jsxs("div",{title:Dt.path,style:{minWidth:0},children:[t.jsx("div",{style:{fontWeight:950,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:Dt.title}),t.jsx(xd,{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:Dt.path})]})}),t.jsx(Ms,{children:Dt.status==="running"?t.jsx(Ng,{}):ut===null&&Dt.audit_error_message?t.jsx(at,{content:Dt.audit_error_message,children:t.jsx("span",{style:{fontSize:"0.75rem",fontWeight:600,color:"#DC2626",cursor:"default"},children:Dt.audit_error_message==="ssl_error"?"SSL error":Dt.audit_error_message==="timeout"?"Timeout":Dt.audit_error_message==="connection_error"?"Unreachable":Dt.audit_error_message==="blocked"?"Blocked":Dt.audit_error_message==="js_required"?"JS required":"Failed"})}):ut===null?t.jsx(xd,{children:"â"}):t.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,fontWeight:800,fontSize:"0.8125rem",color:os(ut)},children:[t.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:os(ut)}}),Math.round(ut)]})}),t.jsx(Ms,{children:Dt.technical_score!=null?t.jsx("span",{style:{fontWeight:700,fontSize:"0.8rem",color:os(Dt.technical_score)},children:Math.round(Dt.technical_score)}):t.jsx(xd,{children:"â"})}),t.jsx(Ms,{children:Dt.content_score!=null?t.jsx("span",{style:{fontWeight:700,fontSize:"0.8rem",color:os(Dt.content_score)},children:Math.round(Dt.content_score)}):t.jsx(xd,{children:"â"})}),t.jsx(Ms,{children:Dt.status==="running"?t.jsx(Ng,{}):t.jsxs(qht,{children:[t.jsx(Ght,{children:Dt.open_actions_count}),(Dt.open_actions_by_severity?.high??0)>0&&t.jsxs(M7,{$tone:"danger",children:[Dt.open_actions_by_severity.high,"H"]}),(Dt.open_actions_by_severity?.medium??0)>0&&t.jsxs(M7,{$tone:"warn",children:[Dt.open_actions_by_severity.medium,"M"]}),(Dt.open_actions_by_severity?.low??0)>0&&t.jsxs(M7,{$tone:"ok",children:[Dt.open_actions_by_severity.low,"L"]})]})}),t.jsx(Ms,{children:t.jsx(rr,{value:Dt.last_audited_at,timeZoneMode:"viewer",options:{month:"short",day:"numeric"}})}),t.jsx(Ms,{$right:!0,children:w?t.jsx("div",{style:{display:"inline-flex",gap:6,justifyContent:"flex-end",flexWrap:"nowrap"},children:t.jsx(he,{type:"button",size:"sm",variant:"outline",leftIcon:Dt.status==="running"?t.jsx(Ng,{size:16}):t.jsx(Sn,{size:14}),onClick:Lt=>{Lt.stopPropagation(),Bu(Dt.id)},disabled:Q||Dt.status==="running",style:{minWidth:60,justifyContent:"center",whiteSpace:"nowrap"},children:"Run"})}):null})]},Dt.id)})})]})}),t.jsx(pi,{page:W,totalPages:le,total:se,onPrev:()=>oe(It=>Math.max(1,It-1)),onNext:()=>
14578oe(It=>Math.min(le,It+1))})]})})]}),t.jsx(Hn,{isOpen:zs,onClose:()=>{Yo||gi||Ca||Sa(!1)},size:"md",title:"Manage pages",description:"Configure page discovery and automatic audits.",children:t.jsxs("div",{style:{display:"grid",gap:20},children:[t.jsxs("div",{style:{display:"grid",gap:8},children:[t.jsx("div",{style:{fontSize:12,fontWeight:900,color:"rgba(107,114,128,0.9)",textTransform:"uppercase",letterSpacing:.4},children:"Sitemap"}),an&&!mo.trim()&&!gi?t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,fontSize:13,color:O},children:[t.jsx("a",{href:an,target:"_blank",rel:"noopener noreferrer",style:{color:"rgb(79,70,229)",textDecoration:"none",maxWidth:340,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",display:"inline-block"},title:an,children:an.replace(/^https?:\/\//,"")}),t.jsxs("span",{style:{fontSize:11,color:z},children:["(",Ka==="manual"?"custom":"auto-detected",")"]}),w&&t.jsx("button",{onClick:()=>ja(an),title:"Change sitemap URL",style:{background:"none",border:"none",cursor:"pointer",padding:2,display:"inline-flex",alignItems:"center",color:z,opacity:.7},children:t.jsx(Lc,{size:12})})]}):t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[t.jsx(Xt,{value:mo,onChange:It=>ja(It.target.value),placeholder:"https://example.com/sitemap.xml",disabled:gi,fullWidth:!0}),t.jsx(he,{type:"button",size:"sm",disabled:gi||!mo.trim(),onClick:()=>void Pl(),style:{whiteSpace:"nowrap"},children:gi?"Savingâ¦":"Save"}),an&&t.jsxs(t.Fragment,{children:[t.jsx(he,{type:"button",size:"sm",variant:"outline",onClick:()=>ja(""),disabled:gi,children:"Cancel"}),t.jsx(he,{type:"button",size:"sm",variant:"outline",onClick:()=>void Kd(),disabled:gi,style:{color:Ut},children:"Remove"})]})]}),t.jsx(xd,{children:an?"Pages are synced from this sitemap for free. Change it if your sitemap lives at a different URL.":"No sitemap detected. Add one to sync pages for free, or weâll crawl your site for 25 credits."}),w&&t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,paddingTop:4,flexWrap:"wrap"},children:[t.jsx(he,{type:"button",size:"sm",variant:"outline",leftIcon:Kn||Q?t.jsx(Ng,{size:14}):an?t.jsx(No,{size:14}):t.jsx(Sn,{size:14}),onClick:()=>{Kn||Q||(Il(),Sa(!1))},disabled:Kn||Q,children:Kn||Q?"Syncingâ¦":"Sync pages"}),!an&&t.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:4,padding:"0.2rem 0.5rem",background:"rgba(79, 70, 229, 0.06)",borderRadius:6,border:"1px solid rgba(79, 70, 229, 0.15)"},children:[t.jsx(Sn,{size:12,style:{color:"rgb(79, 70, 229)",flexShrink:0}}),t.jsx("span",{style:{fontSize:11,fontWeight:700,color:O},children:"25 credits"})]}),t.jsx(xd,{style:{fontSize:11},children:an?"Re-fetch pages from your sitemap (free).":"Crawl your site to discover pages."})]})]}),t.jsx("div",{style:{borderTop:`1px solid ${V}`}}),t.jsxs("div",{style:{display:"grid",gap:8},children:[t.jsx("div",{style:{fontSize:12,fontWeight:900,color:"rgba(107,114,128,0.9)",textTransform:"uppercase",letterSpacing:.4},children:"Exclude from automatic audits"}),t.jsx("textarea",{value:_a,onChange:It=>kl(It.target.value),placeholder:`/privacy-policy 14579/blog/*`,disabled:Ca,rows:4,style:{width:"100%",resize:"vertical",border:`1px solid ${V}`,borderRadius:8,padding:"9px 10px",font:"inherit",fontSize:13,color:O}}),t.jsx(xd,{children:"One path per line. Use * as a wildcard. Pages remain available for manual audits."}),t.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:t.jsx(he,{type:"button",size:"sm",onClick:()=>void Ki(),disabled:Ca,children:Ca?"Savingâ¦":"Save exclusions"})})]}),t.jsx("div",{style:{borderTop:`1px solid ${V}`}}),t.jsxs("div",{style:{display:"grid",gap:8},children:[t.jsx("div",{style:{fontSize:12,fontWeight:900,color:"rgba(107,114,128,0.9)",textTransform:"uppercase",letterSpacing:.4},children:"Add a page"}),ed?t.jsx("div",{style:{color:Ut,fontSize:13,fontWeight:650},children:ed}):null,t.jsxs("div",{style:{display:"grid",gap:6},children:[t.jsx(Xt,{value:ta,onChange:It=>Du(It.target.value),placeholder:y?.website?`${String(y.website).replace(/\/+$/,"")}
14579/pricing (or /pricing)`:"https://example.com/pricing (or /pricing)",disabled:Yo,fullWidth:!0}),t.jsx(xd,{children:'Paste a full URL or just a path like "/pricing".'})]}),t.jsxs("div",{style:{display:"flex",gap:10,alignItems:"flex-end"},children:[t.jsxs("div",{style:{display:"grid",gap:4,flex:1},children:[t.jsx("div",{style:{fontSize:11,fontWeight:700,color:"rgba(107,114,128,0.9)",textTransform:"uppercase",letterSpacing:.3},children:"Kind"}),t.jsx(Fn,{options:Hp,value:ps,onChange:It=>lc(It==="main"||It==="content"||It==="docs"||It==="other"?It:"other"),size:"sm",dropdownPortal:!0,disabled:Yo})]}),t.jsxs("div",{role:"button",tabIndex:0,onClick:()=>{Yo||Ya(It=>!It)},onKeyDown:It=>{(It.key===" "||It.key==="Enter")&&(It.preventDefault(),Yo||Ya(Dt=>!Dt))},style:{display:"inline-flex",alignItems:"center",gap:6,paddingBottom:4,cursor:Yo?"not-allowed":"pointer",userSelect:"none"},children:[t.jsx(Yht,{as:"span",$checked:na,$disabled:Yo,children:na&&t.jsx(Zn,{size:10,color:"#fff",strokeWidth:3})}),t.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,fontSize:12,fontWeight:500,whiteSpace:"nowrap",color:O},children:["In home nav",t.jsx(at,{content:"Marks this page as a primary navigation page.",placement:"top",onlyIfTruncated:!1,children:t.jsx("span",{style:{display:"inline-flex",alignItems:"center",color:z},"aria-label":"Home navigation info",children:t.jsx(wn,{size:13})})})]})]})]}),t.jsx("div",{style:{display:"flex",justifyContent:"flex-end",paddingTop:4},children:t.jsx(he,{type:"button",size:"sm",leftIcon:t.jsx(gr,{size:14}),disabled:Yo||!ta.trim(),onClick:()=>void Aa(),children:Yo?"Addingâ¦":"Add page"})})]})]})}),t.jsx(Hn,{isOpen:ic,onClose:()=>cs(!1),size:"sm",title:"Run full audit?",description:`Re-audits your top ${Ns} most important pages (homepage, navigation and key pages) and refreshes your scores.`,footer
14579:t.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:10},children:[t.jsx(he,{type:"button",size:"sm",variant:"outline",onClick:()=>cs(!1),children:"Cancel"}),t.jsx(he,{type:"button",size:"sm",onClick:()=>{cs(!1),Ia(!1)},disabled:rc||Q,leftIcon:rc?t.jsx(Ng,{size:14}):t.jsx(Sn,{size:14}),children:"Run Audit"})]}),children:t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[t.jsx(xd,{children:"This will run checks on your main pages and update your AI Readiness Score and all category scores."}),t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"0.5rem 0.65rem",background:"rgba(79, 70, 229, 0.06)",borderRadius:8,border:"1px solid rgba(79, 70, 229, 0.15)"},children:[t.jsx(Sn,{size:14,style:{color:"rgb(79, 70, 229)",flexShrink:0}}),t.jsxs("span",{style:{fontSize:"0.8rem",fontWeight:700,color:O},children:["Cost: ",t.jsx("strong",{children:"30 credits"})]})]})]})}),t.jsx(l1,{isOpen:u.isOpen,onClose:u.closeOverlay,title:u.overlayState?.title,message:u.overlayState?.message,limitName:u.overlayState?.limitName,limit:u.overlayState?.limit,used:u.overlayState?.used,isOwner:g==="owner",partnerManaged:x,workspaceId:e||""}),t.jsx(die,{isOpen:ht,onClose:()=>pe(!1),workspaceId:e||"",projectId:n||"",reportEnabled:!!h?.report_enabled,whiteLabelEnabled:!!h?.report_white_label,isOwner:g==="owner",onUpgrade:()=>pe(!1),orgLogoUrl:h?.logo_url}),e&&n&&!(Ae==null&&qe===0&&!Vr)?t.jsx(EC,{orgId:Number(e),projectId:Number(n),sessionTitle:Zht(y?.name),initialMessage:Pa,metadata:{resource_type:"site_audit",resource_id:Number(n)},placeholder:"Ask about this auditâ¦",variant:"overlay",launcher:"floating"}):null]})}const nft=p.div.withConfig({displayName:"ConnectionSettingsModal__Body",componentId:"sc-9l119i-0"})` 14580 display: flex; 14581 flex-direction: column; 14582 gap: 20px; 14583 padding: 4px 0; 14584`,pp=p.div.withConfig({displayName:"ConnectionSettingsModal__Field",componentId:"sc-9l119i-1"})` 14585 display: flex; 14586 flex-direction: column; 14587 gap: 6px; 14588`,gm=p.label.withConfig({displayName:"ConnectionSettingsModal__Label",componentId:"sc-9l119i-2"})` 14589 font-size: 0.8125rem; 14590 font-weight: 600; 14591 color: ${O}; 14592`,zg=p.p.withConfig({displayName:"ConnectionSettingsModal__HelpText",componentId:"sc-9l119i-3"})` 14593 font-size: 0.75rem; 14594 color: ${z}; 14595 margin: 0; 14596`,Yw=p.input.withConfig({displayName:"ConnectionSettingsModal__SearchInput",componentId:"sc-9l119i-4"})` 14597 width: 100%; 14598 padding: 8px 12px; 14599 border: 1px solid ${V}; 14600 border-radius: 8px; 14601 font-size: 0.8125rem; 14602 outline: none; 14603 background: ${Z}; 14604 color: ${O}; 14605 &::placeholder { 14606 color: ${z}; 14607 } 14608 &:focus { 14609 border-color: var(--color-brand-600); 14610 } 14611`,WX=p.div.withConfig({displayName:"ConnectionSettingsModal__AccountList",componentId:"sc-9l119i-5"})` 14612 max-height: 200px; 14613 overflow-y: auto; 14614 border: 1px solid ${V}; 14615 border-radius: 8px; 14616`,UX=p.button.withConfig({displayName:"ConnectionSettingsModal__AccountItem",componentId:"sc-9l119i-6"})` 14617 width: 100%; 14618 text-align: left; 14619 padding: 10px 12px; 14620 border: none; 14621 background: ${e=>e.$active?"var(--color-brand-50, #EEF2FF)":"transparent"}; 14622 font-size: 0.8125rem; 14623 color: ${O}; 14624 cursor: pointer; 14625 border-bottom: 1px solid ${$e}; 14626 &:last-child { border-bottom: none; } 14627 &:hover { background: ${$e}; } 14628`,HX=p.div.withConfig({displayName:"ConnectionSettingsModal__PaginationRow",componentId:"sc-9l119i-7"})` 14629 display: flex; 14630 justify-content: space-between; 14631 align-items: center; 14632 font-size: 0.75rem; 14633 color: ${z}; 14634`,qX=p.div.withConfig({displayName:"ConnectionSettingsModal__Actions",componentId:"sc-9l119i-8"})` 14635 display: flex; 14636 gap: 8px; 14637 justify-content: space-between; 14638 padding-top: 12px; 14639 border-top: 1px solid ${V}; 14640 flex-wrap: wrap; 14641`,GX=p.div.withConfig({displayName:"ConnectionSettingsModal__Divider",componentId:"sc-9l119i-9"})` 14642 height: 1px; 14643 background: ${V}; 14644`,VX=p.div.withConfig({displayName:"ConnectionSettingsModal__InlineGrid",componentId:"sc-9l119i-10"})` 14645 display: grid; 14646 gap: 12px; 14647 grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); 14648 14649 @media (max-width: 640px) { 14650 grid-template-columns: 1fr; 14651 } 14652`,R7=p.span.withConfig({displayName:"ConnectionSettingsModal__BtnLabel",componentId:"sc-9l119i-11"})` 14653 @media (max-width: 480px) { 14654 display: none; 14655 } 14656`,ift=p.span.withConfig({displayName:"ConnectionSettingsModal__BtnLabelShort",componentId:"sc-9l119i-12"})` 14657 display: none; 14658 @media (max-width: 480px) { 14659 display: inline; 14660 } 14661`,Tg=p.div.withConfig({displayName:"ConnectionSettingsModal__ErrorBanner",componentId:"sc-9l119i-13"})` 14662 display: flex; 14663 gap: 10px; 14664 align-items: flex-start; 14665 padding: 12px 14px; 14666 border-radius: 8px; 14667 background: #FEF2F2; 14668 border: 1px solid #FECACA; 14669 font-size: 0.8125rem; 14670 color: #991B1B; 14671 line-height: 1.5; 14672 14673 svg { flex-shrink: 0; margin-top: 2px; } 14674 14675 a { 14676 color: #991B1B; 14677 font-weight: 600; 14678 text-decoration: underline; 14679 } 14680`;function wx(e){const n=e.toLowerCase();return n.includes("insufficient authentication scopes")||n.includes("permission_denied")?"Google Analytics permissions were not fully granted. Please disconnect and reconnect, making sure to check all permission boxes on the Google consent screen. If you're using a corporate Google account, your organization's admin may need to allow third-party app access.":n.includes("authorization failed")||n.includes("invalid_grant")||n.includes("token has been expired")?"Your Google Analytics authorization has expired or was revoked. Please disconnect and reconnect your account.":n.includes("not connected")?"Google Analytics is not connected yet. Please connect your account first.":e}const I$=20;
14680function rft({isOpen:e,onClose:n,orgId:i,projectId:r,isConnected:o,currentAccountId:s,currentPropertyId:a,connectedEmail:c,connectedVia:u,authStrategy:m,currentTokenSourceId:h,currentExternalProjectId:g,initialExternalOpen:x=!1,onConnectWithOAuth:y,onDisconnected:w,onPropertySelected:j}){const[v,_]=l.useState([]),[$,k]=l.useState([]),[P,S]=l.useState([]),[I,A]=l.useState(null),[E,B]=l.useState(null),[T,M]=l.useState(""),[R,F]=l.useState(""),[Y,H]=l.useState(""),[U,X]=l.useState(""),[Q,K]=l.useState(""),[G,L]=l.useState(1),[q,W]=l.useState(!1),[oe,se]=l.useState(!1),[de,le]=l.useState(!1),[me,ee]=l.useState(!1),[ne,Ae]=l.useState("oauth"),[_e,we]=l.useState(!1),[Ke,ce]=l.useState(null),[ie,Re]=l.useState(null),[Be,tt]=l.useState(null),dt=`/api/v1/organizations/${i}/projects/${r}/google_analytics`,je=`/api/v1/organizations/${i}/google_analytics_token_sources`,Me=m==="external_token_source"||u==="external_token_source",Se=ne==="external"||e&&x&&!Me,it=Se?Me||_e:o,De=l.useCallback(()=>{_([]),A(null),B(null),k([]),K(""),L(1)},[]),te=l.useCallback(async()=>{W(!0),ce(null);try{const be=await ue(`${dt}/accounts`),rt=await be.json();if(!be.ok){ce(rt?.error||rt?.errors?.[0]||"Failed to load Google Analytics accounts."),_([]),W(!1);return}const ze=rt.accounts||[];if(_(ze),s&&(ne==="oauth"||Me)){const lt=ze.findIndex(vt=>vt.account_id===s);lt>=0&&(A(s),L(Math.floor(lt/I$)+1))}}catch(be){ce(be?.message||"Failed to load Google Analytics accounts."),_([])}W(!1)},[dt,s,ne,Me]);l.useEffect(()=>{e&&it&&te()},[e,it,te]);const ge=l.useCallback(async()=>{if(i){se(!0),Re(null);try{const be=await ue(je),rt=await be.json().catch(()=>({}));if(!be.ok)throw new Error(rt?.error||"Failed to load token sources.");S(rt.token_sources||[])}catch(be){Re(be?.message||"Failed to load token sources."),S([])}se(!1)}},[i,je]);l.useEffect(()=>{if(!e)return;M(h?String(h):""),F(g||""),H(Me&&s||""),X(Me&&a||"");const be=x||!o||Me?"external":"oauth";Ae(be),we(Me),be==="external"&&!Me&&De(),ge()},[e,h,g,s,a,x,o,Me,De,ge]);const Je=l.useCallback(async be=>{le(!0),tt(null);try{const rt=await ue(`${dt}/properties?account_id=${be}`),ze=await rt.json();if(!rt.ok){tt(ze?.error||ze?.errors?.[0]||"Failed to load properties."),k([]),le(!1);return}const lt=ze.properties||[];k(lt),a&&(ne==="oauth"||Me)&<.some(vt=>vt.property_id===a)?B(a):B(null)}catch(rt){tt(rt?.message||"Failed to load properties."),k([])}le(!1)},[dt,a,ne,Me]);l.useEffect(()=>{I&&Je(I)},[I,Je]);const Ee=v.filter(be=>!Q||be.account_name.toLowerCase().includes(Q.toLowerCase())),Xe=Math.ceil(Ee.length/I$),yt=Ee.slice((G-1)*I$,G*I$),[Ne,Le]=l.useState(null),Ue=async()=>{if(!T||!R.trim())return;ee(!0),Le(null);const be=v.find(lt=>lt.account_id===I)?.account_name||"",rt=$.find(lt=>lt.property_id===E)?.property_name||"",ze=E||U.trim();try{const lt=await ue(`${dt}/connect_external_source`,{method:"POST",body:JSON.stringify({token_source_id:T,external_project_id:R.trim(),account_id:I||Y.trim()||void 0,property_id:ze||void 0,account_name:be||void 0,property_name:rt||void 0})}),vt=await lt.json().catch(()=>({}));if(!lt.ok){Le(vt?.error||"Failed to connect external token source."),ee(!1);return}we(!0),De(),j(ze||""),ze?n():await te()}catch(lt){Le(lt?.message||"Failed to connect external token source.")}ee(!1)},We=async()=>{if(!I||!E)return;ee(!0),Le(null);const be=v.find(ze=>ze.account_id===I)?.account_name||"",rt=$.find(ze=>ze.property_id===E)?.property_name||"";try{const ze=await ue(`${dt}/select_property`,{method:"POST",body:JSON.stringify({account_id:I,property_id:E,account_name:be,property_name:rt})});if(!ze.ok){const lt=await ze.json().catch(()=>({}));Le(lt?.error||"Failed to save property selection."),ee(!1);return}j(E),n()}catch(ze){Le(ze?.message||"Failed to save property selection.")}ee(!1)},Qe=async()=>{ee(!0);try{await ue(`${dt}/disconnect`,{method:"POST"}),w(),n()}catch{}ee(!1)},ht=$.map(be=>({value:be.property_id,label:`${be.property_name} (${be.property_id})`})),pe=P.map(be=>({value:String(be.id),label:`${be.name}${be.enabled?"":" (disabled)"}`}));return t.jsx(Hn,{isOpen:e,onClose:n,title:"Google Analytics Settings",size:"md",minHeight:"0",children:t.jsx(nft,{children:Se?t.jsxs(t.Fragment,{children:[t.jsx("div",{children:t.jsx(he,{size:"sm",variant:"outline",onClick:()=>y?.(),children:"Use Ceyo OAuth"})}),oe?t.jsx(nt,{style:{width:"100%",height:92}}):t.jsxs(pp,{children:[ie&&t.jsxs(Tg,{children:[t.jsx(ei,{size:16}),t.jsx("span",{children:ie})]}),o&&!Me?t.jsx(zg,{children:"Switching source resets the current GA property and synced analytics data."}):null,P.length===0&&!ie?t.jsx(zg,{children:"No external sources configured. Add one in workspace settings first."}):t.jsxs(t.Fragment,{children:[t.jsxs(VX,{children:[t.jsxs(pp,{children:[t.jsx(gm,{children:"Token source"}),t.jsx(Fn,{options:pe,value:T,onChange:be=>M(be),placeholder:"Select token source...",dropdownPortal:!0})]}
14680),t.jsxs(pp,{children:[t.jsx(gm,{children:"External project ID"}),t.jsx(Yw,{placeholder:"External project id",value:R,onChange:be=>F(be.target.value)})]})]}),t.jsxs(VX,{children:[t.jsxs(pp,{children:[t.jsx(gm,{children:"GA4 account ID"}),t.jsx(Yw,{placeholder:"Optional",value:Y,onChange:be=>H(be.target.value)})]}),t.jsxs(pp,{children:[t.jsx(gm,{children:"GA4 property ID"}),t.jsx(Yw,{placeholder:"Optional",value:U,onChange:be=>X(be.target.value)})]})]}),t.jsx(he,{variant:Me?"outline":"primary",size:"sm",onClick:Ue,disabled:!T||!R.trim()||me,children:me?"Saving...":Me?"Update External Source":"Connect External Source"}),Ne&&t.jsxs(Tg,{children:[t.jsx(ei,{size:16}),t.jsx("span",{children:wx(Ne)})]})]})]}),it?t.jsxs(t.Fragment,{children:[t.jsx(GX,{}),q?t.jsxs(t.Fragment,{children:[t.jsx(nt,{style:{width:"100%",height:36}}),t.jsx(nt,{style:{width:"100%",height:120}})]}):t.jsxs(t.Fragment,{children:[Ke&&t.jsxs(Tg,{children:[t.jsx(ei,{size:16}),t.jsx("span",{children:wx(Ke)})]}),t.jsxs(pp,{children:[t.jsx(gm,{children:"GA4 Account"}),t.jsx(Yw,{placeholder:"Search accounts...",value:Q,onChange:be=>{K(be.target.value),L(1)}}),t.jsxs(WX,{children:[yt.map(be=>t.jsx(UX,{$active:I===be.account_id,onClick:()=>A(be.account_id),children:be.account_name},be.account_id)),yt.length===0&&!Ke&&t.jsx(zg,{style:{padding:12},children:"No accounts found."}),yt.length===0&&Ke&&t.jsx(zg,{style:{padding:12},children:"Could not load accounts. See the error above."})]}),Xe>1&&t.jsxs(HX,{children:[t.jsxs("span",{children:["Page ",G," of ",Xe]}),t.jsxs("div",{style:{display:"flex",gap:4},children:[t.jsx(he,{size:"sm",variant:"outline",disabled:G<=1,onClick:()=>L(be=>be-1),children:"Prev"}),t.jsx(he,{size:"sm",variant:"outline",disabled:G>=Xe,onClick:()=>L(be=>be+1),children:"Next"})]})]})]}),I&&t.jsxs(pp,{children:[t.jsx(gm,{children:"GA4 Property"}),de?t.jsx(nt,{style:{width:"100%",height:36}}):Be?t.jsxs(Tg,{children:[t.jsx(ei,{size:16}),t.jsx("span",{children:wx(Be)})]}):t.jsx(Fn,{options:ht,value:E||"",onChange:be=>B(be),placeholder:"Select a property...",dropdownPortal:!0})]}),t.jsx(he,{variant:"primary",size:"sm",onClick:We,disabled:!E||me,children:me?"Saving...":"Save Property"})]})]}):null,o?t.jsx(qX,{children:t.jsxs(he,{variant:"danger",size:"sm",onClick:Qe,disabled:me,children:[t.jsx(k9,{size:14})," ",t.jsx(R7,{children:"Disconnect"})]})}):null]}):t.jsxs(t.Fragment,{children:[t.jsx("div",{children:t.jsx(he,{size:"sm",variant:"outline",onClick:()=>{Ae("external"),De(),H(""),X("")},children:"Use external source"})}),t.jsx(GX,{}),o?q?t.jsxs(t.Fragment,{children:[t.jsx(nt,{style:{width:"100%",height:36}}),t.jsx(nt,{style:{width:"100%",height:200}})]}):t.jsxs(t.Fragment,{children:[c&&t.jsxs(pp,{children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[t.jsx(gm,{children:"Connected as"}),(u==="api"||u==="external_token_source")&&t.jsx("span",{style:{fontSize:"0.625rem",fontWeight:700,padding:"1px 6px",borderRadius:4,background:"#EEF2FF",color:"#4F46E5",letterSpacing:"0.02em",whiteSpace:"nowrap"},children:u==="external_token_source"?"external source":"via API"})]}),t.jsx(zg,{children:c})]}),Ke&&t.jsxs(Tg,{children:[t.jsx(ei,{size:16}),t.jsx("span",{children:wx(Ke)})]}),t.jsxs(pp,{children:[t.jsx(gm,{children:"GA4 Account"}),t.jsx(Yw,{placeholder:"Search accounts...",value:Q,onChange:be=>{K(be.target.value),L(1)}}),t.jsxs(WX,{children:[yt.map(be=>t.jsx(UX,{$active:I===be.account_id,onClick:()=>A(be.account_id),children:be.account_name},be.account_id)),yt.length===0&&!Ke&&t.jsx(zg,{style:{padding:12},children:"No accounts found."}),yt.length===0&&Ke&&t.jsx(zg,{style:{padding:12},children:"Could not load accounts. See the error above."})]}),Xe>1&&t.jsxs(HX,{children:[t.jsxs("span",{children:["Page ",G," of ",Xe]}),t.jsxs("div",{style:{display:"flex",gap:4},children:[t.jsx(he,{size:"sm",variant:"outline",disabled:G<=1,onClick:()=>L(be=>be-1),children:"Prev"}),t.jsx(he,{size:"sm",variant:"outline",disabled:G>=Xe,onClick:()=>L(be=>be+1),children:"Next"})]})]})]}),I&&t.jsxs(pp,{children:[t.jsx(gm,{children:"GA4 Property"}),de?t.jsx(nt,{style:{width:"100%",height:36}}):Be?t.jsxs(Tg,{children:[t.jsx(ei,{size:16}),t.jsx("span",{children:wx(Be)})]}):t.jsx(Fn,{options:ht,value:E||"",onChange:be=>B(be),placeholder:"Select a property...",dropdownPortal:!0})]}),Ne&&t.jsxs(Tg,{children:[t.jsx(ei,{size:16}),t.jsx("span",{children:wx(Ne)})]}),t.jsxs(qX,{children:[t.jsxs(he,{variant:"danger",size:"sm",onClick:Qe,disabled:me,children:[t.jsx(k9,{size:14})," ",t.jsx(R7,{children:"Disconnect"})]}),t.jsx(he,{variant:"primary",size:"sm",onClick:We,disabled:!E||me,children:me?"Saving...":t.jsxs(t.Fragment,{children:[t.jsx(R7,{children:"Save Property"}),t.jsx(ift,{children:"Save"})]})})]})]}):null]})})})}const oft=p.div.withConfig({displayName:"ProjectAnalyticsPage__Page",componentId:"sc-1jlsjaz-0"})` 14681 padding: 1.25rem; 14682 overflow-x: hidden; 14683`,sft=p.div.withConfig({displayName:"ProjectAnalyticsPage__HeroTo
14683p",componentId:"sc-1jlsjaz-1"})` 14684 display: flex; 14685 align-items: flex-start; 14686 justify-content: space-between; 14687 gap: 1rem; 14688 flex-wrap: wrap; 14689`,aft=p.div.withConfig({displayName:"ProjectAnalyticsPage__TabBar",componentId:"sc-1jlsjaz-2"})` 14690 display: flex; 14691 align-items: flex-end; 14692 gap: 1.5rem; 14693 border-bottom: 1px solid ${V}; 14694 margin-top: 1rem; 14695 overflow-x: auto; 14696 -webkit-overflow-scrolling: touch; 14697`,P$=p.button.withConfig({displayName:"ProjectAnalyticsPage__TabBtn",componentId:"sc-1jlsjaz-3"})` 14698 border: 0; 14699 background: transparent; 14700 padding: 0.35rem 0.15rem; 14701 font-size: 0.95rem; 14702 font-weight: ${e=>e.$active?950:850}; 14703 cursor: ${e=>e.$disabled?"default":"pointer"}; 14704 display: inline-flex; 14705 align-items: center; 14706 gap: 0.35rem; 14707 color: ${e=>e.$active?O:z}; 14708 border-bottom: 3px solid ${e=>e.$active?O:"transparent"}; 14709 opacity: ${e=>e.$disabled?.45:1}; 14710 transition: color 0.15s ease; 14711 user-select: none; 14712 white-space: nowrap; 14713 flex-shrink: 0; 14714 &:hover { 14715 color: ${e=>e.$disabled?z:O}; 14716 } 14717`,lft=p.div.withConfig({displayName:"ProjectAnalyticsPage__Content",componentId:"sc-1jlsjaz-4"})` 14718 margin-top: 1.25rem; 14719 display: flex; 14720 flex-direction: column; 14721 gap: 24px; 14722 min-width: 0; 14723`,cft=p.div.withConfig({displayName:"ProjectAnalyticsPage__ConnBanner",componentId:"sc-1jlsjaz-5"})` 14724 background: ${Z}; 14725 border: 1px solid ${V}; 14726 border-radius: 12px; 14727 padding: 14px 20px; 14728 display: flex; 14729 align-items: center; 14730 gap: 12px; 14731 @media (max-width: 640px) { 14732 flex-wrap: wrap; 14733 } 14734`,dft=p.div.withConfig({displayName:"ProjectAnalyticsPage__ConnLeft",componentId:"sc-1jlsjaz-6"})` 14735 display: flex; 14736 align-items: center; 14737 gap: 8px; 14738 min-width: 0; 14739 flex-shrink: 1; 14740`,uft=p.div.withConfig({displayName:"ProjectAnalyticsPage__ConnCenter",componentId:"sc-1jlsjaz-7"})` 14741 flex: 1; 14742 display: flex; 14743 justify-content: center; 14744 @media (max-width: 640px) { 14745 order: 3; 14746 flex-basis: 100%; 14747 justify-content: flex-start; 14748 } 14749`,pft=p.div.withConfig({displayName:"ProjectAnalyticsPage__ConnRight",componentId:"sc-1jlsjaz-8"})` 14750 display: flex; 14751 align-items: center; 14752 gap: 8px; 14753 flex-shrink: 0; 14754 flex-wrap: wrap; 14755 @media (max-width: 640px) { 14756 order: 2; 14757 margin-left: auto; 14758 flex-basis: 100%; 14759 justify-content: flex-start; 14760 } 14761`,mft=p.span.withConfig({displayName:"ProjectAnalyticsPage__StatusDot",componentId:"sc-1jlsjaz-9"})` 14762 width: 8px; 14763 height: 8px; 14764 border-radius: 50%; 14765 background: ${e=>e.$on?Vt:oi}; 14766 flex-shrink: 0; 14767`,hft=p.span.withConfig({displayName:"ProjectAnalyticsPage__ConnLabel",componentId:"sc-1jlsjaz-10"})` 14768 font-size: 0.8125rem; 14769 font-weight: 600; 14770 color: ${O}; 14771 flex: 1; 14772 min-width: 0; 14773 overflow: hidden; 14774 text-overflow: ellipsis; 14775 white-space: nowrap; 14776 @media (max-width: 480px) { 14777 white-space: normal; 14778 flex-basis: calc(100% - 28px); 14779 } 14780`,KX=p.span.withConfig({displayName:"ProjectAnalyticsPage__ConnMeta",componentId:"sc-1jlsjaz-11"})` 14781 font-size: 0.75rem; 14782 color: ${z}; 14783`,fft=Tn` 14784 from { transform: rotate(0deg); } 14785 to { transform: rotate(360deg); } 14786`,ym=p(No).withConfig({displayName:"ProjectAnalyticsPage__SpinIcon",componentId:"sc-1jlsjaz-12"})` 14787 animation: ${fft} 1s linear infinite; 14788`,gft=p.div.withConfig({displayName:"ProjectAnalyticsPage__AISummary",componentId:"sc-1jlsjaz-13"})` 14789 background: ${cn}; 14790 border: 1px solid ${V}; 14791 border-radius: 12px; 14792 padding: 16px 24px; 14793 display: flex; 14794 align-items: flex-start; 14795 gap: 12px; 14796 @media (max-width: 480px) { 14797 padding: 14px 16px; 14798 } 14799`,Xw=p.div.withConfig({displayName:"ProjectAnalyticsPage__CeyoIcon",componentId:"sc-1jlsjaz-14"})` 14800 width: 32px; 14801 height: 32px; 14802 border-radius: 8px; 14803 background: linear-gradient(135deg, ${ot}, ${Ft}); 14804 display: flex; 14805 align-items: center; 14806 justify-content: center; 14807 color: white; 14808 font-weight: 700; 14809 font-size: 12px; 14810 flex-shrink: 0; 14811`,YX=p.p.withConfig({displayName:"ProjectAnalyticsPage__SummaryMsg",componentId:"sc-1jlsjaz-15"})` 14812 font-size: 0.8125rem; 14813 color: ${O}; 14814 line-height: 1.6; 14815 font-style: italic; 14816 margin: 0; 14817`,XX=p.div.withConfig({displayName:"ProjectAnalyticsPage__SummaryStrip",componentId:"sc-1jlsjaz-16"})` 14818 display: grid; 14819 grid-template-columns: repeat(4, 1fr); 14820 gap: 16px; 14821 @media (max-width: 900px) { 14822 grid-template-columns: repeat(2, 1fr); 14823 } 14824 @media (max-width: 480px) { 14825 grid-template-columns: 1fr; 14826 } 14827`,A$=p.div.withConfig({displayName:"ProjectAnalyticsPage__SummaryCard",componentId:"sc-1jlsjaz-17"})` 14828 background: ${Z}; 14829 border: 1px solid ${V}; 14830 border-radius: 10px; 14831 padding: 16px 20px; 14832 min-width: 0; 14833`,N$=p.div.withConfig({displayName:"ProjectAnalyticsPage__SummaryValue",componentId:"sc-1jlsjaz-18"})` 14834 font-size: 1.75rem; 14835 font-weight: 800; 14836 color: ${e=>e.$color||O}; 14837 @media (max-width: 480px) { 14838 font-size: 1.4rem; 14839 } 14840`,z$=p.div.withConfig({displayName:"ProjectAnalyticsPage__SummaryLabel",componentId:"sc-1jlsjaz-19"})` 14841 font-size: 0.75rem; 14842 color: ${z}; 14843 margin-top: 2px; 14844`,yft=p.span.withConfig({displayName:"ProjectAnalyticsPage__CardHint",componentId:"sc-1jlsjaz-20"})` 14845 font-size: 0.6875rem; 14846 color: ${Pe}; 14847 font-style: italic; 14848 margin-top: 4px; 14849`,jx=p.span.withConfig({displayName:"ProjectAnalyticsPage__TrendBadge",componentId:"sc-1jlsjaz-21"})` 14850 font-size: 0.6875rem; 14851 font-weight: 600; 14852 color: ${e=>e.$positive?Vt:oi}; 14853 display: inline-flex; 14854 align-items: center; 14855 gap: 2px; 14856 margin-top: 6px; 14857`,T$=p.div.withConfig({displayName:"ProjectAnalyticsPage__ChartCard",componentId:"sc-1jlsjaz-22"})` 14858 background: ${Z}; 14859 border: 1px solid ${V}; 14860 border-radius: 12px; 14861 padding: 24px; 14862 min-width: 0; 14863 overflow: hidden; 14864 @media (max-width: 480px) { 14865 padding: 16px 12px; 14866 } 14867`,E$=p.div.withConfig({displayName:"ProjectAnalyticsPage__ChartHeader",componentId:"sc-1jlsjaz-23"})` 14868 display: flex; 14869 align-items: center; 14870 justify-content: space-between; 14871 margin-bottom: 16px; 14872 flex-wrap: wrap; 14873 gap: 8px; 14874`,M$=p.h3.withConfig({displayName:"ProjectAnalyticsPage__ChartTitle",componentId:"sc-1jlsjaz-24"})` 14875 font-size: 0.875rem; 14876 font-weight: 600; 14877 color: ${O}; 14878`,xft=p.button.withConfig({displayName:"ProjectAnalyticsPage__ToggleBtn",componentId:"sc-1jlsjaz-25"})` 14879 display: flex; 14880 align-items: center; 14881 gap: 5px; 14882 padding: 4px 10px; 14883 border-radius: 6px; 14884 font-size: 0.6875rem; 14885 font-weight: 500; 14886 font-family: inherit; 14887 cursor: pointer; 14888 border: 1px solid ${e=>e.$active?ot:V}; 14889 color: ${e=>e.$active?ot:z}; 14890 background: ${e=>e.$active?cn:"transparent"}; 14891 &:hover { 14892 background: ${$e}; 14893 } 14894`,bft=p.div.withConfig({displayName:"ProjectAnalyticsPage__TimeFilters",componentId:"sc-1jlsjaz-26"})` 14895 display: flex; 14896 gap: 4px; 14897 background: ${$e}; 14898 border-radius: 8px; 14899 padding: 3px; 14900`,vft=p.button.withConfig({displayName:"ProjectAnalyticsPage__TimeBtn",componentId:"sc-1jlsjaz-27"})` 14901 padding: 6px 16px; 14902 border-radius: 6px; 14903 font-size: 0.8125rem; 14904 font-weight: 600; 14905 color: ${e=>e.$active?ot:z}; 14906 background: ${e=>e.$active?cn:"transparent"}; 14907 border: none; 14908 cursor: pointer; 14909 font-family: inherit; 14910 &:hover { 14911 background: ${$e}; 14912 } 14913`,wft=p.div.withConfig({displayName:"ProjectAnalyticsPage__PlatformRow",componentId:"sc-1jlsjaz-28"})` 14914 display: flex; 14915 align-items: center; 14916 gap: 12px; 14917 padding: 10px 12px; 14918 border-radius: 8px; 14919 min-width: 0; 14920 @media (max-width: 480px) { 14921 gap: 8px; 14922 padding: 8px 4px; 14923 } 14924`,jft=p.div.withConfig({displayName:"ProjectAnalyticsPage__PlatformIconWrap",componentId:"sc-1jlsjaz-29"})` 14925 width: 24px; 14926 height: 24px; 14927 display: flex; 14928 align-items: center; 14929 justify-content: center; 14930 flex-shrink: 0; 14931 color: ${O}; 14932 svg { 14933 width: 18px; 14934 height: 18px; 14935 } 14936`,_ft=p.div.withConfig({displayName:"ProjectAnalyticsPage__PlatformInitialFallback",componentId:"sc-1jlsjaz-30"})` 14937 width: 24px; 14938 height: 24px; 14939 border-radius: 50%; 14940 background: ${e=>e.$bg}; 14941 display: flex; 14942 align-items: center; 14943 justify-content: center; 14944 color: white; 14945 font-size: 11px; 14946 font-weight: 700; 14947 flex-shrink: 0; 14948`,Cft=p.span.withConfig({displayName:"ProjectAnalyticsPage__PlatformName",componentId:"sc-1jlsjaz-31"})` 14949 font-size: 0.8125rem; 14950 font-weight: 600; 14951 width: 100px; 14952 flex-shrink: 0; 14953 color: ${O}; 14954 @media (max-width: 480px) { 14955 width: 64px; 14956 font-size: 0.75rem; 14957 } 14958`,QX=p.div.withConfig({displayName:"ProjectAnalyticsPage__BarBg",componentId:"sc-1jlsjaz-32"})` 14959 flex: 1; 14960 min-width: 0; 14961 height: 24px; 14962 background: ${$e}; 14963 border-radius: 6px; 14964 overflow: hidden; 14965`,ZX=p.div.withConfig({displayName:"ProjectAnalyticsPage__BarFill",componentId:"sc-1jlsjaz-33"})` 14966 height: 100%; 14967 width: ${e=>e.$width}%; 14968 background: ${e=>e.$color}; 14969 border-radius: 6px; 14970 min-width: 30px; 14971 transition: width 0.4s ease; 14972`,Sft=p.span.withConfig({displayName:"ProjectAnalyticsPage__PlatCount",componentId:"sc-1jlsjaz-34"})` 14973 font-size: 0.8125rem; 14974 font-weight: 700; 14975 width: 60px; 14976 text-align: right; 14977 color: ${O}; 14978 flex-shrink: 0; 14979 @media (max-width: 480px) { 14980 width: 44px; 14981 font-size: 0.75rem; 14982 } 14983`,kft=p.span.withConfig({displayName:"ProjectAnalyticsPage__PlatTrend",componentId:"sc-1jlsjaz-35"})` 14984 font-size: 0.75rem; 14985 font-weight: 600; 14986 width: 60px; 14987 text-align: right; 14988 color: ${e=>e.$up?Vt:oi}; 14989 flex-shrink: 0; 14990 @media (max-width: 480px) { 14991 display: none; 14992 } 14993`,$ft=p.div.withConfig({displayName:"ProjectAnalyticsPage__PlatformHeaderRow",componentId:"sc-1jlsjaz-36"})` 14994 display: flex; 14995 align-items: center; 14996 gap: 12px; 14997 padding: 0 12px 6px; 14998 border-bottom: 1px solid ${V}; 14999 margin-bottom: 2px; 15000 @media (max-width: 480px) { 15001 gap: 8px; 15002 padding: 0 4px 6px; 15003 } 15004`,Ift=p.div.withConfig({displayName:"ProjectAnalyticsPage__PlatHeaderSpacer",componentId:"sc-1jlsjaz-37"})` 15005 width: 24px; 15006 flex-shrink: 0; 15007`,Pft=p.span.withConfig({displayName:"ProjectAnalyticsPage__PlatHeaderName",componentId:"sc-1jlsjaz-38"})` 15008 font-size: 0.6875rem; 15009 font-weight: 600; 15010 text-transform: uppercase; 15011 letter-spacing: 0.04em; 15012 color: ${Pe}; 15013 width: 100px; 15014 flex-shrink: 0; 15015 @media (max-width: 480px) { 15016 width: 64px; 15017 } 15018`,Aft=p.div.withConfig({displayName:"ProjectAnalyticsPage__PlatHeaderBar",componentId:"sc-1jlsjaz-39"})` 15019 flex: 1; 15020 min-width: 0; 15021`,JX=p.span.withConfig({displayName:"ProjectAnalyticsPage__PlatHeaderVal",componentId:"sc-1jlsjaz-40"})` 15022 font-size: 0.6875rem; 15023 font-weight: 600; 15024 text-transform: uppercase; 15025 letter-spacing: 0.04em; 15026 color: ${Pe}; 15027 width: 60px; 15028 text-align: right; 15029 flex-shrink: 0; 15030 @media (max-width: 480px) { 15031 &:last-child { 15032 display: none; 15033 } 15034 width: 44px; 15035 } 15036`,Nft=p.div.withConfig({displayName:"ProjectAnalyticsPage__ConvGrid",componentId:"sc-1jlsjaz-41"})` 15037 display: grid; 15038 grid-template-columns: repeat(3, 1fr); 15039 gap: 16px; 15040 @media (max-width: 640px) { 15041 grid-template-columns: 1fr; 15042 } 15043`,O7=p.div.withConfig({displayName:"ProjectAnalyticsPage__ConvCard",componentId:"sc-1jlsjaz-42"})` 15044 background: ${Z}; 15045 border: 1px solid ${V}; 15046 border-radius: 10px; 15047 padding: 20px; 15048 text-align: center; 15049`,D7=p.div.withConfig({displayName:"ProjectAnalyticsPage__ConvValue",componentId:"sc-1jlsjaz-43"})` 15050 font-size: 1.5rem; 15051 font-weight: 800; 15052 color: ${e=>e.$color||O}; 15053`,L7=p.div.withConfig({displayName:"ProjectAnalyticsPage__ConvRate",componentId:"sc-1jlsjaz-44"})` 15054 font-size: 0.75rem; 15055 color: ${z}; 15056 margin-top: 4px; 15057`,B7=p.div.withConfig({displayName:"ProjectAnalyticsPage__ConvLabel",componentId:"sc-1jlsjaz-45"})` 15058 font-size: 0.75rem; 15059 color: ${z}; 15060 margin-top: 2px; 15061`,R$=p.div.withConfig({displayName:"ProjectAnalyticsPage__NoConvBanner",componentId:"sc-1jlsjaz-46"})` 15062 background: ${cn}; 15063 border: 1px solid ${V}; 15064 border-radius: 10px; 15065 padding: 14px 16px; 15066 margin-top: 12px; 15067`,O$=p.button.withConfig({displayName:"ProjectAnalyticsPage__NoConvHeader",componentId:"sc-1jlsjaz-47"})` 15068 display: flex; 15069 align-items: center; 15070 gap: 8px; 15071 width: 100%; 15072 background: none; 15073 border: none; 15074 cursor: pointer; 15075 padding: 0; 15076 font-family: inherit; 15077 text-align: left; 15078`,D$=p.span.withConfig({displayName:"ProjectAnalyticsPage__NoConvTitle",componentId:"sc-1jlsjaz-48"})` 15079 font-size: 0.8125rem; 15080 font-weight: 600; 15081 color: ${O}; 15082 flex: 1; 15083`,L$=p.div.withConfig({displayName:"ProjectAnalyticsPage__NoConvBody",componentId:"sc-1jlsjaz-49"})` 15084 margin-top: 12px; 15085 padding-top: 12px; 15086 border-top: 1px solid ${V}; 15087 font-size: 0.8125rem; 15088 color: ${z}; 15089 line-height: 1.7; 15090`,F7=p.ol.withConfig({displayName:"ProjectAnalyticsPage__StepList",componentId:"sc-1jlsjaz-50"})` 15091 margin: 8px 0 0; 15092 padding-left: 20px; 15093 display: flex; 15094 flex-direction: column; 15095 gap: 6px; 15096`,ol=p.li.withConfig({displayName:"ProjectAnalyticsPage__StepItem",componentId:"sc-1jlsjaz-51"})` 15097 color: ${O}; 15098 font-size: 0.8125rem; 15099 line-height: 1.5; 15100 & strong { 15101 font-weight: 600; 15102 } 15103`,Qw=p.div.withConfig({displayName:"ProjectAnalyticsPage__SyncingBanner",componentId:"sc-1jlsjaz-52"})` 15104 background: ${cn}; 15105 border: 1px solid ${V}; 15106 border-radius: 12px; 15107 padding: 24px; 15108 display: flex; 15109 flex-direction: column; 15110 align-items: center; 15111 gap: 12px; 15112 text-align: center; 15113`,_x=p.span.withConfig({displayName:"ProjectAnalyticsPage__SyncingTitle",componentId:"sc-1jlsjaz-53"})` 15114 font-size: 0.875rem; 15115 font-weight: 700; 15116 color: ${O}; 15117`,Cx=p.span.withConfig({displayName:"ProjectAnalyticsPage__SyncingSub",componentId:"sc-1jlsjaz-54"})` 15118 font-size: 0.8125rem; 15119 color: ${z}; 15120 line-height: 1.5; 15121`,zft=p.div.withConfig({displayName:"ProjectAnalyticsPage__ErrorBanner",componentId:"sc-1jlsjaz-55"})` 15122 background: ${kn}; 15123 border: 1px solid ${Er}; 15124 border-radius: 10px; 15125 padding: 12px 16px; 15126 font-size: 0.8125rem; 15127 color: ${oi}; 15128 display: flex; 15129 align-items: center; 15130 gap: 8px; 15131`,Tft=p.div.withConfig({displayName:"ProjectAnalyticsPage__ConnectCTA",componentId:"sc-1jlsjaz-56"})` 15132 display: flex; 15133 flex-direction: column; 15134 align-items: center; 15135 justify-content: center; 15136 gap: 24px; 15137 padding: 60px 20px 80px; 15138 text-align: center; 15139 @media (max-width: 480px) { 15140 padding: 40px 12px 60px; 15141 gap: 20px; 15142 } 15143 svg { 15144 max-width: 100%; 15145 height: auto; 15146 } 15147`,Eft=p.h2.withConfig({displayName:"ProjectAnalyticsPage__CTATitle",componentId:"sc-1jlsjaz-57"})` 15148 font-size: 1.3rem; 15149 font-weight: 800; 15150 color: ${O}; 15151 margin: 0; 15152`,W7=p.p.withConfig({displayName:"ProjectAnalyticsPage__CTASub",componentId:"sc-1jlsjaz-58"})` 15153 font-size: 0.875rem; 15154 color: ${z}; 15155 max-width: 440px; 15156 line-height: 1.6; 15157 margin: 0; 15158`;function Mft(){return t.jsxs("svg",{width:"220",height:"140",viewBox:"0 0 220 140",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[t.jsx("rect",{x:"10",y:"8",width:"200",height:"124",rx:"12",fill:"var(--color-gray-50)",stroke:"var(--color-gray-200)",strokeWidth:"1"}),t.jsx("text",{x:"22",y:"40",fontSize:"8",fill:"var(--color-gray-400)",fontFamily:"sans-serif",children:"200"}),t.jsx("text",{x:"22",y:"68",fontSize:"8",fill:"var(--color-gray-400)",fontFamily:"sans-serif",children:"100"}),t.jsx("text",{x:"29",y:"96",fontSize:"8",fill:"var(--color-gray-400)",fontFamily:"sans-serif",children:"0"}),t.jsx("line",{x1:"44",y1:"36",x2:"196",y2:"36",stroke:"var(--color-gray-100)",strokeWidth:"1"}),t.jsx("line",{x1:"44",y1:"64",x2:"196",y2:"64",stroke:"var(--color-gray-100)",strokeWidth:"1"}),t.jsx("line",{x1:"44",y1:"92",x2:"196",y2:"92",stroke:"var(--color-gray-100)",strokeWidth:"1"}),[0,1,2,3,4,5,6].map(e=>{const i=[38,42,35,48,44,50,46][e];return t.jsx("rect",{x:48+e*22,y:92-i,width:"14",height:i,rx:"3",fill:"var(--color-gray-200)"},`o${e}`)}),[0,1,2,3,4,5,6].map(e=>{const i=[8,12,10,18,20,28,32][e];return t.jsx("rect",{x:48+e*22,y:92-i,width:"14",height:i,rx:"3",fill:"var(--color-brand-600)",opacity:"0.85"},`a${e}`)}),t.jsx("polyline",{points:"55,84 77,80 99,82 121,74 143,72 165,64 187,60",fill:"none",stroke:"var(--color-brand-600)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),t.jsx("circle",{cx:"187",cy:"60",r:"3.5",fill:"var(--color-brand-600)"}),t.jsx("circle",{cx:"187",cy:"60",r:"6",fill:"var(--color-brand-600)",opacity:"0.15"}
15158),t.jsx("rect",{x:"52",y:"106",width:"8",height:"8",rx:"2",fill:"var(--color-gray-200)"}),t.jsx("text",{x:"64",y:"113",fontSize:"8",fill:"var(--color-gray-400)",fontFamily:"sans-serif",children:"All traffic"}),t.jsx("rect",{x:"108",y:"106",width:"8",height:"8",rx:"2",fill:"var(--color-brand-600)"}),t.jsx("text",{x:"120",y:"113",fontSize:"8",fill:"var(--color-gray-400)",fontFamily:"sans-serif",children:"AI referrals"})]})}const Zw=p.div.withConfig({displayName:"ProjectAnalyticsPage__LPEmpty",componentId:"sc-1jlsjaz-59"})` 15159 display: flex; 15160 flex-direction: column; 15161 align-items: center; 15162 gap: 8px; 15163 padding: 48px 24px; 15164 text-align: center; 15165`,Jw=p.span.withConfig({displayName:"ProjectAnalyticsPage__LPEmptyTitle",componentId:"sc-1jlsjaz-60"})` 15166 font-size: 0.875rem; 15167 font-weight: 700; 15168 color: ${O}; 15169`,ej=p.span.withConfig({displayName:"ProjectAnalyticsPage__LPEmptySub",componentId:"sc-1jlsjaz-61"})` 15170 font-size: 0.8125rem; 15171 color: ${z}; 15172 max-width: 360px; 15173`,Sx=p.div.withConfig({displayName:"ProjectAnalyticsPage__LPSummary",componentId:"sc-1jlsjaz-62"})` 15174 background: ${cn}; 15175 border: 1px solid ${V}; 15176 border-radius: 10px; 15177 padding: 12px 16px; 15178 display: flex; 15179 align-items: center; 15180 gap: 10px; 15181 font-size: 0.8125rem; 15182 color: ${O}; 15183 line-height: 1.5; 15184`,B$=p.div.withConfig({displayName:"ProjectAnalyticsPage__LPHeroStrip",componentId:"sc-1jlsjaz-63"})` 15185 display: grid; 15186 grid-template-columns: repeat(3, 1fr); 15187 gap: 12px; 15188 @media (max-width: 640px) { 15189 grid-template-columns: 1fr; 15190 } 15191`,kx=p.div.withConfig({displayName:"ProjectAnalyticsPage__LPHeroCard",componentId:"sc-1jlsjaz-64"})` 15192 border: 1px solid ${V}; 15193 border-radius: 10px; 15194 padding: 16px 20px; 15195 background: ${Z}; 15196`,$x=p.div.withConfig({displayName:"ProjectAnalyticsPage__LPHeroValue",componentId:"sc-1jlsjaz-65"})` 15197 font-size: 1.75rem; 15198 font-weight: 800; 15199 color: ${e=>e.$color||O}; 15200 line-height: 1.1; 15201`,mp=p.div.withConfig({displayName:"ProjectAnalyticsPage__LPHeroLabel",componentId:"sc-1jlsjaz-66"})` 15202 font-size: 0.75rem; 15203 color: ${z}; 15204 margin-top: 2px; 15205`,tj=p.span.withConfig({displayName:"ProjectAnalyticsPage__LPHeroTrend",componentId:"sc-1jlsjaz-67"})` 15206 font-size: 0.75rem; 15207 font-weight: 600; 15208 color: ${e=>e.$positive?Vt:oi}; 15209`,Rft=p.div.withConfig({displayName:"ProjectAnalyticsPage__LPTableWrap",componentId:"sc-1jlsjaz-68"})` 15210 overflow-x: auto; 15211 border: 1px solid ${V}; 15212 border-radius: 10px; 15213 background: ${Z}; 15214`,Oft=p.table.withConfig({displayName:"ProjectAnalyticsPage__LPTable",componentId:"sc-1jlsjaz-69"})` 15215 width: 100%; 15216 border-collapse: collapse; 15217 font-size: 0.8125rem; 15218`,Ix=p.th.withConfig({displayName:"ProjectAnalyticsPage__LPTh",componentId:"sc-1jlsjaz-70"})` 15219 text-align: ${e=>e.$align||"right"}; 15220 padding: 10px 14px; 15221 font-weight: 600; 15222 font-size: 0.7rem; 15223 color: ${z}; 15224 text-transform: uppercase; 15225 letter-spacing: 0.04em; 15226 border-bottom: 1px solid ${V}; 15227 white-space: nowrap; 15228 &:first-child { 15229 text-align: left; 15230 } 15231`,Px=p.span.withConfig({displayName:"ProjectAnalyticsPage__LPThInner",componentId:"sc-1jlsjaz-71"})` 15232 display: inline-flex; 15233 align-items: center; 15234 gap: 4px; 15235 justify-content: ${e=>e.$align==="left"?"flex-start":"flex-end"}; 15236`,Dft=p.span.withConfig({displayName:"ProjectAnalyticsPage__LPInfoIcon",componentId:"sc-1jlsjaz-72"})` 15237 display: inline-flex; 15238 align-items: center; 15239 cursor: help; 15240`,Lft=p.div.withConfig({displayName:"ProjectAnalyticsPage__PortalTooltipBox",componentId:"sc-1jlsjaz-73"})` 15241 position: fixed; 15242 left: ${e=>e.$x}px; 15243 top: ${e=>e.$y}px; 15244 transform: translateY(-100%); 15245 background: ${O}; 15246 color: ${Z}; 15247 font-size: 0.7rem; 15248 font-weight: 400; 15249 text-transform: none; 15250 letter-spacing: 0; 15251 line-height: 1.4; 15252 padding: 6px 10px; 15253 border-radius: 6px; 15254 white-space: normal; 15255 width: max-content; 15256 max-width: 220px; 15257 z-index: 9999; 15258 pointer-events: none; 15259 opacity: ${e=>e.$visible?1:0}; 15260 transition: opacity 0.12s ease; 15261`;function au({children:e}){const n=l.useRef(null),[i,r]=l.useState({x:0,y:0}),[o,s]=l.useState(!1),a=()=>{if(!n.current)return;const c=n.current.getBoundingClientRect(),u=220,m=c.left+c.width/2,h=8,g=Math.max(h+u/2,Math.min(m,window.innerWidth-h-u/2));r({x:g-u/2,y:c.top-6}),s(!0)};return t.jsxs(t.Fragment,{children:[t.jsx(Dft,{ref:n,onMouseEnter:a,onMouseLeave:()=>s(!1),children:t.jsx(wn,{size:11,style:{color:Pe}})}),o&&jr.createPortal(t.jsx(Lft,{$x:i.x,$y:i.y,$visible:o,children:e}),document.body)]})}const U7=p.tr.withConfig({displayName:"ProjectAnalyticsPage__LPRow",componentId:"sc-1jlsjaz-74"})` 15262 &:hover { 15263 background: ${$e}; 15264 } 15265 &:not(:last-child) td { 15266 border-bottom: 1px solid ${V}; 15267 } 15268`,F$=p.td.withConfig({displayName:"ProjectAnalyticsPage__LPTd",componentId:"sc-1jlsjaz-75"})` 15269 padding: 10px 14px; 15270 text-align: right; 15271 color: ${O}; 15272 white-space: nowrap; 15273`,Bft=p.td.withConfig({displayName:"ProjectAnalyticsPage__LPTdHighlight",componentId:"sc-1jlsjaz-76"})` 15274 padding: 10px 14px; 15275 text-align: right; 15276 color: ${ot}; 15277 font-weight: 700; 15278 white-space: nowrap; 15279`,eQ=p.td.withConfig({displayName:"ProjectAnalyticsPage__LPTdPath",componentId:"sc-1jlsjaz-77"})` 15280 padding: 10px 14px; 15281 text-align: left; 15282 color: ${O}; 15283 font-weight: 500; 15284 max-width: 320px; 15285 overflow: hidden; 15286 text-overflow: ellipsis; 15287 white-space: nowrap; 15288 font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; 15289 font-size: 0.8rem; 15290`,tQ=p.a.withConfig({displayName:"ProjectAnalyticsPage__LPPathLink",componentId:"sc-1jlsjaz-78"})` 15291 color: ${O}; 15292 text-decoration: none; 15293 &:hover { 15294 color: ${ot}; 15295 text-decoration: underline; 15296 } 15297`,Fft=p(Dn).withConfig({displayName:"ProjectAnalyticsPage__LPActions",componentId:"sc-1jlsjaz-79"})` 15298 font-size: 0.7rem; 15299 font-weight: 600; 15300 color: ${ot}; 15301 background: ${cn}; 15302 padding: 2px 8px; 15303 border-radius: 999px; 15304 white-space: nowrap; 15305 text-decoration: none; 15306 &:hover { 15307 background: ${ot}; 15308 color: ${Z}; 15309 } 15310`,Wft=p.div.withConfig({displayName:"ProjectAnalyticsPage__LPMatrixSection",componentId:"sc-1jlsjaz-80"})` 15311 border: 1px solid ${V}; 15312 border-radius: 10px; 15313 background: ${Z}; 15314 overflow-x: auto; 15315`,Uft=p.div.withConfig({displayName:"ProjectAnalyticsPage__LPMatrixHeader",componentId:"sc-1jlsjaz-81"})` 15316 padding: 14px 16px 6px; 15317`,Hft=p.div.withConfig({displayName:"ProjectAnalyticsPage__LPMatrixTitle",componentId:"sc-1jlsjaz-82"})` 15318 font-size: 0.875rem; 15319 font-weight: 700; 15320 color: ${O}; 15321`,qft=p.div.withConfig({displayName:"ProjectAnalyticsPage__LPMatrixSub",componentId:"sc-1jlsjaz-83"})` 15322 font-size: 0.75rem; 15323 color: ${z}; 15324 margin-top: 2px; 15325`,Gft=p.table.withConfig({displayName:"ProjectAnalyticsPage__LPMatrixTable",componentId:"sc-1jlsjaz-84"})` 15326 width: 100%; 15327 border-collapse: collapse; 15328 font-size: 0.8125rem; 15329`,nQ=p.th.withConfig({displayName:"ProjectAnalyticsPage__LPMatrixTh",componentId:"sc-1jlsjaz-85"})` 15330 padding: 8px 14px; 15331 text-align: center; 15332 font-size: 0.7rem; 15333 font-weight: 600; 15334 color: ${z}; 15335 text-transform: uppercase; 15336 letter-spacing: 0.03em; 15337 border-bottom: 1px solid ${V}; 15338 white-space: nowrap; 15339 &:first-child { 15340 text-align: left; 15341 } 15342`,Vft=p.td.withConfig({displayName:"ProjectAnalyticsPage__LPMatrixTd",componentId:"sc-1jlsjaz-86"})` 15343 padding: 8px 14px; 15344 text-align: center; 15345 color: ${O}; 15346 white-space: nowrap; 15347`,Kft=p.span.withConfig({displayName:"ProjectAnalyticsPage__PlatformDot",componentId:"sc-1jlsjaz-87"})` 15348 display: inline-block; 15349 width: 10px; 15350 height: 10px; 15351 border-radius: 50%; 15352 background: ${e=>e.$color}; 15353`,iQ=p.div.withConfig({displayName:"ProjectAnalyticsPage__MatrixIconWrap",componentId:"sc-1jlsjaz-88"})` 15354 display: inline-flex; 15355 align-items: center; 15356 justify-content: center; 15357 color: ${O}; 15358 svg { 15359 width: 16px; 15360 height: 16px; 15361 } 15362`,Yft=p.div.withConfig({displayName:"ProjectAnalyticsPage__ConvBarSection",componentId:"sc-1jlsjaz-89"})` 15363 border: 1px solid ${V}; 15364 border-radius: 10px; 15365 background: ${Z}; 15366 padding: 16px 20px; 15367`,Xft=p.div.withConfig({displayName:"ProjectAnalyticsPage__ConvBarTitle",componentId:"sc-1jlsjaz-90"})` 15368 font-size: 0.875rem; 15369 font-weight: 700; 15370 color: ${O}; 15371`,Qft=p.div.withConfig({displayName:"ProjectAnalyticsPage__ConvBarSub",componentId:"sc-1jlsjaz-91"})` 15372 font-size: 0.75rem; 15373 color: ${z}; 15374 margin-top: 2px; 15375 margin-bottom: 14px; 15376`,Zft=p.div.withConfig({displayName:"ProjectAnalyticsPage__ConvBarRow",componentId:"sc-1jlsjaz-92"})` 15377 display: flex; 15378 align-items: center; 15379 gap: 12px; 15380 margin-bottom: 10px; 15381 &:last-child { margin-bottom: 0; } 15382`,Jft=p.span.withConfig({displayName:"ProjectAnalyticsPage__ConvBarLabel",componentId:"sc-1jlsjaz-93"})` 15383 width: 110px; 15384 flex-shrink: 0; 15385 font-size: 0.8rem; 15386 font-weight: 500; 15387 color: ${O}; 15388 text-align: right; 15389`,egt=p.div.withConfig({displayName:"ProjectAnalyticsPage__ConvBarTrack",componentId:"sc-1jlsjaz-94"})` 15390 flex: 1; 15391 height: 28px; 15392 background: ${$e}; 15393 border-radius: 6px; 15394 overflow: hidden; 15395 position: relative; 15396`,tgt=p.div.withConfig({displayName:"ProjectAnalyticsPage__ConvBarFill",componentId:"sc-1jlsjaz-95"})` 15397 height: 100%; 15398 width: ${e=>e.$width}%; 15399 background: ${e=>e.$color}; 15400 border-radius: 6px; 15401 display: flex; 15402 align-items: center; 15403 padding-left: 8px; 15404 min-width: 40px; 15405 transition: width 0.3s ease; 15406`,ngt=p.span.withConfig({displayName:"ProjectAnalyticsPage__ConvBarPct",componentId:"sc-1jlsjaz-96"})` 15407 font-size: 0.7rem; 15408 font-weight: 700; 15409 color: ${e=>e.$inside?Z:O}; 15410 white-space: nowrap; 15411`,igt=p.div.withConfig({displayName:"ProjectAnalyticsPage__ConvPlatSection",componentId:"sc-1jlsjaz-97"})` 15412 border: 1px solid ${V}; 15413 border-radius: 10px; 15414 background: ${Z}; 15415 overflow-x: auto; 15416`,rgt=p.div.withConfig({displayName:"ProjectAnalyticsPage__ConvPlatHeader",componentId:"sc-1jlsjaz-98"})` 15417 padding: 14px 16px 6px; 15418`,ogt=p.div.withConfig({displayName:"ProjectAnalyticsPage__ConvPlatTitle",componentId:"sc-1jlsjaz-99"})` 15419 font-size: 0.875rem; 15420 font-weight: 700; 15421 color: ${O}; 15422`,sgt=p.div.withConfig({displayName:"ProjectAnalyticsPage__ConvPlatSub",componentId:"sc-1jlsjaz-100"})` 15423 font-size: 0.75rem; 15424 color: ${z}; 15425 margin-top: 2px; 15426`,agt=p.table.withConfig({displayName:"ProjectAnalyticsPage__ConvPlatTable",componentId:"sc-1jlsjaz-101"})` 15427 width: 100%; 15428 border-collapse: collapse; 15429 font-size: 0.8125rem; 15430`,nj=p.th.withConfig({displayName:"ProjectAnalyticsPage__ConvPlatTh",componentId:"sc-1jlsjaz-102"})` 15431 text-align: ${e=>e.$align||"right"}; 15432 padding: 10px 16px; 15433 font-weight: 600; 15434 font-size: 0.7rem; 15435 color: ${z}; 15436 text-transform: uppercase; 15437 letter-spacing: 0.04em; 15438 border-bottom: 1px solid ${V}; 15439 white-space: nowrap; 15440 &:first-child { text-align: left; } 15441`,ij=p.td.withConfig({displayName:"ProjectAnalyticsPage__ConvPlatTd",componentId:"sc-1jlsjaz-103"})` 15442 padding: 10px 16px; 15443 text-align: right; 15444 color: ${O}; 15445 white-space: nowrap; 15446`,lgt=p.td.withConfig({displayName:"ProjectAnalyticsPage__ConvPlatName",componentId:"sc-1jlsjaz-104"})` 15447 padding: 10px 16px; 15448 text-align: left; 15449 color: ${O}; 15450 font-weight: 500; 15451 white-space: nowrap; 15452`,cgt=p.span.withConfig({displayName:"ProjectAnalyticsPage__ConvPlatDot",componentId:"sc-1jlsjaz-105"})` 15453 display: inline-block; 15454 width: 10px; 15455 height: 10px; 15456 border-radius: 50%; 15457 background: ${e=>e.$color}; 15458 margin-right: 8px; 15459 vertical-align: middle; 15460`,dgt=p.span.withConfig({displayName:"ProjectAnalyticsPage__ConvPlatRate",componentId:"sc-1jlsjaz-106"})` 15461 font-weight: 700; 15462 color: ${ot}; 15463`,ugt=p.div.withConfig({displayName:"ProjectAnalyticsPage__KeyInsight",componentId:"sc-1jlsjaz-107"})` 15464 background: ${cn}; 15465 border: 1px solid ${V}; 15466 border-radius: 10px; 15467 padding: 14px 18px; 15468 display: flex; 15469 align-items: flex-start; 15470 gap: 10px; 15471 font-size: 0.8125rem; 15472 color: ${O}; 15473 line-height: 1.6; 15474`,pgt=p.div.withConfig({displayName:"ProjectAnalyticsPage__EventFilterBar",componentId:"sc-1jlsjaz-108"})` 15475 background: ${Z}; 15476 border: 1px solid ${V}; 15477 border-radius: 10px; 15478 padding: 12px 16px; 15479 display: flex; 15480 align-items: center; 15481 gap: 10px; 15482 flex-wrap: wrap; 15483`,mgt=p.div.withConfig({displayName:"ProjectAnalyticsPage__EventFilterIntro",componentId:"sc-1jlsjaz-109"})` 15484 display: flex; 15485 flex-direction: column; 15486 min-width: 0; 15487 margin-right: auto; 15488`,hgt=p.span.withConfig({displayName:"ProjectAnalyticsPage__EventFilterTitle",componentId:"sc-1jlsjaz-110"})` 15489 font-size: 0.8125rem; 15490 font-weight: 700; 15491 color: ${O}; 15492`,fgt=p.span.withConfig({displayName:"ProjectAnalyticsPage__EventFilterSub",componentId:"sc-1jlsjaz-111"})` 15493 font-size: 0.7rem; 15494 color: ${z}; 15495 margin-top: 2px; 15496`,ggt=p.div.withConfig({displayName:"ProjectAnalyticsPage__EventFilterChips",componentId:"sc-1jlsjaz-112"})` 15497 display: flex; 15498 flex-wrap: wrap; 15499 gap: 6px; 15500`,ygt=p.button.withConfig({displayName:"ProjectAnalyticsPage__EventFilterChip",componentId:"sc-1jlsjaz-113"})` 15501 display: inline-flex; 15502 align-items: center; 15503 gap: 4px; 15504 background: ${cn}; 15505 color: ${Ft}; 15506 border: 1px solid ${ot}; 15507 border-radius: 999px; 15508 padding: 3px 8px 3px 10px; 15509 font-size: 0.7rem; 15510 font-weight: 600; 15511 cursor: pointer; 15512 font-family: inherit; 15513 &:hover { 15514 background: ${Z}; 15515 } 15516`,xgt=p.span.withConfig({displayName:"ProjectAnalyticsPage__KeyInsightLabel",componentId:"sc-1jlsjaz-114"})` 15517 font-weight: 700; 15518 font-size: 0.75rem; 15519 color: ${ot}; 15520 white-space: nowrap;
15521 margin-top: 1px; 15522`,bgt=p.div.withConfig({displayName:"ProjectAnalyticsPage__ERSourceRow",componentId:"sc-1jlsjaz-115"})` 15523 display: flex; 15524 align-items: center; 15525 gap: 12px; 15526 padding: 10px 12px; 15527 border-radius: 8px; 15528 min-width: 0; 15529 cursor: pointer; 15530 transition: background 0.15s ease; 15531 background: ${e=>e.$expanded?At:"transparent"}; 15532 &:hover { 15533 background: ${At}; 15534 } 15535`,vgt=p.div.withConfig({displayName:"ProjectAnalyticsPage__ERExpandPanel",componentId:"sc-1jlsjaz-116"})` 15536 padding: 12px 12px 16px; 15537 margin: 0 4px 4px; 15538 background: ${At}; 15539 border-radius: 0 0 8px 8px; 15540 border-top: 1px solid ${V}; 15541`,wgt=p.div.withConfig({displayName:"ProjectAnalyticsPage__ERChartHeader",componentId:"sc-1jlsjaz-117"})` 15542 display: flex; 15543 align-items: center; 15544 justify-content: space-between; 15545 margin-bottom: 8px; 15546 padding: 0 4px; 15547`,jgt=p.span.withConfig({displayName:"ProjectAnalyticsPage__ERChartLabel",componentId:"sc-1jlsjaz-118"})` 15548 font-size: 0.6875rem; 15549 font-weight: 600; 15550 text-transform: uppercase; 15551 letter-spacing: 0.04em; 15552 color: ${Pe}; 15553`,_gt=p.span.withConfig({displayName:"ProjectAnalyticsPage__ERChartTotal",componentId:"sc-1jlsjaz-119"})` 15554 font-size: 0.8125rem; 15555 font-weight: 700; 15556 color: ${O}; 15557`,Cgt=p.div.withConfig({displayName:"ProjectAnalyticsPage__ERChevron",componentId:"sc-1jlsjaz-120"})` 15558 display: flex; 15559 align-items: center; 15560 justify-content: center; 15561 flex-shrink: 0; 15562 color: ${Pe}; 15563 margin-left: auto; 15564 width: 20px; 15565`,Sgt=p.div.withConfig({displayName:"ProjectAnalyticsPage__ERSourceLogoBox",componentId:"sc-1jlsjaz-121"})` 15566 width: 28px; 15567 height: 28px; 15568 border-radius: 6px; 15569 background: ${$e}; 15570 border: 1px solid ${V}; 15571 display: flex; 15572 align-items: center; 15573 justify-content: center; 15574 flex-shrink: 0; 15575 overflow: hidden; 15576 img { 15577 width: 28px; 15578 height: 28px; 15579 border-radius: 6px; 15580 object-fit: contain; 15581 border: none; 15582 background: transparent; 15583 } 15584`,kgt=p.a.withConfig({displayName:"ProjectAnalyticsPage__ERSourceDomain",componentId:"sc-1jlsjaz-122"})` 15585 font-size: 0.8125rem; 15586 font-weight: 600; 15587 color: ${O}; 15588 width: 120px; 15589 flex-shrink: 0; 15590 overflow: hidden; 15591 text-overflow: ellipsis; 15592 white-space: nowrap; 15593 text-decoration: none; 15594 &:hover { 15595 color: ${ot}; 15596 text-decoration: underline; 15597 } 15598 @media (max-width: 480px) { 15599 width: 90px; 15600 font-size: 0.75rem; 15601 } 15602`,$gt=p.span.withConfig({displayName:"ProjectAnalyticsPage__ERSourceSessions",componentId:"sc-1jlsjaz-123"})` 15603 font-size: 0.875rem; 15604 font-weight: 700; 15605 color: ${O}; 15606 min-width: 40px; 15607 text-align: right; 15608`,Igt=p.div.withConfig({displayName:"ProjectAnalyticsPage__ERHeaderRow",componentId:"sc-1jlsjaz-124"})` 15609 display: flex; 15610 align-items: center; 15611 gap: 12px; 15612 padding: 0 12px 6px; 15613 border-bottom: 1px solid ${V}; 15614 margin-bottom: 2px; 15615`,W$=p.span.withConfig({displayName:"ProjectAnalyticsPage__ERHeaderLabel",componentId:"sc-1jlsjaz-125"})` 15616 font-size: 0.6875rem; 15617 font-weight: 600; 15618 text-transform: uppercase; 15619 letter-spacing: 0.04em; 15620 color: ${Pe}; 15621 flex-shrink: 0; 15622`,H7={ChatGPT:ju,Gemini:wu,Claude:nh,Perplexity:ih,Grok:Mf,Copilot:Rf,"You.com":Ube,Phind:qbe,Poe:Vbe};function go(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:e.toLocaleString()}function Ax(e){return e==null?"N/A":`${e>=0?"+":""}${e.toFixed(1)}%`}function rQ(e,n){if(!e)return null;try{const i=e.startsWith("http")?e:`https://${e}`;return new URL(n,i).href}catch{return null}}function Pgt(e,n,i){if(e.ai_sessions===0&&e.total_sessions===0)return"Connect GA4 and sync to start tracking AI referral traffic.";const r=n[0],o=[];if(e.ai_sessions_trend!==null){const s=e.ai_sessions_trend>=0?"up":"down";o.push(`Your AI referral traffic is ${s} ${Math.abs(e.ai_sessions_trend).toFixed(1)}% over the last ${i} days.`)}else o.push(`You have ${go(e.ai_sessions)} AI referral sessions in the last ${i} days.`);if(r){const s=e.ai_sessions>0?(r.sessions/e.ai_sessions*100).toFixed(0):"0";o.push(`${r.name} is your largest AI traffic source (${s}% share).`);const a=n.filter(c=>c.trend!==null&&c.trend>0).sort((c,u)=>(u.trend??0)-(c.trend??0))[0];a&&a.name!==r.name&&o.push(`${a.name} is growing fastest (+${a.trend?.toFixed(0)}%).`)}return o.join(" ")}const Agt=p.div.withConfig({displayName:"ProjectAnalyticsPage__TooltipBox",componentId:"sc-1jlsjaz-126"})` 15623 background: ${Z}; 15624 border: 1px solid ${V}; 15625 border-radius: 10px; 15626 padding: 10px 14px; 15627 font-size: 0.75rem; 15628 min-width: 160px; 15629 box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08); 15630`,Ngt=p.div.withConfig({displayName:"ProjectAnalyticsPage__TtDate",componentId:"sc-1jlsjaz-127"})` 15631 font-weight: 700; 15632 color: ${O}; 15633 margin-bottom: 8px; 15634`,oQ=p.div.withConfig({displayName:"ProjectAnalyticsPage__TtRow",componentId:"sc-1jlsjaz-128"})` 15635 display: flex; 15636 align-items: center; 15637 justify-content: space-between; 15638 gap: 12px; 15639 padding: 2px 0; 15640`,sQ=p.span.withConfig({displayName:"ProjectAnalyticsPage__TtDot",componentId:"sc-1jlsjaz-129"})` 15641 width: 8px; 15642 height: 8px; 15643 border-radius: 50%; 15644 background: ${e=>e.$color}; 15645 flex-shrink: 0; 15646`,aQ=p.span.withConfig({displayName:"ProjectAnalyticsPage__TtLabel",componentId:"sc-1jlsjaz-130"})` 15647 color: ${z}; 15648 flex: 1; 15649`,lQ=p.span.withConfig({displayName:"ProjectAnalyticsPage__TtVal",componentId:"sc-1jlsjaz-131"})` 15650 font-weight: 700; 15651 color: ${O}; 15652`,zgt=p.hr.withConfig({displayName:"ProjectAnalyticsPage__TtDivider",componentId:"sc-1jlsjaz-132"})` 15653 border: none; 15654 border-top: 1px solid ${V}; 15655 margin: 6px 0; 15656`;function Tgt({active:e,payload:n,label:i,platformColors:r}){if(!e||!n?.length)return null;const o=n[0].payload,s=o.platforms||{},a=Object.entries(s).sort((c,u)=>u[1]-c[1]);return t.jsxs(Agt,{children:[t.jsx(Ngt,{children:new Date(i||o.date).toLocaleDateString()}),t.jsxs(oQ,{children:[t.jsx(sQ,{$color:ot}),t.jsx(aQ,{children:"AI Sessions"}),t.jsx(lQ,{children:go(o.ai_sessions)})]}),a.length>0&&t.jsxs(t.Fragment,{children:[t.jsx(zgt,{}),a.map(([c,u])=>t.jsxs(oQ,{children:[t.jsx(sQ,{$color:r[c]||Pe}),t.jsx(aQ,{children:c}),t.jsx(lQ,{children:go(u)})]},c))]})]})}function Egt(e){const n=[];
15656n.push(`I want to discuss my analytics data and understand what it means for AI visibility and growth. 15657`),e.projectName&&n.push(`**Project:** ${e.projectName}`),n.push(`**Current analytics tab:** ${e.activeTab}`),n.push(`**Date range:** last ${e.days} days`);const i=e.metrics?.summary;i&&(n.push(` 15658**Overview metrics:**`),n.push(`- AI referral sessions: ${i.ai_sessions}`),n.push(`- Total site sessions: ${i.total_sessions}`),n.push(`- AI share of traffic: ${i.ai_share}%`),n.push(`- AI conversions: ${i.ai_conversions}`));const r=(e.metrics?.platforms||[]).slice(0,5);return r.length&&(n.push(` 15659**Top AI platforms:**`),r.forEach(o=>n.push(`- ${o.name}: ${o.sessions} sessions${o.trend==null?"":`, trend ${o.trend}%`}`))),e.activeTab==="landing_pages"&&e.landingPages&&(n.push(` 15660**Landing pages context:**`),n.push(`- Tracked pages: ${e.landingPages.hero.tracked_pages} of ${e.landingPages.hero.total_pages}`),n.push(`- AI referrals to pages: ${e.landingPages.hero.total_ai_referrals}`),e.landingPages.pages.slice(0,5).forEach(o=>{n.push(`- ${o.page_path}: ${o.ai_sessions} AI sessions, ${o.conversions} conversions, top source ${o.top_source?.name||"N/A"}`)})),e.activeTab==="conversions"&&e.conversions&&(n.push(` 15661**Conversion context:**`),n.push(`- AI conversions: ${e.conversions.hero.ai.conversions}, rate ${e.conversions.hero.ai.rate}%`),n.push(`- Organic conversions: ${e.conversions.hero.organic.conversions}, rate ${e.conversions.hero.organic.rate}%`),n.push(`- Direct conversions: ${e.conversions.hero.direct.conversions}, rate ${e.conversions.hero.direct.rate}%`),e.conversions.by_platform.slice(0,5).forEach(o=>n.push(`- ${o.name}: ${o.conversions} conversions from ${o.sessions} sessions`))),e.activeTab==="earned_referrals"&&e.earned&&(n.push(` 15662**Earned referral context:**`),n.push(`- Earned sources: ${e.earned.hero.earned_sources} of ${e.earned.hero.total_referral_sources}`),n.push(`- Earned sessions: ${e.earned.hero.earned_sessions}`),e.earned.sources.slice(0,5).forEach(o=>n.push(`- ${o.label||o.domain}: ${o.sessions} sessions${o.is_targeted?" (targeted)":""}`))),n.push(` 15663Help me interpret the biggest opportunities and what actions I should prioritize.`),n.join(` 15664`)}function Mgt(e){const n=String(e||"Project").trim();return`Analytics: ${n.length>50?`${n.slice(0,47)}â¦`:n}`}function Rgt(){const{workspaceId:e,projectId:n}=Gn(),[i,r]=yr(),{projects:o}=Mr(),s=o.find(ke=>String(ke.id)===n),a=!!(s?.can?.edit||s?.can?.settings),{subscribe:c}=wo(),u=["overview","landing_pages","conversions","earned_referrals"],m=i.get("tab"),h=m&&u.includes(m)?m:"overview",g=l.useCallback(ke=>{r(Ve=>{const pt=new URLSearchParams(Ve);return ke==="overview"?pt.delete("tab"):pt.set("tab",ke),pt},{replace:!0})},[r]),x=Number(i.get("days")),y=[7,30,90].includes(x)?x:30,w=l.useCallback(ke=>{r(Ve=>{const pt=new URLSearchParams(Ve);return ke===30?pt.delete("days"):pt.set("days",String(ke)),pt},{replace:!0})},[r]),[j,v]=l.useState(null),[_,$]=l.useState(!0),[k,P]=l.useState(!1),[S,I]=l.useState(null),[A,E]=l.useState(!1),[B,T]=l.useState(!1),[M,R]=l.useState(!1),[F,Y]=l.useState(!1),[H,U]=l.useState("disconnected"),[X,Q]=l.useState(null),[K,G]=l.useState(null),[L,q]=l.useState(!1),[W,oe]=l.useState(1),[se,de]=l.useState(1),[le,me]=l.useState(null),[ee,ne]=l.useState(!1),[Ae,_e]=l.useState([]),[we,Ke]=l.useState(!1),ce=i.get("event_names")||"",ie=l.useMemo(()=>ce?ce.split(",").map(ke=>ke.trim()).filter(Boolean):[],[ce]),Re=l.useCallback(ke=>{r(Ve=>{const pt=new URLSearchParams(Ve),Nt=Array.from(new Set(ke.map(qe=>qe.trim()).filter(Boolean)));return Nt.length===0?pt.delete("event_names"):pt.set("event_names",Nt.join(",")),pt},{replace:!0})},[r]),Be=l.useCallback(ke=>{const pt=ie.includes(ke)?ie.filter(Nt=>Nt!==ke):[...ie,ke];Re(pt)},[ie,Re]),[tt,dt]=l.useState(null),[je,Me]=l.useState(!1),[Se,it]=l.useState(1),[De,te]=l.useState(null),ge=`/api/v1/organizations/${e}/projects/${n}/google_analytics`,Je=l.useCallback(async()=>{if(!(!e||!n)){$(!0);try{const ke=await ue(`${ge}/metrics?days=${y}`);if(ke.ok){const Ve=await ke.json();v(Ve),U(Ve.connection?.status||"disconnected"),Q(Ve.connection?.property_id||null),Ve.connection?.syncing_since&&(Date.now()-new Date(Ve.connection.syncing_since).getTime()<300*1e3?P(!0):P(!1))}}catch{}$(!1)}},[e,n,ge,y]),Ee=l.useCallback(async(ke=W,Ve=se)=>{if(!(!e||!n)){q(!0);try{const pt=await ue(`${ge}/landing_pages?days=${y}&page=${ke}&matrix_page=${Ve}`);if(pt.ok){const Nt=await pt.json();G(Nt)}}catch{}q(!1)}},[e,n,ge,y,W,se]),Xe=l.useCallback(async()=>
15664{if(!(!e||!n)){ne(!0);try{const ke=new URLSearchParams({days:String(y)});ie.length>0&&ke.set("event_names",ie.join(","));const Ve=await ue(`${ge}/conversions?${ke.toString()}`);if(Ve.ok){const pt=await Ve.json();me(pt)}}catch{}ne(!1)}},[e,n,ge,y,ie]),yt=l.useCallback(async()=>{if(!(!e||!n)){Ke(!0);try{const ke=await ue(`${ge}/conversion_events`);if(ke.ok){const Ve=await ke.json();_e(Ve.events||[])}}catch{}Ke(!1)}},[e,n,ge]),Ne=l.useCallback(async(ke=Se)=>{if(!(!e||!n)){Me(!0);try{const Ve=await ue(`${ge}/earned_referrals?days=${y}&page=${ke}`);if(Ve.ok){const pt=await Ve.json();dt(pt)}}catch{}Me(!1)}},[e,n,ge,y,Se]),Le=l.useCallback(ke=>{it(ke),Ne(ke)},[Ne]),Ue=l.useCallback(ke=>{oe(ke),Ee(ke,se)},[Ee,se]),We=l.useCallback(ke=>{de(ke),Ee(W,ke)},[Ee,W]);l.useEffect(()=>{if(!e||!n)return;let ke=!1;return(async()=>{$(!0);try{const pt=await ue(`${ge}`);if(ke)return;if(pt.ok){const Nt=await pt.json(),qe=Nt.connection?.status||"disconnected";if(U(qe),Q(Nt.connection?.property_id||null),Nt.connection?.syncing_since&&Date.now()-new Date(Nt.connection.syncing_since).getTime()<300*1e3&&P(!0),qe==="connected"){await Je(),ht.current.overview=y,h==="landing_pages"?(await Ee(),ht.current.landing_pages=y):h==="conversions"?(await Xe(),ht.current.conversions=y):h==="earned_referrals"&&(await Ne(),ht.current.earned_referrals=y);return}}}catch{}ke||$(!1)})(),()=>{ke=!0}},[e,n,ge]);const Qe=l.useRef(y);l.useEffect(()=>{Qe.current!==y&&(Qe.current=y,H==="connected"&&(h==="overview"?Je():h==="landing_pages"?(oe(1),de(1),Ee(1,1)):h==="conversions"?Xe():h==="earned_referrals"&&(it(1),Ne(1)),ht.current[h]=y))},[y,H,Je,h,Ee,Xe,Ne]);const ht=l.useRef({}),pe=l.useRef(h);l.useEffect(()=>{if(pe.current===h&&ht.current[h]===y||(pe.current=h,H!=="connected"))return;const ke=ht.current[h]!==y;h==="landing_pages"?(oe(1),de(1),Ee(1,1)):h==="conversions"?Xe():h==="earned_referrals"?(it(1),Ne(1)):h==="overview"&&(ke||!j)&&Je(),ht.current[h]=y},[h,y,H,Ee,Xe,Ne,Je,j]);const be=l.useRef(ce);l.useEffect(()=>{be.current!==ce&&(be.current=ce,h==="conversions"&&H==="connected"&&Xe())},[ce,h,H,Xe]);const rt=l.useRef(!1);l.useEffect(()=>{h==="conversions"&&H==="connected"&&(rt.current||(rt.current=!0,yt()))},[h,H,yt]),l.useEffect(()=>{if(!n)return;const ke=c({channel:"ProjectAnalyticsChannel",project_id:n},{received:Ve=>{Ve.type==="sync_completed"&&(P(!1),I(null),Je(),h==="landing_pages"?(oe(1),de(1),Ee(1,1)):h==="conversions"?(Xe(),yt()):h==="earned_referrals"&&(it(1),Ne(1))),Ve.type==="sync_failed"&&(P(!1),I(Ve.error||"Sync failed. Please try again.")),Ve.type==="sync_revoked"&&(P(!1),I(null),U("revoked")),Ve.type==="sync_started"&&(P(!0),I(null))}});return()=>{ke?.unsubscribe?.()}},[n,c,Je,h,Ee,Xe,yt,Ne]);const ze=async()=>{try{const Ve=await(await ue(`${ge}/init`)).json();if(!Ve.authorization_url)return;const pt=520,Nt=640,qe=Math.round((window.screen.width-pt)/2),qt=Math.round((window.screen.height-Nt)/2),Mn=window.open(Ve.authorization_url,"Connect Google Analytics",`width=${pt},height=${Nt},left=${qe},top=${qt},toolbar=no,location=no,status=no,menubar=no`);if(!Mn)return;const zt=()=>{window.removeEventListener("message",dn),rn&&clearInterval(rn),bn&&clearTimeout(bn)},dn=kt=>{if(kt.origin===window.location.origin){if(kt.data?.type==="GA_OAUTH_SUCCESS"){zt();try{Mn.close()}catch{}U("connected"),Je(),T(!1),E(!0)}if(kt.data?.type==="GA_OAUTH_ERROR"){zt();try{Mn.close()}catch{}}}};window.addEventListener("message",dn);const rn=setInterval(()=>{try{Mn.closed&&zt()}catch{}},500),bn=setTimeout(()=>{zt();try{Mn.close()}catch{}},300*1e3)}catch{}},lt=async()=>{P(!0),I(null);try{await ue(`${ge}/sync`,{method:"POST"})}catch{P(!1)}},vt=H==="connected",Wt=j?.summary,Qt=j?.daily_series||[],Yt=j?.platforms||[],Zt=j?.conversion_summary,tn=j?.action_markers||[],nn=!!Wt&&(Wt.total_sessions>0||Wt.ai_sessions>0),xn=Math.max(...Yt.map(ke=>ke.sessions),1),st=l.useMemo(()=>{const ke={};return Yt.forEach(Ve=>{ke[Ve.name]=Ve.color}),ke},[Yt]),Ct=l.useMemo(()=>Yt.map(ke=>ke.name),[Yt]),Ie=l.useMemo(()=>Egt({projectName:s?.name,activeTab:h,days:y,metrics:j,landingPages:K,conversions:le,earned:tt}),[s?.name,h,y,j,K,le,tt]),ae=l.useMemo(()=>F?Qt.map(ke=>{const Ve={...ke};return Ct.forEach(pt=>{Ve[pt]=ke.platforms?.[pt]||0}),Ve}):Qt,[Qt,F,Ct]),Fe=l.useMemo(()=>Wt?Pgt(Wt,Yt,y):"",[Wt,Yt,y]),Ge=Zt&&Zt.ai.conversions===0&&Zt.organic.conversions===0&&Zt.direct.conversions===0,wt=e&&n?`/workspaces
15664/${e}/projects/${n}`:"";return t.jsxs(oft,{children:[t.jsxs(sft,{children:[t.jsx(Fy,{title:"Analytics"}),t.jsx("div",{style:{paddingRight:8},children:t.jsx(qr,{items:[{label:"Projects",to:e?`/workspaces/${e}`:void 0},{label:s?.name||"Project",to:wt||void 0},{label:"Analytics"}]})})]}),t.jsxs(aft,{children:[t.jsx(P$,{$active:h==="overview",onClick:()=>g("overview"),children:"Overview"}),t.jsx(P$,{$active:h==="landing_pages",onClick:()=>g("landing_pages"),children:"Landing Pages"}),t.jsx(P$,{$active:h==="earned_referrals",onClick:()=>g("earned_referrals"),children:"Earned Referrals"}),t.jsx(P$,{$active:h==="conversions",onClick:()=>g("conversions"),children:"Conversions"})]}),t.jsx(lft,{children:!vt&&!_?t.jsxs(Tft,{children:[t.jsx(Mft,{}),t.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:8},children:[t.jsx(Eft,{children:"Connect Google Analytics"}),t.jsx(W7,{children:"Link your GA4 property to track AI referral traffic, see which LLM platforms drive visitors, and measure conversions from AI sources."})]}),a?t.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap",justifyContent:"center"},children:[t.jsxs(he,{variant:"primary",onClick:ze,children:[t.jsx(v0e,{size:14})," Connect GA4"]}),t.jsxs(he,{variant:"outline",onClick:()=>{T(!0),E(!0)},children:[t.jsx(Bc,{size:14})," Use external source"]})]}):t.jsx(W7,{children:"Ask a workspace editor to connect Google Analytics."}),H==="revoked"&&a&&t.jsx(W7,{style:{color:oi},children:"Access was revoked. Please reconnect."})]}):_?t.jsxs(t.Fragment,{children:[t.jsx(nt,{style:{width:"100%",height:48}}),t.jsx(nt,{style:{width:"100%",height:60}}),t.jsx(XX,{children:[1,2,3,4].map(ke=>t.jsx(nt,{style:{height:100}},ke))}),t.jsx(nt,{style:{width:"100%",height:300}})]}):t.jsxs(t.Fragment,{children:[t.jsxs(cft,{$connected:vt,children:[t.jsxs(dft,{children:[t.jsx(mft,{$on:vt}),t.jsx(hft,{children:vt?j?.connection?.property_name?`${j.connection.property_name}${j.connection.account_name?` · ${j.connection.account_name}`:""}`:`GA4 Property: ${j?.connection?.property_id||"Connected"}`:"Not connected"}),vt&&j?.connection?.connected_via==="api"&&t.jsx("span",{style:{fontSize:"0.625rem",fontWeight:700,padding:"1px 6px",borderRadius:4,background:"#EEF2FF",color:"#4F46E5",letterSpacing:"0.02em",whiteSpace:"nowrap",marginLeft:4},children:"via API"})]}),t.jsx(uft,{children:t.jsx(bft,{children:[7,30,90].map(ke=>t.jsxs(vft,{$active:y===ke,onClick:()=>w(ke),children:[ke,"d"]},ke))})}),t.jsxs(pft,{children:[j?.connection?.last_synced_at&&t.jsxs(KX,{children:["Synced ",new Date(j.connection.last_synced_at).toLocaleDateString()]}),a&&X&&t.jsxs(he,{variant:"outline",size:"sm",onClick:lt,disabled:k,children:[k?t.jsx(ym,{size:14}):t.jsx(No,{size:14}),k?"Syncing...":"Sync Now"]}),a&&t.jsxs(he,{variant:"outline",size:"sm",onClick:()=>{T(!1),E(!0)},children:[t.jsx(Bc,{size:14})," Settings"]})]})]}),S&&t.jsxs(zft,{children:[t.jsx("span",{style:{fontWeight:600},children:"Sync failed:"})," ",S]}),k&&!nn&&t.jsxs(Qw,{children:[t.jsx(ym,{size:24,style:{color:ot}}),t.jsx(_x,{children:"Syncing your analytics data..."}),t.jsx(Cx,{children:"Pulling up to 180 days of Google Analytics data. This may take a minute."})]}),!k&&!nn&&vt&&!S&&t.jsx(Qw,{children:X?t.jsxs(t.Fragment,{children:[t.jsx(Gg,{size:24,style:{color:ot}}),t.jsx(_x,{children:"No analytics data yet"}),t.jsxs(Cx,{children:["Your GA4 property is connected. Click ",t.jsx("strong",{children:"Sync Now"})," to fetch your data, or wait for the automatic nightly sync."]})]}):t.jsxs(t.Fragment,{children:[t.jsx(Bc,{size:24,style:{color:ot}}),t.jsx(_x,{children:"Select a GA4 property"}),t.jsxs(Cx,{children:["Open ",t.jsx("strong",{children:"Settings"})," to choose which Google Analytics property to sync data from."]})]})}),h==="overview"&&nn&&t.jsxs(t.Fragment,{children:[t.jsx(gft,{children:k?t.jsxs(t.Fragment,{children:[t.jsx(ym,{size:16,style:{color:ot,flexShrink:0}}),t.jsx(YX,{children:"Updating analytics data â this may take a momentâ¦"})]}):t.jsxs(t.Fragment,{children:[t.jsx(Xw,{children:"C"}),t.jsx(YX,{children:Fe})]})}),t.jsxs(XX,{children:[t.jsxs(A$,{children:[t.jsx(N$,{$color:ot,children:go(Wt.ai_sessions)}),t.jsx(z$,{children:"AI Referral Sessions"}),t.jsxs(jx,{$positive:(Wt.ai_sessions_trend??0)>=0,children:[(Wt.ai_sessions_trend??0)>=0?t.jsx(qi,{size:12}):t.jsx(ul,{size:12}),Ax(Wt.ai_sessions_trend)," vs prev ",y,"d"]})]}),t.jsxs(A$,{children:[t.jsx(N$,{children:go(Wt.total_sessions)}),t.jsx(z$,{children:"Total Site Sessions"}),t.jsxs(jx,{$positive:(Wt.total_sessions_trend??0)>=0,children:[(Wt.total_sessions_trend??0)>=0?t.jsx(qi,{size:12}):t.jsx(ul,{size:12}),Ax(Wt.total_sessions_trend)," vs prev ",y,"d"]})]}),t.jsxs(A$,{children:[t.jsxs(N$,{$color:ot,children:[Wt.ai_share,"%"]}),t.jsx(z$,{children:"AI Share of Traffic"}),t.jsxs(jx,{$positive:Wt.ai_share_change>=0,children:[Wt.ai_share_change>=0?t.jsx(qi,{size:12}):t.jsx(ul,{size:12}),Wt.ai_share_change>=0?"+":"",Wt.ai_share_change,"pp"]})]}),t.jsxs(A$,{children:[t.jsx(N$,{$color:Vt,children:go(Wt.ai_conversions)}),t.jsx(z$,{children:"AI Key Events"}),Wt.ai_conversions===0?t.jsx(yft,{children:"Requires GA4 key events"}):t.jsxs(jx,{$positive:(Wt.ai_conversions_trend??0)>=0,children:[(Wt.ai_conversions_trend??0)>=0?t.jsx(qi,{size:12}):t.jsx(ul,{size:12}),Ax(Wt.ai_conversions_trend)," vs prev ",y,"d"]})]})]}),t.jsxs(T$,{children:[t.jsxs(E$,{children:[t.jsx(M$,{children:"AI Referral Traffic Over Time"}),Ct.length>0&&t.jsxs(xft,{$active:F,onClick:()=>Y(ke=>!ke),children:[t.jsx(CP,{size:12})," By platform"]})]}),t.jsx(Gl,{width:"100%",height:280,children:t.jsxs(zC,{data:ae,margin:{top:10,right:10,left:0,bottom:0},children:[t.jsx("defs",{children:t.jsxs("linearGradient",{id:"aiGrad",x1:"0",y1:"0",x2:"0",y2:"1",children:[t.jsx("stop",{offset:"5%",
15664stopColor:ot,stopOpacity:.2}),t.jsx("stop",{offset:"95%",stopColor:ot,stopOpacity:0})]})}),t.jsx(Zm,{strokeDasharray:"3 3",stroke:$e}),t.jsx(Ql,{dataKey:"date",tick:{fontSize:11,fill:Pe},tickFormatter:ke=>{const Ve=new Date(ke);return`${Ve.getMonth()+1}/${Ve.getDate()}`}}),t.jsx(Zl,{tick:{fontSize:11,fill:Pe}}),t.jsx(Vl,{content:t.jsx(Tgt,{platformColors:st})}),t.jsx(jf,{type:"monotone",dataKey:"ai_sessions",stroke:ot,fill:F?"transparent":"url(#aiGrad)",strokeWidth:2,name:"AI Sessions"}),F&&Ct.map(ke=>t.jsx(Nd,{type:"monotone",dataKey:ke,stroke:st[ke]||Pe,strokeWidth:1.5,dot:!1,name:ke},ke)),tn.map((ke,Ve)=>t.jsx(cce,{x:ke.date,stroke:Vt,strokeDasharray:"4 4",strokeWidth:1.5,label:{value:"â",position:"top",fill:Vt,fontSize:12}},Ve))]})})]}),t.jsxs(T$,{children:[t.jsx(E$,{children:t.jsx(M$,{children:"Sessions by AI Platform"})}),Yt.length===0?t.jsx(KX,{children:"No AI platform sessions recorded yet."}):t.jsxs(t.Fragment,{children:[t.jsxs($ft,{children:[t.jsx(Ift,{}),t.jsx(Pft,{children:"Platform"}),t.jsx(Aft,{}),t.jsx(JX,{children:"Sessions"}),t.jsx(JX,{children:"Trend"})]}),Yt.map(ke=>{const Ve=H7[ke.name];return t.jsxs(wft,{children:[Ve?t.jsx(jft,{children:t.jsx(Ve,{})}):t.jsx(_ft,{$bg:ke.color,children:ke.name[0]}),t.jsx(Cft,{children:ke.name}),t.jsx(QX,{children:t.jsx(ZX,{$width:Math.max(ke.sessions/xn*100,3),$color:ke.color})}),t.jsx(Sft,{children:go(ke.sessions)}),t.jsx(kft,{$up:(ke.trend??0)>=0,children:ke.trend!==null?Ax(ke.trend):"â"})]},ke.name)})]})]}),Zt&&t.jsxs(T$,{children:[t.jsx(E$,{children:t.jsx(M$,{children:"Quick Key Events Summary"})}),t.jsxs(Nft,{children:[t.jsxs(O7,{children:[t.jsx(D7,{$color:Vt,children:go(Zt.ai.conversions)}),t.jsxs(L7,{children:[Zt.ai.rate,"% key event rate"]}),t.jsx(B7,{children:"AI Referral Key Events"})]}),t.jsxs(O7,{children:[t.jsx(D7,{children:go(Zt.organic.conversions)}),t.jsxs(L7,{children:[Zt.organic.rate,"% key event rate"]}),t.jsx(B7,{children:"Organic Key Events"})]}),t.jsxs(O7,{children:[t.jsx(D7,{children:go(Zt.direct.conversions)}),t.jsxs(L7,{children:[Zt.direct.rate,"% key event rate"]}),t.jsx(B7,{children:"Direct Key Events"})]})]}),Ge&&t.jsxs(R$,{children:[t.jsxs(O$,{onClick:()=>R(ke=>!ke),children:[t.jsx(wn,{size:15,style:{color:ot,flexShrink:0}}),t.jsx(D$,{children:"No key events configured in GA4"}),M?t.jsx(yu,{size:16,style:{color:Pe}}):t.jsx(qn,{size:16,style:{color:Pe}})]}),M&&t.jsxs(L$,{children:["Ceyo uses ",t.jsx("strong",{children:"Key Events"})," from Google Analytics. Once configured, this section will show key event counts and rates for AI, organic, and direct traffic.",t.jsxs(F7,{children:[t.jsxs(ol,{children:["Open ",t.jsx("strong",{children:"Google Analytics"})," â select your property"]}),t.jsxs(ol,{children:["Go to ",t.jsx("strong",{children:"Admin"})," (gear icon) â under your property, click ",t.jsx("strong",{children:"Events"})]}),t.jsxs(ol,{children:["Find an event you want to track (e.g. ",t.jsx("strong",{children:"form_submit"}),", ",t.jsx("strong",{children:"purchase"}),", ",t.jsx("strong",{children:"sign_up"}),") or create a custom one"]}),t.jsxs(ol,{children:["Toggle ",t.jsx("strong",{children:'"Mark as key event"'})," next to it"]}),t.jsxs(ol,{children:["Come back here and ",t.jsx("strong",{children:"Sync Now"})," â key event data will appear on the next sync"]})]})]})]})]})]}),h==="landing_pages"&&t.jsx(t.Fragment,{children:L&&!K?t.jsxs(t.Fragment,{children:[t.jsx(nt,{style:{width:"100%",height:48,borderRadius:10}}),t.jsx(B$,{children:[1,2,3].map(ke=>t.jsx(nt,{style:{height:90,borderRadius:10}},ke))}),t.jsx(nt,{style:{width:"100%",height:320,borderRadius:10}})]}):k&&!K?.pages?.length?t.jsxs(Qw,{children:[t.jsx(ym,{size:24,style:{color:ot}}),t.jsx(_x,{children:"Syncing your analytics data..."}),t.jsx(Cx,{children:"Pulling up to 180 days of Google Analytics data. This may take a minute."})]}):!nn&&!k?t.jsxs(Zw,{children:[t.jsx(Gg,{size:24,style:{color:Pe}}),t.jsx(Jw,{children:"No AI landing page data yet"}),t.jsx(ej,{children:"Once analytics data is synced, this tab will show which pages receive the most AI referral traffic."})]}):K&&K.pages.length>0?t.jsxs(t.Fragment,{children:[k?t.jsxs(Sx,{children:[t.jsx(ym,{size:16,style:{color:ot,flexShrink:0}}),t.jsx("span",{children:"Updating analytics data â this may take a momentâ¦"})]}):K.hero.summary?t.jsxs(Sx,{children:[t.jsx(Xw,{children:"C"}),t.jsx("span",{children:K.hero.summary})]}):null,t.jsxs(B$,{children:[t.jsxs(kx,{children:[t.jsx($x,{children:K.hero.tracked_pages}),t.jsx(mp,{children:"Tracked Pages"}),t.jsx(mp,{children:"Pages targeted by actions"})]}),t.jsxs(kx,{children:[t.jsx($x,{$color:ot,children:go(K.hero.total_ai_referrals)}),t.jsx(mp,{children:"Total AI Referrals"}),K.hero.total_ai_referrals_trend!==null&&t.jsxs(tj,{$positive:K.hero.total_ai_referrals_trend>=0,children:[K.hero.total_ai_referrals_trend>=0?"+":"",K.hero.total_ai_referrals_trend,"% vs previous ",y,"d"]})]}),t.jsxs(kx,{children:[t.jsx($x,{$color:Vt,children:go(K.hero.page_conversions)}),t.jsx(mp,{children:"Page Key Events"}),K.hero.page_conversions_trend!==null&&t.jsxs(tj,{$positive:K.hero.page_conversions_trend>=0,children:[K.hero.page_conversions_trend>=0?"+":"",K.hero.page_conversions_trend,"% vs previous ",y,"d"]})]})]}),t.jsxs(Rft,{children:[t.jsxs(Oft,{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx(Ix,{$align:"left",children:t.jsxs(Px,{$align:"left",children:["Page",t.jsx(au,{children:"The landing page URL path that received AI referral traffic."})]})}),t.jsx(Ix,{children:t.jsxs(Px,{children:["Sessions",t.jsx(au,{children:"Total sessions from all traffic sources to this page."})]})}),t.jsx(Ix,{children:t.jsxs(Px,{children:["AI Refs",t.jsx(au,{children:"Sessions referred by AI platforms (ChatGPT, Gemini, Claude, etc.)."})]})}),t.jsx(Ix,{children:t.jsxs(Px,{children:["Key Events",t.jsx(au,{children:"GA4 key events triggered by AI referral visitors on this page."})]})}),t.jsx(Ix,{children:t.jsxs(Px,{children:[y,"d Change",t.jsxs(au,{children:["AI referral session change vs. the previous ",y,"-day period."]})]})}),t.jsx(Ix,{children:t.jsxs(Px,{children:["Actions",t.jsx(au,{children:"Number of project actions targeting this page URL."})]})})]})}),t.jsx("tbody",{children:K.pages.map(ke=>{const Ve=rQ(j?.connection?.website_url,ke.page_path);return t.jsxs(U7,{children:[t.jsx(eQ,{title:ke.page_path,children:Ve?t.jsx(tQ,{href:Ve,target:"_blank",rel:"noopener noreferrer",children:ke.page_path}):ke.page_path}),t.jsx(F$,{children:go(ke.total_sessions)}),t.jsx(Bft,{children:go(ke.ai_sessions)}),t.jsx(F$,{children:go(ke.conversions)}),t.jsx(F$,{children:ke.trend!==null?t.jsxs(jx,{$positive:ke.trend>=0,children:[ke.trend>=0?t.jsx(qi,{size:12}):t.jsx(ul,{size:12}),Ax(ke.trend)]}):t.jsx("span",{style:{color:Pe},children:"â"})}),t.jsx(F$,{children:ke.actions_count>
156640?t.jsxs(Fft,{to:`/workspaces/${e}/projects/${n}/actions?view=kanban&source_cat=owned&action_types=owned_content`,children:[ke.actions_count," ",ke.actions_count===1?"action":"actions"]}):t.jsx("span",{style:{color:Pe},children:"â"})})]},ke.page_path)})})]}),K.pages_pagination&&t.jsx(pi,{page:K.pages_pagination.page,totalPages:K.pages_pagination.total_pages,total:K.pages_pagination.total,onPrev:()=>Ue(W-1),onNext:()=>Ue(W+1),compact:!0})]}),K.hero.page_conversions===0&&t.jsxs(R$,{children:[t.jsxs(O$,{onClick:()=>R(ke=>!ke),children:[t.jsx(wn,{size:15,style:{color:ot,flexShrink:0}}),t.jsx(D$,{children:"Key Events column showing 0? Configure key events in GA4"}),M?t.jsx(yu,{size:16,style:{color:Pe}}):t.jsx(qn,{size:16,style:{color:Pe}})]}),M&&t.jsxs(L$,{children:["Ceyo uses ",t.jsx("strong",{children:"Key Events"})," from Google Analytics. Once configured, the Key Events column will show counts per landing page.",t.jsxs(F7,{children:[t.jsxs(ol,{children:["Open ",t.jsx("strong",{children:"Google Analytics"})," â select your property"]}),t.jsxs(ol,{children:["Go to ",t.jsx("strong",{children:"Admin"})," (gear icon) â under your property, click ",t.jsx("strong",{children:"Events"})]}),t.jsxs(ol,{children:["Find an event you want to track (e.g. ",t.jsx("strong",{children:"form_submit"}),", ",t.jsx("strong",{children:"purchase"}),", ",t.jsx("strong",{children:"sign_up"}),") or create a custom one"]}),t.jsxs(ol,{children:["Toggle ",t.jsx("strong",{children:'"Mark as key event"'})," next to it"]}),t.jsxs(ol,{children:["Come back here and ",t.jsx("strong",{children:"Sync Now"})," â key event data will appear on the next sync"]})]})]})]}),K.platform_matrix.pages.length>0&&t.jsxs(Wft,{children:[t.jsxs(Uft,{children:[t.jsx(Hft,{children:"AI Referrals by Page à Platform"}),t.jsx(qft,{children:"Which AI platforms are sending traffic to which pages"})]}),t.jsxs(Gft,{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx(nQ,{style:{textAlign:"left"},children:"Page"}),K.platform_matrix.platform_names.map((ke,Ve)=>{const pt=H7[ke];return t.jsx(nQ,{title:ke,children:pt?t.jsx(iQ,{children:t.jsx(pt,{})}):t.jsx(Kft,{$color:K.platform_matrix.platform_colors[Ve]})},ke)})]})}),t.jsx("tbody",{children:K.platform_matrix.pages.map(ke=>{const Ve=rQ(j?.connection?.website_url,ke.page_path);return t.jsxs(U7,{children:[t.jsx(eQ,{title:ke.page_path,children:Ve?t.jsx(tQ,{href:Ve,target:"_blank",rel:"noopener noreferrer",children:ke.page_path}):ke.page_path}),ke.platforms.map((pt,Nt)=>t.jsx(Vft,{children:pt>0?go(pt):t.jsx("span",{style:{color:Pe},children:"â"})},Nt))]},ke.page_path)})})]}),K.matrix_pagination&&t.jsx(pi,{page:K.matrix_pagination.page,totalPages:K.matrix_pagination.total_pages,total:K.matrix_pagination.total,onPrev:()=>We(se-1),onNext:()=>We(se+1),compact:!0})]})]}):nn?t.jsxs(Zw,{children:[t.jsx(Gg,{size:24,style:{color:Pe}}),t.jsx(Jw,{children:"No AI landing page data"}),t.jsx(ej,{children:"There are no AI referral sessions with page path data for the selected period."})]}):null}),h==="earned_referrals"&&t.jsx(t.Fragment,{children:je&&!tt?t.jsxs(t.Fragment,{children:[t.jsx(nt,{style:{width:"100%",height:48,borderRadius:10}}),t.jsx(nt,{style:{width:"100%",height:300,borderRadius:10}}),t.jsx(nt,{style:{width:"100%",height:200,borderRadius:10}})]}):k&&!tt?t.jsxs(Qw,{children:[t.jsx(ym,{size:24,style:{color:ot}}),t.jsx(_x,{children:"Syncing your analytics data..."}),t.jsx(Cx,{children:"Pulling up to 180 days of Google Analytics data. This may take a minute."})]}):!nn&&!k?t.jsxs(Zw,{children:[t.jsx(Gg,{size:24,style:{color:Pe}}),t.jsx(Jw,{children:"No earned referral data yet"}),t.jsx(ej,{children:"Once analytics data is synced and you have completed earned actions, this tab will show referral traffic from those sources."})]}):tt?(()=>{const ke=tt,Ve=Math.max(...ke.sources.map(pt=>pt.sessions),1);return t.jsxs(t.Fragment,{children:[k?t.jsxs(Sx,{children:[t.jsx(ym,{size:16,style:{color:ot,flexShrink:0}}),t.jsx("span",{children:"Updating analytics data â this may take a momentâ¦"})]}):ke.summary?t.jsxs(Sx,{children:[t.jsx(Xw,{children:"C"}),t.jsx("span",{children:ke.summary})]}):null,ke.sources.length>0&&t.jsxs(T$,{children:[t.jsx(E$,{children:t.jsxs("div",{children:[t.jsx(M$,{children:"Earned Source Referrals"}),t.jsx("div",{style:{fontSize:"0.75rem",color:z,marginTop:2},children:"Traffic from platforms targeted by your earned actions"})]})}),t.jsxs(Igt,{children:[t.jsx(W$,{style:{width:28}}),t.jsx(W$,{style:{width:120},children:"Source"}),t.jsx("div",{style:{flex:1,minWidth:0}}),t.jsx(W$,{style:{minWidth:40,textAlign:"right"},children:"Sessions"}),t.jsx(W$,{style:{width:20}})]}),ke.sources.map(pt=>{const Nt=De===pt.domain;return t.jsxs("div",{children:[t.jsxs(bgt,{$expanded:Nt,onClick:()=>te(Nt?null:pt.domain),children:[t.jsx(Sgt,{onClick:qe=>
15664qe.stopPropagation(),children:t.jsx("a",{href:`https://${pt.domain}`,target:"_blank",rel:"noopener noreferrer",style:{display:"flex"},children:t.jsx($u,{domain:pt.domain,size:22})})}),t.jsx(kgt,{href:`https://${pt.domain}`,target:"_blank",rel:"noopener noreferrer",title:pt.domain,onClick:qe=>qe.stopPropagation(),children:pt.domain}),t.jsx(QX,{children:t.jsx(ZX,{$width:Math.max(pt.sessions/Ve*100,3),$color:pt.color})}),t.jsx($gt,{title:`${pt.sessions.toLocaleString()} referral sessions in the last ${y} days`,children:go(pt.sessions)}),t.jsx(Cgt,{children:Nt?t.jsx(yu,{size:14}):t.jsx(qn,{size:14})})]}),Nt&&pt.daily_series&&pt.daily_series.length>0&&t.jsxs(vgt,{children:[t.jsxs(wgt,{children:[t.jsxs(jgt,{children:["Daily Sessions â ",pt.domain]}),t.jsxs(_gt,{children:[pt.sessions.toLocaleString()," total"]})]}),t.jsx(Gl,{width:"100%",height:160,children:t.jsxs(C1,{data:pt.daily_series,margin:{top:8,right:8,left:0,bottom:0},children:[t.jsx(Zm,{strokeDasharray:"3 3",stroke:V}),t.jsx(Ql,{dataKey:"date",tick:{fontSize:10,fill:Pe},tickFormatter:qe=>{const qt=new Date(qe+"T00:00:00");return`${qt.getMonth()+1}/${qt.getDate()}`},interval:"preserveStartEnd",stroke:Rt}),t.jsx(Zl,{tick:{fontSize:10,fill:Pe},allowDecimals:!1,width:32,stroke:Rt}),t.jsx(Vl,{contentStyle:{fontSize:12,borderRadius:8,border:`1px solid ${V}`,boxShadow:"0 2px 8px rgba(0,0,0,0.08)"},labelFormatter:qe=>new Date(qe+"T00:00:00").toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"}),formatter:qe=>[Number(qe??0).toLocaleString(),"Sessions"]}),t.jsx(Nd,{type:"monotone",dataKey:"sessions",stroke:pt.color,strokeWidth:2,dot:{r:2.5,fill:pt.color,strokeWidth:0},activeDot:{r:4,fill:pt.color,strokeWidth:0}})]})})]})]},pt.domain)}),ke.sources_pagination&&t.jsx(pi,{page:ke.sources_pagination.page,totalPages:ke.sources_pagination.total_pages,total:ke.sources_pagination.total,onPrev:()=>Le(Se-1),onNext:()=>Le(Se+1),compact:!0})]}),ke.sources.length===0&&t.jsxs(Zw,{children:[t.jsx(Gg,{size:24,style:{color:Pe}}),t.jsx(Jw,{children:"No earned referral data"}),t.jsx(ej,{children:"Complete earned actions (Editorial, UGC, Reference) to start tracking referral traffic from those sources. Actions targeting external platforms will appear here once analytics data includes matching referral traffic."})]})]})})():null}),h==="conversions"&&t.jsx(t.Fragment,{children:ee&&!le?t.jsxs(t.Fragment,{children:[t.jsx(nt,{style:{width:"100%",height:48,borderRadius:10}}),t.jsx(B$,{children:[1,2,3].map(ke=>t.jsx(nt,{style:{height:90,borderRadius:10}},ke))}),t.jsx(nt,{style:{width:"100%",height:200,borderRadius:10}})]}):k&&!le?t.jsxs(Qw,{children:[t.jsx(ym,{size:24,style:{color:ot}}),t.jsx(_x,{children:"Syncing your analytics data..."}),t.jsx(Cx,{children:"Pulling up to 180 days of Google Analytics data. This may take a minute."})]}):!nn&&!k?t.jsxs(Zw,{children:[t.jsx(Gg,{size:24,style:{color:Pe}}),t.jsx(Jw,{children:"No key event data yet"}),t.jsx(ej,{children:"Once analytics data is synced, this tab will show conversion performance across traffic channels."})]}):le?(()=>{const ke=le,Ve=ke.hero.ai.conversions===0&&ke.hero.organic.conversions===0&&ke.hero.direct.conversions===0,pt=Math.max(...ke.rate_by_source.map(rn=>rn.rate),.1),Nt=ie.length>0,qe=Ae.map(rn=>({id:rn.name,label:`${rn.name} ⢠${go(rn.total_key_events)}`})),qt=we||Ae.length>0||Nt,Mn=Nt?"Conversions":"Key Events",zt=Nt?"conv rate":"key event rate",dn=Nt?"Selected GA4 key event conversions triggered by visitors from this platform.":"All GA4 key events triggered by visitors from this platform. Multiple key events can happen in one session.";return t.jsxs(t.Fragment,{children:[qt&&t.jsxs(pgt,{children:[t.jsxs(mgt,{children:[t.jsx(hgt,{children:"Filter by GA4 key event"}),t.jsx(fgt,{children:Nt?`Showing conversions for ${ie.length} selected event${ie.length===1?"":"s"}
15664`:"Showing all GA4 key events combined"})]}),Nt&&t.jsx(ggt,{children:ie.map(rn=>t.jsxs(ygt,{onClick:()=>Be(rn),title:`Remove ${rn}`,type:"button",children:[rn,t.jsx(Ei,{size:11})]},rn))}),t.jsx(_re,{options:qe,value:ie,onChange:Re,disabled:we||Ae.length===0,allLabel:"All events",noun:"event",icon:t.jsx(UE,{size:14}),searchPlaceholder:"Search eventsâ¦"})]}),k?t.jsxs(Sx,{children:[t.jsx(ym,{size:16,style:{color:ot,flexShrink:0}}),t.jsx("span",{children:"Updating analytics data â this may take a momentâ¦"})]}):ke.summary?t.jsxs(Sx,{children:[t.jsx(Xw,{children:"C"}),t.jsx("span",{children:ke.summary})]}):null,t.jsxs(B$,{children:[t.jsxs(kx,{children:[t.jsx($x,{$color:Vt,children:go(ke.hero.ai.conversions)}),t.jsxs(mp,{children:["AI Referral ",Mn]}),t.jsxs(mp,{style:{fontWeight:600,color:O},children:[ke.hero.ai.rate,"% ",zt]}),ke.hero.ai.trend!==null&&t.jsxs(tj,{$positive:ke.hero.ai.trend>=0,children:[ke.hero.ai.trend>=0?"+":"",ke.hero.ai.trend,"% vs prev ",y,"d"]})]}),t.jsxs(kx,{children:[t.jsx($x,{children:go(ke.hero.organic.conversions)}),t.jsxs(mp,{children:["Organic ",Mn]}),t.jsxs(mp,{style:{fontWeight:600,color:O},children:[ke.hero.organic.rate,"% ",zt]}),ke.hero.organic.trend!==null&&t.jsxs(tj,{$positive:ke.hero.organic.trend>=0,children:[ke.hero.organic.trend>=0?"+":"",ke.hero.organic.trend,"% vs prev ",y,"d"]})]}),t.jsxs(kx,{children:[t.jsx($x,{children:go(ke.hero.direct.conversions)}),t.jsxs(mp,{children:["Direct ",Mn]}),t.jsxs(mp,{style:{fontWeight:600,color:O},children:[ke.hero.direct.rate,"% ",zt]}),ke.hero.direct.trend!==null&&t.jsxs(tj,{$positive:ke.hero.direct.trend>=0,children:[ke.hero.direct.trend>=0?"+":"",ke.hero.direct.trend,"% vs prev ",y,"d"]})]})]}),ke.rate_by_source.length>0&&t.jsxs(Yft,{children:[t.jsxs(Xft,{children:[Mn," Rate by Source"]}),t.jsxs(Qft,{children:["Compare ",Nt?"conversion":"key event"," performance across traffic channels"]}),ke.rate_by_source.map(rn=>t.jsxs(Zft,{children:[t.jsx(Jft,{children:rn.name}),t.jsx(egt,{children:t.jsx(tgt,{$width:Math.max(rn.rate/pt*100,3),$color:rn.color,children:t.jsxs(ngt,{$inside:!0,children:[rn.rate,"%"]})})})]},rn.name))]}),t.jsxs(igt,{children:[t.jsxs(rgt,{children:[t.jsxs(ogt,{children:[Mn," by AI Platform"]}),t.jsx(sgt,{children:"Performance breakdown per AI referral source"})]}),t.jsxs(agt,{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsxs(nj,{$align:"left",children:["Platform ",t.jsx(au,{children:"The AI platform that referred traffic to your site (e.g. ChatGPT, Gemini, Perplexity)."})]}),t.jsxs(nj,{children:["Sessions ",t.jsx(au,{children:"Total visits from this AI platform during the selected period."})]}),t.jsxs(nj,{children:[Mn," ",t.jsx(au,{children:dn})]}),t.jsxs(nj,{children:[Nt?"Conv Rate":"Key Event Rate"," ",t.jsxs(au,{children:["Percentage of sessions that resulted in ",Nt?"the selected conversion event":"a GA4 key event","."]})]}),t.jsxs(nj,{children:["vs Prev ",t.jsxs(au,{children:["Percentage change in ",Nt?"conversions":"key events"," compared to the previous period of equal length."]})]})]})}),t.jsx("tbody",{children:ke.by_platform.length>0?ke.by_platform.map(rn=>{const bn=H7[rn.name];return t.jsxs(U7,{children:[t.jsxs(lgt,{children:[bn?t.jsx(iQ,{style:{marginRight:8,verticalAlign:"middle"},children:t.jsx(bn,{})}):t.jsx(cgt,{$color:rn.color}),rn.name]}),t.jsx(ij,{children:go(rn.sessions)}),t.jsx(ij,{children:go(rn.conversions)}),t.jsx(ij,{children:t.jsxs(dgt,{children:[rn.rate,"%"]})}),t.jsx(ij,{children:rn.trend!==null?t.jsxs(jx,{$positive:rn.trend>=0,children:[rn.trend>=0?t.jsx(qi,{size:12}):t.jsx(ul,{size:12}),Ax(rn.trend)]}):t.jsx("span",{style:{color:Pe},children:"â"})})]},rn.name)}):t.jsx("tr",{children:t.jsx(ij,{colSpan:5,style:{textAlign:"center",color:Pe,padding:"24px 16px"},children:"No AI platform sessions in this period"})})})]})]}),ke.summary&&!Ve&&t.jsxs(ugt,{children:[t.jsx(Xw,{children:"C"}),t.jsxs("div",{children:[t.jsx(xgt,{children:"Key Insight"}),t.jsx("div",{style:{marginTop:2},children:ke.summary})]})]}),Ve&&!Nt&&Ae.length===0&&t.jsxs(R$,{children:[t.jsxs(O$,{onClick:()=>R(rn=>!rn),children:[t.jsx(wn,{size:15,style:{color:ot,flexShrink:0}}),t.jsx(D$,{children:"No key events configured in GA4"}),M?t.jsx(yu,{size:16,style:{color:Pe}}):t.jsx(qn,{size:16,style:{color:Pe}})]}),M&&t.jsxs(L$,{children:["Ceyo uses ",t.jsx("strong",{children:"Key Events"})," from Google Analytics. Once configured, this tab will show key event counts and rates across all traffic channels.",t.jsxs(F7,{children:[t.jsxs(ol,{children:["Open ",t.jsx("strong",{children:"Google Analytics"})," â select your property"]}),t.jsxs(ol,{children:["Go to ",t.jsx("strong",{children:"Admin"})," (gear icon) â under your property, click ",t.jsx("strong",{children:"Events"})]}),t.jsxs(ol,{children:["Find an event you want to track (e.g. ",t.jsx("strong",{children:"form_submit"}),", ",t.jsx("strong",{children:"purchase"}),", ",t.jsx("strong",{children:"sign_up"}),") or create a custom one"]}),t.jsxs(ol,{children:["Toggle ",t.jsx("strong",{children:'"Mark as key event"'})," next to it"]}),t.jsxs(ol,{children:["Come back here and ",t.jsx("strong",{children:"Sync Now"})," â key event data will appear on the next sync"]})]})]})]}),Ve&&Nt&&t.jsxs(R$,{children:[t.jsxs(O$,{as:"div",style:{cursor:"default"},children:[t.jsx(wn,{size:15,style:{color:ot,flexShrink:0}}),t.jsxs(D$,{children:["No conversions for ",ie.length===1?`â${ie[0]}â`:"the selected events"," in this period"]})]}),t.jsx(L$,{children:"Try widening the date range or removing one of the selected events."})]})]})})():null})]})}),t.jsx(rft,{isOpen:A,onClose:()=>{E(!1),T(!1)},orgId:e||"",projectId:n||"",isConnected:vt,currentAccountId:j?.connection?.account_id||null,currentPropertyId:X,connectedEmail:j?.connection?.google_account_email||null,connectedVia:j?.connection?.connected_via,authStrategy:j?.connection?.auth_strategy,currentTokenSourceId:j?.connection?.token_source?.id||null,currentExternalProjectId:j?.connection?.external_project_id||"",initialExternalOpen:B,onConnectWithOAuth:()=>{E(!1),T(!1),ze()},onDisconnected:()=>{U("disconnected"),Q(null),v(null),I(null)},onPropertySelected:ke=>{U("connected"),Q(ke||null),v(null),G(null),me(null),dt(null),P(!!ke),I(null),Je()}}),e&&n&&vt?t.jsx(EC,{orgId:Number(e),projectId:Number(n),sessionTitle:Mgt(s?.name),initialMessage:Ie,metadata:{resource_type:"google_analytics",resource_id:Number(n)},placeholder:"Ask about analyticsâ¦",variant:"overlay",launcher:"floating"}):null]})}function Ogt(){const e=zn(),n=window.opener!==null;return l.useEffect(()=>{(async()=>
15664{const r=new URLSearchParams(window.location.search),o=r.get("code"),s=r.get("state"),a=r.get("error");if(a){n?(window.opener?.postMessage({type:"GA_OAUTH_ERROR",error:a},window.location.origin),setTimeout(()=>window.close(),100)):e("/",{replace:!0});return}if(!o||!s){n?(window.opener?.postMessage({type:"GA_OAUTH_ERROR",error:"Missing code or state"},window.location.origin),setTimeout(()=>window.close(),100)):e("/",{replace:!0});return}try{const c=await ue("/api/v1/google_analytics/oauth/exchange",{method:"POST",body:JSON.stringify({code:o,state:s})}),u=await c.json().catch(()=>null);if(!c.ok||!u?.organization_id||!u?.project_id){n?(window.opener?.postMessage({type:"GA_OAUTH_ERROR",error:"Exchange failed"},window.location.origin),setTimeout(()=>window.close(),100)):e("/",{replace:!0});return}n?(window.opener?.postMessage({type:"GA_OAUTH_SUCCESS",organization_id:u.organization_id,project_id:u.project_id},window.location.origin),setTimeout(()=>window.close(),100)):e(`/workspaces/${u.organization_id}/projects/${u.project_id}/analytics`,{replace:!0})}catch{n?(window.opener?.postMessage({type:"GA_OAUTH_ERROR",error:"Network error"},window.location.origin),setTimeout(()=>window.close(),100)):e("/",{replace:!0})}})()},[e,n]),t.jsx(IP,{message:"Completing Google Analytics connection..."})}function z1({disabled:e}){const{workspaceId:n}=Gn(),{requestLeave:i}=oC(),r=Number(n);return t.jsx(he,{type:"button",variant:"ghost",size:"sm",disabled:e,onClick:()=>{!Number.isFinite(r)||r<=0||i(`/workspaces/${r}`)},children:"Cancel"})}const LC=p(Uf).withConfig({displayName:"style__ButtonContainer",componentId:"sc-1tp92y4-0"})` 15665 @media (max-width: 640px) { 15666 position: sticky; 15667 bottom: 0; 15668 z-index: 5; 15669 padding-top: 0.75rem; 15670 padding-bottom: calc(0.75rem + env(safe-area-inset-bottom)); 15671 background: ${At}; 15672 border-top: 1px solid ${V}; 15673 } 15674`,T1=p.div.withConfig({displayName:"style__Container",componentId:"sc-1tp92y4-1"})` 15675 min-height: 100vh; 15676 min-height: 100dvh; 15677 width: 100%; 15678 display: flex; 15679 align-items: center; 15680 justify-content: center; 15681 padding: 2rem 1.5rem; 15682 padding-bottom: calc(2rem + env(safe-area-inset-bottom)); 15683 background: ${At}; 15684 15685 @media (max-width: 640px) { 15686 align-items: flex-start; 15687 padding: 1.25rem 1rem; 15688 padding-bottom: calc(1.25rem + env(safe-area-inset-bottom)); 15689 } 15690`,E1=p.div.withConfig({displayName:"style__FormSection",componentId:"sc-1tp92y4-2"})` 15691 width: 100%; 15692 display: flex; 15693 align-items: center; 15694 justify-content: center; 15695`,Dgt=p.div.withConfig({displayName:"AddProjectWebsiteStep__WebsiteInlineError",componentId:"sc-1l1sspn-0"})` 15696 margin-top: 0.25rem; 15697 font-size: 0.75rem; 15698 color: ${Ut}; 15699 min-height: 1rem; 15700`;function Lgt(){const e=zn(),{workspaceId:n}=Gn(),i=Number(n),{setUser:r}=yn(),[o,s]=l.useState(""),[a,c]=l.useState(""),[u,m]=l.useState(!0),[h,g]=l.useState(!1),[x,y]=l.useState(null),[w,j]=l.useState(!1);l.useEffect(()=>{let P=!1;const S=async()=>{m(!0);try{const I=await ue(`/api/v1/organizations/${i}/projects/add_flow/step_info?step_number=1`,{method:"GET"});if(!I.ok)return;const A=await I.json().catch(()=>({}));if(P)return;const E=A?.project||{};typeof E?.name=="string"&&s(E.name),typeof E?.website=="string"&&c(E.website)}finally{P||m(!1)}};return Number.isFinite(i)&&i>0&&S(),()=>{P=!0}},[i]);const v=Wl(a),_=a.trim().length>0&&!v,$=!!v,k=async P=>{if(P.preventDefault(),!(!o.trim()||!a.trim()||h)){if(!v){j(!0),y("Please enter a valid website URL (e.g., example.com or https://example.com)");return}g(!0),y(null);try{const S=await ue(`/api/v1/organizations/${i}/projects/add_flow/step`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({step_number:1,project:{name:o.trim(),website:v}})}),I=await S.json().catch(()=>({}));if(!S.ok){y(I.errors?.[0]||I.error||"Failed to save project"),g(!1);return}I?.user&&r(I.user),e(`/workspaces/${i}/projects/new?step=location`,{replace:!0})}catch{y("Network error. Please try again."),g(!1)}}};return t.jsx(T1,{children:t.jsx(E1,{children:t.jsx(bl,{children:t.jsxs(vl,{children:[t.jsx(Vc,{currentStep:1,totalSteps:5}),t.jsx("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:"0.5rem",marginBottom:"0.25rem"},children:t.jsx(z1,{disabled:h||u})}),t.jsxs(Yc,{children:[t.jsx(Wd,{children:"Create a new project"}),t.jsx(Ud,{children:"Enter your project name and website to get started."})]}),x&&t.jsx(Xs,{children:x}),t.jsxs(Ru,{onSubmit:k,children:[t.jsxs(Wo,{children:[t.jsx(js,{htmlFor:"projectName",children:"Project Name"}),t.jsx(Xt,{id:"projectName",type:"text",placeholder:"Enter project name",leftIcon:t.jsx(Y8,{size:20}),value:o,onChange:P=>s(P.target.value),disabled:u||h,required:!0}),t.jsx(_s,{children:"This will be the name of your project."})]}),t.jsxs(Wo,{children:[t.jsx(js,{htmlFor:"website",children:"Website URL"}),t.jsx(EA,{id:"website",value:a,onChange:P=>{j(!0),c(P.target.value),y(null)},onBlur:()=>j(!0),disabled:u||h,required:!0}),w&&_?t.jsxs(Dgt,{children:["This URL looks malformed. Please check it (e.g., ",t.jsx("strong",{children:"example.com"}),")."]}):t.jsx(_s,{children:"Enter the website URL for this project."})]}),t.jsx(LC,{style:{justifyContent:"flex-end"},children:t.jsx(he,{type:"submit",variant:"nav",disabled:!o.trim()||!$||u||h,children:h?"Loading...":"Continue"})})]})]})})})})}const Bgt=p.div.withConfig({displayName:"AddProjectLocationStep__FormRow",componentId:"sc-1xfbmmm-0"})` 15701 display: flex; 15702 gap: 1rem; 15703 width: 100%; 15704 15705 @media (max-width: 768px) { 15706 flex-direction: column; 15707 } 15708`,cQ=p.div.withConfig({displayName:"AddProjectLocationStep__FormRowItem",componentId:"sc-1xfbmmm-1"})` 15709 flex: 1; 15710`,Fgt=p.div.withConfig({displayName:"AddProjectLocationStep__InlineError",componentId:"sc-1xfbmmm-2"})` 15711 margin-top: 0.25rem; 15712 font-size: 0.75rem; 15713 color: ${Ut}; 15714 min-height: 1rem; 15715`;function Wgt(){const e=zn(),{workspaceId:n}=Gn(),i=Number(n),{setUser:r}=yn(),[o,s]=l.useState(""),[a,c]=l.useState([]),[u,m]=l.useState(null),[h,g]=l.useState(!1),[x,y]=l.useState(null),[w,j]=l.useState(""),[v,_]=l.useState([]),[$,k]=l.useState(""),[P,S]=l.useState(""),[I,A]=l.useState(!1),[E,B]=l.useState(!0),[T,M]=l.useState(!1),[R,F]=l.useState(null);l.useEffect(()=>{let K=!1;const G=async()=>{B(!0);try{const L=await ue(`/api/v1/organizations/${i}/projects/add_flow/step_info?step_number=2`,{method:"GET"});if(!L.ok)return;const q=await L.json().catch(()=>({}));if(K)return;const W=q?.location||{};if(typeof W?.city=="string"&&typeof W?.country=="string"&&(m({name:W.city,country:W.country,country_code:typeof W?.country_code=="string"?W.country_code:void 0}),s(`${W.city}, ${W.country}`)),typeof W?.language=="string"){j(W.language);const oe=Bo.find(se=>se.iso639_1===W.language);oe&&k(oe.name)}
15715typeof W?.focus=="string"&&S(W.focus),typeof W?.local_mode=="boolean"&&A(W.local_mode)}finally{K||B(!1)}};return Number.isFinite(i)&&i>0&&G(),()=>{K=!0}},[i]),l.useEffect(()=>{if(!o||o.length<2){c([]),y(null);return}const K=window.setTimeout(async()=>{g(!0),y(null);try{const L=(await Jb(o)).map(q=>{const oe=String(q?.place_type||"")==="Country"||!q.name&&!q.state&&!!q.country_code,se=String(q.name||q.state||q.country||"Unknown"),de=oe?[q.country]:[se,q.country];return!oe&&q.state&&q.name&&de.splice(1,0,q.state),{value:oe?q.country:`${se}, ${q.country}`,label:de.join(", "),data:{name:oe?"":String(q.name||q.state||se),country:q.country,country_code:q.country_code,state:q.state}}});c(L),L.length===0&&o.length>=2&&y("No results found")}catch{c([]),y("Location data unavailable")}finally{g(!1)}},300);return()=>window.clearTimeout(K)},[o]),l.useEffect(()=>{_(Bo.map(K=>({value:K.iso639_1,label:K.name})))},[]),l.useEffect(()=>{if(!$){_(Bo.map(G=>({value:G.iso639_1,label:G.name})));return}const K=Bo.filter(G=>G.name.toLowerCase().includes($.toLowerCase()));_(K.map(G=>({value:G.iso639_1,label:G.name})))},[$]);const Y=K=>{const G=K;s(G.label),m({name:G.data.name,country:G.data.country,country_code:G.data.country_code}),c([]),y(null)},H=K=>{j(K.value);const G=Bo.find(L=>L.iso639_1===K.value);G&&k(G.name)},U=K=>{A(K),K&&S("city")},X=async K=>{if(K.preventDefault(),!(!u||!w||!P||T)&&!(I&&!u.name)){M(!0),F(null);try{const G=await ue(`/api/v1/organizations/${i}/projects/add_flow/step`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({step_number:2,location:{city:u.name,country:u.country,country_code:u.country_code,language:w,focus:P,cadence:"daily",local_mode:I}})}),L=await G.json().catch(()=>({}));if(!G.ok){F(L.errors?.[0]||L.error||"Failed to save location"),M(!1);return}if(L?.user){const q=Number(L?.next_step_number),W=Number.isFinite(q)?q:null;r({...L.user,...W?{add_project_active:!0,add_project_step:W,add_project_organization_id:i}:{}})}M(!1)}catch{F("Network error. Please try again."),M(!1)}}},Q=()=>{T||e(`/workspaces/${i}/projects/new?step=website`,{replace:!0})};return t.jsx(T1,{children:t.jsx(E1,{children:t.jsx(bl,{children:t.jsxs(vl,{children:[t.jsx(Vc,{currentStep:2,totalSteps:5}),t.jsx("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:"0.5rem",marginBottom:"0.25rem"},children:t.jsx(z1,{disabled:T||E})}),t.jsxs(Yc,{children:[t.jsx(Wd,{children:"Where are you located?"}),t.jsx(Ud,{children:"Tell us about your location, language, and focus area."})]}),R&&t.jsx(Xs,{children:R}),t.jsxs(Ru,{onSubmit:X,children:[t.jsxs(Bgt,{children:[t.jsx(cQ,{children:t.jsxs(Wo,{children:[t.jsx(js,{htmlFor:"city",children:"Location"}),t.jsx(_u,{value:o,onChange:K=>{s(K),m(null)},onSelect:Y,placeholder:"Search for a city or country...",leftIcon:t.jsx(_y,{size:20}),options:a,isLoading:h,disabled:E||T}),x?t.jsx(Fgt,{children:x}):t.jsx(_s,{children:"Search and select your city."})]})}),t.jsx(cQ,{children:t.jsxs(Wo,{children:[t.jsx(js,{htmlFor:"language",children:"Language"}),t.jsx(_u,{value:$,onChange:K=>{k(K);const G=Bo.find(L=>L.name.toLowerCase()===K.toLowerCase());j(G?G.iso639_1:"")},onSelect:H,placeholder:"Search for a language...",leftIcon:t.jsx(To,{size:20}),options:v,disabled:E||T}),t.jsx(_s,{children:"Select the primary language for your project."})]})})]}),t.jsxs(Wo,{children:[t.jsx(js,{htmlFor:"focus",children:"Focus"}),t.jsx(WO,{value:P||"",onChange:K=>S(K),disabled:E||T||I}),t.jsx(_s,{children:I?"Set to city when local mode is enabled.":"What is your main focus area?"})]}),t.jsx(Wo,{children:t.jsx(dM,{checked:I,onChange:U,disabled:E||T,label:"Local mode",description:"Generate hyper-targeted prompts, actions, and competitors focused on your project's specific city and area."})}),t.jsxs(LC,{children:[t.jsx(he,{type:"button","data-back-button":!0,onClick:Q,disabled:T,variant:"navOutline",children:"â Back"}),t.jsx(he,{type:"submit",variant:"nav",disabled:!u||!u.country||!u.country_code||!w||!P||P==="city"&&!u.name||I&&!u.name||E||T,children:T?"Loading...":"Continue"})]})]})]})})})})}const Nx=5,Ugt=p(bl).withConfig({displayName:"AddProjectTopicsStep__WideFormContainer",componentId:"sc-byk36c-0"})` 15716 @media (min-width: 1024px) { 15717 max-width: 44rem; 15718 } 15719`,Hgt=p.div.withConfig({displayName:"AddProjectTopicsStep__LabelRow",componentId:"sc-byk36c-1"})` 15720 display: flex; 15721 align-items: center; 15722 justify-content: space-between; 15723 gap: 0.75rem; 15724`,qgt=p.span.withConfig({displayName:"AddProjectTopicsStep__CounterPill",componentId:"sc-byk36c-2"})` 15725 font-size: 0.75rem; 15726 font-weight: 700; 15727 color: ${z}; 15728 background: ${$e}; 15729 border: 1px solid ${V}; 15730 padding: 0.125rem 0.5rem; 15731 border-radius: 9999px; 15732 white-space: nowrap; 15733`;function Ggt(){const{setUser:e}=yn(),{workspaceId:n}=Gn(),i=Number(n),[r,o]=l.useState([]),[s,a]=l.useState(""),[c,u]=l.useState(!0),[m,h]=l.useState(!1),[g,x]=l.useState(null),[y,w]=l.useState(null),[j,v]=l.useState(null),_=l.useMemo(()=>new Set(r.map(M=>
15733M.trim().toLowerCase()).filter(Boolean)),[r]),$=r.length>=Nx,k=l.useMemo(()=>r.map(M=>({id:M,name:M})),[r]),P=async()=>{u(!0),x(null);try{const M=await ue(`/api/v1/organizations/${i}/projects/add_flow/step_info?step_number=3`,{method:"GET"});if(!M.ok){x("Failed to load topics");return}const F=(await M.json().catch(()=>({})))?.topics,Y=(F?.status||"").toString();w(Y||null),v(F?.error?String(F.error):null);const H=Array.isArray(F?.selected)?F.selected:[],U=Array.isArray(F?.suggested)?F.suggested:[],X=(H.length>0?H:U).map(Q=>String(Q||"").trim()).filter(Boolean).slice(0,Nx);o(X)}catch{x("Network error. Please try again.")}finally{u(!1)}};l.useEffect(()=>{let M=!1,R=null;return(async()=>(await P(),!M&&(R=window.setInterval(async()=>{M||y==="running"&&await P()},4e3))))(),()=>{M=!0,R&&window.clearInterval(R)}},[i,y]);const S=async()=>{h(!0),x(null);try{const R=await(await ue(`/api/v1/organizations/${i}/projects/add_flow/step`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({step_number:3})})).json().catch(()=>({}));R?.user&&e(R.user),await P()}catch{x("Network error. Please try again.")}finally{h(!1)}},I=()=>{if($){x(`You can add up to ${Nx} topics.`);return}const M=s.trim();if(!M)return;if(M.length>ni.topicNameMaxChars){x(`Topic is too long (max ${ni.topicNameMaxChars} characters).`);return}const R=M.toLowerCase();if(_.has(R)){x("This topic already exists");return}o(F=>[...F,M]),a(""),x(null)},A=M=>{o(R=>R.filter(F=>F!==M))},E=async M=>{if(M.preventDefault(),m)return;const R=r.map(F=>F.trim().toLowerCase()).filter(F=>F.length>0);if(R.length===0){x("Please add at least one topic");return}if(R.length>Nx){x(`You can select a maximum of ${Nx} topics.`);return}h(!0),x(null);try{const F=await ue(`/api/v1/organizations/${i}/projects/add_flow/step`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({step_number:3,topics:{names:R}})}),Y=await F.json().catch(()=>({}));if(!F.ok){x(Y?.error||Y?.errors?.[0]||"Failed to save topics"),h(!1);return}if(Y?.user){const H=Number(Y?.next_step_number),U=Number.isFinite(H)?H:null;e({...Y.user,...U?{add_project_active:!0,add_project_step:U,add_project_organization_id:i}:{}})}h(!1)}catch{x("Network error. Please try again."),h(!1)}},B=y==="running",T=y==="failed";return t.jsx(T1,{children:t.jsx(E1,{children:t.jsx(Ugt,{children:t.jsxs(vl,{children:[t.jsx(Vc,{currentStep:3,totalSteps:5}),t.jsx("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:"0.5rem",marginBottom:"0.25rem"},children:t.jsx(z1,{disabled:m})}),t.jsxs(Yc,{children:[t.jsx(Wd,{children:"Review your topics"}),t.jsx(Ud,{children:"Review and manage the topics we found. Add or remove any that donât apply."})]}),t.jsx(fde,{}),g&&t.jsx(Xs,{children:g}),T&&(j||!0)?t.jsxs(Xs,{children:[j||"Failed to generate topics."," ",t.jsxs(he,{type:"button",variant:"outline",size:"sm",onClick:S,disabled:m,children:[t.jsx(No,{size:14}),"Retry"]})]}):null,t.jsxs(Ru,{onSubmit:E,children:[t.jsxs(Wo,{children:[t.jsxs(Hgt,{children:[t.jsx(js,{children:"Add a topic"}),t.jsxs(qgt,{children:[r.length,"/",Nx]})]}),t.jsx(mde,{value:s,onChange:a,onAdd:I,disabled:c||m||$,addDisabled:!s.trim()||c||m||$}),s.length>=ni.topicNameMaxChars?t.jsxs(_s,{children:["Topic name is limited to ",ni.topicNameMaxChars," characters."]}):t.jsx(_s,{children:B?"Generating topic suggestionsâ¦":"Add a topic to your project."})]}),t.jsxs(Wo,{children:[t.jsx(js,{children:"Your topics"}),c?t.jsx(_s,{children:"Loading topicsâ¦"}):t.jsx(hde,{topics:k,onRemove:M=>A(String(M)),disabled:m,emptyText:B?"Generating topicsâ¦":"No topics yet. Add your first topic above.",tooltipMaxWidth:420})]}),t.jsx(LC,{style:{justifyContent:"flex-end"},children:t.jsx(he,{type:"submit",variant:"nav",disabled:c||m||r.length===0,children:m?"Savingâ¦":"Continue"})})]})]})})})})}const v8=["Organic Search","Brand Sentiment","Competitor Comparison"],Eg=25,Vgt=p.div.withConfig({displayName:"AddProjectPromptsStep__LabelRow",componentId:"sc-xns2qm-0"})` 15734 display: flex; 15735 align-items: center; 15736 justify-content: space-between; 15737 gap: 0.75rem; 15738`,Kgt=p.span.withConfig({displayName:"AddProjectPromptsStep__CounterPill",componentId:"sc-xns2qm-1"})` 15739 font-size: 0.75rem; 15740 font-weight: 700; 15741 color: ${z}; 15742 background: ${$e}; 15743 border: 1px solid ${V}; 15744 padding: 0.125rem 0.5rem; 15745 border-radius: 9999px; 15746 white-space: nowrap; 15747`;function Ygt(){return v8.map(e=>({value:e,label:e}))}function Xgt(e){const n=new Map;return e.forEach(i=>
15747{const r=(i.topic||"").trim();r&&(n.has(r)||n.set(r,[]),n.get(r).push(i))}),Array.from(n.entries()).map(([i,r])=>({topic:i,prompts:r})).sort((i,r)=>i.topic.localeCompare(r.topic))}function Qgt(){const{setUser:e,refreshUser:n}=yn(),{workspaceId:i}=Gn(),r=Number(i),[o,s]=l.useState([]),[a,c]=l.useState(new Set),[u,m]=l.useState(!0),[h,g]=l.useState(!1),[x,y]=l.useState(null),[w,j]=l.useState(null),[v,_]=l.useState(null),[$,k]=l.useState(null),[P,S]=l.useState({content:"",category:v8[0]}),I=l.useMemo(()=>Ygt(),[]),A=l.useMemo(()=>o.reduce((L,q)=>L+(Array.isArray(q.prompts)?q.prompts.length:0),0),[o]),E=A>=Eg,B=l.useMemo(()=>o.map(L=>({id:L.topic,name:L.topic,prompts:(Array.isArray(L.prompts)?L.prompts:[]).map(q=>({id:String(q.id),content:q.content,category:q.category}))})),[o]),T=async()=>{m(!0),y(null);try{const L=await ue(`/api/v1/organizations/${r}/projects/add_flow/step_info?step_number=4`,{method:"GET"});if(!L.ok){y("Failed to load prompts");return}const W=(await L.json().catch(()=>({})))?.prompts,oe=(W?.status||"").toString();j(oe||null),_(W?.error?String(W.error):null);const se=Array.isArray(W?.selected)?W.selected:[],de=Array.isArray(W?.suggested)?W.suggested:[],me=(se.length>0?se:de).filter(ne=>ne&&typeof ne=="object").map(ne=>({id:Date.now()+Math.floor(Math.random()*1e6),content:String(ne.content||"").trim(),category:String(ne.category||"").trim(),topic:String(ne.topic||"").trim()})).filter(ne=>ne.content.length>0&&ne.topic.length>0).slice(0,Eg),ee=Xgt(me);s(ee),ee.length>0&&c(new Set([ee[0].topic]))}catch{y("Network error. Please try again.")}finally{m(!1)}};l.useEffect(()=>{let L=!1,q=null;return(async()=>(await T(),!L&&(q=window.setInterval(async()=>{L||w==="running"&&await T()},4e3))))(),()=>{L=!0,q&&window.clearInterval(q)}},[r,w]);const M=async()=>{g(!0),y(null);try{const q=await(await ue(`/api/v1/organizations/${r}/projects/add_flow/step`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({step_number:4})})).json().catch(()=>({}));q?.user&&e(q.user),await T()}catch{y("Network error. Please try again.")}finally{g(!1)}},R=L=>{c(q=>{const W=new Set(q);return W.has(L)?W.delete(L):W.add(L),W})},F=L=>{if(E){y(`You can add up to ${Eg} prompts.`);return}k(L),S({content:"",category:v8[0]})},Y=()=>k(null),H=()=>{if(!$)return;if(E){y(`You can add up to ${Eg} prompts.`);return}const L=P.content.trim(),q=P.category;if(L){if(L.length>ni.promptContentMaxChars){y(`Prompt is too long (max ${ni.promptContentMaxChars} characters).`);return}s(W=>W.map(oe=>{if(oe.topic!==$)return oe;const se={id:Date.now(),content:L,category:q,topic:$};return{...oe,prompts:[...oe.prompts,se]}})),c(W=>new Set([...W,$])),y(null),Y()}},U=(L,q)=>{s(W=>W.map(oe=>oe.topic===L?{...oe,prompts:oe.prompts.filter(se=>se.id!==q)}:oe))},X=(L,q,W)=>{s(oe=>oe.map(se=>se.topic!==L?se:{...se,prompts:se.prompts.map(de=>de.id===q?{...de,content:W}:de)}))},Q=async L=>{if(L.preventDefault(),h)return;const q=o.flatMap(W=>W.prompts.map(oe=>({content:oe.content.trim().toLowerCase(),category:oe.category.trim().toLowerCase(),topic:W.topic.trim().toLowerCase()}))).filter(W=>W.content.length>0&&W.topic.length>0);if(q.length===0){y("Please keep at least one prompt to continue.");return}if(q.length>Eg){y(`You can select a maximum of ${Eg} prompts.`);return}g(!0),y(null);try{const W=await ue(`/api/v1/organizations/${r}/projects/add_flow/step`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({step_number:4,prompts:{items:q}})}),oe=await W.json().catch(()=>({}));if(!W.ok){const se=oe?.error||oe?.errors?.[0]||"Failed to save prompts";if(String(se).toLowerCase().includes("step out of order")){try{await n()}catch{}y("Your setup progress changed. Redirectingâ¦"),g(!1);return}y(se),g(!1);return}if(oe?.user){const se=Number(oe?.next_step_number),de=Number.isFinite(se)?se:null;e({...oe.user,...de?{add_project_active:!0,add_project_step:de,add_project_organization_id:r}:{}})}g(!1)}catch{y("Network error. Please try again."),g(!1)}},K=w==="running",G=w==="failed";return t.jsxs(T1,{children:[t.jsx(E1,{children:t.jsx(bl,{children:t.jsxs(vl,{children:[t.jsx(Vc,{currentStep:4,totalSteps:5}),t.jsx("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:"0.5rem",marginBottom:"0.25rem"},children:t.jsx(z1,{disabled:h||u})}),t.jsxs(Yc,{children:[t.jsx(Wd,{children:"Review your prompts"}),t.jsx(Ud,{children:"Review and manage the prompts we generated. Add or remove prompts as needed."})]}),x&&t.jsx(Xs,{children:x}),G&&(v||!0)?t.jsxs(Xs,{children:[v||"Failed to generate prompts."," ",t.jsxs(he,{type:"button",variant:"outline",size:"sm",onClick:M,disabled:h,children:[t.jsx(No,{size:14}),"Retry"]})]}):null,t.jsxs(Ru,{onSubmit:Q,children:[t.jsxs(Wo,{children:[t.jsxs(Vgt,{children:[t.jsx(js,{children:"Topics & prompts"}),t.jsxs(Kgt,{children:[A,"/",Eg]})]}
15747),t.jsx(gde,{topics:B,expandedTopicIds:a,onToggleTopic:L=>R(L),onAddPromptClick:L=>F(L),onRemovePrompt:(L,q)=>U(L,Number(q)),onEditPrompt:(L,q,W)=>X(L,Number(q),W),isAtMax:E,isSubmitting:h,isLoading:u,loadingText:"Loading promptsâ¦",emptyText:K?"Generating promptsâ¦":"No prompts found. Please complete the Topics step first."})]}),t.jsx(LC,{style:{justifyContent:"flex-end"},children:t.jsx(he,{type:"submit",variant:"nav",disabled:u||h||A===0,children:h?"Savingâ¦":"Continue"})})]})]})})}),t.jsx(u_,{isOpen:!!$,onClose:()=>{h||Y()},title:$?`Add prompt to ${$}`:"Add prompt",description:"Add a new prompt and choose a category.",categoryValue:P.category,categoryOptions:I,onCategoryChange:L=>S(q=>({...q,category:L})),promptValue:P.content,onPromptChange:L=>S(q=>({...q,content:L})),onAdd:H,isSubmitting:h})]})}const Vh=10,Zgt=p.div.withConfig({displayName:"AddProjectCompetitorsStep__LabelRow",componentId:"sc-1km7knq-0"})` 15748 display: flex; 15749 align-items: center; 15750 justify-content: space-between; 15751 gap: 0.75rem; 15752`,Jgt=p(bl).withConfig({displayName:"AddProjectCompetitorsStep__WideFormContainer",componentId:"sc-1km7knq-1"})` 15753 @media (min-width: 1024px) { 15754 max-width: 44rem; 15755 } 15756 15757 max-height: calc(100vh - 4rem); 15758 overflow: hidden; 15759 15760 /* iOS/mobile dynamic toolbars can clip the bottom action row when we hard-cap height */ 15761 @media (max-width: 640px) { 15762 max-height: none; 15763 overflow: visible; 15764 } 15765`,eyt=p(vl).withConfig({displayName:"AddProjectCompetitorsStep__FixedHeightCard",componentId:"sc-1km7knq-2"})` 15766 display: flex; 15767 flex-direction: column; 15768 max-height: calc(100vh - 4rem); 15769 15770 @media (max-width: 640px) { 15771 max-height: none; 15772 } 15773`,tyt=p(Ru).withConfig({displayName:"AddProjectCompetitorsStep__FixedHeightForm",componentId:"sc-1km7knq-3"})` 15774 flex: 1; 15775 min-height: 0; 15776 gap: 1rem; 15777`,nyt=p.div.withConfig({displayName:"AddProjectCompetitorsStep__ScrollArea",componentId:"sc-1km7knq-4"})` 15778 flex: 1; 15779 min-height: 0; 15780 overflow-y: auto; 15781 padding-right: 0.25rem; 15782 15783 &::-webkit-scrollbar {
15784 width: 6px; 15785 } 15786 &::-webkit-scrollbar-track { 15787 background: transparent; 15788 } 15789 &::-webkit-scrollbar-thumb { 15790 background: ${V}; 15791 border-radius: 9999px; 15792 } 15793`,iyt=p.div.withConfig({displayName:"AddProjectCompetitorsStep__AddRow",componentId:"sc-1km7knq-5"})` 15794 display: grid; 15795 grid-template-columns: minmax(0, 2.25fr) minmax(0, 1.55fr) auto; 15796 gap: 0.5rem; 15797 align-items: flex-start; 15798 15799 @media (max-width: 640px) { 15800 grid-template-columns: 1fr; 15801 } 15802`;function U$(e){try{const i=new URL(e).hostname.replace(/^www\./,""),r=i.split(".")[0]||i;return r.charAt(0).toUpperCase()+r.slice(1)}catch{return"Competitor"}}function H$(e){const n=(e||"").trim();if(!n)return null;try{return new URL(n.includes("://")?n:`https://${n}`).hostname?.toLowerCase().replace(/^www\./,"").trim()||null}catch{return null}}function ryt(){const{setUser:e}=yn(),{workspaceId:n}=Gn(),i=Number(n),r=zn(),{refreshProjects:o,setSelectedProjectId:s}=Mr(),[a,c]=l.useState([]),[u,m]=l.useState([]),[h,g]=l.useState(null),[x,y]=l.useState(""),[w,j]=l.useState(""),[v,_]=l.useState(!0),[$,k]=l.useState(!1),[P,S]=l.useState(null),[I,A]=l.useState(null),[E,B]=l.useState(null),T="2rem",M=a.length>=Vh,R=l.useMemo(()=>{const L=new Set;return[...a,...u].forEach(q=>L.add(`${q.name.toLowerCase()}|${q.website.toLowerCase()}`)),L},[a,u]),F=async()=>{_(!0),S(null);try{const L=await ue(`/api/v1/organizations/${i}/projects/add_flow/step_info?step_number=5`,{method:"GET"});if(!L.ok){S("Failed to load competitors");return}const q=await L.json().catch(()=>({}));g(typeof q?.project_website=="string"?q.project_website:null);const W=q?.competitors,oe=(W?.status||"").toString();A(oe||null),B(W?.error?String(W.error):null);const se=Array.isArray(W?.selected_direct)?W.selected_direct:[],de=Array.isArray(W?.suggested)?W.suggested:[],le=se.map(ne=>({id:Date.now()+Math.floor(Math.random()*1e6),name:String(ne?.name||"").trim(),website:String(ne?.website||"").trim(),competitor_type:"direct"})).filter(ne=>ne.name&&ne.website),me=new Set(le.map(ne=>`${ne.name.toLowerCase()}|${ne.website.toLowerCase()}`)),ee=de.map(ne=>({id:ne?.id??Date.now()+Math.floor(Math.random()*1e6),name:String(ne?.name||"").trim(),website:String(ne?.website||ne?.url||"").trim(),competitor_type:"suggested",logo_url:ne?.logo_url??null})).filter(ne=>ne.name&&ne.website).filter(ne=>!me.has(`${ne.name.toLowerCase()}|${ne.website.toLowerCase()}`));c(le.slice(0,Vh)),m(ee)}catch{S("Network error. Please try again.")}finally{_(!1)}};l.useEffect(()=>{let L=!1,q=null;return(async()=>(await F(),!L&&(q=window.setInterval(async()=>{L||I==="running"&&await F()},4e3))))(),()=>{L=!0,q&&window.clearInterval(q)}},[i,I]);const Y=async()=>{k(!0),S(null);try{const q=await(await ue(`/api/v1/organizations/${i}/projects/add_flow/step`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({step_number:5})})).json().catch(()=>({}));q?.user&&e(q.user),await F()}catch{S("Network error. Please try again.")}finally{k(!1)}},H=()=>{if(M){S(`You can select a maximum of ${Vh} direct competitors.`);return}const L=Wl(w);if(!L){S("Please enter a valid competitor website (e.g., example.com or https://example.com)");return}const q=H$(h),W=H$(L);if(q&&W&&q===W){S("You can't add your own website as a competitor.");return}const oe=String(x||"").trim();if(!oe){S("Name is required."),y(U$(L));return}const se=`${oe.toLowerCase()}|${L.toLowerCase()}`;if(R.has(se)){S("This competitor already exists.");return}c(de=>[...de,{id:Date.now(),name:oe,website:L,competitor_type:"direct"}]),y(""),j(""),S(null)},U=L=>{c(q=>q.filter(W=>W.id!==L)),m(q=>q.filter(W=>W.id!==L))},X=(L,q)=>{if(L.competitor_type!==q)if(q==="direct"){if(a.length>=Vh){S(`You can select a maximum of ${Vh} direct competitors.`);return}m(W=>W.filter(oe=>oe.id!==L.id)),c(W=>[...W,{...L,competitor_type:"direct"}])}else c(W=>W.filter(oe=>oe.id!==L.id)),m(W=>[...W,{...L,competitor_type:"suggested"}])},Q=async L=>{if(L.preventDefault(),$)return;const q=H$(h);if(q&&[...a,...u].some(oe=>H$(oe.website)===q)){S("Remove your own website from the competitors list before continuing.");return}if(a.length>Vh){S(`You can select a maximum of ${Vh} direct competitors.`);return}k(!0),S(null);try{const W=await ue(`/api/v1/organizations/${i}/projects/add_flow/step`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({step_number:5,competitors:{direct:a.map(de=>({name:de.name.trim().toLowerCase(),website:de.website.trim().toLowerCase()}))}})}),oe=await W.json().catch(()=>({}));if(!W.ok){S(oe?.error||oe?.errors?.[0]||"Failed to save competitors"),k(!1);return}oe?.user&&e(oe.user);const se=Number(oe?.project?.id);if(Number.isFinite(se)&&se>0){try{await o()}catch{}
15802s(se),r(`/workspaces/${i}/projects/${se}`,{replace:!0});return}r(`/workspaces/${i}`,{replace:!0})}catch{S("Network error. Please try again."),k(!1)}},K=I==="running",G=I==="failed";return t.jsx(T1,{children:t.jsx(E1,{children:t.jsx(Jgt,{children:t.jsxs(eyt,{children:[t.jsx(Vc,{currentStep:5,totalSteps:5}),t.jsx("div",{style:{display:"flex",justifyContent:"flex-end",marginTop:"0.5rem",marginBottom:"0.25rem"},children:t.jsx(z1,{disabled:$||v})}),t.jsxs(Yc,{children:[t.jsx(Wd,{children:"Review your competitors"}),t.jsx(Ud,{children:"Review and manage the competitors we found. You can add more competitors later."})]}),P&&t.jsx(Xs,{children:P}),G&&(E||!0)?t.jsxs(Xs,{children:[E||"Failed to generate competitors."," ",t.jsxs(he,{type:"button",variant:"outline",size:"sm",onClick:Y,disabled:$,children:[t.jsx(No,{size:14}),"Retry"]})]}):null,t.jsxs(tyt,{onSubmit:Q,children:[t.jsxs(Wo,{children:[t.jsx(Zgt,{children:t.jsx(js,{children:"Competitors"})}),t.jsxs(iyt,{children:[t.jsx(EA,{value:w,onChange:L=>{const q=L.target.value;if(j(q),String(x||"").trim())return;const W=Wl(q);W&&y(U$(W))},placeholder:"example.com or https://example.com",iconSize:18,size:"sm",style:{height:T},disabled:v||$||M,onBlur:()=>{if(String(x||"").trim())return;const L=Wl(w);L&&y(U$(L))},onKeyDown:L=>{L.key==="Enter"&&(L.preventDefault(),H())}}),t.jsx(Xt,{value:x,onChange:L=>y(L.target.value),placeholder:"Name",disabled:v||$||M,size:"sm",style:{height:T},onBlur:()=>{if(String(x||"").trim())return;const q=Wl(w);q&&y(U$(q))}}),t.jsxs(he,{type:"button",onClick:H,disabled:!w.trim()||!x.trim()||v||$||M,size:"sm",style:{height:T},children:[t.jsx(gr,{size:16}),"Add"]})]}),t.jsx(_s,{children:K?"Generating competitor suggestionsâ¦":"Add a competitor by website."})]}),t.jsx(nyt,{children:t.jsx(jre,{direct:a.map(L=>({...L,competitor_type:"direct"})),suggested:u.map(L=>({...L,competitor_type:"suggested"})),effectiveMax:Vh,isLoading:v,isSaving:$,scrollMode:"outer",forceLogoDev:!0,onSetType:(L,q)=>X(L,q),onRemove:L=>U(L)})}),t.jsx(LC,{style:{justifyContent:"flex-end"},children:t.jsx(he,{type:"submit",variant:"nav",disabled:v||$,children:$?"Creatingâ¦":"Create project"})})]})]})})})})}const oyt={topic_analysis:3,prompt_analysis:4,competitor_analysis:5},syt={topic_analysis:"topics",prompt_analysis:"prompts",competitor_analysis:"competitors"},ayt={topic_analysis:{title:"Finding relevant topics",subtitle:"Weâre analyzing your project and preparing topic suggestions. This can take a moment.",statuses:[{id:"searching",label:"Searching for topics",description:"Analyzing your industry and website",icon:Cs},{id:"categorizing",label:"Categorizing topics",description:"Organizing relevant topics for you",icon:Sn},{id:"preparing",label:"Preparing suggestions",description:"Finalizing topic recommendations",icon:qi}]},prompt_analysis:{title:"Generating prompts",subtitle:"Weâre generating optimized prompts from your topics. This can take a moment.",statuses:[{id:"analyzing",label:"Analyzing topics",description:"Generating prompt candidates",icon:Ss},{id:"optimizing",label:"Optimizing prompts",description:"Refining prompts for better results",icon:Sn},{id:"finalizing",label:"Finalizing",description:"Preparing your prompt list",icon:qi}]},competitor_analysis:{title:"Analyzing competitors",subtitle:"Weâre identifying competitors and preparing competitive insights. This can take a moment.",statuses:[{id:"scanning",label:"Scanning competitors",description:"Identifying key players in your industry",icon:Cs},{id:"analyzing",label:"Analyzing strategies",description:"Processing competitor data",icon:Sn},{id:"preparing",label:"Preparing insights",description:"Finalizing competitor suggestions",icon:qi}]}};function lyt(e,n){return!n||typeof n!="object"?"":String(e==="topic_analysis"?n?.topics?.status||"":e==="prompt_analysis"?n?.prompts?.status||"":n?.competitors?.status||"")}function cyt(e,n){return!n||typeof n!="object"?null:e==="topic_analysis"?n?.topics?.error?String(n.topics.error):null:e==="prompt_analysis"?n?.prompts?.error?String(n.prompts.error):null:n?.competitors?.error?String(n.competitors.error):null}function q7({type:e}){const{workspaceId:n}=Gn(),i=Number(n),r=zn(),{requestLeave:o}=oC(),s=l.useMemo(()=>ayt[e],[e]),a=oyt[e],c=syt[e],[u,m]=l.useState(0),[h,g]=l.useState(null),[x,y]=l.useState(null),[w,j]=l.useState("running"),[v,_]=l.useState(!1);l.useEffect(()=>{m(0);const k=s.statuses.map((P,S)=>window.setTimeout(()=>m(S),S*1800));return()=>k.forEach(P=>window.clearTimeout(P))},[s.statuses]),l.useEffect(()=>{if(!Number.isFinite(i)||i<=0||v)return;let k=!1,P=null,S=!1;const I=async()=>{try{const A=await ue(`/api/v1/organizations/${i}/projects/add_flow/step_info?step_number=${a}`,{method:"GET"}),E=await A.json().catch(()=>({}));
15802if(!A.ok)throw new Error(E?.error||"Failed to load analysis status");if(k)return;const B=lyt(e,E);if(j(B||""),y(cyt(e,E)),g(null),B==="failed"){S=!0,_(!0),P&&window.clearInterval(P);return}B==="succeeded"&&!S&&r(`/workspaces/${i}/projects/new?step=${c}`,{replace:!0})}catch(A){if(k)return;g(A instanceof Error?A.message:"Network error. Please try again.")}};return I(),P=window.setInterval(I,4e3),()=>{k=!0,P&&window.clearInterval(P)}},[v,r,c,a,e,i]);const $=v||w==="failed";return t.jsx(T1,{children:t.jsx(E1,{children:t.jsx(bl,{children:t.jsxs(vl,{children:[t.jsx("div",{style:{display:"flex",justifyContent:"flex-end",marginBottom:"0.5rem"},children:t.jsx(z1,{})}),h?t.jsx(Xs,{children:h}):null,$?t.jsxs("div",{style:{marginBottom:"1rem",padding:"0.75rem 0.9rem",borderRadius:12,border:"1px solid rgba(239, 68, 68, 0.35)",background:"rgba(239, 68, 68, 0.06)"},children:[t.jsx("div",{style:{fontWeight:800,marginBottom:6},children:"Setup failed"}),t.jsxs("div",{style:{fontSize:13,color:"rgba(17, 24, 39, 0.8)",marginBottom:10},children:[x||"We couldnât complete this step."," Please cancel setup and start over."]}),t.jsx("div",{style:{display:"flex",gap:10,flexWrap:"wrap"},children:t.jsx(he,{type:"button",variant:"danger",size:"sm",onClick:()=>{!Number.isFinite(i)||i<=0||o(`/workspaces/${i}`)},children:"Cancel setup"})})]}):null,$?null:t.jsxs(nde,{children:[t.jsx(ide,{children:s.title}),t.jsx(rde,{children:s.subtitle}),t.jsx(ode,{children:t.jsx(sde,{})})]}),$?null:t.jsx(ade,{children:s.statuses.map((k,P)=>{const S=k.icon,I=u===P,A=u>P;return t.jsxs(lde,{$active:I,$completed:A,children:[t.jsx(cde,{$active:I,$completed:A,children:t.jsx(S,{size:18})}),t.jsxs(dde,{children:[t.jsx(ude,{children:k.label}),t.jsx(pde,{children:k.description})]})]},k.id)})})]})})})})}function dyt(e){switch((e||"").toLowerCase()){case"location":return"location";case"topic_analysis":return"topic_analysis";case"topics":return"topics";case"prompt_analysis":return"prompt_analysis";case"prompts":return"prompts";case"competitor_analysis":return"competitor_analysis";case"competitors":return"competitors";case"website":default:return"website"}}function uyt(){const{workspaceId:e}=Gn(),n=Number(e),{user:i,setUser:r}=yn(),[o]=yr(),s=zn(),a=l.useRef(!1),c=dyt(o.get("step"));switch(l.useEffect(()=>{if(a.current||!Number.isFinite(n)||n<=0||!i||!i.onboarding_completed)return;a.current=!0;const u=i.add_project_active===!0,m=typeof i.add_project_organization_id=="number"?i.add_project_organization_id:null;if(u&&m===n||u&&m&&m!==n)return;let h=!1;return(async()=>{const x=await(await ue(`/api/v1/organizations/${n}/projects/add_flow/start`,{method:"POST"})).json().catch(()=>({}));h||(x?.user&&r(x.user),s(`/workspaces/${n}/projects/new?step=website`,{replace:!0}))})(),()=>{h=!0}},[s,r,i,n]),l.useEffect(()=>{if(!Number.isFinite(n)||n<=0||!i||!i.add_project_active||i.add_project_organization_id!==n)return;const u=Number(i.add_project_step||1);if(!(c==="topics"&&u===3||c==="prompts"&&u===4||c==="competitors"&&u===5))return;let h=!1;return(async()=>{const x=await ue(`/api/v1/organizations/${n}/projects/add_flow/step_info?step_number=${c==="topics"?3:c==="prompts"?4:5}`,{method:"GET"}),y=await x.json().catch(()=>({}));if(h||!x.ok)return;String(c==="topics"?y?.topics?.status||"":c==="prompts"?y?.prompts?.status||"":y?.competitors?.status||"")==="running"&&s(`/workspaces/${n}/projects/new?step=${c==="topics"?"topic_analysis":c==="prompts"?"prompt_analysis":"competitor_analysis"}`,{replace:!0})})(),()=>{h=!0}},[s,c,i,n]),c){case"website":return t.jsx(Lgt,{});case"location":return t.jsx(Wgt,{});case"topic_analysis":return t.jsx(q7,{type:"topic_analysis"});case"topics":return t.jsx(Ggt,{});case"prompt_analysis":return t.jsx(q7,{type:"prompt_analysis"});case"prompts":return t.jsx(Qgt,{});case"competitor_analysis":return t.jsx(q7,{type:"competitor_analysis"});case"competitors":return t.jsx(ryt,{});default:return null}}class w8 extends Error{details;limitDetails;constructor(n,i){super(n),this.name="ApiError",this.details=i,i?.error_code&&(this.limitDetails=i)}}function M1(e,n){const i=e?.error||e?.errors?.[0]||n;throw new w8(i,e?.errors&&typeof e.errors=="object"?e.errors:void 0)}async function dQ(e,n,i){const r=await ue(`/api/v1/organizations/${e}/projects/${n}/prompts`,{method:"POST",body:JSON.stringify(i)}),o=await r.json().catch(()=>({}));r.ok||M1(o,"Failed to create prompt");const s=o?.prompt;return{id:Number(s?.id),topic_id:Number(s?.topic_id),content:String(s?.content||""),category:String(s?.category||""),city_override:s?.city_override?String(s.city_override):null,country_override:s?.country_override?String(s.country_override):null,country_code_override:s?.country_code_override?String(s.country_code_override):null,created_at:s?.created_at?String(s.created_at):null,archived_at:s?.archived_at?String(s.archived_at):null}}async function uQ(e,n,i){const r=await ue(`/api/v1/organizations/${e}/projects/${n}/prompts/bulk_create`,{method:"POST",body:JSON.stringify({prompts:i})}),o=await r.json().catch(()=>({}));return r.ok||M1(o,"Failed to create prompts"),(Array.isArray(o?.prompts)?o.prompts:[]).map(a=>({id:Number(a?.id),topic_id:Number(a?.topic_id),content:String(a?.content||""),category:String(a?.category||""),city_override:a?.city_override?String(a.city_override):null,country_override:a?.country_override?String(a.country_override):null,country_code_override:a?.country_code_override?String(a.country_code_override):null,created_at:a?.created_at?String(a.created_at):null,archived_at:a?.archived_at?String(a.archived_at):null}))}async function pyt(e,n,i){const r=await ue(`/api/v1/organizations/${e}/projects/${n}/prompts/csv_import`,{method:"POST",body:JSON.stringify({prompts:i})}),o=await r.json().catch(()=>({}));return r.ok||M1(o,"Failed to import prompts"),(Array.isArray(o?.prompts)?o.prompts:[]).map(a=>({id:Number(a?.id),topic_id:Number(a?.topic_id),content:String(a?.content||""),category:String(a?.category||""),city_override:a?.city_override?String(a.city_override):null,country_override:a?.country_override?String(a.country_override):null,country_code_override:a?.country_code_override?String(a.country_code_override):null,created_at:a?.created_at?String(a.created_at):null,archived_at:a?.archived_at?String(a.archived_at):null}))}async function myt(e,n,i){const r=await ue(`/api/v1/organizations/${e}/projects/${n}/prompts/${i}/archive`,{method:"POST"}),o=await r.json().catch(()=>({}));r.ok||M1(o,"Failed to archive prompt");const s=o?.prompt;return{id:Number(s?.id),topic_id:Number(s?.topic_id),content:String(s?.content||""),category:String(s?.category||""),created_at:s?.created_at?String(s.created_at):null,archived_at:s?.archived_at?String(s.archived_at):null}}async function hyt(e,n,i){const r=await ue(`/api/v1/organizations/${e}/projects/${n}/prompts/${i}/unarchive`,{method:"POST"}),o=await r.json().catch(()=>({}));r.ok||M1(o,"Failed to unarchive prompt");const s=o?.prompt;return{id:Number(s?.id),topic_id:Number(s?.topic_id),content:String(s?.content||""),category:String(s?.category||""),created_at:s?.created_at?String(s.created_at):null,archived_at:s?.archived_at?String(s.archived_at):null}}async function fyt(e,n,i){const r=await ue(`/api/v1/organizations/${e}/projects/${n}/prompts/${i}`,{method:"DELETE"}),o=await r.json().catch(()=>({}));r.ok||M1(o,"Failed to delete prompt")}const G7=2,pQ=1,mQ=10,gyt=Tn` 15803 from { transform: rotate(0deg) } 15804 to { transform: rotate(360deg) } 15805`,yyt=p.div.withConfig({displayName:"GeneratePromptsModal__Overlay",componentId:"sc-180vedr-0"})` 15806 position: fixed; 15807 inset: 0; 15808 z-index: 10000; 15809 background: rgba(0, 0, 0, 0.45); 15810 display: flex; 15811 align-items: center; 15812 justify-content: center; 15813 padding: 24px; 15814`,xyt=p.div.withConfig({displayName:"GeneratePromptsModal__Panel",componentId:"sc-180vedr-1"})` 15815 background: ${Z}; 15816 border-radius: 16px; 15817 box-shadow: ${Y_}; 15818 border: 1px solid ${Rt}; 15819 display: flex; 15820 flex-direction: column; 15821 width: 100%; 15822 max-width: ${({$wide:e})=>e?"760px":"540px"}; 15823 max-height: 88vh; 15824 overflow: hidden; 15825`,byt=p.div.withConfig({displayName:"GeneratePromptsModal__PanelHeader",componentId:"sc-180vedr-2"})` 15826 display: flex; 15827 align-items: flex-start; 15828 justify-content: space-between; 15829 padding: 22px 24px 16px; 15830 border-bottom: 1px solid ${Rt}; 15831`,vyt=p.h2.withConfig({displayName:"GeneratePromptsModal__PanelTitle",componentId:"sc-180vedr-3"})` 15832 margin: 0; 15833 font-size: 1rem; 15834 font-weight: 850; 15835 color: ${O}; 15836 line-height: 1.3; 15837`,wyt=p.p.withConfig({displayName:"GeneratePromptsModal__PanelSubtitle",componentId:"sc-180vedr-4"})` 15838 margin: 4px 0 0; 15839 font-size: 0.8125rem; 15840 color: ${z}; 15841`,jyt=p.button.withConfig({displayName:"GeneratePromptsModal__CloseBtn",componentId:"sc-180vedr-5"})` 15842 background: none; 15843 border: none; 15844 cursor: pointer; 15845 padding: 4px; 15846 color: ${z}; 15847 border-radius: 6px; 15848 display: flex; 15849 align-items: center; 15850 &:hover { 15851 background: ${$e}; 15852 } 15853`,hQ=p.div.withConfig({displayName:"GeneratePromptsModal__Body",componentId:"sc-180vedr-6"})` 15854 flex: 1; 15855 overflow-y: auto; 15856 padding: 20px 24px; 15857 display: flex; 15858 flex-direction: column; 15859 gap: 16px; 15860`,fQ=p.div.withConfig({displayName:"GeneratePromptsModal__Footer",componentId:"sc-180vedr-7"})` 15861 padding: 16px 24px; 15862 border-top: 1px solid ${Rt}; 15863 display: flex; 15864 align-items: center; 15865 justify-content: space-between; 15866 gap: 12px; 15867`,gQ=p.div.withConfig({displayName:"GeneratePromptsModal__FooterRight",componentId:"sc-180vedr-8"})` 15868 display: flex; 15869 align-items: center; 15870 gap: 10px; 15871`,_yt=p.div.withConfig({displayName:"GeneratePromptsModal__SectionLabel",componentId:"sc-180vedr-9"})` 15872 font-size: 0.75rem; 15873 font-weight: 850; 15874 color: ${O}; 15875 margin-bottom: 8px; 15876`,Cyt=p.label.withConfig({displayName:"GeneratePromptsModal__TopicRow",componentId:"sc-180vedr-10"})` 15877 display: flex; 15878 align-items: center; 15879 gap: 10px; 15880 padding: 9px 12px; 15881 border-radius: 8px; 15882 border: 1px solid ${Rt}; 15883 cursor: pointer; 15884 transition: border-color 0.15s; 15885 &:hover { 15886 border-color: ${Pe}; 15887 } 15888`,Syt=p.input.withConfig({displayName:"GeneratePromptsModal__TopicCheck",componentId:"sc-180vedr-11"})` 15889 width: 16px; 15890 height: 16px; 15891 cursor: pointer; 15892 flex-shrink: 0; 15893 accent-color: ${Ft}; 15894`,kyt=p.span.withConfig({displayName:"GeneratePromptsModal__TopicName",componentId:"sc-180vedr-12"})` 15895 flex: 1; 15896 font-size: 0.875rem; 15897 font-weight: 750; 15898 color: ${O}; 15899`,$yt=p.div.withConfig({displayName:"GeneratePromptsModal__Stepper",componentId:"sc-180vedr-13"})` 15900 display: flex; 15901 align-items: center; 15902 gap: 0; 15903 border: 1px solid ${Rt}; 15904 border-radius: 8px; 15905 overflow: hidden; 15906`,yQ=p.button.withConfig({displayName:"GeneratePromptsModal__StepBtn",componentId:"sc-180vedr-14"})` 15907 background: none; 15908 border: none; 15909 cursor: pointer; 15910 width: 28px; 15911 height: 28px; 15912 display: flex; 15913 align-items: center; 15914 justify-content: center; 15915 color: ${z}; 15916 &:hover:not(:disabled) { 15917 background: ${$e}; 15918 color: ${O}; 15919 } 15920 &:disabled { 15921 opacity: 0.35;
15922 cursor: not-allowed; 15923 } 15924`,Iyt=p.span.withConfig({displayName:"GeneratePromptsModal__StepVal",componentId:"sc-180vedr-15"})` 15925 width: 32px; 15926 text-align: center; 15927 font-size: 0.875rem; 15928 font-weight: 850; 15929 color: ${O}; 15930 border-left: 1px solid ${Rt}; 15931 border-right: 1px solid ${Rt}; 15932 line-height: 28px; 15933`,xQ=p.div.withConfig({displayName:"GeneratePromptsModal__CreditNote",componentId:"sc-180vedr-16"})` 15934 font-size: 0.8125rem; 15935 color: ${z}; 15936 display: flex; 15937 align-items: center; 15938 gap: 6px; 15939`,Pyt=p.span.withConfig({displayName:"GeneratePromptsModal__CreditBadge",componentId:"sc-180vedr-17"})` 15940 font-weight: 850; 15941 color: ${O}; 15942`,Ayt=p.div.withConfig({displayName:"GeneratePromptsModal__LoadingWrap",componentId:"sc-180vedr-18"})` 15943 display: flex; 15944 flex-direction: column; 15945 align-items: center; 15946 justify-content: center; 15947 padding: 48px 24px; 15948 gap: 16px; 15949 color: ${z}; 15950 font-size: 0.9375rem; 15951`,Nyt=p.div.withConfig({displayName:"GeneratePromptsModal__Spinner",componentId:"sc-180vedr-19"})` 15952 width: 36px; 15953 height: 36px; 15954 border: 3px solid ${Rt}; 15955 border-top-color: ${Ft}; 15956 border-radius: 50%; 15957 animation: ${gyt} 0.8s linear infinite; 15958`,zyt=p.div.withConfig({displayName:"GeneratePromptsModal__ReviewTable",componentId:"sc-180vedr-20"})` 15959 display: flex; 15960 flex-direction: column; 15961 gap: 8px; 15962`,Tyt=p.div.withConfig({displayName:"GeneratePromptsModal__ReviewCard",componentId:"sc-180vedr-21"})` 15963 display: flex; 15964 align-items: flex-start; 15965 gap: 10px; 15966 padding: 12px 14px; 15967 border-radius: 10px; 15968 border: 1px solid ${Rt}; 15969 background: ${Z}; 15970`,Eyt=p.div.withConfig({displayName:"GeneratePromptsModal__ReviewContent",componentId:"sc-180vedr-22"})` 15971 flex: 1; 15972 display: flex; 15973 flex-direction: column; 15974 gap: 6px; 15975`,Myt=p.textarea.withConfig({displayName:"GeneratePromptsModal__ReviewTextarea",componentId:"sc-180vedr-23"})` 15976 font-size: 0.875rem; 15977 font-weight: 500; 15978 color: ${O}; 15979 border: 1px solid transparent; 15980 border-radius: 6px; 15981 padding: 4px 6px; 15982 resize: none; 15983 width: 100%; 15984 box-sizing: border-box; 15985 line-height: 1.45; 15986 background: transparent; 15987 font-family: inherit; 15988 &:focus { 15989 outline: none; 15990 border-color: ${Pe}; 15991 background: ${Z}; 15992 } 15993`,Ryt=p.div.withConfig({displayName:"GeneratePromptsModal__ReviewMeta",componentId:"sc-180vedr-24"})` 15994 display: flex; 15995 align-items: center; 15996 gap: 8px; 15997`,Oyt=p.span.withConfig({displayName:"GeneratePromptsModal__TopicTag",componentId:"sc-180vedr-25"})` 15998 font-size: 0.6875rem; 15999 font-weight: 850; 16000 color: ${Ft}; 16001 background: ${cn}; 16002 border-radius: 5px; 16003 padding: 2px 7px; 16004 white-space: nowrap; 16005 overflow: hidden; 16006 text-overflow: ellipsis; 16007 max-width: 180px; 16008`,Dyt=p.button.withConfig({displayName:"GeneratePromptsModal__RemoveBtn",componentId:"sc-180vedr-26"})` 16009 background: none; 16010 border: none; 16011 cursor: pointer; 16012 padding: 4px; 16013 color: ${z}; 16014 border-radius: 6px; 16015 display: flex; 16016 align-items: center; 16017 flex-shrink: 0; 16018 &:hover { 16019 color: ${sr}; 16020 background: ${kn}; 16021 } 16022`,Lyt=p.div.withConfig({displayName:"GeneratePromptsModal__ErrorMsg",componentId:"sc-180vedr-27"})` 16023 font-size: 0.8125rem; 16024 font-weight: 750; 16025 color: ${sr}; 16026 padding: 10px 14px; 16027 background: ${kn}; 16028 border-radius: 8px; 16029`,bQ=p.div.withConfig({displayName:"GeneratePromptsModal__EmptyNote",componentId:"sc-180vedr-28"})` 16030 text-align: center; 16031 color: ${z}; 16032 font-size: 0.875rem; 16033 padding: 32px 0; 16034`;function Byt({isOpen:e,onClose:n,workspaceId:i,projectId:r,topicOptions:o,categoryOptions:s,onAddMany:a,isSubmitting:c}){const[u,m]=l.useState("config"),[h,g]=l.useState(new Set),[x,y]=l.useState({}),[w,j]=l.useState([]),[v,_]=l.useState(null),$=Uo(),k=l.useRef(!1);l.useEffect(()=>{e&&!k.current&&(m("config"),g(new Set),y({}),j([]),_(null)),k.current=e},[e]);const P=l.useCallback(H=>x[H]??5,[x]),S=l.useCallback((H,U)=>{y(X=>{const Q=X[H]??5,K=Math.max(pQ,Math.min(mQ,Q+U));return{...X,[H]:K}})},[]),I=l.useCallback(H=>{g(U=>{const X=new Set(U);return X.has(H)?X.delete(H):X.add(H),X})},[]),A=l.useMemo(()=>Array.from(h).reduce((H,U)=>H+P(U),0),[h,P]),E=l.useCallback(async()=>{if(h.size===0)return;const H=u;m("loading"),_(null);const U={};h.forEach(X=>{U[String(X)]=P(X)});try{const X=await ue(`/api/v1/organizations/${i}/projects/${r}/prompts/generate_suggestions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({topic_counts:U})}),Q=await X.json().catch(()=>({}));if(!X.ok)throw new Error(Q?.error||"Failed to generate prompts");const K=Q.suggestions||[];j(K),Fo(),m("review")}catch(X){const Q=X instanceof Error?X.message:"Failed to generate prompts";H==="review"?(m("review"),$.showToast(Q,{tone:"error"})):(_(Q),m("config"))}},[h,P,i,r,u,$]),B=l.useCallback((H,U)=>{j(X=>X.map(Q=>Q.id===H?{...Q,content:U}:Q))},[]),T=l.useCallback((H,U)=>{j(X=>X.map(Q=>Q.id===H?{...Q,category:U}:Q))},[]),M=l.useCallback(H=>{j(U=>U.filter(X=>X.id!==H))},[]),R=l.useCallback(async()=>{const H=w.filter(U=>U.content.trim()).map(U=>({content:U.content.trim(),topicValue:String(U.topic_id??""),categoryValue:U.category}));H.length!==0&&await a(H)},[w,a]);if(!e)return null;const F=u==="review",Y=t.jsx(yyt,{onClick:H=>H.target===H.currentTarget&&u!=="loading"&&n(),children:t.jsxs(xyt,{$wide:F,children:[t.jsxs(byt,{children:[t.jsxs("div",{children:[t.jsx(vyt,{children:"Generate prompts with AI"}),t.jsxs(wyt,{children:[u==="config"&&"Select topics and how many prompts to generate per topic.",u==="loading"&&"Generating prompts â this takes a few secondsâ¦",u==="review"&&"Review and edit the generated prompts, then add your favourites."]})]}),u!=="loading"&&t.jsx(jyt,{type:"button","aria-label":"Close",onClick:n,disabled:c,
16034children:t.jsx(Ei,{size:18})})]}),u==="config"&&t.jsxs(hQ,{children:[t.jsxs("div",{children:[t.jsx(_yt,{children:"Topics & prompt count"}),o.length===0?t.jsx(bQ,{children:"No topics in this project yet. Add a topic first."}):t.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8},children:o.map(H=>{const U=h.has(H.id);return t.jsxs(Cyt,{children:[t.jsx(Syt,{type:"checkbox",checked:U,onChange:()=>I(H.id)}),t.jsx(kyt,{children:H.label}),U&&t.jsxs($yt,{children:[t.jsx(yQ,{type:"button",disabled:P(H.id)<=pQ,onClick:X=>{X.preventDefault(),S(H.id,-1)},children:t.jsx(Bne,{size:12})}),t.jsx(Iyt,{children:P(H.id)}),t.jsx(yQ,{type:"button",disabled:P(H.id)>=mQ,onClick:X=>{X.preventDefault(),S(H.id,1)},children:t.jsx(gr,{size:12})})]})]},H.id)})})]}),v&&t.jsx(Lyt,{children:v})]}),u==="loading"&&t.jsxs(Ayt,{children:[t.jsx(Nyt,{}),"Generating prompts with AIâ¦"]}),u==="review"&&t.jsx(hQ,{children:w.length===0?t.jsx(bQ,{children:"No suggestions were returned. Try regenerating."}):t.jsx(zyt,{children:w.map(H=>t.jsxs(Tyt,{children:[t.jsxs(Eyt,{children:[t.jsx(Myt,{rows:2,value:H.content,onChange:U=>B(H.id,U.target.value)}),t.jsxs(Ryt,{children:[t.jsx(Oyt,{title:H.topic_name,children:H.topic_name}),t.jsx(Fn,{size:"sm",value:H.category,options:s,onChange:U=>T(H.id,U),style:{minWidth:160}})]})]}),t.jsx(Dyt,{type:"button",title:"Remove",onClick:()=>M(H.id),children:t.jsx(Fi,{size:15})})]},H.id))})}),u==="config"&&t.jsxs(fQ,{children:[t.jsxs(xQ,{children:[A," prompt",A!==1?"s":""," requested"]}),t.jsxs(gQ,{children:[t.jsx(he,{type:"button",size:"sm",variant:"outline",onClick:n,children:"Cancel"}),t.jsxs(he,{type:"button",size:"sm",variant:"primary",disabled:h.size===0,onClick:E,children:["Generate (",G7," credits)"]})]})]}),u==="review"&&t.jsxs(fQ,{children:[t.jsxs(xQ,{children:[t.jsx(Pyt,{children:w.length}),"prompt",w.length!==1?"s":""," ready to add"]}),t.jsxs(gQ,{children:[t.jsxs(he,{type:"button",size:"sm",variant:"outline",leftIcon:t.jsx(No,{size:13}),disabled:c,title:`Regenerate costs another ${G7} credits`,onClick:E,children:["Regenerate (",G7," credits)"]}),t.jsx(he,{type:"button",size:"sm",variant:"primary",disabled:c||w.length===0,onClick:R,children:c?"Addingâ¦":`Add ${w.length} prompt${w.length!==1?"s":""}`})]})]})]})});return jr.createPortal(Y,document.body)}const vQ=500,wQ=500,rP=["organic search","brand sentiment","competitor comparison"];function Fyt(e){const n=e.startsWith("\uFEFF")?e.slice(1):e,i=[];let r=[],o="",s=!1,a=!1,c=0;for(;c<n.length;){const u=n[c];s?u==='"'&&n[c+1]==='"'?(o+='"',c+=2):u==='"'?(s=!1,c++):(o+=u,c++):u==='"'&&o===""?(s=!0,a=!0,c++):u===","?(r.push(a?o:o.trim()),o="",a=!1,c++):u===` 16035`||u==="\r"?(r.push(a?o:o.trim()),o="",a=!1,u==="\r"&&n[c+1]===` 16036`&&c++,r.some(m=>m!=="")&&i.push(r),r=[],c++):(o+=u,c++)}return r.push(a?o:o.trim()),r.some(u=>u!=="")&&i.push(r),i}function Wyt(e){const n={},i={prompt:"prompt",content:"prompt",topic:"topic",category:"category",city_override:"city_override",city:"city_override",country_override:"country_override",country:"country_override",country_code_override:"country_code_override",country_code:"country_code_override"};return e.forEach((r,o)=>{const s=i[r.toLowerCase().trim().replace(/\s+/g,"_")];s&&!(s in n)&&(n[s]=o)}),n}function zx(e,n){return n===void 0||n<0||n>=e.length?"":String(e[n]||"").trim()}function Uyt(e,n){if(e.length<2)return[];const i=Wyt(e[0]),r=new Map;return n.forEach(s=>r.set(s.label.toLowerCase().trim(),s.id)),e.slice(1).map((s,a)=>{const c=a+2,u=`csv-row-${c}-${Math.random().toString(36).slice(2,7)}`,m=zx(s,i.prompt),h=zx(s,i.topic),g=zx(s,i.category).toLowerCase(),x=zx(s,i.city_override),y=zx(s,i.country_override),w=zx(s,i.country_code_override).toUpperCase(),j=[];m?m.length>wQ&&j.push(`Prompt exceeds ${wQ} characters`):j.push("Prompt is required");const v=r.get(h.toLowerCase())??null;return h?v===null&&j.push(`Topic "${h}" not found in this project`):j.push("Topic is required"),g?rP.includes(g)||j.push(`Category "${g}" is invalid â must be one of: ${rP.join(", ")}`):j.push("Category is required"),w&&!/^[A-Z]{2}$/.test(w)&&j.push(`Country code "${w}" must be a 2-letter ISO code (e.g. US, GB)`),{id:u,rowNum:c,prompt:m,topicName:h,topicId:v,category:g,cityOverride:x,countryOverride:y,countryCodeOverride:w,errors:j}})}function Hyt(e){const n=e[0]?.label??"Your Topic Name",i=["prompt,topic,category,city_override,country_override,country_code_override",`"Which tools do team
16036s like ours recommend for [your service]?","${n}","organic search",,,`,`"Best [your service] providers in [city]?","${n}","brand sentiment","San Francisco","United States","US"`],r=new Blob([i.join(`\r 16037`)],{type:"text/csv;charset=utf-8;"}),o=URL.createObjectURL(r),s=document.createElement("a");s.href=o,s.download="prompts_template.csv",document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(o)}const qyt=p.div.withConfig({displayName:"CsvUploadPromptsModal__Overlay",componentId:"sc-r4y473-0"})` 16038 position: fixed; 16039 inset: 0; 16040 z-index: 10000; 16041 background: rgba(0, 0, 0, 0.45); 16042 display: flex; 16043 align-items: center; 16044 justify-content: center; 16045 padding: 24px; 16046`,Gyt=p.div.withConfig({displayName:"CsvUploadPromptsModal__Panel",componentId:"sc-r4y473-1"})` 16047 background: ${Z}; 16048 border-radius: 16px; 16049 box-shadow: ${Y_}; 16050 border: 1px solid ${Rt}; 16051 display: flex; 16052 flex-direction: column; 16053 width: 100%; 16054 max-width: ${({$wide:e})=>e?"900px":"560px"}; 16055 max-height: 90vh; 16056 overflow: hidden; 16057`,Vyt=p.div.withConfig({displayName:"CsvUploadPromptsModal__PanelHeader",componentId:"sc-r4y473-2"})` 16058 display: flex; 16059 align-items: flex-start; 16060 justify-content: space-between; 16061 padding: 22px 24px 16px; 16062 border-bottom: 1px solid ${Rt}; 16063 flex-shrink: 0; 16064`,Kyt=p.h2.withConfig({displayName:"CsvUploadPromptsModal__PanelTitle",componentId:"sc-r4y473-3"})` 16065 margin: 0; 16066 font-size: 1rem; 16067 font-weight: 850; 16068 color: ${O}; 16069 line-height: 1.3; 16070`,Yyt=p.p.withConfig({displayName:"CsvUploadPromptsModal__PanelSubtitle",componentId:"sc-r4y473-4"})` 16071 margin: 4px 0 0; 16072 font-size: 0.8125rem; 16073 color: ${z}; 16074`,Xyt=p.button.withConfig({displayName:"CsvUploadPromptsModal__CloseBtn",componentId:"sc-r4y473-5"})` 16075 background: none; 16076 border: none; 16077 cursor: pointer; 16078 padding: 4px; 16079 color: ${z}; 16080 border-radius: 6px; 16081 display: flex; 16082 align-items: center; 16083 flex-shrink: 0; 16084 &:hover { background: ${$e}; } 16085`,jQ=p.div.withConfig({displayName:"CsvUploadPromptsModal__Body",componentId:"sc-r4y473-6"})` 16086 flex: 1; 16087 overflow-y: auto; 16088 padding: 20px 24px; 16089 display: flex; 16090 flex-direction: column; 16091 gap: 16px; 16092 min-height: 0; 16093`,_Q=p.div.withConfig({displayName:"CsvUploadPromptsModal__Footer",componentId:"sc-r4y473-7"})` 16094 padding: 16px 24px; 16095 border-top: 1px solid ${Rt}; 16096 display: flex; 16097 align-items: center; 16098 justify-content: space-between; 16099 gap: 12px; 16100 flex-shrink: 0; 16101`,CQ=p.div.withConfig({displayName:"CsvUploadPromptsModal__FooterRight",componentId:"sc-r4y473-8"})` 16102 display: flex; 16103 align-items: center; 16104 gap: 10px; 16105`,Qyt=p.div.withConfig({displayName:"CsvUploadPromptsModal__DropZone",componentId:"sc-r4y473-9"})` 16106 border: 2px dashed ${({$active:e,$error:n})=>n?sr:e?Ft:Rt}; 16107 border-radius: 12px; 16108 padding: 40px 24px; 16109 display: flex; 16110 flex-direction: column; 16111 align-items: center; 16112 gap: 10px; 16113 cursor: pointer; 16114 text-align: center; 16115 transition: border-color 0.15s, background 0.15s; 16116 background: ${({$active:e})=>e?cn:"transparent"}; 16117 &:hover { 16118 border-color: ${Ft}; 16119 background: ${cn}; 16120 } 16121`,Zyt=p.div.withConfig({displayName:"CsvUploadPromptsModal__DropZoneIcon",componentId:"sc-r4y473-10"})` 16122 color: ${z}; 16123`,Jyt=p.div.withConfig({displayName:"CsvUploadPromptsModal__DropZoneText",componentId:"sc-r4y473-11"})` 16124 font-size: 0.9375rem; 16125 font-weight: 750; 16126 color: ${O}; 16127`,e0t=p.div.withConfig({displayName:"CsvUploadPromptsModal__DropZoneSub",componentId:"sc-r4y473-12"})` 16128 font-size: 0.8125rem; 16129 color: ${z}; 16130`,V7=p.div.withConfig({displayName:"CsvUploadPromptsModal__InfoBox",componentId:"sc-r4y473-13"})` 16131 background: ${At}; 16132 border: 1px solid ${Rt}; 16133 border-radius: 10px; 16134 padding: 12px 14px; 16135 display: flex; 16136 flex-direction: column; 16137 gap: 6px; 16138`,q$=p.div.withConfig({displayName:"CsvUploadPromptsModal__InfoLabel",componentId:"sc-r4y473-14"})` 16139 font-size: 0.75rem; 16140 font-weight: 850; 16141 color: ${O}; 16142 margin-bottom: 2px; 16143`,K7=p.div.withConfig({displayName:"CsvUploadPromptsModal__InfoRow",componentId:"sc-r4y473-15"})` 16144 font-size: 0.8125rem; 16145 color: ${z}; 16146 line-height: 1.5; 16147`,SQ=p.div.withConfig({displayName:"CsvUploadPromptsModal__TagList",componentId:"sc-r4y473-16"})` 16148 display: flex; 16149 flex-wrap: wrap; 16150 gap: 6px; 16151 margin-top: 4px; 16152`,kQ=p.span.withConfig({displayName:"CsvUploadPromptsModal__Tag",componentId:"sc-r4y473-17"})` 16153 font-size: 0.75rem; 16154 font-weight: 750; 16155 background: ${Rt}; 16156 color: ${O}; 16157 border-radius: 5px; 16158 padding: 2px 8px; 16159`,t0t=p.div.withConfig({displayName:"CsvUploadPromptsModal__FileErrorMsg",componentId:"sc-r4y473-18"})` 16160 font-size: 0.8125rem; 16161 font-weight: 750; 16162 color: ${sr}; 16163 padding: 10px 14px; 16164 background: ${kn}; 16165 border-radius: 8px; 16166`,n0t=p.div.withConfig({displayName:"CsvUploadPromptsModal__StatBar",componentId:"sc-r4y473-19"})` 16167 display: flex; 16168 align-items: center; 16169 gap: 16px; 16170 padding: 10px 14px; 16171 background: ${At}; 16172 border: 1px solid ${Rt}; 16173 border-radius: 10px; 16174 flex-shrink: 0; 16175`,$Q=p.div.withConfig({displayName:"CsvUploadPromptsModal__StatItem",componentId:"sc-r4y473-20"})` 16176 display: flex; 16177 align-items: center; 16178 gap: 6px; 16179 font-size: 0.875rem; 16180 font-weight: 850; 16181 color: ${({$error:e})=>e?sr:Vt}; 16182`,i0t=p.div.withConfig({displayName:"CsvUploadPromptsModal__PreviewTable",componentId:"sc-r4y473-21"})` 16183 display: flex; 16184 flex-direction: column; 16185 min-height: 0; 16186`,r0t=p.div.withConfig({displayName:"CsvUploadPromptsModal__PreviewHeader",componentId:"sc-r4y473-22"})` 16187 display: grid; 16188 grid-template-columns: 28px 36px minmax(0, 2.5fr) minmax(0, 1.2fr) minmax(0, 1.2fr) minmax(0, 1.1fr) 28px; 16189 gap: 8px; 16190 padding: 4px 0 8px; 16191 font-size: 0.72rem; 16192 font-weight: 850; 16193 color: ${z}; 16194 border-bottom: 1px solid ${Rt}; 16195`,o0t=p.div.withConfig({displayName:"CsvUploadPromptsModal__PreviewRow",componentId:"sc-r4y473-23"})` 16196 display: grid; 16197 grid-template-columns: 28px 36px minmax(0, 2.5fr) minmax(0, 1.2fr) minmax(0, 1.2fr) minmax(0, 1.1fr) 28px; 16198 gap: 8px; 16199 align-items: start; 16200 padding: 8px 0; 16201 border-bottom: 1px solid ${Rt}; 16202 background: ${({$hasError:e})=>e?kn:"transparent"}; 16203 border-radius: 4px; 16204 &:last-child { border-bottom: 0; } 16205`,s0t=p.div.withConfig({displayName:"CsvUploadPromptsModal__CellNum",componentId:"sc-r4y473-24"})` 16206 font-size: 0.72rem; 16207 font-weight: 750; 16208 color: ${z}; 16209 padding-top: 3px; 16210 text-align: right; 16211`,Y7=p.div.withConfig({displayName:"CsvUploadPromptsModal__CellText",componentId:"sc-r4y473-25"})` 16212 font-size: 0.8125rem; 16213 color: ${O}; 16214 overflow: hidden; 16215 text-overflow: ellipsis; 16216 white-space: nowrap; 16217 padding-top: 2px; 16218`,a0t=p.div.withConfig({displayName:"CsvUploadPromptsModal__CellError",componentId:"sc-r4y473-26"})` 16219 font-size: 0.72rem; 16220 color: ${sr}; 16221 margin-top: 3px; 16222 line-height: 1.35; 16223`,l0t=p.div.withConfig({displayName:"CsvUploadPromptsModal__CellMuted",componentId:"sc-r4y473-27"})` 16224 font-size: 0.8125rem; 16225 color: ${z}; 16226 overflow: hidden; 16227 text-overflow: ellipsis; 16228 white-space: nowrap; 16229 padding-top: 2px; 16230`,c0t=p.button.withConfig({displayName:"CsvUploadPromptsModal__RemoveBtn",componentId:"sc-r4y473-28"})` 16231 background: none; 16232 border: none; 16233 cursor: pointer; 16234 padding: 0; 16235 color: ${z}; 16236 border-radius: 4px; 16237 display: flex; 16238 align-items: center; 16239 flex-shrink: 0; 16240 &:hover { color: ${sr}; } 16241`,d0t=p.div.withConfig({displayName:"CsvUploadPromptsModal__EmptyNote",componentId:"sc-r4y473-29"})` 16242 text-align: center; 16243 color: ${z}; 16244 font-size: 0.875rem; 16245 padding: 32px 0; 16246`;function u0t({isOpen:e,onClose:n,topicOptions:i,onAddMany:r,isSubmitting:o}){const[s,a]=l.useState("upload"),[c,u]=l.useState([]),[m,h]=l.useState(null),[g,x]=l.useState(!1),y=l.useRef(null),w=Uo(),j=l.useRef(!1);l.useEffect(()=>{e&&!j.current&&(a("upload"),u([]),h(null),x(!1)),j.current=e},[e]);const v=l.useCallback(B=>{if(h(null),!B.name.toLowerCase().endsWith(".csv")&&B.type!=="text/csv"&&B.type!=="application/vnd.ms-excel"){h("Please upload a .csv file.");return}const T=new FileReader;T.onload=M=>{const R=M.target?.result||"",F=Fyt(R);if(F.length<2){h("The file appears to be empty or has no data rows.");return}const Y=F.length-1;if(Y>vQ){h(`This file has ${Y} rows. Maximum is ${vQ} per upload.`);return}const H=Uyt(F,i);if(H.length===0){h("No data rows found after parsing. Check your file format.");return}u(H),a("preview")},T.onerror=()=>h("Could not read the file. Please try again."),T.readAsText(B,"utf-8")},[i]),_=l.useCallback(B=>{const T=B.target.files?.[0];T&&(v(T),B.target.value="")},[v]),$=l.useCallback(B=>{B.preventDefault(),x(!1);const T=B.dataTransfer.files[0];T&&v(T)},[v]),k=l.useCallback(B=>{u(T=>T.filter(M=>M.id!==B))}
16246,[]),P=c.filter(B=>B.errors.length===0),S=l.useCallback(async()=>{if(P.length===0)return;const B=P.map(T=>({content:T.prompt,topicValue:String(T.topicId),categoryValue:T.category,cityOverride:T.cityOverride||void 0,countryOverride:T.countryOverride||void 0,countryCodeOverride:T.countryCodeOverride||void 0}));try{await r(B)}catch{w.showToast("Failed to upload prompts. Please try again.",{tone:"error"})}},[P,r,w]);if(!e)return null;const I=c.length-P.length,A=s==="preview",E=t.jsx(qyt,{onClick:B=>{B.target===B.currentTarget&&!o&&n()},children:t.jsxs(Gyt,{$wide:A,children:[t.jsxs(Vyt,{children:[t.jsxs("div",{children:[t.jsx(Kyt,{children:s==="upload"?"Upload prompts from CSV":`Review ${c.length} rows`}),t.jsx(Yyt,{children:s==="upload"?"Upload a CSV file to bulk-create prompts. Max 500 rows per file.":`${P.length} valid · ${I} with errors. Remove or fix errors before uploading.`})]}),t.jsx(Xyt,{type:"button","aria-label":"Close",onClick:n,disabled:o,children:t.jsx(Ei,{size:18})})]}),s==="upload"?t.jsxs(jQ,{children:[t.jsxs(Qyt,{$active:g,$error:!!m,onClick:()=>y.current?.click(),onDragOver:B=>{B.preventDefault(),x(!0)},onDragLeave:()=>x(!1),onDrop:$,children:[t.jsx(Zyt,{children:t.jsx(Tne,{size:32})}),t.jsx(Jyt,{children:"Click to select or drag & drop"}),t.jsx(e0t,{children:".csv files only"})]}),t.jsx("input",{ref:y,type:"file",accept:".csv,text/csv,application/vnd.ms-excel",style:{display:"none"},onChange:_}),m&&t.jsx(t0t,{children:m}),t.jsxs(V7,{children:[t.jsx(q$,{children:"Valid categories (use exactly as shown)"}),t.jsx(SQ,{children:rP.map(B=>t.jsx(kQ,{children:B},B))})]}),t.jsxs(V7,{children:[t.jsx(q$,{children:"Valid topics in this project"}),i.length===0?t.jsx(K7,{children:"No topics yet â add topics to this project first."}):t.jsx(SQ,{children:i.map(B=>t.jsx(kQ,{children:B.label},B.id))})]}),t.jsxs(V7,{children:[t.jsx(q$,{children:"Required columns"}),t.jsxs(K7,{children:[t.jsx("strong",{children:"prompt"}),", ",t.jsx("strong",{children:"topic"}),", ",t.jsx("strong",{children:"category"})]}),t.jsx(q$,{style:{marginTop:6},children:"Optional columns"}),t.jsxs(K7,{children:[t.jsx("strong",{children:"city_override"}),", ",t.jsx("strong",{children:"country_override"}),","," ",t.jsx("strong",{children:"country_code_override"})," â 2-letter ISO code (e.g. US, GB, DE)"]})]})]}):t.jsxs(jQ,{children:[t.jsxs(n0t,{children:[t.jsxs($Q,{children:[t.jsx(co,{size:15}),P.length," valid"]}),I>0&&t.jsxs($Q,{$error:!0,children:[t.jsx(Sf,{size:15}),I," ",I===1?"error":"errors"]}),t.jsxs("span",{style:{marginLeft:"auto",fontSize:"0.8125rem",color:z},children:[c.length," total rows"]})]}),c.length===0?t.jsx(d0t,{children:"All rows removed. Go back to re-upload."}):t.jsxs(i0t,{children:[t.jsxs(r0t,{children:[t.jsx("div",{}),t.jsx("div",{style:{textAlign:"right"},children:"Row"}),t.jsx("div",{children:"Prompt"}),t.jsx("div",{children:"Topic"}),t.jsx("div",{children:"Category"}),t.jsx("div",{children:"Location"}),t.jsx("div",{})]}),c.map(B=>{const T=B.errors.length>0,M=[B.cityOverride,B.countryCodeOverride||B.countryOverride].filter(Boolean).join(", ");return t.jsxs(o0t,{$hasError:T,children:[t.jsx("div",{style:{paddingTop:3,display:"flex",justifyContent:"center"},children:T?t.jsx(Sf,{size:14,color:sr}):t.jsx(co,{size:14,color:Vt})}),t.jsx(s0t,{children:B.rowNum}),t.jsxs("div",{style:{minWidth:0},children:[t.jsx(Y7,{title:B.prompt,children:B.prompt||t.jsx("em",{style:{color:z},children:"empty"})}),T&&t.jsx(a0t,{children:B.errors.map((R,F)=>t.jsx("div",{children:R},F))})]}),t.jsx(Y7,{title:B.topicName,style:{color:B.topicId?O:sr},children:B.topicName||t.jsx("em",{style:{color:z},children:"â"})}),t.jsx(Y7,{style:{color:B.category&&rP.includes(B.category)?O:sr},children:B.category||t.jsx("em",{style:{color:z},children:"â"})}),t.jsx(l0t,{title:M,children:M||t.jsx("em",{children:"â"})}),t.jsx(c0t,{type:"button",title:"Remove row",disabled:o,onClick:()=>k(B.id),children:t.jsx(Fi,{size:13})})]},B.id)})]})]}),s==="upload"?t.jsxs(_Q,{children:[t.jsx(he,{type:"button",size:"sm",variant:"outline",leftIcon:t.jsx(wy,{size:14}),onClick:()=>Hyt(i),children:"Download template"}),t.jsx(CQ,{children:t.jsx(he,{type:"button",size:"sm",variant:"outline",onClick:n,children:"Cancel"})})]}):t.jsxs(_Q,{children:[t.jsx(he,{type:"button",size:"sm",variant:"outline",onClick:()=>{a("upload"),h(null)},disabled:o,children:"â Re-upload"}),t.jsxs(CQ,{children:[I>0&&t.jsxs("span",{style:{fontSize:"0.8125rem",color:z},children:[I," row",I!==1?"s":""," with errors will be skipped"]}),t.jsx(he,{type:"button",size:"sm",variant:"primary",disabled:o||P.length===0,onClick:S,children:o?"Uploadingâ¦":`Upload ${P.length} prompt${P.length!==1?"s":""}`})]})]})]})});return jr.createPortal(E,document.body)}const p0t=p.div.withConfig({displayName:"PromptsTabstyles__ScopeTabs",componentId:"sc-mfg5dv-0"})` 16247 display: inline-flex; 16248 align-items: center; 16249 gap: 0.25rem; 16250 padding: 0.2rem; 16251 border-radius: 9999px; 16252 background: ${At}; 16253 border: 1px solid ${V}; 16254`,X7=p.button.withConfig({displayName:"PromptsTabstyles__ScopeTab",componentId:"sc-mfg5dv-1"})` 16255 appearance: none; 16256 border: 1px solid ${e=>e.$active?V:"transparent"}; 16257 background: ${e=>e.$active?Z:"transparent"}; 16258 color: ${e=>e.$active?O:z}; 16259 border-radius: 9999px; 16260 padding: 0.35rem 0.7rem; 16261 font-size: 0.875rem; 16262 font-weight: ${e=>e.$active?950:850}; 16263 cursor: pointer; 16264 line-height: 1.1; 16265 transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease, box-shadow 140ms ease; 16266 16267 &:hover { 16268 color: ${O}; 16269 background: ${e=>e.$active?Z:"color-mix(in srgb, var(--color-gray-900) 4%, transparent)"}; 16270 } 16271 16272 &:focus-visible { 16273 outline: none; 16274 box-shadow: 0 0 0 3px ${En}; 16275 } 16276`,due=p.div.withConfig({displayName:"PromptsTabstyles__FiltersBar",componentId:"sc-mfg5dv-2"})` 16277 display: flex; 16278 align-items: center; 16279 justify-content: space-between; 16280 gap: 0.75rem; 16281 flex-wrap: nowrap; 16282 width: 100%; 16283 overflow-x: auto; 16284 overflow-y: hidden; 16285 -webkit-overflow-scrolling: touch; 16286 16287 /* Keep everything on one line; allow horizontal scroll on smaller screens. */ 16288 16289 /* Mobile: switch to two stacked rows (left row then right row). */ 16290 @media (max-width: 640px) { 16291 flex-direction: column; 16292 align-items: stretch; 16293 justify-content: flex-start; 16294 gap: 0.6rem; 16295 overflow: visible; 16296 } 16297`,uue=p.div.withConfig({displayName:"PromptsTabstyles__FiltersLeft",componentId:"sc-mfg5dv-3"})` 16298 display: flex; 16299 align-items: center; 16300 gap: 0.75rem; 16301 min-width: 0; 16302 flex: 1; 16303 flex-wrap: nowrap; 16304 16305 @media (max-width: 640px) { 16306 width: 100%; 16307 flex: 0 0 auto; 16308 /* Keep row 1 on a single line; if it overflows, scroll within the row. */ 16309 overflow-x: auto; 16310 overflow-y: hidden; 16311 -webkit-overflow-scrolling: touch; 16312 padding-bottom: 2px; 16313 } 16314`,pue=p.div.withConfig({displayName:"PromptsTabstyles__FiltersRight",componentId:"sc-mfg5dv-4"})` 16315 display: flex; 16316 align-items: center; 16317 gap: 0.75rem; 16318 flex-wrap: nowrap; 16319 justify-content: flex-end; 16320
16321 /* SearchBar container (first child) should be flexible. */ 16322 & > div:first-child { 16323 flex: 0 0 auto; 16324 min-width: 0; 16325 width: 16rem; 16326 } 16327 16328 .prompt-actions { 16329 display: inline-flex; 16330 align-items: center; 16331 gap: 0.75rem; 16332 flex: 0 0 auto; 16333 } 16334 16335 @media (max-width: 640px) { 16336 width: 100%; 16337 justify-content: flex-start; 16338 /* Mobile: row 2 = search (full width), row 3 = buttons */ 16339 display: flex; 16340 flex-direction: column; 16341 align-items: stretch; 16342 gap: 0.35rem; 16343 16344 & > div:first-child { 16345 max-width: none; 16346 width: 100%; 16347 } 16348 16349 .prompt-actions { 16350 /* Keep the two buttons in a tight row (wrap only if absolutely necessary). */ 16351 width: 100%; 16352 display: grid; 16353 grid-template-columns: auto auto; 16354 justify-content: start; 16355 gap: 0.5rem; 16356 } 16357 } 16358`,m0t=p.div.withConfig({displayName:"PromptsTabstyles__TabRoot",componentId:"sc-mfg5dv-5"})` 16359 height: 100%; 16360 min-height: 0; 16361 display: flex; 16362 flex-direction: column; 16363`;p.div.withConfig({displayName:"PromptsTabstyles__TableScroll",componentId:"sc-mfg5dv-6"})` 16364 flex: 1; 16365 min-height: 0; 16366 width: 100%; 16367 overflow: auto; 16368 -webkit-overflow-scrolling: touch; 16369 background: ${Z}; 16370`;const h0t=p.table.withConfig({displayName:"PromptsTabstyles__Table",componentId:"sc-mfg5dv-7"})` 16371 width: 100%; 16372 border-collapse: collapse; 16373`,f0t=p(h0t).withConfig({displayName:"PromptsTabstyles__PromptsTable",componentId:"sc-mfg5dv-8"})` 16374 table-layout: fixed; 16375 width: 100%; 16376 background: ${Z}; 16377 16378 /* With many columns, prefer horizontal scroll over squeezing. 16379 First column (scope tabs) is 22rem; fixed-width columns sum to ~74.25rem â ~96.25rem total. 16380 Compact mode (suggested tab) uses a smaller min-width so the table scrolls on mobile 16381 instead of squishing the scope tabs. */ 16382 min-width: ${e=>e.$compact?"720px":"1560px"}; 16383 16384 @media (max-width: 1023px) { 16385 min-width: ${e=>e.$compact?"720px":"1460px"}; 16386 } 16387`,g0t=p.thead.withConfig({displayName:"PromptsTabstyles__THead",componentId:"sc-mfg5dv-9"})` 16388 background: ${$e}; 16389 border-bottom: 1px solid ${V}; 16390 position: sticky; 16391 top: 0; 16392 z-index: 2; 16393`,hp=p.th.withConfig({displayName:"PromptsTabstyles__TH",componentId:"sc-mfg5dv-10"})` 16394 text-align: left; 16395 padding: 0.55rem 0.7rem; 16396 font-size: 0.625rem; 16397 font-weight: 950; 16398 letter-spacing: 0.06em; 16399 text-transform: uppercase; 16400 color: ${z}; 16401 white-space: nowrap; 16402 overflow: hidden; 16403`,Mg=p.div.withConfig({displayName:"PromptsTabstyles__THLabel",componentId:"sc-mfg5dv-11"})` 16404 display: inline-flex; 16405 align-items: center; 16406 gap: 0.35rem; 16407`,Rg=p.button.withConfig({displayName:"PromptsTabstyles__THSortButton",componentId:"sc-mfg5dv-12"})` 16408 appearance: none; 16409 border: 0; 16410 background: transparent; 16411 padding: 0; 16412 margin: 0; 16413 cursor: pointer; 16414 display: inline-flex; 16415 align-items: center; 16416 gap: 0.3rem; 16417 font-size: inherit; 16418 font-weight: inherit; 16419 letter-spacing: inherit; 16420 text-transform: inherit; 16421 color: ${e=>e.$active?O:"inherit"}; 16422 transition: color 120ms ease; 16423 user-select: none; 16424 16425 & > svg { 16426 flex: 0 0 auto; 16427 line-height: 0; 16428 } 16429 16430 &:hover { 16431 color: ${O}; 16432 } 16433 16434 &:focus-visible { 16435 outline: none; 16436 box-shadow: 0 0 0 2px ${En}; 16437 border-radius: 2px; 16438 } 16439`,Og=p.span.withConfig({displayName:"PromptsTabstyles__THInfoTrigger",componentId:"sc-mfg5dv-13"})` 16440 display: inline-flex; 16441 align-items: center; 16442 justify-content: center; 16443 color: ${z}; 16444 line-height: 0; 16445 cursor: help; 16446`,jd=p.tr.withConfig({displayName:"PromptsTabstyles__TR",componentId:"sc-mfg5dv-14"})` 16447 border-bottom: 1px solid ${$e}; 16448 16449 &:last-child { 16450 border-bottom: 0; 16451 } 16452`,IQ=p(jd).withConfig({displayName:"PromptsTabstyles__TRTopic",componentId:"sc-mfg5dv-15"})` 16453 background: ${At}; 16454 16455 & > td { 16456 background: ${At}; 16457 } 16458`,Yn=p.td.withConfig({displayName:"PromptsTabstyles__TD",componentId:"sc-mfg5dv-16"})` 16459 padding: 0.6rem 0.7rem; 16460 font-size: 0.775rem; 16461 font-weight: ${e=>e.$muted?650:750}; 16462 color: ${e=>e.$muted?z:O}; 16463 text-align: ${e=>e.$right?"right":"left"}; 16464 vertical-align: middle; 16465 overflow: hidden; 16466 min-width: 0; 16467`,y0t=p.div.withConfig({displayName:"PromptsTabstyles__MetricCell",componentId:"sc-mfg5dv-17"})` 16468 display: inline-flex; 16469 align-items: center; 16470 justify-content: flex-end; 16471 gap: 0.35rem; 16472 width: 100%; 16473`,Tx=p(y0t).withConfig({displayName:"PromptsTabstyles__MetricCellLeft",componentId:"sc-mfg5dv-18"})` 16474 justify-content: flex-start; 16475`,PQ=p.span.withConfig({displayName:"PromptsTabstyles__TrendPill",componentId:"sc-mfg5dv-19"})` 16476 display: inline-flex; 16477 align-items: center; 16478 gap: 0.2rem; 16479 font-size: 0.55rem; 16480 font-weight: 950; 16481 padding: 0.06rem 0.3rem; 16482 border-radius: 9999px; 16483 border: 1px solid 16484 ${e=>e.$neutral?"color-mix(in srgb, var(--color-gray-500) 25%, transparent)":e.$positive?"color-mix(in srgb, var(--color-green-500) 22%, transparent)":"color-mix(in srgb, var(--color-red-500) 22%, transparent)"}; 16485 color: ${e=>e.$neutral?z:e.$positive?"var(--color-green-500)":"var(--color-red-600)"}; 16486 background: ${e=>e.$neutral?"color-mix(in srgb, var(--color-gray-500) 8%, transparent)":e.$positive?"color-mix(in srgb, var(--color-green-500) 12%, transparent)":"color-mix(in srgb, var(--color-red-500) 12%, transparent)"}; 16487 white-space: nowrap; 16488`;p.button.withConfig({displayName:"PromptsTabstyles__ToggleBtn",componentId:"sc-mfg5dv-20"})` 16489 border: 1px solid ${V}; 16490 background: ${e=>e.$active?V:Z}; 16491 color: ${O}; 16492 font-weight: 850; 16493 font-size: 0.75rem; 16494 height: 2rem; 16495 line-height: 1; 16496 padding: 0 0.75rem; 16497 border-radius: 0.375rem; 16498 cursor: pointer; 16499 display: inline-flex; 16500 align-items: center; 16501 gap: 0.5rem; 16502 user-select: none; 16503 white-space: nowrap; 16504 box-sizing: border-box; 16505 16506 &:hover { 16507 background: ${$e}; 16508 } 16509`;const x0t=p.button.withConfig({displayName:"PromptsTabstyles__TopicRowBtn",componentId:"sc-mfg5dv-21"})` 16510 appearance: none; 16511 border: 0; 16512 background: transparent; 16513 padding: 0; 16514 margin: 0; 16515 width: 100%; 16516 display: flex; 16517 align-items: center; 16518 gap: 0.5rem; 16519 min-width: 0; 16520 cursor: pointer;
16521 color: ${O}; 16522 font-weight: 950; 16523 font-size: 0.8rem; 16524 16525 /* Prevent chevrons/icons from shrinking when the topic name is long */ 16526 & > svg { 16527 flex: 0 0 auto; 16528 } 16529 16530 .topic-name { 16531 min-width: 0; 16532 overflow: hidden; 16533 text-overflow: ellipsis; 16534 white-space: nowrap; 16535 } 16536`,b0t=p.span.withConfig({displayName:"PromptsTabstyles__TopicPill",componentId:"sc-mfg5dv-22"})` 16537 font-size: 0.65rem; 16538 font-weight: 900; 16539 color: ${z}; 16540 background: ${$e}; 16541 border: 1px solid ${V}; 16542 padding: 0.1rem 0.45rem; 16543 border-radius: 9999px; 16544 white-space: nowrap; 16545 margin-left: auto; 16546`,Q7=p.div.withConfig({displayName:"PromptsTabstyles__RowActions",componentId:"sc-mfg5dv-23"})` 16547 width: 100%; 16548 display: inline-flex; 16549 align-items: center; 16550 justify-content: flex-end; 16551 gap: 0.35rem; 16552`,Cc=p.span.withConfig({displayName:"PromptsTabstyles__ActionPlaceholder",componentId:"sc-mfg5dv-24"})` 16553 width: 2rem; 16554 height: 2rem; 16555 flex: 0 0 auto; 16556`,AQ=p(Dn).withConfig({displayName:"PromptsTabstyles__PromptLink",componentId:"sc-mfg5dv-25"})` 16557 font-weight: 700; 16558 color: ${O}; 16559 text-decoration: none; 16560 flex: 1; 16561 min-width: 0; 16562 white-space: normal; 16563 overflow-wrap: anywhere; 16564 word-break: break-word; 16565 16566 &:hover { 16567 text-decoration: underline; 16568 } 16569`,v0t=p.div.withConfig({displayName:"PromptsTabstyles__SmallMuted",componentId:"sc-mfg5dv-26"})` 16570 margin-top: 0.15rem; 16571 font-size: 0.7rem; 16572 color: ${z}; 16573 font-weight: 700; 16574 white-space: normal; 16575 overflow-wrap: anywhere; 16576 word-break: break-word; 16577`,rj=p.div.withConfig({displayName:"PromptsTabstyles__Indent",componentId:"sc-mfg5dv-27"})` 16578 display: inline-flex; 16579 align-items: center; 16580 gap: 0.5rem; 16581 min-width: 0; 16582`,w0t=p.div.withConfig({displayName:"PromptsTabstyles__BrandsInline",componentId:"sc-mfg5dv-28"})` 16583 display: inline-flex; 16584 align-items: center; 16585 gap: 0.4rem; 16586 flex-wrap: nowrap; 16587 min-width: 0; 16588`,mue=p.button.withConfig({displayName:"PromptsTabstyles__BrandPill",componentId:"sc-mfg5dv-29"})` 16589 appearance: none; 16590 border: 1px solid ${V}; 16591 background: ${Z}; 16592 color: ${O}; 16593 font-weight: 850; 16594 font-size: 0.7rem; 16595 padding: 0.18rem 0.45rem; 16596 border-radius: 9999px; 16597 cursor: pointer; 16598 display: inline-flex; 16599 align-items: center; 16600 gap: 0.35rem; 16601 min-width: 0; 16602 white-space: nowrap; 16603 16604 &:hover { 16605 background: ${$e}; 16606 } 16607`,j0t=p.span.withConfig({displayName:"PromptsTabstyles__BrandLogo",componentId:"sc-mfg5dv-30"})` 16608 width: 14px; 16609 height: 14px; 16610 border-radius: 9999px; 16611 border: 1px solid ${V}; 16612 background: ${$e}; 16613 overflow: hidden; 16614 display: inline-flex; 16615 align-items: center; 16616 justify-content: center; 16617 flex: 0 0 auto; 16618 16619 img, 16620 svg { 16621 width: 100%; 16622 height: 100%; 16623 object-fit: cover; 16624 } 16625`,_0t=p(mue).withConfig({displayName:"PromptsTabstyles__MorePill",componentId:"sc-mfg5dv-31"})` 16626 background: color-mix(in srgb, var(--color-brand-600) 6%, transparent); 16627 border-color: color-mix(in srgb, var(--color-brand-600) 18%, transparent); 16628 color: ${Ft}; 16629`,C0t=p.button.withConfig({displayName:"PromptsTabstyles__BrandsPopoverOverlay",componentId:"sc-mfg5dv-32"})` 16630 position: fixed; 16631 inset: 0; 16632 border: 0; 16633 padding: 0; 16634 background: transparent; 16635 cursor: default; 16636 z-index: 40; 16637`,S0t=p.div.withConfig({displayName:"PromptsTabstyles__BrandsPopover",componentId:"sc-mfg5dv-33"})` 16638 position: fixed; 16639 z-index: 41; 16640 width: 360px; 16641 max-width: calc(100vw - 16px); 16642 max-height: 420px; 16643 overflow: hidden; 16644 border-radius: 0.95rem; 16645 border: 1px solid ${V}; 16646 background: ${Z}; 16647 box-shadow: 0 18px 40px color-mix(in srgb, var(--color-gray-900) 14%, transparent); 16648`,k0t=p.div.withConfig({displayName:"PromptsTabstyles__BrandsPopoverHeader",componentId:"sc-mfg5dv-34"})` 16649 padding: 0.75rem 0.75rem; 16650 border-bottom: 1px solid ${V}; 16651 display: flex; 16652 align-items: center; 16653 justify-content: space-between; 16654 gap: 0.75rem; 16655`,$0t=p.div.withConfig({displayName:"PromptsTabstyles__BrandsPopoverTitle",componentId:"sc-mfg5dv-35"})` 16656 font-weight: 950; 16657 color: ${O}; 16658 font-size: 0.85rem; 16659`,I0t=p.button.withConfig({displayName:"PromptsTabstyles__BrandsPopoverClose",componentId:"sc-mfg5dv-36"})` 16660 appearance: none; 16661 border: 0; 16662 background: ${$e}; 16663 border: 1px solid ${V}; 16664 color: ${O}; 16665 width: 2rem; 16666 height: 2rem; 16667 border-radius: 0.6rem; 16668 display: inline-flex; 16669 align-items: center; 16670 justify-content: center; 16671 cursor: pointer; 16672 16673 &:hover { 16674 background: ${V}; 16675 } 16676`,P0t=p.div.withConfig({displayName:"PromptsTabstyles__BrandsPopoverBody",componentId:"sc-mfg5dv-37"})` 16677 padding: 0.75rem 0.75rem; 16678 overflow: auto; 16679 max-height: 360px; 16680`,A0t=p.div.withConfig({displayName:"PromptsTabstyles__BrandsList",componentId:"sc-mfg5dv-38"})` 16681 display: flex; 16682 flex-direction: column; 16683 gap: 0.45rem; 16684`,N0t=p.div.withConfig({displayName:"PromptsTabstyles__BrandRow",componentId:"sc-mfg5dv-39"})` 16685 display: flex; 16686 align-items: center; 16687 justify-content: space-between; 16688 gap: 0.75rem; 16689`,z0t=p.div.withConfig({displayName:"PromptsTabstyles__BrandRowLeft",componentId:"sc-mfg5dv-40"})` 16690 display: inline-flex; 16691 align-items: center; 16692 gap: 0.5rem; 16693 min-width: 0; 16694`,T0t=p.div.withConfig({displayName:"PromptsTabstyles__BrandRowName",componentId:"sc-mfg5dv-41"})` 16695 font-weight: 850; 16696 color: ${O}; 16697 font-size: 0.85rem; 16698 overflow: hidden; 16699 text-overflow: ellipsis; 16700 white-space: nowrap; 16701`,E0t=p.div.withConfig({displayName:"PromptsTabstyles__BrandRowCount",componentId:"sc-mfg5dv-42"})` 16702 font-weight: 950; 16703 color: ${O}; 16704 font-size: 0.85rem; 16705`,oj=p.button.withConfig({displayName:"PromptsTabstyles__DangerIconButton",componentId:"sc-mfg5dv-43"})` 16706 appearance: none; 16707 border: 1px solid color-mix(in srgb, var(--color-red-500) 25%, transparent); 16708 background: color-mix(in srgb, var(--color-red-500) 8%, transparent); 16709 color: var(--color-red-600); 16710 width: 2rem; 16711 height: 2rem; 16712 border-radius: 0.6rem; 16713 display: inline-flex; 16714 align-items: center; 16715 justify-content: center; 16716 cursor: pointer; 16717 16718 &:hover { 16719 background: color-mix(in srgb, var(--color-red-500) 12%, transparent); 16720 } 16721`,G$=p.button.withConfig({displayName:"PromptsTabstyles__NeutralIconButton",componentId:"sc-mfg5dv-44"})` 16722 appearance: none; 16723 border: 1px solid ${V}; 16724 background: ${$e}; 16725 color: ${O}; 16726 width: 2rem; 16727 height: 2rem; 16728 border-radius: 0.6rem; 16729 display: inline-flex; 16730 align-items: center; 16731 justify-content: center; 16732 cursor: pointer; 16733 16734 &:hover { 16735 background: ${V}; 16736 } 16737`,M0t=p.button.withConfig({displayName:"PromptsTabstyles__PrimaryIconButton",componentId:"sc-mfg5dv-45"})` 16738 appearance: none; 16739 border: 1px solid ${Ft}; 16740 background: ${Ft}; 16741 color: ${Z}; 16742 width: 2rem; 16743 height: 2rem; 16744 border-radius: 0.6rem; 16745 display: inline-flex; 16746 align-items: center; 16747 justify-content: center; 16748 cursor: pointer; 16749 transition: background-color 140ms ease, border-color 140ms ease, opacity 140ms ease; 16750 16751 &:hover { 16752 background: color-mix(in srgb, ${Ft} 88%, black); 16753 border-color: color-mix(in srgb, ${Ft} 88%, black); 16754 } 16755 16756 &:disabled {
16757 cursor: not-allowed; 16758 opacity: 0.65; 16759 } 16760`;function R0t(e){return Object.entries(e&&typeof e=="object"?e:{}).map(([i,r])=>({name:String(i),count:Number(r)||0})).filter(i=>i.name.trim()&&i.count>0).sort((i,r)=>r.count-i.count)}const sj=50,NQ=25;function aj(e){const n=Number(e?.prompts_count);return Number.isFinite(n)&&n>=0?n:Array.isArray(e?.prompts)?e.prompts.length:0}function Ex(){return{prompts:[],page:0,per_page:25,total:0,total_pages:0,loading:!1,error:null,initialized:!1}}function zQ(e){return(Array.isArray(e?.topics)?e.topics:[]).map(n=>({id:Number(n?.id),name:String(n?.name||""),suggested_prompts:(Array.isArray(n?.suggested_prompts)?n.suggested_prompts:[]).map(i=>({id:Number(i?.id),topic_id:Number(i?.topic_id),content:String(i?.content||""),created_at:i?.created_at?String(i.created_at):null,avg_monthly_searches:typeof i?.avg_monthly_searches=="number"?i.avg_monthly_searches:null})).filter(i=>Number.isFinite(i.id)&&i.id>0&&i.content.trim()!=="")})).filter(n=>Number.isFinite(n.id)&&n.id>0)}function TQ({disabled:e,title:n,variant:i="primary",size:r="sm",showGenerate:o=!0,onChoose:s}){const[a,c]=l.useState(!1),[u,m]=l.useState(null),h=l.useRef(null),g=l.useRef(null),x=l.useRef(null),y=()=>{const j=h.current;if(!j)return;const v=j.getBoundingClientRect();x.current=v;const _=Math.round(v.bottom+8),$=Math.round(v.left);m({top:_,left:$})};l.useLayoutEffect(()=>{a&&y()},[a]),l.useEffect(()=>{if(!a||!u)return;const j=window.requestAnimationFrame(()=>{const v=x.current,_=g.current;if(!v||!_)return;const $=_.getBoundingClientRect(),k=8,P=8,S=window.innerWidth,I=window.innerHeight,A=(H,U,X)=>Math.max(U,Math.min(X,H)),E=v.left,B=Math.round(A(E,k,Math.max(k,S-k-$.width))),T=v.bottom+P,M=v.top-P-$.height,R=T+$.height<=I-k,F=M>=k;let Y;R?Y=T:F?Y=M:Y=A(T,k,Math.max(k,I-k-$.height)),Y=Math.round(Y),m(H=>H?H.top===Y&&H.left===B?H:{top:Y,left:B}:{top:Y,left:B})});return()=>window.cancelAnimationFrame(j)},[a,u]),l.useEffect(()=>{if(!a)return;const j=$=>{const k=$.target;h.current?.contains(k)||g.current?.contains(k)||c(!1)},v=$=>{$.key==="Escape"&&c(!1)},_=()=>c(!1);return document.addEventListener("mousedown",j),window.addEventListener("keydown",v),window.addEventListener("scroll",_,!0),window.addEventListener("resize",_),()=>{document.removeEventListener("mousedown",j),window.removeEventListener("keydown",v),window.removeEventListener("scroll",_,!0),window.removeEventListener("resize",_)}},[a]);const w=a&&u?jr.createPortal(t.jsxs("div",{ref:g,role:"menu","aria-label":"Add prompt options",style:{position:"fixed",top:u.top,left:u.left,zIndex:10002,minWidth:220,background:"var(--color-white)",border:"1px solid var(--color-gray-200)",borderRadius:12,boxShadow:"0 18px 60px color-mix(in srgb, var(--color-gray-900) 14%, transparent)",padding:6},children:[t.jsxs("button",{type:"button",role:"menuitem",style:{width:"100%",display:"flex",alignItems:"center",gap:10,padding:"10px 10px",borderRadius:10,border:0,background:"transparent",cursor:"pointer",fontWeight:850},onClick:()=>{c(!1),s("single")},children:[t.jsx(gr,{size:16}),"Single prompt"]}),t.jsxs("button",{type:"button",role:"menuitem",style:{width:"100%",display:"flex",alignItems:"center",gap:10,padding:"10px 10px",borderRadius:10,border:0,background:"transparent",cursor:"pointer",fontWeight:850},onClick:()=>{c(!1),s("bulk")},children:[t.jsx(so,{size:16}),"Bulk upload"]}),o?t.jsxs("button",{type:"button",role:"menuitem",style:{width:"100%",display:"flex",alignItems:"center",gap:10,padding:"10px 10px",borderRadius:10,border:0,background:"transparent",cursor:"pointer",fontWeight:850},onClick:()=>{c(!1),s("generate")},children:[t.jsx(Sn,{size:16}),"Generate with AI"]}):null,t.jsxs("button",{type:"button",role:"menuitem",style:{width:"100%",display:"flex",alignItems:"center",gap:10,padding:"10px 10px",borderRadius:10,border:0,background:"transparent",cursor:"pointer",fontWeight:850},onClick:()=>{c(!1),s("csv")},children:[t.jsx(Tne,{size:16}),"Upload from CSV"]})]}),document.body):null;return t.jsxs("div",{ref:h,style:{display:"inline-flex",position:"relative"},children:[t.jsx(he,{type:"button",size:r,variant:i,leftIcon:t.jsx(gr,{size:16}),disabled:e,title:n,onClick:()=>{e||c(j=>!j)},children:"Prompt"}),w]})}function O0t(){const{workspaceId:e,projectId:n,project:i,allModelOptions:r,enabledModelKeys:o,competitorOptions:s,isOwner:a}=z8(),c=Number(e),u=Number(n),[m,h]=yr(),g=S1(c,u),x=l.useCallback(xe=>
16760`/workspaces/${e}/projects/${n}/prompts/${xe}`,[n,e]),y=Uo(),{subscribe:w}=wo(),{user:j}=yn(),{countriesLimit:v,isLoading:_,loadKey:$,loadedKey:k}=Mr(),P=l.useMemo(()=>c&&j?.organizations?.find(xe=>Number(xe.id)===Number(c))||null,[c,j?.organizations]),S=!!(i?.can?.settings||i?.can?.edit),I=k1(),A=P?.role||null,E=!!P?.partner_managed,B=l.useMemo(()=>{if(!c)return null;const xe=j?.organizations?.find(Oe=>Number(Oe.id)===Number(c))?.data_history_months;return xe==null?null:Number(xe)},[c,j?.organizations]),T=e?`/workspaces/${e}/settings/plan`:"",[M,R]=l.useState(!1),F=l.useMemo(()=>B?A==="owner"?t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:()=>R(!0),style:{color:"inherit",fontWeight:850,textDecoration:"underline",background:"none",border:"none",padding:0,font:"inherit",cursor:"pointer"},children:"Upgrade your plan"})," to access older history."]}):"Ask your workspace owner to upgrade the plan.":null,[B,A]),Y=l.useMemo(()=>k!==$||_?!0:v===1,[v,$,k,_]),H=l.useMemo(()=>Y?A==="owner"?t.jsxs(t.Fragment,{children:["Location overrides are locked on your plan. ",t.jsx(Dn,{to:T,style:{color:"inherit",fontWeight:850,textDecoration:"underline"},children:"Upgrade your plan"})," to unlock."]}):"Location overrides are locked on your plan. Ask your workspace owner to upgrade.":"",[Y,A,T]);l.useEffect(()=>{!c||!u||g.loading||g.topics&&g.topics.length>0||g.error||g.ensure()},[c,u,g]);const U=l.useRef(null),X=l.useRef(null),Q=l.useRef(!1),[K,G]=l.useState(0),L=(xe,Oe,He)=>{He?xe.set(Oe,He):xe.delete(Oe)},q=xe=>xe?xe.split(",").map(Oe=>Oe.trim()).filter(Boolean):[],W=xe=>xe?xe.split(",").map(Oe=>Number(String(Oe||"").trim())).filter(Oe=>Number.isFinite(Oe)&&Oe>0):[],oe=xe=>{const Oe=new URLSearchParams(m);Zt===xe?nn==="asc"?(xn("desc"),Oe.set("sort",xe),Oe.set("sort_dir","desc")):(tn(null),xn("asc"),Oe.delete("sort"),Oe.delete("sort_dir")):(tn(xe),xn("asc"),Oe.set("sort",xe),Oe.set("sort_dir","asc")),le(1),Oe.delete("page"),h(Oe,{replace:!0})},se=xe=>Zt!==xe?t.jsx(q8,{size:12,style:{opacity:.4}}):nn==="asc"?t.jsx($ne,{size:12}):t.jsx(kne,{size:12}),[de,le]=l.useState(1),[me,ee]=l.useState({page:1,per_page:sj,total:0,total_pages:0}),[ne,Ae]=l.useState({}),_e=l.useRef(ne);_e.current=ne;const we=l.useRef(new Set),[Ke,ce]=l.useState(0),ie=l.useMemo(()=>String(i?.country_code||"").trim().toUpperCase(),[i]),Re=l.useMemo(()=>String(i?.country||"").trim(),[i]),Be=l.useMemo(()=>String(i?.city||"").trim(),[i]),tt=xe=>{const Oe=String(xe||"").trim().toUpperCase();if(!/^[A-Z]{2}$/.test(Oe))return null;const He=127462,Ye=He+(Oe.charCodeAt(0)-65),ft=He+(Oe.charCodeAt(1)-65);return String.fromCodePoint(Ye,ft)},dt=xe=>{const Oe=String(xe?.city||Be||"").trim(),He=String(xe?.name||Re||"").trim(),Ye=String(xe?.code||ie||"").trim().toUpperCase();if(He){const Ot=/^[A-Z]{2}$/.test(Ye),ln=Ot?tt(Ye):null;return t.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,fontWeight:850},children:[Ot?t.jsx("span",{"aria-hidden":!0,style:{fontSize:"1rem",lineHeight:1},children:ln||"ð³ï¸"}):null,t.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:140},children:Oe?`${Oe}, ${Ot?Ye:He}`:He}),!Oe&&Ot?t.jsx("span",{style:{opacity:.8},children:Ye}):null]})}if(Oe)return t.jsx("span",{style:{fontWeight:850},children:Ye?`${Oe}, ${Ye}`:Oe});if(!/^[A-Z]{2}$/.test(Ye))return t.jsx("span",{children:"â"});const ft=tt(Ye);return t.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,fontWeight:850},children:[t.jsx("span",{"aria-hidden":!0,style:{fontSize:"1rem",lineHeight:1},children:ft||"ð³ï¸"}),t.jsx("span",{children:Ye})]})},[je,Me]=l.useState("active"),Se=je==="suggested",it=!0,De=!0,te=!0,ge={width:0,padding:0,border:"none",overflow:"hidden"},[Je,Ee]=l.useState(()=>{const xe=qs();return{start:hl(xe,-6),end:xe}}),[Xe,yt]=l.useState([]),[Ne,Le]=l.useState([]),[Ue,We]=l.useState([]),[Qe,ht]=l.useState([]),[pe,be]=l.useState([]),rt=l.useMemo(()=>{const xe=new Set(o),Oe=Xe.filter(He=>xe.has(He));return Oe.length>0?Oe:o},[o,Xe]),[ze,lt]=l.useState([]),[vt,Wt]=l.useState(!0),[Qt,Yt]=l.useState(""),[Zt,tn]=l.useState(null),[nn,xn
16760]=l.useState("asc"),st=l.useMemo(()=>{const xe=new Map;s.forEach(Ye=>{const ft=String(Ye.label||"").trim();ft&&xe.set(ft.toLowerCase(),{name:ft,website:Ye.website??null,logo_url:Ye.logo_url??null})});const Oe=String(i?.name||"").trim(),He={name:Oe,website:i?.website??null,logo_url:i?.logo_url??null};return Oe&&xe.set(Oe.toLowerCase(),He),xe},[s,i?.name,i?.website,i?.logo_url]),Ct=l.useRef(null),Ie=l.useRef(null),[ae,Fe]=l.useState(null);function Ge(){Ct.current=null,Fe(null)}function wt(){const xe=Ct.current,Oe=Ie.current;if(!xe||!Oe)return null;const He=xe.getBoundingClientRect(),Ye=Oe.getBoundingClientRect(),ft=window.innerWidth,Ot=window.innerHeight,ln=8,on=8,In=Math.max(0,Number(Ye.width||0)),xi=Math.max(0,Number(Ye.height||0));if(!In||!xi)return null;let ai=He.right-In;ai=Math.min(Math.max(ai,ln),Math.max(ln,ft-ln-In));const Yi=He.bottom+on,ar=He.top-on-xi;let Pi=Yi;return Yi+xi>Ot-ln&&ar>=ln&&(Pi=ar),Pi=Math.min(Math.max(Pi,ln),Math.max(ln,Ot-ln-xi)),{x:ai,y:Pi}}function ke(xe,Oe){Ct.current=xe,Fe({x:0,y:0,ready:!1,items:Oe})}const Ve=xe=>{const Oe=R0t(xe);if(Oe.length===0)return t.jsx("span",{children:"â"});const He=Oe.slice(0,1),Ye=Oe.length-He.length,ft=Ot=>ke(Ot.currentTarget,Oe);return t.jsxs(w0t,{children:[He.map(Ot=>{const ln=st.get(Ot.name.toLowerCase())??{name:Ot.name,website:null,logo_url:null};return t.jsxs(mue,{type:"button",title:`${Ot.name} (${Ot.count})`,onClick:ft,children:[t.jsx(xo,{record:ln,size:18}),t.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis"},children:Ot.name}),t.jsx("span",{style:{color:z,fontWeight:950},children:Ot.count})]},Ot.name)}),Ye>0?t.jsxs(_0t,{type:"button",onClick:ft,title:"Show all",children:["+",Ye]}):null]})};l.useLayoutEffect(()=>{if(!ae)return;let xe=!1;const Oe=()=>{if(xe)return;const ft=wt();ft&&Fe(Ot=>!Ot||Ot.ready&&Math.abs(Ot.x-ft.x)<.5&&Math.abs(Ot.y-ft.y)<.5?Ot:{...Ot,x:ft.x,y:ft.y,ready:!0})};requestAnimationFrame(Oe);const He=()=>requestAnimationFrame(Oe),Ye=()=>requestAnimationFrame(Oe);return window.addEventListener("scroll",He,!0),window.addEventListener("resize",Ye),()=>{xe=!0,window.removeEventListener("scroll",He,!0),window.removeEventListener("resize",Ye)}},[ae]);const[pt,Nt]=l.useState(!1),[qe,qt]=l.useState(null),[Mn,zt]=l.useState([]),[dn,rn]=l.useState([]),[bn,kt]=l.useState([]),[Kt,un]=l.useState(0),[pn,$n]=l.useState({}),[Ii,_i]=l.useState({}),[di,Co]=l.useState(null),[Gr,Go]=l.useState(!1);l.useEffect(()=>{const xe=m.get("end")||qs(),Oe=m.get("start")||hl(xe,-6);(Je.start!==Oe||Je.end!==xe)&&Ee({start:Oe,end:xe});const He=(m.get("scope")||"active").toLowerCase(),Ye=He==="archived"||He==="suggested"&&it?He:"active";je!==Ye&&Me(Ye);const ft=q(m.get("models"));ft.join(",")!==Xe.join(",")&&yt(ft);const Ot=W(m.get("topic_ids"));Ot.join(",")!==Ne.join(",")&&Le(Ot);const ln=W(m.get("competitor_ids"));ln.join(",")!==ze.join(",")&<(ln);const on=q(m.get("categories")),In=on.length===id.length&&id.every(Fu=>on.includes(Fu))?[]:on;In.join(",")!==Ue.join(",")&&We(In);const xi=q(m.get("sentiments")),ai=xi.length===Gd.length&&Gd.every(Fu=>xi.includes(Fu))?[]:xi;ai.join(",")!==Qe.join(",")&&ht(ai);const Yi=q(m.get("locations"));Yi.join(",")!==pe.join(",")&&be(Yi);const ar=m.get("q")||"";ar!==Qt&&Yt(ar);const Xo=(m.get("group")||"topic").toLowerCase()!=="flat";Xo!==vt&&Wt(Xo);const rd=m.get("sort")||"",Yr=["visibility","position","sentiment","category","volume","location","created_at"].includes(rd)?rd:null;Yr!==Zt&&tn(Yr);const qp=(m.get("sort_dir")||"asc").toLowerCase()==="desc"?"desc":"asc";qp!==nn&&xn(qp);const Gp=Math.max(1,Number(m.get("page")||"1")||1);Gp!==de&&le(Gp)},[m]),l.useEffect(()=>{if(!u||je==="suggested")return;try{U.current?.unsubscribe?.()}catch{}U.current=null;const xe=w({channel:"ProjectPromptsChannel",project_id:u},{received:Oe=>{if(String(Oe?.type||"")!=="prompt_finished"||Number(Oe?.project_id)!==u)return;const ft=Number(Oe?.prompt_id);!Number.isFinite(ft)||ft<=0||(zt(Ot=>Ot.map(ln=>({...ln,prompts:(ln.prompts||[]).map(on=>Number(on.id)===ft?{...on,is_running:!1}:on)}))),Ae(Ot=>{const ln={};return Object.entries(Ot).forEach(([on,In])=>{ln[on]={...In,prompts:(In.prompts||[]).map(xi=>Number(xi.id)===ft?{...xi,is_running:!1}:xi)}}),ln}),Q.current=!0,X.current&&window.clearTimeout(X.current),X.current=window.setTimeout(()=>{X.current=null,G(Ot=>Ot+1)},650))}})||null;return U.current=xe,()=>{X.current&&(window.clearTimeout(X.current),X.current=null);try{U.current?.unsubscribe?.()}catch{}U.current=null}},[u,je,w]);const Qc=l.useCallback(xe=>{const Oe=new URLSearchParams;Oe.set("start",Je.start),Oe.set("end",Je.end),Xe.length>0&&Oe.set("models",Xe.join(","));const He=Array.isArray(xe?.topicIds)?xe.topicIds:Ne;He.length>0&&Oe.set("topic_ids",He.join(",")),ze.length>0&&Oe.set("competitor_ids",ze.join(",")),Ue.length>0&&Oe.set("categories",Ue.join(",")),Qe.length>0&&Oe.set("sentiments",Qe.join(",")),pe.length>0&&Oe.set("locations",pe.join(",")),Qt.trim()&&Oe.set("q",Qt.trim());const Ye=Zt||null;
16760return Ye&&(Oe.set("sort",Ye),Oe.set("sort_dir",nn)),xe?.flat&&Oe.set("group","flat"),typeof xe?.page=="number"&&xe.page>0&&Oe.set("page",String(xe.page)),typeof xe?.perPage=="number"&&xe.perPage>0&&Oe.set("per_page",String(xe.perPage)),je==="archived"?Oe.set("scope","archived"):je==="active"&&Oe.set("scope","active"),Oe},[ze,Je.end,Je.start,Xe,je,Qt,Ue,pe,Qe,De,te,Ne,nn,Zt,m]),Zs=l.useCallback(xe=>(Array.isArray(xe?.topics)?xe.topics:[]).map(He=>({id:Number(He?.id),name:String(He?.name||""),prompts_count:Number.isFinite(Number(He?.prompts_count))?Number(He.prompts_count):void 0,avg_monthly_searches:typeof He?.avg_monthly_searches=="number"?He.avg_monthly_searches:null,direct_competitor_mentions:He?.direct_competitor_mentions&&typeof He.direct_competitor_mentions=="object"?He.direct_competitor_mentions:null,visibility_score:typeof He?.visibility_score=="number"?He.visibility_score:null,visibility_trend_pp:typeof He?.visibility_trend_pp=="number"?He.visibility_trend_pp:null,sentiment_score:typeof He?.sentiment_score=="number"?He.sentiment_score:null,avg_position:typeof He?.avg_position=="number"?He.avg_position:null,avg_position_trend_delta:typeof He?.avg_position_trend_delta=="number"?He.avg_position_trend_delta:null,prompts:(Array.isArray(He?.prompts)?He.prompts:[]).map(Ye=>({id:Number(Ye?.id),topic_id:Number(Ye?.topic_id),content:String(Ye?.content||""),category:Ye?.category?String(Ye.category):null,city_override:Ye?.city_override?String(Ye.city_override):null,country_override:Ye?.country_override?String(Ye.country_override):null,country_code_override:Ye?.country_code_override?String(Ye.country_code_override):null,created_at:Ye?.created_at?String(Ye.created_at):null,archived_at:Ye?.archived_at?String(Ye.archived_at):null,avg_monthly_searches:typeof Ye?.avg_monthly_searches=="number"?Ye.avg_monthly_searches:null,direct_competitor_mentions:Ye?.direct_competitor_mentions&&typeof Ye.direct_competitor_mentions=="object"?Ye.direct_competitor_mentions:null,visibility_score:typeof Ye?.visibility_score=="number"?Ye.visibility_score:null,visibility_trend_pp:typeof Ye?.visibility_trend_pp=="number"?Ye.visibility_trend_pp:null,avg_position:typeof Ye?.avg_position=="number"?Ye.avg_position:null,avg_position_trend_delta:typeof Ye?.avg_position_trend_delta=="number"?Ye.avg_position_trend_delta:null,sentiment_score:typeof Ye?.sentiment_score=="number"?Ye.sentiment_score:null,is_running:!!Ye?.is_running})).filter(Ye=>Number.isFinite(Ye.id)&&Ye.id>0&&Ye.content.trim()!=="")})).filter(He=>Number.isFinite(He.id)&&He.id>0&&He.name.trim()!==""),[]);l.useEffect(()=>{const xe=Number(e),Oe=Number(n);if(!xe||!Oe)return;let He=!1;const Ye=Q.current;return Q.current=!1,Ye||Nt(!0),qt(null),(async()=>{try{if(je==="suggested"){const ai=await ue(`/api/v1/organizations/${xe}/projects/${Oe}/suggested_prompts`,{method:"GET"}),Yi=await ai.json().catch(()=>({}));if(!ai.ok)throw new Error(Yi?.error||Yi?.errors?.[0]||"Failed to load suggested prompts");const Pi=zQ(Yi);if(He)return;kt(Pi),zt([]),Ae({});const Xo=Pi.reduce((rd,xr)=>rd+(Array.isArray(xr.suggested_prompts)?xr.suggested_prompts.length:0),0);un(Xo),ee({page:1,per_page:Xo,total:Xo,total_pages:1});return}const ft=vt?Qc():Qc({flat:!0,page:de,perPage:sj}),Ot=await ue(`/api/v1/organizations/${xe}/projects/${Oe}/prompts?${ft.toString()}`,{method:"GET"}),ln=await Ot.json().catch(()=>({}));if(!Ot.ok)throw new Error(ln?.error||ln?.errors?.[0]||"Failed to load prompts");const on=ln;typeof on.suggested_prompts_count=="number"&&un(on.suggested_prompts_count);const In=Array.isArray(on?.filters?.locations)?on.filters.locations:[];rn(In.map(ai=>({key:String(ai?.key||""),country:ai?.country?String(ai.country):null,country_code:ai?.country_code?String(ai.country_code):null})).filter(ai=>!!ai.key));const xi=Zs(on);if(He)return;if(kt([]),vt){zt(xi.map(Yi=>({...Yi,prompts:[]}))),we.current.clear(),Ae({}),ce(Yi=>Yi+1);const ai=xi.reduce((Yi,ar)=>Yi+aj(ar),0);ee({page:1,per_page:0,total:ai,total_pages:1})}else{we.current.clear(),Ae({}),zt(Yi=>{if(de<=1)return xi;const ar=new Map;return Yi.forEach(Pi=>ar.set(Number(Pi.id),{...Pi,prompts:[...Pi.prompts||[]]})),xi.forEach(Pi=>{const Xo=ar.get(Number(Pi.id));if(!Xo){ar.set(Number(Pi.id),Pi);return}const rd=new Set((Xo.prompts||[]).map(Yr=>Number(Yr.id))),xr=[...Xo.prompts||[]];
16760(Pi.prompts||[]).forEach(Yr=>{rd.has(Number(Yr.id))||xr.push(Yr)}),ar.set(Number(Pi.id),{...Pi,prompts:xr})}),Array.from(ar.values())});const ai=ln?.pagination;if(ai&&typeof ai=="object")ee({page:Number(ai?.page)||de,per_page:Number(ai?.per_page)||sj,total:Number(ai?.total)||0,total_pages:Number(ai?.total_pages)||0});else{const Yi=xi.reduce((ar,Pi)=>ar+(Array.isArray(Pi.prompts)?Pi.prompts.length:0),0);ee({page:de,per_page:sj,total:Yi,total_pages:1})}}}catch(ft){if(He)return;zt([]),we.current.clear(),Ae({}),ce(Ot=>Ot+1),kt([]),qt(ft?.message||"Failed to load prompts"),ee({page:de,per_page:sj,total:0,total_pages:0})}finally{if(He)return;Nt(!1)}})(),()=>{He=!0}},[e,n,Je.start,Je.end,rt.join(","),Ne.join(","),ze.join(","),Ue.join(","),Qe.join(","),pe.join(","),Qc,vt,Zs,de,je,K]);const jl=l.useCallback(async(xe,Oe)=>{const He=Number(e),Ye=Number(n);if(!He||!Ye||!vt||je==="suggested"||!Number.isFinite(xe)||xe<=0)return;const ft=String(xe);if(we.current.has(ft))return;const Ot=_e.current[ft]||Ex();if(Ot.loading)return;const ln=Oe?.reset?1:Ot.page+1;if(!(!Oe?.reset&&Ot.initialized&&Ot.total_pages>0&&Ot.page>=Ot.total_pages)){we.current.add(ft),Ae(on=>({...on,[ft]:{...on[ft]||Ex(),loading:!0,error:null}}));try{const on=Qc({flat:!0,topicIds:[xe],page:ln,perPage:NQ}),In=await ue(`/api/v1/organizations/${He}/projects/${Ye}/prompts?${on.toString()}`,{method:"GET"}),xi=await In.json().catch(()=>({}));if(!In.ok)throw new Error(xi?.error||xi?.errors?.[0]||"Failed to load prompts");const Yi=Zs(xi).flatMap(Pi=>Pi.prompts||[]).filter(Pi=>Number(Pi.topic_id)===Number(xe)),ar=xi?.pagination;Ae(Pi=>{const Xo=Pi[ft]||Ex(),rd=new Set((Oe?.reset?[]:Xo.prompts).map(Yr=>Number(Yr.id))),xr=Oe?.reset?[]:[...Xo.prompts];return Yi.forEach(Yr=>{rd.has(Number(Yr.id))||xr.push(Yr)}),{...Pi,[ft]:{prompts:xr,page:Number(ar?.page)||ln,per_page:Number(ar?.per_page)||NQ,total:Number(ar?.total)||Yi.length,total_pages:Number(ar?.total_pages)||(Yi.length>0?1:0),loading:!1,error:null,initialized:!0}}})}catch(on){Ae(In=>({...In,[ft]:{...In[ft]||Ex(),loading:!1,error:on?.message||"Failed to load prompts",initialized:!0}}))}finally{we.current.delete(ft)}}},[Qc,vt,Zs,n,je,e]),Vo=l.useRef(jl);Vo.current=jl;const[Ro,So]=l.useState(()=>({})),ic=l.useMemo(()=>bn.map(xe=>{const Oe=(xe.suggested_prompts||[]).map(ft=>({id:ft.id,topic_id:ft.topic_id,content:ft.content,created_at:ft.created_at||null,archived_at:null,avg_monthly_searches:ft.avg_monthly_searches??null,direct_competitor_mentions:null,visibility_score:null,visibility_trend_pp:null,sentiment_score:null,avg_position:null,avg_position_trend_delta:null,is_suggested:!0})),He=Oe.map(ft=>ft.avg_monthly_searches).filter(ft=>typeof ft=="number"&&ft!==null),Ye=He.length>0?Math.max(...He):null;return{id:xe.id,name:xe.name,visibility_score:null,visibility_trend_pp:null,sentiment_score:null,avg_monthly_searches:Ye,direct_competitor_mentions:null,avg_position:null,avg_position_trend_delta:null,prompts:Oe}}).filter(xe=>Number.isFinite(xe.id)&&xe.id>0),[bn]);l.useEffect(()=>{!vt||je==="suggested"||Mn.length===0||So(xe=>{const Oe={};Mn.forEach(Ot=>{const ln=String(Ot.id);Oe[ln]=xe[ln]===!0}),Object.values(Oe).some(Ot=>Ot)||(Oe[String(Mn[0].id)]=!0);const Ye=Object.keys(xe),ft=Object.keys(Oe);return Ye.length===ft.length&&ft.every(Ot=>xe[Ot]===Oe[Ot])?xe:Oe})},[Mn,vt,je]),l.useEffect(()=>{!vt||je!=="suggested"||ic.length===0||So(xe=>{const Oe={};ic.forEach(ft=>{const Ot=String(ft.id);Oe[Ot]=xe[Ot]!==!1});const He=Object.keys(xe),Ye=Object.keys(Oe);return He.length===Ye.length&&Ye.every(ft=>xe[ft]===Oe[ft])?xe:Oe})},[ic,vt,je]),l.useEffect(()=>{!vt||je==="suggested"||Object.entries(Ro).forEach(([xe,Oe])=>{if(!Oe)return;const He=_e.current[xe];He?.loading||He?.initialized||Vo.current(Number(xe),{reset:!0})})},[vt,Ro,je,Ke]);const cs=l.useMemo(()=>je==="suggested"?ic:Mn,[je,Mn,ic]),rc=l.useMemo(()=>{if(je==="suggested"){const xe=Qt.trim().toLowerCase();return xe?cs.map(Oe=>{if(Oe.name.toLowerCase().includes(xe))return Oe;const Ye=Oe.prompts.filter(ft=>ft.content.toLowerCase().includes(xe));return{...Oe,prompts:Ye}}).filter(Oe=>Oe.prompts.length>0||Oe.name.toLowerCase().includes(xe)):cs}return vt&&Qt.trim()?cs.filter(xe=>aj(xe)>0||xe.name.toLowerCase().includes(Qt.trim().toLowerCase())):[...cs].sort((xe,Oe)=>{const He=aj(xe)===0?1:0,Ye=aj(Oe)===0?1:0;return He-Ye})},[je,Qt,cs,vt]),_l=l.useMemo(()=>{const xe=Qt.trim().toLowerCase(),Oe=[];if(cs.forEach(He=>
16760{He.prompts.forEach(Ye=>{const ft=String(He.name||"");if(!xe){Oe.push({...Ye,topic_name:ft});return}(ft.toLowerCase().includes(xe)||String(Ye.content||"").toLowerCase().includes(xe))&&Oe.push({...Ye,topic_name:ft})})}),Zt){const He=nn==="desc"?-1:1;Oe.sort((Ye,ft)=>{let Ot=null,ln=null;switch(Zt){case"visibility":Ot=Ye.visibility_score??null,ln=ft.visibility_score??null;break;case"position":Ot=Ye.avg_position??null,ln=ft.avg_position??null;break;case"sentiment":Ot=Ye.sentiment_score??null,ln=ft.sentiment_score??null;break;case"category":Ot=(Ye.category??"").toLowerCase(),ln=(ft.category??"").toLowerCase();break;case"volume":Ot=Ye.avg_monthly_searches??null,ln=ft.avg_monthly_searches??null;break;case"location":Ot=(Ye.country_override??"").toLowerCase(),ln=(ft.country_override??"").toLowerCase();break;case"created_at":Ot=Ye.created_at??"",ln=ft.created_at??"";break}return Ot==null&&ln==null?0:Ot==null?1:ln==null?-1:Ot<ln?-1*He:Ot>ln?1*He:0})}return Oe},[Qt,cs,Zt,nn]),Ns=l.useMemo(()=>(g.topics||[]).map(xe=>({value:String(xe?.id),label:String(xe?.name||"").trim()})).filter(xe=>Number.isFinite(Number(xe.value))&&Number(xe.value)>0&&!!xe.label),[g.topics]),[Ti,ds]=l.useState(!1),Cl=l.useMemo(()=>xe=>{if(xe==="generate"){Kn(!0),an(!1),Oo(!1),gi(!1),ps(!1);return}if(xe==="csv"){an(!0),Kn(!1),Oo(!1),gi(!1),ps(!1);return}const Oe=Ns[0]?.value||"";if(Oe){if(xe==="bulk"){mo("organic search"),Ka(Oe),Oo(!0),gi(!1),ps(!1);return}_a("organic search"),ea(Oe),Ca(""),zs(null),ta(""),gi(!0),Oo(!1),ps(!1)}},[Ns]),Sl=l.useMemo(()=>(g.topics||[]).map(xe=>({id:Number(xe?.id),label:String(xe?.name||"").trim()})).filter(xe=>Number.isFinite(xe.id)&&xe.id>0&&!!xe.label),[g.topics]);l.useEffect(()=>{if(Sl.length<=0)return;const xe=new Set(Sl.map(Oe=>Oe.id));Le(Oe=>{const He=Oe.filter(Ye=>xe.has(Ye));return He.length===Oe.length?Oe:He})},[Sl]);const Ko=xe=>{const Oe=String(xe||"").trim();return Oe?Oe.toLowerCase().replace(/\b([a-z0-9])([a-z0-9']*)\b/g,(He,Ye,ft)=>Ye.toUpperCase()+ft):""},Zc=xe=>{const Oe=String(xe||""),He=Oe.trimStart();if(!He)return Oe;const ft=He.split(/\s+/,2)[0]||"",Ot=He.slice(ft.length);return(ft.length>0?ft[0].toUpperCase()+ft.slice(1).toLowerCase():ft)+Ot},us=(xe,Oe,He=!0)=>{if(typeof xe!="number")return t.jsx(PQ,{$neutral:!0,children:"â"});const Ye=He?xe>=0:xe<=0;return t.jsxs(PQ,{$positive:Ye,children:[Ye?t.jsx(qi,{size:11}):t.jsx(ul,{size:11}),xe>=0?"+":"",xe.toFixed(Oe)]})},Js=()=>Array.from({length:8}).map((Oe,He)=>{const Ye=He%4===0,ft=Ye?IQ:jd;return t.jsxs(ft,{children:[t.jsx(Yn,{children:t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.6rem"},children:[t.jsx(nt,{style:{width:Ye?"14rem":"18rem",height:"0.9rem"}}),Ye?t.jsx(nt,{style:{width:"5rem",height:"0.8rem",borderRadius:9999}}):null]})}),t.jsx(Yn,{children:t.jsx(nt,{style:{width:"6rem",height:"0.9rem"}})}),t.jsx(Yn,{children:t.jsx(nt,{style:{width:"6rem",height:"0.9rem"}})}),t.jsx(Yn,{children:t.jsx(nt,{style:{width:"4rem",height:"0.9rem"}})}),t.jsx(Yn,{children:t.jsx(nt,{style:{width:"6rem",height:"0.9rem"}})}),t.jsx(Yn,{children:t.jsx(nt,{style:{width:"4rem",height:"0.9rem"}})}),t.jsx(Yn,{children:t.jsx(nt,{style:{width:"8rem",height:"0.9rem"}})}),t.jsx(Yn,{children:t.jsx(nt,{style:{width:"3rem",height:"0.9rem"}})}),t.jsx(Yn,{children:t.jsx(nt,{style:{width:"4rem",height:"0.9rem"}})}),t.jsx(Yn,{$right:!0,children:t.jsxs("div",{style:{display:"inline-flex",gap:"0.35rem",justifyContent:"flex-end"},children:[t.jsx(nt,{style:{width:"2rem",height:"2rem",borderRadius:"0.5rem"}}),t.jsx(nt,{style:{width:"2rem",height:"2rem",borderRadius:"0.5rem"}}),t.jsx(nt,{style:{width:"2rem",height:"2rem",borderRadius:"0.5rem"}})]})})]},`sk-${He}`)}),[Fp,oc]=l.useState(!1),[va,sc]=l.useState(""),[wa,Wp]=l.useState(!1),[ac,Vr]=l.useState(null),[Jc,Oo]=l.useState(!1),[qa,Kn]=l.useState(!1),[Ga,an]=l.useState(!1),[Va,Ka]=l.useState(""),[Kr,mo]=l.useState("organic search"),[ja,gi]=l.useState(!1),[Or,ea]=l.useState(""),[Hd,_a]=l.useState("organic search"),[kl,Ca]=l.useState(""),[to,zs]=l.useState(null),[Sa,ta]=l.useState(""),[Du,ps]=l.useState(!1),[lc,na]=l.useState(""),[Ya,Yo]=l.useState("organic search"),[Up,ed]=l.useState(""),[Xa,$l]=l.useState(null),[Lu,td]=l.useState("");l.useEffect(()=>{const xe=(m.get("add")||"").toLowerCase();if(xe!=="single"&&xe!=="bulk")return;const Oe=Ns[0]?.value||"";if(!Oe)return;
16760const He=new URLSearchParams(m);if(He.delete("add"),h(He,{replace:!0}),Kn(!1),an(!1),ps(!1),xe==="bulk"){mo("organic search"),Ka(Oe),Oo(!0),gi(!1);return}_a("organic search"),ea(Oe),Ca(""),zs(null),ta(""),gi(!0),Oo(!1)},[Ns,m,h]);const nd=l.useMemo(()=>[{value:"organic search",label:"Organic Search"},{value:"brand sentiment",label:"Brand Sentiment"},{value:"competitor comparison",label:"Competitor Comparison"}],[]),qd=l.useMemo(()=>[{key:"organic search",label:"Organic Search"},{key:"brand sentiment",label:"Brand Sentiment"},{key:"competitor comparison",label:"Competitor Comparison"}],[]),id=l.useMemo(()=>qd.map(xe=>xe.key),[qd]),Qa=l.useMemo(()=>Ue.length===0?id:Ue,[id,Ue]),ka=Ue.length>0,_r=l.useMemo(()=>[{key:"positive",label:"Positive"},{key:"neutral",label:"Neutral"},{key:"negative",label:"Negative"}],[]),Gd=l.useMemo(()=>_r.map(xe=>xe.key),[_r]),Cr=l.useMemo(()=>Qe.length===0?Gd:Qe,[Gd,Qe]),ti=Qe.length>0,Ts=l.useMemo(()=>{const Oe=(Array.isArray(dn)?dn:[]).map(Ye=>{const ft=String(Ye?.key||"").trim(),Ot=String(Ye?.country_code||"").trim().toUpperCase(),ln=String(Ye?.country||"").trim(),on=ln?Ko(ln):"",In=Ot&&/^[A-Z]{2}$/.test(Ot)?tt(Ot):null,xi=`${In?`${In} `:""}${on||Ot||ft}`,ai=Ot&&ln&&!xi.includes(Ot)?`${xi} ${Ot}`:xi;return{key:ft,label:ai}}),He=new Map;return Oe.forEach(Ye=>{Ye.key&&(He.has(Ye.key)||He.set(Ye.key,Ye))}),Array.from(He.values())},[dn]),cc=l.useMemo(()=>Ts.map(xe=>xe.key),[Ts]),hh=l.useMemo(()=>pe.length===0?cc:pe,[cc,pe]),Hp=pe.length>0,dc=Qt.trim()!==""||Ue.length>0||Qe.length>0||pe.length>0||Ne.length>0||ze.length>0;l.useEffect(()=>{if(cc.length<=0)return;const xe=new Set(cc);be(Oe=>{const He=Oe.filter(Ye=>xe.has(String(Ye)));return He.length===Oe.length?Oe:He})},[cc]);const Vd=l.useCallback(xe=>{if(!xe||xe.length===0){we.current.clear(),Ae({}),ce(He=>He+1);return}const Oe=new Set(xe.map(He=>String(He)));Oe.forEach(He=>we.current.delete(He)),Ae(He=>{const Ye={...He};return Oe.forEach(ft=>{delete Ye[ft]}),Ye}),ce(He=>He+1)},[]),$a=l.useCallback(xe=>{if(Vd(xe?.topicIds),!vt&&xe?.resetFlatPage!==!1){le(1);const Oe=new URLSearchParams(m);Oe.delete("page"),h(Oe,{replace:!0})}G(Oe=>Oe+1)},[vt,Vd,m,h]),Bu=l.useCallback(xe=>{for(const Oe of Mn)if((Oe.prompts||[]).some(He=>Number(He.id)===Number(xe)))return Number(Oe.id);for(const[Oe,He]of Object.entries(ne))if((He.prompts||[]).some(Ye=>Number(Ye.id)===Number(xe)))return Number(Oe);return null},[Mn,ne]),[Za,Il]=l.useState(null),[Pl,Kd]=l.useState(null),[Ki,Ia]=l.useState(!1),[Pa,Aa]=l.useState(null);async function It(){if(!c||!u||wa)return;const xe=va.trim();if(!xe){Vr("Topic name is required."),y.showToast("Topic name is required.",{tone:"error"});return}if(xe.length>ni.topicNameMaxChars){const Oe=`Topic is too long (max ${ni.topicNameMaxChars} characters).`;Vr(Oe),y.showToast(Oe,{tone:"error"});return}Wp(!0),Vr(null);try{if(!g.createTopic)throw new Error("Topics provider not ready");const Oe=await g.createTopic(xe);oc(!1),sc(""),So(He=>({...He,[String(Oe.id)]:!0})),$a({topicIds:[Number(Oe.id)],resetFlatPage:!1}),y.showToast("Topic added",{tone:"success"})}catch(Oe){const He=Oe?.message||"Failed to create topic";Vr(He),y.showToast(He,{tone:"error"})}finally{Wp(!1)}}async function Dt(xe){const Oe=Number(e),He=Number(n);if(!Oe||!He||Ti)return;const Ye=Number(Va);if(!Number.isFinite(Ye)||Ye<=0){y.showToast("Topic is required.",{tone:"error"});return}ds(!0);try{const ft=xe.map(In=>({content:String(In.content||"").trim(),topic_id:Number((In.topicValue||Va).toString()),category:String((In.categoryValue||Kr).toString()).trim(),city_override:(In.cityOverride||"").toString().trim()||null,country_override:(In.countryOverride||"").toString().trim()||null,country_code_override:(In.countryCodeOverride||"").toString().trim().toUpperCase()||null})).filter(In=>In.content.length>0&&Number.isFinite(In.topic_id)&&In.topic_id>0&&In.category.length>0);if(ft.find(In=>In.content.length>ni.promptContentMaxChars)){y.showToast(`A prompt is too long (max ${ni.promptContentMaxChars} characters).`,{tone:"error"});return}if(ft.length===0){y.showToast("Add at least one prompt.",{tone:"error"});return}if(ft.length>ni.promptBulkMax){y.showToast(`You can add up to ${ni.promptBulkMax} prompts at a time.`,{tone:"error"});return}const ln=await uQ(Oe,He,ft),on=Array.from(new Set(ln.map(In=>Number(In?.topic_id)).filter(In=>Number.isFinite(In)&&In>0)));So(In=>{const xi={...In};return on.forEach(ai=>{xi[String(ai)]=!0}),xi}),$a({topicIds:on,resetFlatPage:!0}),Oo(!1),mo("organic search"),y.showToast(`Added ${ln.length} ${ln.length===1?"prompt":"prompts"}`,{tone:"success"})}catch(ft){I.handleApiError(ft)||y.showToast(ft?.message||"Failed to create prompt",{tone:"error"})}finally{ds(!1)}}async function ut(){const xe=Number(e),Oe=Number(n);if(!xe||!Oe||Ti)return;const He=Number(lc);if(!Number.isFinite(He)||He<=0){y.showToast("Topic is required.",{tone:"error"});return}const Ye=Up.trim();if(!Ye){y.showToast("Prompt is required.",{tone:"error"});return}if(Ye.length>ni.promptContentMaxChars){y.showToast(`Prompt is too long (max ${ni.promptContentMaxChars} characters).`,{tone:"error"});return}ds(!0);
16760try{const ft=await dQ(xe,Oe,{topic_id:He,content:Ye,category:Ya,city_override:Y?null:(Lu||"").trim()||null,country_override:Y?null:Xa?.name||null,country_code_override:Y?null:Xa?.code||null});So(Ot=>({...Ot,[String(ft.topic_id)]:!0})),$a({topicIds:[Number(ft.topic_id)],resetFlatPage:!0}),ps(!1),na(""),Yo("organic search"),ed(""),$l(null),td(""),y.showToast("Prompt created",{tone:"success"})}catch(ft){I.handleApiError(ft)||y.showToast(ft?.message||"Failed to create prompt",{tone:"error"})}finally{ds(!1)}}async function Lt(){const xe=Number(e),Oe=Number(n);if(!xe||!Oe||Ti)return;const He=Number(Or);if(!Number.isFinite(He)||He<=0){y.showToast("Topic is required.",{tone:"error"});return}const Ye=kl.trim();if(!Ye){y.showToast("Prompt is required.",{tone:"error"});return}if(Ye.length>ni.promptContentMaxChars){y.showToast(`Prompt is too long (max ${ni.promptContentMaxChars} characters).`,{tone:"error"});return}ds(!0);try{const ft=await dQ(xe,Oe,{topic_id:He,content:Ye,category:Hd,city_override:Y?null:(Sa||"").trim()||null,country_override:Y?null:to?.name||null,country_code_override:Y?null:to?.code||null});So(Ot=>({...Ot,[String(ft.topic_id)]:!0})),$a({topicIds:[Number(ft.topic_id)],resetFlatPage:!0}),gi(!1),ea(""),_a("organic search"),Ca(""),zs(null),ta(""),y.showToast("Prompt created",{tone:"success"})}catch(ft){I.handleApiError(ft)||y.showToast(ft?.message||"Failed to create prompt",{tone:"error"})}finally{ds(!1)}}const gt=l.useMemo(()=>{const xe=new Set(["organic search","brand sentiment","competitor comparison"]);return Oe=>{const He=String(Oe?.topic_id||"").trim();He&&na(He);const Ye=String(Oe?.category||"").trim().toLowerCase();if(Yo(xe.has(Ye)?Ye:"organic search"),ed(String(Oe?.content||"")),Y)$l(null),td("");else{const ft=String(Oe?.country_code_override||"").trim(),Ot=String(Oe?.country_override||"").trim();$l(Ot||ft?{name:Ot,code:ft}:null),td(String(Oe?.city_override||"").trim())}Oo(!1),ps(!0)}},[Y]);async function Ln(xe){const Oe=Number(e),He=Number(n);if(!(!Oe||!He)&&!Ki){Ia(!0),Aa(null);try{await fyt(Oe,He,xe);const Ye=Bu(xe);$a({topicIds:Ye?[Ye]:void 0,resetFlatPage:!1}),Il(null),y.showToast("Prompt deleted",{tone:"success"})}catch(Ye){const ft=Ye?.message||"Failed to delete prompt";Aa(ft),y.showToast(ft,{tone:"error"})}finally{Ia(!1)}}}async function yi(xe,Oe){const He=Number(e),Ye=Number(n);if(!(!He||!Ye)&&!Ki){Ia(!0),Aa(null);try{const ft=Oe?await myt(He,Ye,xe):await hyt(He,Ye,xe),Ot=Bu(xe)||Number(ft?.topic_id)||null;$a({topicIds:Ot?[Ot]:void 0,resetFlatPage:!1}),y.showToast(Oe?"Prompt archived":"Prompt unarchived",{tone:"success"})}catch(ft){if(!I.handleApiError(ft)){const Ot=ft?.message||"Failed to update prompt";Aa(Ot),y.showToast(Ot,{tone:"error"})}}finally{Ia(!1)}}}async function Jt(xe){const Oe=Number(e),He=Number(n);if(!Oe||!He||!Number.isFinite(xe)||xe<=0)return;const Ye=String(xe);if(!pn[Ye]){$n(ft=>({...ft,[Ye]:!0})),qt(null);try{const ft=await ue(`/api/v1/organizations/${Oe}/projects/${He}/suggested_prompts/${xe}/promote`,{method:"POST"}),Ot=await ft.json().catch(()=>({}));if(!ft.ok)throw new w8(Ot?.error||Ot?.errors?.[0]||"Failed to create prompt",Ot?.errors&&typeof Ot.errors=="object"?Ot.errors:void 0);kt(ln=>ln.map(on=>({...on,suggested_prompts:(on.suggested_prompts||[]).filter(In=>Number(In.id)!==Number(xe))}))),un(ln=>Math.max(0,ln-1)),y.showToast("Suggested prompt promoted",{tone:"success"})}catch(ft){I.handleApiError(ft)||y.showToast(ft?.message||"Failed to promote suggested prompt",{tone:"error"})}finally{$n(ft=>({...ft,[Ye]:!1}))}}}async function Qn(xe){const Oe=Number(e),He=Number(n);if(!Oe||!He||!Number.isFinite(xe)||xe<=0)return;const Ye=String(xe);if(!Ii[Ye]){_i(ft=>({...ft,[Ye]:!0})),qt(null);try{const ft=await ue(`/api/v1/organizations/${Oe}/projects/${He}/suggested_prompts/${xe}`,{method:"DELETE"}),Ot=await ft.json().catch(()=>({}));if(!ft.ok)throw new Error(Ot?.error||Ot?.errors?.[0]||"Failed to delete suggested prompt");kt(ln=>ln.map(on=>({...on,suggested_prompts:(on.suggested_prompts||[]).filter(In=>Number(In.id)!==Number(xe))}))),un(ln=>Math.max(0,ln-1)),y.showToast("Suggested prompt deleted",{tone:"success"})}catch(ft){const Ot=ft?.message||"Failed to delete suggested prompt";qt(Ot),y.showToast(Ot,{tone:"error"})}finally{_i(ft=>({...ft,[Ye]:!1}))}}}async function Ja(xe){const Oe=Number(e),He=Number(n);if(!(!Oe||!He)&&!Gr){Go(!0),qt(null);try{const Ye=xe.scope==="topic"?{topic_id:xe.topicId}:{},ft=await ue(`/api/v1/organizations/${Oe}/projects/${He}/suggested_prompts/regenerate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Ye)}),Ot=await ft.json().catch(()=>({}));if(!ft.ok)throw new w8(Ot?.error||Ot?.errors?.[0]||"Failed to regenerate suggested prompts",Ot?.errors&&typeof Ot.errors=="object"?Ot.errors:void 0);const ln=zQ(Ot);kt(ln);const on=ln.reduce((ai,Yi)=>ai+(Array.isArray(Yi.suggested_prompts)?Yi.suggested_prompts.length:0),0);un(on),ee({page:1,per_page:on,total:on,total_pages:1}),zt([]),Ae({}),typeof Ot?.credits_charged=="number"&&Ot.credits_charged>0&&Fo();const In=Number(Ot?.generated_count),xi=xe.scope==="topic"?"topic suggestions":"suggested prompts";y.showToast(Number.isFinite(In)&&In>0?`Regenerated ${In} ${In===1?"suggestion":"suggestions"}.`:`Regenerated ${xi}.`,{tone:"success"}),Co(null)}
16760catch(Ye){if(!I.handleApiError(Ye)){const ft=Ye?.message||"Failed to regenerate suggested prompts";qt(ft),y.showToast(ft,{tone:"error"})}}finally{Go(!1)}}}async function ms(xe){if(!(!c||!u)&&!Ki){Ia(!0),Aa(null);try{if(!g.deleteTopic)throw new Error("Topics provider not ready");await g.deleteTopic(xe),$a({topicIds:[xe],resetFlatPage:!1}),So(Oe=>{const He={...Oe};return delete He[String(xe)],He}),Kd(null),y.showToast("Topic deleted",{tone:"success"})}catch(Oe){const He=Oe?.message||"Failed to delete topic";Aa(He),y.showToast(He,{tone:"error"})}finally{Ia(!1)}}}return t.jsxs(m0t,{children:[(()=>{const xe=typeof document<"u"?document.getElementById("project-prompts-filters-slot"):null,Oe=t.jsxs(due,{children:[t.jsxs(uue,{children:[t.jsx(rh,{value:Je,onChange:He=>{Ee(He),le(1);const Ye=new URLSearchParams(m);L(Ye,"start",He.start),L(Ye,"end",He.end),Ye.delete("page"),h(Ye,{replace:!0})},historyMonthsLimit:B,historyLimitMessage:F}),t.jsx(rC,{options:r,value:Xe,onChange:He=>{yt(He),le(1);const Ye=new URLSearchParams(m);L(Ye,"models",He.length>0?He.join(","):null),Ye.delete("page"),h(Ye,{replace:!0})},disabled:o.length<=0,onUpgradeClick:()=>R(!0),isOwner:a,hideUnavailableOptions:!1}),t.jsx(u1,{options:Sl,value:Ne,onChange:He=>{Le(He),le(1);const Ye=new URLSearchParams(m);L(Ye,"topic_ids",He.length>0?He.join(","):null),Ye.delete("page"),h(Ye,{replace:!0})},disabled:g.loading}),t.jsx(SPe,{options:s,value:ze,onChange:He=>{lt(He),le(1);const Ye=new URLSearchParams(m);L(Ye,"competitor_ids",He.length>0?He.join(","):null),Ye.delete("page"),h(Ye,{replace:!0})}}),t.jsx(vf,{label:"Group by topic",active:vt,onClick:()=>{const He=!vt;Wt(He),le(1);const Ye=new URLSearchParams(m);L(Ye,"group",He?null:"flat"),Ye.delete("page"),h(Ye,{replace:!0})}})]}),t.jsxs(pue,{children:[t.jsx(Ed,{value:Qt,onChange:He=>{Yt(He),le(1);const Ye=new URLSearchParams(m);L(Ye,"q",He.trim()?He:null),Ye.delete("page"),h(Ye,{replace:!0})},placeholder:"Search topics & promptsâ¦",containerStyle:{minWidth:0,maxWidth:320}}),S?t.jsx("div",{className:"prompt-actions",children:Se?t.jsx(he,{type:"button",size:"sm",variant:"primary",leftIcon:t.jsx(Sn,{size:14}),disabled:pt||Gr||bn.length===0,title:bn.length===0?"Create topics before regenerating suggestions":"Replace all current suggestions",onClick:()=>Co({scope:"project"}),children:"Regenerate"}):t.jsxs(t.Fragment,{children:[t.jsx(he,{type:"button",size:"sm",variant:"outline",leftIcon:t.jsx(gr,{size:16}),onClick:()=>{Vr(null),sc(""),oc(!0)},children:"Topic"}),t.jsx(TQ,{variant:"primary",size:"sm",disabled:Ns.length===0,title:Ns.length===0?"Create a topic first":"Add prompt",showGenerate:!0,onChoose:He=>Cl(He)})]})}):null]})]});return xe?jr.createPortal(Oe,xe):Oe})(),t.jsx(Xce,{children:t.jsxs(f0t,{$compact:Se,children:[t.jsx(g0t,{children:t.jsxs(jd,{children:[t.jsx(hp,{style:{width:"22rem"},children:t.jsxs(p0t,{role:"tablist","aria-label":"Prompt scope",children:[t.jsx(X7,{type:"button",$active:je==="active",onClick:()=>{Me("active"),le(1);const xe=new URLSearchParams(m);xe.delete("scope"),xe.delete("page"),h(xe,{replace:!0})},role:"tab","aria-selected":je==="active",children:"Active"}),t.jsx(X7,{type:"button",$active:je==="archived",onClick:()=>{Me("archived"),le(1);const xe=new URLSearchParams(m);L(xe,"scope","archived"),xe.delete("page"),h(xe,{replace:!0})},role:"tab","aria-selected":je==="archived",children:"Archived"}),t.jsx(X7,{type:"button",$active:je==="suggested",onClick:()=>{Me("suggested"),le(1);const xe=new URLSearchParams(m);L(xe,"scope","suggested"),xe.delete("page"),h(xe,{replace:!0})},role:"tab","aria-selected":je==="suggested",children:t.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[t.jsx("span",{children:"Suggested"}),Kt>0&&t.jsx("span",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",minWidth:18,height:18,padding:"0 5px",borderRadius:9999,fontSize:"0.6875rem",fontWeight:800,lineHeight:1,background:Ft,color:"#fff"},children:Kt}),t.jsx(at,{content:"Suggestions refresh monthly to keep up to 25 prompts.",children:t.jsx("span",{style:{display:"inline-flex",alignItems:"center"},"aria-label":"Suggested prompts info",children:t.jsx(wn,{size:12})})})]})})]})}),t.jsx(hp,{style:Se?ge:{width:"8rem"},children:!Se&&t.jsxs(Mg,{children:[t.jsxs(Rg,{type:"button",$active:Zt==="visibility",onClick:()=>oe("visibility"),"aria-label":"Sort by visibility",children:[t.jsx("span",{children:"Visibility"}),se("visibility")]}),t.jsx(at,{content:"Percent of runs where your brand is present (across the selected date range/models).",children:t.jsx(Og,{tabIndex:0,"aria-label":"Visibility info",children:t.jsx(wn,{size:12})})})]})}),t.jsx(hp,{style:Se?ge:{width:"7rem"},children:!Se&&t.jsxs(Mg,{children:[t.jsxs(Rg,{type:"button",$active:Zt==="position",onClick:()=>oe("position"),"aria-label":"Sort by position",children:[t.jsx("span",{children:"Position"}),se("position")]}),t.jsx(at,{content:"Average position when your brand is present. Lower is better.",children:t.jsx(Og,{tabIndex:0,"aria-label":"Average position info",children:t.jsx(wn,{size:12})})})]})}),t.jsx(hp,{style:Se||!De?ge:{width:"8.25rem"},children:!Se&&De&&t.jsxs(Mg,{children:[t.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[t.jsx(_b,{label:"Sentiment",options:_r,value:Cr,active:ti,triggerMode:"icon",disabled:pt||Se,onCh
16760ange:xe=>{const Oe=Array.isArray(xe)?xe.map(String):[],He=Oe.length===Gd.length?[]:Oe;ht(He),le(1);const Ye=new URLSearchParams(m);L(Ye,"sentiments",He.length>0?He.join(","):null),Ye.delete("page"),h(Ye,{replace:!0})}}),t.jsxs(Rg,{type:"button",$active:Zt==="sentiment",onClick:()=>oe("sentiment"),"aria-label":"Sort by sentiment",children:[t.jsx("span",{children:"Sentiment"}),se("sentiment")]})]}),t.jsx(at,{content:"Average sentiment score of the model responses for this prompt across the selected date range and models.",children:t.jsx(Og,{tabIndex:0,"aria-label":"Sentiment info",children:t.jsx(wn,{size:12})})})]})}),t.jsx(hp,{style:Se?ge:{width:"9.5rem"},children:!Se&&t.jsxs(Mg,{children:[t.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[t.jsx(_b,{label:"Category",options:qd,value:Qa,active:ka,triggerMode:"icon",disabled:pt||Se,onChange:xe=>{const Oe=Array.isArray(xe)?xe.map(String):[],He=Oe.length===id.length?[]:Oe;We(He),le(1);const Ye=new URLSearchParams(m);L(Ye,"categories",He.length>0?He.join(","):null),Ye.delete("page"),h(Ye,{replace:!0})}}),t.jsxs(Rg,{type:"button",$active:Zt==="category",onClick:()=>oe("category"),"aria-label":"Sort by category",children:[t.jsx("span",{children:"Category"}),se("category")]})]}),t.jsx(at,{content:"Prompt category (affects scoring and actions).",children:t.jsx(Og,{tabIndex:0,"aria-label":"Category info",children:t.jsx(wn,{size:12})})})]})}),t.jsx(hp,{style:{width:"6.25rem"},children:t.jsxs(Mg,{children:[t.jsxs(Rg,{type:"button",$active:Zt==="volume",onClick:()=>oe("volume"),"aria-label":"Sort by volume",children:[t.jsx("span",{children:"Volume"}),se("volume")]}),t.jsx(at,{content:"Estimated search volume in LLMs for this promptâs keywords for the current month. This does not change when you adjust the date range. Refreshed monthly.",children:t.jsx(Og,{tabIndex:0,"aria-label":"Volume info",children:t.jsx(wn,{size:12})})})]})}),t.jsx(hp,{style:Se?ge:{width:"10.5rem"},children:!Se&&t.jsxs(Mg,{children:["Mentions",t.jsx(at,{content:"Counts succeeded prompt-runs where each direct competitor (or you) appears at least once in extracted entities, across the selected date range/models.",children:t.jsx(Og,{tabIndex:0,"aria-label":"Mentions info",children:t.jsx(wn,{size:12})})})]})}),t.jsx(hp,{style:Se?ge:{width:"8.5rem"},children:!Se&&t.jsxs(Mg,{children:[t.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[t.jsx(_b,{label:"Location",options:Ts,value:hh,active:Hp,triggerMode:"icon",disabled:pt||Se||Ts.length<=0,onChange:xe=>{const Oe=Array.isArray(xe)?xe.map(String):[],He=Oe.length===cc.length?[]:Oe;be(He),le(1);const Ye=new URLSearchParams(m);L(Ye,"locations",He.length>0?He.join(","):null),Ye.delete("page"),h(Ye,{replace:!0})}}),t.jsxs(Rg,{type:"button",$active:Zt==="location",onClick:()=>oe("location"),"aria-label":"Sort by location",children:[t.jsx("span",{children:"Location"}),se("location")]})]}),t.jsx(at,{content:"The geo used when the model was run (affects what the model sees).",children:t.jsx(Og,{tabIndex:0,"aria-label":"Location info",children:t.jsx(wn,{size:12})})})]})}),t.jsx(hp,{style:{width:"7.25rem"},children:t.jsxs(Rg,{type:"button",$active:Zt==="created_at",onClick:()=>oe("created_at"),"aria-label":"Sort by created date",children:[t.jsx("span",{children:"Created"}),se("created_at")]})}),t.jsx(hp,{style:{width:"9rem",textAlign:"right"},"aria-label":"Actions"})]})}),t.jsx("tbody",{children:pt?Js():qe?t.jsx(jd,{children:t.jsx(Yn,{$muted:!0,colSpan:10,children:qe})}):vt?rc.length===0?t.jsx(jd,{children:t.jsx(Yn,{$muted:!0,colSpan:10,children:je==="suggested"?null:je==="archived"?t.jsx(Zg,{subtitle:Qt.trim()?"No archived prompts match your search.":"No archived prompts yet. Archive prompts from the Active tab to see them here."}):dc?Qt.trim()?t.jsx(Zg,{subtitle:"No prompts or topics match your search."}):t.jsx(Zg,{subtitle:"No prompts match the current filters. Try adjusting your filters."}):t.jsxs("div",{style:{display:"grid",gap:12},children:[t.jsx(Zg,{subtitle:S?"No prompts yet. Add a topic or prompt to get started.":"No prompts yet. Ask an editor to add prompts."}),S?t.jsxs("div",{style:{display:"inline-flex",gap:"0.5rem",alignItems:"center",justifyContent:"center",flexWrap:"wrap"},children:[t.jsx(he,{type:"button",size:"sm",variant:"outline",leftIcon:t.jsx(gr,{size:16}),onClick:()=>oc(!0),children:"Topic"}),t.jsx(TQ,{variant:"primary",size:"sm",disabled:Ns.length===0,title:Ns.length===0?"Create a topic first":"Add prompt",showGenerate:!0,onChoose:xe=>Cl(xe)})]}):null]})})}):rc.map(xe=>{const Oe=je==="suggested",He=Oe?Ro[String(xe.id)]!==!1:!!Ro[String(xe.id)],Ye=aj(xe),ft=Oe?{...Ex(),prompts:xe.prompts||[],initialized:!0}:ne[String(xe.id)]||Ex(),Ot=ft.prompts||[],ln=!Oe&&ft.total_pages>0&&ft.page<ft.total_pages;return t.jsxs(l.Fragment,{children:[t.jsxs(IQ,{children:[t.jsx(Yn,{children:t.jsxs(x0t,{type:"button",onClick:()=>So(on=>({...on,[xe.id]:!He})),"aria-expanded":He,children:[He?t.jsx(qn,{size:18}):t.jsx(Gi,{size:18}),t.jsx("span",{className:"topic-name",children:Ko(xe.name)}
16760),t.jsxs(b0t,{children:[Ye," prompts"]})]})}),t.jsx(Yn,{style:Se?ge:{fontWeight:900},children:!Se&&t.jsxs(Tx,{children:[t.jsx("span",{children:typeof xe.visibility_score=="number"?`${xe.visibility_score.toFixed(1)}%`:"â"}),us(xe.visibility_trend_pp,1,!0)]})}),t.jsx(Yn,{style:Se?ge:{fontWeight:900},children:!Se&&t.jsxs(Tx,{children:[t.jsx("span",{children:typeof xe.avg_position=="number"?xe.avg_position.toFixed(1):"â"}),us(xe.avg_position_trend_delta,1,!1)]})}),t.jsx(Yn,{style:Se||!De?ge:void 0,children:!Se&&De&&typeof xe.sentiment_score=="number"&&Number.isFinite(xe.sentiment_score)?t.jsx(l_,{score:xe.sentiment_score}):null}),t.jsx(Yn,{style:Se?ge:void 0,$muted:!Se}),t.jsx(Yn,{style:void 0,children:t.jsx(S5,{value:xe.avg_monthly_searches})}),t.jsx(Yn,{style:Se?ge:void 0,$muted:!Se,children:Se?null:Ve(xe.direct_competitor_mentions)}),t.jsx(Yn,{style:Se?ge:void 0,$muted:!Se}),t.jsx(Yn,{style:Se?ge:void 0,$muted:!Se}),t.jsx(Yn,{$right:!0,children:t.jsx(Q7,{children:je==="suggested"?S?t.jsx(M0t,{type:"button","aria-label":`Regenerate suggestions for ${xe.name}`,title:"Regenerate this topic",disabled:Gr,onClick:()=>Co({scope:"topic",topicId:xe.id,topicName:xe.name,promptCount:Ye}),children:t.jsx(Sn,{size:16})}):t.jsx(Cc,{"aria-hidden":"true"}):t.jsxs(t.Fragment,{children:[t.jsx(Cc,{"aria-hidden":"true"}),je==="active"&&S?t.jsx(oj,{type:"button","aria-label":"Delete topic",title:"Delete topic",disabled:Ki,onClick:()=>{Aa(null),Kd({id:xe.id,name:xe.name})},children:t.jsx(Fi,{size:16})}):t.jsx(Cc,{"aria-hidden":"true"})]})})})]}),He?t.jsxs(t.Fragment,{children:[Ot.map(on=>t.jsxs(jd,{children:[t.jsx(Yn,{children:t.jsxs(rj,{children:[t.jsx("span",{style:{width:18}}),je==="suggested"||on?.is_suggested?t.jsx("span",{style:{fontWeight:700,color:O,overflowWrap:"anywhere"},children:Zc(on.content)}):t.jsx(AQ,{to:x(on.id),title:on.content,children:Zc(on.content)})]})}),t.jsx(Yn,{style:Se?ge:{fontWeight:850},children:!Se&&t.jsx(Tx,{children:on.is_running?t.jsx(nt,{width:34,height:12}):t.jsxs(t.Fragment,{children:[t.jsx("span",{children:typeof on.visibility_score=="number"?`${on.visibility_score.toFixed(1)}%`:"â"}),us(on.visibility_trend_pp,1,!0)]})})}),t.jsx(Yn,{style:Se?ge:{fontWeight:850},children:!Se&&t.jsx(Tx,{children:on.is_running?t.jsx(nt,{width:30,height:12}):t.jsxs(t.Fragment,{children:[t.jsx("span",{children:typeof on.avg_position=="number"?on.avg_position.toFixed(1):"â"}),us(on.avg_position_trend_delta,1,!1)]})})}),t.jsx(Yn,{style:Se||!De?ge:void 0,children:!Se&&De&&(on.is_running?t.jsx(nt,{width:54,height:14}):typeof on.sentiment_score=="number"&&Number.isFinite(on.sentiment_score)?t.jsx(l_,{score:on.sentiment_score}):null)}),t.jsx(Yn,{style:Se?ge:void 0,$muted:!Se,children:!Se&&t.jsx("span",{style:{fontWeight:850,color:z},children:(()=>{const In=String(on?.category||"").trim();return In?Ko(In):"â"})()})}),t.jsx(Yn,{style:void 0,children:t.jsx(S5,{value:on.avg_monthly_searches})}),t.jsx(Yn,{style:Se?ge:void 0,$muted:!Se,children:!Se&&(on.is_running?t.jsx(nt,{width:84,height:14}):Ve(on.direct_competitor_mentions))}),t.jsx(Yn,{style:Se?ge:void 0,$muted:!Se,children:!Se&&dt({city:on?.city_override,code:on?.country_code_override,name:on?.country_override})}),t.jsx(Yn,{$muted:!0,children:t.jsx(rr,{value:on.created_at?String(on.created_at):null,format:"date",timeZoneMode:"viewer",options:{month:"short",day:"numeric"}})}),t.jsx(Yn,{$right:!0,children:t.jsx(Q7,{children:je==="suggested"||on?.is_suggested?S?t.jsxs(t.Fragment,{children:[t.jsxs(he,{type:"button",size:"sm",variant:"primary","aria-label":"Track prompt",disabled:!!pn[String(on.id)]||!!Ii[String(on.id)],onClick:()=>Jt(on.id),style:{gap:4,fontSize:"0.75rem",padding:"0.3rem 0.65rem"},children:[t.jsx(gr,{size:14}),"Track"]}),t.jsx(oj,{type:"button","aria-label":"Delete suggestion",title:"Delete suggestion",disabled:!!Ii[String(on.id)]||!!pn[String(on.id)],onClick:()=>Qn(on.id),children:t.jsx(Fi,{size:16})})]}):t.jsxs(t.Fragment,{children:[t.jsx(Cc,{"aria-hidden":"true"}),t.jsx(Cc,{"aria-hidden":"true"})]}):S?t.jsxs(t.Fragment,{children:[t.jsx(G$,{type:"button","aria-label":"Duplicate prompt",title:"Duplicate prompt",disabled:Ki,onClick:()=>gt(on),children:t.jsx(so,{size:16})}),t.jsx(G$,{type:"button","aria-label":on.archived_at?"Unarchive prompt":"Archive prompt",title:on.archived_at?"Unarchive prompt":"Archive prompt",disabled:Ki,onClick:()=>yi(on.id,!on.archived_at),children:on.archived_at?t.jsx(p9,{size:16}):t.jsx(m9,{size:16})}),t.jsx(oj,{type:"button","aria-label":"Delete prompt",title:"Delete prompt",disabled:Ki,onClick:()=>{Aa(null),Il({id:on.id,content:on.content,topicName:xe.name})},children:t.jsx(Fi,{size:16})})]}):t.jsxs(t.Fragment,{children:[t.jsx(Cc,{"aria-hidden":"true"}),t.jsx(Cc,{"aria-hidden":"true"}),t.jsx(Cc,{"aria-hidden":"true"})]})})})]},String(on.id))),ft.loading&&Ot.length===0?t.jsx(jd,{children:t.jsx(Yn,{$muted:!0,colSpan:10,children:t.jsxs(rj,{children:[t.jsx("span",{style:{width:18}}),"Loading prompts..."]})})}):null,!ft.loading&&ft.error?t.jsx(jd,{children:t.jsx(Yn,{$muted:!0,colSpan:10,children:t.jsxs(rj,{children:[t.jsx("span",{style:{width:18}}),ft.error]})})}):null,!ft.loading&&!ft.error&&ft.initialized&&Ot.length===0?t.jsx(jd,{children:t.jsx(Yn,{$muted:!0,colSpan:10,children:t.jsxs(rj,{children:[t.jsx("span",{style:{width:18}}),dc?"No prompts match the current filters for this topic.":"No prompts in this topic yet."]})})}):null,ln?t.jsx(jd,{children:t.jsx(Yn,{colSpan:10,children:t.jsxs(rj,{children:[t.jsx("span",{style:{width:18}}),t.jsx(he,{type:"button",size:"sm",variant:"outline",disabled:ft.loading,onClick:()=>jl(xe.id),children:ft.loading?"Loading...":`Load more (${Math.max(0,Ye-Ot.length)} left)`})]})})}):null]}):null]},String(xe.id))}):_l.length===0?t.jsx(jd,{children:t.jsx(Yn,{$muted:!0,colSpan:10,children:t.jsx(Zg,{subtitle:je==="suggested"?"No suggested prompts yet.":je==="archived"?Qt.trim()?"No archived prompts match your search.":"No archived prompts yet.":dc?"No prompts match the current filters. Try adjusting your filters.":"No prompts yet."})})}):_l.map(xe=>t.jsxs(jd,{children:[t.jsxs(Yn,{children:[je==="suggested"||xe?.is_suggested?t.jsx("span",{style:{fontWeight:700,color:O,overflowWrap:"anywhere"},children:Zc(xe.content)}):t.jsx(AQ,{to:x(xe.id),title:xe.content,children:Zc(xe.content)}),t.jsx(v0t,{children:Ko(xe.topic_name)})]}),t.jsx(Yn,{style:Se?ge:{fontWeight:850},children:!Se&&t.jsx(Tx,{children:xe.is_running?t.jsx(nt,{width:34,he
16760ight:12}):t.jsxs(t.Fragment,{children:[t.jsx("span",{children:typeof xe.visibility_score=="number"?`${xe.visibility_score.toFixed(1)}%`:"â"}),us(xe.visibility_trend_pp,1,!0)]})})}),t.jsx(Yn,{style:Se?ge:{fontWeight:850},children:!Se&&t.jsx(Tx,{children:xe.is_running?t.jsx(nt,{width:30,height:12}):t.jsxs(t.Fragment,{children:[t.jsx("span",{children:typeof xe.avg_position=="number"?xe.avg_position.toFixed(1):"â"}),us(xe.avg_position_trend_delta,1,!1)]})})}),t.jsx(Yn,{style:Se||!De?ge:void 0,children:!Se&&De&&(xe.is_running?t.jsx(nt,{width:54,height:14}):typeof xe.sentiment_score=="number"&&Number.isFinite(xe.sentiment_score)?t.jsx(l_,{score:xe.sentiment_score}):null)}),t.jsx(Yn,{style:Se?ge:void 0,$muted:!Se,children:!Se&&t.jsx("span",{style:{fontWeight:850,color:z},children:(()=>{const Oe=String(xe?.category||"").trim();return Oe?Ko(Oe):"â"})()})}),t.jsx(Yn,{style:void 0,children:t.jsx(S5,{value:xe.avg_monthly_searches})}),t.jsx(Yn,{style:Se?ge:void 0,$muted:!Se,children:!Se&&(xe.is_running?t.jsx(nt,{width:84,height:14}):Ve(xe.direct_competitor_mentions))}),t.jsx(Yn,{style:Se?ge:void 0,$muted:!Se,children:!Se&&dt({city:xe?.city_override,code:xe?.country_code_override,name:xe?.country_override})}),t.jsx(Yn,{$muted:!0,children:t.jsx(rr,{value:xe.created_at?String(xe.created_at):null,format:"date",timeZoneMode:"viewer",options:{month:"short",day:"numeric"}})}),t.jsx(Yn,{$right:!0,children:t.jsx(Q7,{children:je==="suggested"||xe?.is_suggested?S?t.jsxs(t.Fragment,{children:[t.jsxs(he,{type:"button",size:"sm",variant:"primary","aria-label":"Track prompt",disabled:!!pn[String(xe.id)]||!!Ii[String(xe.id)],onClick:()=>Jt(xe.id),style:{gap:4,fontSize:"0.75rem",padding:"0.3rem 0.65rem"},children:[t.jsx(gr,{size:14}),"Track"]}),t.jsx(oj,{type:"button","aria-label":"Delete suggestion",title:"Delete suggestion",disabled:!!Ii[String(xe.id)]||!!pn[String(xe.id)],onClick:()=>Qn(xe.id),children:t.jsx(Fi,{size:16})})]}):t.jsxs(t.Fragment,{children:[t.jsx(Cc,{"aria-hidden":"true"}),t.jsx(Cc,{"aria-hidden":"true"})]}):S?t.jsxs(t.Fragment,{children:[t.jsx(G$,{type:"button","aria-label":"Duplicate prompt",title:"Duplicate prompt",disabled:Ki,onClick:()=>gt(xe),children:t.jsx(so,{size:16})}),t.jsx(G$,{type:"button","aria-label":xe.archived_at?"Unarchive prompt":"Archive prompt",title:xe.archived_at?"Unarchive prompt":"Archive prompt",disabled:Ki,onClick:()=>yi(xe.id,!xe.archived_at),children:xe.archived_at?t.jsx(p9,{size:16}):t.jsx(m9,{size:16})}),t.jsx(oj,{type:"button","aria-label":"Delete prompt",title:"Delete prompt",disabled:Ki,onClick:()=>{Aa(null),Il({id:xe.id,content:xe.content,topicName:xe.topic_name})},children:t.jsx(Fi,{size:16})})]}):t.jsxs(t.Fragment,{children:[t.jsx(Cc,{"aria-hidden":"true"}),t.jsx(Cc,{"aria-hidden":"true"}),t.jsx(Cc,{"aria-hidden":"true"})]})})})]},String(xe.id)))})]})}),!vt&&je!=="suggested"?t.jsx(pi,{page:me.page||de,totalPages:me.total_pages||1,total:me.total||0,compact:!0,onPrev:()=>{const xe=Math.max(1,(me.page||de)-1);le(xe);const Oe=new URLSearchParams(m);Oe.set("page",String(xe)),h(Oe,{replace:!0})},onNext:()=>{const xe=(me.page||de)+1;le(xe);const Oe=new URLSearchParams(m);Oe.set("page",String(xe)),h(Oe,{replace:!0})}}):null,ae?jr.createPortal(t.jsxs(t.Fragment,{children:[t.jsx(C0t,{type:"button","aria-label":"Close mentioned brands",onClick:Ge}),t.jsxs(S0t,{ref:Ie,style:{left:ae.x,top:ae.y,visibility:ae.ready?"visible":"hidden"},children:[t.jsxs(k0t,{children:[t.jsx($0t,{children:"Mentioned brands"}),t.jsx(I0t,{type:"button","aria-label":"Close",onClick:Ge,children:t.jsx(Ei,{size:16})})]}),t.jsx(P0t,{children:t.jsx(A0t,{children:ae.items.map(xe=>{const Oe=st.get(xe.name.toLowerCase())??{name:xe.name,website:null,logo_url:null};return t.jsxs(N0t,{children:[t.jsxs(z0t,{children:[t.jsx(j0t,{children:t.jsx(xo,{record:Oe,size:18})}),t.jsx(T0t,{title:xe.name,children:xe.name})]}),t.jsx(E0t,{children:xe.count})]},xe.name)})})})]})]}),document.body):null,S?t.jsx(Hn,{isOpen:Fp,onClose:()=>{wa||oc(!1)},title:"New topic",description:"Create a new topic for this project.",size:"sm",closeOnOverlayClick:!wa,closeOnEscape:!wa,footer:t.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.5rem"},children:[t.jsx(he,{type:"button",size:"sm",variant:"outline",disabled:wa,onClick:()=>oc(!1),children:"Cancel"}),t.jsx(he,{type:"button",size:"sm",variant:"primary",disabled:wa||va.trim()==="",onClick:It,children:wa?"Creating...":"Create topic"})]}),children:t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"0.75rem"},children:[t.jsxs("div",{children:[t.jsx("div",{style:{fontSize:"0.75rem",fontWeight:850,color:O,marginBottom:"0.35rem"},children:"Name"}),t.jsx(Xt,{autoFocus:!0,value:va,onChange:xe=>sc(xe.target.value),maxLength:ni.topicNameMaxChars,placeholder:'e.g. "customer support tools"',onKeyDown:xe=>xe.key==="Enter"&&It()}),va.length>=ni.topicNameMaxChars?t.jsxs("div",{style:{marginTop:6,fontSize:"0.75rem",fontWeight:750,color:"var(--color-gray-500)"},children:["Topic name is limited to ",ni.topicNameMaxChars," characters."]}):null]}),ac?t.jsx("div",{style:{color:"var(--color-red-600)",fontSize:"0.8125rem",fontWeight:750},children:ac}):null]})}):null,S?t.jsx(u_,{isOpen:ja,onClose:()=>{Ti||gi(!1)},title:"Create prompt",description:"Create a new prompt for this project.",size:"lg",topicOptions:Ns,topicValue:Or,onTopicChange:ea,categoryValue:Hd,categoryOptions:nd,onCategoryChange:xe=>_a(xe),showLocation:!0,countryValue:to,onCountryChange:zs,cityValue:Sa,onCityChange:ta,lockLocationOverride:Y,locationLockMsg:H,promptValue:kl,onPromptChange:Ca,onAdd:Lt,isSubmitting:Ti}):null,S?t.jsx(u_,{isOpen:Du,onClose:()=>{Ti||ps(!1)},title:"Duplicate prompt",description:"Create a new prompt based on an existing one.",size:"lg",topicOptions:Ns,topicValue:lc,onTopicChange:na,c
16760ategoryValue:Ya,categoryOptions:nd,onCategoryChange:xe=>Yo(xe),showLocation:!0,countryValue:Xa,onCountryChange:$l,cityValue:Lu,onCityChange:td,lockLocationOverride:Y,locationLockMsg:H,promptValue:Up,onPromptChange:ed,onAdd:ut,isSubmitting:Ti}):null,S?t.jsx(u_,{mode:"bulk",isOpen:Jc,onClose:()=>{Ti||Oo(!1)},title:"Create prompts",description:"Create multiple prompts for this project.",size:"lg",topicOptions:Ns,topicValue:Va,onTopicChange:Ka,categoryValue:Kr,categoryOptions:nd,onCategoryChange:xe=>mo(xe),lockLocationOverride:Y,locationLockMsg:H,onAddMany:xe=>Dt(xe),isSubmitting:Ti}):null,S?t.jsx(Byt,{isOpen:qa,onClose:()=>{Ti||Kn(!1)},workspaceId:c,projectId:u,topicOptions:Sl,categoryOptions:nd,onAddMany:async xe=>{if(Ti)return;const Oe=xe.map(He=>({content:String(He.content||"").trim(),topic_id:Number(He.topicValue),category:String(He.categoryValue||"").trim(),city_override:null,country_override:null,country_code_override:null})).filter(He=>He.content.length>0&&Number.isFinite(He.topic_id)&&He.topic_id>0&&He.category.length>0);if(Oe.length===0){y.showToast("No valid prompts to add.",{tone:"error"});return}ds(!0);try{const He=await uQ(c,u,Oe),Ye=Array.from(new Set(He.map(ft=>Number(ft?.topic_id)).filter(ft=>Number.isFinite(ft)&&ft>0)));So(ft=>{const Ot={...ft};return Ye.forEach(ln=>{Ot[String(ln)]=!0}),Ot}),$a({topicIds:Ye,resetFlatPage:!0}),Kn(!1),y.showToast(`Added ${He.length} ${He.length===1?"prompt":"prompts"}`,{tone:"success"})}catch(He){I.handleApiError(He)||y.showToast(He?.message||"Failed to add prompts",{tone:"error"})}finally{ds(!1)}},isSubmitting:Ti}):null,S?t.jsx(u0t,{isOpen:Ga,onClose:()=>{Ti||an(!1)},topicOptions:Sl,onAddMany:async xe=>{if(Ti)return;const Oe=xe.map(He=>({content:String(He.content||"").trim(),topic_id:Number(He.topicValue),category:String(He.categoryValue||"").trim(),city_override:(He.cityOverride||"").trim()||null,country_override:(He.countryOverride||"").trim()||null,country_code_override:(He.countryCodeOverride||"").trim().toUpperCase()||null})).filter(He=>He.content.length>0&&Number.isFinite(He.topic_id)&&He.topic_id>0&&He.category.length>0);if(Oe.length===0){y.showToast("No valid prompts to upload.",{tone:"error"});return}ds(!0);try{const He=await pyt(c,u,Oe),Ye=Array.from(new Set(He.map(ft=>Number(ft?.topic_id)).filter(ft=>Number.isFinite(ft)&&ft>0)));So(ft=>{const Ot={...ft};return Ye.forEach(ln=>{Ot[String(ln)]=!0}),Ot}),$a({topicIds:Ye,resetFlatPage:!0}),an(!1),y.showToast(`Added ${He.length} ${He.length===1?"prompt":"prompts"} from CSV`,{tone:"success"})}catch(He){I.handleApiError(He)||y.showToast(He?.message||"Failed to upload prompts",{tone:"error"})}finally{ds(!1)}},isSubmitting:Ti}):null,S?t.jsx(Hn,{isOpen:!!Za,onClose:()=>{Ki||Il(null)},title:"Delete prompt?",description:"This will destroy this prompt and its history.",size:"sm",closeOnOverlayClick:!Ki,closeOnEscape:!Ki,footer:t.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.5rem"},children:[t.jsx(he,{type:"button",size:"sm",variant:"outline",disabled:Ki,onClick:()=>Il(null),children:"Cancel"}),t.jsx(he,{type:"button",size:"sm",variant:"danger",disabled:Ki||!Za,onClick:()=>Za&&Ln(Za.id),children:Ki?"Deleting...":"Delete prompt"})]}),children:Za?t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"0.75rem"},children:[t.jsxs("div",{style:{fontWeight:850,color:O},children:[Za.topicName?`${Za.topicName}: `:"",Za.content]}),Pa?t.jsx("div",{style:{color:"var(--color-red-600)",fontSize:"0.8125rem",fontWeight:750},children:Pa}):null]}):null}):null,S?t.jsx(Hn,{isOpen:!!di,onClose:()=>{Gr||Co(null)},title:di?.scope==="topic"?"Regenerate topic suggestions?":"Regenerate all suggestions?",description:"This will replace the current untracked suggestions. Tracked prompts are not affected.",size:"sm",closeOnOverlayClick:!Gr,closeOnEscape:!Gr,footer:t.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.5rem"},children:[t.jsx(he,{type:"button",size:"sm",variant:"outline",disabled:Gr,onClick:()=>Co(null),children:"Cancel"}),t.jsx(he,{type:"button",size:"sm",variant:"primary",disabled:Gr||!di,leftIcon:t.jsx(Sn,{size:13}),onClick:()=>di&&Ja(di),children:Gr?"Regenerating...":"Regenerate"})]}),children:di?t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[t.jsx("div",{style:{fontSize:"0.875rem",fontWeight:850,color:O},children:di.scope==="topic"?Ko(di.topicName):`${Kt} current ${Kt===1?"suggestion":"suggestions"}`}),t.jsx("div",{style:{color:z,fontSize:"0.8125rem",lineHeight:1.45},children:di.scope==="topic"?`This will replace ${di.promptCount} current untracked ${di.promptCount===1?"suggestion":"suggestions"} for this topic.`:"This will replace all current untracked suggestions with a fresh suggested set across the project."}),t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"0.5rem 0.65rem",background:"rgba(79, 70, 229, 0.06)",borderRadius:8,border:"1px solid rgba(79, 70, 229, 0.15)"},children:[t.jsx(Sn,{size:14,style:{color:"rgb(79, 70, 229)",flexShrink:0}}),t.jsxs("span",{style:{fontSize:"0.8rem",fontWeight:700,color:O},children:["Cost: ",t.jsx("strong",{children:"2 credits"})]})]}),Gr?t.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"0.25rem 0 0.125rem"},"aria-label":"Regenerating suggestions",children:t.jsxs("svg",{width:22,height:22,viewBox:"0 0 24 24",fill:"none",style:{animation:"suggested-regen-spin 0.8s linear infinite",color:Ft},children:[t.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3",strokeDasharray:"31.4 31.4",strokeLinecap:"round"}),t.jsx("style",{children:"@keyframes suggested-regen-spin { to { transform: rotate(360deg); } }"})]})}):null]}):null}):null,S?t.jsx(Hn,{isOpen:!!Pl,onClose:()=>{Ki||Kd(null)},title:"Delete topic?",description:"This will destroy any prompts (active or archived) associated with this topic and their history.",size:"sm",closeOnOverlayClick:!Ki,closeOnEscape:!Ki,footer:t.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.5rem"},children:[t.jsx(he,{type:"button",size:"sm",variant:"outline",disabled:Ki,onClick:()=>Kd(null),children:"Cancel"}),t.jsx(he,{type:"button",size:"sm",variant:"danger",disabled:Ki||!Pl,onClick:()=>Pl&&ms(Pl.id),children:Ki?"Deleting...":"Delete topic"})]}),children:Pl?t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"0.75rem"},children:[t.jsx("div",{style:{fontWeight:850,color:O},children:Pl.name}),Pa?t.jsx("div",{style:{color:"var(--color-red-600)",fontSize:"0.8125rem",fontWeight:750},children:Pa}):null]}):null}):null,t.jsx(l1,{isOpen:I.isOpen,onClose:I.closeOverlay,title:I.overlayState?.title,message:I.overlayState?.message,limitName:I.overlayState?.limitName,limit:I.overlayState?.limit,used:I.overlayState?.used,isOwner:A==="owner",partnerManaged:E,workspaceId:c}),t.jsx(ec,{isOpen:M,orgId:c,onClose:()=>R(!1)})]})}const D0t=p.div.withConfig({displayName:"FanoutTabstyles__TabRoot",componentId:"sc-ssexjr-0"})` 16761 min-width: 0; 16762 min-height: 0; 16763 display: flex; 16764 flex-direction: column; 16765 gap: 0.75rem; 16766`;p.div.withConfig({displayName:"FanoutTabstyles__TableScroll",componentId:"sc-ssexjr-1"})` 16767 flex: 1; 16768 min-height: 0; 16769 width: 100%; 16770 overflow: auto; 16771 -webkit-overflow-scrolling: touch; 16772 border: 1px solid ${V}; 16773 border-radius: 0.875rem; 16774 background: ${Z}; 16775`;const L0t=p.table.withConfig({displayName:"FanoutTabstyles__Table",componentId:"sc-ssexjr-2"})` 16776 width: 100%; 16777 border-collapse: collapse; 16778 table-layout: fixed; 16779 background: ${Z}; 16780 16781 @media (max-width: 1023px) { 16782 min-width: 980px; 16783 } 16784`,B0t=p.thead.withConfig({displayName:"FanoutTabstyles__THead",componentId:"sc-ssexjr-3"})` 16785 background: ${$e}; 16786 border-bottom: 1px solid ${V}; 16787 position: sticky; 16788 top: 0; 16789 z-index: 2; 16790`,lj=p.th.withConfig({displayName:"FanoutTabstyles__TH",componentId:"sc-ssexjr-4"})` 16791 text-align: left; 16792 padding: 0.55rem 0.7rem; 16793 font-size: 0.625rem; 16794 font-weight: 950; 16795 letter-spacing: 0.06em; 16796 text-transform: uppercase; 16797 color: ${z}; 16798 white-space: nowrap; 16799`,V$=p.div.withConfig({displayName:"FanoutTabstyles__THLabel",componentId:"sc-ssexjr-5"})` 16800 display: inline-flex; 16801 align-items: center; 16802 gap: 0.35rem; 16803`,K$=p.span.withConfig({displayName:"FanoutTabstyles__THInfoTrigger",componentId:"sc-ssexjr-6"})` 16804 display: inline-flex; 16805 align-items: center; 16806 justify-content: center; 16807 color: ${z}; 16808 line-height: 0; 16809 cursor: help; 16810`,Sm=p.tr.withConfig({displayName:"FanoutTabstyles__TR",componentId:"sc-ssexjr-7"})` 16811 border-bottom: 1px solid ${$e}; 16812 16813 &:last-child { 16814 border-bottom: 0; 16815 } 16816`,EQ=p(Sm).withConfig({displayName:"FanoutTabstyles__TRTopic",componentId:"sc-ssexjr-8"})` 16817 background: ${$e}; 16818 16819 & > td { 16820 background: ${$e}; 16821 } 16822`,F0t=p(Sm).withConfig({displayName:"FanoutTabstyles__TRFanoutQuery",componentId:"sc-ssexjr-9"})` 16823 /* Minimal cue: a faint leading gradient in the first column only */ 16824 & > td:first-child { 16825 @supports (background: color-mix(in srgb, white 50%, black)) { 16826 background-image: linear-gradient( 16827 to right, 16828 color-mix(in srgb, ${V} 45%, transparent), 16829 transparent 42% 16830 ); 16831 } 16832 }
16833`,fo=p.td.withConfig({displayName:"FanoutTabstyles__TD",componentId:"sc-ssexjr-10"})` 16834 padding: 0.6rem 0.7rem; 16835 font-size: 0.775rem; 16836 font-weight: ${e=>e.$muted?650:750}; 16837 color: ${e=>e.$muted?z:O}; 16838 vertical-align: middle; 16839 overflow: hidden; 16840 min-width: 0; 16841`,Z7=p.button.withConfig({displayName:"FanoutTabstyles__RowBtn",componentId:"sc-ssexjr-11"})` 16842 appearance: none; 16843 border: 0; 16844 background: transparent; 16845 padding: 0; 16846 margin: 0; 16847 width: 100%; 16848 display: inline-flex; 16849 align-items: center; 16850 gap: 0.5rem; 16851 min-width: 0; 16852 cursor: pointer; 16853 color: ${O}; 16854 font-weight: 950; 16855 font-size: 0.8rem; 16856 16857 & > svg { 16858 flex: 0 0 auto; 16859 } 16860`,cj=p.div.withConfig({displayName:"FanoutTabstyles__Indent",componentId:"sc-ssexjr-12"})` 16861 display: inline-flex; 16862 align-items: flex-start; 16863 gap: 0.5rem; 16864 min-width: 0; 16865 padding-left: ${e=>`${Math.max(0,Number(e.$level||0))*1.25}rem`}; 16866`,J7=p.span.withConfig({displayName:"FanoutTabstyles__MutedPill",componentId:"sc-ssexjr-13"})` 16867 font-size: 0.65rem; 16868 font-weight: 900; 16869 color: ${z}; 16870 background: ${Z}; 16871 border: 1px solid ${V}; 16872 padding: 0.1rem 0.45rem; 16873 border-radius: 9999px; 16874 white-space: nowrap; 16875 margin-left: auto; 16876`,W0t=p(Tr).withConfig({displayName:"FanoutTab__Spinner",componentId:"sc-y5snxn-0"})` 16877 animation: spin 0.8s linear infinite; 16878 @keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } } 16879`,U0t=p.div.withConfig({displayName:"FanoutTab__BulkBar",componentId:"sc-y5snxn-1"})` 16880 display: flex; 16881 align-items: center; 16882 gap: 0.75rem; 16883 padding: 0.6rem 0.9rem; 16884 background: ${cn}; 16885 border: 1px solid ${Ft}; 16886 border-radius: 0.75rem; 16887 color: ${O}; 16888 font-size: 0.8rem; 16889 font-weight: 700; 16890 flex-wrap: wrap; 16891`,H0t=p.span.withConfig({displayName:"FanoutTab__BulkBarCount",componentId:"sc-y5snxn-2"})` 16892 font-weight: 900; 16893 font-size: 0.85rem; 16894`,MQ=p.span.withConfig({displayName:"FanoutTab__BulkBarSep",componentId:"sc-y5snxn-3"})` 16895 opacity: 0.3; 16896`,q0t=p.button.withConfig({displayName:"FanoutTab__BulkClearBtn",componentId:"sc-y5snxn-4"})` 16897 appearance: none; 16898 border: 0; 16899 background: transparent; 16900 padding: 0; 16901 margin: 0; 16902 cursor: pointer; 16903 color: ${z}; 16904 display: inline-flex; 16905 align-items: center; 16906 margin-left: auto; 16907 16908 &:hover { color: ${O}; } 16909`,G0t=p.div.withConfig({displayName:"FanoutTab__ConfirmOverlay",componentId:"sc-y5snxn-5"})` 16910 position: fixed; 16911 inset: 0; 16912 background: rgba(0, 0, 0, 0.45); 16913 display: flex; 16914 align-items: center; 16915 justify-content: center; 16916 z-index: 1000; 16917 padding: 1rem; 16918`,V0t=p.div.withConfig({displayName:"FanoutTab__ConfirmCard",componentId:"sc-y5snxn-6"})` 16919 background: ${Z}; 16920 border: 1px solid ${Rt}; 16921 border-radius: 1rem; 16922 padding: 1.5rem 1.75rem; 16923 max-width: 420px; 16924 width: 100%; 16925 display: flex; 16926 flex-direction: column; 16927 gap: 1rem; 16928 box-shadow: ${Y_}; 16929`,K0t=p.div.withConfig({displayName:"FanoutTab__ConfirmTitle",componentId:"sc-y5snxn-7"})` 16930 font-size: 1rem; 16931 font-weight: 900; 16932 color: ${O}; 16933`,Y0t=p.div.withConfig({displayName:"FanoutTab__ConfirmBody",componentId:"sc-y5snxn-8"})` 16934 font-size: 0.82rem; 16935 font-weight: 600; 16936 color: ${z}; 16937 line-height: 1.5; 16938`,X0t=p.div.withConfig({displayName:"FanoutTab__ConfirmActions",componentId:"sc-y5snxn-9"})` 16939 display: flex; 16940 gap: 0.6rem; 16941 justify-content: flex-end; 16942`,Mx=p.td.withConfig({displayName:"FanoutTab__CheckboxCell",componentId:"sc-y5snxn-10"})` 16943 padding: 0.4rem 0.4rem 0.4rem 0.7rem; 16944 vertical-align: middle; 16945 width: 32px; 16946`,RQ=3,Q0t=10080*60*1e3;function Z0t(){const{workspaceId:e,projectId:n,allModelOptions:i,enabledModelKeys:r,isOwner:o}=z8(),s=Number(e),a=Number(n),c=S1(s,a),[u,m]=yr(),{user:h}=yn(),{showToast:g}=Uo(),x=k1(),[y,w]=l.useState(!1),[j,v]=l.useState({}),_=l.useRef({}),$=l.useRef({}),[k,P]=l.useState(new Set),[S,I]=l.useState(!1),[A,E]=l.useState("selected"),[B,T]=l.useState(!1),R=!!l.useMemo(()=>s&&h?.organizations?.find(st=>Number(st.id)===s)||null,[s,h?.organizations])?.partner_managed,F=l.useCallback(async st=>{v(Ct=>({...Ct,[st]:!0})),$.current[st]=0;try{const Ct=await ue(`/api/v1/organizations/${s}/projects/${a}/prompts/${st}/generate_fanout`,{method:"POST"}),Ie=await Ct.json().catch(()=>({}));if(!Ct.ok){x.handleApiError(new Error(Ie?.error||"Failed to generate fan-out queries"),Ie)||g?.(Ie?.error||"Failed to generate fan-out queries",{tone:"error"}),v(Fe=>({...Fe,[st]:!1}));return}Fo(),g?.("Fan-out generation started",{tone:"success"}),_.current[st]&&window.clearTimeout(_.current[st]),_.current[st]=window.setTimeout(()=>{delete _.current[st],v(ae=>ae[st]?(g?.("Fan-out generation is taking longer than expected. Results will appear when ready.",{tone:"info"}),{...ae,[st]:!1}):ae)},12e4)}catch{g?.("Failed to generate fan-out queries",{tone:"error"}),v(Ct=>({...Ct,[st]:!1}))}},[s,a,g,x]),Y=l.useMemo(()=>["gemini","chatgpt","perplexity"],[]),H=l.useMemo(()=>r.filter(st=>Y.includes(st)),[Y,r]),U=l.useMemo(()=>{const st=new Set(Y);return(i||[]).filter(Ct=>st.has(String(Ct?.key||"")))},[Y,i]),[X,Q]=l.useState([]),[K,G]=l.useState([]),[L,q]=l.useState(""),[W,oe]=l.useState("topic"),se=(st,Ct,Ie)=>
16946{Ie?st.set(Ct,Ie):st.delete(Ct)},de=st=>st?st.split(",").map(Ct=>Ct.trim()).filter(Boolean):[],le=st=>st?st.split(",").map(Ct=>Number(String(Ct||"").trim())).filter(Ct=>Number.isFinite(Ct)&&Ct>0):[];l.useEffect(()=>{const st=de(u.get("models"));st.join(",")!==X.join(",")&&Q(st);const Ct=le(u.get("topic_ids")),Ie=Number(u.get("topic_id")||"0")||0,ae=Ct.length>0?Ct:Ie>0?[Ie]:[];ae.join(",")!==K.join(",")&&G(ae);const Fe=u.get("q")||"";Fe!==L&&q(Fe);const Ge=(u.get("group")||"topic").toLowerCase(),wt=Ge==="prompt"?"prompt":Ge==="flat"?"flat":"topic";wt!==W&&oe(wt)},[u]);const me=l.useMemo(()=>(c.topics||[]).map(st=>({id:Number(st?.id),label:String(st?.name||"").trim()})).filter(st=>Number.isFinite(st.id)&&st.id>0&&!!st.label),[c.topics]);l.useEffect(()=>{!s||!a||c.loading||c.topics&&c.topics.length>0||c.error||c.ensure()},[s,a,c]);const ee=l.useMemo(()=>{const st=new Set(H),Ct=X.filter(Ie=>st.has(Ie));return Ct.length>0?Ct:H},[H,X]),{subscribe:ne}=wo(),Ae=l.useRef(null),_e=l.useRef(null),[we,Ke]=l.useState(0);l.useEffect(()=>{if(!Number.isFinite(a)||a<=0)return;try{Ae.current?.unsubscribe?.()}catch{}Ae.current=null;const st=ne({channel:"ProjectPromptsChannel",project_id:a},{received:Ct=>{if(Number(Ct?.project_id)===a&&!(Ct?.type!=="prompt_finished"&&Ct?.type!=="fanout_finished")){if(Ct?.type==="fanout_finished"&&Ct?.prompt_id){const Ie=Number(Ct.prompt_id);Ct?.empty?$.current[Ie]=($.current[Ie]||0)+1:delete $.current[Ie],v(ae=>({...ae,[Ie]:!1})),_.current[Ie]&&(window.clearTimeout(_.current[Ie]),delete _.current[Ie])}_e.current&&window.clearTimeout(_e.current),_e.current=window.setTimeout(()=>{_e.current=null,Ke(Ie=>Ie+1);for(const[Ie,ae]of Object.entries($.current))if(ae>0){g?.("No fan-out queries were found for this prompt.",{tone:"info"}),delete $.current[Number(Ie)];break}},650)}}})||null;return Ae.current=st,()=>{_e.current&&(window.clearTimeout(_e.current),_e.current=null);for(const Ct of Object.values(_.current))window.clearTimeout(Ct);_.current={};try{Ae.current?.unsubscribe?.()}catch{}Ae.current=null}},[a,ne]);const[ce,ie]=l.useState(!1),[Re,Be]=l.useState(null),[tt,dt]=l.useState([]),je=50,[Me,Se]=l.useState(1),[it,De]=l.useState({page:1,per_page:je,total:0,total_pages:0});l.useEffect(()=>{const st=Math.max(1,Number(u.get("page")||"1")||1);st!==Me&&Se(st)},[u]),l.useEffect(()=>{if(!s||!a)return;let st=!1;return ie(!0),Be(null),(async()=>{try{const Ct=new URLSearchParams;ee.length>0&&Ct.set("models",ee.join(",")),K.length>0&&Ct.set("topic_ids",K.join(",")),Ct.set("page",String(Me)),Ct.set("per_page",String(je));const Ie=await ue(`/api/v1/organizations/${s}/projects/${a}/fanout_queries?${Ct.toString()}`,{method:"GET"}),ae=await Ie.json().catch(()=>({}));if(!Ie.ok)throw new Error(ae?.error||ae?.errors?.[0]||"Failed to load fan-out queries");const Fe=ae,wt=(Array.isArray(Fe?.topics)?Fe.topics:[]).map(Ve=>({id:Number(Ve?.id),name:String(Ve?.name||"").trim(),prompts:(Array.isArray(Ve?.prompts)?Ve.prompts:[]).map(pt=>({id:Number(pt?.id),topic_id:Number(pt?.topic_id),content:String(pt?.content||"").trim(),fanout_updated_at:pt?.fanout_updated_at?String(pt.fanout_updated_at):null,fanout_queries:(Array.isArray(pt?.fanout_queries)?pt.fanout_queries:[]).map(Nt=>({query:String(Nt?.query||"").trim(),model_key:String(Nt?.model_key||"").trim(),fetched_at:Nt?.fetched_at?String(Nt.fetched_at):null})).filter(Nt=>Nt.query&&Nt.model_key)})).filter(pt=>Number.isFinite(pt.id)&&pt.id>0&&pt.content)})).filter(Ve=>Number.isFinite(Ve.id)&&Ve.id>0&&Ve.name);if(st)return;dt(wt),P(new Set);const ke=Fe?.pagination;if(ke&&typeof ke=="object")De({page:Number(ke?.page)||Me,per_page:Number(ke?.per_page)||je,total:Number(ke?.total)||0,total_pages:Number(ke?.total_pages)||0});else{const Ve=wt.reduce((pt,Nt)=>pt+(Nt.prompts||[]).length,0);De({page:1,per_page:Ve,total:Ve,total_pages:1})}}catch(Ct){if(st)return;dt([]),Be(Ct?.message||"Failed to load fan-out queries"),De({page:Me,per_page:je,total:0,total_pages:0})}finally{if(st)return;ie(!1)}})(),()=>{st=!0}},[s,a,ee.join(","),K.join(","),Me,we]);const[te,ge]=l.useState({}),[Je,Ee]=l.useState({});l.useEffect(()=>{ge(st=>{const Ct={...st};return tt.forEach(Ie=>{const ae=String(Ie.id);typeof Ct[ae]!="boolean"&&(Ct[ae]=!0)}),Ct})},[tt]);const Xe=l.useMemo(()=>{const st=L.trim().toLowerCase(),Ct=K.length>0?new Set(K.map(ae=>Number(ae))):null,Ie=ae=>st?String(ae||"").toLowerCase().includes(st):!0;
16946return tt.filter(ae=>Ct?Ct.has(Number(ae.id)):!0).map(ae=>{if(!st||Ie(ae.name))return ae;const Fe=(ae.prompts||[]).map(Ge=>{if(Ie(Ge.content))return Ge;const wt=(Ge.fanout_queries||[]).filter(ke=>Ie(ke.query));return{...Ge,fanout_queries:wt}}).filter(Ge=>(Ge.fanout_queries||[]).length>0||Ie(Ge.content));return{...ae,prompts:Fe}}).filter(ae=>(ae.prompts||[]).length>0||Ie(ae.name))},[L,tt,K.join(",")]),yt=l.useMemo(()=>Xe.reduce((st,Ct)=>st+(Ct.prompts||[]).reduce((Ie,ae)=>Ie+(ae.fanout_queries||[]).length,0),0),[Xe]),Ne=l.useMemo(()=>[{value:"topic",label:"Group: Topic"},{value:"prompt",label:"Group: Prompt"},{value:"flat",label:"Group: Flat"}],[]),Le=l.useMemo(()=>Xe.flatMap(st=>(st.prompts||[]).map(Ct=>({topic_id:st.id,topic_name:st.name,prompt:Ct}))),[Xe]),Ue=l.useMemo(()=>Xe.flatMap(st=>(st.prompts||[]).flatMap(Ct=>(Ct.fanout_queries||[]).map(Ie=>({topic_id:st.id,topic_name:st.name,prompt_id:Ct.id,prompt_content:Ct.content,...Ie})))),[Xe]),We=l.useMemo(()=>{const st=new Set;for(const Ct of tt)for(const Ie of Ct.prompts||[])st.add(Ie.id);return st},[tt]),Qe=l.useMemo(()=>{const st={};for(const Ct of tt)for(const Ie of Ct.prompts||[])st[Ie.id]=Ie;return st},[tt]),ht=l.useCallback(st=>{const Ct=Qe[st];if(!Ct?.fanout_updated_at)return!1;const Ie=new Date(Ct.fanout_updated_at).getTime();return Ie>0&&Date.now()-Ie<Q0t},[Qe]),pe=l.useMemo(()=>Array.from(We).filter(st=>!j[st]&&!ht(st)),[We,j,ht]),be=We.size>0&&Array.from(We).every(st=>k.has(st)),rt=k.size>0,ze=()=>{P(be?new Set:new Set(We))},lt=st=>{P(Ct=>{const Ie=new Set(Ct);return Ie.has(st)?Ie.delete(st):Ie.add(st),Ie})},vt=l.useMemo(()=>Array.from(k).filter(st=>!j[st]&&!ht(st)),[k,j,ht]),Wt=st=>{E(st),I(!0)},Qt=l.useCallback(async()=>{const st=A==="all"?pe:vt;if(st.length!==0){I(!1),T(!0),v(Ct=>{const Ie={...Ct};for(const ae of st)Ie[ae]=!0;return Ie});try{const Ct=await ue(`/api/v1/organizations/${s}/projects/${a}/prompts/generate_fanout_bulk`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt_ids:st})}),Ie=await Ct.json().catch(()=>({}));if(!Ct.ok){v(wt=>{const ke={...wt};for(const Ve of st)delete ke[Ve];return ke}),x.handleApiError(new Error(Ie?.error||"Bulk generation failed"),Ie)||g?.(Ie?.error||"Bulk generation failed",{tone:"error"});return}Fo();const ae=Number(Ie?.queued_count??st.length),Fe=Number(Ie?.skipped_count??0);if(Fe>0){g?.(`Fan-out generation started for ${ae} prompt${ae!==1?"s":""}. ${Fe} skipped (on cooldown).`,{tone:"success"});const Ge=(Array.isArray(Ie?.skipped_prompt_ids)?Ie.skipped_prompt_ids:[]).map(Number);v(wt=>{const ke={...wt};for(const Ve of Ge)delete ke[Ve];return ke})}else g?.(`Fan-out generation started for ${ae} prompt${ae!==1?"s":""}.`,{tone:"success"});P(new Set)}catch{v(Ct=>{const Ie={...Ct};for(const ae of st)delete Ie[ae];return Ie}),g?.("Bulk generation failed. Please try again.",{tone:"error"})}finally{T(!1)}}},[A,pe,vt,s,a,g,x]),Yt=()=>Array.from({length:10}).map((st,Ct)=>t.jsxs(Sm,{children:[t.jsx(Mx,{}),t.jsx(fo,{children:t.jsx(nt,{style:{width:Ct%3===0?"14rem":"20rem",height:"0.9rem"}})}),t.jsx(fo,{$muted:!0,children:t.jsx(nt,{style:{width:"6rem",height:"0.9rem"}})}),t.jsx(fo,{$muted:!0,children:t.jsx(nt,{style:{width:"7rem",height:"0.9rem"}})}),t.jsx(fo,{})]},`sk-${Ct}`)),Zt=st=>{const Ct=!!j[st],Ie=ht(st),ae=t.jsx(he,{type:"button",size:"sm",variant:"outline",disabled:Ct||Ie,onClick:()=>F(st),style:{fontSize:"0.7rem",gap:"0.3rem"},children:Ct?t.jsxs(t.Fragment,{children:[t.jsx(W0t,{size:12})," Generatingâ¦"]}):t.jsxs(t.Fragment,{children:[t.jsx(Sn,{size:12})," Generate"]})});return Ie?t.jsx(at,{content:"Fan-out queries can only be regenerated once per week.",children:t.jsx("span",{style:{display:"inline-block"},children:ae})}):ae},tn=A==="all"?pe:vt,nn=tn.length*RQ,xn=!ce&&!Re&&Xe.length>0?yt:null;return t.jsxs(D0t,{children:[(()=>{const st=typeof document<"u"?document.getElementById("project-prompts-filters-slot"):null,Ct=t.jsxs(due,{children:[t.jsxs(uue,{children:[t.jsx(rC,{options:U,value:X,onChange:Ie=>{Q(Ie),Se(1);const ae=new URLSearchParams(u);se(ae,"models",Ie.length>0?Ie.join(","):null),ae.delete("page"),m(ae,{replace:!0})},disabled:H.length<=0,onUpgradeClick:()=>w(!0),isOwner:o}),t.jsx(u1,{options:me,value:K,onChange:Ie=>{G(Ie),Se(1);const ae=new URLSearchParams(u);ae.delete("topic_id"),se(ae,"topic_ids",Ie.length>0?Ie.join(","):null),ae.delete("page"),m(ae,{replace:!0})},disabled:me.length<=0}),t.jsx("div",{style:{width:160,flex:"0 0 160px"},children:t.jsx(Fn,{options:Ne,value:W,onChange:Ie=>{const ae=Ie==="prompt"||Ie==="flat"?Ie:"topic";oe(ae);
16946const Fe=new URLSearchParams(u);se(Fe,"group",ae==="topic"?null:ae),m(Fe,{replace:!0})},size:"sm",dropdownPortal:!0})})]}),t.jsxs(pue,{children:[t.jsx("div",{style:{minWidth:0},children:t.jsx(Ed,{value:L,onChange:Ie=>{q(Ie),Se(1);const ae=new URLSearchParams(u);se(ae,"q",Ie.trim()?Ie:null),ae.delete("page"),m(ae,{replace:!0})},placeholder:"Search fan-outâ¦",containerStyle:{minWidth:0}})}),!rt&&pe.length>0&&!ce&&!Re&&t.jsxs(he,{type:"button",size:"sm",variant:"primary",disabled:B,onClick:()=>Wt("all"),style:{fontSize:"0.72rem",gap:"0.3rem",whiteSpace:"nowrap",flexShrink:0},children:[t.jsx(Sn,{size:12})," Generate all (",pe.length,")"]})]})]});return st?jr.createPortal(Ct,st):Ct})(),rt&&t.jsxs(U0t,{children:[t.jsxs(H0t,{children:[k.size," prompt",k.size!==1?"s":""," selected"]}),vt.length>0&&t.jsxs(t.Fragment,{children:[t.jsx(MQ,{children:"·"}),t.jsxs("span",{style:{opacity:.7,fontSize:"0.75rem"},children:[vt.length*RQ," credits"]}),t.jsxs(he,{type:"button",size:"sm",variant:"primary",disabled:B,onClick:()=>Wt("selected"),style:{fontSize:"0.72rem",gap:"0.3rem"},children:[t.jsx(Sn,{size:12})," Generate selected"]})]}),vt.length===0&&t.jsx("span",{style:{opacity:.6,fontSize:"0.75rem"},children:"All selected are on cooldown"}),t.jsx(MQ,{children:"·"}),pe.length>0&&t.jsxs(he,{type:"button",size:"sm",variant:"outline",disabled:B,onClick:()=>Wt("all"),style:{fontSize:"0.72rem",gap:"0.3rem"},children:[t.jsx(Sn,{size:12})," Generate all (",pe.length,")"]}),t.jsx(q0t,{type:"button",onClick:()=>P(new Set),"aria-label":"Clear selection",children:t.jsx(Ei,{size:15})})]}),t.jsx(Xce,{children:t.jsxs(L0t,{children:[t.jsx(B0t,{children:t.jsxs(Sm,{children:[t.jsx(lj,{style:{width:32,padding:"0.55rem 0.4rem 0.55rem 0.7rem"},children:!ce&&We.size>0&&t.jsx(at,{content:be?"Deselect all":"Select all prompts",children:t.jsx("input",{type:"checkbox",checked:be,onChange:ze,style:{cursor:"pointer",accentColor:O},"aria-label":"Select all prompts"})})}),t.jsx(lj,{style:{width:"46%"},children:t.jsxs(V$,{children:["Fan-out queries",typeof xn=="number"&&t.jsx(MP,{children:xn}),t.jsx(at,{content:"Related queries generated from your prompts. Use Group by to switch between topic, prompt, or a flat list.",children:t.jsx(K$,{tabIndex:0,"aria-label":"Fan-out queries info",children:t.jsx(wn,{size:12})})})]})}),t.jsx(lj,{style:{width:"16%"},children:t.jsxs(V$,{children:["Model",t.jsx(at,{content:"Which model produced the fan-out queries.",children:t.jsx(K$,{tabIndex:0,"aria-label":"Model info",children:t.jsx(wn,{size:12})})})]})}),t.jsx(lj,{style:{width:"16%"},children:t.jsxs(V$,{children:["Refreshed",t.jsx(at,{content:"Last time we fetched fan-out queries for this prompt + model.",children:t.jsx(K$,{tabIndex:0,"aria-label":"Refreshed info",children:t.jsx(wn,{size:12})})})]})}),t.jsx(lj,{style:{width:"20%"},children:t.jsxs(V$,{children:["Generate",t.jsx(at,{content:"Generate fan-out queries for a prompt. Costs 3 credits per prompt.",children:t.jsx(K$,{tabIndex:0,"aria-label":"Generate info",children:t.jsx(wn,{size:12})})})]})})]})}),t.jsx("tbody",{children:ce?Yt():Re?t.jsx(Sm,{children:t.jsx(fo,{$muted:!0,colSpan:5,children:Re})}):Xe.length===0?t.jsx(Sm,{children:t.jsx(fo,{$muted:!0,colSpan:5,children:t.jsx(Zg,{subtitle:"No fan-out queries yet. Click Generate to create them."})})}):W==="topic"?Xe.map(st=>{const Ct=L.trim()?!0:!!te[String(st.id)],Ie=(st.prompts||[]).length,ae=(st.prompts||[]).reduce((Fe,Ge)=>Fe+(Ge.fanout_queries||[]).length,0);return t.jsxs(l.Fragment,{children:[t.jsx(EQ,{children:t.jsx(fo,{colSpan:5,children:t.jsx(cj,{$level:0,children:t.jsxs(Z7,{type:"button",onClick:()=>ge(Fe=>({...Fe,[String(st.id)]:!Ct})),"aria-expanded":Ct,children:[Ct?t.jsx(qn,{size:18}):t.jsx(Gi,{size:18}),t.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0},children:st.name}),t.jsxs(J7,{children:[Ie," prompts · ",ae," queries"]})]})})})}),Ct?st.prompts.map(Fe=>{const Ge=`${st.id}:${Fe.id}`,wt=L.trim()?!0:!!(Je[Ge]??!0),ke=(Fe.fanout_queries||[]).length,Ve=k.has(Fe.id);return t.jsxs(l.Fragment,{children:[t.jsxs(Sm,{style:Ve?{background:`color-mix(in srgb, ${$e} 60%, transparent)`}:void 0,children:[t.jsx(Mx,{children:t.jsx("input",{type:"checkbox",checked:Ve,onChange:()=>lt(Fe.id),style:{cursor:"pointer",accentColor:O},"aria-label":`Select prompt: ${Fe.content}`})}),t.jsx(fo,{colSpan:3,children:t.jsx(cj,{$level:1,children:t.jsxs(Z7,{t
16946ype:"button",onClick:()=>Ee(pt=>({...pt,[Ge]:!wt})),"aria-expanded":wt,children:[wt?t.jsx(qn,{size:16}):t.jsx(Gi,{size:16}),t.jsx("span",{style:{fontWeight:850,overflowWrap:"anywhere"},children:Fe.content}),t.jsxs(J7,{children:[ke," queries"]})]})})}),t.jsx(fo,{children:Zt(Fe.id)})]}),wt?(Fe.fanout_queries||[]).map((pt,Nt)=>t.jsxs(F0t,{children:[t.jsx(Mx,{}),t.jsx(fo,{children:t.jsx(cj,{$level:2,children:t.jsx("span",{style:{fontWeight:750,overflowWrap:"anywhere"},children:pt.query})})}),t.jsx(fo,{$muted:!0,children:pt.model_key}),t.jsx(fo,{$muted:!0,children:t.jsx(rr,{value:pt.fetched_at,format:"date",timeZoneMode:"viewer",options:{month:"short",day:"numeric"}})}),t.jsx(fo,{})]},`fq-${Fe.id}-${pt.model_key}-${Nt}`)):null]},`prompt-${Fe.id}`)}):null]},`topic-${st.id}`)}):W==="prompt"?Le.map(st=>{const Ct=`prompt:${st.prompt.id}`,Ie=L.trim()?!0:!!(Je[Ct]??!0),ae=(st.prompt.fanout_queries||[]).length,Fe=k.has(st.prompt.id);return t.jsxs(l.Fragment,{children:[t.jsxs(EQ,{style:Fe?{background:`color-mix(in srgb, ${$e} 80%, transparent)`}:void 0,children:[t.jsx(Mx,{children:t.jsx("input",{type:"checkbox",checked:Fe,onChange:()=>lt(st.prompt.id),style:{cursor:"pointer",accentColor:O},"aria-label":`Select prompt: ${st.prompt.content}`})}),t.jsx(fo,{colSpan:3,children:t.jsx(cj,{$level:0,children:t.jsxs(Z7,{type:"button",onClick:()=>Ee(Ge=>({...Ge,[Ct]:!Ie})),"aria-expanded":Ie,children:[Ie?t.jsx(qn,{size:18}):t.jsx(Gi,{size:18}),t.jsx("span",{style:{fontWeight:900,overflowWrap:"anywhere"},children:st.prompt.content}),t.jsxs(J7,{children:[st.topic_name," · ",ae," queries"]})]})})}
16946),t.jsx(fo,{children:Zt(st.prompt.id)})]}),Ie?(st.prompt.fanout_queries||[]).map((Ge,wt)=>t.jsxs(Sm,{children:[t.jsx(Mx,{}),t.jsx(fo,{children:t.jsx(cj,{$level:1,children:t.jsx("span",{style:{fontWeight:750,overflowWrap:"anywhere"},children:Ge.query})})}),t.jsx(fo,{$muted:!0,children:Ge.model_key}),t.jsx(fo,{$muted:!0,children:t.jsx(rr,{value:Ge.fetched_at,format:"date",timeZoneMode:"viewer",options:{month:"short",day:"numeric"}})}),t.jsx(fo,{})]},`prompt-fq-${st.prompt.id}-${Ge.model_key}-${wt}`)):null]},`prompt-group-${st.prompt.id}`)}):Ue.map((st,Ct)=>t.jsxs(Sm,{children:[t.jsx(Mx,{children:t.jsx("input",{type:"checkbox",checked:k.has(st.prompt_id),onChange:()=>lt(st.prompt_id),style:{cursor:"pointer",accentColor:O},"aria-label":`Select prompt: ${st.prompt_content}`})}),t.jsx(fo,{children:t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4,minWidth:0},children:[t.jsx("span",{style:{fontWeight:750,overflowWrap:"anywhere"},children:st.query}),t.jsxs("span",{style:{fontSize:"0.72rem",fontWeight:750,color:z,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[st.topic_name," · ",st.prompt_content]})]})}),t.jsx(fo,{$muted:!0,children:st.model_key}),t.jsx(fo,{$muted:!0,children:t.jsx(rr,{value:st.fetched_at,format:"date",timeZoneMode:"viewer",options:{month:"short",day:"numeric"}})}),t.jsx(fo,{children:Zt(st.prompt_id)})]},`flat-fq-${st.prompt_id}-${st.model_key}-${Ct}`))})]})}),t.jsx(pi,{page:it.page||Me,totalPages:it.total_pages||1,total:it.total||0,onPrev:()=>{const st=it.page||Me;if(st<=1)return;const Ct=Math.max(1,st-1);Se(Ct);const Ie=new URLSearchParams(u);Ct===1?Ie.delete("page"):Ie.set("page",String(Ct)),m(Ie,{replace:!0})},onNext:()=>{const st=it.page||Me,Ct=Math.max(1,it.total_pages||1);if(st>=Ct)return;const Ie=st+1;Se(Ie);const ae=new URLSearchParams(u);ae.set("page",String(Ie)),m(ae,{replace:!0})}}),e?t.jsx(ec,{isOpen:y,orgId:Number(e),onClose:()=>w(!1)}):null,t.jsx(l1,{isOpen:x.isOpen,onClose:x.closeOverlay,title:x.overlayState?.title,message:x.overlayState?.message,limitName:x.overlayState?.limitName,limit:x.overlayState?.limit,used:x.overlayState?.used,isOwner:o,partnerManaged:R,workspaceId:e||""}),S&&jr.createPortal(t.jsx(G0t,{onClick:st=>{st.target===st.currentTarget&&I(!1)},children:t.jsxs(V0t,{children:[t.jsx(K0t,{children:A==="all"?`Generate for all ${tn.length} prompt${tn.length!==1?"s":""}?`:`Generate for ${tn.length} selected prompt${tn.length!==1?"s":""}?`}),t.jsxs(Y0t,{children:["This will use ",t.jsxs("strong",{children:[nn," credits"]})," from your workspace balance.",A==="selected"&&vt.length<k.size&&t.jsxs(t.Fragment,{children:[" ",k.size-vt.length," prompt",k.size-vt.length!==1?"s":""," on cooldown will be skipped."]})]}),t.jsxs(X0t,{children:[t.jsx(he,{type:"button",size:"sm",variant:"outline",onClick:()=>I(!1),children:"Cancel"}),t.jsxs(he,{type:"button",size:"sm",variant:"primary",disabled:tn.length===0||B,onClick:Qt,children:[t.jsx(Sn,{size:13})," Confirm · ",nn," credits"]})]})]})}),document.body)]})}function fy(){return new Date().toISOString()}function e4(){const e=globalThis;return e?.crypto?.randomUUID?e.crypto.randomUUID():`${Date.now()}_${Math.random().toString(16).slice(2)}`}function hue(e){try{const n=new Date(e);return Number.isNaN(n.getTime())?"":new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric"}).format(n)}catch{return""}}function t4(e){const n=String(e||"").trim().split(/\s+/).filter(Boolean);if(n.length===0)return"";const i=n.slice(0,20).join(" ");return n.length>20?`${i}â¦`:i}function j8(e){return{id:String(e.id),title:String(e.title||"New chat"),metadata:e.metadata&&typeof e.metadata=="object"?e.metadata:void 0,created_at:String(e.created_at||fy()),updated_at:String(e.updated_at||fy()),messages:[],messages_loaded:!1}}function OQ(e){return{id:String(e.id),role:e.role==="assistant"?"assistant":"user",content:String(e.content||""),status:e.status,metadata:e.metadata||{},created_at:String(e.created_at||fy()),updated_at:String(e.updated_at||fy())}}const J0t=p.div.withConfig({displayName:"styles__Page",componentId:"sc-19bg8bj-0"})` 16947 padding: 1.25rem; 16948 height: 100vh; 16949 height: 100dvh; 16950 overflow: hidden; 16951 display: flex; 16952 flex-direction: column; 16953`,ext=p.div.withConfig({displayName:"styles__ChatShell",componentId:"sc-19bg8bj-1"})` 16954 margin-top: 1rem; 16955 position: relative; 16956 display: flex; 16957 flex-direction: column; 16958 flex: 1 1 auto; 16959 min-height: 0; 16960`,txt=p.div.withConfig({displayName:"styles__ChatHeader",componentId:"sc-19bg8bj-2"})` 16961 padding: 0.45rem 0; 16962 border-bottom: 1px solid ${V}; 16963 flex-shrink: 0; 16964`,nxt=p.div.withConfig({displayName:"styles__ChatHeaderRow",componentId:"sc-19bg8bj-3"})` 16965 display: flex; 16966 align-items: center; 16967 justify-content: space-between; 16968 gap: 0.75rem; 16969 flex-wrap: wrap; 16970`,ixt=p.div.withConfig({displayName:"styles__ChatTitle",componentId:"sc-19bg8bj-4"})` 16971 font-size: 0.9rem; 16972 font-weight: 950; 16973 color: ${O}; 16974 min-width: 0; 16975`,rxt=p.div.withConfig({displayName:"styles__ChatSub",componentId:"sc-19bg8bj-5"})` 16976 margin-top: 0.2rem; 16977 font-size: 0.72rem; 16978 font-weight: 750; 16979 color: ${z}; 16980`,oxt=p.div.withConfig({displayName:"styles__ChatDisclaimer",componentId:"sc-19bg8bj-6"})` 16981 margin-top: 0.35rem; 16982 padding: 0.45rem 0.65rem; 16983 font-size: 0.72rem; 16984 font-weight: 650; 16985 color: ${z}; 16986 line-height: 1.35; 16987 background: ${$e}; 16988 border-radius: 0.5rem; 16989 border: 1px solid ${V}; 16990 text-align: center; 16991`,sxt=p.div.withConfig({displayName:"styles__HeaderActions",componentId:"sc-19bg8bj-7"})` 16992 display: inline-flex; 16993 align-items: center; 16994 gap: 0.5rem; 16995 flex-wrap: wrap; 16996`,axt=p.div.withConfig({displayName:"styles__ChatTitleRow",componentId:"sc-19bg8bj-8"})` 16997 display: inline-flex; 16998 align-items: center; 16999 gap: 0.5rem; 17000 min-width: 0; 17001`,lxt=p.div.withConfig({displayName:"styles__Body",componentId:"sc-19bg8bj-9"})` 17002 flex: 1 1 auto; 17003 min-height: 0; 17004 display: flex; 17005 flex-direction: column; 17006 overflow: hidden; /* keep scrolling inside Messages only */ 17007`,cxt=p.div.withConfig({displayName:"styles__Messages",componentId:"sc-19bg8bj-10"})` 17008 flex: 1 1 auto; 17009 min-height: 0; 17010 overflow: auto; 17011 padding: 1.25rem 0; 17012 display: flex; 17013 flex-direction: column; 17014`,fue=p.div.withConfig({displayName:"styles__Max",componentId:"sc-19bg8bj-11"})` 17015 width: 100%; 17016 max-width: 56rem; 17017 margin: 0 auto; 17018 padding: 0 0.5rem; 17019 17020 @media (min-width: 640px) { 17021 padding: 0 1rem; 17022 } 17023`,dxt=p.div.withConfig({displayName:"styles__MessagesList",componentId:"sc-19bg8bj-12"})` 17024 display: flex; 17025 flex-direction: column; 17026 gap: 1.75rem; 17027`,uxt=p.div.withConfig({displayName:"styles__BubbleRow",componentId:"sc-19bg8bj-13"})` 17028 display: flex; 17029 justify-content: ${e=>e.$role==="user"?"flex-end":"flex-start"}; 17030`,pxt=p.div.withConfig({displayName:"styles__MessageStack",componentId:"sc-19bg8bj-14"})` 17031 display: flex; 17032 flex-direction: column; 17033 gap: 0.3rem; 17034 align-items: ${e=>e.$role==="user"?"flex-end":"flex-start"}; 17035 max-width: 100%; 17036`,mxt=p.div.withConfig({displayName:"styles__MessageMeta",componentId:"sc-19bg8bj-15"})` 17037 display: inline-flex; 17038 align-items: center; 17039 gap: 0.4rem; 17040 font-size: 0.68rem; 17041 font-weight: 750; 17042 color: ${z}; 17043 padding: 0 0.35rem; 17044 justify-content: ${e=>e.$role==="user"?"flex-end":"flex-start"}; 17045`,hxt=p.span.withConfig({displayName:"styles__RolePill",componentId:"sc-19bg8bj-16"})` 17046 display: inline-flex; 17047 align-items: center; 17048 gap: 0.3rem; 17049 padding: 0.15rem 0.5rem; 17050 border-radius: 0.4rem; 17051 border: 1px solid ${e=>e.$role==="user"?"rgba(79,70,229,0.18)":V}; 17052 background: ${e=>e.$role==="user"?"rgba(79,70,229,0.1)":Z}; 17053 color: ${e=>e.$role==="user"?"rgb(79,70,229)":O}; 17054 font-weight: 850; 17055 font-size: 0.68rem; 17056`,fxt=p.div.withConfig({displayName:"styles__Bubble",componentId:"sc-19bg8bj-17"})` 17057 max-width: min(760px, 92%); 17058 border-radius: ${e=>e.$role==="user"?"1rem 1rem 0.25rem 1rem":"1rem 1rem 1rem 0.25rem"}; 17059 padding: 0.75rem 0.95rem; 17060 border: 1px solid ${e=>e.$role==="user"?"rgba(79,70,229,0.14)":V}; 17061 background: ${e=>e.$role==="user"?"rgba(79,70,229,0.06)":Z}; 17062 color: ${O}; 17063 font-size: 0.875rem; 17064 font-weight: ${e=>e.$role==="assistant"?500:700}; 17065 line-height: 1.55; 17066 white-space: ${e=>e.$role==="user"?"pre-wrap":"normal"};
17067 overflow-wrap: anywhere; 17068 box-shadow: ${e=>e.$role==="assistant"?"0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02)":"none"}; 17069`,gxt=p.div.withConfig({displayName:"styles__ComposerDock",componentId:"sc-19bg8bj-18"})` 17070 position: sticky; 17071 bottom: 0; 17072 padding: 0.65rem 0 0.85rem; 17073 border-top: 1px solid ${V}; 17074`,rD=p.div.withConfig({displayName:"styles__Composer",componentId:"sc-19bg8bj-19"})` 17075 display: flex; 17076 justify-content: center; 17077 width: 100%; 17078`,yxt=p.div.withConfig({displayName:"styles__PromptBar",componentId:"sc-19bg8bj-20"})` 17079 width: 100%; 17080 display: flex; 17081 align-items: flex-end; 17082 gap: 0.5rem; 17083 border: 1.5px solid ${Rt}; 17084 background: ${Z}; 17085 border-radius: 1rem; 17086 padding: 0.5rem 0.55rem; 17087 box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.03); 17088 transition: border-color 160ms ease, box-shadow 160ms ease; 17089 17090 &:focus-within { 17091 border-color: rgba(99, 102, 241, 0.5); 17092 box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1), 0 1px 3px rgba(0, 0, 0, 0.04); 17093 } 17094`,xxt=p.button.withConfig({displayName:"styles__PromptIconButton",componentId:"sc-19bg8bj-21"})` 17095 width: 38px; 17096 height: 38px; 17097 border-radius: 0.65rem; 17098 border: none; 17099 background: ${e=>e.$tone==="primary"?e.$disabled?V:"rgb(99, 102, 241)":$e}; 17100 color: ${e=>e.$tone==="primary"?e.$disabled?z:"white":z}; 17101 cursor: ${e=>e.$disabled?"not-allowed":"pointer"}; 17102 display: inline-flex; 17103 align-items: center; 17104 justify-content: center; 17105 flex-shrink: 0; 17106 transition: transform 120ms ease, background-color 120ms ease; 17107 17108 &:hover { 17109 transform: ${e=>e.$disabled?"none":"translateY(-1px)"}; 17110 background: ${e=>e.$tone==="primary"?e.$disabled?V:"rgb(79, 70, 229)":V}; 17111 } 17112 17113 &:active { 17114 transform: translateY(0); 17115 } 17116 17117 &:focus-visible { 17118 outline: none; 17119 box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2); 17120 } 17121`,bxt=p.textarea.withConfig({displayName:"styles__PromptInput",componentId:"sc-19bg8bj-22"})` 17122 flex: 1; 17123 min-width: 0; 17124 min-height: 38px; 17125 max-height: 38px; 17126 border: 0; 17127 outline: none; 17128 background: transparent; 17129 color: ${O}; 17130 font-size: 0.9rem; 17131 font-weight: 600; 17132 padding: 0.45rem 0.4rem; 17133 resize: none; 17134 line-height: 1.4; 17135 overflow-y: auto; 17136 17137 &::placeholder { 17138 color: ${z}; 17139 font-weight: 600; 17140 } 17141`,vxt=p.div.withConfig({displayName:"styles__CenterStage",componentId:"sc-19bg8bj-23"})` 17142 flex: 1 1 auto; 17143 min-height: 0; 17144 display: grid; 17145 place-items: center; 17146 padding: 2rem 1rem; 17147 overflow: auto; 17148`,wxt=p.div.withConfig({displayName:"styles__ChatLoadingStage",componentId:"sc-19bg8bj-24"})` 17149 flex: 1 1 auto; 17150 min-height: 0; 17151 display: flex; 17152 flex-direction: column; 17153`,jxt=p.div.withConfig({displayName:"styles__ChatLoadingMessages",componentId:"sc-19bg8bj-25"})` 17154 flex: 1 1 auto; 17155 min-height: 0; 17156 overflow: auto; 17157 padding: 1rem 0; 17158`,_xt=p.div.withConfig({displayName:"styles__ChatLoadingComposer",componentId:"sc-19bg8bj-26"})` 17159 position: sticky; 17160 bottom: 0; 17161 padding: 0.75rem 0 1rem; 17162 background: transparent; 17163`;p.div.withConfig({displayName:"styles__CenterInner",componentId:"sc-19bg8bj-27"})` 17164 width: 100%; 17165 /* Wider layout for the main/empty chat landing state */ 17166 max-width: 100rem; 17167 display: flex; 17168 flex-direction: column; 17169 gap: 0.9rem; 17170 align-items: center; 17171 text-align: center; 17172`;p.div.withConfig({displayName:"styles__BigGreeting",componentId:"sc-19bg8bj-28"})` 17173 font-size: 1.5rem; 17174 font-weight: 950; 17175 color: ${O}; 17176 line-height: 1.1; 17177`;p.div.withConfig({displayName:"styles__BigSub",componentId:"sc-19bg8bj-29"})` 17178 margin-top: 0.4rem; 17179 font-size: 0.95rem; 17180 font-weight: 750; 17181 color: ${z}; 17182 line-height: 1.35; 17183`;p.div.withConfig({displayName:"styles__QuickActions",componentId:"sc-19bg8bj-30"})` 17184 display: flex; 17185 flex-wrap: wrap; 17186 gap: 0.5rem; 17187 justify-content: center; 17188`;const Cxt=p.div.withConfig({displayName:"styles__HistoryBackdrop",componentId:"sc-19bg8bj-31"})` 17189 position: absolute; 17190 inset: 0; 17191 z-index: 10; 17192 /* Keep the rest of the page visually unchanged (no dimming). */ 17193 background: transparent; 17194 opacity: ${e=>e.$open?1:0}; 17195 pointer-events: ${e=>e.$open?"auto":"none"}; 17196 transition: opacity 160ms ease; 17197`,Sxt=p.aside.withConfig({displayName:"styles__HistoryPanel",componentId:"sc-19bg8bj-32"})` 17198 position: absolute; 17199 top: 3.25rem; 17200 right: 0; 17201 margin-top: 0.5rem; 17202 width: min(360px, calc(100% - 1rem)); 17203 max-height: min(64vh, 560px); 17204 z-index: 11; 17205 background: ${Z}; 17206 border: 1px solid ${Rt}; 17207 border-radius: 1rem; 17208 box-shadow: 0 24px 70px rgba(0, 0, 0, 0.18); 17209 transform: translateY(${e=>e.$open?"0":"-6px"}); 17210 opacity: ${e=>e.$open?1:0}; 17211 pointer-events: ${e=>e.$open?"auto":"none"}; 17212 transition: transform 160ms ease, opacity 160ms ease; 17213 display: flex; 17214 flex-direction: column; 17215`,kxt=p.div.withConfig({displayName:"styles__HistoryHeader",componentId:"sc-19bg8bj-33"})` 17216 padding: 0.85rem 0.85rem 0.75rem; 17217 border-bottom: 1px solid ${V}; 17218 background: ${Z}; 17219 display: flex; 17220 align-items: flex-start; 17221 justify-content: space-between; 17222 gap: 0.75rem; 17223`,$xt=p.div.withConfig({displayName:"styles__HistoryTitle",componentId:"sc-19bg8bj-34"})` 17224 font-size: 0.95rem; 17225 font-weight: 950; 17226 color: ${O}; 17227`,Ixt=p.div.withConfig({displayName:"styles__HistoryBody",componentId:"sc-19bg8bj-35"})` 17228 padding: 0; 17229 overflow: auto; 17230 min-height: 0; 17231 flex: 1 1 auto; 17232`,Pxt=p.div.withConfig({displayName:"styles__HistoryStickyControls",componentId:"sc-19bg8bj-36"})` 17233 position: sticky; 17234 top: 0; 17235 z-index: 2; 17236 background: ${Z}; 17237 padding: 0.75rem; 17238 border-bottom: 1px solid ${V}; 17239`,Axt=p.div.withConfig({displayName:"styles__HistoryListWrap",componentId:"sc-19bg8bj-37"})` 17240 padding: 0.75rem; 17241`,DQ=p.span.withConfig({displayName:"styles__CreditsBadge",componentId:"sc-19bg8bj-38"})` 17242 display: inline-flex; 17243 align-items: center; 17244 gap: 0.25rem; 17245 font-size: 0.65rem; 17246 font-weight: 700; 17247 color: ${z}; 17248 padding: 0.1rem 0.4rem; 17249 border-radius: 999px; 17250 background: ${$e}; 17251 border: 1px solid ${V}; 17252 white-space: nowrap; 17253`,gue=p.div.withConfig({displayName:"styles__LoaderStack",componentId:"sc-19bg8bj-39"})` 17254 display: flex; 17255 flex-direction: column; 17256 gap: 0.5rem; 17257 padding: 0.5rem 0.25rem; 17258`,Nxt=p.div.withConfig({displayName:"styles__DrawerList",componentId:"sc-19bg8bj-40"})` 17259 display: flex; 17260 flex-direction: column; 17261 gap: 0.4rem; 17262`,zxt=p.div.withConfig({displayName:"styles__DrawerRow",componentId:"sc-19bg8bj-41"})` 17263 width: 100%; 17264 text-align: left; 17265 border: 1px solid ${e=>e.$active?Rt:V}; 17266 background: ${e=>e.$active?$e:Z}; 17267 border-radius: 0.875rem; 17268 padding: 0.65rem 0.7rem; 17269 cursor: pointer; 17270 display: grid; 17271 grid-template-columns: 1fr auto; 17272 gap: 0.65rem; 17273 align-items: center; 17274 transition: background-color 140ms ease, border-color 140ms ease; 17275 17276 &:hover { 17277 background: ${$e}; 17278 border-color: ${Rt}; 17279 } 17280 17281 &:focus-visible { 17282 outline: none; 17283 box-shadow: 0 0 0 3px ${En}; 17284 } 17285`,Txt=p.div.withConfig({displayName:"styles__RowTitle",componentId:"sc-19bg8bj-42"})` 17286 font-size: 0.85rem; 17287 font-weight: 950; 17288 color: ${O}; 17289 overflow: hidden; 17290 text-overflow: ellipsis; 17291 white-space: nowrap; 17292`,Ext=p.div.withConfig({displayName:"styles__RowMeta",componentId:"sc-19bg8bj-43"})` 17293 margin-top: 0.25rem; 17294 font-size: 0.72rem; 17295 font-weight: 800; 17296 color: ${z}; 17297 display: inline-flex; 17298 gap: 0.4rem; 17299 align-items: center; 17300`,LQ=p.button.withConfig({displayName:"styles__MiniIconButton",componentId:"sc-19bg8bj-44"})` 17301 border: 1px solid ${V}; 17302 background: ${Z}; 17303 color: ${z}; 17304 border-radius: 0.75rem; 17305 width: 34px; 17306 height: 34px; 17307 display: inline-flex; 17308 align-items: center; 17309 justify-content: center; 17310 cursor: pointer; 17311 transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease; 17312 17313 &:hover { 17314 background: ${$e}; 17315 border-color: ${Rt}; 17316 color: ${O}; 17317 } 17318 17319 &:focus-visible { 17320 outline: none; 17321 box-shadow: 0 0 0 3px ${En}; 17322 } 17323`,n4=[{key:"flash",label:"Fast",icon:Ks,hint:"Fastest responses, newest model"},{key:"balanced",label:"Balanced",icon:Sn,hint:"Great balance of speed & quality"},{key:"pro",label:"Pro",icon:wP,hint:"Smartest model, highest credit cost"}];
17323function yue({value:e,onChange:n,onSend:i,canSend:r,modelTier:o="balanced",onModelTierChange:s,placeholder:a="Ask anything about your project...",ariaLabel:c="Chat input",disabledMessage:u=null,isCorePlan:m=!1,isOwner:h=!1,workspaceId:g}){const x=e.length>=ni.chatUserMessageMaxChars,[y,w]=l.useState(!1),j=l.useRef(null),[v,_]=l.useState(!1),$=n4.find(S=>S.key===o)||n4[1],k=l.useCallback(()=>w(!1),[]);l.useEffect(()=>{if(!y)return;const S=I=>{j.current&&!j.current.contains(I.target)&&k()};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[y,k]);const P=!r&&!!u;return t.jsxs(t.Fragment,{children:[t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[t.jsxs(yxt,{children:[t.jsx(bxt,{style:P?{opacity:.5,transition:"opacity 0.2s ease"}:{transition:"opacity 0.2s ease"},placeholder:P?"Credits exhausted":a,value:e,onChange:S=>n(S.target.value),maxLength:ni.chatUserMessageMaxChars,onKeyDown:S=>{S.key==="Enter"&&!S.shiftKey&&(S.preventDefault(),i())},"aria-label":c,disabled:P}),s?t.jsxs(Mxt,{ref:j,children:[t.jsxs(Rxt,{type:"button",onClick:()=>w(S=>!S),title:`Model: ${$.label}`,$active:y,children:[t.jsx(wP,{size:14}),t.jsx(qn,{size:10,style:{opacity:.5}})]}),y?t.jsx(Oxt,{children:n4.map(S=>{const I=S.icon,A=o===S.key,E=m&&S.key==="pro",B=t.jsxs(Dxt,{type:"button",$selected:A,$locked:E,onClick:()=>{E||(s(S.key),k())},children:[t.jsx(Lxt,{$selected:A,$locked:E,children:E?t.jsx(ku,{size:13}):t.jsx(I,{size:14})}),t.jsxs("div",{style:{flex:1,minWidth:0},children:[t.jsx(Fxt,{children:S.label}),t.jsx(Wxt,{children:E?h?"Upgrade to Grow or Pro+ to unlock":"Ask your workspace owner to upgrade":S.hint})]}),E&&h&&g?t.jsx(Bxt,{type:"button",onClick:T=>{T.stopPropagation(),_(!0),k()},children:"Upgrade"}):null]},S.key);return S.key==="pro"?t.jsx(at,{content:E?"Pro uses the most powerful model and costs significantly more credits per message. Upgrade your plan to unlock it.":"Pro uses the most powerful model and costs significantly more credits per message.",placement:"top",maxWidth:260,children:B},S.key):B})}):null]}):null,t.jsx(xxt,{style:P?{opacity:.5,transition:"opacity 0.2s ease"}:{transition:"opacity 0.2s ease"},type:"button",$tone:"primary",$disabled:!r,"aria-label":"Send",onClick:i,disabled:!r,children:t.jsx(Sn,{size:16})})]}),!r&&u?t.jsx("div",{style:{fontSize:12,fontWeight:750,color:"rgba(148, 163, 184, 0.95)"},children:u}):null,x?t.jsxs("div",{style:{fontSize:12,fontWeight:750,color:"rgba(148, 163, 184, 0.95)"},children:["Message is limited to ",ni.chatUserMessageMaxChars," characters."]}):null]}),g?t.jsx(ec,{isOpen:v,orgId:Number(g),onClose:()=>_(!1)}):null]})}const Mxt=p.div.withConfig({displayName:"ChatComposerBar__ModelPickerWrap",componentId:"sc-uys3un-0"})` 17324 position: relative; 17325 flex-shrink: 0; 17326`,Rxt=p.button.withConfig({displayName:"ChatComposerBar__ModelTrigger",componentId:"sc-uys3un-1"})` 17327 display: inline-flex; 17328 align-items: center; 17329 justify-content: center; 17330 gap: 0.2rem; 17331 width: 38px; 17332 height: 38px; 17333 border-radius: 0.65rem; 17334 border: 1px solid ${e=>e.$active?"rgba(79,70,229,0.25)":"transparent"}; 17335 background: ${e=>e.$active?"rgba(79,70,229,0.06)":"transparent"}; 17336 color: ${e=>e.$active?"rgb(79,70,229)":Pe}; 17337 cursor: pointer; 17338 flex-shrink: 0; 17339 transition: all 0.15s ease; 17340 17341 &:hover { 17342 background: ${$e}; 17343 color: ${O}; 17344 border-color: ${V}; 17345 } 17346`,Oxt=p.div.withConfig({displayName:"ChatComposerBar__ModelMenu",componentId:"sc-uys3un-2"})` 17347 position: absolute; 17348 bottom: calc(100% + 0.5rem); 17349 right: 0; 17350 min-width: 230px; 17351 background: ${Z}; 17352 border: 1px solid ${V}; 17353 border-radius: 0.75rem; 17354 box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06); 17355 padding: 0.35rem; 17356 z-index: 50; 17357 animation: modelMenuIn 120ms ease; 17358 17359 @keyframes modelMenuIn { 17360 from { 17361 opacity: 0; 17362 transform: translateY(4px) scale(0.97); 17363 } 17364 to { 17365 opacity: 1; 17366 transform: translateY(0) scale(1); 17367 } 17368 } 17369`,Dxt=p.button.withConfig({displayName:"ChatComposerBar__ModelMenuItem",componentId:"sc-uys3un-3"})` 17370 display: flex; 17371 align-items: center; 17372 gap: 0.6rem; 17373 width: 100%; 17374 padding: 0.55rem 0.6rem; 17375 border: none; 17376 border-radius: 0.5rem; 17377 background: ${e=>e.$locked?"rgba(148,163,184,0.04)":e.$selected?"rgba(79,70,229,0.06)":"transparent"}; 17378 cursor: ${e=>e.$locked?"default":"pointer"}; 17379 opacity: ${e=>e.$locked?.6:1}; 17380 text-align: left; 17381 transition: background 0.12s ease; 17382 17383 &:hover { 17384 background: ${e=>e.$locked?"rgba(148,163,184,0.07)":e.$selected?"rgba(79,70,229,0.09)":$e}; 17385 } 17386`,Lxt=p.div.withConfig({displayName:"ChatComposerBar__ModelMenuIcon",componentId:"sc-uys3un-4"})` 17387 width: 28px; 17388 height: 28px; 17389 border-radius: 0.45rem; 17390 border: 1px solid ${e=>e.$locked?V:e.$selected?"rgba(79,70,229,0.2)":V}; 17391 background: ${e=>e.$locked?"rgba(148,163,184,0.06)":e.$selected?"rgba(79,70,229,0.06)":Z}; 17392 color: ${e=>e.$locked?Pe:e.$selected?"rgb(79,70,229)":z}; 17393 display: flex; 17394 align-items: center; 17395 justify-content: center; 17396 flex-shrink: 0; 17397`,Bxt=p.button.withConfig({displayName:"ChatComposerBar__UpgradeLink",componentId:"sc-uys3un-5"})` 17398 font-size: 0.65rem; 17399 font-weight: 800; 17400 color: rgb(79, 70, 229); 17401 text-decoration: none; 17402 white-space: nowrap; 17403 padding: 0.2rem 0.5rem; 17404 border: none; 17405 border-radius: 0.35rem; 17406 background: rgba(79, 70, 229, 0.08); 17407 transition: background 0.12s ease; 17408 flex-shrink: 0; 17409 cursor: pointer; 17410 font: inherit; 17411 17412 &:hover { 17413 background: rgba(79, 70, 229, 0.15); 17414 } 17415`,Fxt=p.div.withConfig({displayName:"ChatComposerBar__ModelMenuLabel",componentId:"sc-uys3un-6"})` 17416 font-size: 0.78rem; 17417 font-weight: 800; 17418 color: ${O}; 17419 line-height: 1.2; 17420`,Wxt=p.div.withConfig({displayName:"ChatComposerBar__ModelMenuHint",componentId:"sc-uys3un-7"})` 17421 font-size: 0.65rem; 17422 font-weight: 600; 17423 color: ${z}; 17424 line-height: 1.2; 17425 margin-top: 0.1rem; 17426`,dj=[{icon:t.jsx(Eu,{size:16}),label:"Latest scan summary",prompt:"Give me a detailed summary of my latest scan results. How did my brand perform?",color:"#6366f1",bg:"rgba(99,102,241,0.08)"},{icon:t.jsx(Dc,{size:16}),label:"Visibility gaps",prompt:"What are my biggest visibility gaps right now? Where am I missing and what can I do about it?",color:"#8b5cf6",bg:"rgba(139,92,246,0.08)"},{icon:t.jsx(hxe,{size:16}),label:"Cross-model comparison",prompt:"Compare my brand's performance across all AI models. Where do I rank best and worst?",color:"#0ea5e9",bg:"rgba(14,165,233,0.08)"},{icon:t.jsx(To,{size:16}),label:"Competitor citations",prompt:"Which competitor domains are getting cited most in AI responses? How can I earn more citations?",color:"#f59e0b",bg:"rgba(245,158,11,0.08)"}],i4=[{icon:t.jsx(Rne,{size:16}),label:"Prioritize my actions",prompt:"Review my open actions and prioritize them by impact and effort. What should I tackle first?",color:"#10b981",bg:"rgba(16,185,129,0.08)"},{icon:t.jsx(qi,{size:16}),label:"Quick wins",prompt:"What are the easiest quick wins I can implement right now to improve my AI visibility?",color:"#14b8a6",bg:"rgba(20,184,166,0.08)"}],Uxt=[{icon:t.jsx(th,{size:16}),label:"Site health review",prompt:"Review my site audit health. What are the most critical technical issues I should fix?",color:"#ef4444",bg:"rgba(239,68,68,0.08)"}],r4=[{icon:t.jsx(Ks,{size:16}),label:"What to do next",prompt:"Based on all my data, what's the single most impactful thing I should do next?",color:"#f97316",bg
17426:"rgba(249,115,22,0.08)"},{icon:t.jsx(Cs,{size:16}),label:"Explore my prompts",prompt:"Show me an overview of my prompts and how they're performing across AI models.",color:"#6366f1",bg:"rgba(99,102,241,0.08)"}],Hxt=[{icon:t.jsx(Sn,{size:16}),label:"Getting started",prompt:"I'm new here. What is Ceyo and how does AI visibility monitoring work?",color:"#6366f1",bg:"rgba(99,102,241,0.08)"},{icon:t.jsx(qi,{size:16}),label:"Improve AI visibility",prompt:"What are the best strategies to improve my brand's visibility in AI search results?",color:"#10b981",bg:"rgba(16,185,129,0.08)"},{icon:t.jsx(To,{size:16}),label:"Understand AI search",prompt:"How do AI models like ChatGPT, Gemini, and Perplexity decide which brands to mention?",color:"#0ea5e9",bg:"rgba(14,165,233,0.08)"}];function qxt(e){const{hasRun:n,hasSiteAudit:i,hasPrompts:r}=e;if(!n)return[...Hxt,...r4.slice(0,1),...i4.slice(1,2),...dj.slice(0,1)].slice(0,6);const o=[];return o.push(dj[0],dj[1]),o.push(dj[2]),o.push(dj[3]),i&&o.push(Uxt[0]),o.push(i4[0]),r&&o.push(r4[1]),o.push(r4[0]),o.push(i4[1]),o.slice(0,6)}const Gxt=p.div.withConfig({displayName:"ChatEmptyState__Outer",componentId:"sc-o2xcon-0"})` 17427 width: 100%; 17428 max-width: 44rem; 17429 display: flex; 17430 flex-direction: column; 17431 gap: 1.5rem; 17432 align-items: center; 17433 text-align: center; 17434`,Vxt=p.div.withConfig({displayName:"ChatEmptyState__GreetingWrap",componentId:"sc-o2xcon-1"})` 17435 display: flex; 17436 flex-direction: column; 17437 align-items: center; 17438 gap: 0.6rem; 17439`,Kxt=p.div.withConfig({displayName:"ChatEmptyState__IconCircle",componentId:"sc-o2xcon-2"})` 17440 width: 44px; 17441 height: 44px; 17442 border-radius: 50%; 17443 background: rgba(99, 102, 241, 0.1); 17444 display: flex; 17445 align-items: center; 17446 justify-content: center; 17447 color: ${ot}; 17448`,Yxt=p.h1.withConfig({displayName:"ChatEmptyState__Greeting",componentId:"sc-o2xcon-3"})` 17449 font-size: 1.35rem; 17450 font-weight: 950; 17451 color: ${O}; 17452 line-height: 1.15; 17453 margin: 0; 17454 letter-spacing: -0.015em; 17455`,Xxt=p.p.withConfig({displayName:"ChatEmptyState__Sub",componentId:"sc-o2xcon-4"})` 17456 margin: 0.15rem 0 0; 17457 font-size: 0.85rem; 17458 font-weight: 600; 17459 color: ${z}; 17460 line-height: 1.45; 17461 max-width: 28rem; 17462`,Qxt=p.div.withConfig({displayName:"ChatEmptyState__ActionsGrid",componentId:"sc-o2xcon-5"})` 17463 display: grid; 17464 grid-template-columns: repeat(3, 1fr); 17465 gap: 0.5rem; 17466 width: 100%; 17467 17468 @media (max-width: 640px) { 17469 grid-template-columns: repeat(2, 1fr); 17470 } 17471`,Zxt=p.button.withConfig({displayName:"ChatEmptyState__ActionCard",componentId:"sc-o2xcon-6"})` 17472 display: flex; 17473 flex-direction: column; 17474 align-items: flex-start; 17475 gap: 0.45rem; 17476 padding: 0.75rem 0.8rem; 17477 border-radius: 0.75rem; 17478 border: 1px solid ${V}; 17479 background: ${Z}; 17480 cursor: pointer; 17481 text-align: left; 17482 transition: all 0.15s ease; 17483 17484 &:hover { 17485 border-color: ${Rt}; 17486 background: ${e=>e.$bgColor}; 17487 transform: translateY(-1px); 17488 box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04); 17489 } 17490 17491 &:active { 17492 transform: translateY(0); 17493 } 17494 17495 &:disabled { 17496 opacity: 0.5; 17497 cursor: not-allowed; 17498 transform: none; 17499 &:hover { 17500 border-color: ${V}; 17501 background: ${Z}; 17502 box-shadow: none; 17503 } 17504 } 17505`,Jxt=p.span.withConfig({displayName:"ChatEmptyState__ActionIcon",componentId:"sc-o2xcon-7"})` 17506 display: inline-flex; 17507 align-items: center; 17508 justify-content: center; 17509 width: 28px; 17510 height: 28px; 17511 border-radius: 0.5rem; 17512 background: ${e=>e.$bg}; 17513 color: ${e=>e.$color}; 17514 flex-shrink: 0; 17515`,ebt=p.span.withConfig({displayName:"ChatEmptyState__ActionLabel",componentId:"sc-o2xcon-8"})` 17516 font-size: 0.78rem; 17517 font-weight: 750; 17518 color: ${O}; 17519 line-height: 1.25; 17520`;function BQ({projectName:e,composerText:n,setComposerText:i,canSend:r,sendDisabledMessage:o,canCreateChat:s,onSend:a,onQuickAction:c,hasSuccessfulRun:u=!1,hasSiteAudit:m=!1,activePromptsCount:h=0,isCrunching:g=!1,modelTier:x,onModelTierChange:y,isCorePlan:w,isOwner:j,workspaceId:v}){const _=l.useMemo(()=>qxt({hasRun:u,hasSiteAudit:m,hasPrompts:(h??0)>0}),[u,m,h]),$=g?"Your first scan is running. In the meantime, ask me anything about AI visibility strategies.":u?"Explore your AI visibility data, analyze rankings across models, and get actionable recommendations.":"Ask questions about AI search optimization, or pick a topic below to get started.";return t.jsx(vxt,{children:t.jsxs(Gxt,{children:[t.jsxs(Vxt,{children:[t.jsx(Kxt,{children:t.jsx(Sn,{size:22})}),t.jsxs("div",{children:[t.jsx(Yxt,{children:"What can I help with?"}),t.jsx(Xxt,{children:$})]})]}),t.jsx(rD,{children:t.jsx("div",{style:{width:"100%",maxWidth:"35rem"},children:t.jsx(yue,{value:n,onChange:i,onSend:a,canSend:r,disabledMessage:o,modelTier:x,onModelTierChange:y,isCorePlan:w,isOwner:j,workspaceId:v})})}),t.jsx(Qxt,{children:_.map(k=>t.jsxs(Zxt,{$bgColor:k.bg,$accentColor:k.color,onClick:()=>c(k.prompt),disabled:!s,title:s?k.prompt:"Billing is inactive",children:[t.jsx(Jxt,{$color:k.color,$bg:k.bg,children:k.icon}),t.jsx(ebt,{children:k.label})]},k.label))})]})})}const tbt={project_action:"Action",prompt:"Prompt"};
17520function nbt({title:e,subtitle:n,hasSelected:i,canManageChat:r,canCreateChat:o,metadata:s,onRename:a,onDelete:c,onOpenHistory:u,onNewChat:m}){const h=typeof s?.resource_type=="string"?s.resource_type:null,g=h?tbt[h]||h.replace(/_/g," "):null;return t.jsx(txt,{children:t.jsxs(nxt,{children:[t.jsxs("div",{style:{minWidth:0,display:"flex",flexDirection:"column",gap:"0.15rem"},children:[t.jsxs(axt,{children:[i?null:t.jsx(Sn,{size:16,style:{color:ot,flexShrink:0}}),t.jsx(ixt,{children:i?e:"New conversation"}),i&&r?t.jsx(wre,{buttonLabel:"Chat options",buttonTitle:"Chat options",icon:t.jsx(Sye,{size:18}),items:[{key:"rename",label:"Rename",icon:t.jsx(Lc,{size:16}),onClick:a},{key:"delete",label:"Delete",icon:t.jsx(Fi,{size:16}),danger:!0,onClick:c}],align:"left",buttonPx:34,menuMinWidthPx:180}):null]}),i&&(n||g)?t.jsxs(rxt,{children:[n,g&&t.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"0.2rem",fontSize:"0.65rem",fontWeight:700,color:Ft,background:"rgba(79, 70, 229, 0.08)",padding:"0.1rem 0.35rem",borderRadius:"4px",marginLeft:n?"0.5rem":0},children:[t.jsx(bP,{size:9}),g]})]}):null]}),t.jsxs(sxt,{children:[t.jsx(he,{variant:"outline",size:"sm",leftIcon:t.jsx(txe,{size:16}),onClick:u,children:"Chats"}),o&&i?t.jsx(he,{variant:"primary",size:"sm",leftIcon:t.jsx(O0e,{size:16}),onClick:m,children:"New chat"}):null]})]})})}const ibt={project_action:"Action",prompt:"Prompt"};function rbt(e){if(!e)return null;const n=e.resource_type;return typeof n!="string"||!n?null:ibt[n]||n.replace(/_/g," ")}function obt({open:e,projectName:n,search:i,onSearchChange:r,sessions:o,selectedId:s,onSelect:a,onClose:c,canManageChat:u,canCreateChat:m,hasSelected:h,onNewChat:g,onRequestDelete:x,onScroll:y,hasMore:w,loading:j}){return t.jsxs(t.Fragment,{children:[t.jsx(Cxt,{$open:e,onMouseDown:c,"aria-hidden":!e}),t.jsxs(Sxt,{$open:e,"aria-hidden":!e,children:[t.jsxs(kxt,{children:[t.jsxs("div",{style:{minWidth:0},children:[t.jsx($xt,{children:"Chats"}),t.jsx("div",{style:{marginTop:4,fontSize:12,fontWeight:800,color:z},children:n?`Project: ${n}`:"Project chats"})]}),t.jsx(LQ,{type:"button","aria-label":"Close chats",onClick:c,children:t.jsx(Ei,{size:16})})]}),t.jsxs(Ixt,{onScroll:y,children:[t.jsxs(Pxt,{children:[m&&h?t.jsx(he,{fullWidth:!0,leftIcon:t.jsx(gr,{size:16}),onClick:g,children:"New conversation"}):null,t.jsx("div",{style:{marginTop:10},children:t.jsx(Xt,{placeholder:"Search chatsâ¦",value:i,onChange:v=>r(v.target.value),leftIcon:t.jsx(Cs,{size:16})})})]}),t.jsxs(Axt,{children:[o.length===0?t.jsx("div",{style:{padding:"0.75rem 0.25rem",color:z,fontWeight:800,fontSize:13},children:"No chats yet."}):t.jsx(Nxt,{children:o.map(v=>{const _=hue(v.updated_at)||"â",$=rbt(v.metadata);return t.jsxs(zxt,{$active:v.id===s,role:"button",tabIndex:0,onClick:()=>a(v.id),onKeyDown:k=>{(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),a(v.id))},children:[t.jsxs("div",{style:{minWidth:0},children:[t.jsx(Txt,{title:v.title,children:v.title||"New chat"}),t.jsxs(Ext,{children:[t.jsx("span",{children:_}),$&&t.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"0.2rem",fontSize:"0.65rem",fontWeight:700,color:Ft,background:"rgba(79, 70, 229, 0.08)",padding:"0.1rem 0.35rem",borderRadius:"4px"},children:[t.jsx(bP,{size:9}),$]})]})]}),u?t.jsx(LQ,{type:"button","aria-label":`Delete chat ${v.title}`,title:"Delete",onClick:k=>{k.stopPropagation(),x(v.id)},children:t.jsx(Fi,{size:16})}):null]},v.id)})}),w&&j?t.jsxs(gue,{"aria-label":"Loading more chats",children:[t.jsx(nt,{height:14,width:"92%",radius:10}),t.jsx(nt,{height:14,width:"78%",radius:10}),t.jsx(nt,{height:14,width:"86%",radius:10})]}):null]})]})]})]})}function sbt({endRef:e}){return t.jsxs(wxt,{children:[t.jsx(jxt,{children:t.jsxs(fue,{children:[t.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1.05rem"},children:[0,1,2,3,4].map(n=>t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,alignItems:n%2===0?"flex-start":"flex-end"},children:[t.jsx(nt,{height:12,width:n%2===0?"120px":"92px",radius:10}),t.jsx(nt,{height:14,width:n%2===0?"56%":"44%",radius:12}),t.jsx(nt,{height:14,width:n%2===0?"62%":"38%",radius:12})]},`sk-msg-${n}`))}),t.jsx("div",{ref:e})]})}),t.jsx(_xt,{children:t.jsx(rD,{children:t.jsx("div",{style:{width:"100%",maxWidth:"74rem"}
17520,children:t.jsx(nt,{height:92,radius:18})})})})]})}const FQ={flash:"Fast",balanced:"Balanced",pro:"Pro"};function abt({messages:e,olderLoading:n,messagesScrollRef:i,endRef:r,onScroll:o,onRetryAssistant:s,composerText:a,setComposerText:c,onSend:u,canRetry:m,canSend:h,sendDisabledMessage:g,modelTier:x,onModelTierChange:y,isCorePlan:w,isOwner:j,workspaceId:v}){return t.jsxs(t.Fragment,{children:[t.jsx(cxt,{ref:i,onScroll:o,children:t.jsx(fue,{children:t.jsxs(dxt,{children:[t.jsx("div",{style:{padding:"0 0.35rem"},children:t.jsx(oxt,{children:"Responses are generated using AI and may contain incorrect information."})}),n?t.jsx("div",{"aria-label":"Loading older messages",style:{padding:"0.25rem 0.25rem 0.75rem"},children:t.jsxs(gue,{children:[t.jsx(nt,{height:12,width:"62%",radius:10}),t.jsx(nt,{height:12,width:"54%",radius:10}),t.jsx(nt,{height:12,width:"68%",radius:10})]})}):null,e.map(_=>t.jsx(uxt,{$role:_.role,children:t.jsxs(pxt,{$role:_.role,children:[t.jsxs(mxt,{$role:_.role,children:[t.jsx(hxt,{$role:_.role,children:_.role==="user"?"User":"Agent"}),t.jsx(rr,{value:_.created_at,format:"datetime",timeZoneMode:"viewer",options:{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"},placeholder:""}),_.role==="assistant"&&_.status==="done"&&_.metadata?.model_tier?t.jsx(DQ,{title:`Model: ${FQ[_.metadata.model_tier]||_.metadata.model_tier}`,children:FQ[_.metadata.model_tier]||_.metadata.model_tier}):null,_.role==="assistant"&&_.status==="done"&&_.metadata?.credits_charged?t.jsxs(DQ,{children:[t.jsx(vy,{size:10}),_.metadata.credits_charged]}):null]}),t.jsx(fxt,{$role:_.role,children:_.role==="assistant"?_.status==="failed"?_.metadata?.error_code==="provider_rate_limit"?"The AI service is temporarily busy. Please try again in a few minutes.":"Something went wrong.":_.status==="pending"||_.status==="streaming"?_.content?t.jsx(X5,{wrap:"none",markdown:_.content}):"Thinkingâ¦":t.jsx(X5,{wrap:"none",markdown:_.content}):_.content}),_.role==="assistant"&&_.status==="failed"&&m&&_.metadata?.error_code!=="provider_rate_limit"?t.jsx("div",{style:{marginTop:6},children:t.jsxs(he,{variant:"outline",size:"sm",onClick:()=>s(_.id),children:[t.jsx(Sn,{size:13,style:{marginRight:4}}),"Retry"]})}):null]})},_.id)),t.jsx("div",{ref:r})]})})}),t.jsx(gxt,{children:t.jsx(rD,{children:t.jsx("div",{style:{width:"100%",maxWidth:"74rem"},children:t.jsx(yue,{value:a,onChange:c,onSend:u,canSend:h,disabledMessage:g,modelTier:x,onModelTierChange:y,isCorePlan:w,isOwner:j,workspaceId:v})})})})]})}function lbt({confirmDelete:e,onCloseDelete:n,onConfirmDelete:i,renameOpen:r,onCloseRename:o,renameValue:s,setRenameValue:a,onSubmitRename:c}){return t.jsxs(t.Fragment,{children:[t.jsx(Hn,{isOpen:!!e,onClose:n,title:"Delete chat?",description:e?`This will delete "${e.title}".`:void 0,size:"sm",footer:t.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:10},children:[t.jsx(he,{variant:"outline",onClick:n,children:"Cancel"}),t.jsx(he,{variant:"danger",onClick:()=>{e&&i(e.id),n()},children:"Delete"})]}),children:t.jsx("div",{style:{fontSize:14,fontWeight:750,color:z,lineHeight:1.45},children:"You canât undo this action."})}),t.jsx(Hn,{isOpen:r,onClose:o,title:"Rename chat",size:"sm",footer:t.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:10},children:[t.jsx(he,{variant:"outline",onClick:o,children:"Cancel"}),t.jsx(he,{variant:"primary",onClick:c,disabled:!s.trim(),children:"Save"})]}),children:t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[t.jsx("div",{style:{fontSize:13,fontWeight:800,color:z},children:"Chat name"}),t.jsx(Xt,{value:s,onChange:u=>a(u.target.value),placeholder:"Enter a nameâ¦"})]})})]})}function cbt({subscribe:e,setSessions:n,messageFromDTO:i,onError:r,onCreditsUpdated:o}){const s=l.useRef(null),a=l.useRef(""),c=l.useRef(!1),u=l.useRef(null),m=l.useRef(r),h=l.useRef(o);l.useEffect(()=>{m.current=r},[r]),l.useEffect(()=>{h.current=o},[o]);const g=l.useCallback(v=>{const _=v?.type;if(_==="chat_message_created"||_==="chat_message_updated"){const $=v?.message;if(!$)return;const k=String($.chat_session_id),P=i($),S=P.metadata?.client_nonce;n(I=>{const A=I.map(E=>{if(E.id!==k)return E;const B=Array.isArray(E.messages)?[...E.messages]:[],T=B.findIndex(M=>M.id===P.id);if(T>=0)B[T]={...B[T],...P};else if(S){const M=B.findIndex(R=>R.id.startsWith("local-")&&R.metadata?.client_nonce===S&&R.role===P.role);M>=0?B[M]={...P}:B.push(P)}else B.push(P);return B.sort((M,R)=>String(M.created_at).localeCompare(String(R.created_at))),{...E,updated_at:P.updated_at||E.updated_at,messages:B,messages_loaded:!0}});
17520return A.sort((E,B)=>String(B.updated_at).localeCompare(String(E.updated_at))),A})}else if(_==="chat_session_updated"){const $=v?.session;if(!$)return;const k=String($.id);n(P=>{const S=P.map(I=>I.id!==k?I:{...I,title:String($.title||I.title),updated_at:String($.updated_at||I.updated_at)});return S.sort((I,A)=>String(A.updated_at).localeCompare(String(I.updated_at))),S})}else if(_==="credits_updated")try{h.current?.({credits_used:typeof v?.credits_used=="number"?v.credits_used:0,credits_remaining:typeof v?.credits_remaining=="number"?v.credits_remaining:0,credits_total:typeof v?.credits_total=="number"?v.credits_total:0})}catch{}else if(_==="chat_error"){console.error("[chat] server error:",v?.error);try{m.current?.({error:typeof v?.error=="string"?v.error:void 0,error_code:typeof v?.error_code=="string"?v.error_code:void 0,credits_remaining:typeof v?.credits_remaining=="number"?v.credits_remaining:void 0,credits_total:typeof v?.credits_total=="number"?v.credits_total:void 0,client_nonce:typeof v?.client_nonce=="string"?v.client_nonce:void 0})}catch{}}},[i,n]),x=l.useCallback(v=>{if(v&&!(s.current&&a.current===v)){try{s.current?.unsubscribe?.()}catch{}a.current=v,c.current=!1,s.current=e({channel:"ChatChannel",chat_session_id:Number(v)},{connected:()=>{c.current=!0;const _=u.current;if(_){u.current=null;try{s.current?.perform?.(_.action,_.data)}catch{}}},disconnected:()=>{c.current=!1},received:g})||null}},[g,e]),y=l.useCallback((v,_)=>{const $=a.current;if($){if(!s.current||!c.current){u.current={action:v,data:_},x($);return}try{s.current.perform(v,_)}catch{u.current={action:v,data:_},x($)}}},[x]),w=l.useCallback(()=>{try{s.current?.unsubscribe?.()}catch{}s.current=null,a.current="",c.current=!1,u.current=null},[]),j=l.useCallback((v,_)=>{if(!v)return;const $=Number(_);!Number.isFinite($)||$<=0||(x(v),n(k=>k.map(P=>P.id!==v?P:{...P,messages:(P.messages||[]).map(S=>S.id===_?{...S,status:"pending",content:""}:S)})),y("retry_message",{assistant_message_id:$}))},[y,n,x]);return{subscribeToSession:x,performChatAction:y,retryAssistantMessage:j,unsubscribeFromCurrent:w}}function dbt({orgId:e,projectId:n,selectedId:i,setSessions:r,subscribeToSession:o,unsubscribeFromCurrent:s,messageFromDTO:a,selectedMessagesLength:c}){const u=l.useRef(null),m=l.useRef(null),h=l.useRef(!0),[g,x]=l.useState(""),y=!!i&&g===i,[w,j]=l.useState({oldestId:null,hasMore:!1,loading:!1,sessionId:""}),v=l.useRef(w),_=l.useRef({sessionId:"",beforeId:null});l.useEffect(()=>{v.current=w},[w]),l.useEffect(()=>{h.current&&u.current?.scrollIntoView({behavior:"smooth"})},[c]),l.useEffect(()=>{let P=!1;if(!i){s(),x(""),j({oldestId:null,hasMore:!1,loading:!1,sessionId:""});return}if(!(!Number.isFinite(e)||e<=0)&&!(!Number.isFinite(n)||n<=0))return o(i),(async()=>{try{x(i);const S=await c8(e,n,Number(i),{limit:50});if(P)return;const I=(S.messages||[]).map(B=>a(B));r(B=>B.map(T=>T.id===i?{...T,messages:I,messages_loaded:!0}:T));const A=S.pagination?.oldest_id??null,E=!!S.pagination?.has_more;j({oldestId:A,hasMore:E,loading:!1,sessionId:i}),h.current=!0,requestAnimationFrame(()=>u.current?.scrollIntoView({behavior:"auto"}))}catch(S){console.error("[chat] failed to load messages:",S)}finally{P||x("")}})(),()=>{P=!0}},[a,e,n,i,r,o,s]);const $=l.useCallback(async()=>{const P=i;if(!P||!Number.isFinite(e)||e<=0||!Number.isFinite(n)||n<=0)return;const S=v.current;if(S.loading||S.sessionId!==P||!S.hasMore||!S.oldestId)return;const I=_.current;if(I.sessionId===P&&I.beforeId===S.oldestId)return;_.current={sessionId:P,beforeId:S.oldestId};const A=m.current;if(!A)return;v.current={...S,loading:!0},j({...S,loading:!0});const E=A.scrollHeight,B=A.scrollTop;try{const T=await c8(e,n,Number(P),{limit:50,before_id:S.oldestId}),M=(T.messages||[]).map(Y=>a(Y)),R=T.pagination?.oldest_id??null,F=!!T.pagination?.has_more;h.current=!1,r(Y=>Y.map(H=>{if(H.id!==P)return H;const U=Array.isArray(H.messages)?H.messages:[],X=new Map;for(const K of M)X.set(K.id,K);for(const K of U)X.set(K.id,K);const Q=Array.from(X.values());return Q.sort((K,G)=>String(K.created_at).localeCompare(String(G.created_at))),{...H,messages:Q,messages_loaded:!0}})),requestAnimationFrame(()=>{const Y=A.scrollHeight;A.scrollTop=B+(Y-E)}),v.current={oldestId:R,hasMore:F,loading:!1,sessionId:P},j({oldestId:R,hasMore:F,loading:!1,sessionId:P})}catch(T){console.error("[chat] failed to load older messages:",T),v.current={...v.current,loading:!1},j(M=>M.sessionId===P?{...M,loading:!1}:M)}finally{_.current.sessionId===P&&(_.current={sessionId:"",beforeId:null})}},[a,e,n,i,r]),k=l.useCallback(()=>{const P=m.current;if(!P)return;const S=P.scrollHeight-P.scrollTop-P.clientHeight;h.current=S<140,P.scrollTop<120&&$()},[$]);return{endRef:u,messagesScrollRef:m,onMessagesScroll:k,olderLoading:w.sessionId===i&&w.loading,isSelectedMessagesLoading:y}}function ubt({orgId:e,projectId:n,selectedId:i,searchParams:r,setSearchParams:o}){const[s,a]=l.useState([]),[c,u]=l.useState(1),[m,h]=l.useState(!0),[g,x]=l.useState(!1),y=l.useMemo(()=>s.find(v=>v.id===i)||null,[i,s]);l.useEffect(()=>{let v=!1;if(!(!Number.isFinite(e)||e<=0)&&!(!Number.isFinite(n)||n<=0))return(async()=>{try{x(!0);const _=await eK(e,n,{page:1,per_page:25});if(v)return;const $=(_.sessions||[]).map(P=>j8(P));$.sort((P,S)=>String(S.updated_at).localeCompare(String(P.updated_at))),a($),u(1);const k=_.pagination?.total_pages||1;h(1<k)}catch(_){if(console.error("[chat] failed to load sessions:",_),v)return;a([]),h(!1)}v||x(!1)})(),()=>{v=!0}},[e,n]),l.useEffect(()=>{if(!i||!s.length||s.some(_=>_.id===i))return;const v=new URLSearchParams(r);v.delete("chatId"),o(v,{replace:!0})},[i,s.length]);const w=l.useCallback(async()=>
17520{if(!Number.isFinite(e)||e<=0||!Number.isFinite(n)||n<=0||g||!m)return;const v=c+1;x(!0);try{const _=await eK(e,n,{page:v,per_page:25}),$=(_.sessions||[]).map(P=>j8(P));a(P=>{const S=new Map;for(const A of P)S.set(A.id,A);for(const A of $){const E=S.get(A.id);E?S.set(A.id,{...E,title:A.title,updated_at:A.updated_at,created_at:A.created_at}):S.set(A.id,A)}const I=Array.from(S.values());return I.sort((A,E)=>String(E.updated_at).localeCompare(String(A.updated_at))),I}),u(v);const k=_.pagination?.total_pages||v;h(v<k)}catch(_){console.error("[chat] failed to load more sessions:",_),h(!1)}finally{x(!1)}},[m,g,c,e,n]),j=l.useCallback(v=>{const _=v.currentTarget;_.scrollHeight-_.scrollTop-_.clientHeight<240&&w()},[w]);return{sessions:s,setSessions:a,selected:y,historyHasMore:m,historyLoading:g,onHistoryScroll:j}}function pbt(){const{workspaceId:e,projectId:n}=Gn(),{projects:i}=Mr(),{subscribe:r}=wo(),{user:o}=yn(),[s,a]=yr(),c=Number(e),u=Number(n),m=l.useMemo(()=>i.find(Le=>Le.id===u)||null,[u,i]),h=`/workspaces/${e}/projects/${n}`,{showToast:g}=Uo(),x=o?.organizations?.find(Le=>Le.id===c)||null,y=!!(m?.can?.edit||m?.can?.settings),w=!!x?.billing_active_for_spend&&y,j=l.useMemo(()=>x?.role||null,[x?.role]),v=j==="owner",_=x?.plan_family==="core",$=!!x?.partner_managed,[k,P]=l.useState(null),[S,I]=l.useState(null),[A,E]=l.useState(!1),[B,T]=l.useState(!1),[M,R]=l.useState(""),[F,Y]=l.useState("balanced");l.useEffect(()=>{_&&F==="pro"&&Y("balanced")},[_,F]),l.useEffect(()=>{T(!1)},[F]);const H={flash:2,balanced:10,pro:30},U=l.useMemo(()=>w?B?!0:k==null?!1:k<(H[F]??10):!1,[k,w,F,B]),X=l.useMemo(()=>{if(!U)return null;if($)return"No credits remaining. Contact your partner to upgrade.";const Le=t.jsx("button",{onClick:()=>E(!0),style:{color:"inherit",fontWeight:850,textDecoration:"underline",background:"none",border:"none",padding:0,font:"inherit",cursor:"pointer"},children:"Upgrade your plan"}),Ue=k!=null&&k>0?"Not enough credits for this model.":"No credits remaining.";return j==="owner"?t.jsxs(t.Fragment,{children:[Ue," ",Le," to continue."]}):`${Ue} Ask your workspace owner to upgrade.`},[U,j,$,k]),[Q,K]=l.useState(!1),[G,L]=l.useState(""),q=s.get("chatId")||"",{sessions:W,setSessions:oe,selected:se,historyHasMore:de,historyLoading:le,onHistoryScroll:me}=ubt({orgId:c,projectId:u,selectedId:q,searchParams:s,setSearchParams:a}),ee=l.useMemo(()=>se?(se.messages||[]).some(Le=>Le.role==="assistant"&&(Le.status==="pending"||Le.status==="streaming")):!1,[se]),ne=w&&M.trim().length>0&&M.trim().length<=ni.chatUserMessageMaxChars&&(!se||!ee)&&!U;l.useEffect(()=>{let Le=!1;if(!w){P(null),I(null);return}if(!(!Number.isFinite(c)||c<=0))return I(null),(async()=>{try{const Ue=await ue(`/api/v1/organizations/${c}/chat_usage`,{method:"GET"}),We=await Ue.json().catch(()=>({}));if(!Ue.ok)throw new Error(We?.error||We?.errors?.[0]||"Failed to load chat usage");const Qe=We?.chat_usage||{};if(Le)return;P(Number(Qe?.credits_remaining)||0)}catch(Ue){if(Le)return;P(null),I(Ue?.message||"Failed to load chat usage")}})(),()=>{Le=!0}},[w,c]);const[Ae,_e]=l.useState(null),we=l.useMemo(()=>W.find(Le=>Le.id===Ae)||null,[Ae,W]),[Ke,ce]=l.useState(!1),[ie,Re]=l.useState(""),{subscribeToSession:Be,performChatAction:tt,retryAssistantMessage:dt,unsubscribeFromCurrent:je}=cbt({subscribe:r,setSessions:oe,messageFromDTO:OQ,onCreditsUpdated:Le=>{P(Le.credits_remaining),T(!1),Fo()},onError:Le=>{if(Le)if(Le.error_code==="credits_insufficient"){if(Le.client_nonce){const Ue=Le.client_nonce;oe(We=>We.map(Qe=>{if(!se||Qe.id!==se.id)return Qe;const ht=Array.isArray(Qe.messages)?Qe.messages:[],pe=ht.filter(be=>!(String(be.id).startsWith("local-")&&be.metadata?.client_nonce===Ue));return pe.length===ht.length?Qe:{...Qe,messages:pe}}))}typeof Le.credits_remaining=="number"&&P(Le.credits_remaining),T(!0),g("Not enough credits to send a message. Upgrade your plan to continue.",{tone:"error"})}else Le.error_code==="provider_rate_limit"&&g("The AI service is temporarily busy. Please try again in a few minutes.",{tone:"info"})}}),{endRef:Me,messagesScrollRef:Se,onMessagesScroll:it,olderLoading:De,isSelectedMessagesLoading:te}=dbt({orgId:c,projectId:u,selectedId:q,setSessions:oe,subscribeToSession:Be,unsubscribeFromCurrent:je,messageFromDTO:OQ,selectedMessagesLength:se?.messages?.length||0}),ge=l.useMemo(()=>{const Le=G.trim().toLowerCase();return Le?W.filter(Ue=>String(Ue.title||"").toLowerCase().includes(Le)):W},[G,W]),Je=Le=>{const Ue=new URLSearchParams(s);Le?Ue.set("chatId",Le):Ue.delete("chatId"),a(Ue,{replace:!0})},Ee=l.useCallback(async Le=>{if(!y||!Number.isFinite(c)||c<=0||!Number.isFinite(u)||u<=0)return;const Ue=Number(Le);if(!(!Number.isFinite(Ue)||Ue<=0)){try{await mJe(c,u,Ue)}catch(We){console.error("[chat] delete session failed:",We);return}oe(We=>We.filter(Qe=>Qe.id!==Le)),q===Le&&(Je(""),je())}},[y,c,u,q,je]),Xe=l.useCallback(()=>
17520{if(!w||U)return;const Le=M.trim();if(!Le||Le.length>ni.chatUserMessageMaxChars||!se||ee)return;Be(se.id);const Ue=e4(),We=fy(),Qe={id:`local-${Ue}-user`,role:"user",content:Le,status:"done",metadata:{client_nonce:Ue},created_at:We,updated_at:We},ht={id:`local-${Ue}-assistant`,role:"assistant",content:"",status:"pending",metadata:{client_nonce:Ue},created_at:We,updated_at:We};oe(pe=>{const be=pe.map(rt=>{if(rt.id!==se.id)return rt;const ze=Array.isArray(rt.messages)?[...rt.messages]:[];ze.push(Qe,ht);const vt=(rt.messages||[]).length===0?t4(Le):rt.title;return{...rt,updated_at:We,title:vt||rt.title,messages:ze,messages_loaded:!0}});return be.sort((rt,ze)=>String(ze.updated_at).localeCompare(String(rt.updated_at))),be}),tt("send_message",{content:Le,client_nonce:Ue,model_tier:F}),R("")},[U,w,M,F,tt,se,Be,ee]),yt=l.useCallback(async Le=>{if(!w||U)return;const Ue=String(Le||"").trim();if(!Ue||Ue.length>ni.chatUserMessageMaxChars||!Number.isFinite(c)||c<=0||!Number.isFinite(u)||u<=0||se&&ee)return;if(!se){try{const{session:ht}=await Kce(c,u,""),pe=j8(ht);pe.messages=[],pe.messages_loaded=!0,oe(ze=>[pe,...ze].sort((lt,vt)=>String(vt.updated_at).localeCompare(String(lt.updated_at)))),Je(pe.id),K(!1),Be(pe.id);const be=e4(),rt=fy();oe(ze=>ze.map(lt=>lt.id===pe.id?{...lt,updated_at:rt,title:t4(Ue)||lt.title,messages_loaded:!0,messages:[...lt.messages||[],{id:`local-${be}-user`,role:"user",content:Ue,status:"done",metadata:{client_nonce:be},created_at:rt},{id:`local-${be}-assistant`,role:"assistant",content:"",status:"pending",metadata:{client_nonce:be},created_at:rt}]}:lt)),tt("send_message",{content:Ue,client_nonce:be,model_tier:F}),R("")}catch(ht){console.error("[chat] create+send failed:",ht)}return}const We=e4(),Qe=fy();Be(se.id),oe(ht=>{const pe=ht.map(be=>{if(be.id!==se.id)return be;const rt=Array.isArray(be.messages)?[...be.messages]:[];rt.push({id:`local-${We}-user`,role:"user",content:Ue,status:"done",metadata:{client_nonce:We},created_at:Qe},{id:`local-${We}-assistant`,role:"assistant",content:"",status:"pending",metadata:{client_nonce:We},created_at:Qe});const lt=(be.messages||[]).length===0?t4(Ue):be.title;return{...be,updated_at:Qe,title:lt||be.title,messages:rt,messages_loaded:!0}});return pe.sort((be,rt)=>String(rt.updated_at).localeCompare(String(be.updated_at))),pe}),tt("send_message",{content:Ue,client_nonce:We,model_tier:F}),R("")},[U,w,F,c,tt,u,se,Be,ee]),Ne=l.useCallback(async()=>{if(!y||!se||!Number.isFinite(c)||c<=0||!Number.isFinite(u)||u<=0)return;const Le=ie.trim();if(Le)try{const Ue=await hJe(c,u,Number(se.id),Le);oe(We=>{const Qe=We.map(ht=>ht.id===String(Ue.id)?{...ht,title:String(Ue.title),updated_at:String(Ue.updated_at)}:ht);return Qe.sort((ht,pe)=>String(pe.updated_at).localeCompare(String(ht.updated_at))),Qe}),ce(!1)}catch(Ue){console.error("[chat] rename failed:",Ue)}},[y,c,u,ie,se]);return t.jsxs(J0t,{children:[t.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:"1rem",flexWrap:"wrap"},children:[t.jsx(Fy,{title:"Chat"}),t.jsx("div",{style:{paddingRight:8}
17520,children:t.jsx(qr,{items:[{label:"Projects",to:e?`/workspaces/${e}`:void 0},{label:m?.name||"Project",to:e&&n?h:void 0},{label:"Chat"}]})})]}),t.jsxs(ext,{children:[t.jsx(obt,{open:Q,projectName:m?.name,search:G,onSearchChange:L,sessions:ge,selectedId:q,onSelect:Le=>{Je(Le),K(!1)},onClose:()=>K(!1),canManageChat:y,canCreateChat:w,hasSelected:!!se,onNewChat:()=>{Je(""),je(),R(""),K(!1)},onRequestDelete:Le=>_e(Le),onScroll:me,hasMore:de,loading:le}),t.jsx(nbt,{title:se?se.title:"New conversation",subtitle:se&&hue(se.updated_at)||"",hasSelected:!!se,canManageChat:y,canCreateChat:w,metadata:se?.metadata,onRename:()=>{se&&y&&(Re(se.title||""),ce(!0))},onDelete:()=>{se&&y&&_e(se.id)},onOpenHistory:()=>K(!0),onNewChat:()=>{Je(""),je(),R(""),K(!1)}}),t.jsxs(lxt,{children:[se?!se.messages_loaded&&te?t.jsx(sbt,{endRef:Me}):se.messages.length===0?t.jsx(BQ,{projectName:m?.name,composerText:M,setComposerText:R,canSend:ne,sendDisabledMessage:X||(S?`Chat usage unavailable: ${S}`:null),canCreateChat:w&&!U,onSend:()=>{ee||yt(M)},onQuickAction:Le=>yt(Le),hasSuccessfulRun:!!m?.has_successful_run,hasSiteAudit:!!(m?.site_audit?.enumeration_pages_count&&m.site_audit.enumeration_pages_count>0),activePromptsCount:m?.active_prompts_count??0,isCrunching:!!m?.initial_crunching,modelTier:F,onModelTierChange:Y,isCorePlan:_,isOwner:v,workspaceId:e}):t.jsx(abt,{messages:se.messages,olderLoading:De,messagesScrollRef:Se,endRef:Me,onScroll:it,onRetryAssistant:Le=>{se&&w&&dt(se.id,Le)},composerText:M,setComposerText:R,onSend:()=>{ee||Xe()},canRetry:w,canSend:ne,sendDisabledMessage:X||null,modelTier:F,onModelTierChange:Y,isCorePlan:_,isOwner:v,workspaceId:e}):t.jsx(BQ,{projectName:m?.name,composerText:M,setComposerText:R,canSend:ne,sendDisabledMessage:X||(S?`Chat usage unavailable: ${S}`:null),canCreateChat:w&&!U,onSend:()=>{ee||yt(M)},onQuickAction:Le=>yt(Le),hasSuccessfulRun:!!m?.has_successful_run,hasSiteAudit:!!(m?.site_audit?.enumeration_pages_count&&m.site_audit.enumeration_pages_count>0),activePromptsCount:m?.active_prompts_count??0,isCrunching:!!m?.initial_crunching,modelTier:F,onModelTierChange:Y,isCorePlan:_,isOwner:v,workspaceId:e}),U?t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem",padding:"0.6rem 1rem",background:"rgba(239, 68, 68, 0.06)",borderTop:"1px solid rgba(239, 68, 68, 0.15)",fontSize:"0.78rem",fontWeight:700,color:"rgb(185, 28, 28)"},children:[t.jsx(ei,{size:14,style:{flexShrink:0}}),t.jsx("span",{children:$?"Not enough credits. Contact your partner to upgrade.":j==="owner"?t.jsxs(t.Fragment,{children:[k!=null&&k>0?"Not enough credits for this model.":"No credits remaining."," ",t.jsx("button",{onClick:()=>E(!0),style:{color:"inherit",fontWeight:850,textDecoration:"underline",background:"none",border:"none",padding:0,font:"inherit",cursor:"pointer"},children:"Upgrade your plan"})," to continue chatting."]}):`${k!=null&&k>0?"Not enough credits for this model.":"No credits remaining."} Ask your workspace owner to upgrade the plan.`})]}):null]})]}),t.jsx(lbt,{confirmDelete:we,onCloseDelete:()=>_e(null),onConfirmDelete:Le=>Ee(Le),renameOpen:Ke,onCloseRename:()=>ce(!1),renameValue:ie,setRenameValue:Re,onSubmitRename:Ne}),t.jsx(ec,{isOpen:A,orgId:c,onClose:()=>E(!1)})]})}function mbt({organizationId:e,projectId:n,status:i="pending",agentType:r,enabled:o=!0}){const{subscribe:s}=wo(),[a,c]=l.useState([]),[u,m]=l.useState({tech:0,content:0,total:0}),[h,g]=l.useState(1),[x,y]=l.useState(!1),[w,j]=l.useState(null),v=l.useMemo(()=>WQ(e),[e]),_=l.useMemo(()=>WQ(n),[n]),$=l.useMemo(()=>{if(!v||!_)return null;const T=new URLSearchParams;i&&T.set("status",i),r&&T.set("agent_type",r);const M=T.toString();return`/api/v1/organizations/${v}/projects/${_}/agent_proposals${M?`?${M}`:""}`},[v,_,i,r]),k=l.useCallback(async()=>{if(!(!o||!$)){y(!0),j(null);try{const T=await ue($),M=await T.json().catch(()=>({}));if(!T.ok){j(typeof M?.error=="string"?M.error:`Failed to load proposals (${T.status})`),c([]);return}c(Array.isArray(M?.proposals)?M.proposals:[]),M?.pending_counts&&m({tech:M.pending_counts.tech??0,content:M.pending_counts.content??0,total:M.pending_counts.total??0}),typeof M?.estimated_credits_per_op=="number"&&g(M.estimated_credits_per_op)}catch(T){j(T?.message||"Failed to load proposals"),c([])}finally{y(!1)}}},[o,$]);l.useEffect(()=>{k()},[k]),l.useEffect(()=>{if(!o||!_)return;const T=s({channel:"AgentsChannel",project_id:_},{received:M=>
17520{if(!M||typeof M!="object")return;const R=String(M.type||"");if(R!=="proposal_created"&&R!=="proposal_decided")return;const F=M.proposal;if(F){if(r&&F.agent_type!==r){P();return}c(Y=>hbt(Y,R,F,i)),P()}}});return()=>{try{T?.unsubscribe?.()}catch{}}},[o,_,i,r,s]);const P=l.useCallback(async()=>{if(!(!v||!_))try{const T=await ue(`/api/v1/organizations/${v}/projects/${_}/agent_proposals?status=pending&per_page=1`),M=await T.json().catch(()=>({}));T.ok&&M?.pending_counts&&m({tech:M.pending_counts.tech??0,content:M.pending_counts.content??0,total:M.pending_counts.total??0})}catch{}},[v,_]),S=l.useRef(new Set),I=l.useCallback(async(T,M,R)=>{if(!v||!_)return{ok:!1,status:0,message:"Project not loaded yet."};if(S.current.has(T))return{ok:!1,status:0,errorCode:"in_flight",message:"Already deciding this proposal."};S.current.add(T);const F=a;i==="pending"&&c(Y=>Y.filter(H=>H.id!==T));try{const Y=`/api/v1/organizations/${v}/projects/${_}/agent_proposals/${T}/${M}`,H=M==="dismiss"&&R?{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:R})}:{method:"POST"},U=await ue(Y,H),X=await U.json().catch(()=>({}));if(!U.ok){c(F);const Q=HQ(M,U.status,X)??`http_${U.status}`,K=UQ(X?.error)??fbt(M,U.status);return{ok:!1,status:U.status,errorCode:Q,message:K}}return P(),M==="accept"&&Fo(),{ok:!0,status:U.status}}catch(Y){return c(F),{ok:!1,status:0,errorCode:"network_error",message:Y?.message||`${M} failed.`}}finally{S.current.delete(T)}},[v,_,a,i,P]),A=l.useCallback(T=>I(T,"accept"),[I]),E=l.useCallback((T,M)=>I(T,"dismiss",M),[I]),B=l.useCallback(async(T,M,R)=>{if(!v||!_)return{ok:!1,status:0,message:"Project not loaded yet."};const F=Array.from(new Set(T.filter(H=>Number.isFinite(H)&&H>0)));if(F.length===0)return{ok:!1,status:0,message:"No proposals selected."};const Y=a;if(i==="pending"){const H=new Set(F);c(U=>U.filter(X=>!H.has(X.id)))}try{const H=`/api/v1/organizations/${v}/projects/${_}/agent_proposals/bulk_decide`,U={decision:M,proposal_ids:F};M==="dismiss"&&R&&(U.reason=R);const X=await ue(H,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(U)}),Q=await X.json().catch(()=>({}));if(!X.ok)return c(Y),{ok:!1,status:X.status,errorCode:HQ(M==="accept"?"accept":"dismiss",X.status,Q)??`http_${X.status}`,message:UQ(Q?.error)??`Bulk ${M} failed.`};const K=Array.isArray(Q?.results)?Q.results:[],G=new Set(K.filter(q=>q&&q.ok===!1).map(q=>Number(q.id)).filter(q=>Number.isFinite(q)&&q>0));if(G.size>0&&i==="pending"){const q=Y.filter(W=>G.has(W.id));c(W=>[...q,...W])}P();const L=typeof Q?.succeeded=="number"?Q.succeeded:K.length-G.size;return M==="accept"&&L>0&&Fo(),{ok:!0,status:X.status,decision:M,results:K,succeeded:L,failed:typeof Q?.failed=="number"?Q.failed:G.size}}catch(H){return c(Y),{ok:!1,status:0,errorCode:"network_error",message:H?.message||`Bulk ${M} failed.`}}},[v,_,a,i,P]);return{proposals:a,pendingCounts:u,estimatedCreditsPerOp:h,loading:x,error:w,refetch:k,accept:A,dismiss:E,bulkDecide:B}}function hbt(e,n,i,r){const o=e.findIndex(a=>a.id===i.id);if(!(i.status===r))return o>=0?e.filter((a,c)=>c!==o):e;if(o>=0){const a=e.slice();return a[o]=i,a}return n==="proposal_created"||n==="proposal_decided"?[i,...e]:e}function WQ(e){if(e==null)return null;const n=Number(e);return Number.isFinite(n)&&n>0?n:null}function UQ(e){return typeof e=="string"&&e.length>0?e:void 0}function HQ(e,n,i){switch(n){case 402:return"insufficient_credits";case 403:return"not_authorized";case 404:return"proposal_not_found";case 409:return e==="accept"?"already_in_flight":"already_decided";case 410:return"audit_action_gone";case 422:return"not_supported";case 503:case 504:return"connector_offline"}}function fbt(e,n){if(e==="dismiss"){switch(n){case 403:return"You don't have permission to decide on this proposal.";case 404:return"This proposal no longer exists.";case 409:return"This proposal was already decided."}return"Could not dismiss this proposal."}switch(n){case 402:return"Not enough credits to accept this proposal.";case 403:return"You don't have permission to accept this proposal.";case 404:return"This proposal no longer exists.";case 409:return"An auto-fix is already in flight for this finding.";case 410:return"The underlying audit finding is gone â proposal was archived.";
17520case 422:return"This finding isn't auto-fixable yet.";case 503:case 504:return"WordPress connector is offline."}return"Could not accept this proposal."}function gbt({organizationId:e,projectId:n,status:i="active",enabled:r=!0}){const{subscribe:o}=wo(),[s,a]=l.useState([]),[c,u]=l.useState(xue()),[m,h]=l.useState(1),[g,x]=l.useState(1),[y,w]=l.useState(12),[j,v]=l.useState(!1),[_,$]=l.useState(null),[k,P]=l.useState([]),[S,I]=l.useState([]),[A,E]=l.useState(!1),[B,T]=l.useState(null),M=l.useMemo(()=>GQ(e),[e]),R=l.useMemo(()=>GQ(n),[n]),F=l.useMemo(()=>!M||!R?null:`/api/v1/organizations/${M}/projects/${R}/content_drafts`,[M,R]),Y=l.useMemo(()=>{if(!F)return null;const le=new URLSearchParams;i&&le.set("status",i);const me=le.toString();return`${F}${me?`?${me}`:""}`},[F,i]),H=l.useCallback(async()=>{if(!(!r||!Y)){v(!0),$(null);try{const le=await ue(Y),me=await le.json().catch(()=>({}));if(!le.ok){$(typeof me?.error=="string"?me.error:`Failed to load drafts (${le.status})`),a([]);return}a(Array.isArray(me?.drafts)?me.drafts:[]),me?.counts&&u(qQ(me.counts)),typeof me?.estimated_credits_per_publish=="number"&&h(me.estimated_credits_per_publish),typeof me?.estimated_credits_per_generation=="number"&&x(me.estimated_credits_per_generation),typeof me?.estimated_credits_per_mutation=="number"&&w(me.estimated_credits_per_mutation)}catch(le){$(le?.message||"Failed to load drafts"),a([])}finally{v(!1)}}},[r,Y]);l.useEffect(()=>{H()},[H]);const U=l.useCallback(async()=>{if(F)try{const le=await ue(`${F}?status=all&per_page=1`),me=await le.json().catch(()=>({}));le.ok&&me?.counts&&u(qQ(me.counts))}catch{}},[F]),X=l.useCallback(async()=>{if(!(!r||!F)){E(!0),T(null);try{const le=await ue(`${F}/eligible_actions`),me=await le.json().catch(()=>({}));if(!le.ok){T(typeof me?.error=="string"?me.error:`Failed to load eligible actions (${le.status})`),P([]),I([]);return}P(Array.isArray(me?.actions)?me.actions:[]),I(Array.isArray(me?.audit_actions)?me.audit_actions:[])}catch(le){T(le?.message||"Failed to load eligible actions"),P([]),I([])}finally{E(!1)}}},[r,F]);l.useEffect(()=>{X()},[X]),l.useEffect(()=>{if(!r||!R)return;const le=o({channel:"AgentsChannel",project_id:R},{received:me=>{if(!me||typeof me!="object")return;const ee=String(me.type||"");if(!ee.startsWith("content_draft_"))return;const ne=me.content_draft;ne&&(a(Ae=>ybt(Ae,ne,i)),U(),(ee==="content_draft_created"||ee==="content_draft_decided"||ee==="content_draft_published"||ee==="content_draft_failed")&&X())}});return()=>{try{le?.unsubscribe?.()}catch{}}},[r,R,i,o]);const Q=l.useRef(new Set),K=l.useCallback(async(le,me,ee,ne)=>{if(Q.current.has(ne))return{ok:!1,status:0,errorCode:"in_flight",message:"Already in progress."};Q.current.add(ne);try{const Ae=me?{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(me)}:{method:"POST"},_e=await ue(le,Ae),we=await _e.json().catch(()=>({}));if(!_e.ok)return{ok:!1,status:_e.status,errorCode:vbt(ee,_e.status)??`http_${_e.status}`,message:bbt(we?.error)??wbt(ee,_e.status)};(ee==="generate"||ee==="approve"||ee==="regenerate")&&Fo();const Ke=we?.content_draft??we?.draft;return{ok:!0,status:_e.status,draft:Ke}}catch(Ae){return{ok:!1,status:0,errorCode:"network_error",message:Ae?.message||`${ee} failed.`}}finally{Q.current.delete(ne)}},[]),G=l.useCallback(async le=>{if(!F)return{ok:!1,status:0,message:"Project not loaded yet."};const me=await K(`${F}/generate`,{project_action_id:le},"generate",`generate:${le}`);return me.ok&&X(),me},[F,K,X]),L=l.useCallback(async le=>{if(!F)return{ok:!1,status:0,message:"Project not loaded yet."};const me=await K(`${F}/generate_from_audit_action`,{site_audit_action_id:le},"generate",`generate_audit:${le}`);return me.ok&&X(),me},[F,K,X]),q=l.useCallback(async(le,me)=>{if(!F)return{ok:!1,status:0,message:"Project not loaded yet."};const ee=s;a(Ae=>Ae.map(_e=>_e.id===le?{..._e,status:"publishing"}:_e));const ne=await K(`${F}/${le}/approve`,me?.wpPostStatus?{wp_post_status:me.wpPostStatus}:void 0,"approve",`approve:${le}`);return ne.ok||a(ee),ne},[F,s,K]),W=l.useCallback(async(le,me)=>{if(!F)return{ok:!1,status:0,message:"Project not loaded yet."};const ee=s;(i==="active"||i==="pending_review")&&a(Ae=>Ae.filter(_e=>_e.id!==le));const ne=await K(`${F}/${le}/dismiss`,me?{reason:me}:void 0,"dismiss",`dismiss:${le}`);return ne.ok||a(ee),ne},[F,s,K,i]),oe=l.useCallback(async le=>{if(!F)return{ok:!1,status:0,message:"Project not loaded yet."};const me=s;a(ne=>ne.map(Ae=>Ae.id===le?{...Ae,status:"regenerating"}:Ae));const ee=await K(`${F}/${le}/regenerate`,void 0,"regenerate",`regenerate:${le}`);return ee.ok||a(me),ee},[F,s,K]),se=l.useCallback(async le=>{if(!F)return null;try{const me=await ue(`${F}/${le}`),ee=await me.json().catch(()=>({}));if(!me.ok)return null;const ne=ee?.content_draft;return!ne||typeof ne!="object"?null:{body:typeof ne.body_html=="string"?ne.body_html:null,originalBody:typeof ne.original_body_html=="string"?ne.original_body_html:null}}catch{return null}},[F]),de=l.useCallback(async(le,me)=>{if(!F)return{ok:!1,status:0,message:"Project not loaded yet."};const ee=Array.from(new Set(le.filter(Ae=>Number.isFinite(Ae)&&Ae>0)));if(ee.length===0)return{ok:!1,status:0,message:"No drafts selected."};const ne=s;if(i==="active"||i==="pending_review"){const Ae=new Set(ee);a(_e=>_e.filter(we=>!Ae.has(we.id)))}try{const Ae=`${F}/bulk_dismiss`,_e={draft_ids:ee};me&&(_e.reason=me);const we=await ue(Ae,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(_e)}),Ke=await we.json().catch(()=>({}));if(!we.ok)return a(ne),{ok:!1,status:we.status,errorCode:`http_${we.status}`,message:typeof Ke?.error=="string"?Ke.error:"Bulk dismiss failed."};const ce=Array.isArray(Ke?.results)?Ke.results:[],ie=new Set(ce.filter(Re=>Re&&Re.ok===!1).map(Re=>Number(Re.id)).filter(Re=>Number.isFinite(Re)&&Re>0));if(ie.size>0&&(i==="active"||i==="pending_review")){const Re=ne.filter(Be=>ie.has(Be.id));a(Be=>[...Re,...Be])}return U(),{ok:!0,status:we.status,results:ce,succeeded:typeof Ke?.succeeded=="number"?Ke.succeeded:ce.length-ie.size,failed:typeof Ke?.failed=="number"?Ke.failed:ie.size}}catch(Ae){return a(ne),{ok:!1,status:0,errorCode:"network_error",message:Ae?.message||"Bulk dismiss failed."}}},[F,s,i,U]);return{drafts:s,counts:c,estimatedCreditsPerPublish:m,estimatedCreditsPerGeneration:g,estimatedCreditsPerMutation:y,loading:j,error:_,refetch:H,eligibleActions:k,eligibleAuditActions:S,eligibleLoading:A,eligibleError:B,refetchEligible:X,generate:G,generateFromAuditAction:L,approve:q,dismiss:W,regenerate:oe,fetchBody:se,bulkDismiss:de}}function xue(){return{pending_review:0,pending_generation:0,regenerating:0,approved:0,publishing:0,published:0,failed:0,dismissed:0,active_total:0}}function qQ(e){const n=xue();return{pending_review:e.pending_review??n.pending_review,pending_generation:e.pending_generation??n.pending_generation,regenerating:e.regenerating??n.regenerating,approved:e.approved??n.approved,publishing:e.publishing??n.publishing,published:e.published??n.published,failed:e.failed??n.failed,dismissed:e.dismissed??n.dismissed,active_total:e.active_total??n.active_total}}function ybt(e,n,i){const r=e.findIndex(s=>s.id===n.id);if(!xbt(n,i))return r>=0?e.filter((s,a)=>a!==r):e;if(r>=0){const s=e.slice(),a=e[r].body_html;return s[r]={...n,body_html:n.body_html??a},s}return[n,...e]}function xbt(e,n){switch(n){case"all":return!0;case"active":return!e.terminal;default:return e.status===n}}function GQ(e){if(e==null)return null;const n=Number(e);return Number.isFinite(n)&&n>0?n:null}function bbt(e){return typeof e=="string"&&e.length>0?e:void 0}function vbt(e,n){switch(n){case 402:return"insufficient_credits";case 403:return"not_authorized";case 404:return e==="generate"?"action_not_found":"draft_not_found";case 409:return"already_decided";case 410:return"draft_gone";case 422:return"not_eligible";case 502:return"llm_error";
17520case 503:case 504:return"connector_offline"}}function wbt(e,n){switch(e){case"generate":switch(n){case 402:return"Generation cost would exceed plan.";case 404:return"That action no longer exists.";case 422:return"This action isn't eligible for the Content Agent yet.";case 502:return"The drafting model returned no usable content. Try again."}return"Could not generate a draft.";case"approve":switch(n){case 402:return"Not enough credits to publish this draft.";case 403:return"You don't have permission to publish.";case 409:return"This draft is no longer in review.";case 422:return"WordPress connector isn't ready."}return"Could not approve this draft.";case"dismiss":switch(n){case 409:return"This draft was already decided."}return"Could not dismiss this draft.";case"regenerate":switch(n){case 402:return"Not enough credits â top up to regenerate this draft.";case 409:return"This draft can't be regenerated in its current state.";case 410:return"The source action is gone â start a new draft instead."}return"Could not regenerate this draft."}return`Request failed (${n}).`}function jbt({organizationId:e,projectId:n,limit:i=50,enabled:r=!0}){const{subscribe:o}=wo(),[s,a]=l.useState([]),[c,u]=l.useState(!1),[m,h]=l.useState(null),g=l.useMemo(()=>VQ(e),[e]),x=l.useMemo(()=>VQ(n),[n]),y=l.useRef(i);y.current=i;const w=l.useMemo(()=>!g||!x?null:`/api/v1/organizations/${g}/projects/${x}/agent_activity?limit=${i}`,[g,x,i]),j=l.useCallback(async()=>{if(!(!r||!w)){u(!0),h(null);try{const v=await ue(w),_=await v.json().catch(()=>({}));if(!v.ok){h(typeof _?.error=="string"?_.error:`Failed to load activity (${v.status})`),a([]);return}a(Array.isArray(_?.events)?_.events:[])}catch(v){h(v?.message||"Failed to load activity"),a([])}finally{u(!1)}}},[r,w]);return l.useEffect(()=>{j()},[j]),l.useEffect(()=>{if(!r||!x)return;const v=o({channel:"AgentsChannel",project_id:x},{received:_=>{if(!_||typeof _!="object")return;const $=String(_.type||""),k=_bt($,_);k&&a(P=>Sbt(P,k,y.current))}});return()=>{try{v?.unsubscribe?.()}catch{}}},[r,x,o]),{events:s,loading:c,error:m,refetch:j}}function _bt(e,n){const i=La(n?.server_time)||bue();if(e==="activity_event"&&n?.event&&typeof n.event=="object")return Cbt(n.event);if(e.startsWith("operation_")){const r=n?.operation;return!r?.id||r.dry_run===!0?null:{id:`operation:${r.id}:${r.status||e}`,source:"operation",source_id:Xj(r.id),agent_type:"tech",type:e,status:La(r.status),occurred_at:La(r.updated_at)||i,summary:kbt(r,e),details:{command:r.command,audit_action_id:r.site_audit_action_id,content_draft_id:r.content_draft_id,error_code:r.error_code,error_message:r.error_message}}}if(e==="proposal_created"||e==="proposal_decided"){const r=n?.proposal;if(!r?.id)return null;const o=!!(r.auto_accepted_at||r.triggered_by_rule_id),s=r.status==="pending"?"proposal_created":r.status==="accepted"?o?"proposal_auto_accepted":"proposal_accepted":r.status==="dismissed"?o?"proposal_auto_dismissed":"proposal_dismissed":r.status==="stale"?"proposal_stale":"proposal_updated";return{id:`proposal:${r.id}:${r.status||s}`,source:"proposal",source_id:Xj(r.id),agent_type:La(r.agent_type)==="content"?"content":"tech",type:s,status:La(r.status),occurred_at:La(r.updated_at)||i,summary:$bt(r,o),details:{audit_code:r.audit_code,audit_severity:r.audit_severity,audit_page_url:r.audit_page_url,triggered_by_rule_id:r.triggered_by_rule_id}}}if(e.startsWith("content_draft_")){const r=n?.content_draft;return r?.id?{id:`content_draft:${r.id}:${r.status||e}`,source:"content_draft",source_id:Xj(r.id),agent_type:"content",type:e,status:La(r.status),occurred_at:La(r.updated_at)||i,summary:Ibt(r,e),details:{title:r.title,wp_post_status:r.wp_post_status,wp_permalink:r.wp_permalink,triggered_by_rule_id:r.triggered_by_rule_id,generation_error:r.generation_error}}:null}if(e==="rule_triggered"){const r=n?.rule;if(!r?.id)return null;const o=n?.proposal,s=n?.content_draft;return{id:`rule:${r.id}:${r.action_type}:${i}`,source:"rule",source_id:Xj(r.id),agent_type:La(n?.agent_type)==="content"?"content":"tech",type:"rule_triggered",status:La(r.action_type),occurred_at:i,summary:Pbt(r,o,s),details:{rule_id:r.id,rule_name:r.name,action_type:r.action_type}}}return null}function Cbt(e){return!e||typeof e.id!="string"?null:{id:e.id,source:e.source||"summary",source_id:Xj(e.source_id),agent_type:e.agent_type==="content"?"content":e.agent_type==="tech"?"tech":null,type:String(e.type||"activity"),status:La(e.status),occurred_at:La(e.occurred_at)||bue(),summary:String(e.summary||""),details:e.details&&typeof e.details=="object"?e.details:void 0}}function Sbt(e,n,i){const r=`${n.source}:${n.source_id??"_"}`,o=e.filter(a=>`${a.source}:${a.source_id??"_"}`!==r);return[n,...o].slice(0,Math.max(i,1))}function kbt(e,n){const i=n==="operation_queued"?"Queued":n==="operation_dispatched"?"Sent to WordPress":n==="operation_succeeded"?"Fixed":n==="operation_failed"?"Failed":"Updated",r=oD(String(e?.command||"operation"));return`${i}: ${r}`}function $bt(e,n){const i=oD(String(e?.audit_code||"audit finding")),r=La(e?.audit_page_url),o=r?` on ${vue(r)}`:"";return`${e?.status==="pending"?"Proposed fix for":e?.status==="accepted"?n?"Auto-accepted fix for":"Accepted fix for":e?.status==="dism
17520issed"?n?"Auto-dismissed":"Dismissed":e?.status==="stale"?"Stale proposal for":"Updated proposal for"} ${i}${o}`}function Ibt(e,n){const i=La(e?.title)||"(untitled draft)";return`${n==="content_draft_created"?"Drafting":n==="content_draft_ready"?"Drafted, awaiting review:":n==="content_draft_failed"?"Failed:":n==="content_draft_decided"?"Updated:":n==="content_draft_published"?"Published":"Updated:"} "${i}"`}function Pbt(e,n,i){const r=String(e?.action_type||"triggered"),o=n?`${oD(String(n.audit_code||"finding"))}${n.audit_page_url?` on ${vue(String(n.audit_page_url))}`:""}`:i?`"${La(i.title)||"draft"}"`:"an item",s=r==="auto_accept"?"Auto-accepted":r==="auto_dismiss"?"Auto-dismissed":r==="auto_generate"?"Auto-drafted":"Triggered on",a=La(e?.name)?` (rule: ${e.name})`:"";return`${s} ${o}${a}`}function VQ(e){if(e==null)return null;const n=Number(e);return Number.isFinite(n)&&n>0?n:null}function Xj(e){if(e==null)return null;const n=Number(e);return Number.isFinite(n)?n:null}function La(e){return typeof e=="string"&&e.length>0?e:void 0}function bue(){return new Date().toISOString()}function oD(e){return e?e.replace(/_/g," ").replace(/^./,n=>n.toUpperCase()):""}function vue(e){try{const n=new URL(e);let i=n.pathname||"/";return i.length>50&&(i=`${i.slice(0,47)}â¦`),`${n.host}${i}`}catch{return e}}function wue({organizationId:e,projectId:n}){const[i,r]=l.useState(new Set),[o,s]=l.useState(null),a=l.useCallback(u=>i.has(u),[i]);return{revert:l.useCallback(async u=>{if(!e||!n)return{ok:!1,message:"Missing organization or project"};r(h=>{const g=new Set(h);return g.add(u),g}),s(null);const m=`/api/v1/organizations/${e}/projects/${n}/self_healing_operations/${u}/revert`;try{const h=await ue(m,{method:"POST"}),g=await h.json().catch(()=>({}));if(!h.ok){const x=g&&(g.error||g.message)||`Failed to revert (HTTP ${h.status})`;return s(x),{ok:!1,message:x}}return Fo(),{ok:!0,operation:g.operation}}catch(h){const g=h instanceof Error?h.message:"Network error";return s(g),{ok:!1,message:g}}finally{r(h=>{const g=new Set(h);return g.delete(u),g})}},[e,n]),isPending:a,error:o}}function jue({organizationId:e,projectId:n}){const[i,r]=l.useState(new Set),[o,s]=l.useState(null),a=l.useCallback(u=>i.has(u),[i]);return{retry:l.useCallback(async u=>{if(!e||!n)return{ok:!1,message:"Missing organization or project"};r(h=>{const g=new Set(h);return g.add(u),g}),s(null);const m=`/api/v1/organizations/${e}/projects/${n}/self_healing_operations/${u}/retry`;try{const h=await ue(m,{method:"POST"}),g=await h.json().catch(()=>({}));if(!h.ok){const x=g&&(g.error||g.message)||`Failed to retry (HTTP ${h.status})`;return s(x),{ok:!1,message:x}}return Fo(),{ok:!0,operation:g.operation}}catch(h){const g=h instanceof Error?h.message:"Network error";return s(g),{ok:!1,message:g}}finally{r(h=>{const g=new Set(h);return g.delete(u),g})}},[e,n]),isPending:a,error:o}}const KQ={status:"idle",operationId:null,preview:null,generatedAt:null,errorCode:null,errorMessage:null};function Abt({organizationId:e,projectId:n,enabled:i=!0}){const r=e??null,o=n??null,{subscribe:s}=wo(),[a,c]=l.useState({}),u=l.useRef(new Map),m=l.useCallback((w,j)=>{c(v=>{const _=v[w]??KQ;return{...v,[w]:{..._,...j}}})},[]),h=l.useCallback(w=>a[w]??KQ,[a]),g=l.useCallback(w=>{c(j=>{if(!(w in j))return j;const v={...j},_=v[w]?.operationId;return delete v[w],_!=null&&u.current.delete(_),v})},[]),x=l.useCallback(w=>{!Array.isArray(w)||w.length===0||c(j=>{let v=!1;const _={...j};for(const $ of w){const k=$.latest_preview;if(!k)continue;const P=_[$.id];P&&(P.status==="requesting"||P.status==="queued"||P.operationId===k.operation_id||P.status==="succeeded"&&P.operationId!=null&&k.operation_id<=P.operationId)||(_[$.id]={status:"succeeded",operationId:k.operation_id,preview:k.preview??null,generatedAt:k.generated_at??null,errorCode:null,errorMessage:null},u.current.set(k.operation_id,$.id),v=!0)}return v?_:j})},[]),y=l.useCallback(async w=>{if(!r||!o)return{ok:!1,message:"Project not loaded yet."};m(w,{status:"requesting",errorCode:null,errorMessage:null});try{const j=`/api/v1/organizations/${r}/projects/${o}/agent_proposals/${w}/preview`,v=await ue(j,{method:"POST"}),_=await v.json().catch(()=>({}));if(!v.ok){const k=_?.error||_?.message||`Preview failed (HTTP ${v.status})`;return m(w,{status:"failed",errorCode:_?.error_code||`http_${v.status}`,errorMessage:k}),{ok:!1,message:k}}const $=_?.operation;
17520if($)if(u.current.set($.id,w),$.status==="succeeded"){const k=$.plugin_result??{};m(w,{status:"succeeded",operationId:$.id,preview:k.preview??null,generatedAt:$.finished_at??null})}else $.status==="failed"?m(w,{status:"failed",operationId:$.id,errorCode:$.error_code,errorMessage:$.error_message}):m(w,{status:"queued",operationId:$.id});else m(w,{status:"queued"});return{ok:!0}}catch(j){const v=j instanceof Error?j.message:"Network error";return m(w,{status:"failed",errorCode:"network_error",errorMessage:v}),{ok:!1,message:v}}},[r,o,m]);return l.useEffect(()=>{if(!i||!o)return;const w=s({channel:"AgentsChannel",project_id:o},{received:j=>{if(!j||typeof j!="object"||!String(j.type||"").startsWith("operation_"))return;const _=j.operation;if(!_)return;const $=u.current.get(_.id);if($)if(_.status==="succeeded"){const k=_.plugin_result??{};m($,{status:"succeeded",preview:k.preview??null,generatedAt:_.finished_at??new Date().toISOString()})}else _.status==="failed"?m($,{status:"failed",errorCode:_.error_code,errorMessage:_.error_message}):(_.status==="queued"||_.status==="dispatched")&&m($,{status:"queued"})}});return()=>{try{w?.unsubscribe?.()}catch{}}},[o,s,i,m]),{previewFor:h,requestPreview:y,clearPreview:g,primeFromProposals:x}}function Nbt({organizationId:e,projectId:n,enabled:i=!0}){const{subscribe:r}=wo(),[o,s]=l.useState({tech:null,content:null}),[a,c]=l.useState(!1),[u,m]=l.useState(null),[h,g]=l.useState(null),x=l.useMemo(()=>{if(e==null)return null;const _=Number(e);return Number.isFinite(_)&&_>0?_:null},[e]),y=l.useMemo(()=>{if(n==null)return null;const _=Number(n);return Number.isFinite(_)&&_>0?_:null},[n]),w=l.useMemo(()=>!x||!y?null:`/api/v1/organizations/${x}/projects/${y}/agent_settings`,[x,y]),j=l.useCallback(async()=>{if(!(!w||!i)){c(!0),g(null);try{const _=await ue(w),$=await _.json().catch(()=>({}));if(!_.ok){g($?.error||"Failed to load agent settings.");return}const k=Array.isArray($?.agent_settings)?$.agent_settings:[];s({tech:k.find(P=>P.agent_type==="tech")??null,content:k.find(P=>P.agent_type==="content")??null})}catch(_){g(_?.message||"Failed to load agent settings.")}finally{c(!1)}}},[w,i]);l.useEffect(()=>{i&&j()},[j,i]),l.useEffect(()=>{if(!i||!y)return;const _=r({channel:"AgentsChannel",project_id:y},{received:$=>{if(!$||typeof $!="object"||String($?.type||"")!=="agent_setting_updated")return;const k=$?.agent_setting??null;!k||k.agent_type!=="tech"&&k.agent_type!=="content"||s(P=>({...P,[k.agent_type]:k}))}});return()=>{try{_?.unsubscribe?.()}catch{}}},[i,y,r]);const v=l.useCallback(async(_,$)=>{if(!w)return{ok:!1,message:"Project not loaded yet."};m(_),g(null);try{const k=await ue(`${w}/${_}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify($)}),P=await k.json().catch(()=>({}));if(!k.ok){const I=P?.error||"Failed to update agent setting.";return g(I),{ok:!1,message:I}}const S=P?.agent_setting??null;return S&&s(I=>({...I,[_]:S})),{ok:!0}}catch(k){const P=k?.message||"Failed to update agent setting.";return g(P),{ok:!1,message:P}}finally{m(null)}},[w]);return{settings:o,loading:a,saving:u,error:h,refetch:j,updateSetting:v}}function zbt(){const e=zn(),{workspaceId:n,projectId:i}=Gn(),{projects:r}=Mr(),[o]=yr(),s=o.get("agent")==="content"?"content":"tech",[a,c]=l.useState(s),u=l.useMemo(()=>{const ae=Number(i);return Number.isFinite(ae)&&ae>0?ae:null},[i]),m=l.useMemo(()=>u?r.find(ae=>ae.id===u):null,[u,r]),h=!!(m?.can?.edit||m?.can?.settings),{showToast:g}=Uo(),{connection:x,loading:y,throttle:w,setKillSwitch:j}=Nre({organizationId:n??null,projectId:u}),v=x?.status==="connected",_=!!x?.kill_switch,$=!!x?.alive,k=!!w,P=$&&!_&&!k,S=_?"paused":k?"throttled":P?"ready":"stale",I=!y||x!==null,{settings:A,saving:E,loading:B,updateSetting:T}=Nbt({organizationId:n??null,projectId:u,enabled:v}),[M,R]=l.useState(!1),F=l.useCallback(async()=>{if(x){R(!0);try{await j(!x.kill_switch)}finally{R(!1)}}},[x,j]),Y=l.useMemo(()=>{switch(S){case"paused":return"Paused";case"throttled":return w?.reason==="circuit_open"?"Paused":"Throttled";case"stale":return"Stale";default:return"Connected"}},[S,w?.reason]),H=l.useMemo(()=>{let ae="",Fe="";S==="ready"?(ae="WordPress connected",Fe="Agents are ready on this project. When you accept a fix or publish a draft, itâs sent to your site through this connector."):S==="paused"?(ae="Connector paused",Fe="You paused the connector from Ceyo. The plugin wonât pull new operations until you resume."):S==="throttled"?w?.reason==="circuit_open"?(ae="Connector paused â too many re
17520cent failures",Fe="Several operations failed in a row, so weâve held back new pulls. Weâll automatically resume after the next successful run."):(ae="Connector throttled â slowing down to avoid overload",Fe="Weâve queued the next batch behind a brief rate-limit window so your site doesnât get overloaded. Pulls resume automatically."):S==="stale"&&(ae="WordPress connected (heartbeat stale)",Fe="The plugin hasnât checked in recently. Accepts will queue and run when the connection is healthy again.");const Ge=h?x?.kill_switch?"Click to resume the connector.":"Click to pause all WordPress operations on this project.":null;return t.jsxs("span",{children:[t.jsx("strong",{children:ae}),t.jsx("br",{}),Fe,Ge&&t.jsxs(t.Fragment,{children:[t.jsx("br",{}),t.jsx("em",{children:Ge})]})]})},[S,w?.reason,h,x?.kill_switch]),{proposals:U,pendingCounts:X,estimatedCreditsPerOp:Q,loading:K,error:G,refetch:L,accept:q,dismiss:W,bulkDecide:oe}=mbt({organizationId:n??null,projectId:u,agentType:a,enabled:v}),se=l.useCallback(ae=>q(ae.id),[q]),de=l.useCallback((ae,Fe)=>W(ae.id,Fe),[W]),{drafts:le,counts:me,estimatedCreditsPerPublish:ee,estimatedCreditsPerGeneration:ne,estimatedCreditsPerMutation:Ae,loading:_e,error:we,refetch:Ke,eligibleActions:ce,eligibleAuditActions:ie,eligibleLoading:Re,eligibleError:Be,refetchEligible:tt,generate:dt,generateFromAuditAction:je,approve:Me,dismiss:Se,regenerate:it,fetchBody:De,bulkDismiss:te}=gbt({organizationId:n??null,projectId:u,status:"active",enabled:v}),{events:ge,loading:Je,error:Ee}=jbt({organizationId:n??null,projectId:u,limit:30,enabled:v}),{revert:Xe,isPending:yt}=wue({organizationId:n??null,projectId:u}),Ne=l.useCallback(async ae=>{const Fe=await Xe(ae);Fe.ok||alert(Fe.message??"Could not start the revert")},[Xe]),{retry:Le,isPending:Ue}=jue({organizationId:n??null,projectId:u}),We=l.useCallback(async ae=>{const Fe=await Le(ae);Fe.ok||alert(Fe.message??"Could not retry this operation")},[Le]),{previewFor:Qe,requestPreview:ht,primeFromProposals:pe}=Abt({organizationId:n??null,projectId:u});l.useEffect(()=>{U.length>0&&pe(U)},[U,pe]);const be=l.useCallback(ae=>{ht(ae.id).then(Fe=>{Fe.ok||alert(Fe.message??"Could not start the preview")})},[ht]),[rt,ze]=l.useState(new Set),[lt,vt]=l.useState(!1);l.useEffect(()=>{ze(new Set)},[a]);const Wt=l.useMemo(()=>a==="tech"?new Set(U.filter(ae=>ae.status==="pending").map(ae=>ae.id)):new Set(le.filter(ae=>ae.status==="pending_review").map(ae=>ae.id)),[a,U,le]);l.useEffect(()=>{ze(ae=>{let Fe=!1;const Ge=new Set;return ae.forEach(wt=>{Wt.has(wt)?Ge.add(wt):Fe=!0}),Fe?Ge:ae})},[Wt]);const Qt=l.useCallback((ae,Fe)=>{ze(Ge=>{const wt=new Set(Ge);return Fe?wt.add(ae.id):wt.delete(ae.id),wt})},[]),Yt=l.useCallback((ae,Fe)=>{ze(Ge=>{const wt=new Set(Ge);return Fe?wt.add(ae.id):wt.delete(ae.id),wt})},[]),Zt=l.useCallback(async()=>{if(rt.size===0)return;const ae=rt.size;vt(!0);const Fe=await oe(Array.from(rt),"accept");if(vt(!1),!Fe.ok){g(Fe.message||"Bulk accept failed.",{tone:"error"});return}const Ge=Fe.failed??0;Ge>0?g(`Accepted ${ae-Ge} of ${ae}. ${Ge} failed.`,{tone:"error"}):g(`Accepted ${ae} ${ae===1?"proposal":"proposals"}.`,{tone:"success"}),ze(new Set)},[oe,rt,g]),tn=l.useCallback(async()=>{if(rt.size===0)return;const ae=rt.size;vt(!0);const Fe=await oe(Array.from(rt),"dismiss");if(vt(!1),!Fe.ok){g(Fe.message||"Bulk dismiss failed.",{tone:"error"});return}const Ge=Fe.failed??0;Ge>0?g(`Dismissed ${ae-Ge} of ${ae}. ${Ge} failed.`,{tone:"error"}):g(`Dismissed ${ae} ${ae===1?"proposal":"proposals"}.`,{tone:"success"}),ze(new Set)},[oe,rt,g]),nn=l.useCallback(async()=>{if(rt.size===0)return;const ae=rt.size;vt(!0);const Fe=await te(Array.from(rt));if(vt(!1),!Fe.ok){g(Fe.message||"Bulk dismiss failed.",{tone:"error"});return}const Ge=Fe.failed??0;Ge>0?g(`Dismissed ${ae-Ge} of ${ae}. ${Ge} failed.`,{tone:"error"}):g(`Dismissed ${ae} ${ae===1?"draft":"drafts"}.`,{tone:"success"}),ze(new Set)},[te,rt,g]),xn=a==="tech"?K:_e,st=a==="tech"?G:we,Ct=l.useCallback(async()=>{a==="tech"?await L():await Promise.all([Ke(),tt()])},[a,L,Ke,tt]),Ie=me.pending_review;return t.jsx(ma,{children:t.jsxs(Tbt,{children:[t.jsxs(Ys,{children:[t.jsxs(ha,{children:[t.jsx(fa,{children:"Agents"}),t.jsx("div",{style:{paddingRight:8,minWidth:0}
17520,children:t.jsx(qr,{items:[{label:"Projects",to:n?`/workspaces/${n}`:void 0},{label:m?.name||"Project",to:n&&i?`/workspaces/${n}/projects/${i}`:void 0},{label:"Agents"}]})})]}),t.jsxs(Ebt,{children:[t.jsx(ga,{children:"Self-healing, tech fixes, and content drafts from your agents land here â review what to run, skip the rest, and keep a full audit trail."}),v&&t.jsxs(Mbt,{children:[t.jsx(at,{content:H,placement:"top",maxWidth:320,children:h?t.jsxs(ZQ,{type:"button",$tone:S,onClick:()=>void F(),disabled:M,"aria-label":`WordPress connector â ${Y}. ${x?.kill_switch?"Click to resume.":"Click to pause."}`,children:[t.jsx(JQ,{$tone:S}),Y]}):t.jsxs(ZQ,{as:"span",$tone:S,"aria-disabled":"true",children:[t.jsx(JQ,{$tone:S}),Y]})}),t.jsx(at,{content:"Configure auto-accept and auto-dismiss rules",placement:"top",maxWidth:280,children:t.jsxs(YQ,{type:"button",onClick:()=>e(`/workspaces/${n}/projects/${i}/agents/rules`),children:[t.jsx(Bc,{size:13}),"Rules"]})}),t.jsx(at,{content:"Searchable, paged log of every agent operation, proposal, and draft on this project",placement:"top",maxWidth:280,children:t.jsxs(YQ,{type:"button",onClick:()=>e(`/workspaces/${n}/projects/${i}/agents/log`),children:[t.jsx(Rne,{size:13}),"Activity log"]})}),t.jsx(at,{content:"Reload proposals, drafts, and activity",placement:"top",disabled:xn,children:t.jsxs(Lbt,{type:"button",onClick:()=>void Ct(),disabled:xn,children:[t.jsx(No,{size:13,className:xn?"spinning":void 0}),"Refresh"]})})]})]})]}),v&&t.jsxs(Rbt,{children:[t.jsx(dEe,{events:ge,loading:Je,error:Ee,collapsible:!0,defaultOpen:!1,collapsedRows:0,expandedRows:20,onRevert:Ne,isRevertPending:yt,onRetry:We,isRetryPending:Ue,canManage:h}),t.jsx(BEe,{techSetting:A.tech,contentSetting:A.content,loading:B,saving:E,onUpdate:T,canManage:h,selectedAgentType:a,onSelectAgentType:c,techCount:X.tech,contentCount:Ie}),t.jsxs(Obt,{children:[st&&t.jsxs(qbt,{children:[t.jsxs("strong",{children:["Couldn't load ",a==="tech"?"proposals":"drafts","."]}),t.jsx("span",{children:st}),t.jsx(he,{variant:"outline",size:"sm",onClick:()=>void Ct(),children:"Try again"})]}),h&&a==="tech"&&rt.size>0&&t.jsx(UW,{selectedCount:rt.size,totalCount:Wt.size,estimatedCreditsPerOp:Q,connectorAlive:P,allowAccept:!0,acceptLabel:"Accept selected",dismissLabel:"Dismiss selected",busy:lt,onAcceptAll:()=>void Zt(),onDismissAll:()=>void tn(),onClear:()=>ze(new Set)}),h&&a==="content"&&rt.size>0&&t.jsx(UW,{selectedCount:rt.size,totalCount:Wt.size,allowAccept:!1,dismissLabel:"Dismiss selected drafts",busy:lt,onDismissAll:()=>void nn(),onClear:()=>ze(new Set)}),a==="tech"?xn&&U.length===0?t.jsxs(QQ,{children:[t.jsx(nt,{width:"100%",height:120}),t.jsx(nt,{width:"100%",height:120}),t.jsx(nt,{width:"100%",height:120})]}):U.length===0?t.jsxs(eZ,{children:[t.jsx(Lm,{size:28}),t.jsx("h3",{children:"No proposals waiting"}),t.jsx("p",{children:"No new fix proposals this round. The next site audit refreshes this list automatically â or start one from Site Audit. Past decisions live in the Activity log."})]}):t.jsx(XQ,{children:U.map(ae=>t.jsx(c7e,{proposal:ae,estimatedCreditsPerOp:Q,connectorAlive:P,onAccept:se,onDismiss:de,selectable:!0,selected:rt.has(ae.id),onToggleSelect:Qt,preview:Qe(ae.id),onRequestPreview:be,canManage:h},ae.id))}):t.jsxs(Dbt,{children:[xn&&le.length===0?t.jsxs(QQ,{children:[t.jsx(nt,{width:"100%",height:160}),t.jsx(nt,{width:"100%",height:160})]}):le.length===0?t.jsxs(eZ,{children:[t.jsx(Sn,{size:28}),t.jsx("h3",{children:"No drafts in flight"}),t.jsx("p",{children:"Pick a recommendation below and the Content Agent will draft a first version for you to review, tweak, and approve into WordPress. Past drafts live in the Activity log."})]}):t.jsx(XQ,{children:le.map(ae=>t.jsx(K7e,{draft:ae,estimatedCreditsPerPublish:ee,estimatedCreditsPerGeneration:ne,connectorAlive:P,onFetchBody:De,onApprove:Me,onDismiss:Se,onRegenerate:it,selectable:!0,selected:rt.has(ae.id),onToggleSelect:Yt,onRevertPublish:Ne,isRevertPending:yt,canManage:h},ae.id))}),t.jsx(K4e,{actions:ce,auditActions:ie,loading:Re,error:Be,onGenerate:dt,onGenerateFromAuditAction:je,estimatedCreditsPerGeneration:ne,estimatedCreditsPerMutation:Ae,canManage:h})]})]})]}),!v&&I&&t.jsxs(Bbt,{children:[t.jsxs(Fbt,{children:[t.jsx(SP,{size:18}),t.jsx("h3",{children:"Connect WordPress to unlock the agents"})]}),t.jsx("p",{children:"Once you connect a site, your agents can use site audit findings to propose fixes and content. Nothing runs until you review and accept â unless you add auto-accept rules."}),t.jsxs(Wbt,{children:[t.jsxs(Y$,{children:[t.jsx(Ef,{size:14}),t.jsx("strong",{children:"Tech Agent"}),t.jsx("span",{children:"Proposes one-click fixes for missing meta, OG tags, canonicals, and more."})]}),t.jsxs(Y$,{children:[t.jsx(Sn,{size:14}),t.jsx("strong",{children:"Content Agent"}),t.jsx("span",{children:"Drafts blog posts and pages from action-module recommendations for you to review and publish."})]}),t.jsxs(Y$,{children:[t.jsx(vxe,{size:14}),t.jsx("strong",{children:"Activity log"}),t.jsx("span",{children:"Every agent action is recorded and one-click revertable from a single audit feed."})]}),t.jsxs(Y$,{children:[t.jsx(th,{size:14}),t.jsx("strong",{children:"Guardrails"}),t.jsx("span",{children:"Per-agent kill switches, monthly caps, and auto-accept rules so the agents only do what you allow."})]})]}),t.jsx(Ubt,{children:h?t.jsx(he,{variant:"primary",size:"md",onClick:()=>
17520e(`/workspaces/${n}/projects/${i}/settings/integrations`),children:"Open Integrations"}):t.jsx(Hbt,{children:"Ask a project admin to connect WordPress from the Integrations settings."})})]})]})})}const Tbt=p(Kc).withConfig({displayName:"AgentsPage__AgentsMax",componentId:"sc-1osunwn-0"})` 17521 max-width: 72rem; 17522`,Ebt=p.div.withConfig({displayName:"AgentsPage__HeaderBottomRow",componentId:"sc-1osunwn-1"})` 17523 display: flex; 17524 align-items: flex-start; 17525 justify-content: space-between; 17526 gap: 1rem; 17527 flex-wrap: wrap; 17528 min-width: 0; 17529`,Mbt=p.div.withConfig({displayName:"AgentsPage__HeaderToolbar",componentId:"sc-1osunwn-2"})` 17530 display: inline-flex; 17531 align-items: center; 17532 gap: 0.4rem; 17533 flex-wrap: wrap; 17534 flex-shrink: 0; 17535`,Rbt=p.div.withConfig({displayName:"AgentsPage__ConnectedSpacing",componentId:"sc-1osunwn-3"})` 17536 display: flex; 17537 flex-direction: column; 17538 gap: 1.35rem; 17539 margin-top: 0.35rem; 17540`,Obt=p.div.withConfig({displayName:"AgentsPage__AgentsWorkSurface",componentId:"sc-1osunwn-4"})` 17541 display: flex; 17542 flex-direction: column; 17543 gap: 1rem; 17544`,Dbt=p.div.withConfig({displayName:"AgentsPage__ContentAgentStack",componentId:"sc-1osunwn-5"})` 17545 display: flex; 17546 flex-direction: column; 17547 gap: 1rem; 17548`,Lbt=p.button.withConfig({displayName:"AgentsPage__RefreshButton",componentId:"sc-1osunwn-6"})` 17549 display: inline-flex; 17550 align-items: center; 17551 gap: 0.4rem; 17552 background: ${Z}; 17553 border: 1px solid ${V}; 17554 color: ${O}; 17555 padding: 0.4rem 0.7rem; 17556 border-radius: 0.5rem; 17557 font-size: 0.78rem; 17558 font-weight: 600; 17559 cursor: pointer; 17560 &:disabled { opacity: 0.6; cursor: not-allowed; } 17561 & svg.spinning { animation: spin 1s linear infinite; } 17562 @keyframes spin { to { transform: rotate(360deg); } } 17563`,YQ=p.button.withConfig({displayName:"AgentsPage__RulesLink",componentId:"sc-1osunwn-7"})` 17564 display: inline-flex; 17565 align-items: center; 17566 gap: 0.35rem; 17567 background: ${Z}; 17568 border: 1px solid ${V}; 17569 color: ${O}; 17570 padding: 0.4rem 0.7rem; 17571 border-radius: 0.5rem; 17572 font-size: 0.78rem; 17573 font-weight: 600; 17574 cursor: pointer; 17575 &:hover { background: ${$e}; } 17576`,XQ=p.div.withConfig({displayName:"AgentsPage__Queue",componentId:"sc-1osunwn-8"})` 17577 display: grid; 17578 gap: 0.6rem; 17579`,QQ=p.div.withConfig({displayName:"AgentsPage__SkeletonList",componentId:"sc-1osunwn-9"})` 17580 display: grid; 17581 gap: 0.5rem; 17582`,ZQ=p.button.withConfig({displayName:"AgentsPage__ConnectorChip",componentId:"sc-1osunwn-10"})` 17583 display: inline-flex; 17584 align-items: center; 17585 gap: 0.4rem; 17586 background: ${Z}; 17587 border: 1px solid ${V}; 17588 color: ${O}; 17589 padding: 0.4rem 0.7rem 0.4rem 0.55rem; 17590 border-radius: 0.5rem; 17591 font-size: 0.78rem; 17592 font-weight: 600; 17593 cursor: pointer; 17594 &:hover { background: ${$e}; } 17595 &:disabled { opacity: 0.6; cursor: not-allowed; } 17596 &[aria-disabled="true"] { cursor: default; } 17597`,JQ=p.span.withConfig({displayName:"AgentsPage__ConnectorDot",componentId:"sc-1osunwn-11"})` 17598 width: 8px; 17599 height: 8px; 17600 border-radius: 999px; 17601 flex-shrink: 0; 17602 background: ${e=>e.$tone==="ready"?Vt:e.$tone==="paused"?Ut:$i}; 17603 box-shadow: 0 0 0 2px 17604 ${e=>e.$tone==="ready"?`color-mix(in srgb, ${Vt} 25%, ${Z})`:e.$tone==="paused"?`color-mix(in srgb, ${Ut} 25%, ${Z})`:`color-mix(in srgb, ${$i} 25%, ${Z})`}; 17605`,eZ=p.div.withConfig({displayName:"AgentsPage__EmptyState",componentId:"sc-1osunwn-12"})` 17606 border: 1px dashed ${V}; 17607 background: ${Z}; 17608 border-radius: 0.875rem; 17609 padding: 2rem 1.25rem; 17610 display: grid; 17611 justify-items: center; 17612 text-align: center; 17613 gap: 0.45rem; 17614 color: ${z}; 17615 & h3 { 17616 margin: 0.25rem 0 0; 17617 font-size: 1rem; 17618 font-weight: 800; 17619 color: ${O}; 17620 } 17621 & p { 17622 margin: 0; 17623 max-width: 460px; 17624 line-height: 1.55; 17625 font-size: 0.85rem; 17626 } 17627 & svg { color: ${Ft}; } 17628`,Bbt=p.section.withConfig({displayName:"AgentsPage__PreConnectHero",componentId:"sc-1osunwn-13"})` 17629 border: 1px solid ${V}; 17630 background: ${Z}; 17631 border-radius: 0.875rem; 17632 padding: 1.25rem 1.25rem 1rem; 17633 margin-top: 4rem; 17634 display: grid; 17635 gap: 0.75rem; 17636 & > p { 17637 margin: 0; 17638 color: ${z}; 17639 font-size: 0.85rem; 17640 line-height: 1.55; 17641 max-width: 720px; 17642 } 17643`,Fbt=p.div.withConfig({displayName:"AgentsPage__PreConnectHeader",componentId:"sc-1osunwn-14"})` 17644 display: inline-flex; 17645 align-items: center; 17646 gap: 0.5rem; 17647 color: ${Ft}; 17648 & > h3 { 17649 margin: 0; 17650 font-size: 1rem; 17651 font-weight: 800; 17652 color: ${O}; 17653 } 17654`,Wbt=p.div.withConfig({displayName:"AgentsPage__PreConnectGrid",componentId:"sc-1osunwn-15"})` 17655 display: grid; 17656 grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); 17657 gap: 0.6rem; 17658 margin-top: 0.25rem; 17659`,Y$=p.div.withConfig({displayName:"AgentsPage__PreConnectFeature",componentId:"sc-1osunwn-16"})` 17660 display: grid; 17661 grid-template-columns: 1.1rem 1fr; 17662 grid-template-rows: auto auto; 17663 column-gap: 0.4rem; 17664 row-gap: 0.15rem; 17665 align-items: start; 17666 padding: 0.65rem 0.75rem; 17667 border: 1px solid ${V}; 17668 border-radius: 0.6rem; 17669 background: ${$e}; 17670 & svg { 17671 color: ${Ft}; 17672 grid-row: 1; 17673 grid-column: 1; 17674 margin-top: 2px; 17675 } 17676 & strong { 17677 grid-row: 1; 17678 grid-column: 2; 17679 font-size: 0.78rem; 17680 font-weight: 800; 17681 color: ${O}; 17682 } 17683 & span { 17684 grid-row: 2; 17685 grid-column: 2; 17686 font-size: 0.75rem; 17687 color: ${z}; 17688 line-height: 1.45; 17689 } 17690`,Ubt=p.div.withConfig({displayName:"AgentsPage__PreConnectActions",componentId:"sc-1osunwn-17"})` 17691 display: inline-flex; 17692 gap: 0.4rem; 17693 margin-top: 0.25rem; 17694`,Hbt=p.span.withConfig({displayName:"AgentsPage__ReadOnlyNote",componentId:"sc-1osunwn-18"})` 17695 font-size: 0.78rem; 17696 color: ${z}; 17697 font-style: italic; 17698`,qbt=p.div.withConfig({displayName:"AgentsPage__ErrorBanner",componentId:"sc-1osunwn-19"})` 17699 display: flex; 17700 align-items: center; 17701 gap: 0.6rem; 17702 background: ${$e}; 17703 border: 1px solid ${V}; 17704 border-left: 3px solid ${Ut}; 17705 padding: 0.55rem 0.75rem; 17706 border-radius: 0.5rem; 17707 font-size: 0.78rem; 17708 color: ${O}; 17709 & strong { color: ${Ut}; } 17710 & > span { flex: 1; color: ${z}; } 17711`;function Gbt({organizationId:e,projectId:n,enabled:i=!0}){const[r,o]=l.useState([]),[s,a]=l.useState(null),[c,u]=l.useState(!1),[m,h]=l.useState(null),g=l.useMemo(()=>tZ(e),[e]),x=l.useMemo(()=>tZ(n),[n]),y=l.useMemo(()=>!g||!x?null:`/api/v1/organizations/${g}/projects/${x}/agent_rules`,[g,x]),w=l.useCallback(async()=>
17711{if(!(!i||!y)){u(!0),h(null);try{const P=await ue(y),S=await P.json().catch(()=>({}));if(!P.ok){h(typeof S?.error=="string"?S.error:`Failed to load rules (${P.status})`),o([]);return}o(Array.isArray(S?.rules)?S.rules:[]),a({allowed_actions_per_agent:S?.allowed_actions_per_agent||{tech:[],content:[]},allowed_match_keys:S?.allowed_match_keys||[],supported_audit_codes:S?.supported_audit_codes||[],review_required_codes:S?.review_required_codes||[],content_supported_codes:S?.content_supported_codes||[],max_per_day_ceiling:S?.max_per_day_ceiling||200})}catch(P){h(P?.message||"Failed to load rules"),o([])}finally{u(!1)}}},[i,y]);l.useEffect(()=>{w()},[w]);const j=l.useCallback(async(P,S,I)=>{try{const A=I?{method:S,headers:{"Content-Type":"application/json"},body:JSON.stringify(I)}:{method:S},E=await ue(P,A);if(E.status===204)return{ok:!0,status:204};const B=await E.json().catch(()=>({}));return E.ok?{ok:!0,status:E.status,rule:B?.rule}:{ok:!1,status:E.status,errorCode:Vbt(E.status),message:typeof B?.error=="string"?B.error:`Request failed (${E.status})`,errors:B?.errors}}catch(A){return{ok:!1,status:0,errorCode:"network_error",message:A?.message||"Network error"}}},[]),v=l.useCallback(async P=>{if(!y)return{ok:!1,status:0,message:"Project not loaded"};const S=await j(y,"POST",{rule:P});return S.ok&&S.rule&&o(I=>[S.rule,...I]),S},[y,j]),_=l.useCallback(async(P,S)=>{if(!y)return{ok:!1,status:0,message:"Project not loaded"};const I=await j(`${y}/${P}`,"PATCH",{rule:S});return I.ok&&I.rule&&o(A=>A.map(E=>E.id===P?I.rule:E)),I},[y,j]),$=l.useCallback(async(P,S)=>{const I=r;o(E=>E.map(B=>B.id===P?{...B,enabled:S}:B));const A=await _(P,{enabled:S});return A.ok||o(I),A},[r,_]),k=l.useCallback(async P=>{if(!y)return{ok:!1,status:0,message:"Project not loaded"};const S=r;o(A=>A.filter(E=>E.id!==P));const I=await j(`${y}/${P}`,"DELETE");return I.ok||o(S),I},[y,r,j]);return{rules:r,meta:s,loading:c,error:m,refetch:w,create:v,update:_,toggle:$,destroy:k}}function tZ(e){if(e==null)return null;const n=Number(e);return Number.isFinite(n)&&n>0?n:null}function Vbt(e){switch(e){case 401:return"not_authenticated";case 403:return"not_authorized";case 404:return"not_found";case 422:return"invalid"}return`http_${e}`}function Kbt(){const e=zn(),{workspaceId:n,projectId:i}=Gn(),{projects:r}=Mr(),o=l.useMemo(()=>{const X=Number(i);return Number.isFinite(X)&&X>0?X:null},[i]),s=l.useMemo(()=>o?r.find(X=>X.id===o):null,[o,r]),a=!!(s?.can?.edit||s?.can?.settings),{rules:c,meta:u,loading:m,error:h,refetch:g,create:x,update:y,toggle:w,destroy:j}=Gbt({organizationId:n??null,projectId:o}),[v,_]=l.useState(null),[$,k]=l.useState(null),[P,S]=l.useState(null),[I,A]=l.useState(null),[E,B]=l.useState(!1),[T,M]=l.useState(null),R=l.useMemo(()=>c.filter(X=>X.agent_type==="tech"),[c]),F=l.useMemo(()=>c.filter(X=>X.agent_type==="content"),[c]),Y=l.useCallback(async X=>{B(!0),M(null);const Q=await x(X);return B(!1),Q.ok?(k(null),!0):(M(Q.message||"Couldn't save rule."),!1)},[x]),H=l.useCallback(async(X,Q)=>{B(!0),M(null);const K=await y(X,Q);return B(!1),K.ok?(_(null),!0):(M(K.message||"Couldn't save rule."),!1)},[y]),U=l.useCallback(async()=>{if(!P)return;B(!0),A(null);const X=await j(P.id);if(B(!1),!X.ok){A(X.message||"Couldn't delete rule.");return}S(null)},[P,j]);return t.jsx(ma,{children:t.jsxs(Kc,{children:[t.jsxs(Ys,{children:[t.jsxs(j1t,{type:"button",onClick:()=>e(`/workspaces/${n}/projects/${i}/agents`),children:[t.jsx(Bd,{size:14})," Back to Agents"]}),t.jsxs(ha,{children:[t.jsx(fa,{children:"Agent Rules"}),t.jsx("div",{style:{paddingRight:8,minWidth:0}
17711,children:t.jsx(qr,{items:[{label:"Projects",to:n?`/workspaces/${n}`:void 0},{label:s?.name||"Project",to:n&&i?`/workspaces/${n}/projects/${i}`:void 0},{label:"Agents",to:n&&i?`/workspaces/${n}/projects/${i}/agents`:void 0},{label:"Rules"}]})})]}),t.jsx(ga,{children:"Automate how agents respond to new proposals and drafts from site audits, recommended actions, and similar work â auto-accepted items can run immediately, and auto-dismissed ones stay out of your review queue."})]}),h&&t.jsxs(w1t,{children:[t.jsx(Sf,{size:14}),t.jsx("span",{children:h}),t.jsx(he,{variant:"outline",size:"sm",onClick:()=>void g(),children:"Try again"})]}),t.jsxs(e1t,{children:[t.jsx(nZ,{title:"Tech Agent rules",icon:t.jsx(Ef,{size:14}),subtitle:"Automate decisions on Tech Agent proposals from audits, actions, and similar findings (e.g. titles, meta descriptions, OG tags).",rules:R,loading:m,onAdd:()=>k("tech"),onEdit:X=>_(X),onToggle:(X,Q)=>void w(X.id,Q),onDelete:X=>S(X),meta:u,agentType:"tech",canManage:a}),t.jsx(nZ,{title:"Content Agent rules",icon:t.jsx(Sn,{size:14}),subtitle:"Automate which content opportunities get drafted (or dismissed) without your input.",rules:F,loading:m,onAdd:()=>k("content"),onEdit:X=>_(X),onToggle:(X,Q)=>void w(X.id,Q),onDelete:X=>S(X),meta:u,agentType:"content",canManage:a})]}),a&&($||v)&&u&&t.jsx(Ybt,{mode:v?"edit":"create",agentType:v?v.agent_type:$,initial:v,meta:u,busy:E,error:T,onClose:()=>{_(null),k(null),M(null)},onSubmit:async X=>v?H(v.id,X):Y(X)}),a&&P&&t.jsxs(Hn,{isOpen:!0,onClose:()=>{S(null),A(null)},title:"Delete this rule?",description:`"${P.name}" will stop firing immediately. Existing decisions made by this rule are kept in history.`,footer
17711:t.jsxs(kue,{children:[t.jsx(he,{variant:"outline",onClick:()=>{S(null),A(null)},disabled:E,children:"Cancel"}),t.jsx(he,{variant:"primary",onClick:()=>void U(),disabled:E,children:E?"Deletingâ¦":"Delete rule"})]}),children:[t.jsxs(D1t,{children:[t.jsx(Fi,{size:16}),t.jsx("span",{children:"Rule cannot be recovered."})]}),I&&t.jsx(L1t,{role:"alert",children:I})]})]})})}function nZ({title:e,subtitle:n,icon:i,rules:r,loading:o,meta:s,agentType:a,onAdd:c,onEdit:u,onToggle:m,onDelete:h,canManage:g}){const x=s?.allowed_actions_per_agent?.[a]??[];return t.jsxs(t1t,{children:[t.jsxs(n1t,{children:[t.jsxs(i1t,{children:[t.jsx(r1t,{children:i}),t.jsxs("div",{children:[t.jsx(o1t,{children:e}),t.jsx(s1t,{children:n})]})]}),g&&t.jsxs(he,{variant:"primary",size:"sm",onClick:c,disabled:!s||x.length===0,children:[t.jsx(gr,{size:13}),"New rule"]})]}),o&&r.length===0?t.jsxs(b1t,{children:[t.jsx(nt,{width:"100%",height:60}),t.jsx(nt,{width:"100%",height:60})]}):r.length===0?t.jsxs(v1t,{children:[t.jsxs("strong",{children:["No ",a==="tech"?"Tech":"Content"," Agent rules yet."]}),t.jsxs("p",{children:["Rules let agents act without manual review."," ",a==="tech"?"Try auto-accepting low-risk metadata fixes, or auto-dismissing proposals you've already chosen to handle manually.":"Try auto-dismissing topic suggestions outside your niche so the queue stays focused."]})]}):t.jsx(a1t,{children:r.map(y=>t.jsxs(l1t,{$disabled:!y.enabled,children:[t.jsxs(c1t,{children:[t.jsxs(d1t,{children:[t.jsx(u1t,{children:y.name}),t.jsx(p1t,{$action:y.action_type,children:_ue(y.action_type)}),!y.enabled&&t.jsx(m1t,{children:"Paused"})]}),g&&t.jsxs(h1t,{children:[t.jsx(Cue,{"aria-label":y.enabled?"Disable rule":"Enable rule",role:"switch","aria-checked":y.enabled,onClick:()=>m(y,!y.enabled),$on:y.enabled,children:t.jsx(Sue,{$on:y.enabled})}),t.jsx(rZ,{type:"button","aria-label":"Edit rule",onClick:()=>u(y),children:t.jsx(Lc,{size:13})}),t.jsx(rZ,{type:"button","aria-label":"Delete rule",onClick:()=>h(y),children:t.jsx(Fi,{size:13})})]})]}),t.jsxs(f1t,{children:[t.jsx(g1t,{children:Qbt(y)}),y.description&&t.jsx(y1t,{children:y.description})]}),t.jsxs(x1t,{children:[t.jsxs(o4,{children:[t.jsx(Ks,{size:11}),"Today: ",t.jsx("strong",{children:y.trigger_count_today})," / ",y.max_per_day]}),t.jsxs(o4,{children:["Total fired: ",t.jsx("strong",{children:y.trigger_count_total})]}),y.last_triggered_at&&t.jsxs(o4,{children:["Last fired: ",t.jsx("strong",{children:Zbt(y.last_triggered_at)})]})]})]},y.id))})]})}function Ybt({mode:e,agentType:n,initial:i,meta:r,busy:o,error:s,onSubmit:a,onClose:c}){const u=r.allowed_actions_per_agent[n]||[],[m,h]=l.useState(i?.name??iZ(n)),[g,x]=l.useState(i?.description??""),[y,w]=l.useState(i?.enabled??!0),[j,v]=l.useState(i?.action_type||u[0]||"auto_accept"),[_,$]=l.useState(i?.max_per_day??25),k=i?.match??{},[P,S]=l.useState(k.audit_codes??[]),[I,A]=l.useState(k.audit_severities??[]),[E,B]=l.useState((k.audit_categories??[]).join(", ")),[T,M]=l.useState(k.page_url_includes??""),[R,F]=l.useState(k.max_severity??""),Y=r.supported_audit_codes||[],H=l.useMemo(()=>new Set(r.review_required_codes||[]),[r.review_required_codes]),U=l.useMemo(()=>new Set(r.content_supported_codes||[]),[r.content_supported_codes]),X=l.useMemo(()=>{if(j!=="auto_accept"||H.size===0)return null;if(P.length===0)return{kind:"implicit",codes:Array.from(H)};const G=P.filter(L=>H.has(L));return G.length===0?null:{kind:"explicit",codes:G}},[j,P,H]),Q=l.useMemo(()=>{if(n!=="content"||j!=="auto_generate"||U.size===0)return null;if(P.length===0)return{kind:"implicit",codes:Array.from(U)};const G=P.filter(L=>U.has(L));return G.length===0?null:{kind:"explicit",codes:G}},[n,j,P,U]),K=l.useCallback(async G=>{G.preventDefault();const L={};P.length&&(L.audit_codes=P),I.length&&(L.audit_severities=I);const q=E.split(",").map(oe=>oe.trim()).filter(Boolean);q.length&&(L.audit_categories=q),T.trim()&&(L.page_url_includes=T.trim()),R&&(L.max_severity=R);const W={name:m.trim(),description:g.trim()||void 0,enabled:y,agent_type:n,action_type:j,match:L,max_per_day:Jbt(Math.round(_),1,r.max_per_day_ceiling)};await a(W)},[m,g,y,n,j,_,r.max_per_day_ceiling,P,I,E,T,R,a]);return t.jsx(Hn,{isOpen:!0,onClose:c,title:e==="create"?`New ${n==="tech"?"Tech":"Content"} Agent rule`:"Edit rule",size:"lg",maxWidth:"42rem",footer:t.jsxs(kue,{children:[t.jsx(he,{variant:"outline",onClick:c,disabled:o,children:"Cancel"}),t.jsx(he,{variant:"primary",type:"submit",form:"agent-rule-form",disabled:o||!m.trim(),children:o?"Savingâ¦":e==="create"?"Create rule":"Save changes"})]}),children:t.jsxs(_1t,{id:"agent-rule-form",onSubmit:K,children:[s&&t.jsxs(C1t,{children:[t.jsx(Sf,{size:13}),t.jsx("span",{children:s})]}),t.jsxs(fp,{children:[t.jsx(xm,{htmlFor:"rule-name",children:"Name"}),t.jsx(uj,{id:"rule-name",type:"text",value:m,onChange:G=>h(G.target.value),placeholder:iZ(n),maxLength:120,required:!0}),t.jsx(Kh,{children:"What this rule is for. Shows up in your activity feed when it fires."})]}),t.jsxs(fp,{children:[t.jsx(xm,{children:"Action"}),t.jsx(I1t,{children:u.map(G=>t.jsxs(P1t,{$active:j===G,type:"button",onClick:()=>v(G),children:[t.jsxs(A1t,{children:[G==="auto_accept"&&t.jsx(Ks,{size:13}),G==="auto_dismiss"&&t.jsx(WE,{size:13}),G==="auto_generate"&&t.jsx(Sn,{size:13}),_ue(G)]}),t.jsx(N1t,{children:Xbt(G)})]},G))})]}),t.jsxs(fp,{children:[t.jsx(xm,{children:"Match â audit codes"}),t.jsxs(z1t,{children:[Y.map(G=>
17711{const L=P.includes(G),q=H.has(G);return t.jsxs(T1t,{type:"button",$active:L,$reviewRequired:q,title:q?"This code requires manual review â auto-accept rules will skip it.":void 0,onClick:()=>S(W=>L?W.filter(oe=>oe!==G):[...W,G]),children:[q&&t.jsx(g5,{size:10}),G]},G)}),Y.length===0&&t.jsx(Kh,{children:"No supported audit codes published yet."})]}),t.jsx(Kh,{children:"Leave empty to match every audit code this agent supports."}),X&&t.jsxs(oZ,{role:"status",children:[t.jsx(g5,{size:13}),t.jsxs("div",{children:[t.jsx("strong",{children:"Some matches require manual review."}),t.jsx("p",{children:X.kind==="explicit"?`Auto-accept will be skipped for: ${X.codes.join(", ")}. These proposals will stay in your queue so you can OK each one in person.`:`Codes like ${X.codes.join(", ")} are potentially destructive â they'll stay in your queue for manual approval even though this rule matches them.`})]})]}),Q&&t.jsxs(oZ,{role:"status",children:[t.jsx(g5,{size:13}),t.jsxs("div",{children:[t.jsx("strong",{children:"Drafts will land in your review queue."}),t.jsx("p",{children:Q.kind==="explicit"?`The Content Agent will draft a rewrite for matches like ${Q.codes.slice(0,3).join(", ")}${Q.codes.length>3?`, +${Q.codes.length-3} more`:""}, but every rewrite needs a human OK before it touches your post â they won't auto-publish.`:`Rewrites of existing posts (codes like ${Q.codes.slice(0,3).join(", ")}${Q.codes.length>3?`, +${Q.codes.length-3} more`:""}) always require manual review. The rule will create the draft for you; you'll approve it from the Content tab.`})]})]})]}),t.jsxs(S1t,{children:[t.jsxs(fp,{children:[t.jsx(xm,{children:"Match â severities"}),t.jsx(E1t,{children:["high","medium","low"].map(G=>t.jsx(M1t,{type:"button",$sev:G,$active:I.includes(G),onClick:()=>A(L=>L.includes(G)?L.filter(q=>q!==G):[...L,G]),children:G},G))}),t.jsx(Kh,{children:"Leave empty to match all severities."})]}),t.jsxs(fp,{children:[t.jsx(xm,{htmlFor:"rule-max-sev",children:"Cap at most"}),t.jsxs($1t,{id:"rule-max-sev",value:R,onChange:G=>F(G.target.value),children:[t.jsx("option",{value:"",children:"No upper bound"}),t.jsx("option",{value:"low",children:"Low or below"}),t.jsx("option",{value:"medium",children:"Medium or below"}),t.jsx("option",{value:"high",children:"High or below"})]}),t.jsx(Kh,{children:"Refuse to act on anything more severe than this. Useful for safe-by-default auto_accept rules."})]})]}),t.jsxs(fp,{children:[t.jsx(xm,{htmlFor:"rule-cats",children:"Match â categories"}),t.jsx(uj,{id:"rule-cats",type:"text",value:E,onChange:G=>B(G.target.value),placeholder:"metadata, openGraph, performance"}),t.jsx(Kh,{children:"Comma-separated list. Leave empty to match all."})]}),t.jsxs(fp,{children:[t.jsx(xm,{htmlFor:"rule-url",children:"Match â page URL contains"}),t.jsx(uj,{id:"rule-url",type:"text",value:T,onChange:G=>M(G.target.value),placeholder:"/blog/ or example.com/products"}),t.jsx(Kh,{children:"Substring filter on the affected page URL. Empty means any page."})]}),t.jsxs(fp,{children:[t.jsxs(xm,{htmlFor:"rule-cap",children:["Daily limit (",_," per day)"]}),t.jsxs(R1t,{children:[t.jsx(uj,{id:"rule-cap",type:"range",min:1,max:r.max_per_day_ceiling,step:1,value:_,onChange:G=>$(Number(G.target.value)||1)}),t.jsx(uj,{type:"number",min:1,max:r.max_per_day_ceiling,value:_,onChange:G=>$(Number(G.target.value)||1),style:{width:"5rem"}})]}),t.jsxs(Kh,{children:["Hard ceiling is ",r.max_per_day_ceiling,"/day. The rule pauses itself once this many actions fire, and resets at UTC midnight."]})]}),t.jsxs(fp,{children:[t.jsx(xm,{htmlFor:"rule-desc",children:"Description (optional)"}),t.jsx(k1t,{id:"rule-desc",value:g,onChange:G=>x(G.target.value),rows:2,placeholder:"Why this rule exists, who set it up, etc."})]}),t.jsx(fp,{children:t.jsxs(O1t,{children:[t.jsx(Cue,{type:"button",role:"switch","aria-checked":y,onClick:()=>w(G=>!G),$on:y,children:t.jsx(Sue,{$on:y})}),t.jsx("span",{children:y?"Enabled â the rule will fire after the next audit":"Paused â saved but won't fire"})]})})]})})}function _ue(e){switch(e){case"auto_accept":return"Auto-accept";case"auto_dismiss":return"Auto-dismiss";case"auto_generate":return"Auto-draft"}}function Xbt(e){switch(e){case"auto_accept":return"Spend credits and dispatch the fix to WordPress
17711immediately.";case"auto_dismiss":return"Quietly close matching proposals without a queue entry.";case"auto_generate":return"Have the Content Agent draft new content from matching opportunities."}}function iZ(e){return e==="tech"?"Auto-fix safe metadata":"Auto-draft niche topics"}function Qbt(e){const n=e.match||{},i=[];return Array.isArray(n.audit_codes)&&n.audit_codes.length&&i.push(`code in [${n.audit_codes.join(", ")}]`),Array.isArray(n.audit_severities)&&n.audit_severities.length&&i.push(`severity in [${n.audit_severities.join(", ")}]`),Array.isArray(n.audit_categories)&&n.audit_categories.length&&i.push(`category in [${n.audit_categories.join(", ")}]`),n.max_severity&&i.push(`max severity ⤠${n.max_severity}`),n.page_url_includes&&i.push(`page url â "${n.page_url_includes}"`),i.length===0?"Matches every eligible item.":i.join(" · ")}function Zbt(e){if(!e)return"";const n=new Date(e).getTime();if(!Number.isFinite(n))return"";const i=Date.now()-n,r=Math.floor(i/6e4);if(r<1)return"just now";if(r<60)return`${r}m ago`;const o=Math.floor(r/60);if(o<24)return`${o}h ago`;const s=Math.floor(o/24);return s<7?`${s}d ago`:new Date(e).toLocaleDateString()}function Jbt(e,n,i){return Math.max(n,Math.min(i,e))}const e1t=p.div.withConfig({displayName:"AgentRulesPage__RulesStack",componentId:"sc-1ofag1p-0"})` 17712 margin-top: 3.25rem; 17713 display: flex; 17714 flex-direction: column; 17715 gap: 0; 17716`,t1t=p.section.withConfig({displayName:"AgentRulesPage__Section",componentId:"sc-1ofag1p-1"})` 17717 display: grid; 17718 gap: 0.6rem; 17719 & + & { 17720 margin-top: 1.35rem; 17721 } 17722`,n1t=p.div.withConfig({displayName:"AgentRulesPage__SectionHeader",componentId:"sc-1ofag1p-2"})` 17723 display: flex; 17724 align-items: flex-start; 17725 justify-content: space-between; 17726 gap: 0.75rem; 17727`,i1t=p.div.withConfig({displayName:"AgentRulesPage__SectionTitleRow",componentId:"sc-1ofag1p-3"})` 17728 display: flex; 17729 align-items: flex-start; 17730 gap: 0.6rem; 17731`,r1t=p.span.withConfig({displayName:"AgentRulesPage__SectionIcon",componentId:"sc-1ofag1p-4"})` 17732 display: inline-flex; 17733 align-items: center; 17734 justify-content: center; 17735 width: 1.6rem; 17736 height: 1.6rem; 17737 border-radius: 0.45rem; 17738 background: ${cn}; 17739 color: ${Ft}; 17740`,o1t=p.h2.withConfig({displayName:"AgentRulesPage__SectionTitle",componentId:"sc-1ofag1p-5"})` 17741 font-size: 0.95rem; 17742 font-weight: 800; 17743 color: ${O}; 17744 margin: 0; 17745`,s1t=p.p.withConfig({displayName:"AgentRulesPage__SectionSubtitle",componentId:"sc-1ofag1p-6"})` 17746 margin: 0.15rem 0 0; 17747 font-size: 0.78rem; 17748 color: ${z}; 17749 max-width: 36rem; 17750`,a1t=p.div.withConfig({displayName:"AgentRulesPage__RuleList",componentId:"sc-1ofag1p-7"})` 17751 display: grid; 17752 gap: 0.45rem; 17753`,l1t=p.div.withConfig({displayName:"AgentRulesPage__RuleRow",componentId:"sc-1ofag1p-8"})` 17754 border: 1px solid ${V}; 17755 background: ${Z}; 17756 border-radius: 0.6rem; 17757 padding: 0.65rem 0.8rem; 17758 display: grid; 17759 gap: 0.4rem; 17760 opacity: ${e=>e.$disabled?.7:1}; 17761`,c1t=p.div.withConfig({displayName:"AgentRulesPage__RowHead",componentId:"sc-1ofag1p-9"})` 17762 display: flex; 17763 align-items: center; 17764 justify-content: space-between; 17765 gap: 0.5rem; 17766`,d1t=p.div.withConfig({displayName:"AgentRulesPage__RowTitleCluster",componentId:"sc-1ofag1p-10"})` 17767 display: inline-flex; 17768 align-items: center; 17769 gap: 0.4rem; 17770 flex-wrap: wrap; 17771`,u1t=p.strong.withConfig({displayName:"AgentRulesPage__RuleName",componentId:"sc-1ofag1p-11"})` 17772 font-size: 0.85rem; 17773 color: ${O}; 17774 font-weight: 800; 17775`,p1t=p.span.withConfig({displayName:"AgentRulesPage__ActionPill",componentId:"sc-1ofag1p-12"})` 17776 display: inline-flex; 17777 align-items: center; 17778 padding: 0.1rem 0.45rem; 17779 border-radius: 999px; 17780 background: ${e=>e.$action==="auto_accept"?`color-mix(in srgb, ${Vt} 16%, ${Z})`:e.$action==="auto_dismiss"?$e:cn}; 17781 color: ${e=>e.$action==="auto_accept"?Vt:e.$action==="auto_dismiss"?z:Ft}; 17782 font-weight: 700; 17783 font-size: 0.65rem; 17784 text-transform: uppercase; 17785 letter-spacing: 0.04em; 17786`,m1t=p.span.withConfig({displayName:"AgentRulesPage__DisabledPill",componentId:"sc-1ofag1p-13"})` 17787 display: inline-flex; 17788 align-items: center; 17789 padding: 0.1rem 0.45rem; 17790 border-radius: 999px; 17791 background: ${$e}; 17792 color: ${z}; 17793 font-weight: 700; 17794 font-size: 0.62rem; 17795 text-transform: uppercase; 17796 letter-spacing: 0.04em; 17797`,h1t=p.div.withConfig({displayName:"AgentRulesPage__RowActions",componentId:"sc-1ofag1p-14"})` 17798 display: inline-flex; 17799 align-items: center; 17800 gap: 0.35rem; 17801`,f1t=p.div.withConfig({displayName:"AgentRulesPage__RowBody",componentId:"sc-1ofag1p-15"})` 17802 display: grid; 17803 gap: 0.15rem; 17804`,g1t=p.span.withConfig({displayName:"AgentRulesPage__RuleSummaryText",componentId:"sc-1ofag1p-16"})` 17805 font-size: 0.78rem; 17806 color: ${O}; 17807`,y1t=p.span.withConfig({displayName:"AgentRulesPage__RuleDesc",componentId:"sc-1ofag1p-17"})` 17808 font-size: 0.74rem; 17809 color: ${z}; 17810`,x1t=p.div.withConfig({displayName:"AgentRulesPage__RowFoot",componentId:"sc-1ofag1p-18"})` 17811 display: inline-flex; 17812 align-items: center; 17813 gap: 0.6rem; 17814 flex-wrap: wrap; 17815 font-size: 0.7rem; 17816 color: ${z}; 17817 & strong { color: ${O}; font-weight: 700; } 17818`,o4=p.span.withConfig({displayName:"AgentRulesPage__FootStat",componentId:"sc-1ofag1p-19"})` 17819 display: inline-flex; 17820 align-items: center; 17821 gap: 0.25rem; 17822`,Cue=p.button.withConfig({displayName:"AgentRulesPage__ToggleSwitch",componentId:"sc-1ofag1p-20"})` 17823 appearance: none; 17824 border: 0; 17825 width: 2.2rem; 17826 height: 1.25rem; 17827 border-radius: 999px; 17828 background: ${e=>e.$on?Ft:V}; 17829 position: relative; 17830 cursor: pointer; 17831 padding: 0; 17832 transition: background 120ms ease; 17833`,Sue=p.span.withConfig({displayName:"AgentRulesPage__ToggleKnob",componentId:"sc-1ofag1p-21"})` 17834 position: absolute; 17835 top: 50%; 17836 left: ${e=>e.$on?"1.05rem":"0.15rem"}; 17837 transform: translateY(-50%); 17838 width: 1rem; 17839 height: 1rem; 17840 border-radius: 999px; 17841 background: ${Z}; 17842 box-shadow: ${ige}; 17843 transition: left 120ms ease; 17844`,rZ=p.button.withConfig({displayName:"AgentRulesPage__IconBtn",componentId:"sc-1ofag1p-22"})` 17845 appearance: none; 17846 background: ${Z}; 17847 border: 1px solid ${V}; 17848 color: ${O}; 17849 width: 1.7rem; 17850 height: 1.7rem; 17851 border-radius: 0.4rem; 17852 display: inline-flex; 17853 align-items: center; 17854 justify-content: center; 17855 cursor: pointer; 17856 &:hover { background: ${$e}; } 17857`,b1t=p.div.withConfig({displayName:"AgentRulesPage__SkeletonList",componentId:"sc-1ofag1p-23"})` 17858 display: grid; 17859 gap: 0.4rem; 17860`,v1t=p.div.withConfig({displayName:"AgentRulesPage__EmptyTile",componentId:"sc-1ofag1p-24"})` 17861 border: 1px dashed ${V}; 17862 background: ${Z}; 17863 border-radius: 0.6rem; 17864 padding: 1rem; 17865 text-align: center; 17866 color: ${z}; 17867 font-size: 0.78rem; 17868 & strong { display: block; color: ${O}; font-weight: 800; margin-bottom: 0.25rem; } 17869 & p { margin: 0; max-width: 36rem; margin-left: auto; margin-right: auto; } 17870`,w1t=p.div.withConfig({displayName:"AgentRulesPage__ErrorBanner",componentId:"sc-1ofag1p-25"})` 17871 display: flex; 17872 align-items: center; 17873 gap: 0.5rem; 17874 padding: 0.55rem 0.75rem; 17875 background: color-mix(in srgb, ${Ut} 14%, ${Z}); 17876 border: 1px solid ${Ut}; 17877 color: ${Ut}; 17878 border-radius: 0.55rem; 17879 font-size: 0.78rem; 17880 margin-top: 0.5rem; 17881 & > span { flex: 1; } 17882`,j1t=p.button.withConfig({displayName:"AgentRulesPage__BackBtn",componentId:"sc-1ofag1p-26"})` 17883 display: inline-flex; 17884 align-items: center; 17885 gap: 0.25rem; 17886 background: transparent; 17887 border: 0; 17888 color: ${z}; 17889 cursor: pointer; 17890 font-size: 0.78rem; 17891 padding: 0; 17892 margin-bottom: 0.25rem; 17893 &:hover { color: ${O}; } 17894`,_1t=p.form.withConfig({displayName:"AgentRulesPage__Form",componentId:"sc-1ofag1p-27"})` 17895 display: grid; 17896 gap: 0.85rem; 17897`,C1t=p.div.withConfig({displayName:"AgentRulesPage__FormError",componentId:"sc-1ofag1p-28"})` 17898 display: inline-flex; 17899 align-items: center; 17900 gap: 0.4rem; 17901 padding: 0.45rem 0.6rem; 17902 background: color-mix(in srgb, ${Ut} 14%, ${Z}); 17903 color: ${Ut}; 17904 border: 1px solid ${Ut}; 17905 border-radius: 0.4rem; 17906 font-size: 0.78rem; 17907`,fp=p.div.withConfig({displayName:"AgentRulesPage__Field",componentId:"sc-1ofag1p-29"})` 17908 display: grid; 17909 gap: 0.3rem; 17910`,S1t=p.div.withConfig({displayName:"AgentRulesPage__FieldRow",componentId:"sc-1ofag1p-30"})` 17911 display: grid; 17912 grid-template-columns: 1fr 1fr; 17913 gap: 0.85rem; 17914 17915 @media (max-width: 640px) { 17916 grid-template-columns: 1fr; 17917 } 17918`,xm=p.label.withConfig({displayName:"AgentRulesPage__FieldLabel",componentId:"sc-1ofag1p-31"})` 17919 font-size: 0.78rem; 17920 font-weight: 700; 17921 color: ${O}; 17922`,uj=p.input.withConfig({displayName:"AgentRulesPage__FieldInput",componentId:"sc-1ofag1p-32"})` 17923 border: 1px solid ${V}; 17924 background: ${Z}; 17925 border-radius: 0.45rem; 17926 padding: 0.45rem 0.55rem; 17927 font-size: 0.82rem; 17928 font-family: inherit; 17929 color: ${O}; 17930 &::placeholder { 17931 color: ${Pe}; 17932 } 17933 &:focus { 17934 outline: none; 17935 border-color: ${ot}; 17936 box-shadow: 0 0 0 3px ${En}; 17937 } 17938`,k1t=p.textarea.withConfig({displayName:"AgentRulesPage__FieldTextarea",componentId:"sc-1ofag1p-33"})` 17939 border: 1px solid ${V}; 17940 background: ${Z}; 17941 border-radius: 0.45rem; 17942 padding: 0.45rem 0.55rem; 17943 font-size: 0.82rem; 17944 font-family: inherit; 17945 color: ${O}; 17946 resize: vertical; 17947 &::placeholder { 17948 color: ${Pe}; 17949 } 17950 &:focus { 17951 outline: none; 17952 border-color: ${ot}; 17953 box-shadow: 0 0 0 3px ${En}; 17954 } 17955`,$1t=p.select.withConfig({displayName:"AgentRulesPage__FieldSelect",componentId:"sc-1ofag1p-34"})` 17956 border: 1px solid ${V}; 17957 background: ${Z}; 17958 border-radius: 0.45rem; 17959 padding: 0.45rem 0.55rem; 17960 font-size: 0.82rem; 17961 font-family: inherit; 17962 color: ${O}; 17963 &:focus { 17964 outline: none; 17965 border-color: ${ot}; 17966 box-shadow: 0 0 0 3px ${En}; 17967 } 17968`,Kh=p.span.withConfig({displayName:"AgentRulesPage__FieldHelp",componentId:"sc-1ofag1p-35"})` 17969 font-size: 0.7rem; 17970 color: ${z}; 17971`,I1t=p.div.withConfig({displayName:"AgentRulesPage__ActionGrid",componentId:"sc-1ofag1p-36"})` 17972 display: grid; 17973 grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); 17974 gap: 0.4rem; 17975`,P1t=p.button.withConfig({displayName:"AgentRulesPage__ActionTile",componentId:"sc-1ofag1p-37"})` 17976 text-align: left; 17977 background: ${e=>e.$active?cn:Z}; 17978 border: 1px solid ${e=>e.$active?Ft:V}; 17979 color: ${O}; 17980 padding: 0.55rem 0.7rem; 17981 border-radius: 0.5rem; 17982 cursor: pointer; 17983 display: grid; 17984 gap: 0.2rem; 17985`,A1t=p.span.withConfig({displayName:"AgentRulesPage__ActionTileTitle",componentId:"sc-1ofag1p-38"})` 17986 display: inline-flex; 17987 align-items: center; 17988 gap: 0.35rem; 17989 font-weight: 700; 17990 font-size: 0.82rem; 17991`,N1t=p.span.withConfig({displayName:"AgentRulesPage__ActionTileDesc",componentId:"sc-1ofag1p-39"})` 17992 font-size: 0.7rem; 17993 color: ${z}; 17994`,z1t=p.div.withConfig({displayName:"AgentRulesPage__CodeGrid",componentId:"sc-1ofag1p-40"})` 17995 display: flex; 17996 flex-wrap: wrap; 17997 gap: 0.3rem; 17998`,T1t=p.button.withConfig({displayName:"AgentRulesPage__CodeChip",componentId:"sc-1ofag1p-41"})` 17999 display: inline-flex; 18000 align-items: center; 18001 gap: 3px; 18002 appearance: none; 18003 background: ${e=>e.$active?Ft:e.$reviewRequired?Jl:$e}; 18004 color: ${e=>e.$active?Z:e.$reviewRequired?$i:O}; 18005 border: ${e=>!e.$active&&e.$reviewRequired?`1px solid ${K_}`:"0"}; 18006 border-radius: 999px; 18007 padding: 0.2rem 0.5rem; 18008 font-size: 0.7rem; 18009 font-family: ui-monospace, SFMono-Regular, Menlo, monospace; 18010 cursor: pointer; 18011`,oZ=p.div.withConfig({displayName:"AgentRulesPage__ReviewWarning",componentId:"sc-1ofag1p-42"})` 18012 display: flex; 18013 align-items: flex-start; 18014 gap: 0.45rem; 18015 margin-top: 0.4rem; 18016 padding: 0.5rem 0.65rem; 18017 background: ${Jl}; 18018 border: 1px solid ${K_}; 18019 border-radius: 0.45rem; 18020 color: ${$i}; 18021 font-size: 0.75rem; 18022 & strong { display: block; color: ${O}; font-weight: 700; margin-bottom: 0.15rem; font-size: 0.78rem; } 18023 & p { margin: 0; color: ${z}; font-size: 0.72rem; line-height: 1.4; } 18024 & svg { margin-top: 2px; flex-shrink: 0; } 18025`,E1t=p.div.withConfig({displayName:"AgentRulesPage__SeverityRow",componentId:"sc-1ofag1p-43"})` 18026 display: inline-flex; 18027 gap: 0.3rem; 18028`,M1t=p.button.withConfig({displayName:"AgentRulesPage__SeverityChip",componentId:"sc-1ofag1p-44"})` 18029 appearance: none; 18030 background: ${e=>e.$active?e.$sev==="high"?Ut:e.$sev==="medium"?$i:z:$e}; 18031 color: ${e=>e.$active?Z:O}; 18032 border: 0; 18033 border-radius: 999px; 18034 padding: 0.2rem 0.55rem; 18035 font-size: 0.7rem; 18036 text-transform: capitalize; 18037 cursor: pointer; 18038`,R1t=p.div.withConfig({displayName:"AgentRulesPage__RangeRow",componentId:"sc-1ofag1p-45"})` 18039 display: flex; 18040 align-items: center; 18041 gap: 0.6rem; 18042 & input[type="range"] { flex: 1; } 18043`,O1t=p.div.withConfig({displayName:"AgentRulesPage__ToggleRow",componentId:"sc-1ofag1p-46"})` 18044 display: inline-flex; 18045 align-items: center; 18046 gap: 0.55rem; 18047 font-size: 0.78rem; 18048 color: ${O}; 18049`,kue=p.div.withConfig({displayName:"AgentRulesPage__ModalFooter",componentId:"sc-1ofag1p-47"})` 18050 display: flex; 18051 justify-content: flex-end; 18052 gap: 0.5rem; 18053`,D1t=p.div.withConfig({displayName:"AgentRulesPage__DeleteSummary",componentId:"sc-1ofag1p-48"})` 18054 display: inline-flex; 18055 align-items: center; 18056 gap: 0.4rem; 18057 font-size: 0.82rem; 18058 color: ${O}; 18059`,L1t=p.div.withConfig({displayName:"AgentRulesPage__DeleteError",componentId:"sc-1ofag1p-49"})` 18060 margin-top: 0.6rem; 18061 padding: 0.5rem 0.65rem; 18062 border: 1px solid ${Ut}; 18063 background: color-mix(in srgb, ${Ut} 10%, ${Z}); 18064 border-radius: 6px; 18065 color: ${Ut}; 18066 font-size: 0.78rem; 18067 line-height: 1.35; 18068`;function B1t(){const e=zn(),{workspaceId:n,projectId:i}=Gn(),{projects:r}=Mr(),o=l.useMemo(()=>{const y=Number(i);return Number.isFinite(y)&&y>0?y:null},[i]),s=l.useMemo(()=>o?r.find(y=>y.id===o):null,[o,r]),a=!!(s?.can?.edit||s?.can?.settings),{retry:c,isPending:u}=jue({organizationId:n??null,projectId:o}),m=l.useCallback(async y=>{const w=await c(y);w.ok||alert(w.message??"Could not retry this operation")},[c]),{revert:h,isPending:g}=wue({organizationId:n??null,projectId:o}),x=l.useCallback(async y=>{const w=await h(y);w.ok||alert(w.message??"Could not start the revert")},[h]);return t.jsx(ma,{children:t.jsxs(Kc,{children:[t.jsxs(Ys,{children:[t.jsxs(F1t,{type:"button",onClick:()=>
18068e(`/workspaces/${n}/projects/${i}/agents`),children:[t.jsx(Bd,{size:14})," Back to Agents"]}),t.jsxs(ha,{children:[t.jsx(fa,{children:"Activity log"}),t.jsx("div",{style:{paddingRight:8,minWidth:0},children:t.jsx(qr,{items:[{label:"Projects",to:n?`/workspaces/${n}`:void 0},{label:s?.name||"Project",to:n&&i?`/workspaces/${n}/projects/${i}`:void 0},{label:"Agents",to:n&&i?`/workspaces/${n}/projects/${i}/agents`:void 0},{label:"Activity log"}]})})]}),t.jsx(ga,{children:"Every agent operation, proposal, and content draft on this project â searchable and filterable by agent (Tech / Content), status, and time. Re-queue a failed op or undo a successful one without leaving the page."})]}),t.jsx(d3e,{organizationId:n??null,projectId:o,onRetry:m,isRetryPending:u,onRevert:x,isRevertPending:g,canManage:a})]})})}const F1t=p.button.withConfig({displayName:"AgentLogPage__BackBtn",componentId:"sc-1g3cfmy-0"})` 18069 display: inline-flex; 18070 align-items: center; 18071 gap: 0.25rem; 18072 background: transparent; 18073 border: 0; 18074 color: ${z}; 18075 cursor: pointer; 18076 font-size: 0.78rem; 18077 padding: 0; 18078 margin-bottom: 0.25rem; 18079 &:hover { color: ${O}; } 18080`,$ue="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQwAAAENCAMAAADNDqsEAAAAGFBMVEVMaXH////////////////////////////eQubUAAAAB3RSTlMAzzmAFqdb8eZXZQAAAAlwSFlzAAAuIwAALiMBeKU/dgAABQhJREFUeNrtnQF24yAMRANC+P43Xm/3va3bbbuOwzgZ/DlA6g7SSGD4vt32jlbfRrtde9TIsmxGybimJi0+6LBRJCpKXFSPmst/R+nXkKIsu8YF5Gg7pXiTo07uFctdIxsZshkxqxaxHBhzBkcry6Exo3PUg1qsY7qyUpcHRkeLWdV4UIup1HhYi4nUaMuAMUtNKSPEWOboN3KIFkuZQYu+DBqBYUxlGzlOjNKoqvMkShkphnlF6UO1WJLAmCQ0BgeGd2iMDgzn0BgeGM4FJceLUWg+J1jLd4UYSZZshqkYEi1Ml2tVI0Zc5wXarPVEYxmmplFEYjT809tBq0qMQAxvMUIlRiKGd21FDMRADMRAjFcTY0EMbzFkHajjSk0nRmXV6r1BXlip6Xe6qK2UExwU05jfNDpt1037Fp48mSFPqCenNKGJhZq/YyQ0CI2zQ4OC4l5QdJvk7TpX4DmaMP/2X1BRTqko2IZ566VbyycmihozqYFvnOOijjVFtwnIMsW9F62kyjnB4bhswzmQYxwI8w45umOZ7bLwSMfKsuqhqi1pyWNuPVSKrAjzbkp2f0PS9wiVMmVV5oabfMgeyzhRRchKd3fUQxgf9Gb2dHdaVVa5bIEQHDjHy6ZK5SyUu3GgBmqgxlN9g5rifv4nOf/DsUHO13K+lmte3FG4cUcBD+VmE65BaMChmL/XAF5DnpAn5AkcCngtQJ5Yn4DJw0FpuygnwIkRg9UJYiAGnoEY9Bl0oKxNWLWyn8FOF20GxWQ2/+S9CYcSTu4/kyyxzhKOkLMwof3kICiBQWAQGJQSegyuc8Ko5vYit3wxjAtpEWhhbJ5oQY5AmYE/9PS+06/X6tjFCWFRIXK7QjCFUgREP9OoaFGA5sppyt2IPa5Fsr98W7H+/6UU1f8f9c8Y/MT594lXuHuMgd5L86FpMji/lv3BP1d11ULEWf/Z1Y9/S0RYLVTE+V40hcrwUy+9aHr85gfP7kW05Ol2CXIn63v/Yxhis0MVoH57mYcQ8Lvo7n77d10Vps3vXWmoZsfwC6WpqmyG5wlSVecvp8UPalxQi+/V8DuxmLIa51dHuqzi+/UXVTZXfmduhllcTnCSNWXT5XeStcqesV03Sf6NXr+qGjKP97sH0HRzdmX3/Dxplw+MbWhc3TG202Z4xlmX0H6ooK7rh/xOp6Usiv2ABk0XxmTJZurIkvc8MbyFqmsQ/eiMVZfVScf1bhoFy3hPaz//LLIHxj83Dlr9bq7rTI5ighhfP7EfkBAxEAMxEAMxLiRGGvYZ1W5p0hDjlLVJ87vPr1u13vwIY6l75VXsWOmhi+WwAzRW3fRVO9ZDE06fHw+l6KYv7T6vELrpCzuYVNWZXPMjKBWdyaXdR0hCZ3LdjhvUhK1AsQPcpi6vw47FV3U9YvODrhVdXocdK73q7gcNvp1W7eDmXXZKKuw+J1N0Qjc7zGSVCd3tvgIQMqHTjkz7xY29tON3hs7vB1WUake/77Kw63Yg0pAlYbf7XFvKzmSnHd67yE6opx3s/Ee773bw4yrEvVQ7VvoDLpoSzNNTWemHmUmh+u2nstJDOHvdjpV+IJx306HuDY7ns9LvBjN2ldRhh8W/F7e4G/wYr4JA3j2BR/hpe+Qo8Uo06F2U36NP/L8fz+4Ghn+MUtu/ZYzniyLCv8dh54Awbv3zz6+Q7Jfm5/9+4vIZb16HkuirAJYuleTuJ/4FCv4Mo7uMrtsAAAAASUVORK5CYII=",Oi="#ffffff",R1="#F8F9FA",po="#f3f4f6",zi="#e5e7eb",Nn="#9ca3af",fi="#6b7280",Vn="#111827",W1t="#eef2ff",mi="#4F46E5",Iue="#4338CA",_f={chatgpt:"ChatGPT",perplexity:"Perplexity",gemini:"Gemini",google_ai_mode:"AI Mode",google_ai_overview:"AI Overview",grok:"Grok",copilot:"Copilot",claude:"Claude"},Pue={chatgpt:"#6b7280",perplexity:"#22d3ee",gemini:"#3b82f6",google_ai_mode:"#f59e0b",google_ai_overview:"#10b981",grok:"#a855f7",copilot:"#0ea5e9",claude:"#f97316"};function hb(e){return e==null?"â":e.toFixed(1)}function Hs(e){return e==null?"â":e.toLocaleString()}function U1t(e){if(!e)return"";try{return new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",year:"numeric"}).format(new Date(e))}catch{return e}}function sD(e,n=800){const i=Number.isFinite(e)?e:0,[r,o]=l.useState(0),s=l.useRef(0),a=l.useRef(0),c=l.useCallback(u=>{a.current||(a.current=u);const m=u-a.current,h=Math.min(m/n,1),g=1-Math.pow(1-h,3);o(Math.round(g*i)),h<1&&(s.current=requestAnimationFrame(c))},[i,n]);return l.useEffect(()=>(a.current=0,s.current=requestAnimationFrame(c),()=>cancelAnimationFrame(s.current)),[c]),r}const Ho=p.div.withConfig({displayName:"reportShared__SlideLabel",componentId:"sc-5xl3gm-0"})` 18081 font-size: 0.68rem; 18082 font-weight: 900; 18083 letter-spacing: 0.14em; 18084 text-transform: uppercase; 18085 color: ${mi}; 18086 margin-bottom: 0.15rem; 18087`,qo=p.h2.withConfig({displayName:"reportShared__SlideTitle",componentId:"sc-5xl3gm-1"})` 18088 font-size: 1.85rem; 18089 font-weight: 950; 18090 letter-spacing: -0.02em; 18091 color: ${Vn}; 18092 margin: 0 0 0.75rem; 18093 line-height: 1.15; 18094 @media (max-width: 768px) { font-size: 1.45rem; } 18095 @media (max-width: 480px) { font-size: 1.25rem; } 18096`,Xc=p.p.withConfig({displayName:"reportShared__SlideSubtitle",componentId:"sc-5xl3gm-2"})` 18097 font-size: 0.88rem; 18098 font-weight: 600; 18099 color: ${fi}; 18100 margin: -0.35rem 0 1.25rem; 18101`,WA=p.div.withConfig({displayName:"reportShared__KpiGrid",componentId:"sc-5xl3gm-3"})` 18102 display: grid; 18103 grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); 18104 gap: 1rem; 18105 margin-bottom: 1.5rem; 18106`,Ul=p.div.withConfig({displayName:"reportShared__KpiCard",componentId:"sc-5xl3gm-4"})` 18107 border: 1px solid ${zi}; 18108 border-radius: 0.75rem; 18109 padding: 1rem; 18110 background: ${Oi}; 18111`,Hl=p.div.withConfig({displayName:"reportShared__KpiLabel",componentId:"sc-5xl3gm-5"})` 18112 font-size: 0.68rem; 18113 font-weight: 850; 18114 letter-spacing: 0.06em; 18115 text-transform: uppercase; 18116 color: ${fi}; 18117 margin-bottom: 0.35rem; 18118`,ql=p.div.withConfig({displayName:"reportShared__KpiValue",componentId:"sc-5xl3gm-6"})` 18119 font-size: 1.75rem; 18120 font-weight: 950; 18121 color: ${Vn}; 18122 line-height: 1.1; 18123`,H1t=p.span.withConfig({displayName:"reportShared__KpiDelta",componentId:"sc-5xl3gm-7"})` 18124 display: inline-flex; 18125 align-items: center; 18126 gap: 0.2rem; 18127 font-size: 0.72rem; 18128 font-weight: 850; 18129 color: ${e=>e.$positive?"#059669":"#dc2626"}; 18130 margin-top: 0.3rem; 18131`,My=p.div.withConfig({displayName:"reportShared__SectionCard",componentId:"sc-5xl3gm-8"})` 18132 border: 1px solid ${zi}; 18133 border-radius: 0.75rem; 18134 padding: 1.25rem; 18135 background: ${Oi}; 18136 margin-bottom: 1rem; 18137`,e1=p.div.withConfig({displayName:"reportShared__SectionCardTitle",componentId:"sc-5xl3gm-9"})` 18138 font-size: 0.95rem; 18139 font-weight: 900; 18140 color: ${Vn}; 18141 margin-bottom: 0.75rem; 18142`,Eo=p.div.withConfig({displayName:"reportShared__EmptySlide",componentId:"sc-5xl3gm-10"})` 18143 display: flex; 18144 align-items: center; 18145 justify-content: center; 18146 min-height: 200px; 18147 font-size: 1rem; 18148 font-weight: 700; 18149 color: ${Nn}; 18150 text-align: center; 18151 padding: 2rem; 18152`,Ou=p.div.withConfig({displayName:"reportShared__SlideBackgroun
18152d",componentId:"sc-5xl3gm-11"})``,q1t=Tn`from { transform: rotate(0deg); } to { transform: rotate(360deg); }`;p.div.withConfig({displayName:"reportShared__Spinner",componentId:"sc-5xl3gm-12"})` 18153 flex: 1; 18154 display: flex; 18155 align-items: center; 18156 justify-content: center; 18157 color: ${Nn}; 18158 & > svg { animation: ${q1t} 1s linear infinite; } 18159`;const G1t=p.div.withConfig({displayName:"CoverSlide__CoverShell",componentId:"sc-hu01bv-0"})` 18160 position: relative; 18161 display: flex; 18162 flex-direction: column; 18163 min-height: 100%; 18164 overflow: hidden; 18165 background: ${Oi}; 18166`,V1t=p.div.withConfig({displayName:"CoverSlide__CoverGradientBlob",componentId:"sc-hu01bv-1"})` 18167 position: absolute; 18168 top: -10%; 18169 right: -8%; 18170 width: 55%; 18171 height: 110%; 18172 background: radial-gradient(ellipse at 60% 40%, rgba(167, 139, 250, 0.35) 0%, rgba(139, 92, 246, 0.18) 35%, rgba(196, 181, 253, 0.08) 60%, transparent 80%); 18173 filter: blur(40px); 18174 pointer-events: none; 18175`,K1t=p.div.withConfig({displayName:"CoverSlide__CoverContent",componentId:"sc-hu01bv-2"})` 18176 flex: 1; 18177 display: flex; 18178 flex-direction: column; 18179 justify-content: center; 18180 padding: 4rem 5rem 4rem 8rem; 18181 position: relative; 18182 z-index: 1; 18183 @media (max-width: 1024px) { padding: 3rem 4rem; } 18184 @media (max-width: 768px) { padding: 2.5rem 1.5rem; } 18185`,Y1t=p.span.withConfig({displayName:"CoverSlide__CoverBadge",componentId:"sc-hu01bv-3"})` 18186 display: inline-flex; 18187 align-items: center; 18188 gap: 0.5rem; 18189 font-size: 0.72rem; 18190 font-weight: 800; 18191 letter-spacing: 0.14em; 18192 text-transform: uppercase; 18193 color: ${Iue}; 18194 background: rgba(238, 242, 255, 0.7); 18195 padding: 0.45rem 0.95rem; 18196 border-radius: 999px; 18197 border: 1px solid ${zi}; 18198 width: fit-content; 18199 margin-bottom: 2rem; 18200`,X1t=p.span.withConfig({displayName:"CoverSlide__CoverBadgeDot",componentId:"sc-hu01bv-4"})` 18201 width: 7px; 18202 height: 7px; 18203 border-radius: 50%; 18204 background: ${mi}; 18205`,Q1t=p.h1.withConfig({displayName:"CoverSlide__CoverHeading",componentId:"sc-hu01bv-5"})` 18206 font-size: 4.75rem; 18207 font-weight: 950; 18208 line-height: 1.0; 18209 letter-spacing: -0.02em; 18210 margin: 0 0 1.75rem; 18211 color: ${Vn}; 18212 @media (max-width: 1024px) { font-size: 3.5rem; } 18213 @media (max-width: 768px) { font-size: 2.5rem; } 18214`,Z1t=p.span.withConfig({displayName:"CoverSlide__CoverHeadingAccent",componentId:"sc-hu01bv-6"})` 18215 color: ${mi}; 18216`,J1t=p.div.withConfig({displayName:"CoverSlide__CoverProjectRow",componentId:"sc-hu01bv-7"})` 18217 display: flex; 18218 align-items: center; 18219 gap: 1rem; 18220 margin: 0 0 2.5rem; 18221`,evt=p.p.withConfig({displayName:"CoverSlide__CoverSubtitle",componentId:"sc-hu01bv-8"})` 18222 font-size: 1.65rem; 18223 font-weight: 600; 18224 color: ${fi}; 18225 margin: 0; 18226 line-height: 1.3; 18227`,tvt=p.div.withConfig({displayName:"CoverSlide__CoverMeta",componentId:"sc-hu01bv-9"})` 18228 display: flex; 18229 align-items: center; 18230 gap: 0.5rem; 18231 color: ${Nn}; 18232 font-size: 0.82rem; 18233 font-weight: 600; 18234`;function nvt(){return{key:"cover",label:"Cover",icon:t.jsx(Dc,{size:14}),fullBleed:!0,render:e=>t.jsxs(G1t,{children:[t.jsx(V1t,{}),t.jsxs(K1t,{children:[t.jsxs(Y1t,{children:[t.jsx(X1t,{}),"AI Visibility Intelligence"]}),t.jsxs(Q1t,{children:["AI Visibility",t.jsx("br",{}),t.jsx(Z1t,{children:"Report"})]}),t.jsxs(J1t,{children:[t.jsx(By,{logoUrl:e.project.logo_url,size:48}),t.jsx(evt,{children:e.project.name})]}),t.jsxs(tvt,{children:[t.jsx(a1,{size:14}),(()=>{const n=c=>new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",year:"numeric"}).format(c),i=new Date;let r;if(e.selected_month){const[c,u]=e.selected_month.split("-").map(Number);r=new Date(c,(u||1)-1,1)}else r=new Date(i.getFullYear(),i.getMonth(),1);const o=new Date(r.getFullYear(),r.getMonth()+1,0),a=(e.is_live_month??(r.getFullYear()===i.getFullYear()&&r.getMonth()===i.getMonth()))&&i<o?i:o;return`${n(r)} â ${n(a)}`})()]})]})]})}}const ivt={chatgpt:ju,gemini:wu,claude:nh,perplexity:ih,google_ai_overview:ya,google_ai_mode:ya,grok:Mf,copilot:Rf};function s4({modelKey:e}){const n=ivt[e];return n?t.jsx(n,{width:14,height:14,style:{verticalAlign:"-2px",marginRight:4,flexShrink:0}}):null}const rvt=p.div.withConfig({displayName:"ExecSummarySlide__ExecKpiRow",componentId:"sc-1yrgns5-0"})` 18235 display: grid; 18236 grid-template-columns: repeat(4, 1fr); 18237 gap: 1rem; 18238 margin-top: 2.25rem; 18239 margin-bottom: 2.25rem; 18240 18241 @media (max-width: 768px) { 18242 grid-template-columns: repeat(2, 1fr); 18243 } 18244`,X$=p.div.withConfig({displayName:"ExecSummarySlide__ExecKpi",componentId:"sc-1yrgns5-1"})` 18245 border: 1px solid ${zi}; 18246 border-top: 3px solid ${mi}; 18247 border-radius: 0; 18248 padding: 0.85rem 1rem; 18249 background: ${Oi}; 18250`,Q$=p.div.withConfig({displayName:"ExecSummarySlide__ExecKpiLabel",componentId:"sc-1yrgns5-2"})` 18251 font-size: 0.62rem; 18252 font-weight: 850; 18253 letter-spacing: 0.1em; 18254 text-transform: uppercase; 18255 color: ${fi}; 18256 margin-bottom: 0.25rem; 18257`,Z$=p.div.withConfig({displayName:"ExecSummarySlide__ExecKpiBig",componentId:"sc-1yrgns5-3"})` 18258 font-size: 2rem; 18259 font-weight: 950; 18260 color: ${Vn}; 18261 line-height: 1.1; 18262`,J$=p.div.withConfig({displayName:"ExecSummarySlide__ExecKpiDelta",componentId:"sc-1yrgns5-4"})` 18263 font-size: 0.68rem; 18264 font-weight: 800; 18265 color: ${e=>e.$tone==="up"?"#059669":e.$tone==="down"?"#dc2626":Nn}; 18266 display: flex; 18267 align-items: center; 18268 gap: 0.25rem; 18269`,ovt=p.div.withConfig({displayName:"ExecSummarySlide__ExecBody",componentId:"sc-1yrgns5-5"})` 18270 display: grid; 18271 grid-template-columns: 1fr 1fr; 18272 gap: 1rem; 18273 height: 240px; 18274 min-height: 240px; 18275 max-height: 240px; 18276 @media (max-width: 768px) { grid-template-columns: 1fr; height: auto; min-height: auto; max-height: none; } 18277`,svt=p.div.withConfig({displayName:"ExecSummarySlide__ExecTextBlock",componentId:"sc-1yrgns5-6"})` 18278 border: none; 18279 border-radius: 0; 18280 padding: 1.25rem 0.5rem; 18281 background: ${Oi}; 18282 overflow: hidden; 18283 display: flex; 18284 flex-direction: column; 18285 height: 100%; 18286`,avt=p.div.withConfig({displayName:"ExecSummarySlide__ExecTextTitle",componentId:"sc-1yrgns5-7"})` 18287 font-size: 0.95rem; 18288 font-weight: 900; 18289 color: ${Vn}; 18290 padding-bottom: 0.65rem; 18291 margin-bottom: 0.65rem; 18292 border-bottom: 1px solid ${zi}; 18293 flex-shrink: 0; 18294`,lvt=p.p.withConfig({displayName:"ExecSummarySlide__ExecTextBody",componentId:"sc-1yrgns5-8"})` 18295 font-size: 0.82rem; 18296 font-weight: 500; 18297 color: ${fi}; 18298 line-height: 1.6; 18299 margin: 0; 18300 overflow: hidden; 18301 flex: 1; 18302`,cvt=p.div.withConfig({displayName:"ExecSummarySlide__ExecStatsBlock",componentId:"sc-1yrgns5-9"})` 18303 background: ${R1}; 18304 border-radius: 0; 18305 border-left: 3px solid ${mi}; 18306 padding: 0.5rem 1.25rem; 18307 display: flex; 18308 flex-direction: column; 18309 justify-content: center; 18310 height: 100%; 18311 overflow: hidden; 18312`,e2=p.div.withConfig({displayName:"ExecSummarySlide__ExecStatItem",componentId:"sc-1yrgns5-10"})` 18313 padding: 0.6rem 0; 18314`,t2=p.div.withConfig({displayName:"ExecSummarySlide__ExecStatLabel",componentId:"sc-1yrgns5-11"})` 18315 font-size: 0.62rem; 18316 font-weight: 850; 18317 letter-spacing: 0.1em; 18318 text-transform: uppercase; 18319 color: ${Nn}; 18320 margin-bottom: 0.15rem; 18321`,n2=p.div.withConfig({displayName:"ExecSummarySlide__ExecStatValue",componentId:"sc-1yrgns5-12"})` 18322 font-size: 0.9rem; 18323 font-weight: 850; 18324 color: ${Vn}; 18325`;function i2(e,n){if(e==null||n==null)return"flat";const i=e-n;return i>1?"up":i<-1?"down":"flat"}function bm(e,n){return e[Math.abs(n)%e.length]}function dvt(e,n){const i=i2(e.visibility_score,e.prev_visibility_score),r=i2(e.prev_avg_position,e.avg_position),o=i2(e.sentiment_score,e.prev_sentiment_score),s=i2(e.total_citations,e.prev_citations),a=[i,r,o,s].filter(v=>v==="up").length,c=[i,r,o,s].filter(v=>v==="down").length,u=Math.round((e.visibility_score??0)+(e.total_citations??0)+(e.sentiment_score??0)),m=v=>v?_f[v]||v:null;let h;a>=3?h=bm([`${n} saw broad-based improvements this month, with the majority of key metrics trending upward.`,`A strong month for ${n} â performance advanced across multiple fronts.`,`This period marks notable progress for ${n}, with several indicators posting gains.`],u):a>=2?h=bm([`${n} showed a mixed but positive picture this month, with gains outweighing setbacks.`,`A balanced month â ${n} made headway in some areas while facing pressure in others.`],u):a>=1?h=bm([`${n} encountered headwinds this month, though some silver linings emerged.`,`A challenging period for ${n}, with most metrics under pressure.`],u):c>=2?h=bm([`${n} faced a difficult month, with key metrics trending downward.`,`AI visibility retreated this period for ${n} â focused action is warranted.`],u):h=bm([`${n}
18325's performance held steady this month with no dramatic shifts.`,`A stable period for ${n} â metrics remained within a narrow band.`],u);let g="";if(i==="up"&&e.visibility_score!=null&&e.prev_visibility_score!=null){const v=Math.round(e.visibility_score-e.prev_visibility_score);g=bm([`Visibility climbed ${v}% to ${Math.round(e.visibility_score)}%, reflecting stronger presence in AI responses.`,`AI visibility rose to ${Math.round(e.visibility_score)}% (+${v}%), with more platforms now referencing the brand.`],u+1)}else if(i==="down"&&e.visibility_score!=null&&e.prev_visibility_score!=null){const v=Math.abs(Math.round(e.visibility_score-e.prev_visibility_score));g=bm([`Visibility dipped ${v}% to ${Math.round(e.visibility_score)}%, suggesting reduced brand presence in AI answers.`,`AI visibility fell by ${v}% to ${Math.round(e.visibility_score)}% â an area to prioritize.`],u+1)}let x="";r==="up"&&o==="up"?x="The brand moved higher in AI responses and sentiment improved â a strong signal of growing authority.":r==="up"&&o==="down"?x="Average position improved but sentiment softened, suggesting the brand appears earlier yet may need richer content.":r==="down"&&o==="up"?x="Position slipped slightly but sentiment rose â AI platforms describe the brand more favorably when they reference it.":r==="down"&&o==="down"?x="Both position and sentiment declined, suggesting a need to refresh content strategies targeting AI results.":s==="up"&&e.total_citations!=null&&e.prev_citations!=null?x=`Citations grew to ${e.total_citations} from ${e.prev_citations}, signaling increasing content authority.`:s==="down"&&e.total_citations!=null&&e.prev_citations!=null&&(x=`Citations fell to ${e.total_citations} from ${e.prev_citations} â fresh citable content could help reverse this.`);let y="";const w=m(e.best_platform),j=m(e.worst_platform);return e.brand_rank!=null&&e.total_competitors&&j?e.brand_rank===1?y=bm([`Ranked #1 of ${e.total_competitors} competitors â focus on maintaining this lead, especially on ${j}.`,`Holding the top spot among ${e.total_competitors} brands; optimizing for ${j} can widen the gap.`],u+5):y=bm([`At #${e.brand_rank} of ${e.total_competitors} competitors, optimizing for ${j} is the clearest path to climb.`,`Ranked #${e.brand_rank} of ${e.total_competitors} â targeting ${j} offers the best opportunity to improve.`],u+5):w&&j&&w!==j?y=`${w} leads in visibility${e.best_platform_score!=null?` at ${Math.round(e.best_platform_score)}%`:""}; ${j} is the top optimization priority.`:e.brand_rank!=null&&e.total_competitors&&(y=`Currently ranked #${e.brand_rank} of ${e.total_competitors} tracked competitors.`),[h,g,x,y].filter(Boolean).join(" ")}function r2({to:e,suffix:n="",formatter:i}){const r=sD(e);return t.jsxs(t.Fragment,{children:[i?i(r):String(r),n]})}function uvt({data:e}){const n=e.sections.executive_summary||{};if(!n?.has_data)return t.jsx(Eo,{children:"No scan data yet. Run your first scan to generate the report."});const i=n.visibility_score!=null&&n.prev_visibility_score!=null?n.visibility_score-n.prev_visibility_score:null,r=n.avg_position!=null&&n.prev_avg_position!=null?n.avg_position-n.prev_avg_position:null,o=n.sentiment_score!=null&&n.prev_sentiment_score!=null?n.sentiment_score-n.prev_sentiment_score:null,s=n.total_citations!=null&&n.prev_citations!=null?n.total_citations-n.prev_citations:null,a=u=>u==null?"flat":u>0?"up":u<0?"down":"flat",c=(u,m="")=>u==null?"â":`${u>0?"â²":u<0?"â¼":"â¶"} ${u>0?"+":""}${Math.round(u)}${m} vs last period`;return t.jsxs(Ou,{children:[t.jsx(Ho,{children:"Module 01"}),t.jsx(qo,{children:"Executive Summary"}),t.jsxs(rvt,{children:[t.jsxs(X$,{children:[t.jsx(Q$,{children:"Visibility Score"}),t.jsx(Z$,{children:n.visibility_score!=null?t.jsx(r2,{to:Math.round(n.visibility_score),suffix:"%"}):"â"}),t.jsx(J$,{$tone:a(i),children:c(i,"%")})]}),t.jsxs(X$,{children:[t.jsx(Q$,{children:"Avg. Position"}),t.jsx(Z$,{children:typeof n.avg_position=="number"?t.jsx(r2,{to:Number(n.avg_position.toFixed(1)),suffix:""}):"â"}),t.jsx(J$,{$tone:a(typeof r=="number"?-r:null),children:typeof r=="number"?`${r<0?"â²":r>0?"â¼":"â¶"} ${r<0?"+":""}${Math.abs(Number(r.toFixed(1)))} vs last period`:"â"})]}),t.jsxs(X$,{children:[t.jsx(Q$,{children:"Sentiment Score"}),t.jsx(Z$,{children:n.sentiment_score!=null?t.jsx(r2,{to:Math.round(n.sentiment_score)}):"â"}
18325),t.jsx(J$,{$tone:a(o),children:c(o)})]}),t.jsxs(X$,{children:[t.jsx(Q$,{children:"Total Citations"}),t.jsx(Z$,{children:n.total_citations!=null?t.jsx(r2,{to:n.total_citations,formatter:Hs}):"â"}),t.jsx(J$,{$tone:a(s),children:c(s)})]})]}),t.jsxs(ovt,{children:[t.jsxs(svt,{children:[t.jsx(avt,{children:"Performance Overview"}),t.jsx(lvt,{children:dvt(n,e.project?.name||"Your brand")})]}),t.jsxs(cvt,{children:[t.jsxs(e2,{children:[t.jsx(t2,{children:"Top Performing Platform"}),t.jsx(n2,{children:n.best_platform?t.jsxs(t.Fragment,{children:[t.jsx(s4,{modelKey:n.best_platform}),_f[n.best_platform]||n.best_platform," â ",n.best_platform_score!=null?Math.round(n.best_platform_score)+"%":""," visibility"]}):"â"})]}),t.jsxs(e2,{children:[t.jsx(t2,{children:"Biggest Improvement"}),t.jsx(n2,{children:n.biggest_improvement_platform?t.jsxs(t.Fragment,{children:[t.jsx(s4,{modelKey:n.biggest_improvement_platform}),_f[n.biggest_improvement_platform]||n.biggest_improvement_platform," â +",n.biggest_improvement_delta,"%"]}):"â"})]}),t.jsxs(e2,{children:[t.jsx(t2,{children:"Industry Rank"}),t.jsx(n2,{children:n.brand_rank!=null?`#${n.brand_rank} of ${n.total_competitors??"â"} competitors`:"â"})]}),t.jsxs(e2,{children:[t.jsx(t2,{children:"Priority Action"}),t.jsx(n2,{children:n.worst_platform?t.jsxs(t.Fragment,{children:[t.jsx(s4,{modelKey:n.worst_platform}),"Optimize for ",_f[n.worst_platform]||n.worst_platform]}):"â"})]})]})]})]})}function pvt(){return{key:"executive_summary",label:"Executive Summary",icon:t.jsx(Eu,{size:14}),render:e=>t.jsx(uvt,{data:e})}}const mvt={chatgpt:ju,gemini:wu,claude:nh,perplexity:ih,google_ai_overview:ya,google_ai_mode:ya,grok:Mf,copilot:Rf};function sZ({modelKey:e}){const n=mvt[e];return n?t.jsx(n,{width:16,height:16,style:{marginRight:5,flexShrink:0}}):null}const hvt=p.div.withConfig({displayName:"VisibilitySlide__VisLayout",componentId:"sc-6pbyox-0"})` 18326 display: grid; 18327 grid-template-columns: 300px 1fr; 18328 gap: 2.5rem; 18329 align-items: center; 18330 18331 @media (max-width: 768px) { 18332 grid-template-columns: 1fr; 18333 gap: 1.5rem; 18334 } 18335`,fvt=p.div.withConfig({displayName:"VisibilitySlide__VisGaugeWrap",componentId:"sc-6pbyox-1"})` 18336 display: flex; 18337 flex-direction: column; 18338 align-items: center; 18339 justify-content: center; 18340 gap: 0.85rem; 18341`,gvt=p.div.withConfig({displayName:"VisibilitySlide__VisRightCol",componentId:"sc-6pbyox-2"})` 18342 display: flex; 18343 flex-direction: column; 18344 gap: 1rem; 18345`,yvt=p.div.withConfig({displayName:"VisibilitySlide__GaugeSize",componentId:"sc-6pbyox-3"})` 18346 position: relative; 18347 width: 230px; 18348 height: 230px; 18349 18350 @media (max-width: 768px) { 18351 width: 180px; 18352 height: 180px; 18353 } 18354`,xvt=p.svg.withConfig({displayName:"VisibilitySlide__VisGaugeSvg",componentId:"sc-6pbyox-4"})` 18355 display: block; 18356`,bvt=p.div.withConfig({displayName:"VisibilitySlide__VisGaugeCenter",componentId:"sc-6pbyox-5"})` 18357 position: absolute; 18358 inset: 0; 18359 display: flex; 18360 flex-direction: column; 18361 align-items: center; 18362 justify-content: center; 18363`,vvt=p.div.withConfig({displayName:"VisibilitySlide__VisGaugeScore",componentId:"sc-6pbyox-6"})` 18364 font-size: 4rem; 18365 font-weight: 950; 18366 line-height: 1; 18367 color: ${Vn}; 18368 18369 @media (max-width: 768px) { 18370 font-size: 3rem; 18371 } 18372`,wvt=p.div.withConfig({displayName:"VisibilitySlide__VisDeltaBadge",componentId:"sc-6pbyox-7"})` 18373 display: inline-flex; 18374 align-items: center; 18375 gap: 0.3rem; 18376 padding: 0.35rem 1rem; 18377 border-radius: 999px; 18378 font-size: 0.78rem; 18379 font-weight: 800; 18380 background: ${e=>e.$tone==="up"?"#ecfdf5":e.$tone==="down"?"#fef2f2":po}; 18381 color: ${e=>e.$tone==="up"?"#059669":e.$tone==="down"?"#dc2626":fi}; 18382`,jvt=p.div.withConfig({displayName:"VisibilitySlide__VisChartWrap",componentId:"sc-6pbyox-8"})` 18383 display: flex; 18384 flex-direction: column; 18385`,_vt=p.div.withConfig({displayName:"VisibilitySlide__VisChartTitle",componentId:"sc-6pbyox-9"})` 18386 font-size: 0.68rem; 18387 font-weight: 850; 18388 letter-spacing: 0.1em; 18389 text-transform: uppercase; 18390 color: ${Nn}; 18391 margin-bottom: 0.4rem; 18392 text-align: left; 18393`,Cvt=p.div.withConfig({displayName:"VisibilitySlide__VisCardsGrid",componentId:"sc-6pbyox-10"})` 18394 display: grid; 18395 grid-template-columns: repeat(2, 1fr); 18396 gap: 0.75rem; 18397`,o2=p.div.withConfig({displayName:"VisibilitySlide__VisCard",componentId:"sc-6pbyox-11"})` 18398 border: 1px solid ${zi}; 18399 border-radius: 0; 18400 padding: 1.1rem 1rem; 18401 background: ${Oi}; 18402 min-width: 0; 18403 overflow: hidden; 18404`,s2=p.div.withConfig({displayName:"VisibilitySlide__VisCardAccent",componentId:"sc-6pbyox-12"})` 18405 width: 28px; 18406 height: 3px; 18407 background: ${mi}; 18408 margin-bottom: 0.6rem; 18409`,a2=p.div.withConfig({displayName:"VisibilitySlide__VisCardLabel",componentId:"sc-6pbyox-13"})` 18410 font-size: 0.6rem; 18411 font-weight: 850; 18412 letter-spacing: 0.1em; 18413 text-transform: uppercase; 18414 color: ${Nn}; 18415 margin-bottom: 0.3rem; 18416`,l2=p.div.withConfig({displayName:"VisibilitySlide__VisCardValue",componentId:"sc-6pbyox-14"})` 18417 font-size: 1.25rem; 18418 font-weight: 950; 18419 color: ${Vn}; 18420 line-height: 1.2; 18421 overflow: hidden; 18422 text-overflow: ellipsis; 18423 white-space: nowrap; 18424 display: flex; 18425 align-items: center; 18426`,c2=p.div.withConfig({displayName:"VisibilitySlide__VisCardSub",componentId:"sc-6pbyox-15"})` 18427 font-size: 0.7rem; 18428 font-weight: 600; 18429 color: ${Nn}; 18430 margin-top: 0.15rem; 18431 overflow: hidden; 18432 text-overflow: ellipsis; 18433 white-space: nowrap; 18434`;function Svt({data:e}){const n=e.sections.visibility,i=e.sections.executive_summary||{},r=e.sections.visibility_trend,[o,s]=l.useState(!1);if(l.useEffect(()=>{const q=requestAnimationFrame(()=>s(!0));return()=>cancelAnimationFrame(q)},[]),!n?.has_data)return t.jsx(Eo,{children:"No visibility data available yet."});const a=n.visibility_score??0,c=Math.min(a/100,1),u=80,m=2*Math.PI*u,h=o?m*c:0,g=m-h,x=i.visibility_score!=null&&i.prev_visibility_score!=null?Math.round(i.visibility_score-i.prev_visibility_score):null,y=x==null?"flat":x>0?"up":x<0?"down":"flat",j=(r?.points||[]).slice(-6),_=j.filter(q=>q.visibility_score!=null).map(q=>q.visibility_score),$=_.length?Math.max(..._):100,k=_.length?Math.min(..._):0,P=($-k)*.15||10,S=$+P,I=Math.max(k-P,0),A=S-I||1,E=14,B=440,T=B-E*2,M=72,R=16,F=[];
18434j.forEach((q,W)=>{if(q.visibility_score==null)return;const oe=E+(j.length>1?W/(j.length-1)*T:T/2),se=R+(1-(q.visibility_score-I)/A)*(M-R*2);F.push({x:oe,y:se,score:q.visibility_score})});const Y=F.map(q=>`${q.x},${q.y}`).join(" "),H=F.length>1?`${F[0].x},${M} ${Y} ${F[F.length-1].x},${M}`:"",U=i.best_platform?_f[i.best_platform]||i.best_platform:null,X=i.worst_platform?_f[i.worst_platform]||i.worst_platform:null,Q=i.industry_average,K=i.visibility_score,G=Q!=null&&K!=null?Math.round(K-Q):null,L=i.strongest_topic;return t.jsxs(Ou,{children:[t.jsx(Ho,{children:"Module 02"}),t.jsx(qo,{children:"AI Visibility Score"}),t.jsxs(hvt,{children:[t.jsxs(fvt,{children:[t.jsxs(yvt,{children:[t.jsxs(xvt,{viewBox:"0 0 200 200",style:{width:"100%",height:"100%"},children:[t.jsx("circle",{cx:"100",cy:"100",r:u,fill:"none",stroke:po,strokeWidth:"14"}),t.jsx("circle",{cx:"100",cy:"100",r:u,fill:"none",stroke:mi,strokeWidth:"14",strokeLinecap:"round",strokeDasharray:`${h} ${g}`,transform:"rotate(-90 100 100)",style:{transition:"stroke-dasharray 0.8s cubic-bezier(0.25,0.46,0.45,0.94)"}})]}),t.jsx(bvt,{children:t.jsxs(vvt,{children:[Math.round(a),"%"]})})]}),x!=null&&t.jsxs(wvt,{$tone:y,children:[y==="up"?"â²":y==="down"?"â¼":"â¶"," ",x>0?"+":"",x,"% vs last month"]})]}),t.jsxs(gvt,{children:[t.jsxs(jvt,{children:[t.jsx(_vt,{children:"6-Month Visibility Trend"}),t.jsx("div",{style:{clipPath:o?"inset(0 0% 0 0)":"inset(0 100% 0 0)",transition:"clip-path 0.9s cubic-bezier(0.25,0.46,0.45,0.94) 0.15s"},children:t.jsxs("svg",{viewBox:`0 0 ${B} ${M+22}`,width:"100%",style:{display:"block"},children:[t.jsx("defs",{children:t.jsxs("linearGradient",{id:"visAreaGrad",x1:"0",y1:"0",x2:"0",y2:"1",children:[t.jsx("stop",{offset:"0%",stopColor:mi,stopOpacity:"0.12"}),t.jsx("stop",{offset:"100%",stopColor:mi,stopOpacity:"0.01"})]})}),H&&t.jsx("polygon",{points:H,fill:"url(#visAreaGrad)"}),F.length>1&&t.jsx("polyline",{points:Y,fill:"none",stroke:mi,strokeWidth:"2",strokeLinejoin:"round",strokeLinecap:"round"}),F.map((q,W)=>t.jsxs("g",{children:[t.jsx("circle",{cx:q.x,cy:q.y,r:"3.5",fill:mi}),t.jsxs("text",{x:q.x,y:q.y-7,textAnchor:"middle",fontSize:"7.5",fontWeight:"800",fill:Vn,children:[Math.round(q.score),"%"]})]},W)),j.map((q,W)=>{const oe=E+(j.length>1?W/(j.length-1)*T:T/2),se=(()=>{try{return new Date(q.date+"T00:00:00").toLocaleString("en-US",{month:"short"})}catch{return""}})();return t.jsx("text",{x:oe,y:M+14,textAnchor:"middle",fontSize:"8",fontWeight:"700",fill:Nn,children:se},`l${W}`)})]})})]}),t.jsxs(Cvt,{children:[t.jsxs(o2,{children:[t.jsx(s2,{}),t.jsx(a2,{children:"Industry Average"}),t.jsx(l2,{children:Q!=null?`${Math.round(Q)}%`:"â"}),t.jsx(c2,{children:G!=null?G>=0?`You're ${G}% above`:`You're ${Math.abs(G)}% below`:""})]}),t.jsxs(o2,{children:[t.jsx(s2,{}),t.jsx(a2,{children:"Strongest Topic"}),t.jsx(l2,{children:L?.name||"â"}),t.jsx(c2,{children:L?`${Math.round(L.visibility)}% visibility${L.delta!=null&&L.delta!==0?` · ${L.delta>0?"â²":"â¼"} ${L.delta>0?"+":""}${Math.round(L.delta)}%`:""}`:""})]}),t.jsxs(o2,{children:[t.jsx(s2,{}),t.jsx(a2,{children:"Best Platform"}),t.jsx(l2,{children:i.best_platform?t.jsxs(t.Fragment,{children:[t.jsx(sZ,{modelKey:i.best_platform}),U]}):"â"}),t.jsx(c2,{children:i.best_platform_score!=null?`${Math.round(i.best_platform_score)}% visibility score`:""})]}),t.jsxs(o2,{children:[t.jsx(s2,{}),t.jsx(a2,{children:"Weakest Platform"}),t.jsx(l2,{children:i.worst_platform?t.jsxs(t.Fragment,{children:[t.jsx(sZ,{modelKey:i.worst_platform}),X]}):"â"}),t.jsx(c2,{children:i.worst_platform_score!=null?`${Math.round(i.worst_platform_score)}% â biggest opportunity`:""})]})]})]})]})]})}function kvt(){return{key:"visibility",label:"Visibility Score",icon:t.jsx(Dc,{size:14}),render:e=>t.jsx(Svt,{data:e})}}const $vt={chatgpt:ju,gemini:wu,claude:nh,perplexity:ih,google_ai_overview:ya,google_ai_mode:ya,grok:Mf,copilot:Rf},Ivt=p.div.withConfig({displayName:"LlmBreakdownSlide__LlmGrid",componentId:"sc-rwnokm-0"})` 18435 display: grid; 18436 grid-template-columns: repeat(${e=>e.$cols}, 1fr); 18437 gap: ${e=>e.$single?"1rem":"0.65rem"}; 18438 ${e=>e.$single?"flex: 1; margin-top: 3rem;":"margin-top: 1rem;"} 18439 18440 @media (max-width: 768px) { 18441 grid-template-columns: repeat(2, 1fr); 18442 } 18443`,Pvt=p.div.withConfig({displayName:"LlmBreakdownSlide__LlmCard",componentId:"sc-rwnokm-1"})` 18444 border: 1px solid ${zi}; 18445 border-radius: 12px; 18446 padding: ${e=>e.$stretch?"2.25rem 1rem":"0.6rem 0.75rem"}; 18447 background: ${Oi}; 18448 display: flex; 18449 flex-direction: column; 18450 align-items: center; 18451 text-align: center; 18452 gap: ${e=>e.$stretch?"0.85rem":"0.3rem"}; 18453 ${e=>e.$stretch?"justify-content: center;":""} 18454`,Avt=p.div.withConfig({displayName:"LlmBreakdownSlide__LlmIconWrap",componentId:"sc-rwnokm-2"})` 18455 width: ${e=>e.$compact?"30px":"40px"}; 18456 height: ${e=>e.$compact?"30px":"40px"}; 18457 border-radius: ${e=>e.$compact?"8px":"10px"}; 18458 background: ${po}; 18459 display: flex; 18460 align-items: center; 18461 justify-content: center; 18462 color: ${fi}; 18463`,Nvt=p.div.withConfig({displayName:"LlmBreakdownSlide__LlmName",componentId:"sc-rwnokm-3"})` 18464 font-size: ${e=>e.$compact?"0.75rem":"0.85rem"}; 18465 font-weight: 850; 18466 color: ${Vn}; 18467`,zvt=p.svg.withConfig({displayName:"LlmBreakdownSlide__LlmGaugeSvg",componentId:"sc-rwnokm-4"})` 18468 display: block; 18469`,Tvt=p.div.withConfig({displayName:"LlmBreakdownSlide__LlmGaugeCenter",componentId:"sc-rwnokm-5"})` 18470 position: absolute; 18471 inset: 0; 18472 display: flex; 18473 align-items: center; 18474 justify-content: center; 18475 font-size: ${e=>e.$compact?"1rem":"1.4rem"}; 18476 font-weight: 950; 18477 color: ${Vn}; 18478`,Evt=p.div.withConfig({displayName:"LlmBreakdownSlide__LlmDelta",componentId:"sc-rwnokm-6"})` 18479 display: inline-flex; 18480 align-items: center; 18481 gap: 0.2rem; 18482 padding: 0.2rem 0.6rem; 18483 border-radius: 999px; 18484 font-size: 0.68rem; 18485 font-weight: 800; 18486 background: ${e=>e.$tone==="up"?"#ecfdf5":e.$tone==="down"?"#fef2f2":po}; 18487 color: ${e=>e.$tone==="up"?"#059669":e.$tone==="down"?"#dc2626":fi}; 18488`,Mvt=p.div.withConfig({displayName:"LlmBreakdownSlide__LlmDesc",componentId:"sc-rwnokm-7"})` 18489 font-size: ${e=>e.$compact?"0.6rem":"0.7rem"}; 18490 font-weight: 600; 18491 color: ${Nn}; 18492 line-height: 1.4; 18493 min-height: ${e=>e.$compact?"1.5rem":"2.1rem"}; 18494`,Rvt={chatgpt:{strength:"conversational queries",context:"general knowledge and creative prompts",audience:"mainstream users"},gemini:{strength:"product comparisons",context:"search-integrated responses",audience:"Google ecosystem users"},claude:{strength:"technical topics",context:"detailed analytical queries",audience:"professional users"},perplexity:{strength:"research queries",context:"citation-heavy responses",audience:"information seekers"},google_ai_overview:{strength:"SERP features",context:"search result summaries",audience:"organic search traffic"},google_ai_mode:{strength:"interactive search",context:"multi-turn search conversations",audie
18494nce:"advanced searchers"},grok:{strength:"real-time topics",context:"social media-informed responses",audience:"X/Twitter users"},copilot:{strength:"productivity queries",context:"work-related recommendations",audience:"enterprise users"}};function Ovt(e,n){const i=e.visibility_score??0,r=e.visibility_delta??0,o=Rvt[e.model_key]||{strength:"general queries",context:"AI responses",audience:"users"};if(i===0)return`Not yet visible in ${o.context}.`;const s=i>=80,a=i>=60,c=r>0,u=r<0,m=r<-5,h=[`Top performer in ${o.strength} with momentum building.`,`Dominant performance in ${o.context}.`,`Reliable and growing presence among ${o.audience}.`,`Consistently strong across ${o.strength}.`,`Well-established visibility in ${o.context}.`,`Leading reach among ${o.audience}.`,`Sustained high performance in ${o.strength}.`,`Broad coverage across ${o.context}.`],g=[`Consistently referenced in ${o.context}.`,`Stable authority in ${o.strength}.`,`Maintaining strong reach among ${o.audience}.`,`Steady presence across ${o.context}.`,`Holding position in ${o.strength}.`,`Reliable coverage for ${o.audience}.`],x=[`Strong growth in ${o.strength}.`,`Gaining ground among ${o.audience}.`,`Steady improvement in ${o.context}.`,`Building momentum in ${o.strength}.`,`Positive trajectory among ${o.audience}.`,`Expanding footprint in ${o.context}.`],y=[`Stable visibility in ${o.context}.`,`Consistent performance in ${o.strength}.`,`Holding steady among ${o.audience}.`,`Moderate but stable in ${o.context}.`],w=[`Citation gaps in ${o.context}.`,`Declining traction in ${o.strength}.`,`Losing ground among ${o.audience}.`,`Pullback in ${o.context}.`],j=[`Emerging presence in ${o.strength}.`,`Early traction among ${o.audience}.`,`Room to grow in ${o.context}.`,`Biggest opportunity for ${o.audience}.`],v=_=>_[n%_.length];return s&&c?v(h):s&&u?`Still strong in ${o.strength} despite a dip.`:s?v(g):a&&c?v(x):a&&m?`Notable drop in ${o.strength}.`:a&&u?v(w):a?v(y):u?v(w):i>=20?v(j):`Biggest opportunity for ${o.audience}.`}function Dvt({data:e}){const[n,i]=l.useState(!1);l.useEffect(()=>{const g=requestAnimationFrame(()=>i(!0));return()=>cancelAnimationFrame(g)},[]);const r=e.sections.llm_breakdown;if(!r?.has_data)return t.jsx(Eo,{children:"No per-model data available."});const s=[...r.models||[]].sort((g,x)=>(x.visibility_score||0)-(g.visibility_score||0)),a=s.length<=5,c=a?s.length:Math.ceil(s.length/2),u=a?48:40,m=2*Math.PI*u,h=a?116:82;return t.jsxs(Ou,{children:[t.jsx(Ho,{children:"Module 03"}),t.jsx(qo,{children:"Visibility by LLM"}),t.jsx(Ivt,{$cols:c,$single:a,children:s.map((g,x)=>{const y=g.visibility_score??0,w=Math.min(y/100,1),j=n?m*w:0,v=m-j,_=Pue[g.model_key]||Nn,$=g.visibility_delta,k=$==null?"flat":$>0?"up":$<0?"down":"flat",P=$vt[g.model_key],S=!a,I=S?18:22;return t.jsxs(Pvt,{$stretch:a,children:[t.jsx(Avt,{$compact:S,children:P?t.jsx(P,{width:I,height:I}):null}),t.jsx(Nvt,{$compact:S,children:_f[g.model_key]||g.model_key}),t.jsxs("div",{style:{position:"relative",width:h,height:h},children:[t.jsxs(zvt,{viewBox:"0 0 110 110",width:h,height:h,children:[t.jsx("circle",{cx:"55",cy:"55",r:u,fill:"none",stroke:po,strokeWidth:"8"}),t.jsx("circle",{cx:"55",cy:"55",r:u,fill:"none",stroke:_,strokeWidth:"8",strokeLinecap:"round",strokeDasharray:`${j} ${v}`,transform:"rotate(-90 55 55)",style:{transition:"stroke-dasharray 0.8s cubic-bezier(0.25,0.46,0.45,0.94)",transitionDelay:`${x*.07}s`}})]}),t.jsxs(Tvt,{$compact:S,children:[Math.round(y),"%"]})]}),t.jsx(Evt,{$tone:k,children:$!=null?t.jsxs(t.Fragment,{children:[k==="up"?"â²":k==="down"?"â¼":"â¶"," ",$>0?"+":"",Math.round($),"%"]}):t.jsx(t.Fragment,{children:" â "})}),t.jsx(Mvt,{$compact:S,children:Ovt(g,x)})]},g.model_key)})})]})}function Lvt(){return{key:"llm_breakdown",label:"LLM Breakdown",icon:t.jsx(To,{size:14}),render:e=>t.jsx(Dvt,{data:e})}}const Bvt=p.div.withConfig({displayName:"VisibilityTrendSlide__TrendLayout",componentId:"sc-1f91pq1-0"})` 18495 display: flex; 18496 gap: 2rem; 18497 margin-top: 1rem; 18498 18499 @media (max-width: 768px) { 18500 flex-direction: column; 18501 } 18502`,Fvt=p.div.withConfig({displayName:"VisibilityTrendSlide__ChartWrap",componentId:"sc-1f91pq1-1"})` 18503 flex: 1; 18504 min-width: 0; 18505`,Wvt=p.div.withConfig({displayName:"VisibilityTrendSlide__RightCol",componentId:"sc-1f91pq1-2"})` 18506 width: 280px; 18507 flex-shrink: 0; 18508 display: flex; 18509 flex-direction: column; 18510 gap: 1.25rem; 18511 18512 @media (max-width: 768px) { 18513 width: 100%; 18514 } 18515`,aZ=p.div.withConfig({displayName:"VisibilityTrendSlide__InfoCard",componentId:"sc-1f91pq1-3"})` 18516 border-left: 3px solid ${e=>e.$accent||zi}; 18517 padding: 0 1.25rem 1rem; 18518 background: ${Oi}; 18519`,lZ=p.div.withConfig({displayName:"VisibilityTrendSlide__InfoLabel",componentId:"sc-1f91pq1-4"})` 18520 font-size: 0.6rem; 18521 font-weight: 850; 18522 letter-spacing: 0.1em; 18523 text-transform: uppercase; 18524 color: ${Nn}; 18525 margin-bottom: 0.4rem; 18526`,a4=p.div.withConfig({displayName:"VisibilityTrendSlide__InfoTitle",componentId:"sc-1f91pq1-5"})` 18527 font-size: 1.35rem; 18528 font-weight: 950; 18529 color: ${Vn}; 18530 line-height: 1.2; 18531 margin-bottom: 0.35rem; 18532`,l4=p.div.withConfig({displayName:"VisibilityTrendSlide__InfoDesc",componentId:"sc-1f91pq1-6"})` 18533 font-size: 0.75rem; 18534 font-weight: 600; 18535 color: ${fi}; 18536 line-height: 1.5; 18537`,Uvt=p.div.withConfig({displayName:"VisibilityTrendSlide__LegendRow",componentId:"sc-1f91pq1-7"})` 18538 display: flex; 18539 flex-direction: column; 18540 gap: 0.65rem; 18541 margin-top: auto; 18542 18543 @media (max-width: 768px) { 18544 order: -1; 18545 margin-top: 0; 18546 flex-direction: row; 18547 flex-wrap: wrap; 18548 justify-content: center; 18549 } 18550`,cZ=p.div.withConfig({displayName:"VisibilityTrendSlide__LegendItem",componentId:"sc-1f91pq1-8"})` 18551 display: flex; 18552 align-items: center; 18553 gap: 0.5rem; 18554 font-size: 0.78rem; 18555 font-weight: 750; 18556 color: ${Vn}; 18557`,dZ=p.span.withConfig({displayName:"VisibilityTrendSlide__LegendLine",componentId:"sc-1f91pq1-9"})`
18558 width: 20px; 18559 height: 0; 18560 border-top: 2.5px ${e=>e.$dashed?"dashed":"solid"} ${e=>e.$color}; 18561 flex-shrink: 0; 18562`,uZ=["#9ca3af","#22d3ee"];function Hy(e){try{return new Date(e+"T00:00:00").toLocaleString("en-US",{month:"long"})}catch{return""}}function t1(e){return e.map((n,i)=>({score:n.visibility_score,date:n.date,idx:i})).filter(n=>n.score!=null)}function Hvt(e){if(e.length<2)return null;const n=e[e.length-1],i=Math.max(...e.slice(0,-1).map(r=>r.score));return n.score>i&&n.score>0?{title:"Best Month Yet",description:`${Hy(n.date)} reached ${Math.round(n.score)}% â the highest visibility score recorded so far.`}:null}function qvt(e){if(e.length<2)return null;const n=e[e.length-2],i=e[e.length-1],r=i.score-n.score;return r>0?{title:"Positive Momentum",description:`Visibility rose +${Math.round(r)}% in ${Hy(i.date)}, signaling growing AI presence.`}:null}function Gvt(e){if(e.length<2)return null;const n=e.slice(-Math.min(e.length,3));if(n.every(s=>s.score<=0))return null;const i=n.map(s=>s.score),r=Math.max(...i),o=Math.min(...i);return r-o<=3?{title:"Holding Steady",description:`Visibility has remained stable around ${Math.round(i[i.length-1])}% over recent months.`}:null}function Vvt(e){return e.length<2?null:e.every(i=>i.score>0)?{title:"Consistent Presence",description:`Your brand has appeared in AI responses every tracked month â ${e.length} months and counting.`}:null}function Kvt(e,n){const i=t1(e);if(i.length<2)return null;const r=[()=>Yvt(i,n),()=>Xvt(i,n),()=>Qvt(i),()=>Zvt(i),()=>Jvt(i),()=>ewt(i,n),()=>twt(i,n),()=>Hvt(i),()=>qvt(i),()=>Gvt(i),()=>Vvt(i)];for(const o of r){const s=o();if(s)return s}return null}function Yvt(e,n){for(const i of n){const r=t1(i.points);if(!(r.length<2))for(let o=1;o<e.length;o++){const s=e[o-1],a=e[o],c=r.find(m=>m.idx===s.idx),u=r.find(m=>m.idx===a.idx);if(!(!c||!u)&&s.score<c.score&&a.score>=u.score)return{title:`Overtook ${i.name}`,description:`In ${Hy(a.date)}, your visibility surpassed ${i.name} for the first time.`}}}return null}function Xvt(e,n){if(n.length===0)return null;const i=e[e.length-1],r=e[e.length-2],o=n.every(a=>{const u=t1(a.points).find(m=>m.idx===i.idx);return u?i.score>=u.score:!0}),s=n.every(a=>{const u=t1(a.points).find(m=>m.idx===r.idx);return u?r.score>=u.score:!0});return o&&!s?{title:"Reached #1 Position",description:`You claimed the top visibility ranking in ${Hy(i.date)}.`}:null}function Qvt(e){const n=[75,50,25];for(const i of n)for(let r=1;r<e.length;r++)if(e[r-1].score<i&&e[r].score>=i)return{title:`Crossed ${i}% Visibility`,description:`Your score surpassed ${i}% in ${Hy(e[r].date)}.`};return null}function Zvt(e){if(e.length<3)return null;let n=0,i=-1;for(let r=1;r<e.length;r++){const o=e[r].score-e[r-1].score;o>n&&(n=o,i=r)}return i===e.length-1&&n>=8?{title:"Record Growth Month",description:`${Hy(e[i].date)} saw your largest monthly gain of +${Math.round(n)}%.`}:null}function Jvt(e){let n=0,i=e.length-1;for(let r=e.length-1;r>0&&e[r].score>e[r-1].score;r--)n++,i=r-1;return n>=3?{title:`${n}-Month Growth Streak`,description:`Visibility has increased every month since ${Hy(e[i].date)}.`}:null}function ewt(e,n){for(const i of n){const r=t1(i.points);if(r.length<2)continue;const o=e[0],s=e[e.length-1],a=r.find(h=>h.idx===o.idx),c=r.find(h=>h.idx===s.idx);if(!a||!c)continue;const u=o.score-a.score,m=s.score-c.score;if(u>0&&m>u&&m-u>=10)return{title:"Widening the Lead",description:`Your gap over ${i.name} grew from ${Math.round(u)}% to ${Math.round(m)}%.`}}return null}function twt(e,n){for(const i of n){const r=t1(i.points);if(r.length<2)continue;const o=e[0],s=e[e.length-1],a=r.find(h=>h.idx===o.idx),c=r.find(h=>h.idx===s.idx);if(!a||!c)continue;const u=a.score-o.score,m=c.score-s.score;if(u>0&&m<u&&u-m>=10)return{title:"Closing In",description:`You've narrowed the gap with ${i.name} from ${Math.round(u)}% to ${Math.round(m)}%.`}}return null}function aD(e){const n=e.filter(i=>i.visibility_score!=null);return n.length<2?null:{first:{score:n[0].visibility_score,date:n[0].date},last:{score:n[n.length-1].visibility_score,date:n[n.length-1].date}}}
18562function pZ(e){try{return new Date(e+"T00:00:00").toLocaleString("en-US",{month:"long"})}catch{return""}}function nwt(e){const n=aD(e);if(!n)return"â";const i=n.last.score-n.first.score;return Math.abs(i)<1?"Visibility Stable":i>0?"Visibility Growing":"Visibility Declining"}function iwt(e){const n=aD(e.points);if(!n)return null;const i=Math.round(n.last.score-n.first.score);return Math.abs(i)<1?`${e.name} remained stable around ${Math.round(n.last.score)}%`:i>0?`${e.name} grew from ${Math.round(n.first.score)}% to ${Math.round(n.last.score)}%`:`${e.name} declined from ${Math.round(n.first.score)}% to ${Math.round(n.last.score)}%`}function rwt(e,n){const i=aD(n);if(!i)return"Not enough data to determine a growth trend.";const r=Math.round(i.last.score-i.first.score),o=pZ(i.first.date),s=pZ(i.last.date),a=Math.abs(r);let c;Math.abs(r)<1?c=`Since ${o}, visibility has held steady around ${Math.round(i.last.score)}%.`:r>0?c=`Since ${o}, visibility has grown from ${Math.round(i.first.score)}% to ${Math.round(i.last.score)}% â a ${a}% increase.`:c=`From ${o} to ${s}, visibility declined from ${Math.round(i.first.score)}% to ${Math.round(i.last.score)}% â a ${a}% decrease.`;const u=e.map(iwt).filter(Boolean);return u.length===0?c:`${c} Meanwhile, ${u.join(" and ")}.`}function owt({d:e}){const n=e.sections.visibility_trend,i=l.useRef(null),[r,o]=l.useState({top:0,bottom:0}),[s,a]=l.useState(!1),c=n.points||[],u=n.competitors||[],m=520,h=260,g=40,x=24,y=28,w=m-g-10,j=h-x-y;l.useEffect(()=>{const R=()=>{if(!i.current)return;const F=i.current.getBoundingClientRect().height;o({top:x/h*F,bottom:y/h*F})};return R(),window.addEventListener("resize",R),()=>window.removeEventListener("resize",R)},[]),l.useEffect(()=>{const R=requestAnimationFrame(()=>a(!0));return()=>cancelAnimationFrame(R)},[]);const v=[...c.filter(R=>R.visibility_score!=null).map(R=>R.visibility_score),...u.flatMap(R=>R.points.filter(F=>F.visibility_score!=null).map(F=>F.visibility_score))],_=v.length?Math.ceil(Math.max(...v)/10)*10:100,$=0,k=_-$||1,P=R=>g+(c.length>1?R/(c.length-1)*w:w/2),S=R=>x+(1-(R-$)/k)*j,I=R=>{const F=[];return R.forEach((Y,H)=>{Y.visibility_score!=null&&F.push({x:P(H),y:S(Y.visibility_score)})}),F},A=I(c),E=A.map(R=>`${R.x},${R.y}`).join(" "),B=A.length>1?`${A[0].x},${x+j} ${E} ${A[A.length-1].x},${x+j}`:"",T=5,M=Kvt(c,u);return t.jsxs(Ou,{children:[t.jsx(Ho,{children:"Module 04"}),t.jsx(qo,{children:"Visibility Trend"}),t.jsxs(Bvt,{children:[t.jsx(Fvt,{children:t.jsx("div",{style:{clipPath:s?"inset(0 0% 0 0)":"inset(0 100% 0 0)",transition:"clip-path 1s cubic-bezier(0.25,0.46,0.45,0.94) 0.1s"},children:t.jsxs("svg",{ref:i,viewBox:`0 0 ${m} ${h}`,width:"100%",style:{display:"block"},children:[t.jsx("defs",{children:t.jsxs("linearGradient",{id:"trendAreaGrad",x1:"0",y1:"0",x2:"0",y2:"1",children:[t.jsx("stop",{offset:"0%",stopColor:mi,stopOpacity:"0.10"}),t.jsx("stop",{offset:"100%",stopColor:mi,stopOpacity:"0.01"})]})}),Array.from({length:T+1}).map((R,F)=>{const Y=$+k/T*F,H=S(Y);return t.jsxs("g",{children:[t.jsx("line",{x1:g,y1:H,x2:g+w,y2:H,stroke:po,strokeWidth:"1"}),t.jsxs("text",{x:g-6,y:H+3,textAnchor:"end",fontSize:"8",fontWeight:"700",fill:Nn,children:[Math.round(Y),"%"]})]},F)}),u.map((R,F)=>{const Y=I(R.points);if(Y.length===0)return null;const H=uZ[F]||Nn;if(Y.length===1)return t.jsx("circle",{cx:Y[0].x,cy:Y[0].y,r:"3",fill:H,opacity:"0.7"},F);const U=Y.map(X=>`${X.x},${X.y}`).join(" ");return t.jsx("polyline",{points:U,fill:"none",stroke:H,strokeWidth:"1.5",strokeDasharray:"4 3",strokeLinejoin:"round",strokeLinecap:"round",opacity:"0.7"},F)}),B&&t.jsx("polygon",{points:B,fill:"url(#trendAreaGrad)"}),A.length>1&&t.jsx("polyline",{points:E,fill:"none",stroke:mi,strokeWidth:"2.5",strokeLinejoin:"round",strokeLinecap:"round"}),A.map((R,F)=>t.jsx("circle",{cx:R.x,cy:R.y,r:"4",fill:Oi,stroke:mi,strokeWidth:"2"},F)),c.map((R,F)=>{const Y=P(F),H=(()=>{try{return new Date(R.date+"T00:00:00").toLocaleString("en-US",{month:"short"})}catch{return""}})();return t.jsx("text",{x:Y,y:h-6,textAnchor:"middle",fontSize:"9",fontWeight:"700",fill:Nn,children:H},`l${F}`)})]})})}),t.jsxs(Wvt,{style:{paddingTop:r.top,paddingBottom:r.bottom},children:[t.jsxs(aZ,{$accent:mi,children:[t.jsx(lZ,{children:"Key Milestone"}),M?t.jsxs(t.Fragment,{children:[t.jsx(a4,{children:M.title}),t.jsx(l4,{children:M.description})]}):t.jsxs(t.Fragment,{children:[t.jsx(a4,{style:{color:Nn,fontSize:"0.9rem",fontWeight:700},children:"Tracking milestones..."}),t.jsx(l4,{children:"More data needed to identify a key milestone."})]})]}),t.jsxs(aZ,{$accent:zi,children:[t.jsx(lZ,{children:"Growth Summary"}),t.jsx(a4,{children:nwt(c)}),t.jsx(l4,{children:rwt(u,c)})]}),t.jsxs(Uvt,{children:[t.jsxs(cZ,{children:[t.jsx(By,{logoUrl:e.project.logo_url,size:20}),t.jsx(dZ,{$color:mi}),e.project.name]}),u.map((R,F)=>{const Y=(e.sections.competitor_ranking?.rows||[]).find(H=>H.name===R.name);return t.jsxs(cZ,{children:[t.jsx(xo,{record:{name:R.name,website:Y?.website},size:20,shape:"rounded",forceLogoDev:!0}),t.jsx(dZ,{$color:uZ[F]||Nn,$dashed:!0}),R.name]},F)})]})]})]})]})}function swt(){return{key:"visibility_trend",label:"Visibility Trend",icon:t.jsx(qi,{size:14}),sectionKey:"visibility_trend",render:e=>e.sections.visibility_trend?.has_data?t.jsx(owt,{d:e}):t.jsx(Eo,{children:"Not enough data for a visibility trend yet."})}}const awt=p.div.withConfig({displayName:"CompetitorRankingSlide__TableWrap",componentId:"sc-e3c1um-0"})` 18563 margin-top: 2.75rem;
18564`,Aue="3.5rem 19rem 1fr 6.5rem",Nue="2.5rem 8rem 1fr 4.5rem",lwt=p.div.withConfig({displayName:"CompetitorRankingSlide__HeaderRow",componentId:"sc-e3c1um-1"})` 18565 display: grid; 18566 grid-template-columns: ${Aue}; 18567 gap: 1rem; 18568 padding: 0 0.75rem 0.65rem; 18569 border-bottom: 1px solid ${zi}; 18570 18571 @media (max-width: 768px) { 18572 grid-template-columns: ${Nue}; 18573 gap: 0.5rem; 18574 padding: 0 0.5rem 0.5rem; 18575 } 18576`,d2=p.span.withConfig({displayName:"CompetitorRankingSlide__HeaderCell",componentId:"sc-e3c1um-2"})` 18577 font-size: 0.62rem; 18578 font-weight: 900; 18579 letter-spacing: 0.1em; 18580 text-transform: uppercase; 18581 color: ${Nn}; 18582 text-align: ${e=>e.$align||"left"}; 18583`,cwt=p.div.withConfig({displayName:"CompetitorRankingSlide__Row",componentId:"sc-e3c1um-3"})` 18584 display: grid; 18585 grid-template-columns: ${Aue}; 18586 gap: 1rem; 18587 align-items: center; 18588 padding: 0.75rem 0.75rem; 18589 border-bottom: 1px solid ${po}; 18590 background: ${e=>e.$highlight?W1t:"transparent"}; 18591 border-left: ${e=>e.$highlight?`3px solid ${mi}`:"3px solid transparent"}; 18592 18593 &:last-child { border-bottom: none; } 18594 18595 @media (max-width: 768px) { 18596 grid-template-columns: ${Nue}; 18597 gap: 0.5rem; 18598 padding: 0.6rem 0.5rem; 18599 } 18600`,dwt=p.span.withConfig({displayName:"CompetitorRankingSlide__RankNum",componentId:"sc-e3c1um-4"})` 18601 font-size: 0.9rem; 18602 font-weight: 950; 18603 color: ${e=>e.$highlight?mi:fi}; 18604 text-align: center; 18605`,uwt=p.div.withConfig({displayName:"CompetitorRankingSlide__BrandCell",componentId:"sc-e3c1um-5"})` 18606 display: flex; 18607 align-items: center; 18608 gap: 0.6rem; 18609`,pwt=p.span.withConfig({displayName:"CompetitorRankingSlide__BrandName",componentId:"sc-e3c1um-6"})` 18610 font-size: 0.88rem; 18611 font-weight: 800; 18612 color: ${e=>e.$highlight?Vn:fi}; 18613`,mwt=p.div.withConfig({displayName:"CompetitorRankingSlide__ScoreCell",componentId:"sc-e3c1um-7"})` 18614 display: flex; 18615 align-items: center; 18616 gap: 0.6rem; 18617`,hwt=p.span.withConfig({displayName:"CompetitorRankingSlide__ScoreNum",componentId:"sc-e3c1um-8"})` 18618 font-size: 0.88rem; 18619 font-weight: 900; 18620 color: ${Vn}; 18621 min-width: 2rem; 18622`,fwt=p.div.withConfig({displayName:"CompetitorRankingSlide__BarTrack",componentId:"sc-e3c1um-9"})` 18623 flex: 1; 18624 height: 6px; 18625 border-radius: 3px; 18626 background: ${po}; 18627 overflow: hidden; 18628`,gwt=p.div.withConfig({displayName:"CompetitorRankingSlide__BarFill",componentId:"sc-e3c1um-10"})` 18629 height: 100%; 18630 border-radius: 3px; 18631 width: ${e=>e.$pct}%; 18632 background: ${e=>e.$brand?mi:Nn}; 18633 transition: width 0.7s cubic-bezier(0.25,0.46,0.45,0.94); 18634 transition-delay: ${e=>e.$delay??0}s; 18635`,ywt=p.span.withConfig({displayName:"CompetitorRankingSlide__MomCell",componentId:"sc-e3c1um-11"})` 18636 font-size: 0.78rem; 18637 font-weight: 850; 18638 text-align: right; 18639 color: ${e=>e.$tone==="up"?"#059669":e.$tone==="down"?"#dc2626":Nn}; 18640`,xwt=p.div.withConfig({displayName:"CompetitorRankingSlide__InsightCard",componentId:"sc-e3c1um-12"})` 18641 background: ${Vn}; 18642 color: ${Oi}; 18643 border-radius: 0.75rem; 18644 padding: 1.25rem 1.5rem; 18645 margin-top: 0.75rem; 18646 max-width: 420px; 18647 margin-left: auto; 18648 18649 @media (max-width: 768px) { 18650 max-width: 100%; 18651 } 18652`,bwt=p.div.withConfig({displayName:"CompetitorRankingSlide__InsightLabel",componentId:"sc-e3c1um-13"})` 18653 font-size: 0.58rem; 18654 font-weight: 900; 18655 letter-spacing: 0.12em; 18656 text-transform: uppercase; 18657 color: ${Nn}; 18658 margin-bottom: 0.5rem; 18659`,vwt=p.div.withConfig({displayName:"CompetitorRankingSlide__InsightText",componentId:"sc-e3c1um-14"})` 18660 font-size: 0.82rem; 18661 font-weight: 600; 18662 line-height: 1.55; 18663 color: ${R1}; 18664`;function wwt(e,n){if(e.length<=n)return e;const i=e.findIndex(s=>s.is_main_brand);if(i===-1)return e.slice(0,n);let r=Math.max(0,i-Math.floor((n-1)/2)),o=r+n;return o>e.length&&(o=e.length,r=o-n),e.slice(r,o)}function jwt(e,n){const i=e.find(u=>u.is_main_brand);if(!i||i.visibility==null)return"How your brand ranks against competitors in AI visibility.";const r=i.rank,o=e.length,s=i.mom_change,a=e.filter(u=>!u.is_main_brand&&u.rank<r),c=e.filter(u=>!u.is_main_brand&&u.rank>r);if(r===1&&s!=null&&s>0)return`You hold the #1 position â visibility up ${hb(Math.abs(s))}% this month.`;if(r===1)return"You hold the #1 AI visibility position in your competitive set.";if(s!=null&&s>0&&c.length>0){const u=c.find(m=>m.mom_change!=null&&m.mom_change<0);return u?`You've moved into the top ${r}, overtaking ${u.name} in visibility this month.`:`You rank #${r} of ${o} â visibility up ${hb(Math.abs(s))}% this month.`}if(a.length>0){const u=a[a.length-1],m=u.visibility!=null&&i.visibility!=null?Math.round(u.visibility-i.visibility):null;if(m!=null&&m<=10)return`You rank #${r} of ${o}, just ${m}% visibility behind ${u.name}.`}return`You rank #${r} of ${o} in AI visibility among your competitors.`}function _wt(e,n){const i=e.find(m=>m.is_main_brand);if(!i||i.visibility==null)return null;const r=i.rank,o=i.mom_change,s=e.filter(m=>!m.is_main_brand),a=s.filter(m=>m.rank<r).sort((m,h)=>h.rank-m.rank),c=s.filter(m=>m.rank>r).sort((m,h)=>m.rank-h.rank);if(o!=null&&o>5&&r<=3){const m=hb(Math.abs(o));if(a.length>0){const h=a[0].visibility!=null?Math.round(a[0].visibility-i.visibility):null;if(h!=null)return`Your visibility grew +${m}% this month, narrowing the gap to ${a[0].name} to just ${h}% visibility. Maintain this trajectory to overtake them.`}return`Visibility rose +${m}% this month, placing you in the top ${r}. Continue building on this momentum.`}if(r===1&&c.length>0){const m=c[0].visibility!=null?Math.round(i.visibility-c[0].visibility):null;if(m!=null&&m<=5)return`You lead ${c[0].name} by only ${m}% visibility. Strengthen your content strategy to maintain the #1 position.`;if(m!=null)return`You lead ${c[0].name} by ${m}% visibility â a strong position to defend.`}if(a.length>0&&c.length>0){const m=a[0].visibility!=null?Math.round(a[0].visibility-i.visibility):null,h=c[0].visibility!=null?Math.round(i.visibility-c[0].visibility):null;if(m!=null&&m<=10)return`You're ${m}% visibility behind ${a[0].name}${h!=null?` and ${h}% ahead of ${c[0].name}`:""}. A focused optimization push could move you up.`}if(o!=null&&o<-3&&c.length>0){const m=c[0].visibility!=null?Math.round(i.visibility-c[0].visibility):null;if(m!=null&&m<=5)return`Your visibility dropped ${hb(Math.abs(o))}% this month and ${c[0].name} is now only ${m}% behind. Urgent action recommended.`}const u=s.filter(m=>m.mom_change!=null&&m.mom_change>3);if(u.length>0){const m=u.sort((h,g)=>(g.mom_change??0)-(h.mom_change??0))[0];return`${m.name}'s visibility surged +${hb(Math.abs(m.mom_change))}% this month. Monitor their strategy closely.`}return`You rank #${r} with ${hb(i.visibility)}% visibility. Focus on high-impact content to climb the ranking.`}function Cwt({data:e}){const[n,i]=l.useState(!1);l.useEffect(()=>{const m=requestAnimationFrame(()=>i(!0));return()=>cancelAnimationFrame(m)},[]);const r=e.sections.competitor_ranking;if(!r?.has_data)return t.jsx(Eo,{children:"No competitor ranking data available."});const o=r.rows||[],s=wwt(o,5),a=Math.max(...s.map(m=>m.visibility??0),1),c=jwt(o,e.project.name),u=_wt(o,e.project.name);return t.jsxs(Ou,{children:[t.jsx(Ho,{children:"Module 05"}),t.jsx(qo,{children:"Industry Ranking"}),t.jsx(Xc,{children:c}),t.jsxs(awt,{children:[t.jsxs(lwt,{children:[t.jsx(d2,{children:"Rank"}),t.jsx(d2,{children:"Brand"}),t.jsx(d2,{children:"Visibility Score"}),t.jsx(d2,{$align:"right",children:"MoM Change"})]}),s.map((m,h)=>{const g=m.visibility!=null?m.visibility/a*100:0,x=m.mom_change==null?"flat":m.mom_change>0?"up":m.mom_change<0?"down":"flat",y=m.mom_change==null?"â":`${m.mom_change>0?"â²":"â¼"} ${Math.abs(m.mom_change)}%`,w=m.is_main_brand?{name:m.name,website:m.website,logo_url:m.logo_url||e.project.logo_url}:{name:m.name,website:m.website,logo_url:null};return t.jsxs(cwt,{$highlight:m.is_main_brand,children:[t.jsx(dwt,{$highlight:m.is_main_brand,children:String(m.rank).padStart(2,"0")}),t.jsxs(uwt,{children:[t.jsx(xo,{record:w,size:24,shape:"rounded",forceLogoDev:!m.is_main_brand}),t.jsx(pwt,{$highlight:m.is_main_brand,children:m.name})]}),t.jsxs(mwt,{children:[t.jsx(hwt,{children:m.visibility!=null?`${Math.round(m.visibility)}%`:"â"}),t.jsx(fwt,{children:t.jsx(gwt,{$pct:n?g:0,$brand:m.is_main_brand,$delay:h*.08})})]}),t.jsx(ywt,{$tone:x,children:y})]},h)})]}),u&&t.jsxs(xwt,{children:[t.jsx(bwt,{children:"Key Insight"}),t.jsx(vwt,{children:u})]})]})}function Swt(){return{key:"competitor_ranking",label:"Industry Ranking",icon:t.jsx($P,{size:14}),sectionKey:"competitor_ranking",render:e=>t.jsx(Cwt,{data:e})}}const kwt={chatgpt:ju,gemini:wu,claude:nh,perplexity:ih,google_ai_overview:ya,google_ai_mode:ya,grok:Mf,copilot:Rf},Qj="#10b981",u2="#9ca3af",Zj="#ef4444",$wt=p.div.withConfig({displayName:"SentimentSlide__Layout",componentId:"sc-1u8xb3r-0"})` 18665 display: flex; 18666 gap: 2.5rem; 18667 margin-top: 3.5rem; 18668 18669 @media (max-width: 768px) { 18670 flex-direction: column; 18671 align-items: center; 18672 } 18673`,Iwt=p.div.withConfig({displayName:"SentimentSlide__LeftCol",componentId:"sc-1u8xb3r-1"})` 18674 display: flex; 18675 flex-direction: column; 18676 align-items: center; 18677 flex-shrink: 0; 18678 align-self: stretch; 18679`,Pwt=p.div.withConfig({displayName:"SentimentSlide__DonutWrap",componentId:"sc-1u8xb3r-2"})` 18680 position: relative; 18681 width: 280px; 18682 height: 280px; 18683 18684 @media (max-width: 768px) { 18685 width: 220px; 18686 height: 220px; 18687 } 18688`,Awt=p.div.withConfig({displayName:"SentimentSlide__DonutCenter",componentId:"sc-1u8xb3r-3"})` 18689 position: absolute; 18690 inset: 0; 18691 display: flex; 18692 flex-direction: column; 18693 align-items: center; 18694 justify-content: center; 18695 pointer-events: none; 18696`,Nwt=p.div.withConfig({displayName:"SentimentSlide__CenterLabel",componentId:"sc-1u8xb3r-4"})` 18697 font-size: 0.6rem; 18698 font-weight: 900; 18699 letter-spacing: 0.1em; 18700 text-transform: uppercase; 18701 color: ${Nn}; 18702 margin-bottom: 0.15rem; 18703`,zwt=p.div.withConfig({displayName:"SentimentSlide__CenterScore",componentId:"sc-1u8xb3r-5"})` 18704 font-size: 3rem; 18705 font-weight: 950; 18706 color: ${Vn}; 18707 line-height: 1; 18708`,Twt=p.div.withConfig({displayName:"SentimentSlide__LegendRow",componentId:"sc-1u8xb3r-6"})` 18709 display: flex; 18710 align-items: center; 18711 gap: 1.5rem; 18712 margin-top: 1.25rem; 18713`,c4=p.div.withConfig({displayName:"SentimentSlide__LegendItem",componentId:"sc-1u8xb3r-7"})` 18714 display: flex; 18715 align-items: center; 18716 gap: 0.35rem; 18717 font-size: 0.72rem; 18718 font-weight: 700; 18719 color: ${fi}; 18720`,d4=p.span.withConfig({displayName:"SentimentSlide__LegendDot",componentId:"sc-1u8xb3r-8"})` 18721 width: 8px; 18722 height: 8px; 18723 border-radius: 50%; 18724 background: ${e=>e.$color}; 18725`,Ewt=p.div.withConfig({displayName:"SentimentSlide__RightCol",componentId:"sc-1u8xb3r-9"})` 18726 flex: 1; 18727 display: flex; 18728 flex-direction: column; 18729 gap: 0.75rem; 18730 min-width: 0; 18731 align-self: stretch; 18732 justify-content: center; 18733 18734 @media (max-width: 768px) { 18735 width: 100%; 18736 } 18737`,Mwt=p.div.withConfig({displayName:"SentimentSlide__RightTitle",componentId:"sc-1u8xb3r-10"})` 18738 font-size: 0.62rem; 18739 font-weight: 900; 18740 letter-spacing: 0.1em; 18741 text-transform: uppercase; 18742 color: ${Nn}; 18743 margin-bottom: 0.25rem; 18744`,Rwt=p.div.withConfig({displayName:"SentimentSlide__ModelRow",componentId:"sc-1u8xb3r-11"})` 18745 display: flex; 18746 align-items: center; 18747 gap: 0.85rem; 18748 padding: 0.75rem 1rem; 18749 border: 1px solid ${po}; 18750 border-radius: 0.5rem; 18751 background: ${Oi}; 18752`,Owt=p.div.withConfig({displayName:"SentimentSlide__ModelInfo",componentId:"sc-1u8xb3r-12"})` 18753 display: flex; 18754 align-items: center; 18755 gap: 0.5rem; 18756 width: 120px; 18757 flex-shrink: 0; 18758 18759 @media (max-width: 768px) { 18760 width: 90px; 18761 } 18762`,Dwt=p.span.withConfig({displayName:"SentimentSlide__ModelIconWrap",componentId:"sc-1u8xb3r-13"})` 18763 display: inline-flex; 18764 align-items: center; 18765 justify-content: center; 18766 width: 24px; 18767 height: 24px; 18768 border-radius: 6px; 18769 background: ${po}; 18770 flex-shrink: 0; 18771 18772 svg { width: 14px; height: 14px; } 18773`,Lwt=p.span.withConfig({displayName:"SentimentSlide__ModelName",componentId:"sc-1u8xb3r-14"})` 18774 font-size: 0.78rem; 18775 font-weight: 800; 18776 color: ${Vn}; 18777 white-space: nowrap; 18778 overflow: hidden; 18779 text-overflow: ellipsis; 18780`,Bwt=p.span.withConfig({displayName:"SentimentSlide__ModelScore",componentId:"sc-1u8xb3r-15"})` 18781 font-size: 1rem; 18782 font-weight: 950; 18783 color: ${e=>e.$color}; 18784 min-width: 2.5rem; 18785 text-align: right; 18786 flex-shrink: 0; 18787`,Fwt=p.div.withConfig({displayName:"SentimentSlide__BarArea",componentId:"sc-1u8xb3r-16"})` 18788 flex: 1; 18789 display: flex; 18790 flex-direction: column; 18791 gap: 0.2rem; 18792 min-width: 0; 18793`,Wwt=p.div.withConfig({displayName:"SentimentSlide__StackedBar",componentId:"sc-1u8xb3r-17"})` 18794 display: flex; 18795 height: 10px; 18796 border-radius: 5px; 18797 overflow: hidden; 18798 background: ${po}; 18799`,u4=p.div.withConfig({displayName:"SentimentSlide__BarSegment",componentId:"sc-1u8xb3r-18"})` 18800 width: ${e=>e.$pct}%; 18801 background: ${e=>e.$color}; 18802 transition: width 0.7s cubic-bezier(0.25,0.46,0.45,0.94); 18803 transition-delay: ${e=>e.$delay}s; 18804`,Uwt=p.div.withConfig({displayName:"SentimentSlide__BarLabels",componentId:"sc-1u8xb3r-19"})` 18805 display: flex; 18806 gap: 0.65rem; 18807`,p4=p.span.withConfig({displayName:"SentimentSlide__BarLabel",componentId:"sc-1u8xb3r-20"})` 18808 font-size: 0.58rem; 18809 font-weight: 700; 18810 color: ${e=>e.$color}; 18811`;function Hwt(e,n,i,r){const o=n/2,s=n/2,a=(n-i)/2,c=2*Math.PI*a,u=3,m=e.reduce((x,y)=>x+y.pct,0);if(m===0)return[];const h=[];let g=-90;return e.forEach((x,y)=>{if(x.pct<=0)return;const w=x.pct/m*360,j=x.pct/m*c-u;j<=0||(h.push(t.jsx("circle",{cx:o,cy:s,r:a,fill:"none",stroke:x.color,strokeWidth:i,strokeDasharray:r?`${j} ${c-j}`:`0 ${c}`,strokeDashoffset:-(g/360)*c,strokeLinecap:"round",style:{transition:"stroke-dasharray 0.8s cubic-bezier(0.25,0.46,0.45,0.94)",transitionDelay:`${y*.1}s`}},y)),g+=w)}),h}function qwt(e){return e>=70?Qj:e>=40?fi:Zj}function Gwt({data:e}){const[n,i]=l.useState(!1);l.useEffect(()=>{const x=requestAnimationFrame(()=>i(!0));return()=>cancelAnimationFrame(x)},[]);const r=e.sections.sentiment;if(!r?.has_data)return t.jsx(Eo,{children:"No sentiment data available yet."});const o=typeof r.net_sentiment=="number"?r.net_sentiment:0,s=typeof r.positive_pct=="number"?r.positive_pct:0,a=typeof r.neutral_pct=="number"?r.neutral_pct:0,c=typeof r.negative_pct=="number"?r.negative_pct:0,u=280,m=32,h=[{pct:s,color:Qj},{pct:a,color:u2},{pct:c,color:Zj}],g=r.by_model||[];return t.jsxs(Ou,{children:[t.jsx(Ho,{children:"Module 06"}),t.jsx(qo,{children:"Sentiment Overview"}),t.jsx(Xc,{children:"How AI models perceive and describe your brand entity"}),t.jsxs($wt,{children:[t.jsxs(Iwt,{children:[t.jsxs(Pwt,{children:[t.jsx("svg",{viewBox:`0 0 ${u} ${u}`,width:"100%",height:"100%",children:Hwt(h,u,m,n)}),t.jsxs(Awt,{children:[t.jsx(Nwt,{children:"Net Sentiment"}),t.jsx(zwt,{children:o})]})]}),t.jsxs(Twt,{children:[t.jsxs(c4,{children:[t.jsx(d4,{$color:Qj})," Positive (",s,"%)"]}),t.jsxs(c4,{children:[t.jsx(d4,{$color:u2})," Neutral (",a,"%)"]}),t.jsxs(c4,{children:[t.jsx(d4,{$color:Zj})," Negative (",c,"%)"]})]})]}),t.jsxs(Ewt,{children:[t.jsx(Mwt,{children:"Sentiment by Model"}),g.map((x,y)=>{const w=kwt[x.model_key],j=Pue[x.model_key]||Nn;return t.jsxs(Rwt,{children:[t.jsxs(Owt,{children:[t.jsx(Dwt,{style:{background:`${j}18`},children:w?t.jsx(w,{}):null}),t.jsx(Lwt,{children:_f[x.model_key]||x.model_key})]}),t.jsx(Bwt,{$color:qwt(x.score),children:x.score}),t.jsxs(Fwt,{children:[t.jsxs(Wwt,{children:[t.jsx(u4,{$pct:n?x.positive_pct:0,$color:Qj,$delay:y*.06}),t.jsx(u4,{$pct:n?x.neutral_pct:0,$color:u2,$delay:y*.06+.05}),t.jsx(u4,{$pct:n?x.negative_pct:0,$color:Zj,$delay:y*.06+.1})]}),t.jsxs(Uwt,{children:[x.positive_pct>0&&t.jsxs(p4,{$color:Qj,children:[x.positive_pct,"%"]}),x.neutral_pct>0&&t.jsxs(p4,{$color:u2,children:[x.neutral_pct,"%"]}),x.negative_pct>0&&t.jsxs(p4,{$color:Zj,children:[x.negative_pct,"%"]})]})]})]},x.model_key)})]})]})]})}function Vwt(){return{key:"sentiment",label:"Sentiment Overview",icon:t.jsx(Rxe,{size:14}),sectionKey:"sentiment",render:e=>t.jsx(Gwt,{data:e})}}const Kwt=p.div.withConfig({displayName:"CitationsSlide__Layout",componentId:"sc-1gtromq-0"})` 18812 display: grid; 18813 grid-template-columns: 40% 1fr; 18814 gap: 2.5rem; 18815 margin-top: 2rem; 18816 18817 & > * { min-width: 0; } 18818 18819 @media (max-width: 768px) { 18820 grid-template-columns: 1fr; 18821 gap: 2rem; 18822 } 18823`,mZ=p.div.withConfig({displayName:"CitationsSlide__ColTitle",componentId:"sc-1gtromq-1"})` 18824 display: flex; 18825 align-items: center; 18826 gap: 0.5rem; 18827 font-size: 0.95rem; 18828 font-weight: 900; 18829 c
18829olor: ${Vn}; 18830 margin-bottom: 1.25rem; 18831`,Ywt=p.div.withConfig({displayName:"CitationsSlide__DomainList",componentId:"sc-1gtromq-2"})` 18832 display: flex; 18833 flex-direction: column; 18834 gap: 1.5rem; 18835`,Xwt=p.div.withConfig({displayName:"CitationsSlide__DomainRow",componentId:"sc-1gtromq-3"})` 18836 display: flex; 18837 flex-direction: column; 18838 gap: 0.35rem; 18839`,Qwt=p.div.withConfig({displayName:"CitationsSlide__DomainHeader",componentId:"sc-1gtromq-4"})` 18840 display: flex; 18841 align-items: center; 18842 gap: 0.5rem; 18843`,Zwt=p.div.withConfig({displayName:"CitationsSlide__DomainName",componentId:"sc-1gtromq-5"})` 18844 font-size: 0.85rem; 18845 font-weight: 800; 18846 color: ${Vn}; 18847 flex: 1; 18848`,Jwt=p.div.withConfig({displayName:"CitationsSlide__DomainBarTrack",componentId:"sc-1gtromq-6"})` 18849 width: 100%; 18850 height: 6px; 18851 border-radius: 3px; 18852 background: ${po}; 18853`,ejt=p.div.withConfig({displayName:"CitationsSlide__DomainBarFill",componentId:"sc-1gtromq-7"})` 18854 height: 100%; 18855 border-radius: 3px; 18856 width: ${e=>e.$pct}%; 18857 background: ${mi}; 18858 transition: width 0.7s cubic-bezier(0.25,0.46,0.45,0.94); 18859 transition-delay: ${e=>e.$delay??0}s; 18860`,tjt=p.span.withConfig({displayName:"CitationsSlide__DomainCount",componentId:"sc-1gtromq-8"})` 18861 font-size: 0.85rem; 18862 font-weight: 900; 18863 color: ${Vn}; 18864 min-width: 2rem; 18865 text-align: right; 18866`,njt=p.div.withConfig({displayName:"CitationsSlide__PageList",componentId:"sc-1gtromq-9"})` 18867 display: flex; 18868 flex-direction: column; 18869 gap: 0.75rem; 18870`,ijt=p.div.withConfig({displayName:"CitationsSlide__PageCard",componentId:"sc-1gtromq-10"})` 18871 display: flex; 18872 align-items: center; 18873 gap: 0.85rem; 18874 padding: 0.85rem 1rem; 18875 border: 1px solid ${po}; 18876 border-radius: 0.65rem; 18877 background: ${Oi}; 18878`,rjt=p.span.withConfig({displayName:"CitationsSlide__PageRank",componentId:"sc-1gtromq-11"})` 18879 font-size: 0.75rem; 18880 font-weight: 900; 18881 color: ${mi}; 18882 background: ${R1}; 18883 border-radius: 6px; 18884 width: 28px; 18885 height: 28px; 18886 display: flex; 18887 align-items: center; 18888 justify-content: center; 18889 flex-shrink: 0; 18890`,ojt=p.div.withConfig({displayName:"CitationsSlide__PageInfo",componentId:"sc-1gtromq-12"})` 18891 flex: 1; 18892 min-width: 0; 18893`,sjt=p.div.withConfig({displayName:"CitationsSlide__PagePath",componentId:"sc-1gtromq-13"})` 18894 font-size: 0.82rem; 18895 font-weight: 800; 18896 color: ${Vn}; 18897 white-space: nowrap; 18898 overflow: hidden; 18899 text-overflow: ellipsis; 18900`,ajt=p.div.withConfig({displayName:"CitationsSlide__PageMeta",componentId:"sc-1gtromq-14"})` 18901 display: flex; 18902 align-items: center; 18903 gap: 0.75rem; 18904 margin-top: 0.55rem; 18905 font-size: 0.7rem; 18906 font-weight: 700; 18907 color: ${Nn}; 18908`,hZ=p.span.withConfig({displayName:"CitationsSlide__MetaChip",componentId:"sc-1gtromq-15"})` 18909 display: inline-flex; 18910 align-items: center; 18911 gap: 0.25rem; 18912`,ljt=p.a.withConfig({displayName:"CitationsSlide__OpenLink",componentId:"sc-1gtromq-16"})` 18913 display: inline-flex; 18914 align-items: center; 18915 color: ${Nn}; 18916 cursor: pointer; 18917 transition: color 0.15s; 18918 &:hover { color: ${mi}; } 18919`,cjt=p.span.withConfig({displayName:"CitationsSlide__PageCount",componentId:"sc-1gtromq-17"})` 18920 font-size: 1.1rem; 18921 font-weight: 950; 18922 color: ${Vn}; 18923 flex-shrink: 0; 18924`;function djt({data:e}){const[n,i]=l.useState(!1);l.useEffect(()=>{const c=requestAnimationFrame(()=>i(!0));return()=>cancelAnimationFrame(c)},[]);const r=e.sections.citations;if(!r?.has_data)return t.jsx(Eo,{children:"No citation data available yet."});const o=(r.domains||[]).slice(0,5),s=(r.pages||[]).slice(0,5),a=Math.max(...o.map(c=>c.frequency),1);return t.jsxs(Ou,{children:[t.jsx(Ho,{children:"Module 07"}),t.jsx(qo,{children:"Citation Intelligence"}),t.jsxs(Kwt,{children:[t.jsxs("div",{children:[t.jsxs(mZ,{children:[t.jsx(To,{size:15})," Top Cited Domains"]}),t.jsx(Ywt,{children:o.map((c,u)=>{const m=c.frequency/a*100;return t.jsxs(Xwt,{children:[t.jsxs(Qwt,{children:[t.jsx($u,{domain:c.domain,size:20}),t.jsx(Zwt,{children:c.domain}),t.jsx(tjt,{children:c.frequency})]}),t.jsx(Jwt,{children:t.jsx(ejt,{$pct:n?m:0,$delay:u*.08})})]},u)})})]}),t.jsxs("div",{children:[t.jsxs(mZ,{children:[t.jsx(Ss,{size:15})," Top Cited Pages"]}),t.jsx(njt,{children:s.map((c,u)=>t.jsxs(ijt,{children:[t.jsx(rjt,{children:String(u+1).padStart(2,"0")}),c.domain&&t.jsx($u,{domain:c.domain,size:20}),t.jsxs(ojt,{children:[t.jsx(sjt,{children:c.page||c.url}),t.jsxs(ajt,{children:[t.jsxs(hZ,{children:[t.jsx(xu,{size:10})," ",c.frequency," Citations"]}),c.domain&&t.jsx(hZ,{children:c.domain}),c.url&&t.jsx(ljt,{href:c.url,target:"_blank",rel:"noopener noreferrer",children:t.jsx(as,{size:10})})]})]}),t.jsx(cjt,{children:c.frequency})]},u))})]})]})]})}function ujt(){return{key:"citations",label:"Citation Intelligence",icon:t.jsx(xu,{size:14}),sectionKey:"citations",render:e=>t.jsx(djt,{data:e})}}function pjt(e){return e==null?"â":e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}const mjt={chatgpt:ju,gemini:wu,claude:nh,perplexity:ih,google_ai_overview:ya,google_ai_mode:ya,grok:Mf,copilot:Rf},hjt=p.span.withConfig({displayName:"TopPromptsSlide__ModelIconsWrap",componentId:"sc-1hbs6eb-0"})` 18925 display: inline-flex; 18926 align-items: center; 18927 gap: 0.2rem; 18928`,fjt=p.div.withConfig({displayName:"TopPromptsSlide__Layout",componentId:"sc-1hbs6eb-1"})` 18929 display: grid; 18930 grid-template-columns: 1fr 1fr; 18931 gap: 2.5rem; 18932 margin-top: 3rem; 18933 18934 & > * { min-width: 0; } 18935 18936 @media (max-width: 768px) { 18937 grid-template-columns: 1fr; 18938 gap: 2rem; 18939 } 18940`,fZ=p.div.withConfig({displayName:"TopPromptsSlide__ColTitle",componentId:"sc-1hbs6eb-2"})` 18941 display: flex; 18942 align-items: center; 18943 gap: 0.45rem; 18944 font-size: 0.9rem; 18945 font-weight: 900; 18946 color: ${e=>e.$color}; 18947 margin-bottom: 1rem; 18948`,gZ=p.div.withConfig({displayName:"TopPromptsSlide__CardList",componentId:"sc-1hbs6eb-3"})` 18949 display: flex; 18950 flex-direction: column; 18951 gap: 0.75rem; 18952`,gjt=p.div.withConfig({displayName:"TopPromptsSlide__Card",componentId:"sc-1hbs6eb-4"})` 18953 display: flex; 18954 align-items: center; 18955 gap: 0.75rem; 18956 padding: 0.9rem 1.1rem; 18957 border: 1px solid ${po}; 18958 border-left: 3px solid ${e=>e.$accent}; 18959 border-radius: 0.55rem; 18960 background: ${Oi}; 18961 min-width: 0; 18962 overflow: hidden; 18963`,yjt=p.div.withConfig({displayName:"TopPromptsSlide__CardInfo",componentId:"sc-1hbs6eb-5"})` 18964 flex: 1; 18965 min-width: 0; 18966`,xjt=p.div.withConfig({displayName:"TopPromptsSlide__PromptText",componentId:"sc-1hbs6eb-6"})` 18967 font-size: 0.82rem; 18968 font-weight: 800; 18969 line-height: 1.4; 18970 min-height: calc(0.82rem * 1.4 * 2); 18971 color: ${Vn}; 18972 display: -webkit-box; 18973 -webkit-line-clamp: 2; 18974 -webkit-box-orient: vertical; 18975 overflow: hidden; 18976`,bjt=p.div.withConfig({displayName:"TopPromptsSlide__MetaRow",componentId:"sc-1hbs6eb-7"})` 18977 display: flex; 18978 align-items: center; 18979 gap: 0.65rem; 18980 margin-top: 0.35rem; 18981`,vjt=p.span.withConfig({displayName:"TopPromptsSlide__MetaChip",componentId:"sc-1hbs6eb-8"})` 18982 display: inline-flex; 18983 align-items: center; 18984 gap: 0.2rem; 18985 font-size: 0.65rem; 18986 font-weight: 700; 18987 color: ${Nn}; 18988`,wjt=p.div.withConfig({displayName:"TopPromptsSlide__ScoreCol",componentId:"sc-1hbs6eb-9"})` 18989 display: flex; 18990 flex-direction: column; 18991 align-items: flex-end; 18992 flex-shrink: 0; 18993`,jjt=p.span.withConfig({displayName:"TopPromptsSlide__ScoreValue",componentId:"sc-1hbs6eb-10"})` 18994 font-size: 1.35rem; 18995 font-weight: 950; 18996 color: ${e=>e.$color}; 18997 line-height: 1; 18998`,_jt=p.span.withConfig({displayName:"TopPromptsSlide__MomBadge",componentId:"sc-1hbs6eb-11"})` 18999 display: inline-flex; 19000 align-items: center; 19001 gap: 0.15rem; 19002 font-size: 0.65rem; 19003 font-weight: 800; 19004 color: ${e=>e.$positive?"#16a34a":"#dc2626"}; 19005 margin-top: 0.2rem; 19006`,m4="#16a34a",h4="#dc2626";function yZ({row:e,accent:n,scoreColor:i}){const r=e.mom_change,o=sD(Math.round(e.visibility));return t.jsxs(gjt,{$accent:n,children:[t.jsxs(yjt,{children:[t.jsxs(xjt,{children:['"',e.text,'"']}),t.jsxs(bjt,{children:[e.volume!=null&&t.jsxs(vjt,{children:[t.jsx(Cs,{size:10})," ",pjt(e.volume)," Vol"]}
19006),(e.model_keys||[]).length>0&&t.jsx(hjt,{children:(e.model_keys||[]).map(s=>{const a=mjt[s];return a?t.jsx(a,{width:13,height:13},s):null})})]})]}),t.jsxs(wjt,{children:[t.jsxs(jjt,{$color:i,children:[o,"%"]}),r!=null&&r!==0&&t.jsxs(_jt,{$positive:r>0,children:[r>0?"â²":"â¼"," ",r>0?"+":"",r,"%"]})]})]})}function Cjt(){return{key:"top_prompts",label:"Top Prompts",icon:t.jsx(Ss,{size:14}),sectionKey:"top_prompts",render:e=>{const n=e.sections.top_prompts;if(!n?.has_data)return t.jsx(Eo,{children:"No prompt performance data available."});const i=n.top_performing||[],r=n.opportunities||[];return t.jsxs(Ou,{children:[t.jsx(Ho,{children:"Module 08"}),t.jsx(qo,{children:"Top Prompts"}),t.jsxs(fjt,{children:[t.jsxs("div",{children:[t.jsxs(fZ,{$color:m4,children:[t.jsx(qi,{size:16})," Top Performing"]}),t.jsx(gZ,{children:i.map(o=>t.jsx(yZ,{row:o,accent:m4,scoreColor:m4},o.id))})]}),t.jsxs("div",{children:[t.jsxs(fZ,{$color:h4,children:[t.jsx(Sf,{size:16})," Opportunities"]}),t.jsx(gZ,{children:r.map(o=>t.jsx(yZ,{row:o,accent:h4,scoreColor:h4},o.id))})]})]})]})}}}function Sjt(e){return e>=75?"Good":e>=50?"Needs Work":"Critical"}function Rx(e){return e==null?"var(--color-gray-400, #94A3B8)":e>=75?"var(--color-green-500, #10B981)":e>=50?"var(--color-yellow-500, #F59E0B)":"var(--color-red-500, #EF4444)"}const kjt={high:0,medium:1,low:2};function zue(e){return e.high>0?"high":e.medium>0?"medium":"low"}function xZ(e){return kjt[zue(e)]??3}function $jt(e,n,i){const r=e.category??"",o=e.high,s=e.medium;e.low;const a=e.total,c=i>0?Math.round(a/i*100):0,m={performance:()=>o>0?`${o} critical speed issue${o>1?"s":""} (slow fetch, large DOM) â fixing these can cut load time by 30%+ and improve crawl efficiency.`:s>0?`${s} performance bottleneck${s>1?"s":""} like unoptimized images or large HTML â addressing these will improve Core Web Vitals.`:`${a} minor performance gap${a>1?"s":""} such as missing resource hints â small optimizations for faster page delivery.`,crawlability:()=>o>0?`${o} critical crawl barrier${o>1?"s":""} (missing canonicals, no internal links) blocking AI bots from discovering your content.`:s>0?`${s} crawlability issue${s>1?"s":""} like empty anchor text â these weaken link equity and reduce how well AI models map your site.`:`${a} minor linking issue${a>1?"s":""} with generic anchors â improving anchor text helps AI models understand page relationships.`,security:()=>o>0?`${o} critical security gap${o>1?"s":""} detected â missing HSTS or headers that could expose your site to attacks and hurt trust signals.`:s>0?`Missing ${s} security header${s>1?"s":""} (HSTS, CSP) â adding these takes minutes and builds trust with both users and AI models.`:`${a} low-priority header${a>1?"s":""} missing (X-Frame-Options, CSP) â easy hardening steps for defense-in-depth.`,structured_data:()=>o>0?`${o} page${o>1?"s":""} with no structured data at all â AI models rely on schema markup to understand and cite your content accurately.`:s>0?`${s} page${s>1?"s":""} with incomplete or missing FAQ schema â adding structured data can increase your citation rate by 2-3Ã.`:`${a} minor schema gap${a>1?"s":""} â recommended properties are missing but core markup is present.`,content_quality:()=>o>0?`${o} page${o>1?"s":""} with thin content (<300 words) â AI models skip shallow pages when selecting sources to cite.`:s>0?`${s} content quality flag${s>1?"s":""} (readability, missing media) â richer content gets cited 40% more often in AI responses.`:`${a} minor quality signal${a>1?"s":""} missing (author byline, dates) â these build E-E-A-T that AI models weigh when ranking sources.`,content_structure:()=>o>0?`${o} page${o>1?"s":""} missing H1 tags â without clear headings, AI models can't extract your key topics and answers.`:s>0?`${s} heading hierarchy issue${s>1?"s":""} (skipped levels) â clean structure helps AI models parse sections as distinct answers.`:`${a} minor structure issue${a>1?"s":""} (long paragraphs, no lists) â scannable formatting improves both UX and AI extractability.`,meta_onpage:()=>o>0?`${o} page${o>
190061?"s":""} missing meta descriptions â these are often used by AI models as summary text when citing your site.`:s>0?`${s} on-page issue${s>1?"s":""} (title length, missing OG tags, alt text) â fixing these improves how your pages appear in AI citations.`:`${a} minor meta gap${a>1?"s":""} like missing lang attribute â low effort fixes that round out your on-page optimization.`,aeo_readiness:()=>o>0?`${o} page${o>1?"s":""} with no direct answer format â AI models strongly prefer pages that lead with a concise, extractable answer.`:s>0?`${s} AEO gap${s>1?"s":""} (no E-E-A-T signals, missing summaries) â these directly determine whether AI models choose to cite you.`:`${a} minor AEO refinement${a>1?"s":""} needed â adding source citations can boost your authority signals for AI responses.`}[r];return m?m():c>=30?`Accounts for ${c}% of all site issues â resolving this category will have the biggest overall impact.`:`${a} issue${a!==1?"s":""} across ${Math.min(a,n)} page${a>1?"s":""} â ${o>0?"start with the high-severity findings":"mostly quick fixes"}.`}const Ijt=p.div.withConfig({displayName:"SiteHealthSlide__Layout",componentId:"sc-1umq2a2-0"})` 19007 display: grid; 19008 grid-template-columns: 1fr 1fr; 19009 gap: 2.5rem; 19010 margin-top: 2.75rem; 19011 19012 & > * { min-width: 0; } 19013 19014 @media (max-width: 768px) { 19015 grid-template-columns: 1fr; 19016 gap: 2rem; 19017 } 19018`,Pjt=p.div.withConfig({displayName:"SiteHealthSlide__LeftCol",componentId:"sc-1umq2a2-1"})` 19019 display: flex; 19020 flex-direction: column; 19021 align-items: center; 19022 justify-content: center; 19023 gap: 1.5rem; 19024`,Ajt=p.div.withConfig({displayName:"SiteHealthSlide__ScoresRow",componentId:"sc-1umq2a2-2"})` 19025 display: flex; 19026 align-items: center; 19027 justify-content: center; 19028 gap: 1.5rem; 19029`,f4=p.div.withConfig({displayName:"SiteHealthSlide__ScoreItem",componentId:"sc-1umq2a2-3"})` 19030 display: flex; 19031 flex-direction: column; 19032 align-items: center; 19033 gap: 0.35rem; 19034`,g4=p.div.withConfig({displayName:"SiteHealthSlide__DonutWrap",componentId:"sc-1umq2a2-4"})` 19035 position: relative; 19036 width: ${e=>e.$size??200}px; 19037 height: ${e=>e.$size??200}px; 19038`,y4=p.div.withConfig({displayName:"SiteHealthSlide__DonutCenter",componentId:"sc-1umq2a2-5"})` 19039 position: absolute; 19040 inset: 0; 19041 display: flex; 19042 flex-direction: column; 19043 align-items: center; 19044 justify-content: center; 19045`,x4=p.span.withConfig({displayName:"SiteHealthSlide__DonutScore",componentId:"sc-1umq2a2-6"})` 19046 font-size: ${e=>e.$big?"2.8rem":"1.15rem"}; 19047 font-weight: 950; 19048 line-height: 1; 19049`,Njt=p.span.withConfig({displayName:"SiteHealthSlide__DonutLabel",componentId:"sc-1umq2a2-7"})` 19050 font-size: 0.75rem; 19051 font-weight: 700; 19052 margin-top: 0.2rem; 19053`,b4=p.span.withConfig({displayName:"SiteHealthSlide__ScoreCaption",componentId:"sc-1umq2a2-8"})` 19054 font-size: 0.7rem; 19055 font-weight: 800; 19056 color: ${fi}; 19057 text-transform: uppercase; 19058 letter-spacing: 0.03em; 19059`,zjt=p.div.withConfig({displayName:"SiteHealthSlide__SeverityRow",componentId:"sc-1umq2a2-9"})` 19060 display: flex; 19061 gap: 0.6rem; 19062 width: 80%; 19063 justify-content: center; 19064`,v4=p.div.withConfig({displayName:"SiteHealthSlide__SeverityPill",componentId:"sc-1umq2a2-10"})` 19065 flex: 1; 19066 display: flex; 19067 flex-direction: column; 19068 align-items: center; 19069 justify-content: center; 19070 padding: 0.65rem 0.4rem; 19071 border: 1px solid ${po}; 19072 border-top: 3px solid ${e=>e.$border}; 19073 border-radius: 0.4rem; 19074 background: ${Oi}; 19075`,w4=p.span.withConfig({displayName:"SiteHealthSlide__SeverityCount",componentId:"sc-1umq2a2-11"})` 19076 font-size: 1.5rem; 19077 font-weight: 950; 19078 color: ${Vn}; 19079`,j4=p.span.withConfig({displayName:"SiteHealthSlide__SeverityLabel",componentId:"sc-1umq2a2-12"})` 19080 font-size: 0.65rem; 19081 font-weight: 800; 19082 text-transform: uppercase; 19083 letter-spacing: 0.04em; 19084 margin-top: 0.2rem; 19085`,Tjt=p.div.withConfig({displayName:"SiteHealthSlide__RightCol",componentId:"sc-1umq2a2-13"})` 19086 display: flex; 19087 flex-direction: column; 19088 gap: 0.75rem; 19089`,bZ=p.div.withConfig({displayName:"SiteHealthSlide__ColTitle",componentId:"sc-1umq2a2-14"})` 19090 display: flex; 19091 align-items: center; 19092 gap: 0.4rem; 19093 font-size: 0.95rem; 19094 font-weight: 900; 19095 color: ${Vn}; 19096 margin-bottom: 0.25rem; 19097`,Ejt=p.div.withConfig({displayName:"SiteHealthSlide__QuickWinCard",componentId:"sc-1umq2a2-15"})` 19098 display: flex; 19099 gap: 0.65rem; 19100 padding: 0.85rem 1rem; 19101 border: 1px solid ${po}; 19102 border-radius: 0.55rem; 19103 background: ${Oi}; 19104`,Mjt=p.div.withConfig({displayName:"SiteHealthSlide__QwIcon",componentId:"sc-1umq2a2-16"})` 19105 flex-shrink: 0; 19106 margin-top: 0.1rem; 19107 color: #16a34a; 19108`,Rjt=p.div.withConfig({displayName:"SiteHealthSlide__QwContent",componentId:"sc-1umq2a2-17"})` 19109 flex: 1; 19110 min-width: 0; 19111`,Ojt=p.div.withConfig({displayName:"SiteHealthSlide__QwTitle",componentId:"sc-1umq2a2-18"})` 19112 font-size: 0.8rem; 19113 font-weight: 800; 19114 color: ${Vn}; 19115`,vZ=p.div.withConfig({displayName:"SiteHealthSlide__QwDesc",componentId:"sc-1umq2a2-19"})` 19116 font-size: 0.7rem; 19117 font-weight: 600; 19118 color: ${Nn}; 19119 margin-top: 0.15rem; 19120`,Djt=p.div.withConfig({displayName:"SiteHealthSlide__QwInsight",componentId:"sc-1umq2a2-20"})` 19121 font-size: 0.68rem; 19122 font-weight: 500; 19123 color: ${fi}; 19124 line-height: 1.45; 19125 margin-top: 0.3rem; 19126`,Ljt=p.span.withConfig({displayName:"SiteHealthSlide__ImpactBadge",componentId:"sc-1umq2a2-21"})` 19127 display: inline-block; 19128 font-size: 0.55rem; 19129 font-weight: 900; 19130 text-transform: uppercase; 19131 letter-spacing: 0.04em; 19132 color: ${e=>e.$color}; 19133 background: ${e=>e.$color}18; 19134 padding: 0.15rem 0.45rem; 19135 border-radius: 3px; 19136 margin-top: 0.3rem; 19137`;function _4({size:e,strokeW:n,pct:i,color:r,animated:o,delay:s=0}){const a=(e-n)/2,c=Math.PI*2*a,u=o?c-c*Math.min(i,100)/100:c,m=e/2;return t.jsxs("svg",{width:e,height:e,viewBox:`0 0 ${e} ${e}`,children:[t.jsx("circle",{cx:m,cy:m,r:a,fill:"none",stroke:po,strokeWidth:n}),t.jsx("circle",{cx:m,cy:m,r:a,fill:"none",stroke:r,strokeWidth:n,strokeDasharray:c,strokeDashoffset:u,strokeLinecap:"round",transform:`rotate(-90 ${m} ${m})`,style:{transition:`stroke-dashoffset 0.8s cubic-bezier(0.25,0.46,0.45,0.94) ${s}s`}})]})}function Bjt({data:e}){const[n,i]=l.useState(!1);l.useEffect(()=>{const x=requestAnimationFrame(()=>i(!0));return()=>cancelAnimationFrame(x)},[]);const r=e.sections.site_audit;if(!r?.has_data)return t.jsx(Eo,{children:"No site audit data available."});const o=r.counts||{},s=r.overall_score??0,a=r.technical_score??0,c=r.content_score??0,u=r.pages_audited??0,g=[...r.top_categories||[]].filter(x=>x.total>0).sort((x,y)=>xZ(x)-xZ(y)||y.total-x.total).slice(0,3);return t.jsxs(Ou,{children:[t.jsx(Ho,{children:"Module 09"}),t.jsx(qo,{children:"Site Health Score"}),t.jsx(Xc,{children:"Current snapshot â reflects the latest site audit, not the selected report month."}),t.jsxs(Ijt,{children:[t.jsxs(Pjt,{children:[t.jsxs(Ajt,{children:[t.jsxs(f4,{children:[t.jsxs(g4,{$size:90,children:[t.jsx(_4,{size:90,strokeW:7,pct:a,color:Rx(a),animated:n,delay:.1}),t.jsx(y4,{children:t.jsx(x4,{style:{color:Rx(a)},children:a})})]}),t.jsx(b4,{children:"Technical"})]}),t.jsxs(f4,{children:[t.jsxs(g4,{$size:200,children:[t.jsx(_4,{size:200,strokeW:16,pct:s,color:Rx(s),animated:n}),t.jsxs(y4,{children:[t.jsx(x4,{$big:!0,style:{color:Rx(s)},children:s}),t.jsx(Njt,{style:{color:fi},children:Sjt(s)})]})]}),t.jsx(b4,{children:"AI Readiness"})]}),t.jsxs(f4,{children:[t.jsxs(g4,{$size:90,children:[t.jsx(_4,{size:90,strokeW:7,pct:c,color:Rx(c),animated:n,delay:.2}),t.jsx(y4,{children:t.jsx(x4,{style:{color:Rx(c)},children:c})})]}),t.jsx(b4,{children:"Content"})]})]}),t.jsxs(bZ,{style:{marginTop:"1rem"},children:[t.jsx(Yl,{size:15})," Issues"]}),t.jsxs(zjt,{children:[t.jsxs(v4,{$border:"#dc2626",children:[t.jsx(w4,{children:o.high||
191370}),t.jsx(j4,{style:{color:"#dc2626"},children:"High"})]}),t.jsxs(v4,{$border:"#d97706",children:[t.jsx(w4,{children:o.medium||0}),t.jsx(j4,{style:{color:"#d97706"},children:"Medium"})]}),t.jsxs(v4,{$border:Nn,children:[t.jsx(w4,{children:o.low||0}),t.jsx(j4,{style:{color:Nn},children:"Low"})]})]})]}),t.jsxs(Tjt,{children:[t.jsxs(bZ,{children:[t.jsx(Ks,{size:15})," Quick Wins"]}),g.map((x,y)=>{const w=zue(x),j=w==="high"?"#dc2626":w==="medium"?"#d97706":Nn;return t.jsxs(Ejt,{children:[t.jsx(Mjt,{style:{color:j},children:t.jsx(Pne,{size:16})}),t.jsxs(Rjt,{children:[t.jsx(Ojt,{children:(x.label||x.category||"").replace(/_/g," ").replace(/\b\w/g,v=>v.toUpperCase())}),t.jsxs(vZ,{children:[x.total," issue",x.total!==1?"s":""," · ",x.high," high · ",x.medium," medium · ",x.low," low"]}),t.jsx(Djt,{children:$jt(x,u,r.total_issues??0)}),t.jsx(Ljt,{$color:j,children:w==="high"?"High impact":w==="medium"?"Medium impact":"Low impact"})]})]},y)}),g.length===0&&t.jsx(vZ,{style:{textAlign:"center",padding:"2rem 0"},children:"No issues found â great job!"})]})]})]})}function Fjt(){return{key:"site_audit",label:"Site Health",icon:t.jsx(Yl,{size:14}),sectionKey:"site_audit",render:e=>t.jsx(Bjt,{data:e})}}const Wjt=p.div.withConfig({displayName:"CompetitorDeepDiveSlide__Layout",componentId:"sc-1xczwgh-0"})` 19138 display: flex; 19139 align-items: stretch; 19140 gap: 1.75rem; 19141 margin-top: 2.5rem; 19142 position: relative; 19143 19144 @media (max-width: 768px) { 19145 flex-direction: column; 19146 gap: 0; 19147 } 19148`,Ujt=p.div.withConfig({displayName:"CompetitorDeepDiveSlide__CardCol",componentId:"sc-1xczwgh-1"})` 19149 flex: 1; 19150 min-width: 0; 19151 border: ${e=>e.$isBrand?"1.5px solid #c7d2fe":`1px solid ${zi}`}; 19152 border-radius: 0.85rem; 19153 padding: 1.75rem 1.8rem 1.5rem; 19154 background: ${e=>e.$isBrand?"#f8faff":Oi}; 19155 display: flex; 19156 flex-direction: column; 19157`,Hjt=p.div.withConfig({displayName:"CompetitorDeepDiveSlide__VsWrap",componentId:"sc-1xczwgh-2"})` 19158 position: absolute; 19159 left: 50%; 19160 top: 50%; 19161 transform: translate(-50%, -50%); 19162 z-index: 2; 19163 19164 @media (max-width: 768px) { 19165 position: relative; 19166 left: auto; 19167 top: auto; 19168 transform: none; 19169 display: flex; 19170 justify-content: center; 19171 margin: 0.5rem 0; 19172 z-index: 2; 19173 } 19174`,qjt=p.div.withConfig({displayName:"CompetitorDeepDiveSlide__VsCircle",componentId:"sc-1xczwgh-3"})` 19175 width: 2.5rem; 19176 height: 2.5rem; 19177 border-radius: 50%; 19178 background: ${Oi}; 19179 border: 1px solid ${zi}; 19180 display: flex; 19181 align-items: center; 19182 justify-content: center; 19183 font-size: 0.7rem; 19184 font-weight: 950; 19185 color: ${fi}; 19186 letter-spacing: 0.04em; 19187 box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06); 19188`,Gjt=p.div.withConfig({displayName:"CompetitorDeepDiveSlide__EntityHeader",componentId:"sc-1xczwgh-4"})` 19189 display: flex; 19190 align-items: center; 19191 gap: 0.7rem; 19192 padding-bottom: 1.25rem; 19193 border-bottom: 1px solid ${po}; 19194`,Vjt=p.span.withConfig({displayName:"CompetitorDeepDiveSlide__EntityName",componentId:"sc-1xczwgh-5"})` 19195 font-size: 1.15rem; 19196 font-weight: 950; 19197 color: ${Vn}; 19198`,Kjt=p.div.withConfig({displayName:"CompetitorDeepDiveSlide__MetricsWrap",componentId:"sc-1xczwgh-6"})` 19199 display: flex; 19200 flex-direction: column; 19201 gap: 1.35rem; 19202 padding: 1.25rem 0; 19203 border-bottom: 1px solid ${po}; 19204`,Yjt=p.div.withConfig({displayName:"CompetitorDeepDiveSlide__MetricBlock",componentId:"sc-1xczwgh-7"})` 19205 display: flex; 19206 flex-direction: column; 19207 gap: 0.4rem; 19208`,Xjt=p.div.withConfig({displayName:"CompetitorDeepDiveSlide__MetricTop",componentId:"sc-1xczwgh-8"})` 19209 display: flex; 19210 align-items: baseline; 19211 justify-content: space-between; 19212`,Qjt=p.span.withConfig({displayName:"CompetitorDeepDiveSlide__MetricLabel",componentId:"sc-1xczwgh-9"})` 19213 font-size: 0.62rem; 19214 font-weight: 900; 19215 letter-spacing: 0.1em; 19216 text-transform: uppercase; 19217 color: ${fi}; 19218`,Zjt=p.div.withConfig({displayName:"CompetitorDeepDiveSlide__MetricRight",componentId:"sc-1xczwgh-10"})` 19219 display: flex; 19220 align-items: baseline; 19221 gap: 0.55rem; 19222`,Jjt=p.span.withConfig({displayName:"CompetitorDeepDiveSlide__MetricValue",componentId:"sc-1xczwgh-11"})` 19223 font-size: 1.3rem; 19224 font-weight: 950; 19225 color: ${Vn}; 19226`,e_t=p.span.withConfig({displayName:"CompetitorDeepDiveSlide__WinnerBadge",componentId:"sc-1xczwgh-12"})` 19227 font-size: 0.55rem; 19228 font-weight: 900; 19229 letter-spacing: 0.06em; 19230 text-transform: uppercase; 19231 color: #059669; 19232 background: #ecfdf5; 19233 padding: 0.2rem 0.55rem; 19234 border-radius: 4px; 19235 line-height: 1; 19236`,t_t=p.div.withConfig({displayName:"CompetitorDeepDiveSlide__BarTrack",componentId:"sc-1xczwgh-13"})` 19237 width: 100%; 19238 height: 7px; 19239 background: ${po}; 19240 border-radius: 4px; 19241 overflow: hidden; 19242`,n_t=p.div.withConfig({displayName:"CompetitorDeepDiveSlide__BarFill",componentId:"sc-1xczwgh-14"})` 19243 height: 100%; 19244 width: ${e=>e.$pct}%; 19245 border-radius: 4px; 19246 background: ${e=>e.$brand?mi:Nn}; 19247 transition: width 0.7s cubic-bezier(0.25,0.46,0.45,0.94); 19248 transition-delay: ${e=>e.$delay??0}s; 19249`,i_t=p.div.withConfig({displayName:"CompetitorDeepDiveSlide__PromptsSection",componentId:"sc-1xczwgh-15"})` 19250 margin-top: auto; 19251 padding-top: 1.25rem; 19252 height: 5.5rem; 19253 overflow: hidden; 19254`,r_t=p.div.withConfig({displayName:"CompetitorDeepDiveSlide__PromptsSectionLabel",componentId:"sc-1xczwgh-16"})` 19255 font-size: 0.62rem; 19256 font-weight: 900; 19257 letter-spacing: 0.1em; 19258 text-transform: uppercase; 19259 color: ${fi}; 19260 margin-bottom: 0.6rem; 19261`,wZ=p.div.withConfig({displayName:"CompetitorDeepDiveSlide__PromptItem",componentId:"sc-1xczwgh-17"})` 19262 display: flex; 19263 align-items: baseline; 19264 gap: 0.5rem; 19265 font-size: 0.78rem; 19266 color: ${Vn}; 19267 line-height: 1.65; 19268`,o_t=p.span.withConfig({displayName:"CompetitorDeepDiveSlide__PromptRank",componentId:"sc-1xczwgh-18"})` 19269 font-weight: 950; 19270 color: ${Vn}; 19271 flex-shrink: 0; 19272`,jZ=p.span.withConfig({displayName:"CompetitorDeepDiveSlide__PromptText",componentId:"sc-1xczwgh-19"})` 19273 font-weight: 600; 19274 overflow: hidden; 19275 text-overflow: ellipsis; 19276 white-space: nowrap; 19277 min-width: 0; 19278`;function s_t(e,n="%"){return e==null?"â":`${Math.round(e).toLocaleStr
19278ing()}${n}`}function a_t(e,n){return e==null||n==null?!1:e>n}function _Z({entity:e,opponent:n,isBrand:i,animate:r}){const o=[{label:"Visibility Score",key:"visibility",suffix:"%",max:100},{label:"Sentiment Score",key:"sentiment",suffix:"%",max:100},{label:"Total Mentions",key:"total_mentions",suffix:"",max:Math.max(e.total_mentions??0,n.total_mentions??0,1)}],s=i?{name:e.name,logo_url:e.logo_url,website:e.website}:{name:e.name,website:e.website};return t.jsxs(Ujt,{$isBrand:i,children:[t.jsxs(Gjt,{children:[t.jsx(xo,{record:s,size:36,forceLogoDev:!i}),t.jsx(Vjt,{children:e.name})]}),t.jsx(Kjt,{children:o.map((a,c)=>{const u=e[a.key],m=n[a.key],h=a_t(u,m),g=a.key==="total_mentions"?(u??0)/a.max*100:u??0;return t.jsxs(Yjt,{children:[t.jsxs(Xjt,{children:[t.jsx(Qjt,{children:a.label}),t.jsxs(Zjt,{children:[t.jsx(Jjt,{children:s_t(u,a.suffix)}),h&&t.jsx(e_t,{children:"Winner"})]})]}),t.jsx(t_t,{children:t.jsx(n_t,{$pct:r?Math.max(Math.min(g,100),2):0,$brand:i,$delay:c*.1})})]},a.key)})}),t.jsxs(i_t,{children:[t.jsx(r_t,{children:"Top Ranking Prompts"}),e.top_prompts.length>0?e.top_prompts.map((a,c)=>t.jsxs(wZ,{children:[t.jsxs(o_t,{style:i?{color:mi}:void 0,children:["#",c+1]}),t.jsxs(jZ,{children:['"',a.text,'"']})]},c)):t.jsx(wZ,{children:t.jsx(jZ,{style:{color:Nn},children:"No ranking data"})})]})]})}function l_t({data:e}){const[n,i]=l.useState(!1);l.useEffect(()=>{const a=requestAnimationFrame(()=>i(!0));return()=>cancelAnimationFrame(a)},[]);const r=e.sections.competitor_deep_dive;if(!r?.has_data)return t.jsx(Eo,{children:"No competitor comparison data available."});const o={name:r.brand.name,logo_url:r.brand.logo_url,website:e.project.website,visibility:r.brand.visibility,sentiment:r.brand.sentiment,total_mentions:r.brand.total_mentions,top_prompts:r.brand.top_prompts||[]},s={name:r.competitor.name,website:r.competitor.website,visibility:r.competitor.visibility,sentiment:r.competitor.sentiment,total_mentions:r.competitor.total_mentions,top_prompts:r.competitor.top_prompts||[]};return t.jsxs(Ou,{children:[t.jsx(Ho,{children:"Module 10"}),t.jsx(qo,{children:"Competitor Deep Dive"}),t.jsxs(Wjt,{children:[t.jsx(_Z,{entity:o,opponent:s,isBrand:!0,animate:n}),t.jsx(Hjt,{children:t.jsx(qjt,{children:"VS"})}),t.jsx(_Z,{entity:s,opponent:o,isBrand:!1,animate:n})]})]})}function c_t(){return{key:"competitor_deep_dive",label:"Competitor Deep Dive",icon:t.jsx(Fxe,{size:14}),sectionKey:"competitor_deep_dive",render:e=>t.jsx(l_t,{data:e})}}const d_t={visibility_score:t.jsx(Dc,{size:18}),total_citations:t.jsx(xu,{size:18}),sentiment_score:t.jsx(f5,{size:18}),brand_mentions:t.jsx(t_,{size:18})};function u_t(e,n,i){if(e==null||n==null)return null;const r=e-n;if(r===0)return null;const o=r>0,s=o?"â":"â",a=Math.abs(r);return{value:i==="pct"?`${s} ${a.toFixed(0)}%`:i==="score"?`${s} ${a.toFixed(0)}`:`${s} ${a.toLocaleString()}`,positive:o}}const p_t=p.div.withConfig({displayName:"PeriodComparisonSlide__Layout",componentId:"sc-1yt2vje-0"})` 19279 margin-top: 2.75rem; 19280`,m_t=p.div.withConfig({displayName:"PeriodComparisonSlide__HeaderRow",componentId:"sc-1yt2vje-1"})` 19281 display: grid; 19282 grid-template-columns: 1.4fr 1fr 40px 1fr 0.7fr; 19283 align-items: center; 19284 padding: 0 1rem 0.75rem; 19285 19286 @media (max-width: 768px) { 19287 grid-template-columns: 1.4fr 1fr 28px 1fr 0.7fr; 19288 padding: 0 0.5rem 0.5rem; 19289 } 19290`,pj=p.div.withConfig({displayName:"PeriodComparisonSlide__HeaderCell",componentId:"sc-1yt2vje-2"})` 19291 font-size: 0.65rem; 19292 font-weight: 900; 19293 letter-spacing: 0.12em; 19294 text-transform: uppercase; 19295 color: ${Nn}; 19296 text-align: ${e=>e.$align||"left"}; 19297`,h_t=p.div.withConfig({displayName:"PeriodComparisonSlide__MetricRow",componentId:"sc-1yt2vje-3"})` 19298 display: grid; 19299 grid-template-columns: 1.4fr 1fr 40px 1fr 0.7fr; 19300 align-items: center; 19301 padding: 1rem; 19302 background: ${Oi}; 19303 border: 1px solid ${po}; 19304 border-radius: 0.75rem; 19305 margin-top: 0.6rem; 19306 transition: box-shadow 0.15s; 19307 19308 &:hover { 19309 box-shadow: 0 2px 8px rgba(0,0,0,0.04); 19310 } 19311 19312 @media (max-width: 768px) { 19313 grid-template-columns: 1.4fr 1fr 28px 1fr 0.7fr; 19314 padding: 0.75rem 0.5rem; 19315 margin-top: 0.4rem; 19316 } 19317`,f_t=p.div.withConfig({displayName:"PeriodComparisonSlide__MetricName",componentId:"sc-1yt2vje-4"})` 19318 display: flex; 19319 align-items: center; 19320 gap: 0.75rem; 19321 font-size: 0.95rem; 19322 font-weight: 700; 19323 color: ${Vn}; 19324 19325 @media (max-width: 768px) { 19326 font-size: 0.82rem; 19327 gap: 0.5rem; 19328 } 19329`,g_t=p.div.withConfig({displayName:"PeriodComparisonSlide__IconWrap",componentId:"sc-1yt2vje-5"})` 19330 width: 2rem; 19331 height: 2rem; 19332 border-radius: 0.45rem; 19333 display: flex; 19334 align-items: center; 19335 justify-content: center; 19336 background: ${R1}; 19337 color: ${fi}; 19338 flex-shrink: 0; 19339 19340 @media (max-width: 768px) { 19341 width: 1.6rem; 19342 height: 1.6rem; 19343 border-radius: 0.35rem; 19344 & svg { width: 14px; height: 14px; } 19345 } 19346`,y_t=p.div.withConfig({displayName:"PeriodComparisonSlide__PrevValue",componentId:"sc-1yt2vje-6"})` 19347 font-size: 1.35rem; 19348 font-weight: 500; 19349 color: ${Nn}; 19350 text-align: center; 19351 font-style: italic; 19352 19353 @media (max-width: 768px) { 19354 font-size: 1rem; 19355 } 19356`,x_t=p.div.withConfig({displayName:"PeriodComparisonSlide__Arrow",componentId:"sc-1yt2vje-7"})` 19357 text-align: center; 19358 color: ${Nn}; 19359 font-size: 0.85rem; 19360 font-weight: 400; 19361`,b_t=p.div.withConfig({displayName:"PeriodComparisonSlide__CurrValue",componentId:"sc-1yt2vje-8"})` 19362 font-size: 1.6rem; 19363 font-weight: 900; 19364 color: ${Vn}; 19365 text-align: center; 19366 19367 @media (max-width: 768px) { 19368 font-size: 1.15rem; 19369 } 19370`,v_t=p.div.withConfig({displayName:"PeriodComparisonSlide__ChangeBadge",componentId:"sc-1yt2vje-9"})` 19371 display: inline-flex; 19372 align-items: center; 19373 justify-content: center; 19374 padding: 0.3rem 0.75rem; 19375 border-radius: 999px; 19376 font-size: 0.78rem; 19377 font-weight: 800; 19378 background: ${e=>e.$positive?"#ecfdf5":"#fef2f2"}; 19379 color: ${e=>e.$positive?"#059669":"#dc2626"}; 19380 justify-self: end; 19381 19382 @media (max-width: 768px) { 19383 font-size: 0.68rem; 19384 padding: 0.2rem 0.5rem; 19385 } 19386`,w_t=p.div.withConfig({displayName:"PeriodComparisonSlide__EmptyBadge",componentId:"sc-1yt2vje-10"})` 19387 justify-self: end; 19388 font-size: 0.75rem; 19389 color: ${Nn}; 19390`;function CZ({value:e,format:n}){const i=sD(e!=null?Math.round(e):0);return e==null?t.jsx(t.Fragment,{children:"â"}):n==="pct"?t.jsxs(t.Fragment,{children:[i,"%"]}):n==="score"?t.jsx(t.Fragment,{children:i}
19390):t.jsx(t.Fragment,{children:i.toLocaleString()})}function j_t({data:e}){const n=e.sections.period_comparison;if(!n)return t.jsx(Eo,{children:"No period comparison data available."});const i=n.metrics||[],r=n.previous_label||"Previous",o=n.current_label||"Current";return i.length===0?t.jsx(Eo,{children:"No period comparison data available."}):t.jsxs(Ou,{children:[t.jsx(Ho,{children:"MODULE 11"}),t.jsx(qo,{children:"Period Comparison"}),t.jsxs(p_t,{children:[t.jsxs(m_t,{children:[t.jsx(pj,{children:"METRIC"}),t.jsx(pj,{$align:"center",children:r.toUpperCase()}),t.jsx(pj,{}),t.jsx(pj,{$align:"center",children:o.toUpperCase()}),t.jsx(pj,{$align:"right",children:"CHANGE"})]}),i.map(s=>{const a=u_t(s.current,s.previous,s.format);return t.jsxs(h_t,{children:[t.jsxs(f_t,{children:[t.jsx(g_t,{children:d_t[s.key]||t.jsx(Eu,{size:18})}),s.label]}),t.jsx(y_t,{children:t.jsx(CZ,{value:s.previous,format:s.format})}),t.jsx(x_t,{children:"â"}),t.jsx(b_t,{children:t.jsx(CZ,{value:s.current,format:s.format})}),a?t.jsx(v_t,{$positive:a.positive,children:a.value}):t.jsx(w_t,{children:"â"})]},s.key)})]})]})}function __t(){return{key:"period-comparison",label:"Period Comparison",icon:t.jsx(Eu,{size:16}),sectionKey:"period_comparison",render:e=>t.jsx(j_t,{data:e})}}const Tue="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20156.38%2071.69'%3e%3cg%20data-name='Layer%202'%3e%3cpath%20d='M10.06%2063.86a9.77%209.77%200%200%201-5.24-1.4%209.83%209.83%200%200%201-3.54-3.78%2012%2012%200%200%201%200-10.8%209.65%209.65%200%200%201%203.54-3.74%209.85%209.85%200%200%201%205.24-1.38%209.34%209.34%200%200%201%203.54.68%2010%2010%200%200%201%202.94%201.83%207.51%207.51%200%200%201%201.92%202.65l-2.56%201.32a6.32%206.32%200%200%200-5.84-3.65%206.72%206.72%200%200%200-3.6%201%207%207%200%200%200-2.52%202.75%208.38%208.38%200%200%200-.93%204%208.27%208.27%200%200%200%20.93%203.94A7.07%207.07%200%200%200%206.46%2060a6.57%206.57%200%200%200%203.6%201%206.19%206.19%200%200%200%203.52-1%206.44%206.44%200%200%200%202.32-2.7l2.56%201.4a7.72%207.72%200%200%201-1.92%202.63%209.83%209.83%200%200%201-2.94%201.85%209.34%209.34%200%200%201-3.54.68Zm21.2%200a9.66%209.66%200%200%201-5.1-1.38%209.85%209.85%200%200%201-3.6-3.78%2012%2012%200%200%201%200-10.87A9.74%209.74%200%200%201%2026%2044.12a9.21%209.21%200%200%201%205-1.36%209%209%200%200%201%203.9.81%208.74%208.74%200%200%201%202.92%202.19%209.77%209.77%200%200%201%201.85%203.08%2010%2010%200%200%201%20.64%203.53v.84c0%20.31-.06.64-.11%201H23.05v-2.67H38.5l-1.36%201.13a6%206%200%200%200-.47-3.67%206.28%206.28%200%200%200-2.32-2.6%206.15%206.15%200%200%200-3.39-1%206.5%206.5%200%200%200-3.48%201A6.77%206.77%200%200%200%2025%2049.11a7.61%207.61%200%200%200-.71%204.16%207.44%207.44%200%200%200%20.77%204.2%206.91%206.91%200%200%200%202.64%202.77%207%207%200%200%200%203.59%201%206.34%206.34%200%200%200%203.73-1%208.58%208.58%200%200%200%202.45-2.64l2.41%201.28A7.55%207.55%200%200%201%2038%2061.31a9.58%209.58%200%200%201-3%201.85%2010%2010%200%200%201-3.74.7Zm12.19%207.83a8.69%208.69%200%200%201-1.23-.09%205.94%205.94%200%200%201-1.22-.32v-2.64l1%20.13a6.67%206.67%200%200%200%201.19.1A4.49%204.49%200%200%200%2046%2068.1a7.71%207.71%200%200%200%201.92-3l1.28-3-.07%202.49-8.55-21.4h3.02l7%2017.67h-.8l7-17.67h3.13L50.68%2066a14.16%2014.16%200%200%201-1.52%202.78%207.27%207.27%200%200%201-2.32%202.13%206.65%206.65%200%200%201-3.39.78Zm27.02-7.83a10%2010%200%200%201-5.19-1.38%2010.12%2010.12%200%200%201-3.72-3.77%2010.75%2010.75%200%200%201-1.37-5.44%2010.63%2010.63%200%200%201%201.36-5.39%2010%2010%200%200%201%208.92-5.12%2010.16%2010.16%200%200%201%205.26%201.36%209.76%209.76%200%200%201%203.65%203.73%2011.56%2011.56%200%200%201%200%2010.9%2010.19%2010.19%200%200%201-3.71%203.75%2010%2010%200%200%201-5.2%201.36Zm0-2.83a6.84%206.84%200%200%200%203.68-1%207.26%207.26%200%200%200%202.6-2.78%208.17%208.17%200%200%200%201-4%208%208%200%200%200-1-3.92%207.47%207.47%200%200%200-2.6-2.75%207.19%207.19%200%200%200-7.35%200%207.69%207.69%200%200%200-2.62%202.75%207.86%207.86%200%200%200-1%203.92%208.07%208.07%200%200%200%201%204A7.46%207.46%200%200%200%2066.8%2060a6.81%206.81%200%200%200%203.67%201ZM135%2032.08a10.7%2010.7%200%200%201-10.7%2010.7%2010.69%2010.69%200%200%200-10.69%2010.69%2010.7%2010.7%200%201%201-10.7-10.69%2010.7%2010.7%200%201%200%200-21.39%2010.7%2010.7%200%201%201%2010.7-10.69%2010.7%2010.7%200%200%200%2010.69%2010.69A10.7%2010.7%200%200%201%20135%2032.08Zm21.38%2021.39a10.69%2010.69%200%201%201-10.69-10.69%2010.69%2010.69%200%200%201%2010.69%2010.69Z'%20data-name='Layer%201'/%3e%3c/g%3e%3c/svg%3e",SZ=p.div.withConfig({displayName:"ClosingSlide__Shell",componentId:"sc-11or6ed-0"})` 19391 position: relative; 19392 display: flex; 19393 flex-direction: column; 19394 align-items: center; 19395 justify-content: center; 19396 min-height: 100%; 19397 text-align: center; 19398 background: ${Oi}; 19399 overflow: hidden; 19400`,kZ=p.div.withConfig({displayName:"ClosingSlide__Glow",componentId:"sc-11or6ed-1"})` 19401 position: absolute; 19402 width: 520px; 19403 height: 520px; 19404 border-radius: 50%; 19405 background: radial-gradient(circle, ${R1} 0%, transparent 70%); 19406 top: 50%; 19407 left: 50%; 19408 transform: translate(-50%, -50%); 19409 pointer-events: none; 19410`,$Z=p.div.withConfig({displayName:"ClosingSlide__Content",componentId:"sc-11or6ed-2"})` 19411 position: relative; 19412 z-index: 1; 19413 display: flex; 19414 flex-direction: column; 19415 align-items: center; 19416 gap: 0; 19417`,IZ=p.img.withConfig({displayName:"ClosingSlide__Logo",componentId:"sc-11or6ed-3"})` 19418 height: 6rem; 19419 margin-bottom: 2.5rem; 19420 19421 @media (max-width: 768px) { 19422 height: 4.25rem; 19423 margin-bottom: 2rem; 19424 } 19425`,PZ=p.h2.withConfig({displayName:"ClosingSlide__Heading",componentId:"sc-11or6ed-4"})` 19426 font-size: 3.25rem; 19427 font-weight: 950; 19428 letter-spacing: -0.02em; 19429 line-height: 1.15; 19430 color: ${Vn}; 19431 margin: 0 0 1.15rem; 19432 19433 @media (max-width: 768px) { 19434 font-size: 2.25rem; 19435 } 19436`,AZ=p.p.withConfig({displayName:"ClosingSlide__Sub",componentId:"sc-11or6ed-5"})` 19437 font-size: 1.2rem; 19438 font-weight: 500; 19439 color: ${fi}; 19440 margin: 0; 19441 line-height: 1.5; 19442 19443 @media (max-width: 768px) { 19444 font-size: 1rem; 19445 }
19446`,C_t=p.span.withConfig({displayName:"ClosingSlide__ThankYouAccent",componentId:"sc-11or6ed-6"})` 19447 color: ${mi}; 19448`,S_t=p.p.withConfig({displayName:"ClosingSlide__ThankYouSub",componentId:"sc-11or6ed-7"})` 19449 font-size: 1rem; 19450 font-weight: 500; 19451 color: ${Nn}; 19452 margin: 1.5rem 0 0; 19453 line-height: 1.5; 19454`;function k_t({data:e}){if(e.white_label){const n=e.project.organization_logo_url,i=e.project.organization_name||e.project.name;return t.jsxs(SZ,{children:[t.jsx(kZ,{}),t.jsxs($Z,{children:[n&&t.jsx(IZ,{src:n,alt:i}),t.jsxs(PZ,{children:["Thank you",t.jsx(C_t,{children:"."})]}),t.jsxs(AZ,{children:["Prepared by ",i]}),t.jsx(S_t,{children:e.selected_month_label||new Intl.DateTimeFormat(void 0,{month:"long",year:"numeric"}).format(new Date)})]})]})}return t.jsxs(SZ,{children:[t.jsx(kZ,{}),t.jsxs($Z,{children:[t.jsx(IZ,{src:Tue,alt:"Ceyo"}),t.jsxs(PZ,{children:["Ready to dominate",t.jsx("br",{}),"AI search?"]}),t.jsx(AZ,{children:"Get your full audit at ceyo.ai"})]})]})}function $_t(){return{key:"closing",label:"Closing",icon:t.jsx(Tye,{size:16}),fullBleed:!0,render:e=>t.jsx(k_t,{data:e})}}const C4=p.div.withConfig({displayName:"ReportViewer__Shell",componentId:"sc-har0j7-0"})` 19455 display: flex; 19456 flex-direction: column; 19457 height: 100vh; 19458 width: 100vw; 19459 overflow: hidden; 19460 background: ${Oi}; 19461 color-scheme: light; 19462 position: fixed; 19463 inset: 0; 19464 z-index: 9999; 19465`,S4=p.header.withConfig({displayName:"ReportViewer__TopBar",componentId:"sc-har0j7-1"})` 19466 flex-shrink: 0; 19467 display: flex; 19468 align-items: center; 19469 justify-content: space-between; 19470 padding: 0.65rem 1.5rem; 19471 border-bottom: 1px solid ${zi}; 19472 background: ${Oi}; 19473 z-index: 10; 19474`,k4=p.div.withConfig({displayName:"ReportViewer__TopBarLeft",componentId:"sc-har0j7-2"})` 19475 display: flex; 19476 align-items: center; 19477 gap: 1rem; 19478 min-width: 0; 19479`,$4=p.div.withConfig({displayName:"ReportViewer__TopBarRight",componentId:"sc-har0j7-3"})` 19480 display: flex; 19481 align-items: center; 19482 gap: 0.5rem; 19483 flex-shrink: 0; 19484`,I4=p.button.withConfig({displayName:"ReportViewer__ExitBtn",componentId:"sc-har0j7-4"})` 19485 display: inline-flex; 19486 align-items: center; 19487 gap: 0.35rem; 19488 padding: 0.4rem 0.85rem; 19489 border-radius: 0.5rem; 19490 font-size: 0.78rem; 19491 font-weight: 800; 19492 color: ${fi}; 19493 background: ${Oi}; 19494 border: 1px solid ${zi}; 19495 cursor: pointer; 19496 &:hover { background: #f9fafb; } 19497`,I_t=p.span.withConfig({displayName:"ReportViewer__ReportTitle",componentId:"sc-har0j7-5"})` 19498 font-size: 0.85rem; 19499 font-weight: 850; 19500 color: ${Vn}; 19501 white-space: nowrap; 19502 overflow: hidden; 19503 text-overflow: ellipsis; 19504 max-width: 300px; 19505`,P_t=p.span.withConfig({displayName:"ReportViewer__SlideCounter",componentId:"sc-har0j7-6"})` 19506 font-size: 0.78rem; 19507 font-weight: 800; 19508 color: ${Nn}; 19509 font-variant-numeric: tabular-nums; 19510`,P4=p.button.withConfig({displayName:"ReportViewer__IconBtn",componentId:"sc-har0j7-7"})` 19511 display: inline-flex; 19512 align-items: center; 19513 justify-content: center; 19514 width: 32px; 19515 height: 32px; 19516 border-radius: 0.5rem; 19517 border: 1px solid ${zi}; 19518 background: ${e=>e.$active?mi:Oi}; 19519 color: ${e=>e.$active?"#fff":fi}; 19520 cursor: pointer; 19521 &:disabled { opacity: 0.35; cursor: default; } 19522 &:hover:not(:disabled) { background: ${e=>e.$active?mi:"#f9fafb"}; } 19523`,A_t=p.div.withConfig({displayName:"ReportViewer__ProgressBar",componentId:"sc-har0j7-8"})` 19524 height: 3px; 19525 background: ${zi}; 19526 flex-shrink: 0; 19527 position: relative; 19528`,N_t=p.div.withConfig({displayName:"ReportViewer__ProgressFill",componentId:"sc-har0j7-9"})` 19529 height: 100%; 19530 background: ${mi}; 19531 width: ${e=>e.$pct}%; 19532 transition: width 0.4s ease; 19533`,z_t=Tn` 19534 from { width: 0%; } 19535 to { width: 100%; } 19536`,T_t=p.div.withConfig({displayName:"ReportViewer__AutoplayFill",componentId:"sc-har0j7-10"})` 19537 position: absolute; 19538 top: 0; 19539 left: 0; 19540 height: 100%; 19541 background: ${mi}; 19542 opacity: 0.45; 19543 animation: ${z_t} ${e=>e.$duration}ms linear; 19544 animation-play-state: ${e=>e.$running?"running":"paused"}; 19545 animation-fill-mode: forwards; 19546`,E_t=p.div.withConfig({displayName:"ReportViewer__SlideArea",componentId:"sc-har0j7-11"})` 19547 flex: 1; 19548 overflow-y: auto; 19549 padding: 2rem 3.5rem 1rem; 19550 background-image: 19551 radial-gradient(circle, #c5c9d0 0.6px, transparent 0.6px), 19552 radial-gradient(circle, #c5c9d0 0.6px, transparent 0.6px); 19553 background-size: 20px 20px; 19554 background-position: 0 0, 10px 10px; 19555 @media (max-width: 1024px) { padding: 1.5rem 2rem; } 19556 @media (max-width: 768px) { padding: 1.25rem 1rem; } 19557`,M_t=p.div.withConfig({displayName:"ReportViewer__SlideInner",componentId:"sc-har0j7-12"})` 19558 max-width: 1100px; 19559 margin: 0 auto; 19560`,R_t=p.footer.withConfig({displayName:"ReportViewer__FooterBar",componentId:"sc-har0j7-13"})` 19561 flex-shrink: 0; 19562 display: flex; 19563 align-items: center; 19564 justify-content: space-between; 19565 padding: 0.85rem 2rem; 19566 background: ${e=>e.$bg||"#111827"}; 19567`,O_t=p.div.withConfig({displayName:"ReportViewer__FooterLeft",componentId:"sc-har0j7-14"})` 19568 display: flex; 19569 align-items: center; 19570 gap: 0.75rem; 19571`,D_t=p.div.withConfig({displayName:"ReportViewer__FooterRight",componentId:"sc-har0j7-15"})` 19572 display: flex; 19573 align-items: center; 19574 gap: 1rem; 19575`,NZ=p.span.withConfig({displayName:"ReportViewer__FooterPowered",componentId:"sc-har0j7-16"})` 19576 font-size: 0.65rem; 19577 font-weight: 800; 19578 letter-spacing: 0.14em; 19579 text-transform: uppercase; 19580 color: rgba(255, 255, 255, 0.45); 19581`,L_t=p.span.withConfig({displayName:"ReportViewer__FooterPage",componentId:"sc-har0j7-17"})` 19582 font-size: 0.78rem; 19583 font-weight: 800; 19584 color: rgba(255, 255, 255, 0.5); 19585 font-variant-numeric: tabular-nums; 19586`,B_t=Tn`from { transform: rotate(0deg); } to { transform: rotate(360deg); }`,F_t=p.div.withConfig({displayName:"ReportViewer__SpinnerWrap",componentId:"sc-har0j7-18"})` 19587 flex: 1; 19588 display: flex; 19589 align-items: center; 19590 justify-content: center; 19591 color: ${Nn}; 19592 & > svg { animation: ${B_t} 1s linear infinite; } 19593`,zZ=p.div.withConfig({displayName:"ReportViewer__EmptyState",componentId:"sc-har0j7-19"})` 19594 display: flex; 19595 align-items: center; 19596 justify-content: center; 19597 min-height: 200px; 19598 font-size: 1rem; 19599 font-weight: 700; 19600 color: ${Nn}; 19601 text-align: center; 19602 padding: 2rem; 19603`;function W_t(){return[nvt(),pvt(),kvt(),Lvt(),swt(),Swt(),Vwt(),ujt(),Cjt(),Fjt(),c_t(),__t(),$_t()]}const TZ=8e3;function Eue({data:e,loading:n,error:i,footerColor:r,onExit:o,topBarExtra:s}){const[a,c]=yr(),[u,m]=l.useState(!1),h=l.useRef(null),x=l.useMemo(()=>W_t(),[]),y=l.useMemo(()=>{const I=parseInt(a.get("slide")||"",10);return Number.isFinite(I)?Math.max(0,Math.min(I-1,x.length-1)):0},[]),[w,j]=l.useState(y),v=l.useCallback(I=>{const A=Math.max(0,Math.min(I,x.length-1));j(A),c(E=>{const B=new URLSearchParams(E);return B.set("slide",String(A+1)),B},{replace:!0})},[x.length,c]),_=l.useCallback(()=>v(w+1),[v,w]),$=l.useCallback(()=>v(w-1),[v,w]);l.useEffect(()=>{function I(A){(A.key==="ArrowRight"||A.key===" ")&&(A.preventDefault(),_()),A.key==="ArrowLeft"&&(A.preventDefault(),$()),A.key==="Escape"&&o&&o()}return window.addEventListener("keydown",I),()=>window.removeEventListener("keydown",I)},[_,$,o]),l.useEffect(()=>{if(h.current&&clearInterval(h.current),!!u)return h.current=window.setInterval(()=>{j(I=>{const A=I+1>=x.length?0:I+1;return c(E=>{const B=new URLSearchParams(E);return B.set("slide",String(A+1)),B},{replace:!0}),A})},TZ),()=>{h.current&&clearInterval(h.current)}},[u,x.length,c]);const k=x.length>1?(w+1)/x.length*100:100;if(n)return t.jsxs(C4,{children:[t.jsxs(S4,{children:[t.jsx(k4,{children:o&&t.jsxs(I4,{onClick:o,children:[t.jsx(Ei,{size:14})," Exit"]})}),t.jsx($4,{})]}),t.jsx(F_t,{children:t.jsx(Tr,{size:32})})]});if(i||!e)return t.jsxs(C4,{children:[t.jsxs(S4,{children:[t.jsx(k4,{children:o&&t.jsxs(I4,{onClick:o,children:[t.jsx(Ei,{size:14})," Exit"]})}),t.jsx($4,{})]}),t.jsx(zZ,{style:{flex:1,justifyContent:"center"},children:i||"Failed to load report data."})]});const P=x[w],S=e.white_label&&r||void 0;return t.jsxs(C4,{children:[t.jsxs(S4,{children:[t.jsxs(k4,{children:[o&&t.jsxs(I4,{onClick:o,children:[t.jsx(Ei,{size:14})," Exit"]}),t.jsx(By,{logoUrl:e.project.logo_url,size:24}),t.jsxs(I_t,{children:[e.project.name," â Report"]})]}),t.jsxs($4,{children:[s,t.jsxs(P_t,{children:[w+1," / ",x.length]}),t.jsx(P4,{onClick:$,disabled:w<=0,title:"Previous slide",children:t.jsx(Bd,{size:16})}),t.jsx(P4,{onClick:_,disabled:w>=x.length-1,title:"Next slide",children:t.jsx(Gi,{size:16})}),t.jsx(P4,{$active:u,onClick:()=>m(I=>!I),title:u?"Pause autoplay":"Start autoplay",children:u?t.jsx(Fne,{size:14}):t.jsx(eh,{size:14})})]})]}),t.jsxs(A_t,{children:[t.jsx(N_t,{$pct:k}),u&&t.jsx(T_t,{$duration:TZ,$running:u},`ap-${w}`)]}),P?.fullBleed?t.jsx("div",{style:{flex:1,minHeight:0,overflowY:"auto",display:"flex",flexDirection:"column"},children:t.jsx("div",{style:{flex:1},children:P.render(e)})},P.key):t.jsx(E_t,{children:t.jsx(M_t,{children:P?P.render(e):t.jsx(zZ,{children:"No slide content."})})},P?.key),t.jsxs(R_t,{$bg:S,children:[t.jsx(O_t,{children:e.white_label?t.jsxs(t.Fragment,{children:[t.jsxs(NZ,{children:["Powered by ",e.project.organization_name||"Your Agency"]}),e.project.organization_logo_url&&t.jsx("img",{src:e.project.organization_logo_url,alt:e.project.organization_name||"",height:22,style:{display:"block",borderRadius:4}})]}):t.jsxs(t.Fragment,{children:[t.jsx(NZ,{children:"Powered by Ceyo"}),t.jsx("img",{src:$ue,alt:"Ceyo",height:22,style:{display:"block"}})]})}),t.jsx(D_t,{children:t.jsx(L_t,{children:String(w+1).padStart(2,"0")})})]})]})}const U_t=p.div.withConfig({displayName:"ProjectReportPage__SharePopoverWrap",componentId:"sc-p0w79i-0"})` 19604 position: relative; 19605`,H_t=p.div.withConfig({displayName:"ProjectReportPage__TopBarActions",componentId:"sc-p0w79i-1"})` 19606 display: inline-flex; 19607 align-items: center; 19608 gap: 0.5rem; 19609`,EZ=p.button.withConfig({displayName:"ProjectReportPage__ReportActionButton",componentId:"sc-p0w79i-2"})` 19610 display: inline-flex; 19611 align-items: center; 19612 justify-content: center; 19613 width: 32px; 19614 height: 32px; 19615 border-radius: 0.5rem; 19616 border: 1px solid ${zi}; 19617 background: ${Oi}; 19618 color: ${fi}; 19619 cursor: pointer; 19620 &:hover { background: #f3f4f6; } 19621 &:disabled { opacity: 0.5; cursor: default; } 19622`,q_t=Tn` 19623 to { transform: rotate(360deg); } 19624`,G_t=p(Tr).withConfig({displayName:"ProjectReportPage__SpinningLoader",componentId:"sc-p0w79i-3"})` 19625 animation: ${q_t} 0.8s linear infinite; 19626`,V_t=p.div.withConfig({displayName:"ProjectReportPage__Popover",componentId:"sc-p0w79i-4"})` 19627 position: fixed; 19628 top: 50%; 19629 left: 50%; 19630 transform: translate(-50%, -50%); 19631 z-index: 100; 19632 width: min(420px, calc(100vw - 2rem)); 19633 max-height: 80vh; 19634 overflow-y: auto; 19635 padding: 0.75rem 1rem; 19636 background: #ffffff; 19637 border: 1px solid #e5e7eb; 19638 border-radius: 0.75rem; 19639 box-shadow: 0 12px 40px rgba(0,0,0,0.12); 19640 19641 --color-white: #ffffff; 19642 --color-gray-900: #111827; 19643 --color-gray-500: #6b7280; 19644 --color-gray-400: #9ca3af; 19645 --color-gray-200: #e5e7eb; 19646 --color-gray-100: #f3f4f6; 19647 --color-brand-50: #eef2ff; 19648 --color-brand-600: #4F46E5; 19649 --color-brand-700: #4338CA; 19650 --color-brand-800: #3730A3; 19651`,K_t=p.div.withConfig({displayName:"ProjectReportPage__PopoverBackdrop",componentId:"sc-p0w79i-5"})` 19652 position: fixed; 19653 inset: 0; 19654 z-index: 99; 19655 background: rgba(0, 0, 0, 0.15); 19656`;function Y_t(){const{workspaceId:e,projectId:n}=Gn(),i=zn(),[r]=yr(),{user:o}=yn(),[s,a]=l.useState(null),[c,u]=l.useState(!0),[m,h]=l.useState(null),[g,x]=l.useState(!1),[y,w]=l.useState(!1),{showToast:j}=Uo(),v=r.get("white_label"),_=r.get("footer_color"),$=r.get("month"),k=l.useMemo(()=>{const M=Number(e);return o?.organizations?.find(R=>R.id===M)||null},[o,e]),P=k?.role||null;l.useEffect(()=>{const M=Number(e),R=Number(n);if(!M||!R)return;let F=!1;return u(!0),h(null),(async()=>{try{const Y=new URLSearchParams;v==="1"&&Y.set("white_label","1"),$&&Y.set("month",$);const H=Y.toString()?`?${Y.toString()}`:"",U=await ue(`/api/v1/organizations/${M}/projects/${R}
19656/report${H}`),X=await U.json().catch(()=>({}));if(!U.ok)throw new Error(X?.error||"Failed to load report");if(F)return;a(X)}catch(Y){if(F)return;h(Y?.message||"Failed to load report")}finally{F||u(!1)}})(),()=>{F=!0}},[e,n,v,$]);const S=l.useCallback(()=>i(`/workspaces/${e}/projects/${n}`),[i,e,n]),I=P==="owner"||P==="editor",A=P==="owner",E=!!k?.report_white_label,B=l.useCallback(async()=>{const M=Number(e),R=Number(n);if(!(!M||!R||!s||y)){w(!0);try{const F=new URLSearchParams;v==="1"&&F.set("white_label","1"),$&&F.set("month",$),_&&F.set("footer_color",_);const Y=F.toString()?`?${F.toString()}`:"",H=await ue(`/api/v1/organizations/${M}/projects/${R}/report/pdf${Y}`);if(!H.ok){const oe=await H.json().catch(()=>({}));throw new Error(oe?.error||"Failed to generate report PDF")}const U=await H.blob(),X=URL.createObjectURL(U),Q=s.project.name.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||"project",[K,G,L]=(s.selected_month||"").split("-"),q=K&&G&&L?`-${L}-${G}-${K}`:"",W=document.createElement("a");W.href=X,W.download=`${Q}-visibility-report${q}.pdf`,document.body.appendChild(W),W.click(),W.remove(),window.setTimeout(()=>URL.revokeObjectURL(X),1e3),j("Report PDF downloaded.",{tone:"success"})}catch(F){const Y=F instanceof Error?F.message:"Failed to generate report PDF";j(Y,{tone:"error"})}finally{w(!1)}}},[s,y,_,$,n,j,v,e]),T=t.jsxs(H_t,{children:[t.jsx(EZ,{onClick:B,disabled:y||c||!s,title:y?"Generating report PDFâ¦":"Download report PDF","aria-label":y?"Generating report PDF":"Download report PDF","aria-busy":y,children:y?t.jsx(G_t,{size:15}):t.jsx(wy,{size:15})}),I&&t.jsxs(U_t,{children:[t.jsx(EZ,{onClick:()=>x(M=>!M),title:"Share report",children:t.jsx(Z8,{size:15})}),g&&t.jsxs(t.Fragment,{children:[t.jsx(K_t,{onClick:()=>x(!1)}),t.jsx(V_t,{children:t.jsx(PP,{workspaceId:String(e),projectId:String(n),whiteLabelEnabled:E,isOwner:A,orgLogoUrl:k?.logo_url,defaultMonth:$||void 0,collapsible:!1})})]})]})]});return t.jsx(Eue,{data:s,loading:c,error:m,footerColor:_?decodeURIComponent(_):void 0,onExit:S,topBarExtra:T})}function X_t(){const{token:e}=Gn(),[n,i]=l.useState(null),[r,o]=l.useState(!0),[s,a]=l.useState(null),[c,u]=l.useState();return l.useEffect(()=>{if(!e)return;let m=!1;return o(!0),a(null),(async()=>{try{const h=Td(),g=await fetch(`${h}/api/v1/shared_reports/${e}`),x=await g.json().catch(()=>({}));if(!g.ok)throw new Error(x?.error||"This report link has expired or been revoked.");if(m)return;x.footer_color&&u(x.footer_color),i(x)}catch(h){if(m)return;a(h?.message||"This report link has expired or been revoked.")}finally{m||o(!1)}})(),()=>{m=!0}},[e]),t.jsx(Eue,{data:n,loading:r,error:s,footerColor:c})}function H_(e){return e==null?"#9ca3af":e>=75?"#10b981":e>=50?"#f59e0b":"#ef4444"}function MZ(e){return e==null?"â":String(Math.round(e))}function lD(e){return e==null?"â":`${Math.round(e)}%`}function uf(e){return e==="high"?"#ef4444":e==="medium"?"#f97316":"#ca8a04"}function Mue(e){return e==="high"?"#fef2f2":e==="medium"?"#fff7ed":"#fefce8"}const cD={performance:"Performance",crawlability:"Crawlability",security:"Security",structured_data:"Structured Data",content_quality:"Content Quality",content_structure:"Structure",meta_onpage:"Meta & On-Page",aeo_readiness:"AEO Readiness"},Q_t={performance:"#d97706",crawlability:"#2563eb",security:"#dc2626",structured_data:"#7c3aed",content_quality:"#059669",content_structure:"#4338ca",meta_onpage:"#db2777",aeo_readiness:"#ca8a04"},Z_t=p.div.withConfig({displayName:"SiteAuditCoverSlide__Shell",componentId:"sc-1rrv7i6-0"})` 19657 position: relative; 19658 display: flex; 19659 flex-direction: column; 19660 min-height: 100%; 19661 overflow: hidden; 19662 background: ${Oi}; 19663`,J_t=p.div.withConfig({displayName:"SiteAuditCoverSlide__GradientBlob",componentId:"sc-1rrv7i6-1"})` 19664 position: absolute; 19665 top: -10%; 19666 right: -8%; 19667 width: 55%; 19668 height: 110%; 19669 background: radial-gradient(ellipse at 60% 40%, rgba(99, 179, 237, 0.28) 0%, rgba(79, 70, 229, 0.14) 35%, rgba(196, 220, 255, 0.07) 60%, transparent 80%); 19670 filter: blur(40px); 19671 pointer-events: none; 19672`,eCt=p.div.withConfig({displayName:"SiteAuditCoverSlide__CoverContent",componentId:"sc-1rrv7i6-2"})` 19673 flex: 1; 19674 display: flex; 19675 flex-direction: column; 19676 justify-content: center; 19677 padding: 4rem 5rem 4rem 8rem; 19678 position: relative; 19679 z-index: 1; 19680 @media (max-width: 1024px) { padding: 3rem 4rem; } 19681 @media (max-width: 768px) { padding: 2.5rem 1.5rem; } 19682`,tCt=p.span.withConfig({displayName:"SiteAuditCoverSlide__Badge",componentId:"sc-1rrv7i6-3"})` 19683 display: inline-flex; 19684 align-items: center; 19685 gap: 0.5rem; 19686 font-size: 0.72rem; 19687 font-weight: 800; 19688 letter-spacing: 0.14em; 19689 text-transform: uppercase; 19690 color: ${Iue}; 19691 background: rgba(238, 242, 255, 0.7); 19692 padding: 0.45rem 0.95rem; 19693 border-radius: 999px; 19694 border: 1px solid ${zi}; 19695 width: fit-content; 19696 margin-bottom: 2rem; 19697`,nCt=p.span.withConfig({displayName:"SiteAuditCoverSlide__BadgeDot",componentId:"sc-1rrv7i6-4"})` 19698 width: 7px; 19699 height: 7px; 19700 border-radius: 50%; 19701 background: ${mi}; 19702`,iCt=p.h1.withConfig({displayName:"SiteAuditCoverSlide__Heading",componentId:"sc-1rrv7i6-5"})` 19703 font-size: 4.75rem; 19704 font-weight: 950; 19705 line-height: 1.0; 19706 letter-spacing: -0.02em; 19707 margin: 0 0 1.75rem; 19708 color: ${Vn}; 19709 word-break: break-word; 19710 @media (max-width: 1024px) { font-size: 3.5rem; } 19711 @media (max-width: 768px) { font-size: 2.5rem; } 19712`,rCt=p.span.withConfig({displayName:"SiteAuditCoverSlide__HeadingAccent",componentId:"sc-1rrv7i6-6"})` 19713 color: ${mi}; 19714`,oCt=p.div.withConfig({displayName:"SiteAuditCoverSlide__ProjectRow",componentId:"sc-1rrv7i6-7"})` 19715 display: flex; 19716 align-items: center; 19717 gap: 1rem; 19718 margin: 0 0 2.5rem; 19719`,sCt=p.p.withConfig({displayName:"SiteAuditCoverSlide__ProjectName",componentId:"sc-1rrv7i6-8"})` 19720 font-size: 1.65rem; 19721 font-weight: 600; 19722 color: ${fi}; 19723 margin: 0; 19724 line-height: 1.3; 19725`,aCt=p.div.withConfig({displayName:"SiteAuditCoverSlide__Meta",componentId:"sc-1rrv7i6-9"})` 19726 display: flex; 19727 align-items: center; 19728 gap: 0.5rem; 19729 color: ${Nn}; 19730 font-size: 0.82rem; 19731 font-weight: 600; 19732`;function lCt({data:e}){return t.jsxs(Z_t,{children:[t.jsx(J_t,{}),t.jsxs(eCt,{children:[t.jsxs(tCt,{children:[t.jsx(nCt,{}),"AI Readiness Intelligence"]}),t.jsxs(iCt,{children:["Site Audit",t.jsx("br",{}),t.jsx(rCt,{children:"Report"})]}),t.jsxs(oCt,{children:[t.jsx(By,{logoUrl:e.project.logo_url,size:48}),t.jsx(sCt,{children:e.project.name})]}),t.jsxs(aCt,{children:[t.jsx(a1,{size:14}),U1t(e.audit_snapshot_at||e.generated_at)]})]})]})}function cCt(){return{key:"cover",label:"Cover",icon:t.jsx(th,{size:14}),fullBleed:!0,render:e=>t.jsx(lCt,{data:e})}}const dCt=p.div.withConfig({displayName:"SiteAuditOverviewSlide__ScoreRingWrap",componentId:"sc-ud58ko-0"})` 19733 display: flex; 19734 flex-direction: column; 19735 align-items: center; 19736 justify-content: center; 19737 margin-bottom: 2rem; 19738`,uCt=p.div.withConfig({displayName:"SiteAuditOverviewSlide__RingLabel",componentId:"sc-ud58ko-1"})` 19739 font-size: 0.72rem; 19740 font-weight: 800; 19741 letter-spacing: 0.1em; 19742 text-transform: uppercase; 19743 color: ${fi}; 19744 margin-top: 0.75rem; 19745`,pCt=p.div.withConfig({displayName:"SiteAuditOverviewSlide__IssuePills",componentId:"sc-ud58ko-2"})` 19746 display: flex; 19747 gap: 0.75rem; 19748 justify-content: center; 19749 flex-wrap: wrap; 19750 margin-bottom: 2rem; 19751`,A4=p.div.withConfig({displayName:"SiteAuditOverviewSlide__IssuePill",componentId:"sc-ud58ko-3"})` 19752 display: inline-flex; 19753 align-items: center; 19754 gap: 0.4rem; 19755 padding: 0.4rem 0.85rem; 19756 border-radius: 999px; 19757 border: 1px solid ${e=>e.$color}33; 19758 background: ${e=>e.$color}0d; 19759 font-size: 0.78rem; 19760 font-weight: 800; 19761 color: ${e=>e.$color}; 19762`,N4=p.span.withConfig({displayName:"SiteAuditOverviewSlide__Dot",componentId:"sc-ud58ko-4"})` 19763 width: 8px; 19764 height: 8px; 19765 border-radius: 50%; 19766 background: ${e=>e.$color}; 19767 display: inline-block; 19768`;function mCt({score:e}){const n=e??0,i=H_(n),r=60,o=2*Math.PI*r,s=o*(n/100);return t.jsxs("svg",{width:160,height:160,viewBox:"0 0 160 160",children:[t.jsx("circle",{cx:80,cy:80,r,fill:"none",stroke:zi,strokeWidth:14}),t.jsx("circle",{cx:80,cy:80,r,fill:"none",stroke:i,strokeWidth:14,strokeDasharray:`${s} ${o}`,strokeLinecap:"round",transform:"rotate(-90 80 80)"}),t.jsx("text",{x:80,y:75,textAnchor:"middle",dominantBaseline:"middle",fontSize:28,fontWeight:950,fill:Vn,children:e!=null?Math.round(n):"â"}),t.jsx("text",{x:80,y:100,textAnchor:"middle",dominantBaseline:"middle",fontSize:11,fontWeight:700,fill:Nn,children:"/ 100"})]})}function hCt({data:e}){const n=e.sections.overview;if(!n.has_data)return t.jsx(Eo,{children:"No audit data available yet. Run your first site audit to generate this report."});const i=n.site_score!=null&&n.previous_site_score!=null?+(n.site_score-n.previous_site_score).toFixed(1):null;return t.jsxs(t.Fragment,{children:[t.jsx(Ho,{children:"Site Audit"}),t.jsx(qo,{children:"AI Readiness Overview"}),t.jsx(Xc,{children:"Overall health of your site for AI indexing and citation."}),t.jsxs(dCt,{children:[t.jsx(mCt,{score:n.site_score}),t.jsx(uCt,{children:"AI Readiness Score"}),i!=null&&t.jsxs(H1t,{$positive:i>=0,style:{marginTop:"0.4rem"},children:[i>=0?"+":"",i," vs previous"]})]}),t.jsxs(pCt,{children:[t.jsxs(A4,{$color:uf("high"),children:[t.jsx(N4,{$color:uf("high")}),Hs(n.issue_counts.high)," High"]}),t.jsxs(A4,{$color:uf("medium"),children:[t.jsx(N4,{$color:uf("medium")}),Hs(n.issue_counts.medium)," Medium"]}),t.jsxs(A4,{$color:uf("low"),children:[t.jsx(N4,{$color:uf("low")}),Hs(n.issue_counts.low)," Low"]})]}),t.jsxs(WA,{children:[t.jsxs(Ul,{children:[t.jsx(Hl,{children:"Pages Audited"}),t.jsx(ql,{children:Hs(n.pages_audited)})]}),t.jsxs(Ul,{children:[t.jsx(Hl,{children:"Technical Score"}),t.jsx(ql,{style:{color:H_(n.technical_score)},children:MZ(n.technical_score)})]}),t.jsxs(Ul,{children:[t.jsx(Hl,{children:"Content Score"}),t.jsx(ql,{style:{color:H_(n.content_score)},children:MZ(n.content_score)})]}),t.jsxs(Ul,{children:[t.jsx(Hl,{children:"Total Issues"}),t.jsx(ql,{children:Hs(n.issue_counts.high+n.issue_counts.medium+n.issue_counts.low)})]})]})]})}function fCt(){return{key:"overview",label:"Overview",icon:t.jsx(X8,{size:14}),render:e=>t.jsx(hCt,{data:e})}}function gCt({data:e}){const n=e.sections.score_history;if(!n.has_data)return t.jsx(Eo,{children:"No score history available yet."});const i=n.entries.map(r=>({date:new Date(r.date).toLocaleDateString("en-US",{month:"short",day:"numeric"}
19768),Score:r.score!=null?Math.round(r.score):null,Technical:r.technical_score!=null?Math.round(r.technical_score):null,Content:r.content_score!=null?Math.round(r.content_score):null}));return t.jsxs(t.Fragment,{children:[t.jsx(Ho,{children:"Trend"}),t.jsx(qo,{children:"Score Over Time"}),t.jsx(Xc,{children:"AI Readiness Score trend across recent audit runs."}),t.jsx(My,{children:t.jsx(Gl,{width:"100%",height:320,children:t.jsxs(C1,{data:i,margin:{top:8,right:16,left:-8,bottom:0},children:[t.jsx(Zm,{strokeDasharray:"3 3",stroke:zi}),t.jsx(Ql,{dataKey:"date",tick:{fontSize:11,fill:Nn}}),t.jsx(Zl,{domain:[0,100],tick:{fontSize:11,fill:Nn}}),t.jsx(Vl,{contentStyle:{fontSize:12,borderRadius:8,border:`1px solid ${zi}`},formatter:r=>[`${r}`,void 0]}),t.jsx(rA,{wrapperStyle:{fontSize:12,color:fi}}),t.jsx(Nd,{type:"monotone",dataKey:"Score",stroke:mi,strokeWidth:2.5,dot:!1,connectNulls:!0}),t.jsx(Nd,{type:"monotone",dataKey:"Technical",stroke:"#6366f1",strokeWidth:1.5,dot:!1,strokeDasharray:"4 2",connectNulls:!0}),t.jsx(Nd,{type:"monotone",dataKey:"Content",stroke:"#10b981",strokeWidth:1.5,dot:!1,strokeDasharray:"4 2",connectNulls:!0})]})})})]})}function yCt(){return{key:"score_history",label:"Score Trend",icon:t.jsx(qi,{size:14}),render:e=>t.jsx(gCt,{data:e})}}const xCt=p.div.withConfig({displayName:"SiteAuditCategoryBreakdownSlide__Grid",componentId:"sc-15tw55u-0"})` 19769 display: grid; 19770 grid-template-columns: 1fr 1fr; 19771 gap: 0.75rem; 19772 @media (max-width: 768px) { grid-template-columns: 1fr; } 19773`,bCt=p.div.withConfig({displayName:"SiteAuditCategoryBreakdownSlide__Row",componentId:"sc-15tw55u-1"})` 19774 display: flex; 19775 flex-direction: column; 19776 gap: 0.25rem; 19777 padding: 0.85rem 1rem; 19778 background: ${Oi}; 19779 border: 1px solid ${zi}; 19780 border-radius: 0.75rem; 19781`,vCt=p.div.withConfig({displayName:"SiteAuditCategoryBreakdownSlide__RowTop",componentId:"sc-15tw55u-2"})` 19782 display: flex; 19783 align-items: center; 19784 justify-content: space-between; 19785`,wCt=p.div.withConfig({displayName:"SiteAuditCategoryBreakdownSlide__RowLabel",componentId:"sc-15tw55u-3"})` 19786 font-size: 0.8rem; 19787 font-weight: 800; 19788 color: ${Vn}; 19789`,jCt=p.div.withConfig({displayName:"SiteAuditCategoryBreakdownSlide__RowScore",componentId:"sc-15tw55u-4"})` 19790 font-size: 1.1rem; 19791 font-weight: 950; 19792 color: ${e=>e.$color}; 19793`,_Ct=p.div.withConfig({displayName:"SiteAuditCategoryBreakdownSlide__BarBg",componentId:"sc-15tw55u-5"})` 19794 height: 6px; 19795 background: ${po}; 19796 border-radius: 3px; 19797 overflow: hidden; 19798 margin: 0.3rem 0 0.4rem; 19799`,CCt=p.div.withConfig({displayName:"SiteAuditCategoryBreakdownSlide__BarFill",componentId:"sc-15tw55u-6"})` 19800 height: 100%; 19801 width: ${e=>e.$w}%; 19802 background: ${e=>e.$color}; 19803 border-radius: 3px; 19804 transition: width 0.4s ease; 19805`,SCt=p.span.withConfig({displayName:"SiteAuditCategoryBreakdownSlide__PillarBadge",componentId:"sc-15tw55u-7"})` 19806 font-size: 0.62rem; 19807 font-weight: 800; 19808 text-transform: uppercase; 19809 letter-spacing: 0.06em; 19810 color: ${e=>e.$pillar==="technical"?"#6366f1":"#059669"}; 19811 background: ${e=>e.$pillar==="technical"?"rgba(99,102,241,0.08)":"rgba(5,150,105,0.08)"}; 19812 padding: 1px 6px; 19813 border-radius: 4px; 19814`,kCt=p.div.withConfig({displayName:"SiteAuditCategoryBreakdownSlide__IssueCounts",componentId:"sc-15tw55u-8"})` 19815 display: flex; 19816 gap: 0.5rem; 19817 align-items: center; 19818`,p2=p.span.withConfig({displayName:"SiteAuditCategoryBreakdownSlide__IssueCount",componentId:"sc-15tw55u-9"})` 19819 font-size: 0.65rem; 19820 font-weight: 750; 19821 color: ${e=>e.$color}; 19822`;function $Ct({cat:e}){const n=H_(e.score),i=Q_t[e.key]||n;return t.jsxs(bCt,{children:[t.jsxs(vCt,{children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem"},children:[t.jsx(wCt,{children:cD[e.key]||e.label}),t.jsx(SCt,{$pillar:e.pillar,children:e.pillar})]}),t.jsx(jCt,{$color:n,children:e.score!=null?Math.round(e.score):"â"})]}),t.jsx(_Ct,{children:t.jsx(CCt,{$w:e.score??0,$color:i})}),t.jsxs(kCt,{children:[e.high>0&&t.jsxs(p2,{$color:"#ef4444",children:[e.high," high"]}),e.medium>0&&t.jsxs(p2,{$color:"#f97316",children:[e.medium," medium"]}),e.low>0&&t.jsxs(p2,{$color:"#ca8a04",children:[e.low," low"]}),e.high+e.medium+e.low===0&&t.jsx(p2,{$color:Nn,children:"no open issues"})]})]})}function ICt({data:e}){const n=e.sections.category_scores;return n.has_data?t.jsxs(t.Fragment,{children:[t.jsx(Ho,{children:"Breakdown"}),t.jsx(qo,{children:"Category Scores"}),t.jsx(Xc,{children:"Performance across all 8 audit categories."}),t.jsx(xCt,{children:n.categories.map(i=>t.jsx($Ct,{cat:i},i.key))})]}):t.jsx(Eo,{children:"No category scores available yet."})}function PCt(){return{key:"category_scores",label:"Categories",icon:t.jsx(Gg,{size:14}),render:e=>t.jsx(ICt,{data:e})}}const ACt=p.div.withConfig({displayName:"SiteAuditTopIssuesSlide__IssueList",componentId:"sc-119tadt-0"})` 19823 display: flex; 19824 flex-direction: column; 19825 gap: 0.5rem; 19826`,NCt=p.div.withConfig({displayName:"SiteAuditTopIssuesSlide__IssueRow",componentId:"sc-119tadt-1"})` 19827 display: flex; 19828 align-items: flex-start; 19829 gap: 0.75rem; 19830 padding: 0.75rem 1rem; 19831 background: ${Oi}; 19832 border: 1px solid ${zi}; 19833 border-radius: 0.65rem; 19834`,zCt=p.span.withConfig({displayName:"SiteAuditTopIssuesSlide__SevBadge",componentId:"sc-119tadt-2"})` 19835 display: inline-flex; 19836 align-items: center; 19837 padding: 2px 8px; 19838 border-radius: 5px; 19839 font-size: 0.62rem; 19840 font-weight: 900; 19841 text-transform: uppercase; 19842 letter-spacing: 0.06em; 19843 color: ${e=>uf(e.$sev)}; 19844 background: ${e=>Mue(e.$sev)}; 19845 flex-shrink: 0; 19846 align-self: flex-start; 19847 margin-top: 2px; 19848`,TCt=p.div.withConfig({displayName:"SiteAuditTopIssuesSlide__IssueBody",componentId:"sc-119tadt-3"})` 19849 flex: 1; 19850 min-width: 0; 19851`,ECt=p.div.withConfig({displayName:"SiteAuditTopIssuesSlide__IssueMsg",componentId:"sc-119tadt-4"})` 19852 font-size: 0.82rem; 19853 font-weight: 700; 19854 color: ${Vn}; 19855 line-height: 1.35; 19856`,MCt=p.div.withConfig({displayName:"SiteAuditTopIssuesSlide__IssueMeta",componentId:"sc-119tadt-5"})` 19857 display: flex; 19858 align-items: center; 19859 gap: 0.4rem; 19860 margin-top: 0.25rem; 19861 flex-wrap: wrap; 19862`,RZ=p.span.withConfig({displayName:"SiteAuditTopIssuesSlide__MetaChip",componentId:"sc-119tadt-6"})` 19863 font-size: 0.63rem; 19864 font-weight: 700; 19865 color: ${fi}; 19866 background: #f3f4f6; 19867 padding: 1px 6px; 19868 border-radius: 4px; 19869`,RCt=p.span.withConfig({displayName:"SiteAuditTopIssuesSlide__PageUrl",componentId:"sc-119tadt-7"})` 19870 font-size: 0.63rem; 19871 color: ${Nn}; 19872 overflow: hidden; 19873 text-overflow: ellipsis; 19874 white-space: nowrap; 19875 max-width: min(240px, 100%); 19876`;function OCt({issue:e}){return t.jsxs(NCt,{children:[t.jsx(zCt,{$sev:e.severity,children:e.severity}),t.jsxs(TCt,{children:[t.jsx(ECt,{children:e.message}),t.jsxs(MCt,{children:[t.jsx(RZ,{children:cD[e.category]||e.category}),e.scope==="page"&&e.page_url&&t.jsx(RCt,{title:e.page_url,children:e.page_url}),e.scope==="site"&&t.jsx(RZ,{children:"Site-wide"})]})]})]})}function DCt({data:e}){const n=e.sections.top_issues;return n.has_data?t.jsxs(t.Fragment,{children:[t.jsx(Ho,{children:"Issues"}),t.jsx(qo,{children:"Top Open Issues"}
19876),t.jsx(Xc,{children:"Highest-priority findings that need attention."}),t.jsx(ACt,{children:n.issues.map(i=>t.jsx(OCt,{issue:i},i.id))})]}):t.jsx(Eo,{children:"No open issues â great work!"})}function LCt(){return{key:"top_issues",label:"Top Issues",icon:t.jsx(ei,{size:14}),render:e=>t.jsx(DCt,{data:e})}}const BCt=p.div.withConfig({displayName:"SiteAuditCrawlabilitySlide__Grid",componentId:"sc-17ng3i4-0"})` 19877 display: grid; 19878 grid-template-columns: 1fr 1fr; 19879 gap: 1rem; 19880 @media (max-width: 768px) { grid-template-columns: 1fr; } 19881`,FCt=p.div.withConfig({displayName:"SiteAuditCrawlabilitySlide__MatrixTable",componentId:"sc-17ng3i4-1"})` 19882 display: flex; 19883 flex-direction: column; 19884 gap: 0.35rem; 19885`,WCt=p.div.withConfig({displayName:"SiteAuditCrawlabilitySlide__MatrixRow",componentId:"sc-17ng3i4-2"})` 19886 display: flex; 19887 align-items: center; 19888 justify-content: space-between; 19889 padding: 0.4rem 0.6rem; 19890 background: #f9fafb; 19891 border-radius: 0.4rem; 19892`,UCt=p.span.withConfig({displayName:"SiteAuditCrawlabilitySlide__BotName",componentId:"sc-17ng3i4-3"})` 19893 font-size: 0.78rem; 19894 font-weight: 700; 19895 color: ${Vn}; 19896`,OZ=p.span.withConfig({displayName:"SiteAuditCrawlabilitySlide__StatusBadge",componentId:"sc-17ng3i4-4"})` 19897 font-size: 0.68rem; 19898 font-weight: 800; 19899 padding: 2px 8px; 19900 border-radius: 4px; 19901 background: ${e=>e.$status==="allowed"?"rgba(16,185,129,0.1)":e.$status==="blocked"?"rgba(239,68,68,0.1)":"rgba(156,163,175,0.12)"}; 19902 color: ${e=>e.$status==="allowed"?"#059669":e.$status==="blocked"?"#dc2626":"#6b7280"}; 19903`,m2=p.div.withConfig({displayName:"SiteAuditCrawlabilitySlide__StatRow",componentId:"sc-17ng3i4-5"})` 19904 display: flex; 19905 align-items: center; 19906 justify-content: space-between; 19907 padding: 0.5rem 0; 19908 border-bottom: 1px solid ${zi}; 19909 &:last-child { border-bottom: none; } 19910`,h2=p.span.withConfig({displayName:"SiteAuditCrawlabilitySlide__StatLabel",componentId:"sc-17ng3i4-6"})` 19911 font-size: 0.78rem; 19912 font-weight: 600; 19913 color: ${fi}; 19914`,z4=p.span.withConfig({displayName:"SiteAuditCrawlabilitySlide__StatValue",componentId:"sc-17ng3i4-7"})` 19915 font-size: 0.88rem; 19916 font-weight: 800; 19917 color: ${Vn}; 19918`;function HCt({data:e}){const n=e.sections.crawlability;if(!n.has_data)return t.jsx(Eo,{children:"No crawlability data available."});const i=n.data,r=i.bot_matrix||[],o=i.sitemap||{};return t.jsxs(t.Fragment,{children:[t.jsx(Ho,{children:"Crawlability"}),t.jsx(qo,{children:"AI Bot Access & Crawlability"}),t.jsx(Xc,{children:"How accessible your site is to AI crawlers and search bots."}),t.jsxs(BCt,{children:[r.length>0&&t.jsxs(My,{children:[t.jsx(e1,{children:"Bot Access Matrix"}),t.jsx(FCt,{children:r.map(s=>t.jsxs(WCt,{children:[t.jsxs("div",{children:[t.jsx(UCt,{children:s.name}),t.jsx("div",{style:{fontSize:"0.65rem",color:Nn,marginTop:1},children:s.category})]}),t.jsx(OZ,{$status:s.status,children:s.status})]},s.key))})]}),t.jsxs(My,{children:[t.jsx(e1,{children:"Sitemap Health"}),o.status?t.jsxs(t.Fragment,{children:[t.jsxs(m2,{children:[t.jsx(h2,{children:"Status"}),t.jsx(OZ,{$status:["healthy","ok"].includes(o.status)?"allowed":"blocked",children:o.status})]}),t.jsxs(m2,{children:[t.jsx(h2,{children:"URLs in sitemap"}),t.jsx(z4,{children:o.url_count??"â"})]}),t.jsxs(m2,{children:[t.jsx(h2,{children:"Coverage"}),t.jsx(z4,{children:lD(o.coverage_pct)})]}),t.jsxs(m2,{children:[t.jsx(h2,{children:"Total pages"}),t.jsx(z4,{children:o.total_pages??"â"})]})]}):t.jsx("div",{style:{fontSize:"0.78rem",color:Nn},children:"No sitemap data yet."})]})]})]})}function qCt(){return{key:"crawlability",label:"Crawlability",icon:t.jsx(Cs,{size:14}),render:e=>t.jsx(HCt,{data:e})}}const GCt=p.span.withConfig({displayName:"SiteAuditStructuredDataSlide__TypePill",componentId:"sc-1g9wahh-0"})` 19919 display: inline-block; 19920 padding: 3px 8px; 19921 background: rgba(79, 70, 229, 0.07); 19922 border: 1px solid rgba(79, 70, 229, 0.15); 19923 border-radius: 4px; 19924 font-size: 0.7rem; 19925 font-weight: 700; 19926 color: ${mi}; 19927 margin: 2px; 19928`,VCt=p.div.withConfig({displayName:"SiteAuditStructuredDataSlide__TypesWrap",componentId:"sc-1g9wahh-1"})` 19929 display: flex; 19930 flex-wrap: wrap; 19931 gap: 0.15rem; 19932 margin-top: 0.5rem; 19933`;function KCt({data:e}){const n=e.sections.structured_data;if(!n.has_data)return t.jsx(Eo,{children:"No structured data information available."});const i=n.data,o=(i.types||[]).slice(0,12);return t.jsxs(t.Fragment,{children:[t.jsx(Ho,{children:"Structured Data"}),t.jsx(qo,{children:"Schema & Structured Data"}),t.jsx(Xc,{children:"How well your site uses schema.org markup â critical for AI citations."}),t.jsxs(WA,{children:[t.jsxs(Ul,{children:[t.jsx(Hl,{children:"Pages with Schema"}),t.jsx(ql,{children:Hs(i.with_schema)})]}),t.jsxs(Ul,{children:[t.jsx(Hl,{children:"Schema Coverage"}),t.jsx(ql,{style:{color:i.coverage_pct>=60?"#10b981":i.coverage_pct>=30?"#f59e0b":"#ef4444"},children:lD(i.coverage_pct)})]}),t.jsxs(Ul,{children:[t.jsx(Hl,{children:"Pages without Schema"}),t.jsx(ql,{children:Hs(i.without_schema)})]}),t.jsxs(Ul,{children:[t.jsx(Hl,{children:"Total Audited"}),t.jsx(ql,{children:Hs(i.total_audited)})]})]}),o.length>0&&t.jsxs(My,{children:[t.jsx(e1,{children:"Detected Schema Types"}),t.jsx(VCt,{children:o.map(s=>t.jsxs(GCt,{children:[s.type," (",s.count,")"]},s.type))})]})]})}function YCt(){return{key:"structured_data",label:"Structured Data",icon:t.jsx(Ine,{size:14}),render:e=>t.jsx(KCt,{data:e})}}const f2=p.div.withConfig({displayName:"SiteAuditPerformanceSlide__MetricRow",componentId:"sc-hs7c1-0"})` 19934 display: flex; 19935 align-items: center; 19936 justify-content: space-between; 19937 padding: 0.55rem 0; 19938 border-bottom: 1px solid ${zi}; 19939 &:last-child { border-bottom: none; } 19940`,g2=p.span.withConfig({displayName:"SiteAuditPerformanceSlide__MetricLabel",componentId:"sc-hs7c1-1"})` 19941 font-size: 0.8rem; 19942 font-weight: 600; 19943 color: ${fi}; 19944`,y2=p.span.withConfig({displayName:"SiteAuditPerformanceSlide__MetricValue",componentId:"sc-hs7c1-2"})` 19945 font-size: 0.9rem; 19946 font-weight: 800; 19947 color: ${e=>e.$good?"#10b981":e.$bad?"#ef4444":Vn}; 19948`;function T4(e){return e==null?"â":e>=1e3?`${(e/1e3).toFixed(1)}s`:`${Math.round(e)}ms`}function XCt(e){return e==null?"â":e.toFixed(3)}function QCt({data:e}){const n=e.sections.performance;if(!n.has_data)return t.jsx(Eo,{children:"No performance data available. Enable PageSpeed Insights to collect Core Web Vitals."});const i=n.data,r=i.avg_lcp_ms!=null&&i.avg_lcp_ms<=2500,o=i.avg_lcp_ms!=null&&i.avg_lcp_ms>4e3,s=i.avg_cls!=null&&i.avg_cls<=.1,a=i.avg_cls!=null&&i.avg_cls>.25,c=i.avg_fcp_ms!=null&&i.avg_fcp_ms<=1800,u=i.avg_fcp_ms!=null&&i.avg_fcp_ms>3e3;return t.jsxs(t.Fragment,{children:[t.jsx(Ho,{children:"Performance"}),t.jsx(qo,{children:"Core Web Vitals & Performance"}),t.jsxs(Xc,{children:["Page speed and performance metrics across ",Hs(i.pages_measured)," measured pages."]}),t.jsxs(WA,{children:[t.jsxs(Ul,{children:[t.jsx(Hl,{children:"Avg Performance Score"}),t.jsx(ql,{style:{color:i.avg_performance_score>=90?"#10b981":i.avg_performance_score>=50?"#f59e0b":"#ef4444"},children:i.avg_performance_score!=null?Math.round(i.avg_performance_score):"â"})]}),t.jsxs(Ul,{children:[t.jsx(Hl,{children:"Unoptimized Images"}),t.jsx(ql,{children:Hs(i.total_unoptimized_images)})]}),t.jsxs(Ul,{children:[t.jsx(Hl,{children:"Render Blocking"}),t.jsx(ql,{children:Hs(i.total_render_blocking)})]}),t.jsxs(Ul,{children:[t.jsx(Hl,{children:"Legacy Formats"}),t.jsx(ql,{children:Hs(i.total_legacy_formats)})]})]}),t.jsxs(My,{children:[t.jsx(e1,{children:"Core Web Vitals (averages)"}),t.jsxs(f2,{children:[t.jsx(g2,{children:"LCP (Largest Contentful Paint)"}),t.jsx(y2,{$good:r,$bad:o,children:T4(i.avg_lcp_ms)})]}),t.jsxs(f2,{children:[t.jsx(g2,{children:"CLS (Cumulative Layout Shift)"}),t.jsx(y2,{$good:s,$bad:a,children:XCt(i.avg_cls)})]}),t.jsxs(f2,{children:[t.jsx(g2,{children:"FCP (First Contentful Paint)"}),t.jsx(y2,{$good:c,$bad:u,children:T4(i.avg_fcp_ms)})]}
19948),t.jsxs(f2,{children:[t.jsx(g2,{children:"TBT (Total Blocking Time)"}),t.jsx(y2,{children:T4(i.avg_tbt_ms)})]})]})]})}function ZCt(){return{key:"performance",label:"Performance",icon:t.jsx(Ks,{size:14}),render:e=>t.jsx(QCt,{data:e})}}const E5=p.div.withConfig({displayName:"SiteAuditMetadataSlide__BarRow",componentId:"sc-1lkajnp-0"})` 19949 display: flex; 19950 flex-direction: column; 19951 gap: 0.2rem; 19952 margin-bottom: 0.65rem; 19953`,M5=p.div.withConfig({displayName:"SiteAuditMetadataSlide__BarLabel",componentId:"sc-1lkajnp-1"})` 19954 display: flex; 19955 align-items: center; 19956 justify-content: space-between; 19957 font-size: 0.75rem; 19958 font-weight: 700; 19959 color: ${fi}; 19960`,JCt=p.div.withConfig({displayName:"SiteAuditMetadataSlide__BarBg",componentId:"sc-1lkajnp-2"})` 19961 height: 7px; 19962 background: ${po}; 19963 border-radius: 4px; 19964 overflow: hidden; 19965`,eSt=p.div.withConfig({displayName:"SiteAuditMetadataSlide__BarFill",componentId:"sc-1lkajnp-3"})` 19966 height: 100%; 19967 width: ${e=>e.$w}%; 19968 background: ${e=>e.$color||"#4f46e5"}; 19969 border-radius: 4px; 19970`,tSt=p.div.withConfig({displayName:"SiteAuditMetadataSlide__MetaGrid",componentId:"sc-1lkajnp-4"})` 19971 display: grid; 19972 grid-template-columns: 1fr 1fr; 19973 gap: 1rem; 19974 @media (max-width: 768px) { grid-template-columns: 1fr; } 19975`;function Dg({label:e,pct:n,color:i}){const r=n??0,o=n==null?Nn:n>=80?"#10b981":n>=50?"#f59e0b":"#ef4444",s=i||(n==null?zi:n>=80?"#10b981":n>=50?"#f59e0b":"#ef4444");return t.jsxs(E5,{children:[t.jsxs(M5,{children:[t.jsx("span",{children:e}),t.jsx("span",{style:{color:o},children:lD(n)})]}),t.jsx(JCt,{children:t.jsx(eSt,{$w:r,$color:s})})]})}function nSt({data:e}){const n=e.sections.metadata;if(!n.has_data)return t.jsx(Eo,{children:"No metadata information available."});const i=n.metadata,r=n.content_quality,o=n.content_structure,s=n.aeo,a=i?.coverage||{},c=i?.images||{},u=i?.headings||o?.headings||{};return t.jsxs(t.Fragment,{children:[t.jsx(Ho,{children:"Metadata & Content"}),t.jsx(qo,{children:"Metadata, SEO & Content Quality"}),t.jsx(Xc,{children:"On-page coverage and content signals that affect AI discoverability."}),t.jsxs(tSt,{children:[t.jsxs(My,{children:[t.jsx(e1,{children:"Metadata Coverage"}),t.jsx(Dg,{label:"Title Tag",pct:a.title?.pct}),t.jsx(Dg,{label:"Meta Description",pct:a.description?.pct}),t.jsx(Dg,{label:"OG Tags",pct:a.og_tags?.pct}),t.jsx(Dg,{label:"Canonical Tag",pct:a.canonical?.pct}),t.jsx(Dg,{label:"Twitter Card",pct:a.twitter_card?.pct})]}),t.jsxs(My,{children:[t.jsx(e1,{children:"Content & Structure"}),r?.avg_word_count!=null&&t.jsxs(WA,{style:{marginBottom:"0.75rem"},children:[t.jsxs(Ul,{children:[t.jsx(Hl,{children:"Avg Word Count"}),t.jsx(ql,{children:Hs(r.avg_word_count)})]}),t.jsxs(Ul,{children:[t.jsx(Hl,{children:"Thin Pages"}),t.jsx(ql,{children:Hs(r.thin_pages)})]})]}),u&&t.jsxs(t.Fragment,{children:[t.jsx(E5,{children:t.jsxs(M5,{children:[t.jsx("span",{children:"Proper H1"}),t.jsx("span",{style:{color:"#10b981"},children:Hs(u.proper_h1)})]})}),t.jsx(E5,{children:t.jsxs(M5,{children:[t.jsx("span",{children:"H1 Missing"}),t.jsx("span",{style:{color:u.h1_missing>0?"#ef4444":"#10b981"},children:Hs(u.h1_missing)})]})}),t.jsx(E5,{children:t.jsxs(M5,{children:[t.jsx("span",{children:"Hierarchy Issues"}),t.jsx("span",{style:{color:u.hierarchy_issues>0?"#f97316":"#10b981"},children:Hs(u.hierarchy_issues)})]})})]}),c?.total>0&&t.jsx(Dg,{label:"Images with Alt Text",pct:c.pct}),s?.signals?.direct_answer!=null&&t.jsx(Dg,{label:"AEO: Direct Answer",pct:s.signals.direct_answer.pct,color:"#7c3aed"})]})]})]})}function iSt(){return{key:"metadata",label:"Metadata & Content",icon:t.jsx(Ss,{size:14}),render:e=>t.jsx(nSt,{data:e})}}const rSt=p.div.withConfig({displayName:"SiteAuditPrioritiesSlide__SummaryBox",componentId:"sc-1sgvg7n-0"})` 19976 background: rgba(79, 70, 229, 0.04); 19977 border: 1px solid rgba(79, 70, 229, 0.12); 19978 border-radius: 0.75rem; 19979 padding: 1rem 1.2rem; 19980 font-size: 0.85rem; 19981 line-height: 1.6; 19982 color: ${Vn}; 19983 margin-bottom: 1rem; 19984`,oSt=p.div.withConfig({displayName:"SiteAuditPrioritiesSlide__PriorityList",componentId:"sc-1sgvg7n-1"})` 19985 display: flex; 19986 flex-direction: column; 19987 gap: 0.5rem; 19988`,sSt=p.div.withConfig({displayName:"SiteAuditPrioritiesSlide__PriorityRow",componentId:"sc-1sgvg7n-2"})` 19989 display: flex; 19990 align-items: flex-start; 19991 gap: 0.75rem; 19992 padding: 0.75rem 1rem; 19993 background: ${Oi}; 19994 border: 1px solid ${zi}; 19995 border-radius: 0.65rem; 19996`,aSt=p.div.withConfig({displayName:"SiteAuditPrioritiesSlide__Rank",componentId:"sc-1sgvg7n-3"})` 19997 width: 22px; 19998 height: 22px; 19999 border-radius: 6px; 20000 background: #f3f4f6; 20001 display: flex; 20002 align-items: center; 20003 justify-content: center; 20004 font-size: 0.65rem; 20005 font-weight: 900; 20006 color: ${fi}; 20007 flex-shrink: 0;
20008 margin-top: 1px; 20009`,lSt=p.div.withConfig({displayName:"SiteAuditPrioritiesSlide__PriorityBody",componentId:"sc-1sgvg7n-4"})` 20010 flex: 1; 20011 min-width: 0; 20012`,cSt=p.div.withConfig({displayName:"SiteAuditPrioritiesSlide__PriorityMsg",componentId:"sc-1sgvg7n-5"})` 20013 font-size: 0.82rem; 20014 font-weight: 700; 20015 color: ${Vn}; 20016 line-height: 1.35; 20017`,dSt=p.div.withConfig({displayName:"SiteAuditPrioritiesSlide__PriorityDescription",componentId:"sc-1sgvg7n-6"})` 20018 font-size: 0.75rem; 20019 color: ${fi}; 20020 margin-top: 0.2rem; 20021 line-height: 1.4; 20022`,uSt=p.div.withConfig({displayName:"SiteAuditPrioritiesSlide__MetaRow",componentId:"sc-1sgvg7n-7"})` 20023 display: flex; 20024 gap: 0.4rem; 20025 align-items: center; 20026 margin-top: 0.3rem; 20027 flex-wrap: wrap; 20028`,pSt=p.span.withConfig({displayName:"SiteAuditPrioritiesSlide__SevBadge",componentId:"sc-1sgvg7n-8"})` 20029 display: inline-flex; 20030 align-items: center; 20031 padding: 1px 7px; 20032 border-radius: 4px; 20033 font-size: 0.62rem; 20034 font-weight: 900; 20035 text-transform: uppercase; 20036 letter-spacing: 0.06em; 20037 color: ${e=>uf(e.$sev)}; 20038 background: ${e=>Mue(e.$sev)}; 20039`,DZ=p.span.withConfig({displayName:"SiteAuditPrioritiesSlide__CatChip",componentId:"sc-1sgvg7n-9"})` 20040 font-size: 0.63rem; 20041 font-weight: 700; 20042 color: ${fi}; 20043 background: #f3f4f6; 20044 padding: 1px 6px; 20045 border-radius: 4px; 20046`;function mSt({data:e}){const n=e.sections.priorities;return n.has_data?t.jsxs(t.Fragment,{children:[t.jsx(Ho,{children:"AI Analysis"}),t.jsx(qo,{children:"Top Priorities"}),t.jsx(Xc,{children:"AI-synthesized actions to improve your site's AI readiness score."}),n.summary&&t.jsx(rSt,{children:n.summary}),t.jsx(oSt,{children:n.priorities.slice(0,8).map((i,r)=>{const o=i.message||i.title||"",s=i.description||"";return t.jsxs(sSt,{children:[t.jsx(aSt,{children:r+1}),t.jsxs(lSt,{children:[t.jsx(cSt,{children:o}),s&&t.jsx(dSt,{children:s}),t.jsxs(uSt,{children:[i.severity&&t.jsx(pSt,{$sev:i.severity,children:i.severity}),i.category&&t.jsx(DZ,{children:cD[i.category]||i.category}),i.affected_pages!=null&&t.jsxs(DZ,{children:[i.affected_pages," ",i.affected_pages===1?"page":"pages"]})]})]})]},r)})})]}):t.jsx(Eo,{children:"No AI-generated priorities yet. Run a full site audit to generate priorities."})}function hSt(){return{key:"priorities",label:"AI Priorities",icon:t.jsx(Sn,{size:14}),render:e=>t.jsx(mSt,{data:e})}}const fSt=p.table.withConfig({displayName:"SiteAuditPagesTableSlide__Table",componentId:"sc-afkrq-0"})` 20047 width: 100%; 20048 border-collapse: collapse; 20049 font-size: 0.8rem; 20050`,x2=p.th.withConfig({displayName:"SiteAuditPagesTableSlide__TH",componentId:"sc-afkrq-1"})` 20051 text-align: left; 20052 font-size: 0.68rem; 20053 font-weight: 850; 20054 letter-spacing: 0.05em; 20055 text-transform: uppercase; 20056 color: ${Nn}; 20057 padding: 0.5rem 0.75rem; 20058 border-bottom: 1px solid ${zi}; 20059 background: ${po}; 20060 white-space: nowrap; 20061`,b2=p.td.withConfig({displayName:"SiteAuditPagesTableSlide__TD",componentId:"sc-afkrq-2"})` 20062 padding: 0.55rem 0.75rem; 20063 border-bottom: 1px solid ${zi}; 20064 color: ${Vn}; 20065`,gSt=p.div.withConfig({displayName:"SiteAuditPagesTableSlide__TableWrap",componentId:"sc-afkrq-3"})` 20066 border-radius: 0.75rem; 20067 border: 1px solid ${zi}; 20068 overflow: hidden; 20069`,ySt=p.div.withConfig({displayName:"SiteAuditPagesTableSlide__ScrollWrap",componentId:"sc-afkrq-4"})` 20070 overflow-x: auto; 20071`,xSt=p.div.withConfig({displayName:"SiteAuditPagesTableSlide__PathCell",componentId:"sc-afkrq-5"})` 20072 font-size: 0.75rem; 20073 font-weight: 600; 20074 color: ${Vn}; 20075 overflow: hidden; 20076 text-overflow: ellipsis; 20077 white-space: nowrap; 20078 max-width: 260px; 20079`,bSt=p.span.withConfig({displayName:"SiteAuditPagesTableSlide__ScorePill",componentId:"sc-afkrq-6"})` 20080 font-size: 0.8rem; 20081 font-weight: 900; 20082 color: ${e=>e.$color}; 20083`,vSt=p.div.withConfig({displayName:"SiteAuditPagesTableSlide__IssueCell",componentId:"sc-afkrq-7"})` 20084 display: flex; 20085 gap: 0.4rem; 20086 font-size: 0.7rem; 20087 font-weight: 750; 20088`,v2=p.span.withConfig({displayName:"SiteAuditPagesTableSlide__ICount",componentId:"sc-afkrq-8"})` 20089 color: ${e=>e.$color}; 20090`;function wSt({page:e,rank:n}){const i=H_(e.score);return t.jsxs("tr",{children:[t.jsx(b2,{style:{color:Nn,fontWeight:800,width:32},children:n}),t.jsx(b2,{children:t.jsx(xSt,{title:e.url,children:e.path||e.url})}),t.jsx(b2,{style:{textAlign:"center"},children:t.jsx(bSt,{$color:i,children:e.score!=null?Math.round(e.score):"â"})}),t.jsx(b2,{children:t.jsxs(vSt,{children:[e.high>0&&t.jsxs(v2,{$color:"#ef4444",children:[e.high,"H"]}),e.medium>0&&t.jsxs(v2,{$color:"#f97316",children:[e.medium,"M"]}),e.low>0&&t.jsxs(v2,{$color:"#ca8a04",children:[e.low,"L"]}),e.high+e.medium+e.low===0&&t.jsx(v2,{$color:Nn,children:"â"})]})})]})}function jSt({data:e}){const n=e.sections.pages_table;return n.has_data?t.jsxs(t.Fragment,{children:[t.jsx(Ho,{children:"Pages"}),t.jsx(qo,{children:"Lowest-Scoring Pages"}),t.jsx(Xc,{children:"Pages that need the most attention, sorted by AI Readiness Score."}),t.jsx(gSt,{children:t.jsx(ySt,{children:t.jsxs(fSt,{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx(x2,{children:"#"}),t.jsx(x2,{children:"Page"}),t.jsx(x2,{style:{textAlign:"center"},children:"Score"}),t.jsx(x2,{children:"Issues"})]})}),t.jsx("tbody",{children:n.pages.map((i,r)=>t.jsx(wSt,{page:i,rank:r+1},i.id))})]})})})]}):t.jsx(Eo,{children:"No page data available yet."})}function _St(){return{key:"pages_table",label:"Pages",icon:t.jsx(To,{size:14}),render:e=>t.jsx(jSt,{data:e})}}const LZ=p.div.withConfig({displayName:"SiteAuditClosingSlide__Shell",componentId:"sc-c8j8in-0"})` 20091 position: relative; 20092 display: flex; 20093 flex-direction: column; 20094 align-items: center; 20095 justify-content: center; 20096 min-height: 100%; 20097 text-align: center; 20098 background: ${Oi}; 20099 overflow: hidden; 20100`,BZ=p.div.withConfig({displayName:"SiteAuditClosingSlide__Glow",componentId:"sc-c8j8in-1"})` 20101 position: absolute; 20102 width: 520px; 20103 height: 520px; 20104 border-radius: 50%; 20105 background: radial-gradient(circle, ${R1} 0%, transparent 70%); 20106 top: 50%; 20107 left: 50%; 20108 transform: translate(-50%, -50%); 20109 pointer-events: none; 20110`,FZ=p.div.withConfig({displayName:"SiteAuditClosingSlide__Content",componentId:"sc-c8j8in-2"})` 20111 position: relative; 20112 z-index: 1; 20113 display: flex; 20114 flex-direction: column; 20115 align-items: center; 20116`,WZ=p.img.withConfig({displayName:"SiteAuditClosingSlide__Logo",componentId:"sc-c8j8in-3"})` 20117 height: 5.5rem; 20118 margin-bottom: 2.5rem; 20119 @media (max-width: 768px) { height: 4rem; margin-bottom: 2rem; } 20120`,UZ=p.h2.withConfig({displayName:"SiteAuditClosingSlide__Heading",componentId:"sc-c8j8in-4"})` 20121 font-size: 3rem; 20122 font-weight: 950; 20123 letter-spacing: -0.02em; 20124 line-height: 1.15; 20125 color: ${Vn}; 20126 margin: 0 0 1rem; 20127 @media (max-width: 768px) { font-size: 2rem; } 20128`,HZ=p.span.withConfig({displayName:"SiteAuditClosingSlide__Accent",componentId:"sc-c8j8in-5"})` 20129 color: ${mi}; 20130`,qZ=p.p.withConfig({displayName:"SiteAuditClosingSlide__Sub",componentId:"sc-c8j8in-6"})` 20131 font-size: 1.1rem; 20132 font-weight: 500; 20133 color: ${fi}; 20134 margin: 0; 20135 line-height: 1.5; 20136 @media (max-width: 768px) { font-size: 0.95rem; } 20137`,CSt=p.p.withConfig({displayName:"SiteAuditClosingSlide__PreparedBy",componentId:"sc-c8j8in-7"})` 20138 font-size: 1rem; 20139 font-weight: 500; 20140 color: ${Nn}; 20141 margin: 1.5rem 0 0; 20142`;function SSt({data:e}){if(e.white_label){const n=e.project.organization_logo_url,i=e.project.organization_name||e.project.name;return t.jsxs(LZ,{children:[t.jsx(BZ,{}),t.jsxs(FZ,{children:[n&&t.jsx(WZ,{src:n,alt:i}),t.jsxs(UZ,{children:["Thank you",t.jsx(HZ,{children:"."})]}),t.jsxs(qZ,{children:["Prepared by ",i]}),t.jsx(CSt,{children:e.project.name})]})]})}return t.jsxs(LZ,{children:[t.jsx(BZ,{}),t.jsxs(FZ,{children:[t.jsx(WZ,{src:Tue,alt:"Ceyo"}),t.jsxs(UZ,{children:["Improve your AI",t.jsx("br",{}),"visibility",t.jsx(HZ,{children:"."})]}),t.jsxs(qZ,{children:["Site audit complete for ",e.project.name]})]})]})}function kSt(){return{key:"closing",label:"Closing",icon:t.jsx(co,{size:14}),fullBleed:!0,render:e=>t.jsx(SSt,{data:e})}}const E4=p.div.withConfig({displayName:"SiteAuditReportViewer__Shell",componentId:"sc-1e4d1is-0"})` 20143 display: flex; 20144 flex-direction: column; 20145 height: 100vh; 20146 width: 100vw; 20147 overflow: hidden; 20148 background: ${Oi}; 20149 color-scheme: light; 20150 position: fixed; 20151 inset: 0; 20152 z-index: 9999; 20153`,M4=p.header.withConfig({displayName:"SiteAuditReportViewer__TopBar",componentId:"sc-1e4d1is-1"})` 20154 flex-shrink: 0; 20155 display: flex; 20156 align-items: center; 20157 justify-content: space-between; 20158 padding: 0.65rem 1.5rem; 20159 border-bottom: 1px solid ${zi}; 20160 background: ${Oi}; 20161 z-index: 10; 20162`,R4=p.div.withConfig({displayName:"SiteAuditReportViewer__TopBarLeft",componentId:"sc-1e4d1is-2"})` 20163 display: flex; 20164 align-items: center; 20165 gap: 1rem; 20166 min-width: 0; 20167`,O4=p.div.withConfig({displayName:"SiteAuditReportViewer__TopBarRight",componentId:"sc-1e4d1is-3"})` 20168 display: flex; 20169 align-items: center; 20170 gap: 0.5rem; 20171 flex-shrink: 0; 20172`,D4=p.button.withConfig({displayName:"SiteAuditReportViewer__ExitBtn",componentId:"sc-1e4d1is-4"})` 20173 display: inline-flex; 20174 align-items: center; 20175 gap: 0.35rem; 20176 padding: 0.4rem 0.85rem; 20177 border-radius: 0.5rem; 20178 font-size: 0.78rem; 20179 font-weight: 800; 20180 color: ${fi}; 20181 background: ${Oi}; 20182 border: 1px solid ${zi}; 20183 cursor: pointer; 20184 &:hover { background: #f9fafb; } 20185`,$St=p.span.withConfig({displayName:"SiteAuditReportViewer__ReportTitle",componentId:"sc-1e4d1is-5"})` 20186 font-size: 0.85rem; 20187 font-weight: 850; 20188 color: ${Vn}; 20189 white-space: nowrap; 20190 overflow: hidden; 20191 text-overflow: ellipsis; 20192 max-width: 300px; 20193`,ISt=p.span.withConfig({displayName:"SiteAuditReportViewer__SlideCounter",componentId:"sc-1e4d1is-6"})` 20194 font-size: 0.78rem; 20195 font-weight: 800; 20196 color: ${Nn}; 20197 font-variant-numeric: tabular-nums; 20198`,L4=p.button.withConfig({displayName:"SiteAuditReportViewer__IconBtn",componentId:"sc-1e4d1is-7"})` 20199 display: inline-flex; 20200 align-items: center; 20201 justify-content: center; 20202 width: 32px; 20203 height: 32px; 20204 border-radius: 0.5rem; 20205 border: 1px solid ${zi}; 20206 background: ${e=>e.$active?mi:Oi}; 20207 color: ${e=>e.$active?"#fff":fi}; 20208 cursor: pointer; 20209 &:disabled { opacity: 0.35; cursor: default; } 20210 &:hover:not(:disabled) { background: ${e=>e.$active?mi:"#f9fafb"}; } 20211`,PSt=p.div.withConfig({displayName:"SiteAuditReportViewer__ProgressBar",componentId:"sc-1e4d1is-8"})` 20212 height: 3px; 20213 background: ${zi}; 20214 flex-shrink: 0; 20215 position: relative; 20216`,ASt=p.div.withConfig({displayName:"SiteAuditReportViewer__ProgressFill",componentId:"sc-1e4d1is-9"})` 20217 height: 100%; 20218 background: ${mi}; 20219 width: ${e=>e.$pct}%; 20220 transition: width 0.4s ease; 20221`,NSt=Tn` 20222 from { width: 0%; } 20223 to { width: 100%; } 20224`,zSt=p.div.withConfig({displayName:"SiteAuditReportViewer__AutoplayFill",componentId:"sc-1e4d1is-10"})` 20225 position: absolute; 20226 top: 0; 20227 left: 0; 20228 height: 100%; 20229 background: ${mi}; 20230 opacity: 0.45; 20231 animation: ${NSt} ${e=>e.$duration}ms linear; 20232 animation-play-state: ${e=>e.$running?"running":"paused"}; 20233 animation-fill-mode: forwards; 20234`,TSt=p.div.withConfig({displayName:"SiteAuditReportViewer__SlideArea",componentId:"sc-1e4d1is-11"})` 20235 flex: 1; 20236 overflow-y: auto; 20237 padding: 2rem 3.5rem 1rem; 20238 background-image: 20239 radial-gradient(circle, #c5c9d0 0.6px, transparent 0.6px), 20240 radial-gradient(circle, #c5c9d0 0.6px, transparent 0.6px); 20241 background-size: 20px 20px; 20242 background-position: 0 0, 10px 10px; 20243 @media (max-width: 1024px) { padding: 1.5rem 2rem; } 20244 @media (max-width: 768px) { padding: 1.25rem 1rem; } 20245`,ESt=p.div.withConfig({displayName:"SiteAuditReportViewer__SlideInner",componentId:"sc-1e4d1is-12"})` 20246 max-width: 1100px; 20247 margin: 0 auto; 20248`,MSt=p.footer.withConfig({displayName:"SiteAuditReportViewer__FooterBar",componentId:"sc-1e4d1is-13"})` 20249 flex-shrink: 0; 20250 display: flex; 20251 align-items: center; 20252 justify-content: space-between; 20253 padding: 0.85rem 2rem; 20254 background: ${e=>e.$bg||"#111827"}; 20255`,RSt=p.div.withConfig({displayName:"SiteAuditReportViewer__FooterLeft",componentId:"sc-1e4d1is-14"})` 20256 display: flex; 20257 align-items: center; 20258 gap: 0.75rem; 20259`,OSt=p.div.withConfig({displayName:"SiteAuditReportViewer__FooterRight",componentId:"sc-1e4d1is-15"})` 20260 display: flex; 20261 align-items: center; 20262 gap: 1rem; 20263`,GZ=p.span.withConfig({displayName:"SiteAuditReportViewer__FooterPowered",componentId:"sc-1e4d1is-16"})` 20264 font-size: 0.65rem; 20265 font-weight: 800; 20266 letter-spacing: 0.14em; 20267 text-transform: uppercase; 20268 color: rgba(255, 255, 255, 0.45); 20269`,DSt=p.span.withConfig({displayName:"SiteAuditReportViewer__FooterPage",componentId:"sc-1e4d1is-17"})` 20270 font-size: 0.78rem; 20271 font-weight: 800; 20272 color: rgba(255, 255, 255, 0.5); 20273 font-variant-numeric: tabular-nums; 20274`,LSt=Tn`from { transform: rotate(0deg); } to { transform: rotate(360deg); }`,BSt=p.div.withConfig({displayName:"SiteAuditReportViewer__SpinnerWrap",componentId:"sc-1e4d1is-18"})` 20275 flex: 1; 20276 display: flex; 20277 align-items: center; 20278 justify-content: center; 20279 color: ${Nn}; 20280 & > svg { animation: ${LSt} 1s linear infinite; } 20281`,VZ=p.div.withConfig({displayName:"SiteAuditReportViewer__EmptyState",componentId:"sc-1e4d1is-19"})` 20282 display: flex; 20283 align-items: center; 20284 justify-content: center; 20285 min-height: 200px; 20286 font-size: 1rem; 20287 font-weight: 700; 20288 color: ${Nn}; 20289 text-align: center; 20290 padding: 2rem; 20291`;
20291function FSt(){return[cCt(),fCt(),hSt(),yCt(),PCt(),LCt(),qCt(),YCt(),ZCt(),iSt(),_St(),kSt()]}const KZ=8e3;function Rue({data:e,loading:n,error:i,footerColor:r,onExit:o,topBarExtra:s}){const[a,c]=yr(),[u,m]=l.useState(!1),h=l.useRef(null),g=l.useMemo(()=>FSt(),[]),x=l.useMemo(()=>{const S=parseInt(a.get("slide")||"",10);return Number.isFinite(S)?Math.max(0,Math.min(S-1,g.length-1)):0},[]),[y,w]=l.useState(x),j=l.useCallback(S=>{const I=Math.max(0,Math.min(S,g.length-1));w(I),c(A=>{const E=new URLSearchParams(A);return E.set("slide",String(I+1)),E},{replace:!0})},[g.length,c]),v=l.useCallback(()=>j(y+1),[j,y]),_=l.useCallback(()=>j(y-1),[j,y]);l.useEffect(()=>{function S(I){(I.key==="ArrowRight"||I.key===" ")&&(I.preventDefault(),v()),I.key==="ArrowLeft"&&(I.preventDefault(),_()),I.key==="Escape"&&o&&o()}return window.addEventListener("keydown",S),()=>window.removeEventListener("keydown",S)},[v,_,o]),l.useEffect(()=>{if(h.current&&clearInterval(h.current),!!u)return h.current=window.setInterval(()=>{w(S=>{const I=S+1>=g.length?0:S+1;return c(A=>{const E=new URLSearchParams(A);return E.set("slide",String(I+1)),E},{replace:!0}),I})},KZ),()=>{h.current&&clearInterval(h.current)}},[u,g.length,c]);const $=g.length>1?(y+1)/g.length*100:100;if(n)return t.jsxs(E4,{children:[t.jsxs(M4,{children:[t.jsx(R4,{children:o&&t.jsxs(D4,{onClick:o,children:[t.jsx(Ei,{size:14})," Exit"]})}),t.jsx(O4,{})]}),t.jsx(BSt,{children:t.jsx(Tr,{size:32})})]});if(i||!e)return t.jsxs(E4,{children:[t.jsxs(M4,{children:[t.jsx(R4,{children:o&&t.jsxs(D4,{onClick:o,children:[t.jsx(Ei,{size:14})," Exit"]})}),t.jsx(O4,{})]}),t.jsx(VZ,{style:{flex:1},children:i||"Failed to load report data."})]});const k=g[y],P=e.white_label&&r||void 0;return t.jsxs(E4,{children:[t.jsxs(M4,{children:[t.jsxs(R4,{children:[o&&t.jsxs(D4,{onClick:o,children:[t.jsx(Ei,{size:14})," Exit"]}),t.jsx(By,{logoUrl:e.project.logo_url,size:24}),t.jsxs($St,{children:[e.project.name," â Site Audit Report"]})]}),t.jsxs(O4,{children:[s,t.jsxs(ISt,{children:[y+1," / ",g.length]}),t.jsx(L4,{onClick:_,disabled:y<=0,title:"Previous slide",children:t.jsx(Bd,{size:16})}),t.jsx(L4,{onClick:v,disabled:y>=g.length-1,title:"Next slide",children:t.jsx(Gi,{size:16})}),t.jsx(L4,{$active:u,onClick:()=>m(S=>!S),title:u?"Pause autoplay":"Start autoplay",children:u?t.jsx(Fne,{size:14}):t.jsx(eh,{size:14})})]})]}),t.jsxs(PSt,{children:[t.jsx(ASt,{$pct:$}),u&&t.jsx(zSt,{$duration:KZ,$running:u},`ap-${y}`)]}),k?.fullBleed?t.jsx("div",{style:{flex:1,minHeight:0,overflowY:"auto",display:"flex",flexDirection:"column"},children:t.jsx("div",{style:{flex:1},children:k.render(e)})},k.key):t.jsx(TSt,{children:t.jsx(ESt,{children:k?k.render(e):t.jsx(VZ,{children:"No slide content."})})},k?.key),t.jsxs(MSt,{$bg:P,children:[t.jsx(RSt,{children:e.white_label?t.jsxs(t.Fragment,{children:[t.jsxs(GZ,{children:["Powered by ",e.project.organization_name||"Your Agency"]}),e.project.organization_logo_url&&t.jsx("img",{src:e.project.organization_logo_url,alt:e.project.organization_name||"",height:22,style:{display:"block",borderRadius:4}})]}):t.jsxs(t.Fragment,{children:[t.jsx(GZ,{children:"Powered by Ceyo"}),t.jsx("img",{src:$ue,alt:"Ceyo",height:22,style:{display:"block"}})]})}),t.jsx(OSt,{children:t.jsx(DSt,{children:String(y+1).padStart(2,"0")})})]})]})}const WSt=p.div.withConfig({displayName:"ProjectSiteAuditReportPage__SharePopoverWrap",componentId:"sc-1rqwz5k-0"})` 20292 position: relative; 20293`,USt=p.div.withConfig({displayName:"ProjectSiteAuditReportPage__TopBarActions",componentId:"sc-1rqwz5k-1"})` 20294 display: inline-flex; 20295 align-items: center; 20296 gap: 0.5rem; 20297`,YZ=p.button.withConfig({displayName:"ProjectSiteAuditReportPage__ShareIconBtn",componentId:"sc-1rqwz5k-2"})` 20298 display: inline-flex; 20299 align-items: center; 20300 justify-content: center; 20301 width: 32px; 20302 height: 32px; 20303 border-radius: 0.5rem; 20304 border: 1px solid ${zi}; 20305 background: ${Oi}; 20306 color: ${fi}; 20307 cursor: pointer; 20308 &:hover { background: #f3f4f6; } 20309 &:disabled { opacity: 0.5; cursor: default; } 20310`,HSt=Tn`to { transform: rotate(360deg); }`,qSt=p(Tr).withConfig({displayName:"ProjectSiteAuditReportPage__SpinningLoader",componentId:"sc-1rqwz5k-3"})`animation: ${HSt} 0.8s linear infinite;`,GSt=p.div.withConfig({displayName:"ProjectSiteAuditReportPage__Popover",componentId:"sc-1rqwz5k-4"})` 20311 position: fixed; 20312 top: 50%; 20313 left: 50%; 20314 transform: translate(-50%, -50%); 20315 z-index: 100; 20316 width: min(420px, calc(100vw - 2rem)); 20317 max-height: 80vh; 20318 overflow-y: auto; 20319 padding: 0.75rem 1rem; 20320 background: #ffffff; 20321 border: 1px solid #e5e7eb; 20322 border-radius: 0.75rem; 20323 box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12); 20324 20325 --color-white: #ffffff; 20326 --color-gray-900: #111827; 20327 --color-gray-500: #6b7280; 20328 --color-gray-400: #9ca3af; 20329 --color-gray-200: #e5e7eb; 20330 --color-gray-100: #f3f4f6; 20331 --color-brand-50: #eef2ff; 20332 --color-brand-600: #4f46e5; 20333 --color-brand-700: #4338ca; 20334 --color-brand-800: #3730a3; 20335`,VSt=p.div.withConfig({displayName:"ProjectSiteAuditReportPage__PopoverBackdrop",componentId:"sc-1rqwz5k-5"})` 20336 position: fixed; 20337 inset: 0; 20338 z-index: 99; 20339 background: rgba(0, 0, 0, 0.15); 20340`;function KSt(){const{workspaceId:e,projectId:n}=Gn(),i=zn(),[r]=yr(),{user:o}=yn(),[s,a]=l.useState(null),[c,u]=l.useState(!0),[m,h]=l.useState(null),[g,x]=l.useState(!1),[y,w]=l.useState(!1),{showToast:j}=Uo(),v=r.get("white_label"),_=r.get("footer_color"),$=l.useMemo(()=>{const T=Number(e);return o?.organizations?.find(M=>M.id===T)||null},[o,e]),k=$?.role||null;l.useEffect(()=>{const T=Number(e),M=Number(n);if(!T||!M)return;let R=!1;return u(!0),h(null),(async()=>{try{const F=new URLSearchParams;v==="1"&&F.set("white_label","1");const Y=F.toString()?`?${F.toString()}`:"",H=await ue(`/api/v1/organizations/${T}/projects/${M}/site_audit_report${Y}`),U=await H.json().catch(()=>({}));if(!H.ok)throw new Error(U?.error||"Failed to load site audit report");if(R)return;a(U)}catch(F){if(R)return;h(F?.message||"Failed to load site audit report")}finally{R||u(!1)}})(),()=>{R=!0}},[e,n,v]);const P=l.useCallback(()=>
20340i(`/workspaces/${e}/projects/${n}/site-audit`),[i,e,n]),S=k==="owner"||k==="editor",I=k==="owner",A=!!$?.report_white_label,E=l.useCallback(async()=>{const T=Number(e),M=Number(n);if(!(!T||!M||!s||y)){w(!0);try{const R=new URLSearchParams;v==="1"&&R.set("white_label","1"),_&&R.set("footer_color",_);const F=R.toString()?`?${R.toString()}`:"",Y=await ue(`/api/v1/organizations/${T}/projects/${M}/site_audit_report/pdf${F}`);if(!Y.ok){const oe=await Y.json().catch(()=>({}));throw new Error(oe?.error||"Failed to generate site audit PDF")}const H=await Y.blob(),U=URL.createObjectURL(H),X=s.project.name.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||"project",Q=(s.audit_snapshot_at||s.generated_at||"").slice(0,10),[K,G,L]=Q.split("-"),q=K&&G&&L?`-${L}-${G}-${K}`:"",W=document.createElement("a");W.href=U,W.download=`${X}-site-audit-report${q}.pdf`,document.body.appendChild(W),W.click(),W.remove(),window.setTimeout(()=>URL.revokeObjectURL(U),1e3),j("Site audit PDF downloaded.",{tone:"success"})}catch(R){const F=R instanceof Error?R.message:"Failed to generate site audit PDF";j(F,{tone:"error"})}finally{w(!1)}}},[s,y,_,n,j,v,e]),B=t.jsxs(USt,{children:[t.jsx(YZ,{onClick:E,disabled:y||c||!s,title:y?"Generating site audit PDFâ¦":"Download site audit PDF","aria-label":y?"Generating site audit PDF":"Download site audit PDF","aria-busy":y,children:y?t.jsx(qSt,{size:15}):t.jsx(wy,{size:15})}),S&&t.jsxs(WSt,{children:[t.jsx(YZ,{onClick:()=>x(T=>!T),title:"Share report",children:t.jsx(Z8,{size:15})}),g&&t.jsxs(t.Fragment,{children:[t.jsx(VSt,{onClick:()=>x(!1)}),t.jsx(GSt,{children:t.jsx(PP,{workspaceId:String(e),projectId:String(n),whiteLabelEnabled:A,isOwner:I,orgLogoUrl:$?.logo_url,collapsible:!1,reportType:"site_audit"})})]})]})]});return t.jsx(Rue,{data:s,loading:c,error:m,footerColor:_?decodeURIComponent(_):void 0,onExit:P,topBarExtra:B})}function YSt(){const{token:e}=Gn(),[n,i]=l.useState(null),[r,o]=l.useState(!0),[s,a]=l.useState(null),[c,u]=l.useState();return l.useEffect(()=>{if(!e)return;let m=!1;return o(!0),a(null),(async()=>{try{const h=Td(),g=await fetch(`${h}/api/v1/shared_site_audit_reports/${e}`),x=await g.json().catch(()=>({}));if(!g.ok)throw new Error(x?.error||"This report link has expired or been revoked.");if(m)return;x.footer_color&&u(x.footer_color),i(x)}catch(h){if(m)return;a(h?.message||"This report link has expired or been revoked.")}finally{m||o(!1)}})(),()=>{m=!0}},[e]),t.jsx(Rue,{data:n,loading:r,error:s,footerColor:c})}const XSt=p.textarea.withConfig({displayName:"ProjectSettingsGeneral__TextArea",componentId:"sc-ptqmob-0"})` 20341 width: 100%; 20342 min-height: 96px; 20343 max-height: 256px; 20344 resize: vertical; 20345 border: 1px solid ${Rt}; 20346 border-radius: 0.375rem; 20347 padding: 0.75rem; 20348 font-size: 0.875rem; 20349 background: ${Z}; 20350 color: ${O}; 20351 line-height: 1.5; 20352 font-family: inherit; 20353 20354 &:focus { 20355 outline: none; 20356 border-color: ${z}; 20357 box-shadow: 0 0 0 3px ${En}; 20358 } 20359`,XZ=p.div.withConfig({displayName:"ProjectSettingsGeneral__LabelRow",componentId:"sc-ptqmob-1"})` 20360 display: inline-flex; 20361 align-items: center; 20362 gap: 0.5rem; 20363`,QZ=p.span.withConfig({displayName:"ProjectSettingsGeneral__AIBadge",componentId:"sc-ptqmob-2"})` 20364 display: inline-flex; 20365 align-items: center; 20366 justify-content: center; 20367 width: 1.2rem; 20368 height: 1.2rem; 20369 border-radius: 999px; 20370 border: 1px solid ${V}; 20371 background: ${$e}; 20372 color: ${z}; 20373`;function QSt(){const e=zn(),{workspaceId:n,projectId:i}=Gn(),{projects:r,selectedProjectId:o,setSelectedProjectId:s,updateProject:a,removeProject:c,countriesLimit:u}=Mr(),{user:m}=yn(),h=l.useMemo(()=>{const zt=Number(n);return Number.isFinite(zt)&&zt>0?zt:null},[n]),g=l.useMemo(()=>{const zt=Number(i);return Number.isFinite(zt)&&zt>0?zt:null},[i]),x=l.useMemo(()=>g?r.find(zt=>zt.id===g):null,[g,r]),y=l.useMemo(()=>h&&m?.organizations?.find(zt=>Number(zt.id)===Number(h))?.role||null,[m?.organizations,h]),w=l.useMemo(()=>u===1,[u]),[j,v]=l.useState(!1),_=l.useMemo(()=>w?y==="owner"?t.jsxs(t.Fragment,{children:["Location changes are locked on your plan. ",t.jsx("button",{onClick:()=>v(!0),style:{color:"inherit",fontWeight:850,textDecoration:"underline",background:"none",border:"none",padding:0,font:"inherit",curs
20373or:"pointer"},children:"Upgrade your plan"})," to unlock."]}):"Location changes are locked on your plan. Ask your workspace owner to upgrade.":"",[w,y]);l.useEffect(()=>{g&&r.some(zt=>zt.id===g)&&o!==g&&s(g)},[g,r,o,s]);const[$,k]=l.useState(""),[P,S]=l.useState(""),[I,A]=l.useState(""),[E,B]=l.useState([]),[T,M]=l.useState(!1),[R,F]=l.useState(""),[Y,H]=l.useState([]),[U,X]=l.useState(null),[Q,K]=l.useState(!1),[G,L]=l.useState(null),[q,W]=l.useState(""),[oe,se]=l.useState(""),[de,le]=l.useState([]),[me,ee]=l.useState(""),[ne,Ae]=l.useState(""),[_e,we]=l.useState([]),[Ke,ce]=l.useState(""),[ie,Re]=l.useState(!1),[Be,tt]=l.useState(null),[dt,je]=l.useState(!1),Me=l.useMemo(()=>Be?URL.createObjectURL(Be):dt?null:x?.logo_url||null,[Be,x?.logo_url,dt]);l.useEffect(()=>{if(!Be)return;const zt=URL.createObjectURL(Be);return()=>URL.revokeObjectURL(zt)},[Be]);const[Se,it]=l.useState(null),[De,te]=l.useState(null),[ge,Je]=l.useState(null),[Ee,Xe]=l.useState(null),[yt,Ne]=l.useState(null),[Le,Ue]=l.useState(null),[We,Qe]=l.useState(null),[ht,pe]=l.useState(null),[be,rt]=l.useState(null),[ze,lt]=l.useState(null),[vt,Wt]=l.useState(!1),[Qt,Yt]=l.useState(!1),[Zt,tn]=l.useState(!1),[nn,xn]=l.useState(!1),[st,Ct]=l.useState(!1);l.useEffect(()=>{if(!Se)return;const zt=window.setTimeout(()=>it(null),5e3);return()=>window.clearTimeout(zt)},[Se]),l.useEffect(()=>{if(!ge)return;const zt=window.setTimeout(()=>Je(null),5e3);return()=>window.clearTimeout(zt)},[ge]),l.useEffect(()=>{if(!yt)return;const zt=window.setTimeout(()=>Ne(null),5e3);return()=>window.clearTimeout(zt)},[yt]),l.useEffect(()=>{if(!We)return;const zt=window.setTimeout(()=>Qe(null),5e3);return()=>window.clearTimeout(zt)},[We]),l.useEffect(()=>{if(!be)return;const zt=window.setTimeout(()=>rt(null),5e3);return()=>window.clearTimeout(zt)},[be]);const[Ie,ae]=l.useState("");l.useEffect(()=>{if(it(null),te(null),Je(null),Xe(null),Ne(null),Ue(null),Qe(null),pe(null),rt(null),lt(null),!x)return;k(x.name||""),S(x.website||""),A(x.description||""),ae(x.custom_identifier||""),B(Array.isArray(x?.brand_aliases)?x.brand_aliases.map(un=>String(un||"").trim()).filter(Boolean):[]);const zt=x.city||"",dn=x.country||"",rn=x.country_code||"";if(dn){const un={name:zt||"",country:dn,country_code:rn||void 0,state:x.state||void 0,address:x.address||void 0,postal_code:x.postal_code||void 0,latitude:x.latitude??void 0,longitude:x.longitude??void 0,google_place_id:x.google_place_id||void 0};F(zt?`${zt}, ${dn}`:dn),X(un)}else F(""),X(null);const bn=x.language||"";W(bn),se(bn&&z6(bn)?.name||"");const kt=x.action_language||"";ee(kt),Ae(kt&&z6(kt)?.name||"");const Kt=x.focus||"";ce(Kt==="global"||Kt==="country"||Kt==="region"||Kt==="city"?Kt:""),Re(!!x.local_mode),tt(null),je(!1)},[x?.id]),l.useEffect(()=>{if(U){H([]),L(null);return}if(!R||R.length<2){H([]),L(null);return}const zt=window.setTimeout(async()=>{K(!0),L(null);try{const rn=(await Jb(R)).map(bn=>{const Kt=String(bn?.place_type||"")==="Country"||!bn.name&&!bn.state&&!!bn.country_code,un=String(bn.name||bn.state||bn.country||"Unknown"),pn=Kt?[bn.country]:[un,bn.country];return!Kt&&bn.state&&bn.name&&pn.splice(1,0,bn.state),{value:Kt?bn.country:`${un}, ${bn.country}`,label:pn.join(", "),data:{name:Kt?"":String(bn.name||bn.state||un),country:bn.country,country_code:bn.country_code,state:bn.state,place_id:bn.place_id,lat:bn.lat,lon:bn.lon}}});H(rn),rn.length===0&&R.length>=2&&L("No results found")}catch{H([]),L("Location data unavailable")}finally{K(!1)}},300);return()=>window.clearTimeout(zt)},[R,U]),l.useEffect(()=>{le(Bo.map(zt=>({value:zt.iso639_1,label:zt.name})))},[]),l.useEffect(()=>{if(!oe){le(Bo.map(rn=>({value:rn.iso639_1,label:rn.name})));return}const zt=oe.toLowerCase(),dn=Bo.filter(rn=>rn.name.toLowerCase().includes(zt));le(dn.map(rn=>({value:rn.iso639_1,label:rn.name})))},[oe]),l.useEffect(()=>{if(!ne){we(Bo.map(rn=>({value:rn.iso639_1,label:rn.name})));return}const zt=ne.toLowerCase(),dn=Bo.filter(rn=>rn.name.toLowerCase().includes(zt));we(dn.map(rn=>({value:rn.iso639_1,label:rn.name})))},[ne]);const Fe=!!(h&&g&&x)&&$.trim().length>
203730,Ge=!!(h&&g&&x)&&!!U?.country&&!!U?.country_code&&!!q&&!!Ke&&(Ke!=="city"||!!U?.name),wt=!!(h&&g&&x),ke=!!(h&&g&&x),Ve=!!(h&&g&&x),pt=async()=>{if(!(!h||!g)&&!(!Fe||vt)){if(te(null),it(null),I.trim().length>ni.projectDescriptionMaxChars){te(`Description is too long (max ${ni.projectDescriptionMaxChars} characters).`);return}Wt(!0);try{const zt=!!Be||dt,dn=await(async()=>{if(zt){const bn=new FormData;return bn.append("name",$.trim()),bn.append("description",I),dt&&bn.append("remove_logo","true"),Be&&bn.append("logo",Be),ue(`/api/v1/organizations/${h}/projects/${g}`,{method:"PATCH",body:bn})}return ue(`/api/v1/organizations/${h}/projects/${g}`,{method:"PATCH",body:JSON.stringify({name:$.trim(),description:I})})})(),rn=await dn.json().catch(()=>({}));if(!dn.ok)throw new Error(rn?.error||rn?.errors?.[0]||"Failed to update project");it("Saved."),tt(null),je(!1),rn?.project&&a(rn.project)}catch(zt){te(zt?.message||"Failed to save")}finally{Wt(!1)}}},Nt=async()=>{if(!(!h||!g)&&!(!Ge||Qt)){Xe(null),Je(null),Yt(!0);try{const zt={city:U?.name||"",state:U?.state||"",country:U?.country||"",country_code:U?.country_code||"",address:U?.address||"",postal_code:U?.postal_code||"",latitude:U?.latitude??null,longitude:U?.longitude??null,google_place_id:U?.google_place_id||"",language:q,focus:Ke,local_mode:ie},dn=await ue(`/api/v1/organizations/${h}/projects/${g}`,{method:"PATCH",body:JSON.stringify(zt)}),rn=await dn.json().catch(()=>({}));if(!dn.ok)throw new Error(rn?.error||rn?.errors?.[0]||"Failed to update project");Je("Saved."),rn?.project&&a(rn.project)}catch(zt){Xe(zt?.message||"Failed to save")}finally{Yt(!1)}}},qe=async()=>{if(!(!h||!g)&&!(!wt||nn)){pe(null),Qe(null),xn(!0);try{const zt=Ie.toString().trim(),dn=await ue(`/api/v1/organizations/${h}/projects/${g}`,{method:"PATCH",body:JSON.stringify({custom_identifier:zt.length?zt:null})}),rn=await dn.json().catch(()=>({}));if(!dn.ok)throw new Error(rn?.error||rn?.errors?.[0]||"Failed to update project");Qe("Saved."),rn?.project&&a(rn.project)}catch(zt){pe(zt?.message||"Failed to save")}finally{xn(!1)}}},qt=async()=>{if(!(!h||!g)&&!(!ke||Zt)){if(Ue(null),Ne(null),ne.trim()&&!me){Ue("Choose a language from the list, or clear the field to inherit the project language.");return}tn(!0);try{const zt=await ue(`/api/v1/organizations/${h}/projects/${g}`,{method:"PATCH",body:JSON.stringify({action_language:me||null})}),dn=await zt.json().catch(()=>({}));if(!zt.ok)throw new Error(dn?.error||dn?.errors?.[0]||"Failed to update action language");Ne("Saved."),dn?.project&&a(dn.project)}catch(zt){Ue(zt?.message||"Failed to save")}finally{tn(!1)}}},Mn=async()=>{if(!(!h||!g)&&!st){te(null),it(null),Ct(!0);try{const zt=await ue(`/api/v1/organizations/${h}/projects/${g}`,{method:"DELETE"}),dn=await zt.json().catch(()=>({}));if(!zt.ok)throw new Error(dn?.error||dn?.errors?.[0]||"Failed to delete project");e(`/workspaces/${h}`,{replace:!0}),setTimeout(()=>c(g),0)}catch(zt){te(zt?.message||"Failed to delete project")}finally{Ct(!1)}}};return t.jsxs(ma,{children:[t.jsxs(Kc,{children:[t.jsxs(Ys,{children:[t.jsxs(ha,{children:[t.jsx(fa,{children:"Project settings"}),t.jsx("div",{style:{paddingRight:8,minWidth:0}
20373,children:t.jsx(qr,{items:[{label:"Projects",to:n?`/workspaces/${n}`:void 0},{label:x?.name||"Project",to:n&&i?`/workspaces/${n}/projects/${i}`:void 0},{label:"Settings",to:n&&i?`/workspaces/${n}/projects/${i}/settings`:void 0},{label:"General"}]})})]}),t.jsx(ga,{children:"Manage this projectâs profile and defaults."})]}),t.jsxs(Ar,{children:[t.jsx(Zr,{children:t.jsxs("div",{style:{minWidth:0},children:[t.jsxs(Wr,{children:[t.jsx(Bc,{size:18}),t.jsx(Ur,{children:"Profile"})]}),t.jsx(Hr,{children:"Update your project name, description, and logo."})]})}),Se?t.jsx(hr,{$variant:"success",children:Se}):null,De?t.jsx(hr,{$variant:"error",children:De}):null,t.jsxs(Bl,{children:[t.jsxs(Bn,{children:[t.jsx(ii,{htmlFor:"project-name",children:"Name"}),t.jsx(Xt,{id:"project-name",value:$,onChange:zt=>k(zt.target.value),placeholder:"Project name",leftIcon:t.jsx(Gxe,{size:16}),disabled:!x}),t.jsxs(t.Fragment,{children:[t.jsxs("div",{style:{marginTop:8,display:"flex",alignItems:"center",gap:10,flexWrap:"wrap"},children:[t.jsx(he,{type:"button",size:"sm",variant:"outline",disabled:!Ve,onClick:()=>{lt(null),rt(null),M(!0)},children:"Manage aliases"}),t.jsx("span",{style:{fontSize:12,fontWeight:800,color:z},children:E.length>0?`${E.length} alias${E.length===1?"":"es"}`:"No aliases"})]}),ze?t.jsx("div",{style:{marginTop:6,fontSize:12,fontWeight:800,color:"var(--color-red-500)"},children:ze}):null,be?t.jsx("div",{style:{marginTop:6,fontSize:12,fontWeight:900,color:"var(--color-green-700)"},children:be}):null]})]}),t.jsxs(Bn,{children:[t.jsx(ii,{htmlFor:"project-website",children:"Website"}),t.jsx(RM,{children:t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem",minWidth:0},children:[t.jsx(To,{size:16,color:z}),t.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:P||"â"})]})}),t.jsx(Gs,{children:"This is set when the project is created and canât be changed."})]})]}),t.jsxs(Bn,{children:[t.jsx(ii,{htmlFor:"project-description",children:t.jsxs(XZ,{children:["Description",x?.description_autofetched?t.jsx(at,{content:"We generated this automatically from your website. Edit it once to make it fully yours.",children:t.jsx(QZ,{"aria-label":"AI generated description",children:t.jsx(Sn,{size:14})})}):null]})}),t.jsx(XSt,{id:"project-description",value:I,onChange:zt=>A(zt.target.value),placeholder:"Short description (optional)",disabled:!x,maxLength:ni.projectDescriptionMaxChars}),I.length>=ni.projectDescriptionMaxChars?t.jsxs(Gs,{children:["Description is limited to ",ni.projectDescriptionMaxChars," characters."]}):null]}),t.jsx(Z5,{}),t.jsxs(Bn,{children:[t.jsx(ii,{children:t.jsxs(XZ,{children:["Logo",x?.logo_autofetched?t.jsx(at,{content:"We fetched this automatically from your website. Upload/remove to override.",children:t.jsx(QZ,{"aria-label":"Auto-fetched logo",children:t.jsx(Sn,{size:14})})}):null]})}),t.jsx(FO,{previewUrl:Me,disabled:!x,hasLogo:!!(x?.logo_url||Be)&&!dt,previewAriaLabel:"Project logo preview",previewAlt:"Project logo",onPickFile:zt=>{tt(zt),je(!1)},onRemove:()=>{tt(null),je(!0)}})]}),t.jsx(ey,{children:t.jsx(he,{type:"button",size:"sm",disabled:!Fe||vt,onClick:pt,children:vt?"Savingâ¦":"Save changes"})})]}),t.jsxs(Ar,{children:[t.jsx(Zr,{children:t.jsxs("div",{style:{minWidth:0},children:[t.jsxs(Wr,{children:[t.jsx($P,{size:18}),t.jsx(Ur,{children:"Targeting"})]}),t.jsx(Hr,{children:"Set location, language, and focus."})]})}),ge?t.jsx(hr,{$variant:"success",children:ge}):null,Ee?t.jsx(hr,{$variant:"error",children:Ee}):null,t.jsxs(Bl,{children:[t.jsxs(Bn,{children:[t.jsx(ii,{children:"Location"}),t.jsx(at,{content:_,disabled:!w,children:t.jsx("span",{style:{display:"block"},children:t.jsx(_u,{value:R,onChange:zt=>{F(zt),X(null)},onSelect:async zt=>{const dn=zt;F(dn.label);const rn={name:dn.data.name,country:dn.data.country,country_code:dn.data.country_code,state:dn.data.state,latitude:dn.data.lat,longitude:dn.data.lon,google_place_id:dn.data.place_id};if(X(rn),dn.data.place_id){const bn=await Iet(dn.data.place_id);
20373if(bn){const kt=[bn.address_number,bn.street].filter(Boolean);X(Kt=>Kt&&{...Kt,address:kt.join(" ")||void 0,state:bn.state||Kt.state,postal_code:bn.postal_code||void 0,latitude:bn.latitude??Kt.latitude,longitude:bn.longitude??Kt.longitude})}}},placeholder:"City or country",leftIcon:t.jsx(_y,{size:16}),options:Y,isLoading:Q,disabled:!x||w})})}),G?t.jsx("div",{style:{marginTop:"0.25rem",fontSize:"0.75rem",color:"var(--color-red-500)"},children:G}):null]}),t.jsxs(Bn,{children:[t.jsx(ii,{children:"Language"}),t.jsx(_u,{value:oe,onChange:zt=>{se(zt);const dn=Bo.find(rn=>rn.name.toLowerCase()===zt.toLowerCase());W(dn?dn.iso639_1:"")},onSelect:zt=>{W(zt.value),se(zt.label)},placeholder:"Search language",leftIcon:t.jsx(VN,{size:16}),options:de,disabled:!x})]})]}),t.jsxs(Bn,{children:[t.jsx(ii,{children:"Focus"}),t.jsx(WO,{value:Ke,onChange:zt=>ce(zt),disabled:!x})]}),t.jsx(Z5,{}),t.jsx(Bn,{children:t.jsxs("label",{style:{display:"flex",alignItems:"flex-start",gap:"0.625rem",cursor:x?"pointer":"default"},children:[t.jsx("input",{type:"checkbox",checked:ie,onChange:zt=>Re(zt.target.checked),disabled:!x,style:{marginTop:3,accentColor:O}}),t.jsxs("div",{children:[t.jsx("div",{style:{fontSize:"0.875rem",fontWeight:600,color:O},children:"Local mode"}),t.jsx("div",{style:{fontSize:"0.75rem",color:z,marginTop:2,lineHeight:1.4},children:"Generate hyper-targeted prompts, actions, and competitors focused on your project's specific city and area."})]})]})}),t.jsx(ey,{children:t.jsx(he,{type:"button",size:"sm",disabled:!Ge||Qt,onClick:Nt,children:Qt?"Savingâ¦":"Save changes"})})]}),t.jsxs(t.Fragment,{children:[t.jsxs(Ar,{children:[t.jsx(Zr,{children:t.jsxs("div",{style:{minWidth:0},children:[t.jsxs(Wr,{children:[t.jsx(VN,{size:18}),t.jsx(Ur,{children:"Actions"})]}),t.jsx(Hr,{children:"Choose the language used for generated actions and implementation guides."})]})}),yt?t.jsx(hr,{$variant:"success",children:yt}):null,Le?t.jsx(hr,{$variant:"error",children:Le}):null,t.jsxs(Bn,{children:[t.jsx(ii,{children:"Action language"}),t.jsx(_u,{value:ne,onChange:zt=>{Ae(zt);const dn=Bo.find(rn=>rn.name.toLowerCase()===zt.toLowerCase());ee(dn?dn.iso639_1:"")},onSelect:zt=>{ee(zt.value),Ae(zt.label)},placeholder:q?`Inherit project language (${z6(q)?.name||q})`:"Inherit project language",leftIcon:t.jsx(VN,{size:16}),options:_e,disabled:!x}),t.jsx(Gs,{children:"Leave empty to use the project language for new actions. Existing actions are not translated retroactively."})]}),t.jsxs(ey,{children:[t.jsx(he,{type:"button",size:"sm",variant:"outline",disabled:!x||Zt||!me&&!ne,onClick:()=>{ee(""),Ae("")},children:"Use project language"}),t.jsx(he,{type:"button",size:"sm",disabled:!ke||Zt,onClick:qt,children:Zt?"Savingâ¦":"Save changes"})]})]}),t.jsxs(Ar,{children:[t.jsx(Zr,{children:t.jsxs("div",{style:{minWidth:0},children:[t.jsxs(Wr,{children:[t.jsx(g9,{size:18}),t.jsx(Ur,{children:"Identifiers"})]}),t.jsx(Hr,{children:"Set a custom identifier for API lookups."})]})}),We?t.jsx(hr,{$variant:"success",children:We}):null,ht?t.jsx(hr,{$variant:"error",children:ht}):null,t.jsxs(Bn,{children:[t.jsx(ii,{htmlFor:"project-custom-identifier",children:"Custom identifier"}),t.jsx(Xt,{id:"project-custom-identifier",value:Ie,onChange:zt=>ae(zt.target.value),placeholder:"e.g. customer-project-123",disabled:!x,leftIcon:t.jsx(g9,{size:16})}),t.jsx(Gs,{children:"Optional. Must be unique within this workspace."})]}),t.jsx(ey,{children:t.jsx(he,{type:"button",size:"sm",disabled:!wt||nn,onClick:qe,children:nn?"Savingâ¦":"Save changes"})})]})]}),t.jsx("div",{style:{marginTop:"1.25rem"},children:t.jsx(zM,{title:"Danger zone",description:"Deleting a project removes its data and settings.",warningText:"Deleting this project will permanently remove its data. This cannot be undone.",actionLabel:"Delete project",confirmTitle:"Delete project",confirmKeyword:"DELETE",buttonSize:"sm",disabled:!h||!g||st,onConfirm:async()=>{await Mn()}})})]}),t.jsx(s6e,{isOpen:T,onClose:()=>M(!1),workspaceId:h,projectId:g,initialAliases:E,onSaved:({aliases:zt,project:dn})=>{rt("Saved."),lt(null),B(zt),dn&&a(dn)}}),t.jsx(ec,{isOpen:j,orgId:Number(n),onClose:()=>v(!1)})]})}const ZSt=p(Kc).withConfig({displayName:"ProjectSettingsIntegrations__SettingsMaxWide",componentId:"sc-dvitde-0"})` 20374 max-width: 52rem; 20375`,JSt=p.div.withConfig({displayName:"ProjectSettingsIntegrations__CardsGri
20375d",componentId:"sc-dvitde-1"})` 20376 display: grid; 20377 gap: 1rem; 20378`,ekt=p.div.withConfig({displayName:"ProjectSettingsIntegrations__IntegrationPanel",componentId:"sc-dvitde-2"})` 20379 border: 1px solid ${V}; 20380 border-radius: 1rem; 20381 background: ${Z}; 20382 overflow: hidden; 20383`,tkt=p.button.withConfig({displayName:"ProjectSettingsIntegrations__IntegrationToggle",componentId:"sc-dvitde-3"})` 20384 width: 100%; 20385 border: none; 20386 background: transparent; 20387 padding: 1rem 1.1rem; 20388 display: flex; 20389 align-items: flex-start; 20390 justify-content: space-between; 20391 gap: 1rem; 20392 cursor: pointer; 20393 text-align: left; 20394 20395 &:hover { 20396 background: ${At}; 20397 } 20398 20399 &:focus-visible { 20400 outline: none; 20401 box-shadow: inset 0 0 0 2px ${V}; 20402 } 20403 20404 @media (max-width: 640px) { 20405 flex-wrap: wrap; 20406 } 20407`,nkt=p.div.withConfig({displayName:"ProjectSettingsIntegrations__IntegrationToggleMain",componentId:"sc-dvitde-4"})` 20408 min-width: 0; 20409 display: grid; 20410 gap: 0.35rem; 20411`,ikt=p.div.withConfig({displayName:"ProjectSettingsIntegrations__IntegrationToggleTitleRow",componentId:"sc-dvitde-5"})` 20412 display: flex; 20413 align-items: center; 20414 gap: 0.5rem; 20415 color: ${O}; 20416 font-weight: 750; 20417`,rkt=p.div.withConfig({displayName:"ProjectSettingsIntegrations__IntegrationToggleTitle",componentId:"sc-dvitde-6"})` 20418 font-size: 0.95rem; 20419 font-weight: 800; 20420 color: ${O}; 20421`,okt=p.div.withConfig({displayName:"ProjectSettingsIntegrations__IntegrationToggleDescription",componentId:"sc-dvitde-7"})` 20422 color: ${z}; 20423 font-size: 0.8125rem; 20424 line-height: 1.45; 20425`,skt=p.div.withConfig({displayName:"ProjectSettingsIntegrations__IntegrationToggleAffordance",componentId:"sc-dvitde-8"})` 20426 display: inline-flex; 20427 align-items: center; 20428 gap: 0.45rem; 20429 white-space: nowrap; 20430 color: ${z}; 20431 font-size: 0.75rem; 20432 font-weight: 800; 20433 border: 1px solid ${V}; 20434 border-radius: 999px; 20435 padding: 0.4rem 0.65rem; 20436 background: ${Z}; 20437 20438 @media (max-width: 640px) { 20439 margin-left: auto; 20440 } 20441`,akt=p.div.withConfig({displayName:"ProjectSettingsIntegrations__IntegrationCollapse",componentId:"sc-dvitde-9"})` 20442 display: grid; 20443 grid-template-rows: ${e=>e.$open?"1fr":"0fr"}; 20444 transition: grid-template-rows 0.18s ease; 20445`,lkt=p.div.withConfig({displayName:"ProjectSettingsIntegrations__IntegrationCollapseInner",componentId:"sc-dvitde-10"})` 20446 overflow: hidden; 20447`,ckt=p.div.withConfig({displayName:"ProjectSettingsIntegrations__CardBody",componentId:"sc-dvitde-11"})` 20448 border-top: 1px solid ${V}; 20449 display: grid; 20450 gap: 1rem; 20451 padding: 1rem 1.1rem 1.1rem; 20452 min-width: 0; 20453`,Ox=p.button.withConfig({displayName:"ProjectSettingsIntegrations__CopyIconButton",componentId:"sc-dvitde-12"})` 20454 display: inline-flex; 20455 align-items: center; 20456 justify-content: center; 20457 flex-shrink: 0; 20458 width: 1.75rem; 20459 height: 1.75rem; 20460 border: 1px solid ${e=>e.$copied?Vt:V}; 20461 border-radius: 0.375rem; 20462 background: ${Z}; 20463 color: ${e=>e.$copied?Vt:z}; 20464 cursor: pointer; 20465 padding: 0; 20466 transition: color 0.15s, border-color 0.15s; 20467 20468 &:hover:not(:disabled) { 20469 background: ${At}; 20470 color: ${e=>e.$copied?Vt:O}; 20471 } 20472 20473 &:disabled { 20474 opacity: 0.4; 20475 cursor: not-allowed; 20476 } 20477`,dkt=p.ol.withConfig({displayName:"ProjectSettingsIntegrations__Steps",componentId:"sc-dvitde-13"})` 20478 margin: 0; 20479 padding-left: 1.25rem; 20480 display: grid; 20481 gap: 0.5rem; 20482 color: ${z}; 20483 font-size: 0.875rem; 20484`,ukt=p.ul.withConfig({displayName:"ProjectSettingsIntegrations__SubSteps",componentId:"sc-dvitde-14"})` 20485 margin: 0.35rem 0 0; 20486 padding-left: 1rem; 20487 display: grid; 20488 gap: 0.35rem; 20489`,pkt=p.pre.withConfig({displayName:"ProjectSettingsIntegrations__CodeBlock",componentId:"sc-dvitde-15"})` 20490 margin: 0; 20491 padding: 0.75rem; 20492 border: 1px solid ${V}; 20493 border-radius: 0.75rem; 20494 background: ${At}; 20495 color: ${O}; 20496 font-size: 0.75rem; 20497 line-height: 1.45; 20498 white-space: pre-wrap; 20499 overflow-wrap: anywhere; 20500`,mkt=p.div.withConfig({displayName:"ProjectSettingsIntegrations__ValueGrid",componentId:"sc-dvitde-16"})` 20501 display: grid; 20502 gap: 0.875rem; 20503 min-width: 0; 20504 20505 @media (min-width: 768px) { 20506 grid-template-columns: minmax(8rem, auto) minmax(0, 1fr) auto; 20507 } 20508`,ZZ=p.div.withConfig({displayName:"ProjectSettingsIntegrations__ValueCard",componentId:"sc-dvitde-17"})` 20509 display: grid; 20510 gap: 0.5rem; 20511 min-width: 0; 20512`,Dx=p.div.withConfig({displayName:"ProjectSettingsIntegrations__ValueLabel",componentId:"sc-dvitde-18"})` 20513 font-size: 0.75rem; 20514 font-weight: 800; 20515 color: ${z}; 20516 text-transform: uppercase; 20517 letter-spacing: 0.03em; 20518`,Lx=p(RM).withConfig({displayName:"ProjectSettingsIntegrations__ValueBox",componentId:"sc-dvitde-19"})` 20519 background: ${Z}; 20520 color: ${O}; 20521 font-size: 0.8125rem; 20522 display: flex; 20523 align-items: center; 20524 justify-content: space-between; 20525 gap: 0.5rem; 20526 min-height: 2.5rem; 20527 min-width: 0; 20528 padding: 0.5rem 0.65rem; 20529 20530`,Bx=p.div.withConfig({displayName:"ProjectSettingsIntegrations__ValueText",componentId:"sc-dvitde-20"})` 20531 min-width: 0; 20532 overflow: hidden; 20533 text-overflow: ellipsis; 20534 white-space: nowrap; 20535 font-size: 0.8125rem; 20536 20537 @media (max-width: 640px) { 20538 white-space: normal;
20539 overflow-wrap: anywhere; 20540 } 20541`,w2=p.div.withConfig({displayName:"ProjectSettingsIntegrations__InlineNote",componentId:"sc-dvitde-21"})` 20542 color: ${z}; 20543 font-size: 0.75rem; 20544 line-height: 1.45; 20545`,hkt=p.div.withConfig({displayName:"ProjectSettingsIntegrations__PlatformGrid",componentId:"sc-dvitde-22"})` 20546 display: grid; 20547 gap: 0.75rem; 20548 20549 @media (min-width: 760px) { 20550 grid-template-columns: repeat(5, minmax(0, 1fr)); 20551 } 20552`,fkt=p.div.withConfig({displayName:"ProjectSettingsIntegrations__MobilePlatformDetails",componentId:"sc-dvitde-23"})` 20553 display: block; 20554 20555 @media (min-width: 760px) { 20556 display: none; 20557 } 20558`,gkt=p.div.withConfig({displayName:"ProjectSettingsIntegrations__DesktopPlatformDetails",componentId:"sc-dvitde-24"})` 20559 display: none; 20560 20561 @media (min-width: 760px) { 20562 display: block; 20563 } 20564`,ykt=p.button.withConfig({displayName:"ProjectSettingsIntegrations__PlatformButton",componentId:"sc-dvitde-25"})` 20565 border: 1px solid ${e=>e.$active?O:V}; 20566 border-radius: 0.875rem; 20567 background: ${Z}; 20568 padding: 0.875rem; 20569 display: grid; 20570 gap: 0.65rem; 20571 min-width: 0; 20572 cursor: pointer; 20573 text-align: left; 20574 transition: border-color 0.15s, background 0.15s; 20575 20576 &:hover { 20577 border-color: ${O}; 20578 background: ${At}; 20579 } 20580 20581 &:focus-visible { 20582 outline: none; 20583 box-shadow: inset 0 0 0 2px ${O}; 20584 } 20585`,xkt=p.div.withConfig({displayName:"ProjectSettingsIntegrations__PlatformButtonTop",componentId:"sc-dvitde-26"})` 20586 display: flex; 20587 align-items: center; 20588 justify-content: space-between; 20589 gap: 0.5rem; 20590`,bkt=p.span.withConfig({displayName:"ProjectSettingsIntegrations__PlatformIcon",componentId:"sc-dvitde-27"})` 20591 width: 2.125rem; 20592 height: 2.125rem; 20593 border-radius: 999px; 20594 display: inline-grid; 20595 place-items: center; 20596 align-items: center; 20597 justify-content: center; 20598 background: ${Z}; 20599 color: ${O}; 20600 border: 1px solid ${V}; 20601 flex-shrink: 0; 20602 overflow: hidden; 20603`,vkt=p.img.withConfig({displayName:"ProjectSettingsIntegrations__PlatformLogoImg",componentId:"sc-dvitde-28"})` 20604 width: 1.35rem; 20605 height: 1.35rem; 20606 border-radius: 999px; 20607 border: 0; 20608 background: transparent; 20609 object-fit: contain; 20610 display: block; 20611`,wkt=p.span.withConfig({displayName:"ProjectSettingsIntegrations__SetupPill",componentId:"sc-dvitde-29"})` 20612 border-radius: 999px; 20613 border: 1px solid ${e=>e.$active?O:V}; 20614 background: ${e=>e.$active?O:Z}; 20615 color: ${e=>e.$active?Z:z}; 20616 padding: 0.2rem 0.45rem; 20617 font-size: 0.6875rem; 20618 font-weight: 850; 20619 white-space: nowrap; 20620`,jkt=p.div.withConfig({displayName:"ProjectSettingsIntegrations__PlatformName",componentId:"sc-dvitde-30"})` 20621 color: ${O}; 20622 font-size: 0.875rem; 20623 font-weight: 850; 20624`,mj=p.div.withConfig({displayName:"ProjectSettingsIntegrations__PlatformPanel",componentId:"sc-dvitde-31"})` 20625 border: 1px solid ${V}; 20626 border-radius: 1rem; 20627 background: ${Z}; 20628 padding: 1rem; 20629 display: grid; 20630 gap: 1rem; 20631 min-width: 0; 20632`,hj=p.div.withConfig({displayName:"ProjectSettingsIntegrations__PlatformPanelHeader",componentId:"sc-dvitde-32"})` 20633 display: flex; 20634 align-items: flex-start; 20635 justify-content: space-between; 20636 gap: 1rem; 20637 20638 @media (max-width: 640px) { 20639 flex-direction: column; 20640 } 20641`,fj=p.div.withConfig({displayName:"ProjectSettingsIntegrations__PlatformPanelTitle",componentId:"sc-dvitde-33"})` 20642 color: ${O}; 20643 font-size: 0.95rem; 20644 font-weight: 850; 20645`,gj=p.div.withConfig({displayName:"ProjectSettingsIntegrations__PlatformPanelText",componentId:"sc-dvitde-34"})` 20646 color: ${z}; 20647 font-size: 0.875rem; 20648 line-height: 1.5; 20649 margin-top: 0.25rem; 20650`,yj=p.div.withConfig({displayName:"ProjectSettingsIntegrations__ConnectorActions",componentId:"sc-dvitde-35"})` 20651 display: flex; 20652 flex-wrap: wrap; 20653 gap: 0.75rem; 20654 20655 @media (max-width: 640px) { 20656 width: 100%; 20657 20658 > * { 20659 width: 100%; 20660 } 20661 } 20662`,JZ=p.a.withConfig({displayName:"ProjectSettingsIntegrations__ConnectorLink",componentId:"sc-dvitde-36"})` 20663 display: inline-flex; 20664 align-items: center; 20665 justify-content: center; 20666 gap: 0.45rem; 20667 border: 1px solid ${e=>e.$variant==="secondary"?V:O}; 20668 border-radius: 0.5rem; 20669 background: ${e=>e.$variant==="secondary"?Z:O}; 20670 color: ${e=>e.$variant==="secondary"?O:Z}; 20671 min-height: 2rem; 20672 padding: 0.45rem 0.75rem; 20673 font-size: 0.8125rem; 20674 font-weight: 800; 20675 text-decoration: none; 20676 line-height: 1; 20677 20678 &:hover { 20679 background: ${e=>e.$variant==="secondary"?At:O}; 20680 opacity: ${e=>e.$variant==="secondary"?1:.82}; 20681 } 20682`,_kt=p.div.withConfig({displayName:"ProjectSettingsIntegrations__DetailBody",componentId:"sc-dvitde-37"})` 20683 display: grid; 20684 gap: 0.75rem; 20685`,Ckt=p.div.withConfig({displayName:"ProjectSettingsIntegrations__ClaudeOptionGrid",componentId:"sc-dvitde-38"})` 20686 display: grid; 20687 gap: 0.75rem; 20688`,eJ=p.div.withConfig({displayName:"ProjectSettingsIntegrations__ClaudeOption",componentId:"sc-dvitde-39"})` 20689 border: 1px solid ${V}; 20690 border-radius: 0.875rem; 20691 background: ${At}; 20692 padding: 0.875rem; 20693 display: flex; 20694 align-items: flex-start; 20695 justify-content: space-between; 20696 gap: 1rem; 20697 20698 @media (max-width: 640px) { 20699 flex-direction: column; 20700 } 20701`,tJ=p.div.withConfig({displayName:"ProjectSettingsIntegrations__ClaudeOptionMain",componentId:"sc-dvitde-40"})` 20702 display: grid; 20703 gap: 0.35rem; 20704 min-width: 0; 20705`,nJ=p.div.withConfig({displayName:"ProjectSettingsIntegrations__ClaudeOptionTitleRow",componentId:"sc-dvitde-41"})` 20706 display: flex; 20707 align-items: center; 20708 flex-wrap: wrap; 20709 gap: 0.5rem; 20710`,iJ=p.div.withConfig({displayName:"ProjectSettingsIntegrations__ClaudeOptionTitle",componentId:"sc-dvitde-42"})` 20711 color: ${O}; 20712 font-size: 0.875rem; 20713 font-weight: 850; 20714`,rJ=p.div.withConfig({displayName:"ProjectSettingsIntegrations__ClaudeOptionText",componentId:"sc-dvitde-43"})` 20715 color: ${z}; 20716 font-size: 0.8125rem; 20717 line-height: 1.45; 20718`,oJ=p.span.withConfig({displayName:"ProjectSettingsIntegrations__ClaudeOptionBadge",componentId:"sc-dvitde-44"})` 20719 border: 1px solid ${V}; 20720 border-radius: 999px; 20721 background: ${Z}; 20722 color: ${z}; 20723 padding: 0.15rem 0.45rem; 20724 font-size: 0.6875rem; 20725 font-weight: 850; 20726`,Skt=p.div.withConfig({displayName:"ProjectSettingsIntegrations__SetupGri
20726d",componentId:"sc-dvitde-45"})` 20727 display: grid; 20728 gap: 0.75rem; 20729 20730 @media (min-width: 720px) { 20731 grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); 20732 } 20733`,j2=p.div.withConfig({displayName:"ProjectSettingsIntegrations__MiniValue",componentId:"sc-dvitde-46"})` 20734 border: 1px solid ${V}; 20735 border-radius: 0.75rem; 20736 background: ${At}; 20737 padding: 0.75rem; 20738 display: grid; 20739 gap: 0.4rem; 20740 min-width: 0; 20741`;function kkt(){const e=zn(),{workspaceId:n,projectId:i}=Gn(),{user:r}=yn(),{projects:o}=Mr(),[s,a]=l.useState(null),[c,u]=l.useState(!1),[m,h]=l.useState(null),[g,x]=l.useState(!1),[y,w]=l.useState(null),j=l.useRef(null),v=l.useMemo(()=>{const Q=Number(n);return Number.isFinite(Q)&&Q>0?Q:null},[n]),_=l.useMemo(()=>{const Q=Number(i);return Number.isFinite(Q)&&Q>0?Q:null},[i]),$=l.useMemo(()=>_?o.find(Q=>Q.id===_):null,[_,o]),k=l.useMemo(()=>r?.organizations?.find(Q=>Number(Q.id)===Number(v))||null,[r?.organizations,v]),P=k?.role||null,S=!!k?.api_access_enabled,I=!!k?.agents_enabled,A=P==="owner",E=l.useMemo(()=>Td().replace(/\/+$/,""),[]),B=l.useMemo(()=>`${E}/api/public/v1/mcp`,[E]),T=l.useMemo(()=>{const Q="https://www.ceyo.ai/pricing".trim();if(!Q)return"/docs/mcp";try{return`${new URL(Q).origin}/docs/mcp`}catch{return"/docs/mcp"}},[]),M="https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-langchain.mcpClient/",R=l.useMemo(()=>{const Q=JSON.stringify({url:B,headers:{"X-Api-Key":"your_api_key_here"}});return`cursor://anysphere.cursor-deeplink/mcp/install?name=ceyo&config=${encodeURIComponent(btoa(Q))}`},[B]),F=l.useMemo(()=>JSON.stringify({mcpServers:{ceyo:{command:"npx",args:["mcp-remote",B,"--header","X-Api-Key: your_api_key_here"]}}},null,2),[B]),Y=l.useMemo(()=>[{key:"claude",label:"Claude",setup:"Manual",icon:Dy,domain:"anthropic.com"},{key:"chatgpt",label:"ChatGPT",setup:"Manual",icon:Ane,domain:"openai.com"},{key:"n8n",label:"n8n",setup:"Manual",icon:Gne,domain:"n8n.io"},{key:"cursor",label:"Cursor",setup:"Deeplink",icon:V8,domain:"cursor.com"},{key:"other",label:"Other",setup:"Generic",icon:n_,domain:null}],[]),H=l.useCallback(async(Q,K,G)=>{if(Q){a(null);try{await navigator.clipboard.writeText(Q),w(G),j.current&&clearTimeout(j.current),j.current=setTimeout(()=>w(null),1500)}catch{a(`Failed to copy ${K.toLowerCase()}.`)}}},[]),U=Q=>{Q&&window.open(Q,"_blank","noopener,noreferrer")},X=Q=>Q==="chatgpt"?t.jsx(mj,{children:t.jsx(hj,{children:t.jsxs("div",{children:[t.jsx(fj,{children:"ChatGPT"}),t.jsx(gj,{children:"ChatGPT setup requires OAuth support. Coming soon."})]})})}):Q==="claude"?t.jsxs(mj,{children:[t.jsx(hj,{children:t.jsxs("div",{children:[t.jsx(fj,{children:"Connect Ceyo to Claude"}),t.jsx(gj,{children:"Choose where you want to use Claude. You will need a Ceyo workspace API key."})]})}),t.jsxs(Ckt,{children:[t.jsx(eJ,{children:t.jsxs(tJ,{children:[t.jsxs(nJ,{children:[t.jsx(iJ,{children:"Claude.ai"}),t.jsx(oJ,{children:"Coming soon"})]}),t.jsx(rJ,{children:"Remote Claude.ai setup requires OAuth support. Coming soon."})]})}),t.jsxs(eJ,{children:[t.jsxs(tJ,{children:[t.jsxs(nJ,{children:[t.jsx(iJ,{children:"Claude Desktop"}),t.jsx(oJ,{children:"Live"})]}),t.jsx(rJ,{children:"Manual local config. Most users should use Claude.ai above."})]}),t.jsx(yj,{children:t.jsx(he,{type:"button",size:"sm",variant:"outline",onClick:()=>x(K=>!K),leftIcon:g?t.jsx(qn,{size:16}):t.jsx(Gi,{size:16}),children:g?"Hide instructions":"Show instructions"})})]})]}),g?t.jsxs(_kt,{children:[t.jsxs(dkt,{children:[t.jsxs("li",{children:["Create or reuse a workspace API key from ",t.jsx("strong",{children:"Workspace settings â API keys"}),"."]}),t.jsxs("li",{children:["Open the Claude Desktop MCP config file:",t.jsxs(ukt,{children:[t.jsxs("li",{children:[t.jsx("strong",{children:"macOS:"})," ",t.jsx("code",{children:"~/Library/Application Support/Claude/claude_desktop_config.json"})]}),t.jsxs("li",{children:[t.jsx("strong",{children:"Windows:"})," ",t.jsx("code",{children:"%APPDATA%\\Claude\\claude_desktop_config.json"})]})]})]}),t.jsxs("li",{children:["Paste this config, replace ",t.jsx("code",{children:"your_api_key_here"}),", save, then fully quit and reopen Claude Desktop."]})]}),t.jsx(pkt,{children:F}),t.jsx(yj,{children:t.jsx(he,{type:"button",size:"sm",variant:"outline",leftIcon:t.jsx(so,{size:16}),onClick:()=>H(F,"Claude Desktop config","mcp-claude-config"),children:y==="mcp-claude-config"?"Copied Desktop config":"Copy Desktop config"})})]}):null]}):Q==="cursor"?t.jsxs(mj,{children:[t.jsxs(hj,{children:[t.jsxs("div",{children:[t.jsx(fj,{children:"Cursor"}
20741),t.jsx(gj,{children:"Install the Ceyo MCP server entry in Cursor."})]}),t.jsx(yj,{children:t.jsxs(JZ,{href:R,children:[t.jsx(Q8,{size:15}),"Add to Cursor"]})})]}),t.jsx(w2,{children:"After install, replace the API key placeholder with a workspace API key."})]}):Q==="n8n"?t.jsxs(mj,{children:[t.jsxs(hj,{children:[t.jsxs("div",{children:[t.jsx(fj,{children:"n8n"}),t.jsx(gj,{children:"Add Ceyo through an MCP Client node."})]}),t.jsx(yj,{children:t.jsxs(JZ,{href:M,target:"_blank",rel:"noreferrer",$variant:"secondary",children:[t.jsx(xu,{size:15}),"n8n docs"]})})]}),t.jsxs(Skt,{children:[t.jsxs(j2,{children:[t.jsx(Dx,{children:"Node"}),t.jsxs(Lx,{children:[t.jsx(Bx,{children:"MCP Client or MCP Client Tool"}),t.jsx(Ox,{type:"button",$copied:y==="mcp-n8n-node",onClick:()=>H("MCP Client or MCP Client Tool","n8n node","mcp-n8n-node"),"aria-label":"Copy n8n node",children:y==="mcp-n8n-node"?t.jsx(Zn,{size:14}):t.jsx(so,{size:14})})]})]}),t.jsxs(j2,{children:[t.jsx(Dx,{children:"Authentication"}),t.jsxs(Lx,{children:[t.jsx(Bx,{children:"Header Auth / Multiple Headers Auth"}),t.jsx(Ox,{type:"button",$copied:y==="mcp-n8n-auth",onClick:()=>H("Header Auth / Multiple Headers Auth","n8n authentication","mcp-n8n-auth"),"aria-label":"Copy n8n authentication",children:y==="mcp-n8n-auth"?t.jsx(Zn,{size:14}):t.jsx(so,{size:14})})]})]}),t.jsxs(j2,{children:[t.jsx(Dx,{children:"Header name"}),t.jsxs(Lx,{children:[t.jsx(Bx,{children:"X-Api-Key"}),t.jsx(Ox,{type:"button",$copied:y==="mcp-n8n-header",onClick:()=>H("X-Api-Key","n8n header","mcp-n8n-header"),"aria-label":"Copy n8n header",children:y==="mcp-n8n-header"?t.jsx(Zn,{size:14}):t.jsx(so,{size:14})})]})]}),t.jsxs(j2,{children:[t.jsx(Dx,{children:"MCP URL"}),t.jsxs(Lx,{children:[t.jsx(Bx,{title:B,children:B}),t.jsx(Ox,{type:"button",$copied:y==="mcp-n8n-url",onClick:()=>H(B,"n8n MCP URL","mcp-n8n-url"),"aria-label":"Copy n8n MCP URL",children:y==="mcp-n8n-url"?t.jsx(Zn,{size:14}):t.jsx(so,{size:14})})]})]})]}),t.jsxs(w2,{children:["Paste a workspace API key as the ",t.jsx("code",{children:"X-Api-Key"})," header value."]})]}):t.jsxs(mj,{children:[t.jsx(hj,{children:t.jsxs("div",{children:[t.jsx(fj,{children:"Other MCP client"}),t.jsx(gj,{children:"Copy the values your client asks for."})]})}),t.jsxs(mkt,{children:[t.jsxs(ZZ,{children:[t.jsx(Dx,{children:"MCP Endpoint"}),t.jsxs(Lx,{children:[t.jsx(Bx,{title:B,children:B}),t.jsx(Ox,{type:"button",$copied:y==="mcp-endpoint",onClick:()=>H(B,"MCP endpoint","mcp-endpoint"),"aria-label":"Copy MCP endpoint",children:y==="mcp-endpoint"?t.jsx(Zn,{size:14}):t.jsx(so,{size:14})})]})]}),t.jsxs(ZZ,{children:[t.jsx(Dx,{children:"Auth Header"}),t.jsxs(Lx,{children:[t.jsx(Bx,{children:"X-Api-Key"}),t.jsx(Ox,{type:"button",$copied:y==="mcp-header",onClick:()=>H("X-Api-Key","auth header","mcp-header"),"aria-label":"Copy auth header",children:y==="mcp-header"?t.jsx(Zn,{size:14}):t.jsx(so,{size:14})})]})]})]}),t.jsx(w2,{children:"Ask your MCP client to list projects to verify the connection."})]});return t.jsx(ma,{children:t.jsxs(ZSt,{children:[t.jsxs(Ys,{children:[t.jsxs(ha,{children:[t.jsx(fa,{children:"Integrations"}),t.jsx("div",{style:{paddingRight:8,minWidth:0}
20741,children:t.jsx(qr,{items:[{label:"Projects",to:n?`/workspaces/${n}`:void 0},{label:$?.name||"Project",to:n&&i?`/workspaces/${n}/projects/${i}`:void 0},{label:"Settings",to:n&&i?`/workspaces/${n}/projects/${i}/settings`:void 0},{label:"Integrations"}]})})]}),t.jsx(ga,{children:"Connect this project to external tools and reporting destinations."})]}),t.jsxs(JSt,{children:[I&&t.jsx(X6e,{organizationId:v,projectId:_,defaultOpen:!1}),S?t.jsxs(t.Fragment,{children:[s?t.jsx(hr,{$variant:"error",children:s}):null,t.jsxs(ekt,{children:[t.jsxs(tkt,{type:"button","aria-expanded":c,"aria-label":c?"Collapse MCP quick start":"Expand MCP quick start",onClick:()=>u(Q=>!Q),children:[t.jsxs(nkt,{children:[t.jsxs(ikt,{children:[t.jsx(SP,{size:18}),t.jsx(rkt,{children:"AI agent connectors"})]}),t.jsx(okt,{children:"Connect Claude, Cursor, n8n, and other MCP clients to this project's Ceyo data."})]}),t.jsxs(skt,{"aria-hidden":"true",children:[c?"Hide details":"Show details",c?t.jsx(qn,{size:16}):t.jsx(Gi,{size:16})]})]}),t.jsx(akt,{$open:c,children:t.jsx(lkt,{children:t.jsxs(ckt,{children:[t.jsxs(yj,{children:[A?t.jsx(he,{type:"button",size:"sm",variant:"outline",leftIcon:t.jsx(Rc,{size:16}),onClick:()=>e(`/workspaces/${n}/settings/api-keys`),children:"API keys"}):null,t.jsx(he,{type:"button",size:"sm",variant:"outline",leftIcon:t.jsx(xu,{size:16}),onClick:()=>U(T),children:"Docs"})]}),t.jsx(hkt,{children:Y.map(Q=>{const K=m===Q.key,G=Q.icon;return t.jsxs(t.Fragment,{children:[t.jsxs(ykt,{type:"button",$active:K,onClick:()=>h(L=>L===Q.key?null:Q.key),"aria-pressed":K,children:[t.jsxs(xkt,{children:[t.jsx(bkt,{$active:K,children:t.jsx($u,{domain:Q.domain,alt:`${Q.label} logo`,size:22,Img:vkt,fallback:t.jsx(G,{size:17})})}),t.jsx(wkt,{$active:K,children:Q.setup})]}),t.jsx("div",{children:t.jsx(jkt,{children:Q.label})})]},Q.key),K?t.jsx(fkt,{children:X(Q.key)},`${Q.key}-mobile-details`):null]})})}),m?t.jsx(gkt,{children:X(m)}):null,A?null:t.jsx(w2,{children:"API keys are managed at the workspace level. If you do not have workspace owner access, ask the owner to create a key for this MCP connection."})]})})})]})]}):t.jsxs(Ar,{children:[t.jsx(Zr,{children:t.jsxs("div",{style:{minWidth:0},children:[t.jsxs(Wr,{children:[t.jsx(Rc,{size:18}),t.jsx(Ur,{children:"Public API not enabled"})]}),t.jsx(Hr,{children:"Upgrade your plan to unlock API keys and access the Public API for this workspace."})]})}),t.jsxs("div",{style:{marginTop:"0.75rem",display:"grid",gap:10},children:[t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:"Your current plan does not include Public API access."}),t.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:A?t.jsx(he,{type:"button",size:"sm",variant:"primary",onClick:()=>e(`/workspaces/${n}/settings/plan`),children:"Upgrade Plan"}):null})]})]})]})]})})}const $kt=10;function Oue(e){const n=Number(e);if(!Number.isFinite(n))return null;const i=Math.floor(n);return i<=0?null:i}function B4(e){const n=Number(e);if(!Number.isFinite(n))return 0;const i=Math.floor(n);return i<0?0:i}function kd(e){if(!e||typeof e!="object")return null;const n=Oue(e?.limits?.seats),i=B4(e?.usage?.members),r=B4(e?.usage?.active_invites),o=B4(e?.usage?.seats_used),s=e?.usage&&typeof e?.usage=="object"?{members:i,active_invites:r,seats_used:o||i+r}:null;return!n&&!s?null:{limit:n,usage:s}}function $d(e,n){return e?n?{limit:n.limit??e.limit,usage:n.usage??e.usage}:e:n}function Due(e){return Oue(e)||$kt}const sJ=[{value:"editor",label:"Editor"},{value:"viewer",label:"Viewer"}],Ikt=p(Kc).withConfig({displayName:"ProjectSettingsUsers__SettingsMaxWide",componentId:"sc-86nwzv-0"})` 20742 max-width: 50rem; 20743`,aJ=p.ul.withConfig({displayName:"ProjectSettingsUsers__RoleList",componentId:"sc-86nwzv-1"})` 20744 margin: 0; 20745 padding-left: 1.1rem; 20746 display: grid; 20747 gap: 0.35rem; 20748 color: ${z}; 20749 font-size: 0.8125rem; 20750 20751 li strong { 20752 color: ${O}; 20753 } 20754`,Pkt=p.div.withConfig({displayName:"ProjectSettingsUsers__RowUser",componentId:"sc-86nwzv-2"})` 20755 display: flex; 20756 align-items: center; 20757 gap: 0.75rem; 20758 min-width: 0; 20759`,Akt=p.div.withConfig({displayName:"ProjectSettingsUsers__Avatar",componentId:"sc-86nwzv-3"})` 20760 width: 2rem; 20761 height: 2rem; 20762 border-radius: 0.75rem; 20763 display: flex; 20764 align-items: center; 20765 justify-content: center; 20766 font-weight: 800; 20767 font-size: 0.75rem; 20768 color: ${Z}; 20769 background: ${e=>e.$bg}; 20770 border: 1px solid ${V}; 20771 flex-shrink: 0; 20772`,Nkt=p.div.withConfig({displayName:"ProjectSettingsUsers__NameBlock",componentId:"sc-86nwzv-4"})` 20773 min-width: 0; 20774 display: flex; 20775 flex-direction: column; 20776 gap: 0.1rem; 20777`,zkt=p.div.withConfig({displayName:"ProjectSettingsUsers__NameRow",componentId:"sc-86nwzv-5"})` 20778 min-width: 0; 20779 display: flex; 20780 align-items: baseline; 20781 gap: 0.5rem; 20782`,Tkt=p.div.withConfig({displayName:"ProjectSettingsUsers__Name",componentId:"sc-86nwzv-6"})` 20783 min-width: 0; 20784 overflow: hidden; 20785 text-overflow: ellipsis; 20786 white-space: nowrap; 20787 font-weight: 650; 20788 color: ${O}; 20789`,Ekt=p.span.withConfig({displayName:"ProjectSettingsUsers__YouBadge",componentId:"sc-86nwzv-7"})` 20790 font-size: 0.75rem; 20791 font-weight: 700; 20792 color: ${z}; 20793 background: ${At}; 20794 border: 1px solid ${V}; 20795 padding: 0.1rem 0.5rem; 20796 border-radius: 9999px; 20797 white-space: nowrap; 20798`,lJ=p.div.withConfig({displayName:"ProjectSettingsUsers__EmailText",componentId:"sc-86nwzv-8"})` 20799 min-width: 0; 20800 overflow: hidden; 20801 text-overflow: ellipsis; 20802 white-space: nowrap; 20803 color: ${z}; 20804 font-size: 0.8125rem; 20805`,Mkt=p.div.withConfig({displayName:"ProjectSettingsUsers__ExpiryWrap",componentId:"sc-86nwzv-9"})` 20806 display: grid; 20807 gap: 0.125rem; 20808 line-height: 1.1; 20809`,Rkt=p.div.withConfig({displayName:"ProjectSettingsUsers__ExpiryDate",componentId:"sc-86nwzv-10"})` 20810 font-size: 0.8125rem; 20811 font-weight: 750; 20812 color: ${O}; 20813`,Okt=p.div.withConfig({displayName:"ProjectSettingsUsers__ExpiryTime",componentId:"sc-86nwzv-11"})` 20814 font-size: 0.75rem; 20815 color: ${z}; 20816`,cJ=p.button.withConfig({displayName:"ProjectSettingsUsers__IconButton",componentId:"sc-86nwzv-12"})` 20817 border: 1px solid ${V}; 20818 background: ${Z}; 20819 color: ${z}; 20820 border-radius: 0.5rem; 20821 padding: 0.5rem; 20822 display: inline-flex; 20823 align-items: center; 20824 justify-content: center; 20825 cursor: pointer; 20826 transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease; 20827 20828 &:hover { 20829 background: ${At}; 20830 border-color: ${Pe}; 20831 color: ${O}; 20832 } 20833 20834 &:focus-visible { 20835 outline: none; 20836 box-shadow: 0 0 0 3px ${En}; 20837 } 20838 20839 &:disabled { 20840 opacity: 0.6;
20841 cursor: not-allowed; 20842 } 20843`,Dkt=p.div.withConfig({displayName:"ProjectSettingsUsers__TabsRow",componentId:"sc-86nwzv-13"})` 20844 display: grid; 20845 grid-template-columns: 1fr auto 1fr; 20846 align-items: flex-end; 20847 gap: 0.75rem; 20848 20849 @media (max-width: 640px) { 20850 grid-template-columns: 1fr auto; 20851 align-items: center; 20852 } 20853`,Lkt=p.div.withConfig({displayName:"ProjectSettingsUsers__TabsLeft",componentId:"sc-86nwzv-14"})` 20854 justify-self: start; 20855 min-width: 0; 20856 20857 @media (max-width: 640px) { 20858 grid-column: 1 / -1; 20859 width: 100%; 20860 } 20861`,Bkt=p.div.withConfig({displayName:"ProjectSettingsUsers__TabsCenter",componentId:"sc-86nwzv-15"})` 20862 justify-self: center; 20863 20864 @media (max-width: 640px) { 20865 justify-self: start; 20866 min-width: 0; 20867 } 20868`,Fkt=p.div.withConfig({displayName:"ProjectSettingsUsers__TabsRight",componentId:"sc-86nwzv-16"})` 20869 justify-self: end; 20870 display: inline-flex; 20871 align-items: center; 20872 gap: 0.5rem; 20873 padding-right: 0.25rem; 20874 20875 @media (max-width: 640px) { 20876 padding-right: 0; 20877 } 20878`,Wkt=p.div.withConfig({displayName:"ProjectSettingsUsers__SeatsGroup",componentId:"sc-86nwzv-17"})` 20879 display: inline-flex; 20880 align-items: center; 20881 background: ${At}; 20882 border: 1px solid ${V}; 20883 border-radius: 0.75rem; 20884 overflow: hidden; 20885 white-space: nowrap; 20886 20887 @media (max-width: 640px) { 20888 flex-wrap: wrap; 20889 white-space: normal; 20890 } 20891`,F4=p.span.withConfig({displayName:"ProjectSettingsUsers__SeatsGroupItem",componentId:"sc-86nwzv-18"})` 20892 font-size: 0.75rem; 20893 font-weight: 800; 20894 color: ${z}; 20895 padding: 0.125rem 0.5rem; 20896 20897 & + & { 20898 border-left: 1px solid ${V}; 20899 } 20900`;function oP(e){return e.trim().toLowerCase()}function Lg(e){const n=oP(e);return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(n)}function Ukt(e){const n=String(e||"").trim();if(!n)return"?";const i=n.replace("@"," ").split(/\s+/).filter(Boolean),r=i[0]?.[0]||"?",o=i[1]?.[0]||i[0]?.[1]||"";return(r+o).toUpperCase()}function W4(e){const n=oP(e),i=n.split("@")[0]||n;return i&&i.replace(/[._-]+/g," ").trim()||n}function Hkt(){const{workspaceId:e,projectId:n}=Gn(),{user:i}=yn(),{projects:r}=Mr(),o=Number(n),s=l.useMemo(()=>Number.isFinite(o)&&o>0&&r.find(je=>je.id===o)||null,[o,r]),a="project",c="Project users",u=l.useMemo(()=>{const je=Number(e),Me=Number(n);return!Number.isFinite(je)||je<=0||!Number.isFinite(Me)||Me<=0?null:`/api/v1/organizations/${je}/projects/${Me}`},[n,e]),m=l.useMemo(()=>u?`${u}/users`:null,[u]),[h,g]=l.useState("users"),[x,y]=l.useState(!1),[w,j]=l.useState([]),[v,_]=l.useState([]),[$,k]=l.useState(!0),[P,S]=l.useState(!1),[I,A]=l.useState(!1),[E,B]=l.useState(!1),[T,M]=l.useState(""),[R,F]=l.useState("viewer"),[Y,H]=l.useState(null),[U,X]=l.useState(null),[Q,K]=l.useState(null),[G,L]=l.useState(null),[q,W]=l.useState(null),oe=l.useRef(null),se=`${e||""}:${n||""}:${i?.id||"anon"}`;l.useEffect(()=>{if(oe.current===se)return;if(oe.current=se,g("users"),y(!1),M(""),F("viewer"),H(null),X(null),K(null),W(null),A(!1),B(!1),j([]),_([]),k(!0),L(null),!m||!u){X(`Invalid workspace, project, or ${a} id.`),k(!1);return}let je=!1;return(async()=>{try{const[Me,Se]=await Promise.all([ue(m,{method:"GET"}),ue(`${u}/invitations`,{method:"GET"})]),it=await Me.json().catch(()=>({}));if(!Me.ok)throw new Error(it?.error||it?.errors?.[0]||"Failed to load users");const De=Se?await Se.json().catch(()=>({})):{};if(Se&&!Se.ok)throw new Error(De?.error||De?.errors?.[0]||"Failed to load invitations");const ge=(Array.isArray(it?.users)?it.users:[]).map(Xe=>{const yt=Number(Xe?.id??Xe?.user_id),Ne=String(Xe?.email||"").trim(),Ue=String(Xe?.full_name||"").trim()||W4(Ne),We=String(Xe?.role||"").trim()||"viewer",Qe=Xe?.color?String(Xe.color):null;return{id:yt,email:Ne,name:Ue,role:We,color:Qe,isYou:i?.id?yt===i.id:!1}}).filter(Xe=>Number.isFinite(Xe.id)&&Xe.id>0&&Lg(Xe.email)),Ee=(Array.isArray(De?.invitations)?De.invitations:[]).map(Xe=>({id:Number(Xe?.id),email:String(Xe?.email||"").trim(),role:String(Xe?.role||"").trim()||"viewer",expires_at:String(Xe?.expires_at||""),accepted_at:Xe?.accepted_at??null,revoked_at:Xe?.revoked_at??null})).filter(Xe=>Number.isFinite(Xe.id)&&Xe.id>0&&Lg(Xe.email));je||(j(ge),_(Ee),L(Xe=>$d(Xe,$d(kd(it),kd(De)))),X(null))}catch(Me){je||X(Me?.message||`Failed to load ${a} members`)}finally{je||k(!1)}})(),()=>{je=!0}},[u,se,i?.id,m,a]),l.useEffect(()=>{if(!Y)return;const je=window.setTimeout(()=>H(null),5e3);return()=>window.clearTimeout(je)},[Y]);const de=l.useMemo(()=>{const je=Date.now();return v.filter(Me=>{if(Me.accepted_at||Me.revoked_at)return!1;const Se=Date.parse(Me.expires_at);return Number.isFinite(Se)?Se>je:!1}).length},[v]),le=l.useMemo(()=>Due(G?.limit??null),[G?.limit]),me=l.useMemo(()=>G?.usage?.seats_used??w.length+de,[de,w.length,G?.usage?.seats_used]),ee=l.useMemo(()=>G?.usage?.members??w.length,[w.length,G?.usage?.members]),ne=l.useMemo(()=>G?.usage?.active_invites??de,[de,G?.usage?.active_invites]),Ae=l.useMemo(()=>me>=le,[le,me]),_e=l.useMemo(()=>`${me}/${le}`,[le,me]),we=l.useMemo(()=>Lg(T),[T]),Ke=async()=>{const je=oP(T);if(K(null),H(null),!Lg(je)){K("Please enter a valid email.");return}if(Ae){K(`This ${a} already has the maximum of ${le} seats.`);return}if(w.some(Me=>oP(Me.email)===je)){K(`This user is already in the ${a}.`);return}S(!0);try{if(!u||!m)throw new Error(`Invalid workspace, project, or ${a} id.`);const Me=await ue(`${u}/invitations`,{method:"POST",body:JSON.stringify({email:je,role:R})}),Se=await Me.json().catch(()=>({}));if(!Me.ok)throw new Error(Se?.error||Se?.errors?.[0]||"Failed to send invite");const De=(Array.isArray(Se?.invitations)?Se.invitations:[]).map(te=>({id:Number(te?.id),email:String(te?.email||"").trim(),role:String(te?.role||"").trim()||"viewer",expires_at:String(te?.expires_at||""),accepted_at:te?.accepted_at??null,revoked_at:te?.revoked_at??null})).filter(te=>Number.isFinite(te.id)&&te.id>0&&Lg(te.email));_(De),L(te=>$d(te,kd(Se))),M(""),F("viewer"),y(!1),H("Invitation sent."),K(null)}catch(Me){K(Me?.message||"Failed to send invite")}finally{S(!1)}},ce=async je=>{X(null),H(null),S(!0);try{if(!u)throw new Error(`Invalid workspace, project, or ${a} id.`);const Me=await ue(`${u}/invitations/${je}/resend`,{method:"POST"}),Se=await Me.json().catch(()=>({}));if(!Me.ok)throw new Error(Se?.error||Se?.errors?.[0]||"Failed to resend");H("Invitation resent."),L(De=>$d(De,kd(Se)));const it=Se?.invitation;it&&Number.isFinite(Number(it.id))&&_(De=>De.map(te=>te.id===Number(it.id)?{...te,role:String(it.role||te.role)||te.role,expires_at:String(it.expires_at||te.expires_at),accepted_at:it.accepted_at??te.accepted_at??null,revoked_at:it.revoked_at??te.revoked_at??null}:te))}finally{S(!1)}},ie=async je=>{X(null),H(null),S(!0);try{if(!u)throw new Error(`Invalid workspace, project, or ${a} id.`);const Me=await ue(`${u}/invitations/${je}/revoke`,{method:"POST"}),Se=await Me.json().catch(()=>({}));if(!Me.ok)throw new Error(Se?.error||Se?.errors?.[0]||"Failed to revoke");
20900_(it=>it.filter(De=>De.id!==je)),L(it=>$d(it,kd(Se))),H("Invitation deleted.")}finally{S(!1)}},Re=async(je,Me)=>{const Se=w.find(it=>it.id===je);if(Se&&Se.role!==Me){if(X(null),H(null),!u||!m){X(`Invalid workspace, project, or ${a} id.`);return}S(!0);try{j(Je=>Je.map(Ee=>Ee.id===je?{...Ee,role:Me}:Ee));const it=await ue(`${u}/users/${je}`,{method:"PATCH",body:JSON.stringify({role:Me})}),De=await it.json().catch(()=>({}));if(!it.ok)throw new Error(De?.error||De?.errors?.[0]||"Failed to update role");const ge=(Array.isArray(De?.users)?De.users:[]).map(Je=>{const Ee=Number(Je?.id),Xe=String(Je?.email||"").trim(),Ne=String(Je?.full_name||"").trim()||W4(Xe),Le=String(Je?.role||"").trim()||"viewer",Ue=Je?.color?String(Je.color):null;return{id:Ee,email:Xe,name:Ne,role:Le,color:Ue,isYou:i?.id?Ee===i.id:!1}}).filter(Je=>Number.isFinite(Je.id)&&Je.id>0&&Lg(Je.email));j(ge),H("Role updated.")}catch(it){j(De=>De.map(te=>te.id===je?Se:te)),X(it?.message||"Failed to update role")}finally{S(!1)}}},Be=je=>{X(null),W(je)},tt=async()=>{if(q){if(X(null),H(null),!u||!m){X(`Invalid workspace, project, or ${a} id.`),W(null);return}S(!0);try{const je=await ue(`${u}/users/${q.id}`,{method:"DELETE"}),Me=await je.json().catch(()=>({}));if(!je.ok)throw new Error(Me?.error||Me?.errors?.[0]||"Failed to remove user");const it=(Array.isArray(Me?.users)?Me.users:[]).map(De=>{const te=Number(De?.id),ge=String(De?.email||"").trim(),Ee=String(De?.full_name||"").trim()||W4(ge),Xe=String(De?.role||"").trim()||"viewer",yt=De?.color?String(De.color):null;return{id:te,email:ge,name:Ee,role:Xe,color:yt,isYou:i?.id?te===i.id:!1}}).filter(De=>Number.isFinite(De.id)&&De.id>0&&Lg(De.email));j(it),H("User removed."),W(null)}catch(je){X(je?.message||"Failed to remove user"),W(null)}finally{S(!1)}}},dt=l.useMemo(()=>[...w].sort((je,Me)=>je.email.trim().toLowerCase().localeCompare(Me.email.trim().toLowerCase())),[w]);return t.jsxs(ma,{children:[t.jsxs(Ikt,{children:[t.jsxs(Ys,{children:[t.jsxs(ha,{children:[t.jsx(fa,{children:c}),t.jsx("div",{style:{paddingRight:8,minWidth:0}
20900,children:t.jsx(qr,{items:[{label:"Projects",to:e?`/workspaces/${e}`:void 0},{label:s?.name||"Project",to:e&&n?`/workspaces/${e}/projects/${n}`:void 0},{label:"Settings",to:e&&n?`/workspaces/${e}/projects/${n}/settings`:void 0},{label:"Users"}]})})]}),t.jsx(ga,{children:"Manage members and roles for this project."})]}),t.jsxs(Ar,{children:[t.jsx(Zr,{children:t.jsxs("div",{style:{minWidth:0},children:[t.jsxs(Wr,{children:[t.jsx(Ap,{size:18}),t.jsx(Ur,{children:"Members"})]}),t.jsx(Hr,{children:"Add or remove members and set their project role."})]})}),Y?t.jsx(hr,{$variant:"success",children:Y}):null,U?t.jsx(hr,{$variant:"error",children:U}):null,t.jsx("div",{style:{marginTop:"1rem"},children:t.jsx(MM,{title:h==="users"?"Role permissions":"Invitations",icon:t.jsx(Yl,{size:16}),open:h==="users"?I:E,onToggle:()=>{h==="users"?A(je=>!je):B(je=>!je)},children:h==="users"?t.jsxs(aJ,{children:[t.jsxs("li",{children:["These are ",t.jsxs("strong",{children:[a," roles"]})," and apply only to this ",a,"."]}),t.jsxs("li",{children:[t.jsx("strong",{children:"Viewer"}),": view-only access to this ",a,"."]}),t.jsxs("li",{children:[t.jsx("strong",{children:"Editor"}),": edit access to this ",a,`, but cannot manage ${a} users.`]})]}):t.jsxs(aJ,{children:[t.jsxs("li",{children:["Invitations expire after ",t.jsx("strong",{children:"7 days"}),". If an invite expires, you can delete it and send a new one."]}),t.jsxs("li",{children:["You can ",t.jsx("strong",{children:"resend"})," or ",t.jsx("strong",{children:"revoke"})," invites at any time from this page."]}),t.jsxs("li",{children:["This ",a," has a maximum of ",t.jsxs("strong",{children:[le," seats"]}),", including active invitations."]})]})})}),t.jsxs(Dkt,{children:[t.jsx(Lkt,{children:t.jsx(RP,{ariaLabel:`${c} tabs`,marginTop:"1.25rem",activeKey:h,onChange:je=>g(je),tabs:[{key:"users",label:"Users",icon:t.jsx(Ap,{size:18})},{key:"invites",label:"Invites",icon:t.jsx(bu,{size:18})}]})}),t.jsx(Bkt,{children:t.jsxs(Wkt,{"aria-label":"Seats breakdown",children:[t.jsxs(F4,{"aria-label":`${c} seats ${_e}`,children:["Seats ",_e]}),t.jsxs(F4,{"aria-label":`${c} members ${ee}`,children:["Members ",ee]}),t.jsxs(F4,{"aria-label":`${c} pending invites ${ne}`,children:["Invites ",ne]})]})}),t.jsx(Fkt,{children:t.jsx(cJ,{type:"button","aria-label":"Invite user",title:"Invite user",onClick:()=>{K(null),y(!0)},disabled:P||Ae,children:t.jsx(qne,{size:16})})})]}),t.jsx("div",{style:{marginTop:"1rem"},children:h==="users"?$?t.jsx($p,{minWidth:"38rem",columns:[{},{},{width:"10.5rem"},{width:"5.5rem"}],rows:7}):w.length===0?t.jsx(Iu,{children:"No users yet."}):t.jsx(tr,{children:t.jsxs(nr,{$minWidth:"38rem",children:[t.jsx(pr,{children:t.jsxs(Cn,{children:[t.jsx(Ai,{children:"User"}),t.jsx(Ai,{children:"Email"}),t.jsx(Ai,{style:{width:"10.5rem"},children:"Role"}),t.jsx(Ai,{style:{width:"5.5rem"},children:"Actions"})]})}),t.jsx(mr,{children:dt.map(je=>{const Me=je.color||(je.isYou?i?.color:null)||$e,Se=je.isYou;return t.jsxs(Cn,{children:[t.jsx(bt,{children:t.jsxs(Pkt,{children:[t.jsx(Akt,{$bg:Me,"aria-hidden":"true",children:Ukt(je.name||je.email)}),t.jsx(Nkt,{children:t.jsxs(zkt,{children:[t.jsx(at,{content:je.name,onlyIfTruncated:!0,children:t.jsx(Tkt,{children:je.name})}),je.isYou?t.jsx(Ekt,{children:"You"}):null]})})]})}),t.jsx(bt,{children:t.jsx(at,{content:je.email,onlyIfTruncated:!0,children:t.jsx(lJ,{children:je.email})})}),t.jsx(bt,{children:t.jsx(Fn,{value:je.role,onChange:it=>Re(je.id,it),options:sJ,disabled:P,dropdownPortal:!0})}),t.jsx(bt,{children:t.jsx(cJ,{type:"button","aria-label":`Remove ${je.email}`,onClick:()=>Be(je),disabled:Se,title:Se?"You canât remove yourself here yet.":"Remove user",style:{color:Se?Pe:oi},children:t.jsx(Fi,{size:16})})})]},je.id)})})]})}):$?t.jsx($p,{minWidth:"38rem",columns:[{},{width:"10rem"},{width:"12rem"},{width:"7.5rem"},{width:"8rem"}],rows:6}):v.length===0?t.jsx(Iu,{children:"No invitations yet."}):t.jsx(tr,{children:t.jsxs(nr,{$minWidth:"38rem",children:[t.jsx(pr,{children:t.jsxs(Cn,{children:[t.jsx(Ai,{children:"Email"}),t.jsx(Ai,{style:{width:"10rem"},children:"Role"}),t.jsx(Ai,{style:{width:"12rem"},children:"Expires"}),t.jsx(Ai,{style:{width:"7.5rem"},children:"Status"}),t.jsx(Ai,{style:{width:"8rem"},children:"Actions"})]})}),t.jsx(mr,{children:v.map(je=>{const Me=Date.now(),Se=Date.parse(je.expires_at),De=(Number.isFinite(Se)?Se<=Me:!1)?"Expired":"Pending";return t.jsxs(Cn,{children:[t.jsx(bt,{children:t.jsx(at,{content:je.email,onlyIfTruncated:!0,children:t.jsx(lJ,{children:je.email})})}),t.jsx(bt,{children:je.role}),t.jsx(bt,{children:t.jsxs(Mkt,{children:[t.jsx(Rkt,{children:t.jsx(rr,{value:je.expires_at,timeZoneMode:"viewer",placeholder:"-",options:{month:"short",day:"numeric",year:"numeric"}})}),t.jsx(Okt,{children:t.jsx(rr,{value:je.expires_at,timeZoneMode:"viewer",placeholder:"-",options:{hour:"numeric",minute:"2-digit"}})})]})}),t.jsx(bt,{children:De}),t.jsx(bt,{children:t.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[t.jsx(he,{type:"button",size:"sm",variant:"outline",disabled:P,onClick:()=>ce(je.id),children:"Resend"}),t.jsx(he,{type:"button",size:"sm",variant:"danger",disabled:P,onClick:()=>ie(je.id),children:"Delete"})]})})]},je.id)})})]})})})]})]}),t.jsxs(Hn,{isOpen:x,onClose:()=>{P||(y(!1),K(null))},title:"Invite user",description:"Send an invitation to join this project.",size:"md",footer
20900:t.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.75rem"},children:[t.jsx(he,{type:"button",size:"sm",variant:"outline",onClick:()=>y(!1),disabled:P,children:"Cancel"}),t.jsx(he,{type:"button",size:"sm",variant:"primary",onClick:Ke,disabled:!we||P||Ae,children:P?"Sendingâ¦":"Send invite"})]}),children:[Q?t.jsx(hr,{$variant:"error",children:Q}):null,t.jsxs(Bl,{children:[t.jsxs(Bn,{style:{margin:0},children:[t.jsx(ii,{children:"Email"}),t.jsx(Xt,{value:T,onChange:je=>M(je.target.value),placeholder:"[email protected]",leftIcon:t.jsx(bu,{size:18}),disabled:P||Ae}),t.jsxs(Gs,{children:["Max ",le," project seats (including invitations)."]})]}),t.jsxs(Bn,{style:{margin:0},children:[t.jsx(ii,{children:"Role"}),t.jsx(Fn,{value:R,onChange:je=>F(je),options:sJ,disabled:P,dropdownPortal:!0}),t.jsxs(Gs,{children:["Editors can edit this ",a,". Viewers have read-only access."]})]})]})]}),t.jsx(Hn,{isOpen:!!q,onClose:()=>{P||W(null)},title:"Remove user",description:`This will remove the user from this ${a}.`,size:"sm",footer:t.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.75rem"},children:[t.jsx(he,{type:"button",size:"sm",variant:"outline",onClick:()=>W(null),disabled:P,children:"Cancel"}),t.jsx(he,{type:"button",size:"sm",variant:"danger",onClick:tt,disabled:P,children:P?"Removingâ¦":"Remove"})]}),children:t.jsx("div",{style:{color:z,fontSize:"0.875rem"},children:q?t.jsxs(t.Fragment,{children:["Remove ",t.jsx("strong",{style:{color:O},children:q.email})," from this project?"]}):null})})]})}const dJ=10;function _2(e){try{const i=new URL(e).hostname.replace(/^www\./,""),r=i.split(".")[0]||i;return r.charAt(0).toUpperCase()+r.slice(1)}catch{return"Competitor"}}function uJ(e){const n=(e||"").trim();if(!n)return null;try{return new URL(n.includes("://")?n:`https://${n}`).hostname?.toLowerCase().replace(/^www\./,"").trim()||null}catch{return null}}function U4(e){return e>=70?Vt:e>=40?$i:Ut}function qkt(e){const n=[];n.push(`I want to discuss a competitor and how to improve my AI visibility against them. 20901`),n.push(`**Competitor:** ${e.name}`),e.website&&n.push(`**Website:** ${e.website}`);const i=e.visibility_score!=null?`${Math.round(e.visibility_score)}%`:"N/A";n.push(`**AI Visibility Score:** ${i}`),n.push(`**Mentions (7d):** ${e.mention_count??0}`);const r=(Array.isArray(e.aliases)?e.aliases:[]).filter(Boolean);return r.length&&n.push(`**Known Aliases:** ${r.join(", ")}`),n.push(` 20902Help me understand why this competitor appears in AI responses and what I can do to improve my visibility relative to them.`),n.join(` 20903`)}function Gkt(e){return`Competitor: ${e.name.length>50?e.name.slice(0,47)+"â¦":e.name}`}const Vkt=p.div.withConfig({displayName:"ProjectSettingsCompetitors__CompetitorsMax",componentId:"sc-1i92bcd-0"})` 20904 max-width: 80rem; 20905 margin: 0 auto; 20906`,Kkt=p.div.withConfig({displayName:"ProjectSettingsCompetitors__StatsBar",componentId:"sc-1i92bcd-1"})` 20907 display: grid; 20908 grid-template-columns: repeat(4, 1fr); 20909 gap: 0.75rem; 20910 margin-bottom: 1.25rem; 20911 20912 @media (max-width: 860px) { 20913 grid-template-columns: repeat(2, 1fr); 20914 } 20915 @media (max-width: 480px) { 20916 grid-template-columns: 1fr; 20917 } 20918`,C2=p.div.withConfig({displayName:"ProjectSettingsCompetitors__StatCard",componentId:"sc-1i92bcd-2"})` 20919 display: flex; 20920 align-items: center; 20921 gap: 0.75rem; 20922 padding: 0.875rem 1rem; 20923 background: ${Z}; 20924 border: 1px solid ${V}; 20925 border-radius: 0.625rem; 20926`,S2=p.div.withConfig({displayName:"ProjectSettingsCompetitors__StatIcon",componentId:"sc-1i92bcd-3"})` 20927 width: 2rem; 20928 height: 2rem; 20929 border-radius: 0.5rem; 20930 display: flex; 20931 align-items: center; 20932 justify-content: center; 20933 background: ${e=>e.$bg}; 20934 color: ${e=>e.$fg}; 20935 flex-shrink: 0; 20936`,k2=p.div.withConfig({displayName:"ProjectSettingsCompetitors__StatValue",componentId:"sc-1i92bcd-4"})` 20937 font-size: 1.125rem; 20938 font-weight: 700; 20939 color: ${O}; 20940 line-height: 1.2; 20941`,$2=p.div.withConfig({displayName:"ProjectSettingsCompetitors__StatLabel",componentId:"sc-1i92bcd-5"})` 20942 font-size: 0.6875rem; 20943 color: ${Pe}; 20944 margin-top: 0.0625rem;
20945`,Ykt=p.div.withConfig({displayName:"ProjectSettingsCompetitors__AddBarIcon",componentId:"sc-1i92bcd-6"})` 20946 flex-shrink: 0; 20947 display: flex; 20948 align-items: center; 20949 20950 @media (max-width: 640px) { 20951 display: none; 20952 } 20953`,Xkt=p.div.withConfig({displayName:"ProjectSettingsCompetitors__AddBar",componentId:"sc-1i92bcd-7"})` 20954 display: flex; 20955 align-items: center; 20956 gap: 0.5rem; 20957 padding: 0.875rem 1rem; 20958 background: ${cn}; 20959 border: 1px solid ${V}; 20960 border-radius: 0.625rem; 20961 margin-bottom: 1rem; 20962 20963 @media (max-width: 640px) { 20964 display: grid; 20965 grid-template-columns: 1fr 1fr; 20966 gap: 0.5rem; 20967 } 20968`,Lue=p.input.withConfig({displayName:"ProjectSettingsCompetitors__AddBarInput",componentId:"sc-1i92bcd-8"})` 20969 flex: 1; 20970 min-width: 0; 20971 padding: 0.5rem 0.75rem; 20972 border: 1.5px solid ${V}; 20973 border-radius: 0.5rem; 20974 font-size: 0.8125rem; 20975 font-family: inherit; 20976 background: ${Z}; 20977 color: ${O}; 20978 outline: none; 20979 transition: border-color 0.15s, box-shadow 0.15s; 20980 20981 &::placeholder { 20982 color: ${Pe}; 20983 } 20984 &:focus { 20985 border-color: ${ot}; 20986 box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-brand-600) 12%, transparent); 20987 } 20988 &:disabled { 20989 opacity: 0.5; 20990 cursor: not-allowed; 20991 } 20992 20993 @media (max-width: 640px) { 20994 grid-column: 1 / -1; 20995 } 20996`,Qkt=p(Lue).withConfig({displayName:"ProjectSettingsCompetitors__AddBarNameInput",componentId:"sc-1i92bcd-9"})` 20997 max-width: 16rem; 20998 20999 @media (max-width: 640px) { 21000 max-width: none; 21001 grid-column: 1 / 2; 21002 } 21003`,Zkt=p.div.withConfig({displayName:"ProjectSettingsCompetitors__AddBarButton",componentId:"sc-1i92bcd-10"})` 21004 @media (max-width: 640px) { 21005 grid-column: 2 / 3; 21006 display: flex; 21007 21008 > button { 21009 width: 100%; 21010 } 21011 } 21012`,Jkt=p.div.withConfig({displayName:"ProjectSettingsCompetitors__TwoColLayout",componentId:"sc-1i92bcd-11"})` 21013 display: grid; 21014 grid-template-columns: 57fr 43fr; 21015 gap: 1rem; 21016 align-items: start; 21017 margin-bottom: 1.5rem; 21018 21019 @media (max-width: 960px) { 21020 grid-template-columns: 1fr; 21021 } 21022`,Bue=p.div.withConfig({displayName:"ProjectSettingsCompetitors__Card",componentId:"sc-1i92bcd-12"})` 21023 background: ${Z}; 21024 border: 1px solid ${V}; 21025 border-radius: 0.75rem; 21026 min-width: 0; 21027 overflow: hidden; 21028`,pJ=p.div.withConfig({displayName:"ProjectSettingsCompetitors__CardHeader",componentId:"sc-1i92bcd-13"})` 21029 padding: 0.875rem 1.125rem; 21030 border-bottom: 1px solid ${$e}; 21031 display: flex; 21032 align-items: center; 21033 justify-content: space-between; 21034 gap: 0.5rem; 21035 flex-wrap: wrap; 21036`,mJ=p.h2.withConfig({displayName:"ProjectSettingsCompetitors__CardTitle",componentId:"sc-1i92bcd-14"})` 21037 font-size: 0.9375rem; 21038 font-weight: 700; 21039 color: ${O}; 21040 margin: 0; 21041`,e$t=p.div.withConfig({displayName:"ProjectSettingsCompetitors__CardTitleRow",componentId:"sc-1i92bcd-15"})` 21042 display: inline-flex; 21043 align-items: baseline; 21044 gap: 0.4rem; 21045 flex-wrap: wrap; 21046`,t$t=p.span.withConfig({displayName:"ProjectSettingsCompetitors__CardTitleCount",componentId:"sc-1i92bcd-16"})` 21047 color: ${Pe}; 21048 font-size: 0.8125rem; 21049 font-weight: 650; 21050`,n$t=p.div.withConfig({displayName:"ProjectSettingsCompetitors__CardSubtitle",componentId:"sc-1i92bcd-17"})` 21051 font-size: 0.8125rem; 21052 color: ${Pe}; 21053 margin-top: 0.125rem; 21054`,Fue=p.div.withConfig({displayName:"ProjectSettingsCompetitors__CardControls",componentId:"sc-1i92bcd-18"})` 21055 display: flex; 21056 align-items: center; 21057 gap: 0.375rem; 21058 flex-wrap: wrap; 21059`,i$t=p(Fue).withConfig({displayName:"ProjectSettingsCompetitors__TrackedCardControls",componentId:"sc-1i92bcd-19"})` 21060 flex: 1 1 36rem; 21061 justify-content: space-between; 21062 min-width: min(100%, 30rem); 21063`,Fx=p.button.withConfig({displayName:"ProjectSettingsCompetitors__SortBtn",componentId:"sc-1i92bcd-20"})` 21064 display: inline-flex; 21065 align-items: center; 21066 justify-content: center; 21067 width: 1.875rem; 21068 height: 1.875rem; 21069 border-radius: 0.375rem; 21070 border: 1px solid ${e=>e.$active?ot:V}; 21071 background: ${e=>e.$active?cn:"transparent"}; 21072 color: ${e=>e.$active?ot:Pe}; 21073 cursor: pointer; 21074 padding: 0; 21075 transition: all 0.15s; 21076 21077 &:hover { 21078 border-color: ${ot}; 21079 color: ${ot}; 21080 background: ${cn}; 21081 }
21082`,hJ=p.div.withConfig({displayName:"ProjectSettingsCompetitors__CardBody",componentId:"sc-1i92bcd-21"})` 21083 min-height: 6rem; 21084 max-height: 32rem; 21085 overflow-y: auto; 21086`,r$t=p(Bue).withConfig({displayName:"ProjectSettingsCompetitors__SuggestedCard",componentId:"sc-1i92bcd-22"})` 21087 position: sticky; 21088 top: 1.75rem; 21089 21090 @media (max-width: 960px) { 21091 position: static; 21092 } 21093`,I2=p.div.withConfig({displayName:"ProjectSettingsCompetitors__EmptyState",componentId:"sc-1i92bcd-23"})` 21094 padding: 2rem; 21095 text-align: center; 21096 color: ${Pe}; 21097 font-size: 0.8125rem; 21098`,fJ=p.div.withConfig({displayName:"ProjectSettingsCompetitors__DirectItem",componentId:"sc-1i92bcd-24"})` 21099 display: flex; 21100 align-items: center; 21101 gap: 0.625rem; 21102 padding: 0.5rem 1rem; 21103 border-bottom: 1px solid ${$e}; 21104 transition: background 0.1s; 21105 min-width: 0; 21106 flex-wrap: wrap; 21107 21108 &:last-child { 21109 border-bottom: none; 21110 } 21111 &:hover { 21112 background: ${$e}22; 21113 } 21114`,gJ=p.div.withConfig({displayName:"ProjectSettingsCompetitors__DirectInfo",componentId:"sc-1i92bcd-25"})` 21115 flex: 1; 21116 min-width: 0; 21117`,o$t=p.div.withConfig({displayName:"ProjectSettingsCompetitors__DirectName",componentId:"sc-1i92bcd-26"})` 21118 font-size: 0.8125rem; 21119 font-weight: 600; 21120 color: ${O}; 21121 white-space: nowrap; 21122 overflow: hidden; 21123 text-overflow: ellipsis; 21124`,s$t=p.div.withConfig({displayName:"ProjectSettingsCompetitors__DirectUrl",componentId:"sc-1i92bcd-27"})` 21125 font-size: 0.6875rem; 21126 color: ${Pe}; 21127 white-space: nowrap; 21128 overflow: hidden; 21129 text-overflow: ellipsis; 21130 margin-top: 0.0625rem; 21131`,a$t=p.span.withConfig({displayName:"ProjectSettingsCompetitors__AliasCount",componentId:"sc-1i92bcd-28"})` 21132 font-size: 0.625rem; 21133 font-weight: 400; 21134 color: ${Pe}; 21135`,l$t=p.div.withConfig({displayName:"ProjectSettingsCompetitors__AliasRow",componentId:"sc-1i92bcd-29"})` 21136 display: flex; 21137 gap: 0.25rem; 21138 margin-top: 0.1875rem; 21139 flex-wrap: wrap; 21140`,c$t=p.span.withConfig({displayName:"ProjectSettingsCompetitors__AliasTag",componentId:"sc-1i92bcd-30"})` 21141 font-size: 0.5625rem; 21142 font-weight: 500; 21143 padding: 0.0625rem 0.375rem; 21144 border-radius: 0.25rem; 21145 background: ${$e}; 21146 color: ${z}; 21147 white-space: nowrap; 21148`,d$t=p.button.withConfig({displayName:"ProjectSettingsCompetitors__IconBtn",componentId:"sc-1i92bcd-31"})` 21149 display: inline-flex; 21150 align-items: center; 21151 justify-content: center; 21152 width: 1.5rem; 21153 height: 1.5rem; 21154 border-radius: 0.375rem; 21155 border: none; 21156 background: transparent; 21157 color: ${Pe}; 21158 cursor: pointer; 21159 padding: 0; 21160 transition: background 0.15s, color 0.15s; 21161 21162 &:hover { 21163 background: ${$e}; 21164 color: ${z}; 21165 } 21166 &:disabled { 21167 opacity: 0.4; 21168 cursor: not-allowed; 21169 } 21170`,yJ=p.div.withConfig({displayName:"ProjectSettingsCompetitors__StatsGroup",componentId:"sc-1i92bcd-32"})` 21171 display: flex; 21172 align-items: flex-start; 21173 gap: 0.75rem; 21174 flex-shrink: 0; 21175 21176 @media (max-width: 480px) { 21177 gap: 0.5rem; 21178 } 21179`,P2=p.div.withConfig({displayName:"ProjectSettingsCompetitors__StatCol",componentId:"sc-1i92bcd-33"})` 21180 display: flex; 21181 flex-direction: column; 21182 align-items: center; 21183 width: 3.25rem; 21184`,A2=p.div.withConfig({displayName:"ProjectSettingsCompetitors__StatValWrap",componentId:"sc-1i92bcd-34"})` 21185 display: flex; 21186 align-items: center; 21187 justify-content: center; 21188 height: 1.25rem; 21189`,xJ=p.span.withConfig({displayName:"ProjectSettingsCompetitors__VisPill",componentId:"sc-1i92bcd-35"})` 21190 display: inline-flex; 21191 align-items: center; 21192 padding: 0.15rem 0.5rem; 21193 border-radius: 999px; 21194 background: ${cn}; 21195 color: ${ot}; 21196 font-size: 0.6875rem; 21197 font-weight: 800; 21198 cursor: default; 21199 white-space: nowrap; 21200`,bJ=p.span.withConfig({displayName:"ProjectSettingsCompetitors__MentionVal",componentId:"sc-1i92bcd-36"})` 21201 font-size: 0.75rem; 21202 font-weight: 700; 21203 color: ${O}; 21204 line-height: 1; 21205`,N2=p.span.withConfig({displayName:"ProjectSettingsCompetitors__RowStatLabel",componentId:"sc-1i92bcd-37"})` 21206 font-size: 0.5625rem; 21207 color: ${Pe}; 21208 margin-top: 0.125rem; 21209 line-height: 1; 21210`;function Wx({data:e,width:n=48,height:i=18}){const r=l.useId().replace(/[^a-zA-Z0-9_-]/g,"");if(!e||e.length<2||e.filter(v=>v>0).length<2)return null;const o=2,s=3,a=Math.min(...e),c=Math.max(...e),u=Math.max(1e-6,c-a),m=(n-o*2)/(e.length-1),h=v=>s+(i-s*2)*(1-(v-a)/u);let g="";for(let v=0;v<e.length;v++){const _=o+m*v,$=h(e[v]);g+=g?` L ${_.toFixed(2)} ${$.toFixed(2)}`:`M ${_.toFixed(2)} ${$.toFixed(2)}`}const x=o,y=o+m*(e.length-1),w=i-s,j=`${g} L ${y.toFixed(2)} ${w.toFixed(2)} L ${x.toFixed(2)} ${w.toFixed(2)} Z`;return t.jsxs("svg",{width:n,height:i,viewBox:`0 0 ${n} ${i}`,style:{display:"block",flexShrink:0,maxWidth:"100%"},children:[t.jsx("defs",{children:t.jsxs("linearGradient",{id:`sparkFill-${r}`,x1:"0",x2:"0",y1:"0",y2:"1",children:[t.jsx("stop",{offset:"0%",stopColor:ot,stopOpacity:.35}),t.jsx("stop",{offset:"100%",stopColor:ot,stopOpacity:.04})]})}),t.jsx("path",{d:j,fill:`url(#sparkFill-${r})`}),t.jsx("path",{d:g,fill:"none",stroke:ot,strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})]})}
21210const vJ=p.div.withConfig({displayName:"ProjectSettingsCompetitors__SuggItem",componentId:"sc-1i92bcd-38"})` 21211 display: flex; 21212 align-items: center; 21213 gap: 0.625rem; 21214 padding: 0.625rem 1rem; 21215 border-bottom: 1px solid ${$e}; 21216 transition: background 0.1s; 21217 min-width: 0; 21218 flex-wrap: wrap; 21219 21220 &:last-child { 21221 border-bottom: none; 21222 } 21223 &:hover { 21224 background: ${si}; 21225 } 21226`,wJ=p.div.withConfig({displayName:"ProjectSettingsCompetitors__SuggInfo",componentId:"sc-1i92bcd-39"})` 21227 flex: 1; 21228 min-width: 0; 21229`,u$t=p.div.withConfig({displayName:"ProjectSettingsCompetitors__SuggName",componentId:"sc-1i92bcd-40"})` 21230 font-size: 0.8125rem; 21231 font-weight: 600; 21232 color: ${O}; 21233 white-space: nowrap; 21234 overflow: hidden; 21235 text-overflow: ellipsis; 21236`,p$t=p.div.withConfig({displayName:"ProjectSettingsCompetitors__SuggUrl",componentId:"sc-1i92bcd-41"})` 21237 font-size: 0.6875rem; 21238 color: ${Pe}; 21239 white-space: nowrap; 21240 overflow: hidden; 21241 text-overflow: ellipsis; 21242 margin-top: 0.0625rem; 21243`,m$t=p.button.withConfig({displayName:"ProjectSettingsCompetitors__TrackBtn",componentId:"sc-1i92bcd-42"})` 21244 display: inline-flex; 21245 align-items: center; 21246 gap: 0.25rem; 21247 padding: 0.25rem 0.625rem; 21248 border-radius: 0.375rem; 21249 border: none; 21250 background: ${ot}; 21251 color: ${Z}; 21252 font-size: 0.6875rem; 21253 font-weight: 600; 21254 font-family: inherit; 21255 cursor: pointer; 21256 flex-shrink: 0; 21257 transition: opacity 0.15s; 21258 21259 &:hover { 21260 opacity: 0.85; 21261 } 21262 &:disabled { 21263 opacity: 0.4; 21264 cursor: not-allowed; 21265 } 21266`,h$t=p.button.withConfig({displayName:"ProjectSettingsCompetitors__DismissBtn",componentId:"sc-1i92bcd-43"})` 21267 display: inline-flex; 21268 align-items: center; 21269 justify-content: center; 21270 width: 1.25rem; 21271 height: 1.25rem; 21272 border-radius: 999px; 21273 border: none; 21274 background: transparent; 21275 color: ${Pe}; 21276 cursor: pointer; 21277 flex-shrink: 0; 21278 transition: background 0.15s, color 0.15s; 21279 padding: 0; 21280 21281 &:hover { 21282 background: ${$e}; 21283 color: ${z}; 21284 } 21285`,H4=8,f$t=p.button.withConfig({displayName:"ProjectSettingsCompetitors__ShowMoreBar",componentId:"sc-1i92bcd-44"})` 21286 display: flex; 21287 align-items: center; 21288 justify-content: center; 21289 gap: 0.35rem; 21290 width: 100%; 21291 padding: 0.5rem 0; 21292 border: none; 21293 border-top: 1px solid ${$e}; 21294 background: transparent; 21295 color: ${z}; 21296 font-size: 0.75rem; 21297 font-weight: 600; 21298 font-family: inherit; 21299 cursor: pointer; 21300 transition: background 0.15s, color 0.15s; 21301 21302 &:hover { 21303 background: ${$e}; 21304 color: ${O}; 21305 } 21306`,q4=p.button.withConfig({displayName:"ProjectSettingsCompetitors__CompareBtn",componentId:"sc-1i92bcd-45"})` 21307 display: inline-flex; 21308 align-items: center; 21309 gap: 0.3rem; 21310 height: 1.875rem; 21311 padding: 0 0.65rem; 21312 border: none; 21313 border-radius: 0.375rem; 21314 background: ${e=>e.$danger?Ut:ot}; 21315 color: ${Z}; 21316 font-size: 0.6875rem; 21317 font-weight: 600; 21318 font-family: inherit; 21319 cursor: pointer; 21320 white-space: nowrap; 21321 transition: background 0.15s; 21322 21323 &:hover { 21324 background: ${e=>e.$danger?oi:Ft}; 21325 } 21326 21327 &:disabled { 21328 opacity: 0.55; 21329 cursor: not-allowed; 21330 } 21331`,g$t=p.div.withConfig({displayName:"ProjectSettingsCompetitors__CompetitorBulkActions",componentId:"sc-1i92bcd-46"})` 21332 display: inline-flex; 21333 align-items: center; 21334 gap: 0.5rem; 21335 flex-wrap: wrap; 21336`,y$t=p.div.withConfig({displayName:"ProjectSettingsCompetitors__CompetitorSearchActions",componentId:"sc-1i92bcd-47"})` 21337 display: inline-flex; 21338 align-items: center; 21339 gap: 0.5rem; 21340 flex-wrap: wrap; 21341 justify-content: flex-end; 21342`,x$t=p.button.withConfig({displayName:"ProjectSettingsCompetitors__CompareCheckbox",componentId:"sc-1i92bcd-48"})` 21343 width: 1rem; 21344 height: 1rem; 21345 border-radius: 0.25rem; 21346 border: 2px solid ${e=>e.$checked?ot:V}; 21347 background: ${e=>e.$checked?ot:"transparent"}; 21348 display: flex; 21349 align-items: center; 21350 justify-content: center; 21351 flex-shrink: 0; 21352 cursor: ${e=>e.$disabled?"not-allowed":"pointer"}; 21353 opacity: ${e=>e.$disabled?.4:1}; 21354 transition: background 0.15s, border-color 0.15s, opacity 0.15s; 21355 padding: 0; 21356 21357 &:hover { 21358 border-color: ${e=>e.$disabled?V:ot}; 21359 }
21360`,jJ=p.div.withConfig({displayName:"ProjectSettingsCompetitors__CompareSection",componentId:"sc-1i92bcd-49"})` 21361 background: ${Z}; 21362 border: 1px solid ${V}; 21363 border-radius: 0.75rem; 21364 margin-bottom: 1.25rem; 21365 overflow: hidden; 21366`,_J=p.div.withConfig({displayName:"ProjectSettingsCompetitors__CompareSectionHeader",componentId:"sc-1i92bcd-50"})` 21367 display: flex; 21368 align-items: center; 21369 justify-content: space-between; 21370 padding: 0.75rem 1.125rem; 21371 border-bottom: 1px solid ${$e}; 21372 flex-wrap: wrap; 21373 gap: 0.5rem; 21374`,CJ=p.h3.withConfig({displayName:"ProjectSettingsCompetitors__CompareSectionTitle",componentId:"sc-1i92bcd-51"})` 21375 font-size: 0.875rem; 21376 font-weight: 700; 21377 color: ${O}; 21378 margin: 0; 21379`,SJ=p.div.withConfig({displayName:"ProjectSettingsCompetitors__CompareSectionControls",componentId:"sc-1i92bcd-52"})` 21380 display: flex; 21381 align-items: center; 21382 gap: 0.625rem; 21383`,z2=p.button.withConfig({displayName:"ProjectSettingsCompetitors__CompareCloseBtn",componentId:"sc-1i92bcd-53"})` 21384 display: inline-flex; 21385 align-items: center; 21386 justify-content: center; 21387 width: 1.5rem; 21388 height: 1.5rem; 21389 border-radius: 0.375rem; 21390 border: none; 21391 background: transparent; 21392 color: ${Pe}; 21393 cursor: pointer; 21394 padding: 0; 21395 transition: all 0.15s; 21396 21397 &:hover { 21398 background: ${$e}; 21399 color: ${O}; 21400 } 21401`,b$t=p.div.withConfig({displayName:"ProjectSettingsCompetitors__CompareTable",componentId:"sc-1i92bcd-54"})` 21402 display: grid; 21403 overflow-x: auto; 21404`,xj=p.div.withConfig({displayName:"ProjectSettingsCompetitors__CompareRow",componentId:"sc-1i92bcd-55"})` 21405 display: grid; 21406 align-items: center; 21407 padding: 0.625rem 1rem; 21408 border-bottom: 1px solid ${$e}; 21409 font-size: 0.75rem; 21410 color: ${O}; 21411 21412 &:last-child { border-bottom: none; } 21413 21414 ${e=>e.$head?`background: ${At}; font-weight: 600; color: ${z}; font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.025rem;`:""} 21415`,sl=p.div.withConfig({displayName:"ProjectSettingsCompetitors__CompareCell",componentId:"sc-1i92bcd-56"})` 21416 text-align: ${e=>e.$name?"left":"center"}; 21417 font-weight: ${e=>e.$name?600:400}; 21418 ${e=>e.$name?"display: flex; align-items: center;":"display: flex; align-items: center; justify-content: center;"} 21419`,kJ=p.span.withConfig({displayName:"ProjectSettingsCompetitors__CompareCellScore",componentId:"sc-1i92bcd-57"})` 21420 font-size: 1rem; 21421 font-weight: 700; 21422 color: ${e=>e.$color}; 21423`,v$t=p.div.withConfig({displayName:"ProjectSettingsCompetitors__PanelOverlay",componentId:"sc-1i92bcd-58"})` 21424 position: fixed; 21425 inset: 0; 21426 background: color-mix(in srgb, var(--color-gray-900) 30%, transparent); 21427 z-index: 50; 21428 opacity: ${e=>e.$open?1:0}; 21429 pointer-events: ${e=>e.$open?"auto":"none"}; 21430 transition: opacity 0.25s; 21431`,w$t=p.div.withConfig({displayName:"ProjectSettingsCompetitors__Panel",componentId:"sc-1i92bcd-59"})` 21432 position: fixed; 21433 top: 0; 21434 right: 0; 21435 bottom: 0; 21436 width: 28rem; 21437 max-width: 100vw; 21438 background: ${Z}; 21439 z-index: 51; 21440 transform: translateX(${e=>e.$open?"0":"100%"}); 21441 transition: transform 0.3s ease; 21442 box-shadow: -8px 0 30px color-mix(in srgb, var(--color-gray-900) 10%, transparent); 21443 display: flex; 21444 flex-direction: column; 21445`,j$t=p.div.withConfig({displayName:"ProjectSettingsCompetitors__MergeTag",componentId:"sc-1i92bcd-60"})` 21446 display: inline-flex; 21447 align-items: center; 21448 gap: 0.375rem; 21449 padding: 0.3rem 0.5rem; 21450 border-radius: 0.5rem; 21451 background: ${e=>e.$main?cn:At}; 21452 border: 1px solid ${e=>e.$main?ot:V}; 21453 font-size: 0.75rem; 21454 font-weight: 600; 21455 color: ${O}; 21456`,_$t=p.span.withConfig({displayName:"ProjectSettingsCompetitors__MergeTagLabel",componentId:"sc-1i92bcd-61"})` 21457 font-size: 0.5625rem; 21458 font-weight: 700; 21459 text-transform: uppercase; 21460 letter-spacing: 0.03em; 21461 color: ${Pe}; 21462`,C$t=p.button.withConfig({displayName:"ProjectSettingsCompetitors__MergeTagRemove",componentId:"sc-1i92bcd-62"})` 21463 display: inline-flex; 21464 align-items: center; 21465 justify-content: center; 21466 width: 1rem; 21467 height: 1rem; 21468 border-radius: 50%; 21469 border: none; 21470 background: transparent; 21471 color: ${Pe}; 21472 cursor: pointer; 21473 padding: 0; 21474 21475 &:hover { 21476 background: ${V}; 21477 color: ${O}; 21478 }
21479`,S$t=p.button.withConfig({displayName:"ProjectSettingsCompetitors__MergeConfirmBtn",componentId:"sc-1i92bcd-63"})` 21480 display: inline-flex; 21481 align-items: center; 21482 gap: 0.375rem; 21483 padding: 0.5rem 1rem; 21484 border: none; 21485 border-radius: 0.5rem; 21486 background: ${ot}; 21487 color: ${Z}; 21488 font-size: 0.75rem; 21489 font-weight: 600; 21490 font-family: inherit; 21491 cursor: pointer; 21492 transition: background 0.15s, opacity 0.15s; 21493 21494 &:hover:not(:disabled) { 21495 background: ${Ft}; 21496 } 21497 &:disabled { 21498 opacity: 0.4; 21499 cursor: not-allowed; 21500 } 21501`,k$t=p.div.withConfig({displayName:"ProjectSettingsCompetitors__PanelHeader",componentId:"sc-1i92bcd-64"})` 21502 padding: 1.25rem 1.5rem; 21503 border-bottom: 1px solid ${$e}; 21504 display: flex; 21505 align-items: flex-start; 21506 justify-content: space-between; 21507`,$$t=p.div.withConfig({displayName:"ProjectSettingsCompetitors__PanelHeaderInfo",componentId:"sc-1i92bcd-65"})` 21508 display: flex; 21509 align-items: center; 21510 gap: 0.75rem; 21511 min-width: 0; 21512`,I$t=p.div.withConfig({displayName:"ProjectSettingsCompetitors__PanelTitle",componentId:"sc-1i92bcd-66"})` 21513 font-size: 1rem; 21514 font-weight: 700; 21515 color: ${O}; 21516`,P$t=p.div.withConfig({displayName:"ProjectSettingsCompetitors__PanelUrl",componentId:"sc-1i92bcd-67"})` 21517 font-size: 0.75rem; 21518 color: ${Pe}; 21519 margin-top: 0.125rem; 21520`,A$t=p.button.withConfig({displayName:"ProjectSettingsCompetitors__PanelClose",componentId:"sc-1i92bcd-68"})` 21521 background: none; 21522 border: none; 21523 cursor: pointer; 21524 color: ${Pe}; 21525 padding: 0.25rem; 21526 border-radius: 0.375rem; 21527 transition: background 0.15s, color 0.15s; 21528 flex-shrink: 0; 21529 21530 &:hover { 21531 background: ${$e}; 21532 color: ${O}; 21533 } 21534`,N$t=p.div.withConfig({displayName:"ProjectSettingsCompetitors__PanelBody",componentId:"sc-1i92bcd-69"})` 21535 flex: 1; 21536 overflow-y: auto; 21537 padding: 1.5rem; 21538`,bj=p.div.withConfig({displayName:"ProjectSettingsCompetitors__PanelSection",componentId:"sc-1i92bcd-70"})` 21539 margin-bottom: 1.5rem; 21540`,z$t=p.div.withConfig({displayName:"ProjectSettingsCompetitors__PanelSectionHeader",componentId:"sc-1i92bcd-71"})` 21541 display: flex; 21542 align-items: center; 21543 justify-content: space-between; 21544 margin-bottom: 0.625rem; 21545`,vj=p.div.withConfig({displayName:"ProjectSettingsCompetitors__PanelSectionTitle",componentId:"sc-1i92bcd-72"})` 21546 font-size: 0.6875rem; 21547 font-weight: 600; 21548 color: ${Pe}; 21549 text-transform: uppercase; 21550 letter-spacing: 0.025rem; 21551`,G4=p.hr.withConfig({displayName:"ProjectSettingsCompetitors__PanelDivider",componentId:"sc-1i92bcd-73"})` 21552 border: none; 21553 border-top: 1px solid ${$e}; 21554 margin: 1.25rem 0; 21555`,T$t=p.div.withConfig({displayName:"ProjectSettingsCompetitors__VisScoreRow",componentId:"sc-1i92bcd-74"})` 21556 display: flex; 21557 align-items: baseline; 21558 gap: 0.5rem; 21559`,E$t=p.span.withConfig({displayName:"ProjectSettingsCompetitors__VisScoreBig",componentId:"sc-1i92bcd-75"})` 21560 font-size: 2.25rem; 21561 font-weight: 800; 21562 color: ${e=>e.$color}; 21563 line-height: 1; 21564`,M$t=p.div.withConfig({displayName:"ProjectSettingsCompetitors__VisMeter",componentId:"sc-1i92bcd-76"})` 21565 height: 0.375rem; 21566 border-radius: 999px; 21567 background: ${$e}; 21568 margin-top: 0.5rem; 21569 overflow: hidden; 21570`,R$t=p.div.withConfig({displayName:"ProjectSettingsCompetitors__VisMeterFill",componentId:"sc-1i92bcd-77"})` 21571 height: 100%; 21572 border-radius: 999px; 21573 width: ${e=>e.$width}%; 21574 background: ${e=>e.$color}; 21575 transition: width 0.5s ease; 21576`,O$t=p.div.withConfig({displayName:"ProjectSettingsCompetitors__MentionStatsRow",componentId:"sc-1i92bcd-78"})` 21577 display: flex; 21578 gap: 1.25rem; 21579`,D$t=p.div.withConfig({displayName:"ProjectSettingsCompetitors__MentionStatBlock",componentId:"sc-1i92bcd-79"})` 21580 display: flex; 21581 flex-direction: column; 21582`,L$t=p.div.withConfig({displayName:"ProjectSettingsCompetitors__MentionStatNumber",componentId:"sc-1i92bcd-80"})` 21583 font-size: 1.5rem; 21584 font-weight: 700; 21585 color: ${e=>e.$color||O}; 21586 line-height: 1.2; 21587`,B$t=p.div.withConfig({displayName:"ProjectSettingsCompetitors__MentionStatLabel",componentId:"sc-1i92bcd-81"})` 21588 font-size: 0.6875rem; 21589 color: ${Pe}; 21590 margin-top: 0.125rem;
21591`,F$t=p.div.withConfig({displayName:"ProjectSettingsCompetitors__PanelAliasRow",componentId:"sc-1i92bcd-82"})` 21592 display: flex; 21593 align-items: center; 21594 gap: 0.5rem; 21595 padding: 0.5rem 0.75rem; 21596 background: ${At}; 21597 border-radius: 0.5rem; 21598 margin-bottom: 0.375rem; 21599`,W$t=p.div.withConfig({displayName:"ProjectSettingsCompetitors__PanelAliasName",componentId:"sc-1i92bcd-83"})` 21600 font-size: 0.75rem; 21601 font-weight: 500; 21602 color: ${O}; 21603 flex: 1; 21604`,U$t=p.div.withConfig({displayName:"ProjectSettingsCompetitors__PanelAliasEmpty",componentId:"sc-1i92bcd-84"})` 21605 font-size: 0.75rem; 21606 color: ${Pe}; 21607 padding: 0.75rem 0; 21608`,H$t=p.div.withConfig({displayName:"ProjectSettingsCompetitors__PanelBtnRow",componentId:"sc-1i92bcd-85"})` 21609 display: flex; 21610 flex-direction: column; 21611 gap: 0.5rem; 21612 margin-top: 0.5rem; 21613`,T2=p.button.withConfig({displayName:"ProjectSettingsCompetitors__PanelActionBtn",componentId:"sc-1i92bcd-86"})` 21614 display: flex; 21615 align-items: center; 21616 justify-content: flex-start; 21617 gap: 0.5rem; 21618 width: 100%; 21619 padding: 0.625rem 0.75rem; 21620 border-radius: 0.5rem; 21621 font-size: 0.8125rem; 21622 font-weight: 500; 21623 font-family: inherit; 21624 cursor: pointer; 21625 transition: background 0.15s, color 0.15s, border-color 0.15s; 21626 21627 ${e=>e.$variant==="danger"?` 21628 background: ${kn}; 21629 border: 1px solid ${Ut}; 21630 color: ${oi}; 21631 &:hover { background: ${Ut}; color: ${Z}; } 21632 `:` 21633 background: ${Z}; 21634 border: 1px solid ${V}; 21635 color: ${O}; 21636 &:hover { background: ${$e}; } 21637 `} 21638 21639 &:disabled { 21640 opacity: 0.5; 21641 cursor: not-allowed; 21642 } 21643`;function q$t(){const e=Gn(),n=e.workspaceId,i=e.projectId,r=Number(n),o=Number(i),s=Uo(),{projects:a,refreshProjects:c}=Mr(),u=l.useMemo(()=>Number.isFinite(o)&&o>0&&a.find(pe=>pe.id===o)||null,[o,a]),m=!!u?.can?.edit,h=MA(r,o),[g,x]=l.useState(""),[y,w]=l.useState(""),[j,v]=l.useState(!1),[_,$]=l.useState(null),[k,P]=l.useState(null),[S,I]=l.useState(!1),[A,E]=l.useState(""),[B,T]=l.useState({key:"name",asc:!0}),[M,R]=l.useState(""),[F,Y]=l.useState({key:"visibility",asc:!1}),[H,U]=l.useState([]),[X,Q]=l.useState(!1),[K,G]=l.useState(!1),[L,q]=l.useState(!1),[W,oe]=l.useState([]),[se,de]=l.useState(!1),[le,me]=l.useState(!1),[ee,ne]=l.useState(!1),Ae=l.useRef(null),_e=(pe,be,rt)=>{pe.key===rt?be({key:rt,asc:!pe.asc}):be({key:rt,asc:rt==="name"})};l.useEffect(()=>{!r||!o||h.loading||h.error||h.ensure()},[h,r,o]);const we=h.direct,Ke=l.useMemo(()=>{let pe=[...we];const be=A.trim().toLowerCase();be&&(pe=pe.filter(ze=>ze.name.toLowerCase().includes(be)||(ze.website||"").toLowerCase().includes(be)||(Array.isArray(ze.aliases)?ze.aliases:[]).some(lt=>lt.toLowerCase().includes(be))));const rt=B.asc?1:-1;return pe.sort((ze,lt)=>B.key==="visibility"?rt*((ze.visibility_score??-1)-(lt.visibility_score??-1)):B.key==="mentions"?rt*((ze.mention_count??0)-(lt.mention_count??0)):rt*ze.name.localeCompare(lt.name)),pe},[we,A,B]),ce=h.suggested,ie=l.useMemo(()=>{let pe=[...ce];const be=M.trim().toLowerCase();be&&(pe=pe.filter(ze=>ze.name.toLowerCase().includes(be)||(ze.website||"").toLowerCase().includes(be)||(Array.isArray(ze.aliases)?ze.aliases:[]).some(lt=>lt.toLowerCase().includes(be))));const rt=F.asc?1:-1;return pe.sort((ze,lt)=>F.key==="visibility"?rt*((ze.visibility_score??-1)-(lt.visibility_score??-1)):F.key==="mentions"?rt*((ze.mention_count??0)-(lt.mention_count??0)):rt*ze.name.localeCompare(lt.name)),pe},[ce,M,F]),Re=h.summary,Be=h.project_website??null,tt=Number(h.max_competitors)>0?Number(h.max_competitors):dJ,dt=h.loading&&!h.data,je=h.loading&&!!h.data,Me=l.useRef(new Set),Se=Number.isFinite(tt)&&tt>0?tt:dJ,it=we.length>=Se,De=l.useMemo(()=>k?we.find(pe=>pe.id===k.id)??k:null,[k,we]),te=pe=>{U(be=>be.includes(pe)?be.filter(rt=>rt!==pe):be.length>=5?be:[...be,pe])},ge=l.useMemo(()=>we.filter(pe=>H.includes(pe.id)),[we,H]),Je=pe=>{oe(be=>be.includes(pe)?be.filter(rt=>rt!==pe):be.length>=5?be:[...be,pe])},Ee=l.useMemo(()=>W.map(pe=>we.find(be=>be.id===pe)).filter(Boolean),[we,W]),Xe=async()=>{if(!m||Ee.length<2)return;const[pe,...be]=Ee;de(!0);try{if(!h.updateCompetitorAliases||!h.deleteCompetitor)throw new Error("Competitors provider not ready");
21643const rt=(pe.aliases||[]).filter(Boolean),ze=be.map(vt=>vt.name).filter(vt=>!rt.includes(vt)),lt=[...rt,...ze];await h.updateCompetitorAliases(pe.id,lt);for(const vt of be)await h.deleteCompetitor(vt.id);s.showToast(`Merged ${be.length} competitor${be.length!==1?"s":""} into ${pe.name}.`,{tone:"success"}),oe([]),q(!1)}catch(rt){s.showToast(rt?.message||"Failed to merge competitors",{tone:"error"})}finally{de(!1)}};l.useEffect(()=>{const pe=h.error?String(h.error||"").trim():"";pe&&Ae.current!==pe&&(Ae.current=pe,s.showToast(pe,{tone:"error"}))},[h.error,s]);const yt=async()=>{if(!m)return;if(it){s.showToast(`You can select a maximum of ${Se} competitors.`,{tone:"error"});return}const pe=Wl(y);if(!pe){s.showToast("Please enter a valid competitor website (e.g., example.com or https://example.com)",{tone:"error"});return}const be=uJ(Be),rt=uJ(pe);if(be&&rt&&be===rt){s.showToast("You can't add your own website as a competitor.",{tone:"error"});return}try{if(!h.createCompetitor)throw new Error("Competitors provider not ready");const ze=String(g||"").trim();if(!ze){s.showToast("Name is required.",{tone:"error"}),x(_2(pe));return}await h.createCompetitor({website:pe,name:ze,competitor_type:"direct"}),x(""),w(""),s.showToast("Competitor added.",{tone:"success"})}catch(ze){s.showToast(ze?.message||"Failed to add competitor",{tone:"error"})}},Ne=async pe=>{if(m&&!Me.current.has(pe)){Me.current.add(pe);try{if(!h.deleteCompetitor)throw new Error("Competitors provider not ready");await h.deleteCompetitor(pe),s.showToast("Competitor removed.",{tone:"success"})}catch(be){s.showToast(be?.message||"Failed to remove competitor",{tone:"error"})}finally{Me.current.delete(pe)}}},Le=async()=>{if(!m)return;const pe=H.filter(be=>we.some(rt=>rt.id===be));if(pe.length===0){me(!1);return}ne(!0);try{if(!h.deleteCompetitor)throw new Error("Competitors provider not ready");for(const be of pe)await h.deleteCompetitor(be);s.showToast(`Removed ${pe.length} competitor${pe.length===1?"":"s"}.`,{tone:"success"}),U([]),oe(be=>be.filter(rt=>!pe.includes(rt))),me(!1),k&&pe.includes(k.id)&&P(null)}catch(be){s.showToast(be?.message||"Failed to remove competitors",{tone:"error"})}finally{ne(!1)}},[Ue,We]=l.useState(!1),Qe=async pe=>{if(m&&!Ue){We(!0);try{const be=await ue(`/api/v1/organizations/${r}/projects/${o}
21643/competitors/${pe.id}/claim_as_brand`,{method:"POST"}),rt=await be.json().catch(()=>({}));if(!be.ok)throw new Error(rt?.error||"Failed to claim as brand");s.showToast(`"${pe.name}" added as your brand alias and removed from competitors.`,{tone:"success",durationMs:5e3}),P(null),h.invalidate?.(),c()}catch(be){s.showToast(be?.message||"Failed to claim as brand",{tone:"error"})}finally{We(!1)}}},ht=async(pe,be)=>{if(m&&pe.competitor_type!==be){if(be==="direct"&&it){s.showToast(`You can select a maximum of ${Se} competitors.`,{tone:"error"});return}try{if(!h.updateCompetitor)throw new Error("Competitors provider not ready");await h.updateCompetitor(pe.id,be),s.showToast("Competitor updated.",{tone:"success"})}catch(rt){s.showToast(rt?.message||"Failed to update competitor",{tone:"error"})}}};return t.jsxs(ma,{children:[t.jsxs(Vkt,{children:[t.jsxs(Ys,{children:[t.jsxs(ha,{children:[t.jsx(fa,{children:"Competitors"}),t.jsx("div",{style:{paddingRight:8,minWidth:0},children:t.jsx(qr,{items:[{label:"Projects",to:n?`/workspaces/${n}`:void 0}
21643,{label:u?.name||"Project",to:n&&i?`/workspaces/${n}/projects/${i}`:void 0},{label:"Settings",to:n&&i?`/workspaces/${n}/projects/${i}/settings`:void 0},{label:"Competitors"}]})})]}),t.jsx(ga,{children:"Track, compare, and analyze your competitive landscape."})]}),t.jsxs(Kkt,{children:[t.jsxs(C2,{children:[t.jsx(S2,{$bg:cn,$fg:ot,children:t.jsx(Jye,{size:16})}),t.jsxs("div",{children:[t.jsxs(k2,{children:[we.length,"/",Se]}),t.jsx($2,{children:"Tracked"})]})]}),t.jsxs(C2,{children:[t.jsx(S2,{$bg:si,$fg:Vt,children:t.jsx(Dc,{size:16})}),t.jsxs("div",{children:[t.jsxs(k2,{children:[Re?Re.avg_visibility:0,"%"]}),t.jsx($2,{children:"Avg. Visibility"})]})]}),t.jsxs(C2,{children:[t.jsx(S2,{$bg:$e,$fg:z,children:t.jsx(t_,{size:16})}),t.jsxs("div",{children:[t.jsx(k2,{children:Re?Re.total_mentions:0}),t.jsx($2,{children:"Total Mentions"})]})]}),t.jsxs(C2,{children:[t.jsx(S2,{$bg:cn,$fg:ot,children:t.jsx(y0e,{size:16})}),t.jsxs("div",{children:[t.jsx(k2,{children:ce.length}),t.jsx($2,{children:"Suggested"})]})]})]}),m?t.jsxs(Xkt,{children:[t.jsx(Ykt,{children:t.jsx(Cs,{size:18,color:ot})}),t.jsx(Lue,{value:y,onChange:pe=>{const be=pe.target.value;if(w(be),String(g||"").trim())return;const rt=Wl(be);rt&&x(_2(rt))},placeholder:"example.com or https://example.com",disabled:dt||je||it,onBlur:()=>{if(String(g||"").trim())return;const pe=Wl(y);pe&&x(_2(pe))},onKeyDown:pe=>{pe.key==="Enter"&&(pe.preventDefault(),yt())}}),t.jsx(Qkt,{value:g,onChange:pe=>x(pe.target.value),placeholder:"Name",disabled:dt||je||it,onBlur:()=>{if(String(g||"").trim())return;const be=Wl(y);be&&x(_2(be))}}),t.jsx(Zkt,{children:t.jsxs(he,{type:"button",size:"sm",onClick:()=>void yt(),disabled:!y.trim()||!g.trim()||dt||je||it,children:[t.jsx(gr,{size:16}),"Add"]})})]}):null,X&&(()=>{const pe=ge.length+(K?1:0),be=pe>0?`8rem repeat(${pe}, 1fr)`:"1fr",rt=pe>0?`${8+pe*10}rem`:void 0,ze=Math.round(Re?.avg_visibility??0);return t.jsxs(jJ,{children:[t.jsxs(_J,{children:[t.jsxs(CJ,{children:["Comparison",pe>0?` · ${pe}`:"",K&&pe>0?" (incl. you)":""]}),t.jsxs(SJ,{children:[t.jsxs("label",{style:{display:"flex",alignItems:"center",gap:5,fontSize:"0.6875rem",fontWeight:600,color:z,cursor:"pointer"},children:[t.jsx("input",{type:"checkbox",checked:K,onChange:()=>G(lt=>!lt),style:{accentColor:ot}}),"Include myself"]}),H.length>0&&t.jsx(z2,{type:"button","aria-label":"Clear selection",onClick:()=>{U([]),G(!1)},children:t.jsx(Fi,{size:13})}),t.jsx(z2,{type:"button","aria-label":"Close comparison",onClick:()=>{Q(!1),G(!1)},children:t.jsx(Ei,{size:14})})]})]}),pe===0?t.jsx("div",{style:{padding:"2rem",textAlign:"center",color:Pe,fontSize:"0.8125rem"},children:"Select competitors using the checkboxes below to compare them."}):t.jsxs(b$t,{style:{gridTemplateColumns:"1fr"},children:[t.jsxs(xj,{$head:!0,style:{gridTemplateColumns:be,display:"grid",minWidth:rt},children:[t.jsx(sl,{$name:!0,children:"Competitor"}),K&&t.jsx(sl,{children:t.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:4},children:[t.jsx(xo,{record:u,size:28,shape:"rounded",forceLogoDev:!1}),t.jsx("span",{style:{color:ot,fontWeight:700},children:u?.name??"Your Site"})]})}),ge.map(lt=>t.jsx(sl,{children:t.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:4},children:[t.jsx(xo,{record:lt,size:28,shape:"rounded"}),t.jsx("span",{children:lt.name})]})},lt.id))]}),t.jsxs(xj,{style:{gridTemplateColumns:be,display:"grid",minWidth:rt},children:[t.jsx(sl,{$name:!0,style:{color:z,fontWeight:500},children:"Visibility"}),K&&t.jsx(sl,{children:t.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:4,minHeight:40},children:[t.jsxs(kJ,{$color:U4(ze),children:[ze,"%"]}),Re?.self_trend&&Re.self_trend.length>=2&&t.jsx(Wx,{data:Re.self_trend,width:60,height:20})]})}),ge.map(lt=>{const vt=Math.round(lt.visibility_score??0);return t.jsx(sl,{children:t.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:4,minHeight:40},children:[t.jsxs(kJ,{$color:U4(vt),children:[vt,"%"]}),lt.trend&<.trend.length>=2&&t.jsx(Wx,{data:lt.trend,width:60,height:20})]})},lt.id)})]}),t.jsxs(xj,{style:{gridTemplateColumns:be,display:"grid",minWidth:rt},children:[t.jsx(sl,{$name:!0,style:{color:z,fontWeight:500},children:"AI Mentions"}),K&&t.jsx(sl,{children:t.jsx("span",{style:{fontSize:"1rem",fontWeight:700},children:Re?.self_mention_count??0})}),ge.map(lt=>t.jsx(sl,{children:t.jsx("span",{style:{fontSize:"1rem",fontWeight:700},children:lt.mention_count??0})},lt.id))]}),t.jsxs(xj,{style:{gridTemplateColumns:be,display:"grid",minWidth:rt},children:[t.jsx(sl,{$name:!0,style:{color:z,fontWeight:500},children:"Trend (7d)"}),K&&t.jsx(sl,{style:{minHeight:28},children:Re?.self_trend&&Re.self_trend.length>=2?t.jsx(Wx,{data:Re.self_trend,width:80,height:28}):t.jsx("span",{style:{color:Pe,fontSize:"0.75rem"},children:"â"})}),ge.map(lt=>t.jsx(sl,{style:{minHeight:28},children:lt.trend&<.trend.length>=2?t.jsx(Wx,{data:lt.trend,width:80,height:28}):t.jsx("span",{style:{color:Pe,fontSize:"0.75rem"},children:"â"})},lt.id))]}),t.jsxs(xj,{style:{gridTemplateColumns:be,display:"grid",minWidth:rt},children:[t.jsx(sl,{$name:!0,style:{color:z,fontWeight:500},children:"Aliases"}),K&&t.jsx(sl,{style:{fontSize:"0.6875rem",color:Pe},children:u?.brand_aliases?.length>0?u.brand_aliases.join(", "):"â"}),ge.map(lt=>
21643{const vt=(Array.isArray(lt.aliases)?lt.aliases:[]).filter(Boolean);return t.jsx(sl,{style:{fontSize:"0.6875rem",color:Pe},children:vt.length>0?vt.join(", "):"â"},lt.id)})]})]})]})})(),m&&L&&t.jsxs(jJ,{children:[t.jsxs(_J,{children:[t.jsx(CJ,{children:"Merge Competitors"}),t.jsxs(SJ,{children:[W.length>0&&t.jsx(z2,{type:"button","aria-label":"Clear selection",onClick:()=>oe([]),children:t.jsx(Fi,{size:13})}),t.jsx(z2,{type:"button","aria-label":"Close merge",onClick:()=>{q(!1),oe([])},children:t.jsx(Ei,{size:14})})]})]}),Ee.length===0?t.jsxs("div",{style:{padding:"2rem",textAlign:"center",color:Pe,fontSize:"0.8125rem"},children:["Select the ",t.jsx("strong",{children:"main"})," competitor first, then select duplicates to merge into it."]}):t.jsxs("div",{style:{padding:"1rem 1.125rem"},children:[t.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"0.5rem",alignItems:"center",marginBottom:"0.75rem"},children:Ee.map((pe,be)=>t.jsxs(j$t,{$main:be===0,children:[t.jsx(xo,{record:pe,size:20,shape:"rounded"}),t.jsx("span",{children:pe.name}),t.jsx(_$t,{children:be===0?"Main":"Duplicate"}),t.jsx(C$t,{type:"button","aria-label":`Remove ${pe.name}`,onClick:()=>oe(rt=>rt.filter(ze=>ze!==pe.id)),children:t.jsx(Ei,{size:10})})]},pe.id))}),Ee.length>=2&&t.jsxs("div",{style:{fontSize:"0.75rem",color:z,marginBottom:"0.75rem"},children:["The names of the ",Ee.length-1," duplicate",Ee.length-1!==1?"s":""," will be added as aliases to ",t.jsx("strong",{children:Ee[0].name}),", then the duplicates will be deleted. Changes will take effect from the next scan run."]}),Ee.length<2&&t.jsx("div",{style:{fontSize:"0.75rem",color:Pe,marginBottom:"0.75rem"},children:"Select at least one more competitor to merge."}),t.jsx(S$t,{type:"button",disabled:Ee.length<2||se,onClick:()=>void Xe(),children:se?"Mergingâ¦":`Merge ${Ee.length-1} duplicate${Ee.length-1!==1?"s":""} into ${Ee[0]?.name??"main"}`})]})]}),t.jsxs(Jkt,{children:[t.jsxs(Bue,{children:[t.jsxs(pJ,{children:[t.jsx("div",{children:t.jsxs(e$t,{children:[t.jsx(mJ,{children:"Tracked Competitors"}),t.jsxs(t$t,{children:[we.length," of ",Se]})]})}),t.jsxs(i$t,{children:[t.jsxs(g$t,{children:[t.jsxs(q4,{type:"button",onClick:()=>{Q(pe=>!pe),L&&(q(!1),oe([]))},children:[t.jsx(Wye,{size:13}),"Compare"]}),m?t.jsxs(t.Fragment,{children:[t.jsxs(q4,{type:"button",onClick:()=>{L?(q(!1),oe([])):(q(!0),oe(H.slice(0,5)),X&&(Q(!1),G(!1)))},children:[t.jsx(Gye,{size:13}),"Merge"]}),t.jsxs(q4,{type:"button",$danger:!0,disabled:H.length===0||je||ee,onClick:()=>me(!0),title:H.length===0?"Select competitors to delete":`Delete ${H.length} selected competitor${H.length===1?"":"s"}`,children:[t.jsx(Fi,{size:13}),"Delete"]})]}):null]}),t.jsxs(y$t,{children:[t.jsx(Ed,{value:A,onChange:E,placeholder:"Searchâ¦",size:"sm",inputStyle:{width:"10rem",fontSize:"0.75rem",height:"1.875rem",padding:"0 0.5rem 0 1.75rem"}}),t.jsx(at,{content:"Sort by name",size:"sm",children:t.jsx(Fx,{$active:B.key==="name",onClick:()=>_e(B,T,"name"),children:t.jsx(h9,{size:13})})}),t.jsx(at,{content:"Sort by visibility",size:"sm",children:t.jsx(Fx,{$active:B.key==="visibility",onClick:()=>_e(B,T,"visibility"),children:t.jsx(Dc,{size:13})})}),t.jsx(at,{content:"Sort by mentions",size:"sm",children:t.jsx(Fx,{$active:B.key==="mentions",onClick:()=>_e(B,T,"mentions"),children:t.jsx(t_,{size:13})})})]})]})]}),t.jsx(hJ,{children:dt?t.jsx(t.Fragment,{children:Array.from({length:4}).map((pe,be)=>t.jsxs(fJ,{style:{pointerEvents:"none"},children:[t.jsx(nt,{width:28,height:28,radius:"0.5rem"}),t.jsxs(gJ,{children:[t.jsx(nt,{width:`${55+be%3*18}%`,height:12}),t.jsx(nt,{width:`${35+be%2*20}%`,height:10,style:{marginTop:4}})]})]},be))}):we.length===0?t.jsx(I2,{children:"No direct competitors yet. Add one above to start tracking."}):Ke.length===0?t.jsx(I2,{children:"No competitors match your search."}):Ke.map(pe=>{const be=(Array.isArray(pe.aliases)?pe.aliases:[]).filter(Boolean),rt=W.includes(pe.id),ze=L&&W.length>=5&&!rt,lt=L?rt:H.includes(pe.id),vt=L?ze:H.length>=5&&!H.includes(pe.id),Wt=W.indexOf(pe.id),Qt=L?ze?"Max 5 competitors can be merged":rt?Wt===0?`${pe.name} (main)`:`Deselect ${pe.name}`:`Select ${pe.name} for merge`:vt?"Max 5 competitors can be compared":lt?`Deselect ${pe.name}`:`Select ${pe.name}
21643 for comparison`,Yt=t.jsx(x$t,{$checked:lt,$disabled:vt,type:"button","aria-label":Qt,onClick:nn=>{nn.stopPropagation(),vt||(te(pe.id),L&&Je(pe.id))},children:lt&&t.jsx(Zn,{size:10,color:Z,strokeWidth:3})}),Zt=L?"Max 5 competitors can be merged":"Max 5 competitors can be compared",tn=L?rt?Wt===0?cn:At:void 0:lt?cn:void 0;return t.jsxs(fJ,{style:tn?{background:tn}:void 0,children:[vt?t.jsx(at,{content:Zt,size:"sm",children:Yt}):Yt,t.jsx(xo,{record:pe,size:28,shape:"rounded"}),t.jsxs(gJ,{children:[t.jsxs(o$t,{children:[pe.name,be.length>0&&t.jsxs(a$t,{children:[" (+",be.length," alias",be.length!==1?"es":"",")"]})]}),t.jsx(s$t,{children:pe.website?.replace(/^https?:\/\//,"")}),be.length>0&&t.jsx(l$t,{children:be.map(nn=>t.jsx(c$t,{children:nn},nn))})]}),t.jsxs(yJ,{children:[t.jsx(at,{content:`Mentioned in ${pe.visibility_score??0}% of AI responses (7d)`,size:"sm",maxWidth:260,children:t.jsxs(P2,{children:[t.jsx(A2,{children:t.jsx(xJ,{children:pe.visibility_score!=null?`${Math.round(pe.visibility_score)}%`:"â"})}),t.jsx(N2,{children:"Visibility"})]})}),t.jsx(at,{content:`${pe.mention_count??0} mention${(pe.mention_count??0)!==1?"s":""} in AI responses (7d)`,size:"sm",maxWidth:260,children:t.jsxs(P2,{children:[t.jsx(A2,{children:t.jsx(bJ,{children:pe.mention_count??0})}),t.jsx(N2,{children:"Mentions"})]})}),t.jsx("div",{style:{width:48,height:18,flexShrink:0},children:pe.trend&&pe.trend.length>=2&&t.jsx(at,{content:"Daily visibility trend (7d)",size:"sm",children:t.jsx(Wx,{data:pe.trend})})})]}),t.jsx(at,{content:"View details",size:"sm",children:t.jsx(d$t,{type:"button","aria-label":`View details for ${pe.name}`,onClick:()=>P(pe),children:t.jsx(Gi,{size:16})})})]},pe.id)})})]}),t.jsxs(r$t,{children:[t.jsxs(pJ,{children:[t.jsxs("div",{children:[t.jsx(mJ,{children:"Suggested Competitors"}),t.jsx(n$t,{children:"AI mentions & visibility overlap"})]}),t.jsxs(Fue,{children:[t.jsx(Ed,{value:M,onChange:R,placeholder:"Searchâ¦",size:"sm",inputStyle:{width:"10rem",fontSize:"0.75rem",height:"1.875rem",padding:"0 0.5rem 0 1.75rem"}}),t.jsx(at,{content:"Sort by name",size:"sm",children:t.jsx(Fx,{$active:F.key==="name",onClick:()=>_e(F,Y,"name"),children:t.jsx(h9,{size:13})})}),t.jsx(at,{content:"Sort by visibility",size:"sm",children:t.jsx(Fx,{$active:F.key==="visibility",onClick:()=>_e(F,Y,"visibility"),children:t.jsx(Dc,{size:13})})}),t.jsx(at,{content:"Sort by mentions",size:"sm",children:t.jsx(Fx,{$active:F.key==="mentions",onClick:()=>_e(F,Y,"mentions"),children:t.jsx(t_,{size:13})})})]})]}),t.jsx(hJ,{children:dt?t.jsx(t.Fragment,{children:Array.from({length:4}).map((pe,be)=>t.jsxs(vJ,{style:{pointerEvents:"none"},children:[t.jsx(nt,{width:28,height:28,radius:"0.5rem"}),t.jsxs(wJ,{children:[t.jsx(nt,{width:`${60+be%3*20}%`,height:12}),t.jsx(nt,{width:`${40+be%2*15}%`,height:10,style:{marginTop:4}})]}),t.jsx(nt,{width:36,height:16,radius:"999px"})]},be))}):ce.length===0?t.jsx(I2,{children:"No suggestions yet. Run more prompts to generate suggestions."}):ie.length===0?t.jsx(I2,{children:"No competitors match your search."}):t.jsxs(t.Fragment,{children:[(S?ie:ie.slice(0,H4)).map(pe=>t.jsxs(vJ,{children:[t.jsx(xo,{record:pe,size:28,shape:"rounded"}),t.jsxs(wJ,{children:[t.jsx(u$t,{children:pe.name}),t.jsx(p$t,{children:pe.website?.replace(/^https?:\/\//,"")})]}),t.jsxs(yJ,{children:[t.jsx(at,{content:`Mentioned in ${pe.visibility_score!=null?Math.round(pe.visibility_score):0}% of AI responses (7d)`,size:"sm",maxWidth:280,children:t.jsxs(P2,{children:[t.jsx(A2,{children:t.jsx(xJ,{children:pe.visibility_score!=null?`${Math.round(pe.visibility_score)}%`:"â"})}),t.jsx(N2,{children:"Visibility"})]})}),t.jsx(at,{content:`${pe.mention_count??0} mention${(pe.mention_count??0)!==1?"s":""} in AI responses (7d)`,size:"sm",maxWidth:260,children:t.jsxs(P2,{children:[t.jsx(A2,{children:t.jsx(bJ,{children:pe.mention_count??0})}),t.jsx(N2,{children:"Mentions"})]})})]}),m?t.jsxs(t.Fragment,{children:[t.jsxs(m$t,{onClick:()=>void ht(pe,"direct"),disabled:dt||je||it,children:[t.jsx(gr,{size:12}),"Track"]}),t.jsx(at,{content:"Dismiss suggestion",size:"sm",children:t.jsx(h$t,{type:"button","aria-label":`Dismiss ${pe.name}`,onClick:()=>void Ne(pe.id),children:t.jsx(Ei,{size:12})})})]}):null]},pe.id)),ie.length>H4&&t.jsxs(f$t,{type:"button",onClick:()=>I(pe=>!pe),children:[S?"Show less":`Show ${ie.length-H4} more`,t.jsx(qn,{size:14,style:{transform:S?"rotate(180deg)":"none",transition:"transform 0.2s"}})]})]})})]})]})]}),t.jsx(Are,{isOpen:j,onClose:()=>
21643{v(!1),$(null)},title:_?`Aliases: ${_.name}`:"Aliases",description:"Aliases are used only for mention detection and highlighting; we wonât show them instead of the competitor name.",initialAliases:Array.isArray(_?.aliases)?_.aliases.map(pe=>String(pe||"").trim()).filter(Boolean):[],maxAliases:10,helperText:"Examples: abbreviations, alternate spellings, product names.",onSave:async pe=>{if(m&&_){if(!h.updateCompetitorAliases)throw new Error("Competitors provider not ready");await h.updateCompetitorAliases(_.id,pe),s.showToast("Aliases saved.",{tone:"success"})}}}),t.jsx(Hn,{isOpen:le,onClose:()=>{ee||me(!1)},title:"Delete selected competitors?",description:`This will remove ${H.length} tracked competitor${H.length===1?"":"s"} from this project.`,size:"sm",footer:t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:"0.75rem",flexWrap:"wrap"},children:[t.jsx(he,{type:"button",variant:"outline",size:"sm",disabled:ee,onClick:()=>me(!1),children:"Cancel"}),t.jsx(he,{type:"button",variant:"danger",size:"sm",disabled:ee||H.length===0,onClick:()=>void Le(),children:ee?"Deletingâ¦":"Delete selected"})]}),children:t.jsxs("div",{style:{display:"grid",gap:"0.5rem",fontSize:"0.8125rem",color:z},children:[ge.slice(0,6).map(pe=>t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem",color:O,fontWeight:800},children:[t.jsx(xo,{record:pe,size:20,shape:"rounded"}),t.jsx("span",{children:pe.name})]},pe.id)),ge.length>6?t.jsxs("div",{children:["+",ge.length-6," more"]}):null,t.jsx("div",{style:{marginTop:"0.25rem"},children:"This does not delete historical scan data, but the competitors will no longer be tracked going forward."})]})}),t.jsx(v$t,{$open:!!k,onClick:()=>P(null)}),t.jsx(w$t,{$open:!!k,children:De&&(()=>{const pe=Math.round(De.visibility_score??0),be=De.mention_count??0,rt=(De.aliases||[]).filter(Boolean),ze=U4(pe);return t.jsxs(t.Fragment,{children:[t.jsxs(k$t,{children:[t.jsxs($$t,{children:[t.jsx(xo,{record:De,size:36,shape:"rounded"}),t.jsxs("div",{children:[t.jsx(I$t,{children:De.name}),t.jsx(P$t,{children:De.website?.replace(/^https?:\/\//,"")})]})]}),t.jsx(A$t,{type:"button","aria-label":"Close panel",onClick:()=>P(null),children:t.jsx(Ei,{size:18})})]}),t.jsxs(N$t,{children:[t.jsxs(bj,{children:[t.jsx(vj,{children:"Visibility Score"}),t.jsx(T$t,{children:t.jsxs(E$t,{$color:ze,children:[pe,"%"]})}),t.jsx(M$t,{children:t.jsx(R$t,{$width:pe,$color:ze})}),De.trend&&De.trend.length>=2&&t.jsx("div",{style:{marginTop:12},children:t.jsx(Wx,{data:De.trend,width:360,height:44})})]}),t.jsxs(bj,{children:[t.jsx(vj,{children:"AI Mentions"}),t.jsx(O$t,{children:t.jsxs(D$t,{children:[t.jsx(L$t,{children:be}),t.jsx(B$t,{children:"Total mentions (7d)"})]})})]}),t.jsx(G4,{}),t.jsxs(bj,{children:[t.jsxs(z$t,{children:[t.jsx(vj,{style:{margin:0},children:"Aliases"}),m?t.jsxs(T2,{style:{width:"auto",padding:"0.3rem 0.625rem",fontSize:"0.6875rem"},onClick:()=>{$(De),v(!0)},children:[t.jsx(Lc,{size:12}),"Manage"]}):null]}),rt.length===0?t.jsx(U$t,{children:"No aliases yet. Add aliases to track alternative brand names."}):rt.map(lt=>t.jsx(F$t,{children:t.jsx(W$t,{children:lt})},lt))]}),t.jsxs(t.Fragment,{children:[t.jsx(G4,{}),t.jsxs(bj,{children:[t.jsx(vj,{style:{marginBottom:"0.75rem"},children:"Ask AI"}),t.jsx(EC,{orgId:r,projectId:o,sessionTitle:Gkt(De),initialMessage:qkt(De),metadata:{resource_type:"project_competitor",resource_id:De.id},placeholder:"Ask about this competitorâ¦"})]})]}),m?t.jsxs(t.Fragment,{children:[t.jsx(G4,{}),t.jsxs(bj,{children:[t.jsx(vj,{children:"Management"}),t.jsxs(H$t,{children:[t.jsx(at,{content:`Add "${De.name}" as an alias of your brand and remove it from competitors`,size:"sm",maxWidth:280,onlyIfTruncated:!1,children:t.jsxs(T2,{disabled:je||Ue,onClick:()=>void Qe(De),children:[t.jsx(th,{size:14}),Ue?"Claimingâ¦":"This is my brand"]})}),t.jsxs(T2,{disabled:je,onClick:async()=>{await ht(De,"suggested"),P(null)},children:[t.jsx(jP,{size:14}),"Stop Tracking"]}),t.jsxs(T2,{$variant:"danger",disabled:je,onClick:async()=>{await Ne(De.id),P(null)},children:[t.jsx(Fi,{size:14}),"Remove Competitor"]})]})]})]}):null]})]})})()})]})}const V4=25,G$t=p.div.withConfig({displayName:"WorkspaceSettingsGoogleAnalytics__SourceList",componentId:"sc-re7j2q-0"})` 21644 display: grid; 21645 gap: 0.75rem; 21646 max-height: 27rem; 21647 overflow-y: auto; 21648 padding-right: 0.25rem; 21649`,V$t=p.button.withConfig({displayName:"WorkspaceSettingsGoogleAnalytics__SourceCard",componentId:"sc-re7j2q-1"})` 21650 border: 1px solid ${e=>e.$active?"var(--color-brand-600)":V}; 21651 background: ${Z}; 21652 border-radius: 0.875rem; 21653 padding: 0.875rem; 21654 text-align: left; 21655 cursor: pointer; 21656 display: grid; 21657 gap: 0.25rem; 21658 color: ${O}; 21659 21660 &:focus-visible { 21661 outline: none; 21662 box-shadow: 0 0 0 3px ${En}; 21663 } 21664`,K$t=p.div.withConfig({displayName:"WorkspaceSettingsGoogleAnalytics__SourceName",componentId:"sc-re7j2q-2"})` 21665 font-weight: 800; 21666`,$J=p.div.withConfig({displayName:"WorkspaceSettingsGoogleAnalytics__SourceMeta",componentId:"sc-re7j2q-3"})` 21667 color: ${z}; 21668 font-size: 0.75rem; 21669 overflow: hidden; 21670 text-overflow: ellipsis; 21671 white-space: nowrap; 21672`,Y$t=p.div.withConfig({displayName:"WorkspaceSettingsGoogleAnalytics__ModalBody",componentId:"sc-re7j2q-4"})` 21673 display: grid; 21674 gap: 1rem; 21675`,X$t=p.textarea.withConfig({displayName:"WorkspaceSettingsGoogleAnalytics__TextArea",componentId:"sc-re7j2q-5"})` 21676 width: 100%; 21677 max-width: 100%; 21678 box-sizing: border-box; 21679 min-height: 96px; 21680 resize: none; 21681 border: 1px solid ${Rt}; 21682 border-radius: 0.375rem; 21683 padding: 0.75rem; 21684 font-size: 0.875rem; 21685 background: ${Z}; 21686 color: ${O}; 21687 line-height: 1.5; 21688 font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; 21689 21690 &:focus { 21691 outline: none; 21692 border-color: ${z}; 21693 box-shadow: 0 0 0 3px ${En}; 21694 } 21695`;function Q$t({orgId:e}){const n=Uo(),[i,r]=l.useState([]),[o,s]=l.useState("new"),[a,c]=l.useState(!1),[u,m]=l.useState(!0),[h,g]=l.useState(!1),x=o==="new"?null:i.find(K=>K.id===o)||null,y=i.length>=V4,[w,j]=l.useState(""),[v,_]=l.useState(""),[$,k]=l.useState("X-Service-Key"),[P,S]=l.useState(""),[I,A]=l.useState("project_id"),[E,B]=l.useState("{}"),[T,M]=l.useState(!0),R=e?`/api/v1/organizations/${e}/google_analytics_token_sources`:"",F=()=>{j(""),_(""),k("X-Service-Key"),S(""),A("project_id"),B("{}"),M(!0)},Y=()=>{if(y){n.showToast(`You can create up to ${V4} Google Analytics sources per workspace.`,{tone:"error"});return}s("new"),F(),c(!0)},H=K=>{s(K.id),c(!0)},U=()=>{h||(c(!1),s("new"),F())};l.useEffect(()=>{if(!e){m(!1),n.showToast("Invalid workspace id.",{tone:"error"});return}let K=!1;return m(!0),ue(R).then(async G=>{const L=await G.json().catch(()=>({}));if(!G.ok)throw new Error(L?.error||"Failed to load token sources");K||r(L.token_sources||[])}).catch(G=>{K||n.showToast(G instanceof Error?G.message:"Failed to load token sources",{tone:"error"})}).finally(()=>{K||m(!1)}),()=>{K=!0}},[e,R,n]),l.useEffect(()=>{if(!x){j(""),_(""),k("X-Service-Key"),S(""),A("project_id"),B("{}"),M(!0);return}j(x.name),_(x.endpoint_url),k(x.service_key_header||"X-Service-Key"),S(""),A(x.request_project_id_key||"project_id"),B(JSON.stringify(x.headers||{},null,2)),M(x.enabled)},[x]);const X=async()=>
21695{if(R){g(!0);try{const K=JSON.parse(E||"{}"),G={name:w.trim(),endpoint_url:v.trim(),service_key_header:$.trim()||"X-Service-Key",service_key:P,request_project_id_key:I.trim()||"project_id",headers:K,enabled:T},L=await ue(x?`${R}/${x.id}`:R,{method:x?"PATCH":"POST",body:JSON.stringify(G)}),q=await L.json().catch(()=>({}));if(!L.ok)throw new Error(q?.error||"Failed to save token source");const W=q.token_source;r(oe=>x?oe.map(se=>se.id===W.id?W:se):[...oe,W]),s(W.id),S(""),c(!1),n.showToast("Google Analytics token source saved.",{tone:"success"})}catch(K){n.showToast(K instanceof Error?K.message:"Failed to save token source",{tone:"error"})}g(!1)}},Q=async()=>{if(!(!x||!R)){g(!0);try{const K=await ue(`${R}/${x.id}`,{method:"DELETE"}),G=await K.json().catch(()=>({}));if(!K.ok)throw new Error(G?.error||"Failed to delete token source");r(L=>L.filter(q=>q.id!==x.id)),s("new"),c(!1),n.showToast("Google Analytics token source deleted.",{tone:"success"})}catch(K){n.showToast(K instanceof Error?K.message:"Failed to delete token source",{tone:"error"})}g(!1)}};return t.jsxs(Ar,{children:[t.jsxs(Zr,{children:[t.jsxs("div",{style:{minWidth:0},children:[t.jsxs(Wr,{children:[t.jsx(Eu,{size:18}),t.jsx(Ur,{children:"Google Analytics sources"})]}),t.jsx(Hr,{children:"Manage shared external GA token sources."})]}),t.jsxs(he,{size:"sm",variant:"outline",onClick:Y,disabled:y,children:[t.jsx(gr,{size:14})," New source"]})]}),t.jsxs(G$t,{children:[u?t.jsx(Gs,{children:"Loading token sources..."}):i.length===0?t.jsx(Gs,{children:"No token sources yet."}):i.map(K=>t.jsxs(V$t,{$active:o===K.id&&a,onClick:()=>H(K),children:[t.jsx(K$t,{children:K.name}),t.jsx($J,{children:K.endpoint_url}),t.jsxs($J,{children:[K.attached_projects_count," attached projects - ",K.enabled?"enabled":"disabled"]})]},K.id)),y?t.jsxs(Gs,{children:["Limit reached: ",V4," sources per workspace."]}):null]}),t.jsx(Hn,{isOpen:a,onClose:U,title:x?"Edit Google Analytics source":"Create Google Analytics source",description:"Configure the external endpoint Ceyo calls to fetch temporary GA access tokens.",size:"md",minHeight:"0",footer:t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:"0.75rem",flexWrap:"wrap"},children:[t.jsx("div",{children:x?t.jsxs(he,{variant:"danger",size:"sm",onClick:Q,disabled:h||x.attached_projects_count>0,children:[t.jsx(Fi,{size:14})," Delete"]}):null}),t.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.75rem"},children:[t.jsx(he,{type:"button",size:"sm",variant:"outline",onClick:U,disabled:h,children:"Cancel"}),t.jsx(he,{variant:"primary",size:"sm",onClick:X,disabled:h||!w.trim()||!v.trim(),children:h?"Saving...":x?"Save source":"Create source"})]})]}),children:t.jsxs(Y$t,{children:[t.jsxs(Bn,{children:[t.jsx(ii,{children:"Name"}),t.jsx(Xt,{value:w,onChange:K=>j(K.target.value),placeholder:"Partner GA token source"})]}),t.jsxs(Bn,{children:[t.jsx(ii,{children:"Endpoint URL"}),t.jsx(Xt,{value:v,onChange:K=>_(K.target.value),placeholder:"https://example.com/ga-access-token"})]}),t.jsxs(Bn,{children:[t.jsx(ii,{children:"Service key header"}),t.jsx(Xt,{value:$,onChange:K=>k(K.target.value),placeholder:"X-Service-Key"})]}),t.jsxs(Bn,{children:[t.jsx(ii,{children:"Service key"}),t.jsx(Xt,{value:P,onChange:K=>S(K.target.value),placeholder:x?.service_key_configured?"Leave blank to keep existing key":"Paste service key",type:"password"})]}),t.jsxs(Bn,{children:[t.jsx(ii,{children:"Request project id key"}),t.jsx(Xt,{value:I,onChange:K=>A(K.target.value),placeholder:"project_id"}),t.jsx(Gs,{children:"Each project stores its own external project id. This controls the JSON key sent to the token endpoint."})]}),t.jsxs(Bn,{children:[t.jsx(ii,{children:"Extra headers JSON"}),t.jsx(X$t,{value:E,onChange:K=>B(K.target.value),placeholder:'{"X-Partner": "example"}'})]}),t.jsxs("label",{style:{display:"inline-flex",alignItems:"center",gap:8,color:O,fontWeight:700,fontSize:"0.8125rem"},children:[t.jsx("input",{type:"checkbox",checked:T,onChange:K=>M(K.target.checked)}),"Enabled"]})]})})]})}const Z$t=p.textarea.withConfig({displayName:"WorkspaceSettingsGeneral__TextArea",componentId:"sc-ycxqfe-0"})` 21696 width: 100%; 21697 max-width: 100%; 21698 box-sizing: border-box; 21699 min-height: 96px; 21700 max-height: 256px; 21701 resize: none; 21702 border: 1px solid ${Rt}; 21703 border-radius: 0.375rem; 21704 padding: 0.75rem; 21705 font-size: 0.875rem; 21706 background: ${Z}; 21707 color: ${O}; 21708 line-height: 1.5; 21709 font-family: inherit; 21710 21711 &:focus { 21712 outline: none; 21713 border-color: ${z}; 21714 box-shadow: 0 0 0 3px ${En}; 21715 } 21716`;function J$t(){const e=zn(),{workspaceId:n}=Gn(),{user:i,setUser:r,refreshUser:o}=yn(),s=l.useMemo(()=>{const H=Number(n);return Number.isFinite(H)?H:null},[n]),a=l.useMemo(()=>s&&i?.organizations?.find(H=>Number(H.id)===Number(s))||null,[s,i?.organizations]),c=l.useMemo(()=>{const H=String(a?.billing_status||"");return H==="active"||H==="trialing"},[a?.billing_status]),u=l.useMemo(()=>!!a?.partner_managed,[a?.partner_managed]),[m,h]=l.useState(!0),[g,x]=l.useState(!1),[y,w]=l.useState(null),[j,v]=l.useState(""),[_,$]=l.useState(""),[k,P]=l.useState("business"),[S,I]=l.useState(null),[A,E]=l.useState(!1),[B,T]=l.useState(null),[M,R]=l.useState(null);l.useEffect(()=>{if(!B)return;const H=window.setTimeout(()=>T(null),5e3);return()=>window.clearTimeout(H)},[B]);const F=l.useMemo(()=>S?URL.createObjectURL(S):A?null:y?.logo_url||null,[S,A,y?.logo_url]);l.useEffect(()=>{if(!S)return;const H=URL.createObjectURL(S);return()=>URL.revokeObjectURL(H)},[S]),l.useEffect(()=>{if(!s){h(!1),R("Invalid workspace id.");return}let H=!1;return h(!0),R(null),T(null),ue(`/api/v1/organizations/${s}`,{method:"GET"}).then(async U=>{const X=await U.json().catch(()=>({}));
21716if(!U.ok)throw new Error(X?.error||"Failed to load workspace");if(H)return;const Q=X?.organization;w(Q),v((Q?.name||"").trim()),$(Q?.description||""),P(Q?.organization_type||"business"),I(null),E(!1)}).catch(U=>{H||R(U instanceof Error?U.message:"Failed to load workspace")}).finally(()=>{H||h(!1)}),()=>{H=!0}},[s]);const Y=j.trim().length>0&&(k==="business"||k==="agency")&&!g;return t.jsx(ma,{children:t.jsxs(Kc,{children:[t.jsxs(Ys,{children:[t.jsxs(ha,{children:[t.jsx(fa,{children:"Workspace settings"}),t.jsx("div",{style:{paddingRight:8,minWidth:0},children:t.jsx(qr,{items:[{label:"Workspace",to:n?`/workspaces/${n}`:void 0},{label:"Settings",to:n?`/workspaces/${n}/settings`:void 0},{label:"General"}]})})]}),t.jsx(ga,{children:"Manage your workspace profile."})]}),t.jsxs(Ar,{children:[t.jsx(Zr,{children:t.jsxs("div",{style:{minWidth:0},children:[t.jsxs(Wr,{children:[t.jsx(Bc,{size:18}),t.jsx(Ur,{children:"General"})]}),t.jsx(Hr,{children:"Update your workspace name, description, and type."})]})}),B?t.jsx(hr,{$variant:"success",children:B}):null,M?t.jsx(hr,{$variant:"error",children:M}):null,t.jsxs(Bn,{children:[t.jsx(ii,{htmlFor:"ws-name",children:"Name"}),t.jsx(Xt,{id:"ws-name",value:j,onChange:H=>v(H.target.value),placeholder:"Workspace name",leftIcon:t.jsx(by,{size:16}),disabled:m})]}),t.jsxs(Bn,{children:[t.jsx(ii,{htmlFor:"ws-description",children:"Description"}),t.jsx(Z$t,{id:"ws-description",value:_,onChange:H=>$(H.target.value),placeholder:"Short description (optional)",disabled:m}),t.jsx(Gs,{children:"This is optional and can be updated later."})]}),t.jsxs(Bn,{children:[t.jsx(ii,{children:"Type"}),t.jsx(Fn,{options:[{value:"business",label:"Business"},{value:"agency",label:"Agency"}],value:k,onChange:H=>P(H),leftIcon:t.jsx(Bc,{size:16}),disabled:m})]}),t.jsx(Z5,{}),t.jsxs(Bn,{children:[t.jsx(ii,{children:"Logo"}),t.jsx(FO,{previewUrl:F,disabled:m,hasLogo:!!(y?.logo_url||S)&&!A,previewAriaLabel:"Workspace logo preview",previewAlt:"Workspace logo",onPickFile:H=>{I(H),E(!1)},onRemove:()=>{I(null),E(!0)}})]}),t.jsx(ey,{children:t.jsx(he,{type:"button",size:"sm",disabled:!Y,onClick:()=>{if(!s)return;x(!0),R(null),T(null);const H=new FormData;H.append("name",j.trim()),H.append("description",_),H.append("organization_type",k),A&&H.append("remove_logo","true"),S&&H.append("logo",S),ue(`/api/v1/organizations/${s}`,{method:"PATCH",body:H}).then(async U=>{const X=await U.json().catch(()=>({}));if(!U.ok)throw new Error(X?.error||X?.errors?.[0]||"Failed to update workspace");w(X.organization),I(null),E(!1),T("Workspace updated."),await o()}).catch(U=>R(U instanceof Error?U.message:"Failed to update workspace")).finally(()=>x(!1))},children:g?"Saving...":"Save changes"})})]}),t.jsx("div",{style:{marginTop:"1.25rem"},children:t.jsx(Q$t,{orgId:s})}),t.jsx("div",{style:{marginTop:"1.25rem"},children:t.jsx(zM,{title:"Danger zone",description:"Deleting a workspace removes its projects and data for all members.",warningText:u?"This workspace is managed by a partner. To delete it, it must be deprovisioned from the partner.":c?"This workspace has an active subscription. Cancel the subscription before deleting the workspace.":"Deleting this workspace will permanently remove its data, projects, and settings. This cannot be undone.",actionLabel:"Delete workspace",confirmTitle:"Delete workspace",confirmKeyword:"DELETE",contactSupport:"If youâre having trouble accessing your workspace, contact support before deleting.",buttonSize:"sm",disabled:m||!s||c||u,onConfirm:async()=>{if(!s)return;const H=await ue(`/api/v1/organizations/${s}`,{method:"DELETE"}),U=await H.json().catch(()=>({}));if(!H.ok)throw new Error(U?.error||"Failed to delete workspace");const Q=(Array.isArray(i?.organizations)?i?.organizations:[]).filter(G=>Number(G?.id)!==Number(s)),K=Q[0]?.id??null;K?e(`/workspaces/${K}`,{replace:!0}):e("/",{replace:!0}),setTimeout(()=>{i&&r({...i,organizations:Q,add_project_active:i.add_project_organization_id===s?!1:i.add_project_active,add_project_organization_id:i.add_project_organization_id===s?null:i.add_project_organization_id})},0)}})})]})})}const IJ=[{value:"owner",label:"Owner"},{value:"editor",label:"Editor"},{value:"viewer",label:"Viewer"}],e2t=p(Kc).withConfig({displayName:"WorkspaceSettingsUsers__SettingsMaxWide",componentId:"sc-13pwf5z-0"})` 21717 max-width: 50rem; 21718`,PJ=p.ul.withConfig({displayName:"WorkspaceSettingsUsers__RoleList",componentId:"sc-13pwf5z-1"})` 21719 margin: 0; 21720 padding-left: 1.1rem; 21721 display: grid; 21722 gap: 0.35rem; 21723 color: ${z}; 21724 font-size: 0.8125rem; 21725 21726 li strong { 21727 color: ${O}; 21728 } 21729`,t2t=p.div.withConfig({displayName:"WorkspaceSettingsUsers__RowUser",componentId:"sc-13pwf5z-2"})` 21730 display: flex; 21731 align-items: center; 21732 gap: 0.75rem; 21733 min-width: 0; 21734`,n2t=p.div.withConfig({displayName:"WorkspaceSettingsUsers__Avatar",componentId:"sc-13pwf5z-3"})` 21735 width: 2rem; 21736 height: 2rem; 21737 border-radius: 0.75rem; 21738 display: flex; 21739 align-items: center; 21740 justify-content: center; 21741 font-weight: 800; 21742 font-size: 0.75rem; 21743 color: ${Z}; 21744 background: ${e=>e.$bg}; 21745 border: 1px solid ${V}; 21746 flex-shrink: 0; 21747`,i2t=p.div.withConfig({displayName:"WorkspaceSettingsUsers__NameBlock",componentId:"sc-13pwf5z-4"})` 21748 min-width: 0; 21749 display: flex; 21750 flex-direction: column; 21751 gap: 0.1rem; 21752`,r2t=p.div.withConfig({displayName:"WorkspaceSettingsUsers__NameRow",componentId:"sc-13pwf5z-5"})` 21753 min-width: 0; 21754 display: flex; 21755 align-items: baseline; 21756 gap: 0.5rem; 21757`,o2t=p.div.withConfig({displayName:"WorkspaceSettingsUsers__Name",componentId:"sc-13pwf5z-6"})` 21758 min-width: 0; 21759 overflow: hidden; 21760 text-overflow: ellipsis; 21761 white-space: nowrap; 21762 font-weight: 650; 21763 color: ${O}; 21764`,s2t=p.span.withConfig({displayName:"WorkspaceSettingsUsers__YouBadge",componentId:"sc-13pwf5z-7"})` 21765 font-size: 0.75rem; 21766 font-weight: 700; 21767 color: ${z}; 21768 background: ${At}; 21769 border: 1px solid ${V}; 21770 padding: 0.1rem 0.5rem; 21771 border-radius: 9999px; 21772 white-space: nowrap; 21773`,AJ=p.div.withConfig({displayName:"WorkspaceSettingsUsers__EmailText",componentId:"sc-13pwf5z-8"})` 21774 min-width: 0; 21775 overflow: hidden; 21776 text-overflow: ellipsis; 21777 white-space: nowrap; 21778 color: ${z}; 21779 font-size: 0.8125rem; 21780`,a2t=p.div.withConfig({displayName:"WorkspaceSettingsUsers__ExpiryWrap",componentId:"sc-13pwf5z-9"})` 21781 display: grid; 21782 gap: 0.125rem; 21783 line-height: 1.1; 21784`,l2t=p.div.withConfig({displayName:"WorkspaceSettingsUsers__ExpiryDate",componentId:"sc-13pwf5z-10"})` 21785 font-size: 0.8125rem; 21786 font-weight: 750; 21787 color: ${O}; 21788`,c2t=p.div.withConfig({displayName:"WorkspaceSettingsUsers__ExpiryTime",componentId:"sc-13pwf5z-11"})` 21789 font-size: 0.75rem; 21790 color: ${z}; 21791`,NJ=p.button.withConfig({displayName:"WorkspaceSettingsUsers__IconButton",componentId:"sc-13pwf5z-12"})` 21792 border: 1px solid ${V}; 21793 background: ${Z}; 21794 color: ${z}; 21795 border-radius: 0.5rem; 21796 padding: 0.5rem; 21797 display: inline-flex; 21798 align-items: center; 21799 justify-content: center; 21800 cursor: pointer; 21801 transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease; 21802 21803 &:hover { 21804 background: ${At}; 21805 border-color: ${Pe}; 21806 color: ${O}; 21807 } 21808 21809 &:focus-visible { 21810 outline: none; 21811 box-shadow: 0 0 0 3px ${En}; 21812 } 21813 21814 &:disabled { 21815 opacity: 0.6;
21816 cursor: not-allowed; 21817 } 21818`,d2t=p.div.withConfig({displayName:"WorkspaceSettingsUsers__TabsRow",componentId:"sc-13pwf5z-13"})` 21819 display: grid; 21820 grid-template-columns: 1fr auto 1fr; 21821 align-items: flex-end; 21822 gap: 0.75rem; 21823 21824 @media (max-width: 640px) { 21825 grid-template-columns: 1fr auto; 21826 align-items: center; 21827 } 21828`,u2t=p.div.withConfig({displayName:"WorkspaceSettingsUsers__TabsLeft",componentId:"sc-13pwf5z-14"})` 21829 justify-self: start; 21830 min-width: 0; 21831 21832 @media (max-width: 640px) { 21833 grid-column: 1 / -1; 21834 width: 100%; 21835 } 21836`,p2t=p.div.withConfig({displayName:"WorkspaceSettingsUsers__TabsCenter",componentId:"sc-13pwf5z-15"})` 21837 justify-self: center; 21838 21839 @media (max-width: 640px) { 21840 justify-self: start; 21841 min-width: 0; 21842 } 21843`,m2t=p.div.withConfig({displayName:"WorkspaceSettingsUsers__TabsRight",componentId:"sc-13pwf5z-16"})` 21844 justify-self: end; 21845 display: inline-flex; 21846 align-items: center; 21847 gap: 0.5rem; 21848 padding-right: 0.25rem; 21849 21850 @media (max-width: 640px) { 21851 padding-right: 0; 21852 } 21853`,h2t=p.div.withConfig({displayName:"WorkspaceSettingsUsers__SeatsGroup",componentId:"sc-13pwf5z-17"})` 21854 display: inline-flex; 21855 align-items: center; 21856 background: ${At}; 21857 border: 1px solid ${V}; 21858 border-radius: 0.75rem; 21859 overflow: hidden; 21860 white-space: nowrap; 21861 21862 @media (max-width: 640px) { 21863 flex-wrap: wrap; 21864 white-space: normal; 21865 } 21866`,K4=p.span.withConfig({displayName:"WorkspaceSettingsUsers__SeatsGroupItem",componentId:"sc-13pwf5z-18"})` 21867 font-size: 0.75rem; 21868 font-weight: 800; 21869 color: ${z}; 21870 padding: 0.125rem 0.5rem; 21871 21872 & + & { 21873 border-left: 1px solid ${V}; 21874 } 21875`;function sP(e){return e.trim().toLowerCase()}function vm(e){const n=sP(e);return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(n)}function f2t(e){const n=String(e||"").trim();if(!n)return"?";const i=n.replace("@"," ").split(/\s+/).filter(Boolean),r=i[0]?.[0]||"?",o=i[1]?.[0]||i[0]?.[1]||"";return(r+o).toUpperCase()}function Y4(e){const n=sP(e),i=n.split("@")[0]||n;return i&&i.replace(/[._-]+/g," ").trim()||n}function g2t(){const{workspaceId:e}=Gn(),{user:n}=yn(),[i,r]=l.useState("users"),[o,s]=l.useState(!1),[a,c]=l.useState([]),[u,m]=l.useState([]),[h,g]=l.useState(!0),[x,y]=l.useState(!1),[w,j]=l.useState(!1),[v,_]=l.useState(!1),[$,k]=l.useState(""),[P,S]=l.useState("viewer"),[I,A]=l.useState(null),[E,B]=l.useState(null),[T,M]=l.useState(null),[R,F]=l.useState(null),[Y,H]=l.useState(null),U=l.useRef(null),X=`${e||""}:${n?.id||"anon"}`;l.useEffect(()=>{if(U.current===X)return;U.current=X,r("users"),s(!1),k(""),S("viewer"),A(null),B(null),M(null),H(null),j(!1),_(!1),c([]),m([]),g(!0),F(null);const ie=Number(e);if(!Number.isFinite(ie)||ie<=0){A("Invalid workspace id."),g(!1);return}let Re=!1;return(async()=>{try{const[Be,tt]=await Promise.all([ue(`/api/v1/organizations/${ie}/users`,{method:"GET"}),ue(`/api/v1/organizations/${ie}/invitations`,{method:"GET"})]),dt=await Be.json().catch(()=>({}));if(!Be.ok)throw new Error(dt?.error||dt?.errors?.[0]||"Failed to load users");const je=await tt.json().catch(()=>({}));if(!tt.ok)throw new Error(je?.error||je?.errors?.[0]||"Failed to load invitations");const Se=(Array.isArray(dt?.users)?dt.users:[]).map(te=>{const ge=Number(te?.id),Je=String(te?.email||"").trim(),Xe=String(te?.full_name||"").trim()||Y4(Je),yt=String(te?.role||"").trim()||"viewer",Ne=te?.color?String(te.color):null;return{id:ge,email:Je,name:Xe,role:yt,color:Ne,isYou:n?.id?ge===n.id:!1}}).filter(te=>Number.isFinite(te.id)&&te.id>0&&vm(te.email)),De=(Array.isArray(je?.invitations)?je.invitations:[]).map(te=>({id:Number(te?.id),email:String(te?.email||"").trim(),role:String(te?.role||"").trim()||"viewer",expires_at:String(te?.expires_at||""),accepted_at:te?.accepted_at??null,revoked_at:te?.revoked_at??null})).filter(te=>Number.isFinite(te.id)&&te.id>0&&vm(te.email));Re||(c(Se),m(De),F(te=>$d(te,$d(kd(dt),kd(je)))),A(null))}catch(Be){Re||A(Be?.message||"Failed to load users")}finally{Re||g(!1)}})(),()=>{Re=!0}},[X,n?.id,e]),l.useEffect(()=>{if(!E)return;const ie=window.setTimeout(()=>B(null),5e3);return()=>window.clearTimeout(ie)},[E]);const Q=l.useMemo(()=>a.filter(ie=>ie.role==="owner").length,[a]),K=l.useMemo(()=>{const ie=Date.now();return u.filter(Re=>{if(Re.accepted_at||Re.revoked_at)return!1;const Be=Date.parse(Re.expires_at);return Number.isFinite(Be)?Be>ie:!1}).length},[u]),G=l.useMemo(()=>Due(R?.limit??null),[R?.limit]),L=l.useMemo(()=>R?.usage?.seats_used??a.length+K,[K,a.length,R?.usage?.seats_used]),q=l.useMemo(()=>R?.usage?.members??a.length,[a.length,R?.usage?.members]),W=l.useMemo(()=>R?.usage?.active_invites??K,[K,R?.usage?.active_invites]),oe=l.useMemo(()=>L>=G,[G,L]),se=l.useMemo(()=>`${L}/${G}`,[G,L]),le=!!l.useMemo(()=>{const ie=Number(e);return n?.organizations?.find(Re=>Number(Re.id)===ie)||null},[n?.organizations,e])?.partner_managed,me=l.useMemo(()=>vm($),[$]),ee=async()=>{const ie=sP($);if(M(null),B(null),!vm(ie)){M("Please enter a valid email.");return}if(oe){M(`This workspace already has the maximum of ${G} users.`);return}if(a.some(tt=>sP(tt.email)===ie)){M("This user is already in the workspace.");return}const Be=Number(e);if(!Number.isFinite(Be)||Be<=0){M("Invalid workspace id.");return}y(!0);try{const tt=await ue(`/api/v1/organizations/${Be}/invitations`,{method:"POST",body:JSON.stringify({email:ie,role:P})}),dt=await tt.json().catch(()=>({}));if(!tt.ok)throw new Error(dt?.error||dt?.errors?.[0]||"Failed to add user");const Me=(Array.isArray(dt?.invitations)?dt.invitations:[]).map(Se=>({id:Number(Se?.id),email:String(Se?.email||"").trim(),role:String(Se?.role||"").trim()||"viewer",expires_at:String(Se?.expires_at||""),accepted_at:Se?.accepted_at??null,revoked_at:Se?.revoked_at??null})).filter(Se=>Number.isFinite(Se.id)&&Se.id>0&&vm(Se.email));m(Me),F(Se=>$d(Se,kd(dt))),k(""),S("viewer"),B("Invitation sent."),M(null),s(!1)}catch(tt){M(tt?.message||"Failed to send invitation")}finally{y(!1)}},ne=async ie=>{const Re=Number(e);if(!(!Number.isFinite(Re)||Re<=0)){A(null),B(null),y(!0);try{const Be=await ue(`/api/v1/organizations/${Re}/invitations/${ie}/resend`,{method:"POST"}),tt=await Be.json().catch(()=>({}));if(!Be.ok)throw new Error(tt?.error||tt?.errors?.[0]||"Failed to resend");B("Invitation resent."),F(Me=>$d(Me,kd(tt)));const dt=await ue(`/api/v1/organizations/${Re}/invitations`,{method:"GET"}),je=await dt.json().catch(()=>({}));if(dt.ok){const Me=Array.isArray(je?.invitations)?je.invitations:[];m(Me.map(Se=>({id:Number(Se?.id),email:String(Se?.email||"").trim(),role:String(Se?.role||"").trim()||"viewer",expires_at:String(Se?.expires_at||""),accepted_at:Se?.accepted_at??null,revoked_at:Se?.revoked_at??null})).filter(Se=>Number.isFinite(Se.id)&&Se.id>0&&vm(Se.email))),F(Se=>$d(Se,kd(je)))}}catch(Be){A(Be?.message||"Failed to resend invitation")}finally{y(!1)}}},Ae=async ie=>{const Re=Number(e);if(!(!Number.isFinite(Re)||Re<=0)){A(null),B(null),y(!0);try{const Be=await ue(`/api/v1/organizations/${Re}/invitations/${ie}/revoke`,{method:"POST"}),tt=await Be.json().catch(()=>({}));if(!Be.ok)throw new Error(tt?.error||tt?.errors?.[0]||"Failed to revoke");B("Invitation deleted."),F(Me=>$d(Me,kd(tt)));const dt=await ue(`/api/v1/organizations/${Re}/invitations`,{method:"GET"}),je=await dt.json().catch(()=>({}));if(dt.ok){const Me=Array.isArray(je?.invitations)?je.invitations:[];m(Me.map(Se=>({id:Number(Se?.id),email:String(Se?.email||"").trim(),role:String(Se?.role||"").trim()||"viewer",expires_at:String(Se?.expires_at||""),accepted_at:Se?.accepted_at??null,revoked_at:Se?.revoked_at??null})).filter(Se=>Number.isFinite(Se.id)&&Se.id>0&&vm(Se.email))),F(Se=>$d(Se,kd(je)))}}catch(Be){A(Be?.message||"Failed to delete invitation")}finally{y(!1)}}},_e=async(ie,Re)=>{const Be=a.find(je=>je.id===ie);if(!Be||Be.role===Re)return;A(null),B(null);const tt=Number(e);if(!Number.isFinite(tt)||tt<=0){A("Invalid workspace id.");return}const dt=a;c(je=>je.map(Me=>Me.id===ie?{...Me,role:Re}:Me)),y(!0);try{const je=await ue(`/api/v1/organizations/${tt}/users/${ie}`,{method:"PATCH",body:JSON.stringify({role:Re})}),Me=await je.json().catch(()=>({}));if(!je.ok)throw new Error(Me?.error||Me?.errors?.[0]||"Failed to update role");const it=(Array.isArray(Me?.users)?Me.users:[]).map(De=>{const te=Number(De?.id),ge=String(De?.email||"").trim(),Ee=String(De?.full_name||"").trim()||Y4(ge),Xe=String(De?.role||"").trim()||"viewer",yt=De?.color?String(De.color):null;return{id:te,email:ge,name:Ee,role:Xe,color:yt,isYou:n?.id?te===n.id:!1}}).filter(De=>Number.isFinite(De.id)&&De.id>0&&vm(De.email));c(it)}catch(je){c(dt),A(je?.message||"Failed to update role")}finally{y(!1)}},we=ie=>{A(null),B(null),H(ie)},Ke=async()=>
21875{if(!Y)return;const ie=Number(e);if(!Number.isFinite(ie)||ie<=0){A("Invalid workspace id."),H(null);return}const Re=a;y(!0);try{const Be=await ue(`/api/v1/organizations/${ie}/users/${Y.id}`,{method:"DELETE"}),tt=await Be.json().catch(()=>({}));if(!Be.ok)throw new Error(tt?.error||tt?.errors?.[0]||"Failed to remove user");const je=(Array.isArray(tt?.users)?tt.users:[]).map(Me=>{const Se=Number(Me?.id),it=String(Me?.email||"").trim(),te=String(Me?.full_name||"").trim()||Y4(it),ge=String(Me?.role||"").trim()||"viewer",Je=Me?.color?String(Me.color):null;return{id:Se,email:it,name:te,role:ge,color:Je,isYou:n?.id?Se===n.id:!1}}).filter(Me=>Number.isFinite(Me.id)&&Me.id>0&&vm(Me.email));c(je),B("User removed."),H(null)}catch(Be){c(Re),A(Be?.message||"Failed to remove user"),H(null)}finally{y(!1)}},ce=l.useMemo(()=>[...a].sort((ie,Re)=>ie.email.trim().toLowerCase().localeCompare(Re.email.trim().toLowerCase())),[a]);return t.jsxs(ma,{children:[t.jsxs(e2t,{children:[t.jsxs(Ys,{children:[t.jsxs(ha,{children:[t.jsx(fa,{children:"Users"}),t.jsx("div",{style:{paddingRight:8,minWidth:0}
21875,children:t.jsx(qr,{items:[{label:"Workspace",to:e?`/workspaces/${e}`:void 0},{label:"Settings",to:e?`/workspaces/${e}/settings`:void 0},{label:"Users"}]})})]}),t.jsx(ga,{children:"Manage members and roles for this workspace."})]}),t.jsxs(Ar,{children:[t.jsx(Zr,{children:t.jsxs("div",{style:{minWidth:0},children:[t.jsxs(Wr,{children:[t.jsx(Ap,{size:18}),t.jsx(Ur,{children:"Members"})]}),t.jsx(Hr,{children:"Add or remove members and set their role."})]})}),I?t.jsx(hr,{$variant:"error",children:I}):null,E?t.jsx(hr,{$variant:"success",children:E}):null,t.jsx("div",{style:{marginTop:"1rem"},children:t.jsx(MM,{title:i==="users"?"Role permissions":"Invitations",icon:t.jsx(Yl,{size:16}),open:i==="users"?w:v,onToggle:()=>{i==="users"?j(ie=>!ie):_(ie=>!ie)},children:i==="users"?t.jsxs(PJ,{children:[t.jsx("li",{children:"These are workspace roles that apply across the entire SaaS workspace."}),t.jsxs("li",{children:[t.jsx("strong",{children:"Viewer"}),": can view workspace and project data."]}),t.jsxs("li",{children:[t.jsx("strong",{children:"Editor"}),": can create and edit projects, prompts, competitors, and other project content."]}),t.jsxs("li",{children:[t.jsx("strong",{children:"Owner"}),": full access, including users, workspace settings, billing/plan, and all content.",le?" Billing and plan changes may still be managed by your partner.":null]}),t.jsx("li",{children:"For narrower access, assign project-level roles in project settings."})]}):t.jsxs(PJ,{children:[t.jsxs("li",{children:["Invitations expire after ",t.jsx("strong",{children:"7 days"}),". If an invite expires, you can delete it and send a new one."]}),t.jsxs("li",{children:["You can ",t.jsx("strong",{children:"resend"})," or ",t.jsx("strong",{children:"delete"})," invites at any time from this page."]}),t.jsxs("li",{children:["The workspace has a maximum of ",t.jsxs("strong",{children:[G," seats"]}),", including active invitations."]})]})})}),t.jsxs(d2t,{children:[t.jsx(u2t,{children:t.jsx(RP,{ariaLabel:"Members tabs",marginTop:"1.25rem",activeKey:i,onChange:ie=>r(ie),tabs:[{key:"users",label:"Users",icon:t.jsx(Ap,{size:18})},{key:"invites",label:"Invites",icon:t.jsx(bu,{size:18})}]})}),t.jsx(p2t,{children:t.jsxs(h2t,{"aria-label":"Seats breakdown",children:[t.jsxs(K4,{"aria-label":`Seats ${se}`,children:["Seats ",se]}),t.jsxs(K4,{"aria-label":`Members ${q}`,children:["Members ",q]}),t.jsxs(K4,{"aria-label":`Pending invites ${W}`,children:["Invites ",W]})]})}),t.jsx(m2t,{children:t.jsx(NJ,{type:"button","aria-label":"Invite user",title:"Invite user",onClick:()=>{M(null),s(!0)},disabled:x||oe,children:t.jsx(qne,{size:16})})})]}),t.jsx("div",{style:{marginTop:"1rem"},children:i==="users"?h?t.jsx($p,{minWidth:"38rem",columns:[{},{},{width:"10.5rem"},{width:"5.5rem"}],rows:7}):a.length===0?t.jsx(Iu,{children:"No users yet."}):t.jsx(tr,{children:t.jsxs(nr,{$minWidth:"38rem",children:[t.jsx(pr,{children:t.jsxs(Cn,{children:[t.jsx(Ai,{children:"User"}),t.jsx(Ai,{children:"Email"}),t.jsx(Ai,{style:{width:"10.5rem"},children:"Role"}),t.jsx(Ai,{style:{width:"5.5rem"},children:"Actions"})]})}),t.jsx(mr,{children:ce.map(ie=>{const Re=ie.color||(ie.isYou?n?.color:null)||$e,Be=ie.role==="owner"&&Q<=1,tt=Be||ie.isYou,dt=Be;return t.jsxs(Cn,{children:[t.jsx(bt,{children:t.jsxs(t2t,{children:[t.jsx(n2t,{$bg:Re,"aria-hidden":"true",children:f2t(ie.name||ie.email)}),t.jsx(i2t,{children:t.jsxs(r2t,{children:[t.jsx(at,{content:ie.name,onlyIfTruncated:!0,children:t.jsx(o2t,{children:ie.name})}),ie.isYou?t.jsx(s2t,{children:"You"}):null]})})]})}),t.jsx(bt,{children:t.jsx(at,{content:ie.email,onlyIfTruncated:!0,children:t.jsx(AJ,{children:ie.email})})}),t.jsxs(bt,{children:[t.jsx(Fn,{value:ie.role,onChange:je=>_e(ie.id,je),options:IJ,disabled:dt||x,dropdownPortal:!0}),Be?t.jsx("div",{style:{marginTop:"0.25rem",color:z,fontSize:"0.75rem"},children:"Keep at least one owner."}):null]}),t.jsx(bt,{children:t.jsx(NJ,{type:"button","aria-label":`Remove ${ie.email}`,onClick:()=>we(ie),disabled:tt,title:tt?ie.isYou?"You canât remove yourself here. Let another owner remove you or delete the workspace if you want to remove yourself.":"You must keep at least one owner.":"Remove user",style:{color:tt?Pe:oi},children:t.jsx(Fi,{size:16})})})]},ie.id)})})]})}):u.length===0?t.jsx(Iu,{children:"No invitations yet."}):t.jsx(tr,{children:t.jsxs(nr,{$minWidth:"38rem",children:[t.jsx(pr,{children:t.jsxs(Cn,{children:[t.jsx(Ai,{children:"Email"}),t.jsx(Ai,{style:{width:"10rem"},children:"Role"}),t.jsx(Ai,{style:{width:"12rem"},children:"Expires"}),t.jsx(Ai,{style:{width:"7.5rem"},children:"Status"}),t.jsx(Ai,{style:{width:"8rem"},children:"Actions"})]})}),t.jsx(mr,{children:u.map(ie=>{const Re=Date.now(),Be=Date.parse(ie.expires_at),dt=(Number.isFinite(Be)?Be<=Re:!1)?"Expired":"Pending";return t.jsxs(Cn,{children:[t.jsx(bt,{children:t.jsx(at,{content:ie.email,onlyIfTruncated:!0,children:t.jsx(AJ,{children:ie.email})})}),t.jsx(bt,{children:ie.role}),t.jsx(bt,{children:t.jsxs(a2t,{children:[t.jsx(l2t,{children:t.jsx(rr,{value:ie.expires_at,timeZoneMode:"viewer",placeholder:"-",options:{month:"short",day:"numeric",year:"numeric"}})}),t.jsx(c2t,{children:t.jsx(rr,{value:ie.expires_at,timeZoneMode:"viewer",placeholder:"-",options:{hour:"numeric",minute:"2-digit"}})})]})}),t.jsx(bt,{children:dt}),t.jsx(bt,{children:t.jsxs("div",{style:{display:"flex",gap:"0.5rem"},children:[t.jsx(he,{type:"button",size:"sm",variant:"outline",disabled:x,onClick:()=>ne(ie.id),children:"Resend"}),t.jsx(he,{type:"button",size:"sm",variant:"danger",disabled:x,onClick:()=>Ae(ie.id),children:"Delete"})]})})]},ie.id)})})]})})})]})]}),t.jsxs(Hn,{isOpen:o,onClose:()=>{x||(s(!1),M(null))},title:"Invite user",description:"Send an invitation to join this workspace.",size:"md",footer
21875:t.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.75rem"},children:[t.jsx(he,{type:"button",size:"sm",variant:"outline",onClick:()=>s(!1),disabled:x,children:"Cancel"}),t.jsx(he,{type:"button",size:"sm",variant:"primary",onClick:ee,disabled:!me||x||oe,children:x?"Sendingâ¦":"Send invite"})]}),children:[T?t.jsx(hr,{$variant:"error",children:T}):null,t.jsxs(Bl,{children:[t.jsxs(Bn,{style:{margin:0},children:[t.jsx(ii,{children:"Email"}),t.jsx(Xt,{value:$,onChange:ie=>k(ie.target.value),placeholder:"[email protected]",leftIcon:t.jsx(bu,{size:18}),disabled:x||oe}),t.jsxs(Gs,{children:["Max ",G," users per workspace (including invitations)."]})]}),t.jsxs(Bn,{style:{margin:0},children:[t.jsx(ii,{children:"Role"}),t.jsx(Fn,{value:P,onChange:ie=>S(ie),options:IJ,disabled:x,dropdownPortal:!0}),t.jsx(Gs,{children:"Owners can manage users and critical workspace settings."})]})]})]}),t.jsx(Hn,{isOpen:!!Y,onClose:()=>H(null),title:"Remove user",description:"This will remove the user from this workspace.",size:"sm",footer:t.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.75rem"},children:[t.jsx(he,{type:"button",size:"sm",variant:"outline",onClick:()=>H(null),disabled:x,children:"Cancel"}),t.jsx(he,{type:"button",size:"sm",variant:"danger",onClick:Ke,disabled:x,children:x?"Removingâ¦":"Remove"})]}),children:t.jsx("div",{style:{color:z,fontSize:"0.875rem"},children:Y?t.jsxs(t.Fragment,{children:["Remove ",t.jsx("strong",{style:{color:O},children:Y.email})," from this workspace?"]}):null})})]})}const y2t=p(Kc).withConfig({displayName:"WorkspaceSettingsApiKeys__SettingsMaxWide",componentId:"sc-9userm-0"})` 21876 max-width: 50rem; 21877`,x2t=p.div.withConfig({displayName:"WorkspaceSettingsApiKeys__TabsRow",componentId:"sc-9userm-1"})` 21878 display: flex; 21879 align-items: flex-end; 21880 justify-content: space-between; 21881 gap: 0.75rem; 21882`,b2t=p.div.withConfig({displayName:"WorkspaceSettingsApiKeys__TabsRight",componentId:"sc-9userm-2"})` 21883 display: inline-flex; 21884 align-items: center; 21885 gap: 0.5rem; 21886 padding-right: 0.25rem; 21887`,v2t=p.button.withConfig({displayName:"WorkspaceSettingsApiKeys__KeyNameButton",componentId:"sc-9userm-3"})` 21888 display: block; 21889 width: 100%; 21890 text-align: left; 21891 border: none; 21892 background: none; 21893 padding: 0; 21894 cursor: pointer; 21895 min-width: 0; 21896 21897 &:focus-visible { 21898 outline: none; 21899 box-shadow: 0 0 0 3px ${En}; 21900 border-radius: 0.5rem; 21901 } 21902`,X4=p.button.withConfig({displayName:"WorkspaceSettingsApiKeys__IconButton",componentId:"sc-9userm-4"})` 21903 border: 1px solid ${V}; 21904 background: ${Z}; 21905 color: ${z}; 21906 border-radius: 0.5rem; 21907 padding: 0.5rem; 21908 display: inline-flex; 21909 align-items: center; 21910 justify-content: center; 21911 cursor: pointer; 21912 transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease; 21913 21914 &:hover { 21915 background: ${At}; 21916 border-color: ${Pe}; 21917 color: ${O}; 21918 } 21919 21920 &:focus-visible { 21921 outline: none; 21922 box-shadow: 0 0 0 3px ${En}; 21923 } 21924 21925 &:disabled { 21926 opacity: 0.6; 21927 cursor: not-allowed; 21928 } 21929`,w2t=p.div.withConfig({displayName:"WorkspaceSettingsApiKeys__KeyPill",componentId:"sc-9userm-5"})` 21930 display: inline-flex; 21931 align-items: center; 21932 gap: 0.5rem; 21933 padding: 0.375rem 0.625rem; 21934 border: 1px solid ${V}; 21935 background: ${At}; 21936 border-radius: 0.75rem; 21937 font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; 21938 font-size: 0.8125rem; 21939 color: ${O}; 21940`,j2t=p.span.withConfig({displayName:"WorkspaceSettingsApiKeys__StatusPill",componentId:"sc-9userm-6"})` 21941 display: inline-flex; 21942 align-items: center; 21943 justify-content: center; 21944 padding: 0.25rem 0.5rem; 21945 border-radius: 9999px; 21946 font-size: 0.75rem; 21947 font-weight: 800; 21948 border: 1px solid ${e=>e.$on?Mo:Er}; 21949 background: ${e=>e.$on?si:kn}; 21950 color: ${e=>e.$on?Vt:Ut}; 21951`,_2t=p.span.withConfig({displayName:"WorkspaceSettingsApiKeys__ManagedPill",componentId:"sc-9userm-7"})` 21952 display: inline-flex; 21953 align-items: center; 21954 gap: 0.25rem; 21955 padding: 0.125rem 0.5rem; 21956 border-radius: 9999px; 21957 font-size: 0.6875rem; 21958 font-weight: 800; 21959 letter-spacing: 0.01em; 21960 border: 1px solid ${V}; 21961 background: ${At}; 21962 color: ${z}; 21963 white-space: nowrap; 21964`,C2t=p.div.withConfig({displayName:"WorkspaceSettingsApiKeys__TokenBox",componentId:"sc-9userm-8"})` 21965 border: 1px solid ${V}; 21966 background: ${At}; 21967 border-radius: 0.875rem; 21968 padding: 0.875rem; 21969 color: ${O}; 21970`,S2t=p.div.withConfig({displayName:"WorkspaceSettingsApiKeys__TokenRow",componentId:"sc-9userm-9"})` 21971 display: flex; 21972 align-items: center; 21973 gap: 0.75rem; 21974 flex-wrap: wrap; 21975`,k2t=p.div.withConfig({displayName:"WorkspaceSettingsApiKeys__TokenValue",componentId:"sc-9userm-10"})` 21976 flex: 1; 21977 min-width: 14rem; 21978 padding: 0.75rem; 21979 border-radius: 0.75rem; 21980 border: 1px solid ${V}; 21981 background: ${Z}; 21982 font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; 21983 font-size: 0.875rem; 21984 color: ${O}; 21985 overflow: hidden; 21986 text-overflow: ellipsis; 21987 white-space: nowrap; 21988`;function $2t(){const{workspaceId:e}=Gn(),n=zn(),{user:i}=yn(),r=l.useMemo(()=>{const se=Number(e);return Number.isFinite(se)?se:null},[e]),o=l.useMemo(()=>r?!!i?.organizations?.find(de=>Number(de.id)===Number(r))?.api_access_enabled:!1,[r,i?.organizations]),s=l.useRef(null),a=`${r||"none"}`,[c,u]=l.useState([]),[m,h]=l.useState(!0),[g,x]=l.useState(!1),[y,w]=l.useState(null),[j,v]=l.useState(null),[_,$]=l.useState(!1),[k,P]=l.useState(""),[S,I]=l.useState(null),[A,E]=l.useState(null),[B,T]=l.useState(null),[M,R]=l.useState(null),[F,Y]=l.useState("keys"),[H,U]=l.useState(!1),[X,Q]=l.useState(!1),K=c.length>=3;l.useEffect(()=>{if(s.current===a)return;if(s.current=a,u([]),h(!0),x(!1),w(null),v(null),$(!1),P(""),I(null),E(null),T(null),R(null),Y("keys"),U(!1),Q(!1),!r){w("Invalid workspace id."),h(!1);return}if(!o){h(!1);return}let se=!1;return(async()=>{try{const de=await ue(`/api/v1/organizations/${r}/api_keys`,{method:"GET"}),le=await de.json().catch(()=>({}));if(!de.ok)throw new Error(le?.error||le?.errors?.[0]||"Failed to load API keys");
21988const ee=(Array.isArray(le?.api_keys)?le.api_keys:[]).map(ne=>({id:Number(ne?.id),name:String(ne?.name||""),last4:String(ne?.last4||""),enabled:!!ne?.enabled,key_type:String(ne?.key_type||"public_api"),partner_managed:!!ne?.partner_managed,created_at:String(ne?.created_at||""),last_used_at:ne?.last_used_at?String(ne.last_used_at):null})).filter(ne=>Number.isFinite(ne.id)&&ne.id>0&&ne.name.trim()!=="");se||u(ee)}catch(de){se||w(de?.message||"Failed to load API keys")}finally{se||h(!1)}})(),()=>{se=!0}},[o,a,r]),l.useEffect(()=>{if(!j)return;const se=window.setTimeout(()=>v(null),5e3);return()=>window.clearTimeout(se)},[j]);const G=()=>{w(null),v(null),P(""),I(null),E(null),$(!0)},L=async()=>{if(!r||g)return;w(null),v(null);const se=k.trim();if(!se){w("Please enter a name for the API key.");return}if(K){w("This workspace already has the maximum of 3 API keys.");return}x(!0);try{const de=await ue(`/api/v1/organizations/${r}/api_keys`,{method:"POST",body:JSON.stringify({name:se})}),le=await de.json().catch(()=>({}));if(!de.ok)throw new Error(le?.error||le?.errors?.[0]||"Failed to create API key");const me=le?.api_key,ee=le?.token;if(!me||!ee)throw new Error("Invalid server response");I(String(ee)),E(String(me?.name||se)),v("API key created.");const ne=await ue(`/api/v1/organizations/${r}/api_keys`,{method:"GET"}),Ae=await ne.json().catch(()=>({}));if(ne.ok){const _e=Array.isArray(Ae?.api_keys)?Ae.api_keys:[];u(_e.map(we=>({id:Number(we?.id),name:String(we?.name||""),last4:String(we?.last4||""),enabled:!!we?.enabled,key_type:String(we?.key_type||"public_api"),partner_managed:!!we?.partner_managed,created_at:String(we?.created_at||""),last_used_at:we?.last_used_at?String(we.last_used_at):null})).filter(we=>Number.isFinite(we.id)&&we.id>0&&we.name.trim()!==""))}}catch(de){w(de?.message||"Failed to create API key"),$(!1)}finally{x(!1)}},q=async se=>{if(r&&!g){w(null),v(null),x(!0);try{const de=await ue(`/api/v1/organizations/${r}/api_keys/${se.id}`,{method:"PATCH",body:JSON.stringify({enabled:!se.enabled})}),le=await de.json().catch(()=>({}));if(!de.ok)throw new Error(le?.error||le?.errors?.[0]||"Failed to update API key");const me=le?.api_key;if(!me)throw new Error("Invalid server response");u(ee=>ee.map(ne=>ne.id===se.id?{...ne,enabled:!!me.enabled}:ne)),v(se.enabled?"API key disabled.":"API key enabled.")}catch(de){w(de?.message||"Failed to update API key")}finally{x(!1)}}},W=async()=>{if(r&&B&&!g){w(null),v(null),x(!0);try{const se=await ue(`/api/v1/organizations/${r}/api_keys/${B.id}`,{method:"DELETE"}),de=await se.json().catch(()=>({}));if(!se.ok)throw new Error(de?.error||de?.errors?.[0]||"Failed to delete API key");u(le=>le.filter(me=>me.id!==B.id)),v("API key deleted."),T(null)}catch(se){w(se?.message||"Failed to delete API key"),T(null)}finally{x(!1)}}},oe=async se=>{try{await navigator.clipboard.writeText(se),v("Copied.")}catch{w("Failed to copy. Please copy manually.")}};return t.jsxs(ma,{children:[t.jsxs(y2t,{children:[t.jsxs(Ys,{children:[t.jsxs(ha,{children:[t.jsx(fa,{children:"API keys"}),t.jsx("div",{style:{paddingRight:8,minWidth:0}
21988,children:t.jsx(qr,{items:[{label:"Workspace",to:e?`/workspaces/${e}`:void 0},{label:"Settings",to:e?`/workspaces/${e}/settings`:void 0},{label:"API keys"}]})})]}),t.jsx(ga,{children:"Create and manage API keys for this workspace, including Public API and MCP access."})]}),o?t.jsxs(Ar,{children:[t.jsx(Zr,{children:t.jsxs("div",{style:{minWidth:0},children:[t.jsxs(Wr,{children:[F==="usage"?t.jsx(gl,{size:18}):t.jsx(Rc,{size:18}),t.jsx(Ur,{children:F==="usage"?"Usage":"Keys"})]}),t.jsx(Hr,{children:F==="keys"?"Keep API keys secret. New keys are shown only once after creation.":"View usage across all API keys in this workspace."})]})}),y?t.jsx(hr,{$variant:"error",children:y}):null,j?t.jsx(hr,{$variant:"success",children:j}):null,t.jsx("div",{style:{marginTop:"1rem"},children:t.jsx(MM,{title:F==="keys"?"API keys":"Usage",icon:t.jsx(Yl,{size:16}),open:F==="keys"?H:X,onToggle:()=>{F==="keys"?U(se=>!se):Q(se=>!se)},children:F==="keys"?t.jsxs("ul",{style:{margin:0,paddingLeft:"1.1rem",display:"grid",gap:"0.35rem",color:z,fontSize:"0.8125rem"},children:[t.jsxs("li",{children:["Maximum ",t.jsx("strong",{style:{color:O},children:"3"})," API keys per workspace."]}),t.jsx("li",{children:"Use API keys for the Public API, MCP server, and supported integrations."}),t.jsx("li",{children:"Keep API keys secret. New keys are shown only once after creation."}),t.jsx("li",{children:"Disable a key to stop access without deleting it."})]}):t.jsxs("ul",{style:{margin:0,paddingLeft:"1.1rem",display:"grid",gap:"0.35rem",color:z,fontSize:"0.8125rem"},children:[t.jsx("li",{children:"Usage is based on requests made using API keys."}),t.jsx("li",{children:"Click a key name to view usage for that specific key."})]})})}),t.jsxs(x2t,{children:[t.jsx(RP,{ariaLabel:"API keys tabs",marginTop:"1.25rem",activeKey:F,onChange:se=>Y(se),tabs:[{key:"keys",label:"Keys",icon:t.jsx(Rc,{size:18})},{key:"usage",label:"Usage",icon:t.jsx(gl,{size:18})}]}),t.jsx(b2t,{children:F==="keys"?t.jsxs(t.Fragment,{children:[t.jsx(X4,{type:"button","aria-label":"Create API key",title:"Create API key",onClick:G,disabled:g||K,children:t.jsx(gr,{size:16})}),t.jsxs(MP,{"aria-label":`API keys ${c.length}/3`,children:[c.length,"/3"]})]}):null})]}),t.jsx("div",{style:{marginTop:"1rem"},children:F==="usage"?r?t.jsx(JV,{organizationId:r}):t.jsx(Iu,{children:"Invalid workspace id."}):m?t.jsx($p,{minWidth:"42rem",columns:[{},{},{width:"12rem"},{width:"8rem"},{width:"13rem"}],rows:6}):c.length===0?t.jsx(Iu,{children:"No API keys yet."}):t.jsx(tr,{children:t.jsxs(nr,{$minWidth:"42rem",children:[t.jsx(pr,{children:t.jsxs(Cn,{children:[t.jsx(Ai,{children:"Name"}),t.jsx(Ai,{children:"Key"}),t.jsx(Ai,{style:{width:"12rem"},children:"Created"}),t.jsx(Ai,{style:{width:"8rem"},children:"Status"}),t.jsx(Ai,{style:{width:"13rem"},children:"Actions"})]})}),t.jsx(mr,{children:c.map(se=>t.jsxs(Cn,{children:[t.jsxs(bt,{children:[t.jsx(v2t,{type:"button",onClick:()=>R(se),children:t.jsx(at,{content:se.name,onlyIfTruncated:!0,children:t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem",fontWeight:700,color:O,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[se.name,se.partner_managed?t.jsxs(_2t,{children:[t.jsx(ku,{size:10}),"Partner managed"]}):null]})})}),t.jsxs("div",{style:{marginTop:"0.25rem",color:z,fontSize:"0.75rem"},children:["Last used:"," ",t.jsx(rr,{value:se.last_used_at,timeZoneMode:"viewer",placeholder:"â",options:{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"}})]})]}),t.jsx(bt,{children:t.jsxs(w2t,{children:[t.jsx(Yl,{size:16}),"â¢â¢â¢â¢ ",se.last4]})}),t.jsx(bt,{children:t.jsx(rr,{value:se.created_at,timeZoneMode:"viewer",placeholder:"â",options:{month:"short",day:"numeric",year:"numeric"}})}),t.jsx(bt,{children:t.jsx(j2t,{$on:se.enabled,children:se.enabled?"Enabled":"Disabled"})}),t.jsx(bt,{children:se.partner_managed?t.jsx(at,{content:"This key is managed by a partner and cannot be modified here.",children:t.jsxs("div",{style:{display:"flex",gap:"0.5rem",alignItems:"center"},children:[t.jsx(he,{type:"button",size:"sm",variant:"outline",disabled:!0,children:se.enabled?"Disable":"Enable"}),t.jsx(X4,{type:"button","aria-label":"Locked",disabled:!0,style:{color:Pe},children:t.jsx(ku,{size:16})})]})}):t.jsxs("div",{style:{display:"flex",gap:"0.5rem",alignItems:"center"},children:[t.jsx(he,{type:"button",size:"sm",variant:"outline",disabled:g,onClick:()=>q(se),children:se.enabled?"Disable":"Enable"}),t.jsx(X4,{type:"button","aria-label":`Delete ${se.name}`,title:"Delete",onClick:()=>T(se),disabled:g,style:{color:oi},children:t.jsx(Fi,{size:16})})]})})]},se.id))})]})})})]}):t.jsxs(Ar,{children:[t.jsx(Zr,{children:t.jsxs("div",{style:{minWidth:0},children:[t.jsxs(Wr,{children:[t.jsx(Rc,{size:18}),t.jsx(Ur,{children:"Public API not enabled"})]}),t.jsx(Hr,{children:"Upgrade your plan to unlock API keys and access the Public API for this workspace."})]})}),t.jsxs("div",{style:{marginTop:"0.75rem",display:"grid",gap:10},children:[t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:"Your current plan does not include Public API access."}),t.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:t.jsx(he,{type:"button",size:"sm",variant:"primary",onClick:()=>
21988n(`/workspaces/${e}/settings/plan`),children:"Upgrade Plan"})})]})]})]}),t.jsx(Hn,{isOpen:_,onClose:()=>{g||$(!1)},title:S?"API key created":"Create API key",description:S?"Copy your API key now. You wonât be able to see it again.":"Create a new API key for this workspace.",size:"md",footer:S?t.jsx("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.75rem"},children:t.jsx(he,{type:"button",size:"sm",variant:"primary",onClick:()=>$(!1),children:"Done"})}):t.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.75rem"},children:[t.jsx(he,{type:"button",size:"sm",variant:"outline",onClick:()=>$(!1),disabled:g,children:"Cancel"}),t.jsx(he,{type:"button",size:"sm",variant:"primary",onClick:L,disabled:g||K,children:g?"Creatingâ¦":"Create"})]}),children:S?t.jsxs(C2t,{children:[t.jsx("div",{style:{fontWeight:800,marginBottom:"0.5rem",color:O},children:A?`Key: ${A}`:"Your API key"}),t.jsxs(S2t,{children:[t.jsx(k2t,{title:S,children:S}),t.jsx(he,{type:"button",size:"sm",variant:"outline",leftIcon:t.jsx(so,{size:16}),onClick:()=>oe(S),children:"Copy"})]}),t.jsx("div",{style:{marginTop:"0.5rem",color:z,fontSize:"0.75rem"},children:"Treat this key like a password. If itâs exposed, delete it and create a new one."})]}):t.jsx("div",{children:t.jsxs(Bn,{style:{margin:0},children:[t.jsx(ii,{children:"Name"}),t.jsx(Xt,{value:k,onChange:se=>P(se.target.value),placeholder:"e.g. Production server",leftIcon:t.jsx(Rc,{size:18}),disabled:g}),t.jsx(Gs,{children:"Give this key a name so you can identify it later."})]})})}),t.jsx(Hn,{isOpen:!!B,onClose:()=>{g||T(null)},title:"Delete API key",description:"This will permanently delete the API key. Any service using it will lose access.",size:"sm",footer:t.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.75rem"},children:[t.jsx(he,{type:"button",size:"sm",variant:"outline",onClick:()=>T(null),disabled:g,children:"Cancel"}),t.jsx(he,{type:"button",size:"sm",variant:"danger",onClick:W,disabled:g,children:g?"Deletingâ¦":"Delete"})]}),children:t.jsxs("div",{style:{color:z,fontSize:"0.875rem"},children:["Delete ",t.jsx("strong",{style:{color:O},children:B?.name}),"? This cannot be undone."]})}),t.jsx(Hn,{isOpen:!!M,onClose:()=>R(null),title:"API key usage",description:M?`Usage for â${M.name}â`:"Usage",size:"md",footer:t.jsx("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.75rem"},children:t.jsx(he,{type:"button",size:"sm",variant:"primary",onClick:()=>R(null),children:"Done"})}),children:r&&M?t.jsx(JV,{organizationId:r,apiKeyId:M.id}):null})]})}function Bg(e,n){const i=typeof e=="number"?e:null;if(i==null||!Number.isFinite(i))return"â";const r=(n||"usd").toUpperCase();try{return new Intl.NumberFormat("en-US",{style:"currency",currency:r,minimumFractionDigits:0,maximumFractionDigits:2}).format(i/100)}catch{return`$${(i/100).toFixed(2)}`}}function zJ(e){const n=String(e||"").trim().toUpperCase();if(!n||n.length!==2)return"";try{const i=new Intl.DisplayNames(["en"],{type:"region"});return String(i.of(n)||n)}catch{return n}}const _8=["ad_nrt","ae_trn","al_tin","am_tin","ao_tin","ar_cuit","au_abn","au_arn","aw_tin","az_tin","ba_tin","bb_tin","bd_bin","bf_ifu","bg_uic","bh_vat","bj_ifu","bo_tin","br_cnpj","br_cpf","bs_tin","by_tin","ca_bn","ca_gst_hst","ca_pst_bc","ca_pst_mb","ca_pst_sk","ca_qst","cd_nif","ch_uid","ch_vat","cl_tin","cm_niu","cn_tin","co_nit","cr_tin","cv_nif","de_stn","do_rcn","ec_ruc","eg_tin","es_cif","et_tin","eu_oss_vat","eu_vat","gb_vat","ge_vat","gn_nif","hk_br","hr_oib","hu_tin","id_npwp","il_vat","in_gst","is_vat","jp_cn","jp_rn","jp_trn","ke_pin","kg_tin","kh_tin","kr_brn","kz_bin","la_tin","li_uid","li_vat","ma_vat","md_vat","me_pib","mk_vat","mr_nif","mx_rfc","my_frp","my_itn","my_sst","ng_tin","no_vat","no_voec","np_pan","nz_gst","om_vat","pe_ruc","ph_tin","ro_tin","rs_pib","ru_inn","ru_kpp","sa_vat","sg_gst","sg_uen","si_tin","sn_ninea","sr_fin","sv_nit","th_vat","tj_tin","tr_tin","tw_vat","tz_vat","ua_vat","ug_tin","us_ein","uy_ruc","uz_tin","uz_vat","ve_rif","vn_tin","za_vat","zm_tin","zw_tin","unknown"];function Q4(e){const n=String(e||"").trim();if(!n)return"";if(n==="unknown")return"Unknown (legacy)";const i=n.split("_");if(i.length===1)return n.toUpperCase();const r=i[0].toUpperCase(),o=i.slice(1).join("_").toUpperCase();return`${r} · ${o}`}const I2t=new Set(["AT","BE","BG","HR","CY","CZ","DK","EE","FI","FR","DE","GR","HU","IE","IT","LV","LT","LU","MT","NL","PL","PT","RO","SK","SI","ES","SE"]);function P2t(e){const n=String(e||"").trim().toUpperCase();if(!n||n.length!==2)return[];const i=`${n.toLowerCase()}_`,o=[..._8.filter(c=>c.startsWith(i))];I2t.has(n)&&(o.includes("eu_vat")||o.unshift("eu_vat"),o.includes("eu_oss_vat")||o.unshift("eu_oss_vat")),n==="GB"&&!o.includes("gb_vat")&&o.unshift("gb_vat");const s=[];n==="CA"&&s.push("ca_gst_hst","ca_bn","ca_qst","ca_pst_bc","ca_pst_mb","ca_pst_sk"),n==="AU"&&s.push("au_abn","au_arn"),n==="BR"&&s.push("br_cnpj","br_
21988cpf"),n==="CH"&&s.push("ch_vat","ch_uid"),n==="JP"&&s.push("jp_trn","jp_cn","jp_rn"),n==="RU"&&s.push("ru_inn","ru_kpp"),n==="UZ"&&s.push("uz_vat","uz_tin"),n==="MY"&&s.push("my_sst","my_itn","my_frp");const a=[];for(const c of s)_8.includes(c)&&!a.includes(c)&&a.push(c);for(const c of o)a.includes(c)||a.push(c);return a}const TJ=p.span.withConfig({displayName:"WorkspaceSettingsBilling__PlanBadge",componentId:"sc-1fxz2mw-0"})` 21989 padding: 0.35rem 0.9rem; 21990 background: ${At}; 21991 color: ${O}; 21992 border: 1px solid ${V}; 21993 border-radius: 9999px; 21994 font-size: 1.1rem; 21995 font-weight: 950; 21996 white-space: nowrap; 21997`,EJ=p.div.withConfig({displayName:"WorkspaceSettingsBilling__PriceRow",componentId:"sc-1fxz2mw-1"})` 21998 display: flex; 21999 align-items: baseline; 22000 gap: 0.35rem; 22001`,Z4=p.span.withConfig({displayName:"WorkspaceSettingsBilling__PriceAmount",componentId:"sc-1fxz2mw-2"})` 22002 font-size: 1.25rem; 22003 font-weight: 650; 22004 color: ${O}; 22005`,A2t=p.span.withConfig({displayName:"WorkspaceSettingsBilling__PricePeriod",componentId:"sc-1fxz2mw-3"})` 22006 font-size: 0.85rem; 22007 color: ${z}; 22008`,MJ=p.div.withConfig({displayName:"WorkspaceSettingsBilling__DetailList",componentId:"sc-1fxz2mw-4"})` 22009 display: grid; 22010 gap: 0.5rem; 22011 margin-top: 0.75rem; 22012`,E2=p.div.withConfig({displayName:"WorkspaceSettingsBilling__DetailRow",componentId:"sc-1fxz2mw-5"})` 22013 display: flex; 22014 align-items: center; 22015 justify-content: space-between; 22016 gap: 1rem; 22017 font-size: 0.875rem; 22018`,M2=p.div.withConfig({displayName:"WorkspaceSettingsBilling__DetailLabel",componentId:"sc-1fxz2mw-6"})` 22019 color: ${z}; 22020`,R2=p.div.withConfig({displayName:"WorkspaceSettingsBilling__DetailValue",componentId:"sc-1fxz2mw-7"})` 22021 color: ${O}; 22022 font-weight: 650; 22023`,N2t=p.span.withConfig({displayName:"WorkspaceSettingsBilling__StatusPill",componentId:"sc-1fxz2mw-8"})` 22024 display: inline-flex; 22025 align-items: center; 22026 justify-content: center; 22027 padding: 0.25rem 0.5rem; 22028 border-radius: 9999px; 22029 font-size: 0.75rem; 22030 font-weight: 850; 22031 border: 1px solid 22032 ${e=>e.$tone==="canceled"?Er:e.$tone==="active"?Mo:V}; 22033 background: ${e=>e.$tone==="canceled"?kn:e.$tone==="active"?si:At}; 22034 color: ${e=>e.$tone==="canceled"?Ut:e.$tone==="active"?Vt:z}; 22035`,RJ=p(Kc).withConfig({displayName:"WorkspaceSettingsBilling__BillingMax",componentId:"sc-1fxz2mw-9"})` 22036 max-width: 60rem; 22037`,OJ=p.div.withConfig({displayName:"WorkspaceSettingsBilling__CurrentPlanGrid",componentId:"sc-1fxz2mw-10"})` 22038 display: grid; 22039 grid-template-columns: 1.1fr 1fr; 22040 gap: 1.25rem; 22041 margin-top: 0.75rem; 22042 22043 @media (max-width: 900px) { 22044 grid-template-columns: 1fr; 22045 } 22046`,O2=p.div.withConfig({displayName:"WorkspaceSettingsBilling__CurrentPlanCard",componentId:"sc-1fxz2mw-11"})` 22047 border: 1px solid ${V}; 22048 background: ${Z}; 22049 border-radius: 1rem; 22050 padding: 1.25rem; 22051`,DJ=p.div.withConfig({displayName:"WorkspaceSettingsBilling__CurrentPlanTopRow",componentId:"sc-1fxz2mw-12"})` 22052 display: flex; 22053 align-items: center; 22054 justify-content: space-between; 22055 gap: 0.75rem; 22056 flex-wrap: wrap; 22057`,fb=p.div.withConfig({displayName:"WorkspaceSettingsBilling__ButtonRow",componentId:"sc-1fxz2mw-13"})` 22058 display: flex; 22059 gap: 0.75rem; 22060 flex-wrap: wrap; 22061 margin-top: 1rem; 22062`,z2t=p.div.withConfig({displayName:"WorkspaceSettingsBilling__BillingDetailsStack",componentId:"sc-1fxz2mw-14"})` 22063 display: flex; 22064 flex-direction: column; 22065 gap: 1.25rem; 22066`,T2t=p.div.withConfig({displayName:"WorkspaceSettingsBilling__BillingAddressStack",componentId:"sc-1fxz2mw-15"})` 22067 display: flex; 22068 flex-direction: column; 22069 gap: 1.25rem; 22070`,E2t=p.div.withConfig({displayName:"WorkspaceSettingsBilling__PaymentCard",componentId:"sc-1fxz2mw-16"})` 22071 display: flex; 22072 align-items: center; 22073 justify-content: space-between; 22074 gap: 1rem; 22075 padding: 1rem; 22076 border: 1px solid ${V}; 22077 background: ${At}; 22078 border-radius: 0.875rem; 22079`,M2t=p.div.withConfig({displayName:"WorkspaceSettingsBilling__PaymentLeft",componentId:"sc-1fxz2mw-17"})` 22080 display: flex; 22081 align-items: center; 22082 gap: 0.75rem; 22083 min-width: 0; 22084`,R2t=p.div.withConfig({displayName:"WorkspaceSettingsBilling__CardIcon",componentId:"sc-1fxz2mw-18"})` 22085 width: 3rem; 22086 height: 2rem; 22087 border-radius: 0.5rem; 22088 border: 1px solid ${Rt}; 22089 background: ${Z}; 22090 display: flex; 22091 align-items: center; 22092 justify-content: center; 22093 font-weight: 900; 22094 font-size: 0.75rem; 22095 color: ${O}; 22096`,O2t=p.div.withConfig({displayName:"WorkspaceSettingsBilling__CardMeta",componentId:"sc-1fxz2mw-19"})` 22097 display: flex; 22098 flex-direction: column; 22099 gap: 0.15rem; 22100 min-width: 0; 22101`,D2t=p.div.withConfig({displayName:"WorkspaceSettingsBilling__CardNumber",componentId:"sc-1fxz2mw-20"})` 22102 font-size: 0.875rem; 22103 font-weight: 700; 22104 color: ${O}; 22105`,L2t=p.div.withConfig({displayName:"WorkspaceSettingsBilling__CardExpiry",componentId:"sc-1fxz2mw-21"})` 22106 font-size: 0.8125rem; 22107 color: ${z}; 22108`,B2t=p(nr).withConfig({displayName:"WorkspaceSettingsBilling__BillingHistoryTable",componentId:"sc-1fxz2mw-22"})` 22109 td { 22110 font-size: 0.8125rem; 22111 font-weight: 650; 22112 } 22113 th { 22114 font-size: 0.7rem; 22115 font-weight: 650; 22116 } 22117`,LJ=p(tr).withConfig({displayName:"WorkspaceSettingsBilling__BillingHistoryScroll",componentId:"sc-1fxz2mw-23"})` 22118 height: min(20rem, 55vh); 22119 overflow-x: auto; 22120 overflow-y: auto; 22121 -webkit-overflow-scrolling: touch; 22122 22123 @media (max-width: 640px) { 22124 height: min(18rem, 50vh); 22125 } 22126`,F2t=p.div.withConfig({displayName:"WorkspaceSettingsBilling__BillingHistorySkeletonRoot",componentId:"sc-1fxz2mw-24"})` 22127 padding: 0.75rem; 22128 display: flex; 22129 flex-direction: column; 22130 gap: 0.6rem; 22131 min-width: 38rem; 22132`,BJ=p.div.withConfig({displayName:"WorkspaceSettingsBilling__BillingHistorySkeletonRow",componentId:"sc-1fxz2mw-25"})` 22133 display: grid; 22134 grid-template-columns: 10rem 10rem 8rem 8rem 9rem; 22135 gap: 0.75rem; 22136 align-items: center; 22137`,Wue=p.div.withConfig({displayName:"WorkspaceSettingsBilling__BillingFormSkeleton",componentId:"sc-1fxz2mw-26"})` 22138 display: flex; 22139 flex-direction: column; 22140 gap: 0.875rem; 22141`;function W2t(){return t.jsxs(Wue,{children:[t.jsxs(Bl,{children:[t.jsxs(Bn,{style:{margin:0},children:[t.jsx(nt,{width:96,height:12,radius:8}),t.jsx(nt,{height:42,radius:10})]}),t.jsxs(Bn,{style:{margin:0},children:[t.jsx(nt,{width:92,height:12,radius:8}),t.jsx(nt,{height:42,radius:10}),t.jsx(nt,{width:210,height:12,radius:8})]})]}),t.jsxs(Bn,{style:{margin:0},children:[t.jsx(nt,{width:160,height:12,radius:8}
22141),t.jsx(nt,{width:18,height:18,radius:4})]}),t.jsxs(Bl,{children:[t.jsxs(Bn,{style:{margin:0},children:[t.jsx(nt,{width:58,height:12,radius:8}),t.jsx(nt,{height:42,radius:10})]}),t.jsxs(Bn,{style:{margin:0},children:[t.jsx(nt,{width:92,height:12,radius:8}),t.jsx(nt,{height:42,radius:10}),t.jsx(nt,{width:260,height:12,radius:8})]})]}),t.jsx(fb,{children:t.jsx(nt,{width:130,height:34,radius:10})})]})}function U2t(){return t.jsxs(Wue,{children:[t.jsxs(Bn,{style:{margin:0},children:[t.jsx(nt,{width:108,height:12,radius:8}),t.jsx(nt,{height:42,radius:10})]}),t.jsxs(Bl,{children:[t.jsxs(Bn,{style:{margin:0},children:[t.jsx(nt,{width:108,height:12,radius:8}),t.jsx(nt,{height:42,radius:10})]}),t.jsxs(Bn,{style:{margin:0},children:[t.jsx(nt,{width:98,height:12,radius:8}),t.jsx(nt,{height:42,radius:10})]})]}),t.jsxs(Bl,{children:[t.jsxs(Bn,{style:{margin:0},children:[t.jsx(nt,{width:52,height:12,radius:8}),t.jsx(nt,{height:42,radius:10})]}),t.jsxs(Bn,{style:{margin:0},children:[t.jsx(nt,{width:110,height:12,radius:8}),t.jsx(nt,{height:42,radius:10})]})]}),t.jsxs(Bn,{style:{margin:0},children:[t.jsx(nt,{width:76,height:12,radius:8}),t.jsx(nt,{height:42,radius:10})]}),t.jsx(fb,{children:t.jsx(nt,{width:136,height:34,radius:10})})]})}function H2t(){const{workspaceId:e}=Gn(),n=vo(),{user:i,refreshUser:r}=yn(),{showToast:o}=Uo(),s=l.useMemo(()=>{const kt=Number(e);return Number.isFinite(kt)?kt:null},[e]),a=l.useMemo(()=>s&&i?.organizations?.find(kt=>kt.id===s)||null,[s,i?.organizations]),c=!!a?.billing_exempt,u=!!a?.partner_managed,m=String(a?.partner?.name||"").trim(),h=String(a?.partner?.return_url||"").trim(),x=String(a?.role||"").toLowerCase()==="owner",y=new URLSearchParams(n.search).get("billing_required")==="1",[w,j]=l.useState(""),[v,_]=l.useState(""),[$,k]=l.useState(!1),[P,S]=l.useState(""),[I,A]=l.useState(""),[E,B]=l.useState(""),[T,M]=l.useState(!1),[R,F]=l.useState(""),[Y,H]=l.useState(""),[U,X]=l.useState(""),[Q,K]=l.useState(""),[G,L]=l.useState(""),[q,W]=l.useState(""),[oe,se]=l.useState(!1),[de,le]=l.useState(""),[me,ee]=l.useState([]),[ne,Ae]=l.useState(!1),[_e,we]=l.useState(!1),[Ke,ce]=l.useState(""),[ie,Re]=l.useState([]),[Be,tt]=l.useState(!1),[dt,je]=l.useState(!1),[Me,Se]=l.useState(!1),[it,De]=l.useState(null),[te,ge]=l.useState([]),[Je,Ee]=l.useState([]),[Xe,yt]=l.useState(!1),[Ne,Le]=l.useState(null),[Ue,We]=l.useState(1),[Qe,ht]=l.useState(null),[pe,be]=l.useState(!1),[rt,ze]=l.useState(null),[lt,vt]=l.useState(!1),Wt=5,[Qt,Yt]=l.useState(1),[Zt,tn]=l.useState(0);l.useEffect(()=>{s||o("Invalid workspace id.",{tone:"error"})},[s,o]),l.useEffect(()=>()=>{try{rt?.close?.()}catch{}},[rt]);const nn=!!it?.billing_exempt||c,xn=String(it?.polar?.status||it?.status||"").toLowerCase(),st=xn==="trialing",Ct=xn==="past_due",Ie=["canceled","cancelled"].includes(xn),ae=!!it?.polar?.cancel_at_period_end&&!Ie,Fe=it?.pending_downgrade??null,Ge=!!Fe?.plan,wt=it?.original_price_cents!=null&&it?.price_cents!=null&&it.original_price_cents>it.price_cents,ke=!nn&&it?.provider==="polar"&&!it?.provider_subscription_id&&!Ie,Ve=it?.billing_interval==="yearly"?"yearly":"monthly",pt=!!(it?.provider==="polar"&&it?.provider_customer_id)&&!nn,Nt=!!(it?.provider==="polar"&&it?.provider_customer_id)&&!nn,qe=Me&&!T,qt=Me&&!oe;async function Mn(){if(!s)return null;const kt=await ue(`/api/v1/organizations/${s}/billing`,{method:"GET"}),Kt=await kt.json().catch(()=>({}));if(!kt.ok)throw new Error(Kt?.error||"Failed to load billing");return De(Kt?.billing?.subscription||null),ge(Array.isArray(Kt?.billing?.plans)?Kt.billing.plans:[]),Kt}async function zt(){if(s){be(!0);try{const kt=await ue(`/api/v1/organizations/${s}/billing/customer_portal`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})}),Kt=await kt.json().catch(()=>({}));if(!kt.ok)throw new Error(Kt?.error||"Failed to open customer portal");const un=String(Kt?.customer_portal_url||"");if(!un)throw new Error("Missing customer portal URL");window.open(un,"_blank","noopener,noreferrer")}catch(kt){o(kt instanceof Error?kt.message:"Failed to open customer portal",{tone:"error"})}finally{be(!1)}}}async function dn(){if(!s)return;vt(!0);const kt=Date.now(),Kt=45e3,un=2e3;
22141try{for(;Date.now()-kt<Kt;){const $n=(await Mn())?.billing?.subscription,Ii=String($n?.polar?.status||$n?.status||"").toLowerCase();if(Ii==="active"||Ii==="trialing"){vt(!1),o("Billing confirmed.",{tone:"success"});try{await r()}catch{}return}await new Promise(_i=>window.setTimeout(_i,un))}vt(!1),o("Checkout completed, but billing confirmation is still processing. Refresh in a few seconds.",{tone:"info",durationMs:6500})}catch(pn){vt(!1),o(pn instanceof Error?pn.message:"Failed to confirm billing",{tone:"error"})}}async function rn(kt,Kt){if(!s)return;const un=String(kt||"").trim().toLowerCase();if(!un){o("Select a plan to continue.",{tone:"error"});return}if(!rt)try{const pn=await ue(`/api/v1/organizations/${s}/billing/checkout`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plan_code:un,billing_interval:Kt})}),$n=await pn.json().catch(()=>({}));if(!pn.ok)throw new Error($n?.error||"Failed to start checkout");const Ii=String($n?.checkout_url||"");if(!Ii)throw new Error("Missing checkout URL");const _i=i?.theme==="dark"?"dark":"light";try{ze({__opening:!0});const di=await GO(Ii,_i,{onSuccess:()=>{ze(null),dn()},onClose:()=>{ze(null),o("Checkout closed.",{tone:"info"})},onErrorFallback:()=>{window.location.href=Ii}});ze(di)}catch{ze(null)}}catch(pn){o(pn instanceof Error?pn.message:"Failed to start checkout",{tone:"error"})}}l.useEffect(()=>{if(!s||!u&&a&&!x)return;let kt=!1;return Se(!0),Mn().catch(Kt=>{kt||(o(Kt instanceof Error?Kt.message:"Failed to load billing",{tone:"error"}),De(null),ge([]))}).finally(()=>{kt||Se(!1)}),()=>{kt=!0}},[s]),l.useEffect(()=>{if(!s)return;const kt=new URLSearchParams(window.location.search),Kt=kt.get("checkout");if(!Kt)return;Kt==="cancel"&&o("Checkout was canceled.",{tone:"info"}),Kt==="success"&&dn(),kt.delete("checkout");const un=kt.toString(),pn=`${window.location.pathname}${un?`?${un}`:""}${window.location.hash||""}`;window.history.replaceState({},"",pn)},[s]),l.useEffect(()=>{if(u)return;const kt=()=>{s&&Mn().catch(()=>null)};return window.addEventListener("focus",kt),()=>window.removeEventListener("focus",kt)},[s]),l.useEffect(()=>{if(!s||u||nn||!it?.provider_customer_id||it?.provider!=="polar")return;let kt=!1;return yt(!0),Le(null),ue(`/api/v1/organizations/${s}/billing/history?page=${Ue}&per_page=${Wt}`,{method:"GET"}).then(async Kt=>{const un=await Kt.json().catch(()=>({}));if(!Kt.ok)throw new Error(un?.error||"Failed to load billing history");if(kt)return;const pn=Array.isArray(un?.billing?.orders)?un.billing.orders:[];Ee(pn);const $n=un?.billing?.pagination||{},Ii=Number($n?.total_pages||1),_i=Number($n?.total||0);Yt(Number.isFinite(Ii)&&Ii>0?Ii:1),tn(Number.isFinite(_i)&&_i>=0?_i===0&&pn.length>0?pn.length:_i:pn.length)}).catch(Kt=>{kt||(Le(Kt instanceof Error?Kt.message:"Failed to load billing history"),Ee([]),Yt(1),tn(0))}).finally(()=>{kt||yt(!1)}),()=>{kt=!0}},[s,it?.provider,it?.provider_customer_id,Ue]),l.useEffect(()=>{it?.provider_customer_id&&it?.provider==="polar"&&We(1)},[it?.provider,it?.provider_customer_id]),l.useEffect(()=>{Ue>Qt&&We(Qt)},[Ue,Qt]),l.useEffect(()=>{if(oe)return;const kt=it?.billing_address;if(!kt)return;F(String(kt.line1||"")),H(String(kt.line2||"")),X(String(kt.postal_code||"")),K(String(kt.city||"")),L(String(kt.state||""));const Kt=String(kt.country||"").toUpperCase();W(Kt),le(zJ(Kt)||Kt),ce(String(kt.city||"")),se(!0)},[oe,it?.billing_address]),l.useEffect(()=>{if(T)return;const kt=it?.billing_details;if(!kt)return;j(String(kt.name||"")),_(String(kt.email||""));const Kt=Array.isArray(kt.tax_id)?kt.tax_id:[];S(typeof Kt[0]=="string"?Kt[0]:"");const un=typeof Kt[1]=="string"?Kt[1]:"";A(un),B(un?`${Q4(un)}`:""),k(Kt.length>0&&!!Kt[0]),M(!0)},[T,it?.billing_details]);const bn=l.useMemo(()=>{const kt=E.trim().toLowerCase(),Kt=String(q||"").trim().toUpperCase(),un=Kt?P2t(Kt):[],pn=new Set(un),$n=_8.map(di=>{const Co=`${Q4(di)} (${di})`;return{value:di,label:Co}});return(kt?$n.filter(di=>di.value.toLowerCase().includes(kt)||di.label.toLowerCase().includes(kt)):$n).sort((di,Co)=>{const Gr=pn.has(di.value)?0:1,Go=pn.has(Co.value)?0:1;return Gr!==Go?Gr-Go:di.label.localeCompare(Co.label)})},[E,q]);return l.useEffect(()=>{const kt=de.trim();if(!_e)return;if(!kt||kt.length<2){ee([]);return}const Kt=window.setTimeout(async()=>{Ae(!0);try{const pn=(await Jb(kt)).filter($n=>
22141(String($n?.place_type||"")==="Country"||!$n?.name&&!$n?.state&&!!$n?.country_code)&&!!$n?.country_code).map($n=>({value:String($n.country_code||""),label:String($n.country||$n.country_code||""),data:$n})).filter($n=>$n.value&&$n.label);ee(pn)}catch{ee([])}finally{Ae(!1)}},300);return()=>window.clearTimeout(Kt)},[de]),l.useEffect(()=>{const kt=Ke.trim();if(!dt)return;if(!kt||kt.length<2){Re([]);return}const Kt=window.setTimeout(async()=>{tt(!0);try{const pn=(await Jb(kt)).filter($n=>!(String($n?.place_type||"")==="Country"||!$n?.name&&!$n?.state&&!!$n?.country_code)).map($n=>{const Ii=String($n.name||$n.state||$n.country||"Unknown"),_i=[Ii,$n.country].filter(Boolean);return $n.state&&$n.name&&_i.splice(1,0,$n.state),{value:`${Ii}, ${$n.country}`,label:_i.join(", "),data:$n}});Re(pn)}catch{Re([])}finally{tt(!1)}},300);return()=>window.clearTimeout(Kt)},[Ke]),u?t.jsxs(ma,{children:[t.jsx(m8,{isOpen:!1}),t.jsxs(RJ,{children:[t.jsxs(Ys,{children:[t.jsxs(ha,{children:[t.jsx(fa,{children:"Billing"}),t.jsx("div",{style:{paddingRight:8,minWidth:0}
22141,children:t.jsx(qr,{items:[{label:"Workspace",to:e?`/workspaces/${e}`:void 0},{label:"Settings",to:e?`/workspaces/${e}/settings`:void 0},{label:"Billing"}]})})]}),t.jsx(ga,{children:"Billing details, payment method, and invoices."})]}),t.jsxs(Ar,{children:[t.jsx(Zr,{children:t.jsxs("div",{style:{minWidth:0},children:[t.jsxs(Wr,{children:[t.jsx(wp,{size:18}),t.jsx(Ur,{children:"Plan"})]}),t.jsxs(Hr,{children:["This workspace is billed via your partner.",h?t.jsxs(t.Fragment,{children:[" ",t.jsxs("a",{href:h,target:"_blank",rel:"noreferrer",style:{color:"inherit",textDecoration:"underline"},children:["Go to ",m||"your partner"," to manage billing."]})]}):null]})]})}),t.jsx("div",{style:{display:"flex",alignItems:"center",gap:"0.75rem"},children:Me&&!it?t.jsx(nt,{width:140,height:26,radius:9999}):t.jsx(TJ,{children:pa(it?.plan?.name)})})]})]})]}):a&&!x?t.jsx(ma,{children:t.jsxs(Kc,{children:[t.jsxs(Ys,{children:[t.jsxs(ha,{children:[t.jsx(fa,{children:"Billing"}),t.jsx("div",{style:{paddingRight:8,minWidth:0},children:t.jsx(qr,{items:[{label:"Workspace",to:e?`/workspaces
22141/${e}`:void 0},{label:"Settings",to:e?`/workspaces/${e}/settings`:void 0},{label:"Billing"}]})})]}),t.jsx(ga,{children:"Manage billing details, payment method, and invoices."})]}),t.jsxs(Ar,{children:[t.jsx(Zr,{children:t.jsxs("div",{style:{minWidth:0},children:[t.jsxs(Wr,{children:[t.jsx(wp,{size:18}),t.jsx(Ur,{children:"Billing requires workspace owner"})]}),t.jsx(Hr,{children:"Ask your workspace owner to complete billing. Until billing is active, spend-related actions are blocked."})]})}),t.jsxs("div",{style:{fontSize:"0.875rem",fontWeight:650,color:z,lineHeight:1.45},children:["Billing support:"," ",t.jsx("a",{href:"mailto:[email protected]",style:{color:"inherit",textDecoration:"underline"},children:"[email protected]"})]})]})]})}):t.jsxs(ma,{children:[t.jsx(m8,{isOpen:lt}),t.jsxs(RJ,{children:[t.jsxs(Ys,{children:[t.jsxs(ha,{children:[t.jsx(fa,{children:"Billing"}),t.jsx("div",{style:{paddingRight:8,minWidth:0},children:t.jsx(qr,{items:[{label:"Workspace",to:e?`/workspaces/${e}`:void 0},{label:"Settings",to:e?`/workspaces
22141/${e}/settings`:void 0},{label:"Billing"}]})})]}),t.jsxs(ga,{children:["Manage billing details, payment method, and invoices."," ",t.jsx(Dn,{to:`/workspaces/${e}/settings/plan`,style:{color:"inherit",textDecoration:"underline"},children:"View plan & usage"})]})]}),!nn&&(y||a&&a.billing_active_for_spend===!1)?t.jsx(Ar,{children:t.jsx(Zr,{children:t.jsxs("div",{style:{minWidth:0},children:[t.jsxs(Wr,{children:[t.jsx(wp,{size:18}),t.jsx(Ur,{children:"Billing required to unlock this workspace"})]}),t.jsx(Hr,{children:"Complete checkout to unlock this workspace. Until billing is active, spend-related actions are blocked."})]})})}):null,nn?t.jsxs(Ar,{children:[t.jsx(Zr,{children:t.jsxs("div",{style:{minWidth:0},children:[t.jsxs(Wr,{children:[t.jsx(wp,{size:18}),t.jsx(Ur,{children:"Billing setup temporarily disabled"})]}),t.jsx(Hr,{children:"This workspace is temporarily exempt from billing while we migrate existing customers. No action is required."})]})}),t.jsxs("div",{style:{fontSize:"0.875rem",fontWeight:650,color:z,lineHeight:1.45},children:["When billing is enabled for this workspace, youâll be prompted to complete checkout here.",t.jsx("br",{}),"Billing support:"," ",t.jsx("a",{href:"mailto:[email protected]",style:{color:"inherit",textDecoration:"underline"},children:"[email protected]"})]})]}):null,t.jsxs(Ar,{children:[t.jsxs(Zr,{children:[t.jsxs("div",{style:{minWidth:0},children:[t.jsxs(Wr,{children:[t.jsx(wp,{size:18}),t.jsx(Ur,{children:"Subscription"})]}),t.jsx(Hr,{children:"Your current plan and billing cycle."})]}),t.jsx("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem",color:z},children:t.jsxs("span",{style:{fontSize:"0.8125rem",fontWeight:650},children:["Billing support:"," ",t.jsx("a",{href:"mailto:[email protected]",style:{color:"inherit",textDecoration:"underline"},children:"[email protected]"})]})})]}),Me&&!it?t.jsxs(OJ,{children:[t.jsxs(O2,{children:[t.jsxs(DJ,{children:[t.jsx(nt,{width:110,height:26,radius:9999}),t.jsx(nt,{width:84,height:22,radius:9999})]}),t.jsx("div",{style:{marginTop:.75},children:t.jsxs(EJ,{children:[t.jsx(nt,{width:140,height:34,radius:12}),t.jsx(nt,{width:56,height:18,radius:10})]})})]}),t.jsxs(O2,{children:[t.jsx(MJ,{style:{marginTop:0},children:t.jsxs(E2,{children:[t.jsx(M2,{children:"Next charge"}),t.jsx(R2,{children:t.jsx(nt,{width:180,height:14,radius:10})})]})}),t.jsxs(fb,{children:[t.jsx(nt,{width:120,height:34,radius:10}),t.jsx(nt,{width:120,height:34,radius:10})]})]})]}):t.jsx(t.Fragment,{children:t.jsxs(OJ,{children:[t.jsxs(O2,{children:[t.jsxs(DJ,{children:[t.jsx(TJ,{children:pa(it?.plan?.name)}),t.jsx("div",{style:{display:"inline-flex",alignItems:"center",gap:"0.5rem"},children:t.jsx(N2t,{$tone:Ie?"canceled":["active","trialing"].includes(xn)?"active":"neutral",children:String(it?.polar?.status||it?.status||"â")})})]}),t.jsx("div",{style:{marginTop:"0.75rem"},children:t.jsxs(EJ,{children:[wt?t.jsxs(t.Fragment,{children:[t.jsx(Z4,{style:{textDecoration:"line-through",color:Pe,fontSize:"1rem",fontWeight:500},children:Bg(it?.original_price_cents,it?.currency)}),t.jsx(Z4,{style:Ie?{textDecoration:"line-through"}:void 0,children:Bg(it?.price_cents,it?.currency)})]}):t.jsx(Z4,{style:Ie?{textDecoration:"line-through"}:void 0,children:Bg(it?.price_cents,it?.currency)}),t.jsx(A2t,{children:it?.billing_interval==="yearly"?"/year":"/month"})]})})]}),t.jsxs(O2,{children:[Ct?t.jsxs("div",{style:{marginBottom:"0.75rem",padding:"0.85rem",borderRadius:"0.9rem",border:`1px solid ${Er}`,background:kn,color:Ut,fontWeight:750,lineHeight:1.35,fontSize:"0.875rem"},children:["Payment failed â your subscription is ",t.jsx("b",{children:"past due"}),". Update your payment method in the Polar portal to retry payment, then refresh this page.",t.jsxs("div",{style:{marginTop:"0.65rem",display:"flex",gap:"0.6rem",flexWrap:"wrap"},children:[t.jsxs(he,{type:"button",size:"sm",variant:"outline",disabled:!Nt||Me||pe,onClick:()=>void zt(),children:[t.jsx(v9,{size:16}),pe?"Openingâ¦":"Update payment method"]}),t.jsx(he,{type:"button",size:"sm",variant:"outline",disabled:Me||!s,onClick:async()=>{try{await Mn(),await r().catch(()=>null),o("Billing status refreshed.",{tone:"success"})}catch(kt){o(kt instanceof Error?kt.message:"Failed to refresh billing status",{tone:"error"})}},children:"Refresh status"})]})]}):null,t.jsxs(MJ,{style:{marginTop:0},children:[t.jsxs(E2,{children:[t.jsx(M2,{children:st?"First charge":"Next charge"}),t.jsx(R2,{style:{fontWeight:500},children:Ie?"â":ae?"No further charges":st?t.jsxs(t.Fragment,{children:[Bg(it?.price_cents,it?.currency)," on"," ",t.jsx(rr,{value:it?.polar?.trial_end||it?.polar?.current_period_end,placeholder:"â"})]}):Ge?t.jsxs(t.Fragment,{children:[Bg(Fe.price_cents,Fe.currency||it?.currency)," on"," ",t.jsx(rr,{value:Fe.scheduled_at||it?.polar?.current_period_end,placeholder:"â"})]}):t.jsxs(t.Fragment,{children:[Bg(it?.price_cents,it?.currency)," on"," ",t.jsx(rr,{value:it?.polar?.current_period_end,placeholder:"â"})]})})]}),it?.polar?.cancel_at_period_end?t.jsxs(E2,{children:[t.jsx(M2,{children:"Cancellation"}),t.jsxs(R2,{style:{fontWeight:500},children:["Scheduled (",t.jsx(rr,{value:st&&it?.polar?.trial_end||it?.polar?.current_period_end,placeholder:"â"}),")"]})]}):null,Ge?t.jsxs(E2,{children:[t.jsx(M2,{children:"Pending downgrade"}),t.jsxs(R2,{style:{fontWeight:500},children:["â ",pa(Fe.plan.name),Fe.billing_interval?` (${Fe.billing_interval})`:""," ","on"," ",t.jsx(rr,{value:Fe.scheduled_at,placeholder:"â"})]})]}):null]}),t.jsxs(fb,{children:[ke?t.jsx(he,{type:"button",size:"sm",disabled:Me||!s||!!rt,onClick:()=>{const kt=it?.plan?.code||te[0]?.code||"";rn(kt,Ve)},children:"Complete checkout"}
22141):null,t.jsx(Dn,{to:`/workspaces/${e}/settings/plan`,children:t.jsx(he,{type:"button",size:"sm",disabled:Me,children:"Manage plan"})})]})]})]})})]}),t.jsxs(Ar,{children:[t.jsx(Zr,{children:t.jsxs("div",{style:{minWidth:0},children:[t.jsxs(Wr,{children:[t.jsx(wp,{size:18}),t.jsx(Ur,{children:"Payment method"})]}),t.jsx(Hr,{children:"Manage your default payment method."})]})}),t.jsxs(E2t,{children:[t.jsxs(M2t,{children:[t.jsx(R2t,{"aria-hidden":!0}),t.jsxs(O2t,{children:[t.jsx(D2t,{children:"Payment method on file"}),t.jsx(L2t,{children:"Managed securely by Polar"})]})]}),t.jsxs(he,{type:"button",size:"sm",variant:"outline",disabled:!Nt||Me||pe,onClick:()=>void zt(),children:[t.jsx(v9,{size:16}),pe?"Openingâ¦":"Update"]})]})]}),t.jsxs(Ar,{children:[t.jsx(Zr,{children:t.jsxs("div",{style:{minWidth:0},children:[t.jsxs(Wr,{children:[t.jsx(Hj,{size:18}),t.jsx(Ur,{children:"Billing details"})]}),t.jsx(Hr,{children:"Invoice recipient and billing contact."})]})}),qe?t.jsx(W2t,{}):t.jsxs(z2t,{children:[t.jsxs(Bl,{children:[t.jsxs(Bn,{style:{margin:0},children:[t.jsx(ii,{htmlFor:"billing-name",children:"Billing name"}),t.jsx(Xt,{id:"billing-name",value:w,onChange:kt=>j(kt.target.value),disabled:!Nt||Me,placeholder:"Name on invoices"})]}),t.jsxs(Bn,{style:{margin:0},children:[t.jsx(ii,{htmlFor:"billing-email",children:"Billing email"}),t.jsx(Xt,{id:"billing-email",type:"email",value:v,onChange:kt=>_(kt.target.value),disabled:!Nt||Me}),t.jsx(Gs,{children:"Invoices and receipts are sent to this email."})]})]}),t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.6rem"},children:[t.jsx("input",{id:"billing-is-business",type:"checkbox",checked:$,disabled:!Nt||Me,onChange:kt=>{const Kt=!!kt.target.checked;k(Kt),Kt||(S(""),A(""),B(""))}}),t.jsx(ii,{htmlFor:"billing-is-business",style:{margin:0},children:"Iâm billing as a business"})]}),$?t.jsxs(Bl,{children:[t.jsxs(Bn,{style:{margin:0},children:[t.jsx(ii,{htmlFor:"tax-id-value",children:"Tax ID"}),t.jsx(Xt,{id:"tax-id-value",value:P,onChange:kt=>S(kt.target.value),disabled:!Nt||Me,placeholder:"e.g. DE123456789"})]}),t.jsxs(Bn,{style:{margin:0},children:[t.jsx(ii,{htmlFor:"tax-id-type",children:"Tax ID type"}),t.jsx(_u,{value:E,onChange:kt=>{B(kt),I&&A("")},onSelect:kt=>{const Kt=String(kt.value||"");A(Kt),B(Kt?Q4(Kt):"")},placeholder:"Search tax ID type (e.g. EU · VAT, US · EIN)",options:bn,disabled:!Nt||Me,dropdownPortal:!0}),t.jsx(Gs,{children:"Taxes/VAT may apply depending on your billing address and tax ID settings."})]})]}):null]}),t.jsx(fb,{children:t.jsx(he,{type:"button",size:"sm",disabled:!Nt||Me,onClick:async()=>{if(!s)return;const kt=w.trim(),Kt=v.trim();if(!kt||!Kt){o(kt?"Billing email is required.":"Billing name is required.",{tone:"error"});return}if($&&(!P.trim()||!I.trim())){o("Tax ID and Tax ID type are required for business billing.",{tone:"error"});return}Se(!0);try{const un=await ue(`/api/v1/organizations/${s}/billing/update_billing_details`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({billing_details:{name:kt,email:Kt,tax_id_value:P,tax_id_type:I}})}),pn=await un.json().catch(()=>({}));if(!un.ok)throw new Error(pn?.error||"Failed to update billing details");De(pn?.billing?.subscription||null),ge(Array.isArray(pn?.billing?.plans)?pn.billing.plans:[]),M(!1),o("Billing details updated.",{tone:"success"})}catch(un){o(un instanceof Error?un.message:"Failed to update billing details",{tone:"error"})}finally{Se(!1)}},children:"Update details"})})]}),t.jsxs(Ar,{children:[t.jsx(Zr,{children:t.jsxs("div",{style:{minWidth:0},children:[t.jsxs(Wr,{children:[t.jsx(_y,{size:18}),t.jsx(Ur,{children:"Billing address"})]}),t.jsx(Hr,{children:"Used for invoicing and taxes (where applicable)."})]})}),qt?t.jsx(U2t,{}):t.jsx(t.Fragment,{children:t.jsxs(T2t,{children:[t.jsxs(Bn,{style:{margin:0},children:[t.jsx(ii,{htmlFor:"billing-line1",children:"Address line 1"}),t.jsx(Xt,{id:"billing-line1",value:R,onChange:kt=>F(kt.target.value),disabled:!pt||Me,placeholder:"Street address"})]}),t.jsxs(Bl,{children:[t.jsxs(Bn,{style:{margin:0},children:[t.jsx(ii,{htmlFor:"billing-line2",children:"Address line 2"}),t.jsx(Xt,{id:"billing-line2",value:Y,onChange:kt=>H(kt.target.value),disabled:!pt||Me,placeholder:"Apt, suite, etc. (optional)"})]}),t.jsxs(Bn,{style:{margin:0},children:[t.jsx(ii,{htmlFor:"billing-postal",children:"Postal code"}),t.jsx(Xt,{id:"billing-postal",value:U,onChange:kt=>X(kt.target.value),disabled:!pt||Me,placeholder:"ZIP / postal code"})]})]}),t.jsxs(Bl,{children:[t.jsxs(Bn,{style:{margin:0},children:[t.jsx(ii,{htmlFor:"billing-city",children:"City"}),t.jsx(_u,{value:Ke,onChange:kt=>{ce(kt),K(kt),je(!0)},onSelect:kt=>{const Kt=kt?.data||{},un=String(Kt?.name||"").trim(),pn=String(Kt?.state||"").trim(),$n=String(Kt?.country_code||"").trim().toUpperCase(),Ii=String(Kt?.country||"").trim();ce(kt.label),un&&K(un),pn&&L(pn),$n&&(W($n),le(Ii||zJ($n)||$n)),Re([])},placeholder:"Search for a city...",options:ie,isLoading:Be,disabled:!pt||Me,dropdownPortal:ie.length>0||Be})]}),t.jsxs(Bn,{style:{margin:0},children:[t.jsx(ii,{htmlFor:"billing-state",children:"State / regi
22141on"}),t.jsx(Xt,{id:"billing-state",value:G,onChange:kt=>L(kt.target.value),disabled:!pt||Me,placeholder:"State / region"})]})]}),t.jsxs(Bn,{style:{margin:0},children:[t.jsx(ii,{htmlFor:"billing-country",children:"Country"}),t.jsx(_u,{value:de,onChange:kt=>{le(kt),W(""),we(!0)},onSelect:kt=>{const Kt=String(kt.value||"").trim().toUpperCase();W(Kt),le(kt.label),ee([])},placeholder:"Search for a country...",options:me,isLoading:ne,disabled:!pt||Me,dropdownPortal:me.length>0||ne})]}),t.jsx(fb,{children:t.jsx(he,{type:"button",size:"sm",disabled:!pt||Me,onClick:async()=>{if(s){Se(!0);try{const kt=await ue(`/api/v1/organizations/${s}/billing/update_billing_address`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({billing_address:{line1:R,line2:Y,postal_code:U,city:Q,state:G,country:q}})}),Kt=await kt.json().catch(()=>({}));if(!kt.ok)throw new Error(Kt?.error||"Failed to update billing address");De(Kt?.billing?.subscription||null),ge(Array.isArray(Kt?.billing?.plans)?Kt.billing.plans:[]),se(!1),o("Billing address updated.",{tone:"success"})}catch(kt){o(kt instanceof Error?kt.message:"Failed to update billing address",{tone:"error"})}finally{Se(!1)}}},children:"Update address"})})]})})]}),t.jsxs(Ar,{children:[t.jsx(Zr,{children:t.jsxs("div",{style:{minWidth:0},children:[t.jsxs(Wr,{children:[t.jsx(Ss,{size:18}),t.jsx(Ur,{children:"Billing history"})]}),t.jsx(Hr,{children:"Past invoices and receipts."})]})}),Xe?t.jsx(LJ,{children:t.jsxs(F2t,{children:[t.jsxs(BJ,{children:[t.jsx(nt,{height:12,width:"55%",radius:8}),t.jsx(nt,{height:12,width:"45%",radius:8}),t.jsx(nt,{height:12,width:"40%",radius:8}),t.jsx(nt,{height:12,width:"40%",radius:8}),t.jsx(nt,{height:12,width:"50%",radius:8})]}),Array.from({length:5}).map((kt,Kt)=>t.jsxs(BJ,{children:[t.jsx(nt,{height:14,width:"65%",radius:10}),t.jsx(nt,{height:14,width:"55%",radius:10}),t.jsx(nt,{height:14,width:"45%",radius:10}),t.jsx(nt,{height:14,width:"45%",radius:10}),t.jsx(nt,{height:14,width:"60%",radius:10})]},`bh-skel-${Kt}`))]})}):t.jsxs(t.Fragment,{children:[t.jsx(LJ,{children:t.jsxs(B2t,{$minWidth:"38rem",children:[t.jsx(pr,{children:t.jsxs(Cn,{children:[t.jsx(Ai,{children:"Invoice"}),t.jsx(Ai,{children:"Date"}),t.jsx(Ai,{children:"Amount"}),t.jsx(Ai,{children:"Status"}),t.jsx(Ai,{align:"right",children:"Action"})]})}),t.jsx(mr,{children:Ne?t.jsx(Cn,{children:t.jsx(bt,{colSpan:5,$muted:!0,children:Ne})}):Je.length===0?t.jsx(Cn,{children:t.jsx(bt,{colSpan:5,$muted:!0,children:"No billing history yet."})}):Je.map(kt=>{const Kt=Qe===kt.id;return t.jsxs(Cn,{children:[t.jsx(bt,{children:kt.invoice_number||"â"}),t.jsx(bt,{children:t.jsx(rr,{value:kt.created_at,format:"date",placeholder:"â"})}),t.jsx(bt,{children:Bg(kt.total_amount,kt.currency)}),t.jsx(bt,{children:kt.status||"â"}),t.jsx(bt,{$align:"right",children:kt.is_invoice_generated?t.jsx(he,{type:"button",size:"sm",variant:"outline",disabled:Kt,onClick:async()=>{if(s){ht(kt.id);try{const un=await ue(`/api/v1/organizations/${s}/billing/orders/${kt.id}/invoice`,{method:"GET"}),pn=await un.json().catch(()=>({}));if(!un.ok)throw new Error(pn?.error||"Invoice not available yet");const $n=String(pn?.invoice?.url||"");if(!$n)throw new Error("Invoice URL missing");window.open($n,"_blank","noopener,noreferrer")}catch(un){o(un instanceof Error?un.message:"Failed to download invoice",{tone:"error"})}finally{ht(null)}}},children:Kt?"Openingâ¦":"Download"}):t.jsx(he,{type:"button",size:"sm",disabled:Kt,onClick:async()=>{if(s){ht(kt.id);try{const un=await ue(`/api/v1/organizations/${s}/billing/orders/${kt.id}/invoice`,{method:"POST"}),pn=await un.json().catch(()=>({}));if(!un.ok)throw new Error(pn?.error||"Failed to generate invoice");const $n=String(pn?.invoice?.url||"");$n?window.open($n,"_blank","noopener,noreferrer"):o("Invoice is generating. Please try again in a few seconds.",{tone:"info",durationMs:6500});const Ii=await ue(`/api/v1/organizations/${s}/billing/history?page=${Ue}&per_page=${Wt}`,{method:"GET"}),_i=await Ii.json().catch(()=>({}));if(Ii.ok){const di=Array.isArray(_i?.billing?.orders)?_i.billing.orders:[];Ee(di);const Co=_i?.billing?.pagination||{},Gr=Number(Co?.total_pages||1),Go=Number(Co?.total||0);Yt(Number.isFinite(Gr)&&Gr>0?Gr:1),tn(Number.isFinite(Go)&&Go>=0?Go===0&&di.length>0?di.length:Go:di.length)}}catch(un){o(un instanceof Error?un.message:"Failed to generate invoice",{tone:"error"})}finally{ht(null)}}},children:Kt?"Generatingâ¦":"Generate"})})]},kt.id)})})]})}),Ne?null:t.jsx(pi,{page:Ue,totalPages:Qt,total:Zt,compact:!0,onPrev:()=>We(kt=>Math.max(1,kt-1)),onNext:()=>We(kt=>Math.min(Qt,kt+1))})]})]})]})]})}function q2t(e){const n=zn(),i=vo(),[r,o]=l.useState(!1),s=l.useRef(null),a=l.useRef(e);a.current=e,l.useEffect(()=>{if(!e)return;const m=history.pushState.bind(history),h=history.replaceState.bind(history),g=(x,y,w,j)=>{if(!a.current||!j)return x(y,w,j);const v=typeof j=="string"?j:j.toString(),_=i.pathname;if(v===_)return x(y,w,j);s.current=v,o(!0)};return history.pushState=function(x,y,w){g(m,x,y,w)},history.replaceState=function(x,y,w){g(h,x,y,w)},()=>{history.pushState=m,history.replaceState=h}},[e,i.pathname]),l.useEffect(()=>{if(!e)return;const m=()=>{a.current&&(s.current=window.location.pathname,history.pushState(null,"",i.pathname),o(!0))};return window.addEventListener("popstate",m),()=>window.removeEventListener("popstate",m)},[e,i.pathname]),l.useEffect(()=>{if(!e)return;const m=h=>{h.preventDefault(),h.returnValue=""};return window.addEventListener("beforeunload",m),()=>window.removeEventListener("beforeunload",m)},[e]);const c=l.useCallback(()=>{o(!1);const m=s.current;s.current=null,m&&(a.current=!1,n(m,{replace:!0}))},[n]),u=l.useCallback(()=>{s.current=null,o(!1)},[]);return{showPrompt:r,confirm:c,cancel:u}}
22141const yf="#06b6d4",C8="rgba(6, 182, 212, 0.08)",G2t=p.div.withConfig({displayName:"PlanCreditHero__HeroCard",componentId:"sc-1fevqyh-0"})` 22142 background: ${Z}; 22143 border: 1px solid ${V}; 22144 border-radius: 1rem; 22145 padding: 1.75rem 2rem; 22146 color: ${O}; 22147`,V2t=p.div.withConfig({displayName:"PlanCreditHero__HeroTop",componentId:"sc-1fevqyh-1"})` 22148 display: flex; 22149 align-items: flex-start; 22150 justify-content: space-between; 22151 gap: 1rem; 22152 flex-wrap: wrap; 22153`,K2t=p.div.withConfig({displayName:"PlanCreditHero__HeroLabel",componentId:"sc-1fevqyh-2"})` 22154 font-size: 0.7rem; 22155 font-weight: 600; 22156 color: ${z}; 22157 text-transform: uppercase; 22158 letter-spacing: 0.5px; 22159 margin-bottom: 0.2rem; 22160`,Y2t=p.div.withConfig({displayName:"PlanCreditHero__HeroAmount",componentId:"sc-1fevqyh-3"})` 22161 font-size: 2.75rem; 22162 font-weight: 800; 22163 letter-spacing: -2px; 22164 line-height: 1; 22165`,X2t=p.div.withConfig({displayName:"PlanCreditHero__HeroBadge",componentId:"sc-1fevqyh-4"})` 22166 background: ${cn}; 22167 border: 1px solid ${V}; 22168 border-radius: 0.5rem; 22169 padding: 0.4rem 0.85rem; 22170 font-size: 0.72rem; 22171 font-weight: 700; 22172 color: ${ot}; 22173 white-space: nowrap; 22174`,Q2t=p.div.withConfig({displayName:"PlanCreditHero__HeroBarWrap",componentId:"sc-1fevqyh-5"})` 22175 margin-top: 1.25rem; 22176`,Z2t=p.div.withConfig({displayName:"PlanCreditHero__HeroBarLabels",componentId:"sc-1fevqyh-6"})` 22177 display: flex; 22178 justify-content: space-between; 22179 font-size: 0.65rem; 22180 font-weight: 600; 22181 margin-bottom: 0.35rem; 22182 color: ${Pe}; 22183`,FJ=p.button.withConfig({displayName:"PlanCreditHero__BarLabelBtn",componentId:"sc-1fevqyh-7"})` 22184 appearance: none; 22185 border: none; 22186 background: none; 22187 padding: 0.15rem 0.4rem; 22188 border-radius: 0.3rem; 22189 font: inherit; 22190 font-size: 0.65rem; 22191 font-weight: 700; 22192 color: ${e=>e.$active?e.$color||ot:Pe}; 22193 cursor: pointer; 22194 display: inline-flex; 22195 align-items: center; 22196 gap: 0.3rem; 22197 transition: background 0.15s, color 0.15s; 22198 22199 ${e=>e.$active&&Pp` 22200 background: ${e.$color===yf?C8:cn}; 22201 `} 22202 22203 &:hover { 22204 background: ${e=>e.$color===yf?C8:cn}; 22205 color: ${e=>e.$color||ot}; 22206 } 22207`,J2t=p.div.withConfig({displayName:"PlanCreditHero__HeroBar",componentId:"sc-1fevqyh-8"})` 22208 width: 100%; 22209 height: 7px; 22210 background: ${V}; 22211 border-radius: 99px; 22212 overflow: hidden; 22213 display: flex; 22214`,WJ=p.button.withConfig({displayName:"PlanCreditHero__BarSegment",componentId:"sc-1fevqyh-9"})` 22215 appearance: none; 22216 border: none; 22217 padding: 0; 22218 width: ${e=>e.$pct}%; 22219 height: 100%; 22220 background: ${e=>e.$color}; 22221 cursor: pointer; 22222 transition: width 0.5s, filter 0.15s, opacity 0.15s; 22223 ${e=>e.$first&&Pp`border-radius: 99px 0 0 99px;`} 22224 ${e=>e.$active&&Pp`filter: brightness(1.15);`} 22225 22226 &:hover { 22227 filter: brightness(1.1); 22228 } 22229`,e5t=p.div.withConfig({displayName:"PlanCreditHero__PersistentStats",componentId:"sc-1fevqyh-10"})` 22230 display: flex; 22231 gap: 1.5rem; 22232 margin-top: 0.9rem; 22233 flex-wrap: wrap; 22234`,UJ=p.div.withConfig({displayName:"PlanCreditHero__MiniStat",componentId:"sc-1fevqyh-11"})` 22235 font-size: 0.68rem; 22236 font-weight: 650; 22237 color: ${z}; 22238 22239 strong { 22240 font-weight: 850; 22241 color: ${O}; 22242 } 22243`,HJ=p.div.withConfig({displayName:"PlanCreditHero__BreakdownPanel",componentId:"sc-1fevqyh-12"})` 22244 margin-top: 0.75rem; 22245 padding: 0.75rem 0.85rem; 22246 background: ${e=>e.$color===yf?C8:cn}; 22247 border: 1px solid ${e=>e.$color===yf?"rgba(6,182,212,0.18)":V}; 22248 border-radius: 0.65rem; 22249 animation: breakdownIn 150ms ease; 22250 22251 @keyframes breakdownIn { 22252 from { opacity: 0; transform: translateY(-4px); } 22253 to { opacity: 1; transform: translateY(0); } 22254 } 22255`,qJ=p.div.withConfig({displayName:"PlanCreditHero__BreakdownTitle",componentId:"sc-1fevqyh-13"})` 22256 font-size: 0.62rem; 22257 font-weight: 800; 22258 text-transform: uppercase; 22259 letter-spacing: 0.04em; 22260 color: ${z}; 22261 margin-bottom: 0.5rem; 22262`,GJ=p.div.withConfig({displayName:"PlanCreditHero__BreakdownGrid",componentId:"sc-1fevqyh-14"})` 22263 display: flex; 22264 gap: 1.25rem; 22265 flex-wrap: wrap; 22266`,Fg=p.div.withConfig({displayName:"PlanCreditHero__BreakdownItem",componentId:"sc-1fevqyh-15"})` 22267 font-size: 0.72rem; 22268 font-weight: 650; 22269 color: ${z}; 22270 22271 strong { 22272 font-weight: 850; 22273 color: ${O}; 22274 margin-right: 0.2rem; 22275 } 22276`,t5t=p.span.withConfig({displayName:"PlanCreditHero__StatusPill",componentId:"sc-1fevqyh-16"})` 22277 display: inline-flex; 22278 align-items: center; 22279 justify-content: center; 22280 padding: 0.2rem 0.45rem; 22281 border-radius: 9999px; 22282 font-size: 0.65rem; 22283 font-weight: 850; 22284 border: 1px solid ${e=>e.$tone==="canceled"?Er:e.$tone==="active"?Mo:V}; 22285 background: ${e=>
22285e.$tone==="canceled"?kn:e.$tone==="active"?si:At}; 22286 color: ${e=>e.$tone==="canceled"?Ut:e.$tone==="active"?Vt:z}; 22287 text-transform: capitalize; 22288`,n5t=p.div.withConfig({displayName:"PlanCreditHero__PlanRowWrap",componentId:"sc-1fevqyh-17"})` 22289 display: flex; 22290 align-items: center; 22291 justify-content: space-between; 22292 padding: 0.85rem 1.1rem; 22293 background: ${cn}; 22294 border: 1px solid ${V}; 22295 border-radius: 0.75rem; 22296 gap: 0.75rem; 22297 flex-wrap: wrap; 22298`,i5t=p.div.withConfig({displayName:"PlanCreditHero__PlanRowLeft",componentId:"sc-1fevqyh-18"})` 22299 display: flex; 22300 align-items: center; 22301 gap: 0.75rem; 22302`,r5t=p.div.withConfig({displayName:"PlanCreditHero__PlanIcon",componentId:"sc-1fevqyh-19"})` 22303 width: 38px; 22304 height: 38px; 22305 background: ${ot}; 22306 border-radius: 0.55rem; 22307 display: flex; 22308 align-items: center; 22309 justify-content: center; 22310 color: #fff; 22311 font-weight: 700; 22312 font-size: 0.85rem; 22313 flex-shrink: 0; 22314`,o5t=p.div.withConfig({displayName:"PlanCreditHero__PlanRowName",componentId:"sc-1fevqyh-20"})` 22315 font-size: 0.85rem; 22316 font-weight: 700; 22317 color: ${O}; 22318`,s5t=p.div.withConfig({displayName:"PlanCreditHero__PlanRowMeta",componentId:"sc-1fevqyh-21"})` 22319 font-size: 0.68rem; 22320 color: ${z};
22321 margin-top: 1px; 22322`,VJ=p.button.withConfig({displayName:"PlanCreditHero__SmallLinkBtn",componentId:"sc-1fevqyh-22"})` 22323 appearance: none; 22324 border: 0; 22325 padding: 0; 22326 background: transparent; 22327 text-decoration: underline; 22328 font: inherit; 22329 font-size: 0.75rem; 22330 color: ${z}; 22331 cursor: pointer; 22332 &:disabled { cursor: default; opacity: 0.6; text-decoration: none; } 22333`,a5t=p.div.withConfig({displayName:"PlanCreditHero__DowngradeWrap",componentId:"sc-1fevqyh-23"})` 22334 position: relative; 22335 display: inline-block; 22336`,l5t=p.div.withConfig({displayName:"PlanCreditHero__DowngradeMenu",componentId:"sc-1fevqyh-24"})` 22337 position: absolute; 22338 right: 0; 22339 bottom: calc(100% + 4px); 22340 min-width: 240px; 22341 background: ${Z}; 22342 border: 1px solid ${V}; 22343 border-radius: 0.5rem; 22344 box-shadow: 0 4px 16px rgba(0, 0, 0, 0.10); 22345 z-index: 20; 22346 padding: 0.3rem; 22347`,KJ=p.button.withConfig({displayName:"PlanCreditHero__DowngradeMenuItem",componentId:"sc-1fevqyh-25"})` 22348 appearance: none; 22349 border: none; 22350 width: 100%; 22351 text-align: left; 22352 padding: 0.5rem 0.65rem; 22353 border-radius: 0.35rem; 22354 background: transparent; 22355 cursor: pointer; 22356 font: inherit; 22357 font-size: 0.72rem; 22358 font-weight: 650; 22359 color: ${O}; 22360 display: flex; 22361 flex-direction: column; 22362 gap: 0.1rem; 22363 transition: background 0.1s; 22364 &:hover { background: ${At}; } 22365`,YJ=p.span.withConfig({displayName:"PlanCreditHero__DowngradeItemMeta",componentId:"sc-1fevqyh-26"})` 22366 font-size: 0.62rem; 22367 font-weight: 600; 22368 color: ${Pe}; 22369`;function c5t({usageLimits:e,creditsTotal:n,creditsUsed:i,creditsAvailable:r,addonReserved:o,statusLower:s,canceled:a,subscription:c}){const u=e?.usage?.credits,[m,h]=l.useState(null),g=v=>h(_=>_===v?null:v),x=Math.max(0,i-o),y=n>0?x/n*100:0,w=n>0?o/n*100:0,j=e?.addon_reservation;return t.jsxs(G2t,{children:[t.jsxs(V2t,{children:[t.jsxs("div",{children:[t.jsx(K2t,{children:"Available Credits"}),t.jsx(Y2t,{children:u?r.toLocaleString():"â"})]}),t.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-end",gap:"0.35rem"},children:[t.jsxs(X2t,{children:[pa(c?.plan?.name)," · ",c?.billing_interval==="yearly"?"Yearly":"Monthly"]}),t.jsx(t5t,{$tone:a?"canceled":["active","trialing"].includes(s)?"active":"neutral",children:String(c?.polar?.status||c?.status||"â")})]})]}),u?t.jsxs(Q2t,{children:[t.jsxs(Z2t,{children:[t.jsxs(FJ,{type:"button",$active:m==="spent",$color:ot,onClick:()=>g("spent"),children:[t.jsx("span",{style:{width:7,height:7,borderRadius:"50%",background:ot,flexShrink:0}}),"Spent: ",x.toLocaleString()]}),o>0?t.jsxs(FJ,{type:"button",$active:m==="reserved",$color:yf,onClick:()=>g("reserved"),children:[t.jsx("span",{style:{width:7,height:7,borderRadius:"50%",background:yf,flexShrink:0}}),"Reserved: ",o.toLocaleString()]}):null,t.jsxs("span",{children:["Total: ",n.toLocaleString(),u?.monthly_credits_allowance&&u.monthly_credits_allowance>n?t.jsx("span",{style:{marginLeft:4,fontSize:"0.58rem",fontWeight:700,color:"#d97706",background:"rgba(217,119,6,0.08)",padding:"1px 5px",borderRadius:4},children:"Prorated"}):null]})]}),t.jsxs(J2t,{children:[t.jsx(WJ,{type:"button","aria-label":"Show spent breakdown",$color:ot,$pct:y,$first:!0,$active:m==="spent",onClick:()=>g("spent")}),o>0?t.jsx(WJ,{type:"button","aria-label":"Show reserved breakdown",$color:yf,$pct:w,$active:m==="reserved",onClick:()=>g("reserved")}):null]}),m==="spent"&&e?t.jsxs(HJ,{$color:ot,children:[t.jsx(qJ,{children:"Credits spent this period"}),t.jsxs(GJ,{children:[t.jsxs(Fg,{children:[t.jsx("strong",{children:e.usage.site_audit.used_total}),"Site Audits"]}),t.jsxs(Fg,{children:[t.jsx("strong",{children:e.usage.project_actions?.credits_used??0}),"Actions"]}),t.jsxs(Fg,{children:[t.jsx("strong",{children:e.usage.fanout?.credits_used??0}),"Fan-out"]}),t.jsxs(Fg,{children:[t.jsx("strong",{children:e.usage.chat?.credits_used??0}),"Chat"]})]})]}):null,m==="reserved"&&j?(()=>{const v=!!(u?.monthly_credits_allowance&&u.monthly_credits_allowance>n);return t.jsxs(HJ,{$color:yf,children:[t.jsxs(qJ,{children:["Credit reservations",v?" (prorated this period)":""]}),t.jsxs(GJ,{children:[j.llm_breakdown&&Object.keys(j.llm_breakdown).length>0?Object.entries(j.llm_breakdown).map(([_,$])=>
22369t.jsxs(Fg,{children:[t.jsxs("strong",{children:[$.toLocaleString()," cr"]}),"/mo ",_.replace(/_/g," ")]},_)):null,j.pack_credits&&j.pack_credits>0?t.jsxs(Fg,{children:[t.jsxs("strong",{children:[j.pack_credits.toLocaleString()," cr"]}),"/mo Prompt packs",j.prompt_packs?` (Ã${j.prompt_packs})`:""]}):null,j.total_addon_monthly!=null?t.jsxs(Fg,{style:{fontWeight:750,color:O},children:["Full month: ",t.jsxs("strong",{children:[j.total_addon_monthly.toLocaleString()," cr"]}),"/mo",v?t.jsxs("span",{style:{fontWeight:600,color:Pe},children:[" · This period: ",o.toLocaleString()," cr"]}):null]}):null]})]})})():null]}):null,e?t.jsxs(e5t,{children:[t.jsxs(UJ,{children:[t.jsxs("strong",{children:[e.usage.projects.projects_count,e.limits.projects_limit!=null?` / ${e.limits.projects_limit}`:""]})," Projects"]}),t.jsxs(UJ,{children:[t.jsxs("strong",{children:[e.usage.prompts.active_prompts," / ",e.limits.daily_prompt_runs_limit]})," Active prompts"]})]}):null]})}function d5t({subscription:e,isTrialing:n,canceled:i,scheduledCancel:r,hasPendingDowngrade:o,pendingDowngrade:s,needsCheckout:a,checkoutDisabled:c,onStartCheckout:u,canUncancel:m,uncancelSaving:h,onUncancel:g,cancelDowngradeSaving:x,onCancelDowngrade:y,canCancel:w,canDowngrade:j,onDowngradeClick:v,onDowngradeToGrow:_,onCancelClick:$,startNowDisabled:k,onStartNow:P,currentPlanFamily:S,growPlans:I,configInterval:A="monthly"}){const[E,B]=l.useState(!1),T=l.useRef(null);l.useEffect(()=>{if(!E)return;const Y=H=>{T.current&&!T.current.contains(H.target)&&B(!1)};return document.addEventListener("mousedown",Y),()=>document.removeEventListener("mousedown",Y)},[E]);const M=S==="pro_plus",R=A,F=()=>{M&&I&&I.length>0?B(Y=>!Y):v()};return t.jsxs(n5t,{children:[t.jsxs(i5t,{children:[t.jsx(r5t,{children:(e?.plan?.name||"P")[0]}),t.jsxs("div",{children:[t.jsx(o5t,{children:pa(e?.plan?.name)}),t.jsxs(s5t,{children:[mf(e?.price_cents,e?.currency),e?.billing_interval==="yearly"?"/yr":"/mo"," · ",n?t.jsxs(t.Fragment,{children:["Trial ends ",t.jsx(rr,{value:e?.polar?.trial_end||e?.polar?.current_period_end,placeholder:"â"})]}):i?"Canceled":r?t.jsxs(t.Fragment,{children:["Cancels ",t.jsx(rr,{value:e?.polar?.current_period_end,placeholder:"â"})]}):o?t.jsxs(t.Fragment,{children:["â ",pa(s.plan.name)," on ",t.jsx(rr,{value:s.scheduled_at,placeholder:"â"})]}):t.jsxs(t.Fragment,{children:["Renews ",t.jsx(rr,{value:e?.polar?.current_period_end,placeholder:"â"})]})]})]})]}),t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem",flexWrap:"wrap"},children:[a?t.jsx(he,{type:"button",size:"sm",disabled:c,onClick:u,children:"Complete checkout"}):null,n&&!r&&!i&&P?t.jsx(he,{type:"button",size:"sm",variant:"outline",disabled:k,onClick:P,children:"Start now"}):null,r?t.jsx(he,{type:"button",variant:"outline",size:"sm",disabled:!m||h,onClick:g,children:h?"Uncancelingâ¦":"Uncancel"}):null,o?t.jsx(he,{type:"button",variant:"outline",size:"sm",disabled:x,onClick:y,children:x?"Cancelingâ¦":"Cancel downgrade"}):null,!r&&!i?t.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"flex-end",gap:"0.35rem"},children:[j?t.jsxs(a5t,{ref:T,children:[t.jsxs(VJ,{type:"button",onClick:F,style:M?{display:"inline-flex",alignItems:"center",gap:"0.2rem"}:void 0,children:["Downgrade",M?t.jsx(qn,{size:11,style:{transform:E?"rotate(180deg)":void 0,transition:"transform 0.15s"}}):null]}),E&&M?t.jsxs(l5t,{children:[t.jsxs(KJ,{type:"button",onClick:()=>{B(!1),v()},children:["Core",t.jsx(YJ,{children:"120 credits"})]}),(I||[]).map(Y=>{const H=r_(Y,R),U=R==="yearly"?"/yr":"/mo";return t.jsxs(KJ,{type:"button",onClick:()=>{B(!1),_?.(Y.code)},children:[pa(Y.name),t.jsxs(YJ,{children:[(Y.monthly_credits_allowance??0).toLocaleString()," credits · ",mf(H,Y.currency),U]})]},Y.code)})]}):null]}):null,t.jsx(VJ,{type:"button",disabled:!w,onClick:$,children:"Cancel plan"})]}):null]})]})}const u5t=p.div.withConfig({displayName:"PlanUsageLimits__UsageGrid",componentId:"sc-1i7ez1k-0"})` 22370 display: grid; 22371 grid-template-columns: auto auto auto 1fr 1fr 1fr; 22372 gap: 0.5rem; 22373 @media (max-width: 900px) { grid-template-columns: repeat(3, 1fr); } 22374 @media (max-width: 650px) { grid-template-columns: 1fr 1fr; } 22375 @media (max-width: 420px) { grid-template-columns: 1fr; } 22376`,R5=p.div.withConfig({displayName:"PlanUsageLimits__UsageCard",componentId:"sc-1i7ez1k-1"})` 22377 border: 1px solid ${V}; 22378 background: ${At}; 22379 border-radius: 0.65rem; 22380 padding: 0.55rem 0.7rem 0.5rem; 22381 min-width: 0; 22382`,J4=p(R5).withConfig({displayName:"PlanUsageLimits__UsageCardCentered",componentId:"sc-1i7ez1k-2"})` 22383 display: flex; 22384 flex-direction: column; 22385 align-items: center; 22386`,eE=p.div.withConfig({displayName:"PlanUsageLimits__UsageCardCenteredContent",componentId:"sc-1i7ez1k-3"})` 22387 flex: 1; 22388 display: flex; 22389 flex-direction: column; 22390 align-items: center; 22391 justify-content: center; 22392 width: 100%; 22393`,Ux=p.div.withConfig({displayName:"PlanUsageLimits__UsageCardHeader",componentId:"sc-1i7ez1k-4"})` 22394 display: flex; 22395 align-items: center; 22396 gap: 0.3rem; 22397 margin-bottom: 0.25rem; 22398`,Hx=p.div.withConfig({displayName:"PlanUsageLimits__UsageCardIcon",componentId:"sc-1i7ez1k-5"})` 22399 display: flex; 22400 align-items: center; 22401 justify-content: center; 22402 color: ${e=>e.$accent||Pe}; 22403 flex-shrink: 0; 22404`,qx=p.div.withConfig({displayName:"PlanUsageLimits__UsageLabel",componentId:"sc-1i7ez1k-6"})` 22405 font-size: 0.62rem; 22406 font-weight: 800; 22407 letter-spacing: 0.02em; 22408 text-transform: uppercase; 22409 color: ${z}; 22410`,XJ=p.div.withConfig({displayName:"PlanUsageLimits__UsageValue",componentId:"sc-1i7ez1k-7"})` 22411 font-size: 0.88rem; 22412 font-weight: 900; 22413 color: ${O}; 22414 line-height: 1.2; 22415`,wj=p.div.withConfig({displayName:"PlanUsageLimits__UsageBar",componentId:"sc-1i7ez1k-8"})` 22416 margin-top: 0.3rem; 22417 height: 3px; 22418 border-radius: 2px; 22419 background: ${V}; 22420 overflow: hidden; 22421`,jj=p.div.withConfig({displayName:"PlanUsageLimits__UsageBarFill",componentId:"sc-1i7ez1k-9"})` 22422 height: 100%; 22423 border-radius: 2px; 22424 width: ${e=>Math.min(100,e.$pct)}%; 22425 background: ${e=>e.$pct>=90?Ut:e.$pct>=70?"#f59e0b":e.$accent||ot}; 22426 transition: width 0.3s ease; 22427`,p5t=p.span.withConfig({displayName:"PlanUsageLimits__UsageBadge",componentId:"sc-1i7ez1k-10"})` 22428 margin-left: auto; 22429 font-size: 0.65rem; 22430 font-weight: 800; 22431 background: ${V}; 22432 color: ${z}; 22433 border-radius: 99px; 22434 padding: 0.1rem 0.45rem; 22435 line-height: 1.3; 22436`,m5t=p.span.withConfig({displayName:"PlanUsageLimits__UsageStatusPill",componentId:"sc-1i7ez1k-11"})` 22437 display: inline-block; 22438 font-size: 0.65rem; 22439 font-weight: 800; 22440 border-radius: 99px; 22441 padding: 0.12rem 0.5rem; 22442 line-height: 1.3; 22443 margin-top: 0.1rem; 22444 background: ${e=>e.$enabled?"#dcfce7":V}; 22445 color: ${e=>e.$enabled?"#16a34a":Pe}; 22446`,h5t=p.div.withConfig({displayName:"PlanUsageLimits__UsageIcons",componentId:"sc-1i7ez1k-12"})` 22447 margin-top: 0.4rem; 22448 display: flex; 22449 flex-wrap: wrap; 22450 gap: 0.4rem; 22451 align-items: center; 22452 color: ${z}; 22453`,QJ=p.div.withConfig({displayName:"PlanUsageLimits__UsageDualRow",componentId:"sc-1i7ez1k-13"})` 22454 display: grid; 22455 grid-template-columns: 1fr 1fr; 22456 gap: 0.6rem; 22457`,D2=p.div.withConfig({displayName:"PlanUsageLimits__UsageDualCol",componentId:"sc-1i7ez1k-14"})` 22458 display: flex; 22459 flex-direction: column; 22460 min-width: 0; 22461`,L2=p.div.withConfig({displayName:"PlanUsageLimits__UsageDualLabel",componentId:"sc-1i7ez1k-15"})` 22462 font-size: 0.55rem; 22463 font-weight: 700; 22464 text-transform: uppercase; 22465 letter-spacing: 0.03em; 22466 color: ${Pe}; 22467 margin-bottom: 0.15rem; 22468`,B2=p.div.withConfig({displayName:"PlanUsageLimits__UsageDualValue",componentId:"sc-1i7ez1k-16"})` 22469 font-size: 0.8rem; 22470 font-weight: 900; 22471 color: ${O}; 22472 margin-bottom: 0.2rem; 22473 white-space: nowrap; 22474`;
22474function tE(e){return Number(e||0).toLocaleString()}function f5t({usageLimits:e,usageLoading:n}){const[i,r]=l.useState(!1);return t.jsxs(Ar,{children:[t.jsxs(Zr,{children:[t.jsxs("div",{style:{minWidth:0},children:[t.jsxs(Wr,{children:[t.jsx(gl,{size:18}),t.jsx(Ur,{children:"Usage & limits"})]}),t.jsx(Hr,{children:"Overview of plan limits and current usage."})]}),t.jsx(he,{type:"button",size:"sm",variant:"outline",onClick:()=>r(o=>!o),disabled:n&&!e,children:i?t.jsxs(t.Fragment,{children:[t.jsx(yu,{size:16})," Hide"]}):t.jsxs(t.Fragment,{children:[t.jsx(qn,{size:16})," View"]})})]}),i&&e?t.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.65rem"},children:t.jsxs(u5t,{children:[t.jsxs(J4,{children:[t.jsxs(Ux,{children:[t.jsx(Hx,{$accent:"#3b82f6",children:t.jsx(jy,{size:12})}),t.jsx(qx,{children:"Projects"})]}),t.jsxs(eE,{children:[t.jsxs(XJ,{children:[e.usage.projects.projects_count," / ",e.limits.projects_limit==null?"â":e.limits.projects_limit]}),e.limits.projects_limit!=null?t.jsx(wj,{style:{alignSelf:"stretch"},children:t.jsx(jj,{$pct:e.usage.projects.projects_count/e.limits.projects_limit*100,$accent:"#3b82f6"})}):null]})]}),t.jsxs(J4,{children:[t.jsxs(Ux,{children:[t.jsx(Hx,{$accent:"#06b6d4",children:t.jsx(To,{size:12})}),t.jsx(qx,{children:"Countries"})]}),t.jsx(eE,{children:t.jsxs(XJ,{children:[e.usage.countries.distinct_countries_count," / ",e.limits.countries_limit==null?"â":e.limits.countries_limit]})})]}),t.jsxs(J4,{children:[t.jsxs(Ux,{children:[t.jsx(Hx,{$accent:"#6366f1",children:t.jsx(Yl,{size:12})}),t.jsx(qx,{children:"API access"})]}),t.jsx(eE,{children:t.jsx(m5t,{$enabled:e.features.api_access_enabled,children:e.features.api_access_enabled?"Enabled":"Disabled"})})]}),t.jsxs(R5,{children:[t.jsxs(Ux,{children:[t.jsx(Hx,{$accent:"#8b5cf6",children:t.jsx(Dy,{size:12})}),t.jsx(qx,{children:"LLMs enabled"}),t.jsx(p5t,{children:(e.usage.llms_enabled||[]).length})]}),t.jsx(h5t,{children:(e.usage.llms_enabled||[]).length?e.usage.llms_enabled.map(o=>{const s=pie[o],a=s?.Icon,c=String(s?.label||o);return a?t.jsx(at,{content:c,size:"sm",children:t.jsx("span",{style:{width:16,height:16,display:"inline-flex",cursor:"default"},children:t.jsx(a,{style:{width:16,height:16}})})},o):t.jsx(at,{content:c,size:"sm",children:t.jsx("span",{style:{fontSize:11,fontWeight:750,cursor:"default"},children:o})},o)}):t.jsx("span",{style:{fontSize:"0.7rem",fontWeight:650,color:Pe},children:"â"})})]}),t.jsxs(R5,{children:[t.jsxs(Ux,{children:[t.jsx(Hx,{$accent:"#f59e0b",children:t.jsx(Ss,{size:12})}),t.jsx(qx,{children:"Prompts"})]}),t.jsxs(QJ,{children:[t.jsxs(D2,{children:[t.jsx(L2,{children:"Active"}),t.jsxs(B2,{children:[e.usage.prompts.active_prompts," / ",e.limits.daily_prompt_runs_limit]}),t.jsx(wj,{children:t.jsx(jj,{$pct:e.limits.daily_prompt_runs_limit>0?e.usage.prompts.active_prompts/e.limits.daily_prompt_runs_limit*100:0,$accent:"#f59e0b"})})]}),t.jsxs(D2,{children:[t.jsx(L2,{children:"Runs today"}),t.jsxs(B2,{children:[e.usage.prompts.daily_prompt_runs_used_today," / ",e.limits.daily_prompt_runs_limit]}),t.jsx(wj,{children:t.jsx(jj,{$pct:e.limits.daily_prompt_runs_limit>0?e.usage.prompts.daily_prompt_runs_used_today/e.limits.daily_prompt_runs_limit*100:0,$accent:"#f97316"})})]})]})]}),t.jsxs(R5,{children:[t.jsxs(Ux,{children:[t.jsx(Hx,{$accent:"#16a34a",children:t.jsx(vy,{size:12})}),t.jsx(qx,{children:"Credits"})]}),t.jsxs(QJ,{children:[t.jsxs(D2,{children:[t.jsx(L2,{children:"Used"}),t.jsxs(B2,{children:[tE(e.usage.credits.credits_used)," / ",tE(e.usage.credits.credits_total)]}),t.jsx(wj,{children:t.jsx(jj,{$pct:e.usage.credits.credits_total>0?e.usage.credits.credits_used/e.usage.credits.credits_total*100:0,$accent:"#16a34a"})})]}),t.jsxs(D2,{children:[t.jsx(L2,{children:"Left"}),t.jsx(B2,{children:tE(e.usage.credits.credits_remaining)}),t.jsx(wj,{children:t.jsx(jj,{$pct:e.usage.credits.credits_total>0?e.usage.credits.credits_remaining/e.usage.credits.credits_total*100:0,$accent:"#22c55e"})})]})]})]})]})}):i&&n?t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[t.jsx(nt,{height:14,width:"42%",radius:10}),t.jsx(nt,{height:14,width:"56%",radius:10})]}):null]})}const nE=p(Kc).withConfig({displayName:"WorkspaceSettingsPlan__PlanMax",componentId:"sc-1san0md-0"})` 22475 max-width: 56rem; 22476 display: flex; 22477 flex-direction: column; 22478 gap: 1.25rem; 22479 22480 ${Ys} { 22481 margin-bottom: 0; 22482 } 22483`;function g5t(){const{workspaceId:e}=Gn(),{user:n,refreshUser:i}=yn(),{showToast:r}=Uo(),o=l.useMemo(()=>{const pe=Number(e);return Number.isFinite(pe)?pe:null},[e]),s=l.useMemo(()=>o&&n?.organizations?.find(pe=>pe.id===o)||null,[o,n?.organizations]),a=String(s?.role||"").toLowerCase()==="owner",c=!!s?.partner_managed,u=String(s?.partner?.name||"").trim(),m=String(s?.partner?.return_url||"").trim(),[h,g]=l.useState(!1),[x,y]=l.useState(null),[w,j]=l.useState([]),[v,_]=l.useState(null);async function $(){if(!o)return null;const pe=await ue(`/api/v1/organizations/${o}/billing/usage_limits`,{method:"GET"}),be=await pe.json().catch(()=>({}));if(!pe.ok)throw new Error(be?.error||"Failed to load usage limits");return y(be?.usage_limits||null),be}async function k(){if(!o)return;const pe=await ue(`/api/v1/organizations/${o}/billing`,{method:"GET"}),be=await pe.json().catch(()=>({}));if(pe.ok)return j(be?.billing?.plans||[]),_(be?.billing?.subscription||null),be}l.useEffect(()=>{if(!o)return;let pe=!1;return ue(`/api/v1/organizations/${o}/billing`,{method:"GET"}).then(be=>be.json()).then(be=>{pe||(j(be?.billing?.plans||[]),_(be?.billing?.subscription||null))}).catch(()=>{}),()=>{pe=!0}}
22483,[o]),l.useEffect(()=>{if(!o||h||x)return;let pe=!1;return g(!0),$().catch(()=>{pe||y(null)}).finally(()=>{pe||g(!1)}),()=>{pe=!0}},[o]);const P=!!v?.billing_exempt,S=String(v?.polar?.status||v?.status||"").toLowerCase(),I=S==="trialing",A=["canceled","cancelled"].includes(S),E=!!v?.polar?.cancel_at_period_end&&!A,B=v?.pending_downgrade??null,T=!!B?.plan,M=!!(v?.provider==="polar"&&v?.provider_subscription_id)&&!P&&!A&&!E,R=!!(v?.provider==="polar"&&v?.provider_subscription_id)&&!P&&E,F=v?.plan?.plan_family||"grow",Y=F==="core",H=!Y&&!P&&!A&&!E&&!T,U=l.useMemo(()=>w.filter(pe=>pe.plan_family==="grow").sort((pe,be)=>(pe.monthly_credits_allowance??0)-(be.monthly_credits_allowance??0)),[w]),[X,Q]=l.useState(!1),[K,G]=l.useState(!1),[L,q]=l.useState(!1),[W,oe]=l.useState(!1),[se,de]=l.useState(!1),[le,me]=l.useState(null),[ee,ne]=l.useState(!1),[Ae,_e]=l.useState(!1),[we,Ke]=l.useState(!1),[ce,ie]=l.useState(!1),[Re,Be]=l.useState(!1),[tt,dt]=l.useState("monthly"),[je,Me]=l.useState(!1),Se=q2t(je),it=l.useCallback(pe=>{const be=U.find(rt=>rt.code===pe)||null;be&&(me(be),de(!0))},[U]),[De,te]=l.useState(null),ge=!P&&v?.provider==="polar"&&(!v?.provider_subscription_id||A);l.useEffect(()=>()=>{try{De?.close?.()}catch{}},[De]);async function Je(){if(!(!o||!v?.plan?.code||De))try{const pe=await ue(`/api/v1/organizations/${o}/billing/checkout`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plan_code:v.plan.code,billing_interval:tt})}),be=await pe.json().catch(()=>({}));if(!pe.ok)throw new Error(be?.error||"Failed to start checkout");const rt=String(be?.checkout_url||"");if(!rt)throw new Error("Missing checkout URL");const ze=n?.theme==="dark"?"dark":"light";try{te({__opening:!0});const lt=await GO(rt,ze,{onSuccess:()=>{te(null),Ee()},onClose:()=>{te(null),r("Checkout closed.",{tone:"info"})},onErrorFallback:()=>{window.location.href=rt}});te(lt)}catch{te(null)}}catch(pe){r(pe instanceof Error?pe.message:"Failed to start checkout",{tone:"error"})}}async function Ee(){if(!o)return;const pe=Date.now();try{for(;Date.now()-pe<45e3;){const rt=(await k())?.billing?.subscription,ze=String(rt?.polar?.status||rt?.status||"").toLowerCase();if(ze==="active"||ze==="trialing"){r("Billing confirmed.",{tone:"success"}),i().catch(()=>{}),$().catch(()=>{});return}await new Promise(lt=>setTimeout(lt,2e3))}r("Billing confirmation is taking a moment â try refreshing.",{tone:"info"})}catch{r("Could not confirm billing status.",{tone:"error"})}}
22483async function Xe(){if(o){_e(!0);try{const pe=await ue(`/api/v1/organizations/${o}/billing/uncancel`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})}),be=await pe.json().catch(()=>({}));if(!pe.ok)throw new Error(be?.error||"Failed to uncancel");_(be?.billing?.subscription||null),r("Cancellation removed.",{tone:"success"})}catch(pe){r(pe instanceof Error?pe.message:"Failed to uncancel",{tone:"error"})}finally{_e(!1)}}}async function yt(){if(o){Ke(!0);try{const pe=await ue(`/api/v1/organizations/${o}/billing/cancel_pending_downgrade`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})}),be=await pe.json().catch(()=>({}));if(!pe.ok)throw new Error(be?.error||"Failed to cancel pending downgrade");_(be?.billing?.subscription||null),j(Array.isArray(be?.billing?.plans)?be.billing.plans:[]),r("Pending downgrade canceled.",{tone:"success"})}catch(pe){r(pe instanceof Error?pe.message:"Failed",{tone:"error"})}finally{Ke(!1)}}}function Ne(){k(),$().catch(()=>{}),i().catch(()=>{})}const Le=x?.usage?.credits,Ue=Le?.credits_total??0,We=Le?.credits_used??0,Qe=Le?.addon_credits_reserved??0,ht=Math.max(0,Ue-We);return c?t.jsx(ma,{children:t.jsxs(nE,{children:[t.jsxs(Ys,{children:[t.jsxs(ha,{children:[t.jsx(fa,{children:"Plan"}),t.jsx("div",{style:{paddingRight:8,minWidth:0}
22483,children:t.jsx(qr,{items:[{label:"Workspace",to:e?`/workspaces/${e}`:void 0},{label:"Settings",to:e?`/workspaces/${e}/settings`:void 0},{label:"Plan"}]})})]}),t.jsx(ga,{children:"Your plan is managed by your partner."})]}),t.jsxs(Ar,{children:[t.jsx(Zr,{children:t.jsxs("div",{children:[t.jsxs(Wr,{children:[t.jsx(Yl,{size:18}),t.jsx(Ur,{children:"Plan"})]}),t.jsxs(Hr,{children:["This workspace's plan is managed by your partner.",m?t.jsxs(t.Fragment,{children:[" ",t.jsxs("a",{href:m,target:"_blank",rel:"noreferrer",style:{color:"inherit",textDecoration:"underline"},children:["Go to ",u||"your partner"," to manage your plan."]})]}):null]})]})}),t.jsx("div",{style:{display:"flex",alignItems:"center",gap:"0.75rem"},children:v?t.jsx("span",{style:{fontWeight:800,fontSize:"1rem"},children:pa(v?.plan?.name)}):t.jsx(nt,{width:140,height:26,radius:9999})})]}),t.jsx(f5t,{usageLimits:x,usageLoading:h})]})}):s&&!a?t.jsx(ma,{children:t.jsxs(nE,{children:[t.jsxs(Ys,{children:[t.jsx(ha,{children:t.jsx(fa,{children:"Plan"})}),t.jsx(ga,{children:"View your plan usage and limits."})]}),t.jsx(Ar,{children:t.jsx("div",{style:{fontSize:"0.875rem",fontWeight:650,color:z},children:"Plan details require workspace owner access."})})]})}):t.jsxs(ma,{children:[t.jsxs(nE,{children:[t.jsxs(Ys,{children:[t.jsxs(ha,{children:[t.jsx(fa,{children:"Plan & Usage"}),t.jsx("div",{style:{paddingRight:8,minWidth:0}
22483,children:t.jsx(qr,{items:[{label:"Workspace",to:e?`/workspaces/${e}`:void 0},{label:"Settings",to:e?`/workspaces/${e}/settings`:void 0},{label:"Plan"}]})})]}),t.jsxs(ga,{children:["Manage your subscription, credits, and AI configuration."," ",t.jsx(Dn,{to:`/workspaces/${e}/settings/billing`,style:{color:"inherit",textDecoration:"underline"},children:"Billing & invoices"})]})]}),A&&t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"0.625rem",padding:"0.75rem 1rem",borderRadius:"0.75rem",background:"#FEF3C7",border:"1px solid #F59E0B",fontSize:"0.875rem",fontWeight:650,color:"#92400E",lineHeight:1.45},children:[t.jsx(ei,{size:16,style:{flexShrink:0}}),"Your subscription has ended. Choose a plan below to resubscribe."]}),v?t.jsx(c5t,{subscription:v,usageLimits:x,creditsTotal:Ue,creditsUsed:We,creditsAvailable:ht,addonReserved:Qe,statusLower:S,canceled:A}):t.jsx(nt,{height:180,width:"100%",radius:16}),v?t.jsx(d5t,{subscription:v,isTrialing:I,canceled:A,scheduledCancel:E,hasPendingDowngrade:T,pendingDowngrade:B,needsCheckout:ge,checkoutDisabled:!o||!!De,onStartCheckout:()=>void Je(),canUncancel:R,uncancelSaving:Ae,onUncancel:()=>void Xe(),cancelDowngradeSaving:we,onCancelDowngrade:()=>void yt(),canCancel:M,canDowngrade:H,onDowngradeClick:()=>q(!0),onDowngradeToGrow:it,onCancelClick:()=>Q(!0),startNowDisabled:Re||!o,onStartNow:()=>ie(!0),currentPlanFamily:F,growPlans:U,configInterval:tt}):t.jsx(nt,{height:56,width:"100%",radius:12}),a&&!v?t.jsx(nt,{height:120,width:"100%",radius:12}):a?t.jsx(mie,{plans:w,subscription:v,orgId:o,isCore:Y,currentPlanFamily:F,billingLocked:P,onSaved:Ne,onIntervalChange:dt,onDirtyChange:Me,showToast:r,creditsAvailable:ht}):null]}),t.jsx(Hn,{isOpen:ce,onClose:()=>{Re||ie(!1)},title:"Start billing now",description:"End your free trial and start billing immediately.",size:"sm",footer:t.jsxs("div",{style:{display:"flex",gap:"0.75rem",justifyContent:"flex-end"},children:[t.jsx(he,{type:"button",variant:"outline",size:"sm",disabled:Re,onClick:()=>ie(!1),children:"Back"}),t.jsx(he,{type:"button",variant:"primary",size:"sm",disabled:Re||!o,onClick:async()=>{if(o){Be(!0);try{const pe=await ue(`/api/v1/organizations/${o}/billing/end_trial`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})}),be=await pe.json().catch(()=>({}));if(!pe.ok)throw new Error(be?.error||"Failed to start billing now");_(be?.billing?.subscription||null),r("Trial ended â billing is now active.",{tone:"success"}),i().catch(()=>{}),ie(!1)}catch(pe){r(pe instanceof Error?pe.message:"Failed to start billing now",{tone:"error"})}finally{Be(!1)}}},children:Re?"Startingâ¦":"Confirm"})]}),children:t.jsxs("div",{style:{fontSize:"0.875rem",lineHeight:1.5,color:z},children:["Your trial will end immediately and your ",t.jsx("b",{style:{color:O},children:pa(v?.plan?.name,"plan")})," subscription will begin billing at"," ",t.jsx("b",{style:{color:O},children:v?.price_cents!=null?`${(v.price_cents/100).toLocaleString("en-US",{style:"currency",currency:v.currency||"USD",minimumFractionDigits:0,maximumFractionDigits:2})}${v.billing_interval==="yearly"?"/yr":"/mo"}`:"the plan rate"}),"."]})}),t.jsxs(Hn,{isOpen:L,onClose:()=>{W||q(!1)},title:"Downgrade to Core",description:"Your current plan will remain active until the end of your billing period.",size:"sm",footer:t.jsxs("div",{style:{display:"flex",gap:"0.75rem",justifyContent:"flex-end"},children:[t.jsx(he,{type:"button",variant:"outline",size:"sm",disabled:W,onClick:()=>q(!1),children:"Keep current plan"}),t.jsx(he,{type:"button",variant:"danger",size:"sm",disabled:W||!o,onClick:async()=>{if(o){oe(!0);try{const pe=await ue(`/api/v1/organizations/${o}/billing/change_plan`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plan_code:"core",billing_interval:v?.billing_interval||"monthly"})}),be=await pe.json().catch(()=>({}));if(!pe.ok){if((be?.errors?.error_code||be?.error_code)==="plan_downgrade_over_limit"){const ze=be?.errors?.details||be?.details||[];throw new Error(ze.length>0?`Downgrade blocked: ${ze.join(", ")}`:"Downgrade blocked â your current usage exceeds Core plan limits.")}throw new Error(be?.error||"Failed to schedule downgrade")}_(be?.billing?.subscription||null),r("Downgrade to Core scheduled for end of billing period.",{tone:"success"}),i().catch(()=>{}),q(!1)}catch(pe){r(pe instanceof Error?pe.message:"Failed to schedule downgrade",{tone:"error"})}finally{oe(!1)}}},children:W?"Downgradingâ¦":"Confirm downgrade"})]}),children:[t.jsxs("div",{style:{fontSize:"0.875rem",lineHeight:1.5,color:z},children:["At the end of your current billing period (",t.jsx("b",{style:{color:O},children:t.jsx(rr,{value:v?.polar?.current_period_end,placeholder:"your next renewal date"})}),"), your workspace will move to the ",t.jsx("b",{style:{color:O},children:"Core"})," plan. You will lose access to:"]}),t.jsxs("ul",{style:{fontSize:"0.875rem",lineHeight:1.7,color:z,margin:"0.5rem 0 0",paddingLeft:"1.25rem"},children:[t.jsx("li",{children:"Extra LLM models and prompt packs"}),t.jsx("li",{children:"Higher credit allowances"}),t.jsx("li",{children:"Priority support and advanced features"})]})]}),t.jsxs(Hn,{isOpen:se,onClose:()=>{ee||de(!1)},title:`Downgrade to ${pa(le?.name,"Grow")}`,description:"Your current plan will remain active until the end of your billing period.",size:"sm",footer:t.jsxs("div",{style:{display:"flex",gap:"0.75rem",justifyContent:"flex-end"},children:[t.jsx(he,{type:"button",variant:"outline",size:"sm",disabled:ee,onClick:()=>de(!1),children:"Keep current plan"}),t.jsx(he,{type:"button",variant:"danger",size:"sm",disabled:ee||!o||!le,onClick:async()=>
22483{if(!(!o||!le)){ne(!0);try{const pe=await ue(`/api/v1/organizations/${o}/billing/change_plan`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plan_code:le.code,billing_interval:v?.billing_interval||"monthly"})}),be=await pe.json().catch(()=>({}));if(!pe.ok){if((be?.errors?.error_code||be?.error_code)==="plan_downgrade_over_limit"){const ze=be?.errors?.details||be?.details||[];throw new Error(ze.length>0?`Downgrade blocked: ${ze.join(", ")}`:"Downgrade blocked â your current usage exceeds the target plan limits.")}throw new Error(be?.error||"Failed to schedule downgrade")}_(be?.billing?.subscription||null),r(`Downgrade to ${pa(le.name)} scheduled for end of billing period.`,{tone:"success"}),i().catch(()=>{}),de(!1)}catch(pe){r(pe instanceof Error?pe.message:"Failed to schedule downgrade",{tone:"error"})}finally{ne(!1)}}},children:ee?"Downgradingâ¦":"Confirm downgrade"})]}),children:[t.jsxs("div",{style:{fontSize:"0.875rem",lineHeight:1.5,color:z},children:["At the end of your current billing period (",t.jsx("b",{style:{color:O},children:t.jsx(rr,{value:v?.polar?.current_period_end,placeholder:"your next renewal date"})}),"), your workspace will switch from ",t.jsx("b",{style:{color:O},children:pa(v?.plan?.name)})," to ",t.jsx("b",{style:{color:O},children:pa(le?.name,"Grow")}),"."]}),t.jsxs("ul",{style:{fontSize:"0.875rem",lineHeight:1.7,color:z,margin:"0.5rem 0 0",paddingLeft:"1.25rem"},children:[t.jsxs("li",{children:["Your monthly credit allowance will change to ",(le?.monthly_credits_allowance??0).toLocaleString()," credits"]}),t.jsx("li",{children:"Some included LLM models may become add-ons"}),t.jsxs("li",{children:["Billing will adjust to ",mf(r_(le,v?.billing_interval==="yearly"?"yearly":"monthly"),le?.currency),v?.billing_interval==="yearly"?"/yr":"/mo"]})]})]}),t.jsx(Hn,{isOpen:X,onClose:()=>{K||Q(!1)},title:"Cancel plan",description:I?"Your plan will remain active until the end of your trial.":"Your plan will remain active until the end of your current billing period.",size:"sm",footer:t.jsxs("div",{style:{display:"flex",gap:"0.75rem",justifyContent:"flex-end"},children:[t.jsx(he,{type:"button",variant:"outline",size:"sm",disabled:K,onClick:()=>Q(!1),children:"Keep plan"}),t.jsx(he,{type:"button",variant:"danger",size:"sm",disabled:K||!o,onClick:async()=>{if(o){G(!0);try{const pe=await ue(`/api/v1/organizations/${o}/billing/cancel`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({timing:"end_of_cycle"})}),be=await pe.json().catch(()=>({}));if(!pe.ok)throw new Error(be?.error||"Failed to cancel subscription");_(be?.billing?.subscription||null),r(I?"Cancellation scheduled for trial end.":"Cancellation scheduled for period end.",{tone:"success"}),i().catch(()=>{}),Q(!1)}catch(pe){r(pe instanceof Error?pe.message:"Failed to cancel subscription",{tone:"error"})}finally{G(!1)}}},children:K?"Cancelingâ¦":"Confirm cancellation"})]}),children:t.jsxs("div",{style:{fontSize:"0.875rem",lineHeight:1.5,color:z},children:["Your plan stays active until"," ",t.jsx("b",{style:{color:O},children:t.jsx(rr,{value:I&&v?.polar?.trial_end||v?.polar?.current_period_end,placeholder:I?"the end of your trial":"the end of your current period"})}),". After that, your subscription will be canceled and access will be removed."]})}),t.jsx(Hn,{isOpen:Se.showPrompt,onClose:Se.cancel,title:"Unsaved changes",description:"You have unsaved plan configuration changes. Are you sure you want to leave?",size:"sm",minHeight:"0",closeOnOverlayClick:!1,footer:t.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"0.5rem"},children:[t.jsx(he,{type:"button",size:"sm",variant:"outline",onClick:Se.cancel,children:"Stay"}),t.jsx(he,{type:"button",size:"sm",variant:"danger",onClick:Se.confirm,children:"Leave"})]}),children:t.jsx("div",{style:{fontSize:"0.85rem",fontWeight:600,color:z,lineHeight:1.5},children:"If you leave now, your changes to LLMs, prompt packs, or plan selection will be lost."})})]})}const y5t=p.div.withConfig({displayName:"WorkspaceBillingGate__Wrap",componentId:"sc-1igmyb1-0"})` 22484 min-height: calc(100vh - 120px); 22485 display: grid; 22486 place-items: center; 22487 padding: 1.25rem; 22488`,x5t=p.div.withConfig({displayName:"WorkspaceBillingGate__Card",componentId:"sc-1igmyb1-1"})` 22489 width: min(42rem, 100%); 22490 border: 1px solid ${V}; 22491 border-radius: 1rem; 22492 background: ${Z}; 22493 padding: 1.25rem; 22494 display: grid; 22495 gap: 0.75rem; 22496`,b5t=p.div.withConfig({displayName:"WorkspaceBillingGate__Title",componentId:"sc-1igmyb1-2"})` 22497 font-size: 1.05rem; 22498 font-weight: 950; 22499 color: ${O}; 22500`,v5t=p.div.withConfig({displayName:"WorkspaceBillingGate__Body",componentId:"sc-1igmyb1-3"})` 22501 font-size: 0.9rem; 22502 font-weight: 650; 22503 color: ${z}; 22504 line-height: 1.45; 22505`;function Pr({children:e}){const{workspaceId:n}=Gn(),i=vo(),r=zn(),{user:o}=yn(),s=Number(n),a=Number.isFinite(s),c=a&&o?.organizations?.find($=>
22505$.id===s)||null,u=!!c?.billing_exempt,m=!!c?.billing_active_for_spend,h=a&&!!c&&!u&&!m,g=String(c?.role||"").toLowerCase(),x=h&&g==="owner",y=a?`/workspaces/${s}/settings/billing`:"",w=a?`/workspaces/${s}/settings/plan`:"",j=y?i.pathname===y||i.pathname.startsWith(`${y}/`):!1,v=w?i.pathname===w||i.pathname.startsWith(`${w}/`):!1,_=j||v;return l.useEffect(()=>{h&&x&&(_||r(`${y}?billing_required=1`,{replace:!0}))},[y,x,r,_,h]),h?x?_?t.jsx(t.Fragment,{children:e}):null:t.jsx(y5t,{children:t.jsxs(x5t,{children:[t.jsx(b5t,{children:"Billing required"}),t.jsxs(v5t,{children:["This workspace is currently locked because billing hasnât been set up yet.",t.jsx("br",{}),"Ask your workspace owner to complete billing and unlock access."]}),t.jsxs("div",{style:{display:"flex",gap:10,flexWrap:"wrap"},children:[t.jsx(he,{type:"button",size:"sm",onClick:()=>r("/",{replace:!0}),children:"Go to home"}),t.jsx(he,{type:"button",size:"sm",variant:"outline",onClick:()=>window.location.reload(),children:"Refresh"})]})]})}):t.jsx(t.Fragment,{children:e})}const w5t=p.div.withConfig({displayName:"Invite__Muted",componentId:"sc-132ymy6-0"})` 22506 color: ${z}; 22507 font-size: 0.875rem; 22508`,j5t=p.div.withConfig({displayName:"Invite__Stack",componentId:"sc-132ymy6-1"})` 22509 display: flex; 22510 flex-direction: column; 22511 gap: 0.75rem; 22512`,_5t=p.div.withConfig({displayName:"Invite__Row",componentId:"sc-132ymy6-2"})` 22513 display: flex; 22514 align-items: center; 22515 gap: 0.5rem; 22516 color: ${O}; 22517`,C5t=p.div.withConfig({displayName:"Invite__RowText",componentId:"sc-132ymy6-3"})` 22518 font-size: 0.875rem; 22519 color: inherit; 22520`,S5t=p.div.withConfig({displayName:"Invite__SubtleLine",componentId:"sc-132ymy6-4"})` 22521 font-size: 0.875rem; 22522 color: ${z}; 22523`,iE=p.div.withConfig({displayName:"Invite__AlertRow",componentId:"sc-132ymy6-5"})` 22524 display: flex; 22525 align-items: center; 22526 gap: 0.5rem; 22527 color: ${oi}; 22528`,k5t=p.div.withConfig({displayName:"Invite__InfoCard",componentId:"sc-132ymy6-6"})` 22529 border: 1px solid ${V}; 22530 background: ${At}; 22531 border-radius: 0.875rem; 22532 padding: 0.875rem; 22533 color: ${O}; 22534 font-size: 0.875rem; 22535`,$5t=p.div.withConfig({displayName:"Invite__InfoTitle",componentId:"sc-132ymy6-7"})` 22536 font-weight: 800; 22537 margin-bottom: 0.375rem; 22538`,I5t=p.ul.withConfig({displayName:"Invite__InfoList",componentId:"sc-132ymy6-8"})` 22539 margin: 0; 22540 padding-left: 1.1rem; 22541 display: grid; 22542 gap: 0.35rem; 22543 color: ${z}; 22544 22545 li strong { 22546 color: ${O}; 22547 } 22548`,P5t=p.div.withConfig({displayName:"Invite__Actions",componentId:"sc-132ymy6-9"})` 22549 display: flex; 22550 gap: 0.75rem; 22551 justify-content: flex-end; 22552 flex-wrap: wrap; 22553`;function A5t(){const[e]=yr(),n=e.get("token")||"",i=zn(),{user:r,setUser:o,logout:s}=yn(),[a,c]=l.useState(!0),[u,m]=l.useState(null),[h,g]=l.useState(null),[x,y]=l.useState(!1),w=h?.invitation?.email||"",j=!!h?.invitee_has_account,_=(h?.invitable?.type||null)==="Project",$=_?"project":"workspace",k=_?"Project":"Workspace",P=h?.invitable?.name||k,S=l.useMemo(()=>{const T=Date.parse(h?.invitation?.expires_at||"");return Number.isFinite(T)?T<=Date.now():!1},[h?.invitation?.expires_at]),I=l.useMemo(()=>h?h.invitation.revoked_at?"revoked":h.invitation.accepted_at?"accepted":S?"expired":null:null,[h,S]),A=l.useMemo(()=>!r||!w?!1:r.email?.trim().toLowerCase()!==w.trim().toLowerCase(),[w,r]);l.useEffect(()=>{let T=!1;if(c(!0),m(null),g(null),!n){Cp(),c(!1),m("Missing invitation token.");return}return r||oM(n),ue(`/api/v1/invitations/${encodeURIComponent(n)}`,{method:"GET"}).then(async M=>{const R=await M.json().catch(()=>({}));if(!M.ok)throw Cp(),new Error(R?.error||"Invalid invitation");if(!T){const F=R;g(F);const Y=!!F?.invitation?.revoked_at,H=!!F?.invitation?.accepted_at,U=Date.parse(F?.invitation?.expires_at||""),X=Number.isFinite(U)?U<=Date.now():!1;(Y||H||X)&&Cp()}}).catch(M=>{T||m(M?.message||"Failed to load invitation")}).finally(()=>{T||c(!1)}),()=>{T=!0}},[n]);const E=l.useMemo(()=>!(!r||!h||I||A),[h,A,I,r]),B=async()=>{if(n&&!x){y(!0),m(null);try{const T=await ue(`/api/v1/invitations/${encodeURIComponent(n)}/accept`,{method:"POST"}),M=await T.json().catch(()=>({}));if(!T.ok)throw new Error(M?.error||"Failed to accept invitation");M?.user&&o(M.user),Cp(),M?.invitable_type==="Organization"&&M?.invitable_id?i(`/workspaces
22553/${M.invitable_id}`,{replace:!0}):M?.invitable_type==="Project"&&M?.invitable_id&&M?.organization_id?i(`/workspaces/${M.organization_id}/projects/${M.invitable_id}`,{replace:!0}):i("/",{replace:!0})}catch(T){m(T?.message||"Failed to accept invitation")}finally{y(!1)}}};return t.jsxs(Bm,{children:[t.jsx(xa,{}),t.jsx(Fm,{children:t.jsx(Wm,{children:t.jsxs(Um,{children:[t.jsxs(Hm,{children:[t.jsxs(kf,{children:[k," invitation"]}),t.jsxs($f,{children:["Accept an invitation to join a ",$,"."]})]}),u?t.jsx(Mm,{children:u}):null,a?t.jsx(w5t,{children:"Loading invitationâ¦"}):h?t.jsxs(j5t,{children:[t.jsxs(_5t,{children:[t.jsx(bu,{size:18}),t.jsxs(C5t,{children:["Invited as ",t.jsx("b",{children:h.invitation.role})," to ",t.jsx("b",{children:P})]})]}),t.jsxs(S5t,{children:["For: ",t.jsx("b",{children:h.invitation.email})]}),I==="revoked"?t.jsxs(iE,{children:[t.jsx(y5,{size:18}),"This invitation was revoked."]}):I==="expired"?t.jsxs(iE,{children:[t.jsx(y5,{size:18}),"This invitation has expired."]}):I==="accepted"?t.jsxs(iE,{children:[t.jsx(y5,{size:18}),"This invitation has already been accepted."]}):null,t.jsxs(k5t,{children:[t.jsx($5t,{children:"How invitations work"}),t.jsxs(I5t,{children:[t.jsxs("li",{children:["Invitations expire after ",t.jsx("strong",{children:"7 days"}),"."]}),t.jsxs("li",{children:["If an invite expires or is revoked, ask a ",$," admin to send a new invitation."]}),t.jsx("li",{children:_?"Project editors (and workspace admins) can resend or revoke invitations from the project settings.":"Workspace owners can resend or revoke invitations from the workspace settings."})]})]}),t.jsx(P5t,{children:r?t.jsx(he,{onClick:B,disabled:!E||x,leftIcon:t.jsx(co,{size:18}),children:x?"Acceptingâ¦":"Accept invite"}):t.jsx(t.Fragment,{children:j?t.jsx(he,{variant:"outline",leftIcon:t.jsx(Lne,{size:18}),onClick:()=>i(`/signin?invite_token=${encodeURIComponent(n)}`),children:"Sign in"}):t.jsx(he,{disabled:xf,onClick:()=>{xf||i(`/signup?invite_token=${encodeURIComponent(n)}`)},children:xf?"Sign up temporarily disabled":"Create account"})})}),I?t.jsxs("div",{style:{fontSize:"0.8125rem",color:z},children:["This invite is no longer available. Ask a ",$," admin to resend it or send you a new invite."]}):r&&A?t.jsxs("div",{style:{fontSize:"0.8125rem",color:z},children:["You must be signed in as ",t.jsx("b",{children:w})," to accept this invite."," ",t.jsx("button",{type:"button",onClick:async()=>{try{await s()}finally{i(`/signin?invite_token=${encodeURIComponent(n)}`,{replace:!0})}},style:{appearance:"none",border:0,background:"transparent",padding:0,margin:0,color:"inherit",font:"inherit",fontWeight:900,textDecoration:"underline",cursor:"pointer"},children:"Sign in with another account"}),"."]}):null]}):null]})})})]})}const dD=Tn` 22554 from { opacity: 0; transform: translateY(6px); } 22555 to { opacity: 1; transform: translateY(0); } 22556`,N5t=Tn` 22557 from { transform: rotate(0deg); } 22558 to { transform: rotate(360deg); } 22559`,z5t=p.div.withConfig({displayName:"AdminHome__Wrap",componentId:"sc-16ptkxy-0"})` 22560 padding: 1.25rem 1.25rem 2rem; 22561 min-height: 100%; 22562 background: ${At}; 22563 position: relative; 22564 overflow: hidden; 22565 22566 /* Dashed/fade grid (match onboarding, but more subtle) */ 22567 &::before { 22568 content: ""; 22569 position: absolute; 22570 inset: 0; 22571 z-index: 0; 22572 opacity: 0.55; 22573 background-image: 22574 linear-gradient(to right, ${Cf} 1px, ${hn} 1px), 22575 linear-gradient(to bottom, ${Cf} 1px, ${hn} 1px); 22576 background-size: 20px 20px; 22577 background-position: 0 0, 0 0; 22578 mask-image: 22579 repeating-linear-gradient( 22580 to right, 22581 ${mn} 0px, 22582 ${mn} 3px, 22583 ${hn} 3px, 22584 ${hn} 8px 22585 ), 22586 repeating-linear-gradient( 22587 to bottom, 22588 ${mn} 0px, 22589 ${mn} 3px, 22590 ${hn} 3px, 22591 ${hn} 8px 22592 ), 22593 linear-gradient(to bottom, ${mn} 0%, ${mn} 40%, ${hn} 78%); 22594 -webkit-mask-image: 22595 repeating-linear-gradient( 22596 to right, 22597 ${mn} 0px, 22598 ${mn} 3px, 22599 ${hn} 3px, 22600 ${hn} 8px 22601 ), 22602 repeating-linear-gradient( 22603 to bottom, 22604 ${mn} 0px, 22605 ${mn} 3px, 22606 ${hn} 3px, 22607 ${hn} 8px 22608 ), 22609 linear-gradient(to bottom, ${mn} 0%, ${mn} 40%, ${hn} 78%); 22610 mask-composite: intersect; 22611 -webkit-mask-composite: source-in; 22612 pointer-events: none; 22613 } 22614`,T5t=p.div.withConfig({displayName:"AdminHome__Max",componentId:"sc-16ptkxy-1"})` 22615 max-width: 56rem; 22616 margin: 0 auto; 22617 position: relative; 22618 z-index: 1; 22619`,E5t=p.div.withConfig({displayName:"AdminHome__Hero",componentId:"sc-16ptkxy-2"})` 22620 background: ${Z}; 22621 border: 1px solid ${Rt}; 22622 box-shadow: 0 16px 40px rgba(17, 24, 39, 0.08); 22623 border-radius: 1rem; 22624 padding: 1.25rem 1.25rem; 22625 animation: ${dD} 180ms ease both;
22626`,M5t=p.div.withConfig({displayName:"AdminHome__HeroTop",componentId:"sc-16ptkxy-3"})` 22627 display: flex; 22628 align-items: flex-start; 22629 justify-content: space-between; 22630 gap: 1rem; 22631`,R5t=p.div.withConfig({displayName:"AdminHome__TitleRow",componentId:"sc-16ptkxy-4"})` 22632 display: inline-flex; 22633 align-items: center; 22634 gap: 0.625rem; 22635 color: ${O}; 22636 font-weight: 800; 22637 font-size: 1.125rem; 22638`,O5t=p.div.withConfig({displayName:"AdminHome__Sub",componentId:"sc-16ptkxy-5"})` 22639 margin-top: 0.5rem; 22640 color: ${z}; 22641 font-size: 0.875rem; 22642 line-height: 1.45; 22643`,D5t=p.div.withConfig({displayName:"AdminHome__Stats",componentId:"sc-16ptkxy-6"})` 22644 margin-top: 1rem; 22645 display: grid; 22646 grid-template-columns: repeat(3, minmax(0, 1fr)); 22647 gap: 0.75rem; 22648 22649 @media (max-width: 860px) { 22650 grid-template-columns: 1fr; 22651 } 22652`,rE=p.div.withConfig({displayName:"AdminHome__StatCard",componentId:"sc-16ptkxy-7"})` 22653 border: 1px solid ${V}; 22654 border-radius: 0.875rem; 22655 background: ${Z}; 22656 padding: 0.75rem 0.875rem; 22657 display: flex; 22658 align-items: center; 22659 gap: 0.75rem; 22660`,oE=p.div.withConfig({displayName:"AdminHome__StatIcon",componentId:"sc-16ptkxy-8"})` 22661 width: 38px; 22662 height: 38px; 22663 border-radius: 0.875rem; 22664 display: inline-flex; 22665 align-items: center; 22666 justify-content: center; 22667 background: rgba(17, 24, 39, 0.04); 22668 color: ${O}; 22669 flex: 0 0 auto; 22670`,sE=p.div.withConfig({displayName:"AdminHome__StatText",componentId:"sc-16ptkxy-9"})` 22671 min-width: 0; 22672 display: flex; 22673 flex-direction: column; 22674 gap: 0.125rem; 22675`,aE=p.div.withConfig({displayName:"AdminHome__StatLabel",componentId:"sc-16ptkxy-10"})` 22676 color: ${z}; 22677 font-size: 0.75rem; 22678 font-weight: 700; 22679 letter-spacing: 0.04em; 22680 text-transform: uppercase; 22681`,lE=p.div.withConfig({displayName:"AdminHome__StatValue",componentId:"sc-16ptkxy-11"})` 22682 color: ${O}; 22683 font-size: 0.95rem; 22684 font-weight: 750; 22685 overflow: hidden; 22686 text-overflow: ellipsis; 22687 white-space: nowrap; 22688`,L5t=[{key:"admin-ui",label:"Admin",description:"Manage users, orgs & partners",icon:Ef,to:"/admin/resources?resource=users"},{key:"admin-health",label:"Health & Sources",description:"Source status & data health",icon:Mne,to:"/admin/health",adminOnly:!0},{key:"admin-infra",label:"Infrastructure",description:"ECS, RDS, Redis & deploys",icon:Lb,to:"/admin/infrastructure",adminOnly:!0},{key:"admin-logs",label:"Logs",description:"CloudWatch log viewer",icon:Ss,to:"/admin/logs",adminOnly:!0},{key:"admin-runs",label:"Run Monitor",description:"Bucket runs & prompt retries",icon:eh,to:"/admin/runs"},{key:"admin-costs",label:"Costs",description:"API spend & cost tracking",icon:K8,to:"/admin/costs"},{key:"admin-sidekiq",label:"Sidekiq",description:"Background job dashboard",icon:gl,portalEndpoint:"/api/v1/admin/sidekiq_portal_token",adminOnly:!0},{key:"admin-performance",label:"Performance",description:"API request metrics",icon:Eu,portalEndpoint:"/api/v1/admin/performance_portal_token",adminOnly:!0}],B5t=p.div.withConfig({displayName:"AdminHome__LinksSection",componentId:"sc-16ptkxy-12"})` 22689 margin-top: 1rem; 22690 animation: ${dD} 220ms ease both; 22691 animation-delay: 60ms; 22692`,F5t=p.div.withConfig({displayName:"AdminHome__LinksTitle",componentId:"sc-16ptkxy-13"})` 22693 font-size: 0.8rem; 22694 font-weight: 800; 22695 color: ${z}; 22696 text-transform: uppercase; 22697 letter-spacing: 0.05em; 22698 margin-bottom: 0.6rem; 22699`,W5t=p.div.withConfig({displayName:"AdminHome__LinksGrid",componentId:"sc-16ptkxy-14"})` 22700 display: grid; 22701 grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); 22702 gap: 0.6rem; 22703`,U5t=p.button.withConfig({displayName:"AdminHome__LinkCard",componentId:"sc-16ptkxy-15"})` 22704 display: flex; 22705 align-items: center; 22706 gap: 0.65rem; 22707 padding: 0.65rem 0.75rem; 22708 background: ${Z}; 22709 border: 1px solid ${V}; 22710 border-radius: 0.75rem; 22711 cursor: pointer; 22712 text-align: left; 22713 transition: all 120ms ease; 22714 color: ${O}; 22715 22716 &:hover { 22717 border-color: ${Rt}; 22718 background: ${$e}; 22719 } 22720`,H5t=p.div.withConfig({displayName:"AdminHome__LinkIcon",componentId:"sc-16ptkxy-16"})` 22721 width: 32px; 22722 height: 32px; 22723 border-radius: 0.625rem; 22724 display: inline-flex; 22725 align-items: center; 22726 justify-content: center; 22727 background: ${$e}; 22728 color: ${ot}; 22729 flex: 0 0 auto; 22730`,q5t=p.div.withConfig({displayName:"AdminHome__LinkText",componentId:"sc-16ptkxy-17"})` 22731 min-width: 0; 22732 flex: 1; 22733`,G5t=p.div.withConfig({displayName:"AdminHome__LinkLabel",componentId:"sc-16ptkxy-18"})` 22734 font-size: 0.8rem; 22735 font-weight: 800; 22736 color: ${O}; 22737 display: flex; 22738 align-items: center; 22739 gap: 0.3rem; 22740`,V5t=p.div.withConfig({displayName:"AdminHome__LinkDesc",componentId:"sc-16ptkxy-19"})` 22741 font-size: 0.68rem; 22742 font-weight: 600; 22743 color: ${Pe}; 22744 margin-top: 0.05rem; 22745`,K5t=p.div.withConfig({displayName:"AdminHome__ProviderSection",componentId:"sc-16ptkxy-20"})` 22746 margin-top: 1rem; 22747 animation: ${dD} 240ms ease both; 22748 animation-delay: 100ms; 22749`,ZJ=p.div.withConfig({displayName:"AdminHome__ProviderCard",componentId:"sc-16ptkxy-21"})` 22750 background: ${Z}; 22751 border: 1px solid ${V}; 22752 border-radius: 0.75rem; 22753 padding: 0.85rem 1rem; 22754`,JJ=p.div.withConfig({displayName:"AdminHome__ProviderHeader",componentId:"sc-16ptkxy-22"})` 22755 display: flex; 22756 align-items: center; 22757 gap: 0.5rem; 22758 margin-bottom: 0.75rem; 22759 color: ${O}; 22760`,eee=p.div.withConfig({displayName:"AdminHome__ProviderTitle",componentId:"sc-16ptkxy-23"})` 22761 font-size: 0.8rem; 22762 font-weight: 800; 22763 color: ${z}; 22764 text-transform: uppercase; 22765 letter-spacing: 0.05em; 22766`,tee=p.div.withConfig({displayName:"AdminHome__ProviderRow",componentId:"sc-16ptkxy-24"})` 22767 display: flex; 22768 align-items: center; 22769 gap: 1rem; 22770 flex-wrap: wrap; 22771`,_j=p.span.withConfig({displayName:"AdminHome__ProviderLabel",componentId:"sc-16ptkxy-25"})` 22772 font-size: 0.8rem; 22773 font-weight: 700; 22774 color: ${z}; 22775`,Y5t=p.button.withConfig({displayName:"AdminHome__FallbackToggle",componentId:"sc-16ptkxy-26"})` 22776 display: inline-flex; 22777 align-items: center; 22778 gap: 0.35rem; 22779 font-size: 0.8rem; 22780 font-weight: 700; 22781 color: ${e=>e.$on?ot:Pe}; 22782 background: none; 22783 border: none; 22784 cursor: pointer; 22785 padding: 0; 22786 transition: color 120ms ease; 22787 22788 &:hover { 22789 color: ${ot}; 22790 } 22791`,X5t=p.button.withConfig({displayName:"AdminHome__ModelFallbackToggle",componentId:"sc-16ptkxy-27"})` 22792 display: inline-flex; 22793 align-items: center; 22794 gap: 0.25rem; 22795 font-size: 0.68rem; 22796 font-weight: 700; 22797 color: ${e=>e.$isDefault?Pe:e.$on?ot:Pe}; 22798 background: none; 22799 border: 1px solid ${e=>e.$isDefault?V:e.$on?ot:Rt}; 22800 border-radius: 0.35rem; 22801 cursor: pointer; 22802 padding: 0.15rem 0.4rem; 22803 transition: all 120ms ease; 22804 white-space: nowrap; 22805 flex-shrink: 0; 22806 22807 &:hover { 22808 border-color: ${ot}; 22809 color: ${ot}; 22810 } 22811`,Q5t=p.div.withConfig({displayName:"AdminHome__ModelOverridesGrid",componentId:"sc-16ptkxy-28"})` 22812 margin-top: 0.75rem; 22813 display: grid; 22814 grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); 22815 gap: 0.5rem 1.25rem; 22816`,Z5t=p.div.withConfig({displayName:"AdminHome__ModelOverrideItem",componentId:"sc-16ptkxy-29"})` 22817 display: grid; 22818 grid-template-columns: 1.1rem 7.5rem 6.5rem max-content; 22819 align-items: center; 22820 gap: 0.5rem; 22821 min-height: 2rem; 22822`,nee=p.span.withConfig({displayName:"AdminHome__ModelIconWrap",componentId:"sc-16ptkxy-30"})` 22823 width: 1.1rem; 22824 height: 1.1rem; 22825 display: inline-flex; 22826 align-items: center; 22827 justify-content: center; 22828 flex-shrink: 0; 22829 color: ${O}; 22830 22831 svg { 22832 width: 100%; 22833 height: 100%; 22834 } 22835`,J5t=p.span.withConfig({displayName:"AdminHome__ModelName",componentId:"sc-16ptkxy-31"})` 22836 font-size: 0.78rem; 22837 font-weight: 700; 22838 color: ${z}; 22839 overflow: hidden; 22840 text-overflow: ellipsis; 22841 white-space: nowrap; 22842`,eIt=p(Tr).withConfig({displayName:"AdminHome__Spinner",componentId:"sc-16ptkxy-32"})` 22843 animation: ${N5t} 1s linear infinite; 22844`,tIt=p.span.withConfig({displayName:"AdminHome__SavedBadge",componentId:"sc-16ptkxy-33"})` 22845 display: inline-flex; 22846 align-items: center; 22847 gap: 0.25rem; 22848 font-size: 0.72rem; 22849 font-weight: 700; 22850 color: ${ot}; 22851 opacity: 0; 22852 transition: opacity 200ms ease; 22853 22854 &.visible { 22855 opacity: 1; 22856 } 22857`;function nIt(){const e=zn(),{user:n}=yn(),[i,r]=l.useState(()=>new Date);l.useEffect(()=>{ue("/api/v1/admin/ping",{method:"GET"}).then(S=>{S.ok||e("/forbidden",{replace:!0})}).catch(()=>{e("/forbidden",{replace:!0})})},[e]),l.useEffect(()=>{const S=window.setInterval(()=>r(new Date),1e3);return()=>window.clearInterval(S)},[]);const o=l.useMemo(()=>n?.full_name?.trim()||n?.email?.trim()||"Admin",[n?.email,n?.full_name]),s=l.useMemo(()=>i.toLocaleDateString(void 0,{weekday:"long",year:"numeric",month:"long",day:"numeric"}),[i]),a=l.useMemo(()=>i.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit"}),[i]),c=l.useMemo(()=>Intl.DateTimeFormat().resolvedOptions().timeZone||"Local time",[]),m=String(n?.admin_role||"").toLowerCase()==="admin",[h,g]=l.useState(null),[x,y]=l.useState(!1),[w,j]=l.useState(!1),v=l.useCallback(async()=>{try{const S=await ue("/api/v1/admin/provider_settings");if(S.ok){const I=await S.json();g(I)}}catch{}},[]);l.useEffect(()=>{m&&v()},[m,v]);const _=l.useCallback(async S=>{y(!0),j(!1);try{const I=await ue("/api/v1/admin/provider_settings",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(S)});if(I.ok){const A=await I.json();g(A),j(!0),setTimeout(()=>j(!1),2e3)}}catch{}finally{y(!1)}},[]),$=l.useMemo(()=>L5t.filter(S=>!S.adminOnly||m),[m]),k=async(S,I)=>{try{const A=await ue(S,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})}),E=await A.json().catch(()=>({}));if(!A.ok||!E?.portal_token)throw new Error(E?.error||"Failed to open");const B=`${Td()}${I}?portal_token=${encodeURIComponent(E.portal_token)}`;window.open(B,"_blank","noopener,noreferrer")}catch(A){console.error(A)}},P=S=>{if(S.portalEndpoint){const I=S.portalEndpoint.includes("sidekiq")?"/api/v1/admin/sidekiq":"/api/v1/admin/performance";k(S.portalEndpoint,I)}else S.to&&e(S.to)};return t.jsx(z5t,{children:t.jsxs(T5t,{children:[t.jsxs(E5t,{children:[t.jsx(M5t,{children:t.jsxs("div",{style:{minWidth:0},children:[t.jsxs(R5t,{children:[t.jsx(Yl,{size:18}),t.jsxs("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:["Welcome to the Admin Dashboard, ",o]})]}
22857),t.jsx(O5t,{children:"Quick access to internal tools and operational links."})]})}),t.jsxs(D5t,{children:[t.jsxs(rE,{children:[t.jsx(oE,{children:t.jsx(a1,{size:18})}),t.jsxs(sE,{children:[t.jsx(aE,{children:"Today"}),t.jsx(lE,{title:s,children:s})]})]}),t.jsxs(rE,{children:[t.jsx(oE,{children:t.jsx(qc,{size:18})}),t.jsxs(sE,{children:[t.jsx(aE,{children:"Time"}),t.jsx(lE,{title:a,children:a})]})]}),t.jsxs(rE,{children:[t.jsx(oE,{children:t.jsx(gl,{size:18})}),t.jsxs(sE,{children:[t.jsx(aE,{children:"Timezone"}),t.jsx(lE,{title:c,children:c})]})]})]})]}),t.jsxs(B5t,{children:[t.jsx(F5t,{children:"Quick access"}),t.jsx(W5t,{children:$.map(S=>t.jsxs(U5t,{type:"button",onClick:()=>P(S),children:[t.jsx(H5t,{children:t.jsx(S.icon,{size:16})}),t.jsxs(q5t,{children:[t.jsxs(G5t,{children:[S.label,S.portalEndpoint&&t.jsx(G8,{size:11})]}),t.jsx(V5t,{children:S.description})]})]},S.key))})]}),m&&h&&t.jsxs(K5t,{children:[t.jsxs(ZJ,{children:[t.jsxs(JJ,{children:[t.jsx(Ks,{size:14}),t.jsx(eee,{children:"Provider Settings"}),x&&t.jsx(eIt,{size:13}),t.jsxs(tIt,{className:w?"visible":"",children:[t.jsx(Zn,{size:11})," Saved"]})]}),t.jsxs(tee,{children:[t.jsx(_j,{children:"Active backend"}),t.jsx(ly,{size:"sm",variant:"outline",value:h.active_backend,onChange:S=>_({active_backend:S}),disabled:x,options:h.available_backends.map(S=>({value:S,label:S}))}),t.jsx(_j,{style:{marginLeft:"0.5rem"},children:"Fallback"}),t.jsxs(Y5t,{$on:h.fallback_enabled,type:"button",onClick:()=>_({fallback_enabled:!h.fallback_enabled}),disabled:x,children:[h.fallback_enabled?t.jsx(S9,{size:18}):t.jsx(C9,{size:18}),h.fallback_enabled?"On":"Off"]}),h.fallback_enabled&&t.jsxs(t.Fragment,{children:[t.jsx(_j,{style:{marginLeft:"0.5rem"},children:"Chain"}),t.jsx("span",{style:{fontSize:"0.78rem",fontWeight:700,color:"var(--gray-900, #111827)"},children:h.fallback_chain.join(" â ")})]})]}),h.model_keys&&h.model_keys.length>0&&t.jsxs(t.Fragment,{children:[t.jsx(_j,{style:{display:"block",marginTop:"0.75rem",marginBottom:"0.25rem"},children:"Per-model overrides"}),t.jsx(Q5t,{children:h.model_keys.map(S=>{const I=If.find(M=>M.key===S),A=I?.Icon,E=I?.label||S.replace(/_/g," "),B=S in h.model_fallback_overrides,T=B?h.model_fallback_overrides[S]:h.fallback_enabled;return t.jsxs(Z5t,{children:[A?t.jsx(nee,{children:t.jsx(A,{})}):t.jsx(nee,{}),t.jsx(J5t,{children:E}),t.jsx(ly,{size:"sm",variant:"outline",value:h.model_overrides[S]||"",onChange:M=>_({model_overrides:{[S]:M}}),disabled:x,options:[{value:"",label:"default"},...h.available_backends.map(M=>({value:M,label:M}))]}),t.jsxs(X5t,{$on:T,$isDefault:!B,type:"button",title:B?`Fallback ${T?"on":"off"} (per-model) · right-click to reset to global`:`Fallback ${T?"on":"off"} (using global) · click to override`,disabled:x,onClick:()=>{_({model_fallback_overrides:{[S]:!T}})},onContextMenu:M=>{M.preventDefault(),B&&_({model_fallback_overrides:{[S]:null}})},children:[T?t.jsx(S9,{size:13}):t.jsx(C9,{size:13}),"FB"]})]},S)})})]})]}),h.site_audit&&t.jsxs(ZJ,{style:{marginTop:"0.75rem"},children:[t.jsxs(JJ,{children:[t.jsx(To,{size:14}),t.jsx(eee,{children:"Site Audit â Page Enumeration"})]}),t.jsxs(tee,{children:[t.jsx(_j,{children:"Enumeration provider"}),t.jsx(ly,{size:"sm",variant:"outline",value:h.site_audit.enumeration_provider,onChange:S=>_({site_audit_enumeration_provider:S}),disabled:x,options:h.site_audit.enumeration_providers.map(S=>({value:S,label:S==="internal"?"Internal crawler":S==="dataforseo"?"DataForSEO":S}))})]})]})]})]})})}const Uue=Tn` 22858 from { opacity: 0; transform: translateY(6px); } 22859 to { opacity: 1; transform: translateY(0); } 22860`,iIt=p.div.withConfig({displayName:"AdminHealthSources__Wrap",componentId:"sc-1boxwkr-0"})` 22861 padding: 1.25rem 1.25rem 2rem; 22862 min-height: 100%; 22863 background: ${At}; 22864`,rIt=p.div.withConfig({displayName:"AdminHealthSources__Max",componentId:"sc-1boxwkr-1"})` 22865 max-width: 56rem; 22866 margin: 0 auto; 22867`,oIt=p.div.withConfig({displayName:"AdminHealthSources__Hero",componentId:"sc-1boxwkr-2"})` 22868 background: ${Z}; 22869 border: 1px solid ${Rt}; 22870 box-shadow: 0 16px 40px rgba(17, 24, 39, 0.08); 22871 border-radius: 1rem; 22872 padding: 1.25rem 1.25rem; 22873 animation: ${Uue} 180ms ease both; 22874`,sIt=p.div.withConfig({displayName:"AdminHealthSources__TitleRow",componentId:"sc-1boxwkr-3"})` 22875 display: inline-flex; 22876 align-items: center; 22877 gap: 0.625rem; 22878 color: ${O}; 22879 font-weight: 800; 22880 font-size: 1.125rem; 22881`,aIt=p.div.withConfig({displayName:"AdminHealthSources__Sub",componentId:"sc-1boxwkr-4"})` 22882 margin-top: 0.5rem; 22883 color: ${z}; 22884 font-size: 0.875rem; 22885 line-height: 1.45; 22886`,lIt=p.div.withConfig({displayName:"AdminHealthSources__Panel",componentId:"sc-1boxwkr-5"})` 22887 margin-top: 1rem; 22888 background: ${Z}; 22889 border: 1px solid ${Rt}; 22890 box-shadow: 0 10px 24px rgba(17, 24, 39, 0.06); 22891 border-radius: 1rem; 22892 padding: 1rem 1rem; 22893 animation: ${Uue} 180ms ease both; 22894`,cIt=p.div.withConfig({displayName:"AdminHealthSources__PanelTop",componentId:"sc-1boxwkr-6"})` 22895 display: flex; 22896 align-items: flex-start; 22897 justify-content: space-between; 22898 gap: 0.75rem; 22899`,dIt=p.div.withConfig({displayName:"AdminHealthSources__PanelTitle",componentId:"sc-1boxwkr-7"})` 22900 color: ${O}; 22901 font-weight: 800; 22902 font-size: 0.95rem; 22903 display: inline-flex; 22904 align-items: center; 22905 gap: 0.5rem; 22906`,uIt=p.div.withConfig({displayName:"AdminHealthSources__PanelSub",componentId:"sc-1boxwkr-8"})` 22907 margin-top: 0.35rem; 22908 color: ${z}; 22909 font-size: 0.875rem; 22910 line-height: 1.45; 22911`,pIt=p.div.withConfig({displayName:"AdminHealthSources__Results",componentId:"sc-1boxwkr-9"})` 22912 margin-top: 0.85rem; 22913 border: 1px solid ${V}; 22914 border-radius: 0.875rem; 22915 overflow: hidden; 22916`,mIt=p.div.withConfig({displayName:"AdminHealthSources__ResultRow",componentId:"sc-1boxwkr-10"})` 22917 display: grid; 22918 grid-template-columns: 10rem 6.25rem 1fr 5.5rem; 22919 gap: 0.75rem; 22920 align-items: center; 22921 padding: 0.65rem 0.75rem; 22922 background: ${Z}; 22923 22924 & + & { 22925 border-top: 1px solid ${V}; 22926 } 22927 22928 @media (max-width: 860px) { 22929 grid-template-columns: 1fr;
22930 align-items: flex-start; 22931 gap: 0.35rem; 22932 } 22933`,hIt=p.div.withConfig({displayName:"AdminHealthSources__ResultLabel",componentId:"sc-1boxwkr-11"})` 22934 color: ${O}; 22935 font-weight: 750; 22936 font-size: 0.875rem; 22937`,fIt=p.div.withConfig({displayName:"AdminHealthSources__ResultMsg",componentId:"sc-1boxwkr-12"})` 22938 color: ${z}; 22939 font-size: 0.875rem; 22940 overflow: hidden; 22941 text-overflow: ellipsis; 22942 white-space: nowrap; 22943 22944 @media (max-width: 860px) { 22945 white-space: normal; 22946 } 22947`,gIt=p.div.withConfig({displayName:"AdminHealthSources__ResultMeta",componentId:"sc-1boxwkr-13"})` 22948 color: ${z}; 22949 font-size: 0.75rem; 22950 text-align: right; 22951 22952 @media (max-width: 860px) { 22953 text-align: left; 22954 } 22955`,yIt=p.div.withConfig({displayName:"AdminHealthSources__Pill",componentId:"sc-1boxwkr-14"})` 22956 display: inline-flex; 22957 align-items: center; 22958 justify-content: center; 22959 width: fit-content; 22960 padding: 0.25rem 0.5rem; 22961 border-radius: 999px; 22962 font-weight: 750; 22963 font-size: 0.75rem; 22964 border: 1px solid ${V}; 22965 color: ${O}; 22966 22967 ${e=>e.$tone==="ok"?` 22968 background: ${si}; 22969 border-color: ${Mo}; 22970 color: ${Vt}; 22971 `:e.$tone==="error"?` 22972 background: ${kn}; 22973 border-color: ${Er}; 22974 color: ${oi}; 22975 `:` 22976 background: ${At}; 22977 border-color: ${V}; 22978 color: ${z}; 22979 `} 22980`;function xIt(){const e=zn(),[n,i]=l.useState(!1),[r,o]=l.useState(null),[s,a]=l.useState(null);l.useEffect(()=>{ue("/api/v1/admin/ping",{method:"GET"}).then(u=>{u.ok||e("/forbidden",{replace:!0})}).catch(()=>e("/forbidden",{replace:!0}))},[e]);const c=l.useMemo(()=>{const u=s?.services||{};return[{key:"polar",label:"Polar"},{key:"brightdata",label:"BrightData"},{key:"cloro",label:"Cloro"},{key:"dataforseo",label:"DataForSEO"},{key:"loops",label:"Loops"},{key:"logo_dev",label:"Logo.dev"},{key:"openrouter",label:"OpenRouter"},{key:"aws",label:"AWS"},{key:"gcp",label:"GCP"}].map(({key:h,label:g})=>{const x=u[h]||null,y=String(x?.status||"skipped"),w=String(x?.message||""),j=typeof x?.latency_ms=="number"?x.latency_ms:null,v=typeof x?.http_status=="number"?x.http_status:null;return{key:h,label:g,status:y,message:w,latencyMs:j,httpStatus:v}})},[s]);return t.jsx(iIt,{children:t.jsxs(rIt,{children:[t.jsxs(oIt,{children:[t.jsxs(sIt,{children:[t.jsx(Yl,{size:18}),t.jsx("span",{children:"Health & sources"})]}),t.jsx(aIt,{children:"Run connectivity checks for key external providers."})]}),t.jsxs(lIt,{children:[t.jsxs(cIt,{children:[t.jsxs("div",{style:{minWidth:0},children:[t.jsxs(dIt,{children:[t.jsx(gl,{size:16}),"Data sources healthcheck"]}),t.jsx(uIt,{children:"Click âRun checksâ to test key external providers used by the platform."})]}),t.jsx(he,{size:"sm",variant:"outline",disabled:n,leftIcon:t.jsx(No,{size:16}),onClick:async()=>{if(!n){i(!0),o(null);try{const u=await ue("/api/v1/admin/data_sources_health",{method:"GET"}),m=await u.json().catch(()=>null);if(!u.ok)throw new Error(m?.error||`Request failed (${u.status})`);a(m)}catch(u){a(null),o(u?.message||"Healthcheck failed")}finally{i(!1)}}},children:"Run checks"})]}),r?t.jsx("div",{style:{marginTop:"0.75rem",color:oi,fontWeight:650,fontSize:"0.875rem"},children:r}):null,s?t.jsxs("div",{style:{marginTop:"0.75rem",color:z,fontSize:"0.75rem"},children:["Overall:"," ",t.jsx("span",{style:{color:s?.ok?Vt:oi,fontWeight:800},children:s?.ok?"OK":"Issues detected"})," · ","Checked: ",t.jsx("span",{style:{color:O,fontWeight:700},children:String(s?.checked_at||"")})," · ","Duration: ",t.jsxs("span",{style:{color:O,fontWeight:700},children:[String(s?.duration_ms??""),"ms"]})]}):t.jsx("div",{style:{marginTop:"0.75rem",color:z,fontSize:"0.75rem"},children:"Not run yet."}),t.jsx(pIt,{children:c.map(u=>t.jsxs(mIt,{children:[t.jsx(hIt,{children:u.label}),t.jsx(yIt,{$tone:u.status,children:u.status}),t.jsx(fIt,{title:u.message,children:u.message||"â"}),t.jsxs(gIt,{children:[u.httpStatus?`HTTP ${u.httpStatus}`:" ",u.latencyMs!=null?` · ${u.latencyMs}ms`:""]})]},u.key))})]})]})})}const bd=[{key:"1h",label:"1 hour",hours:1,period:60},{key:"3h",label:"3 hours",hours:3,period:60},{key:"6h",label:"6 hours",hours:6,period:300},{key:"12h",label:"12 hours",hours:12,period:300},{key:"24h",label:"24 hours",hours:24,period:300},{key:"3d",label:"3 days",hours:72,period:900},{key:"7d",label:"7 days",hours:168,period:3600}],Hue=Tn` 22981 from { opacity: 0; transform: translateY(6px); } 22982 to { opacity: 1; transform: translateY(0); }
22983`,bIt=p.div.withConfig({displayName:"AdminInfrastructure__Wrap",componentId:"sc-1x2ldcm-0"})` 22984 padding: 1.25rem 1.25rem 2rem; 22985 min-height: 100%; 22986 background: ${At}; 22987`,vIt=p.div.withConfig({displayName:"AdminInfrastructure__Max",componentId:"sc-1x2ldcm-1"})` 22988 max-width: 68rem; 22989 margin: 0 auto; 22990`,wIt=p.div.withConfig({displayName:"AdminInfrastructure__Hero",componentId:"sc-1x2ldcm-2"})` 22991 background: ${Z}; 22992 border: 1px solid ${Rt}; 22993 box-shadow: 0 16px 40px rgba(17, 24, 39, 0.08); 22994 border-radius: 1rem; 22995 padding: 1.25rem; 22996 animation: ${Hue} 180ms ease both; 22997`,jIt=p.div.withConfig({displayName:"AdminInfrastructure__TitleRow",componentId:"sc-1x2ldcm-3"})` 22998 display: inline-flex; 22999 align-items: center; 23000 gap: 0.625rem; 23001 color: ${O}; 23002 font-weight: 800; 23003 font-size: 1.125rem; 23004`,_It=p.div.withConfig({displayName:"AdminInfrastructure__Sub",componentId:"sc-1x2ldcm-4"})` 23005 margin-top: 0.5rem; 23006 color: ${z}; 23007 font-size: 0.875rem; 23008 line-height: 1.45; 23009`,Gx=p.div.withConfig({displayName:"AdminInfrastructure__Panel",componentId:"sc-1x2ldcm-5"})` 23010 margin-top: 1rem; 23011 background: ${Z}; 23012 border: 1px solid ${Rt}; 23013 box-shadow: 0 10px 24px rgba(17, 24, 39, 0.06); 23014 border-radius: 1rem; 23015 padding: 1rem; 23016 animation: ${Hue} 180ms ease both; 23017`,Vx=p.div.withConfig({displayName:"AdminInfrastructure__PanelTop",componentId:"sc-1x2ldcm-6"})` 23018 display: flex; 23019 align-items: flex-start; 23020 justify-content: space-between; 23021 gap: 0.75rem; 23022`,iee=p.div.withConfig({displayName:"AdminInfrastructure__PanelTitle",componentId:"sc-1x2ldcm-7"})` 23023 color: ${O}; 23024 font-weight: 800; 23025 font-size: 0.95rem; 23026 display: inline-flex; 23027 align-items: center; 23028 gap: 0.5rem; 23029`,CIt=p.div.withConfig({displayName:"AdminInfrastructure__ServiceGrid",componentId:"sc-1x2ldcm-8"})` 23030 margin-top: 0.85rem; 23031 display: grid; 23032 grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); 23033 gap: 0.625rem; 23034`,SIt=p.button.withConfig({displayName:"AdminInfrastructure__ServiceCard",componentId:"sc-1x2ldcm-9"})` 23035 background: ${e=>e.$active?ot:Z}; 23036 color: ${e=>e.$active?Z:O}; 23037 border: 1px solid ${e=>e.$active?Ft:V}; 23038 border-radius: 0.75rem; 23039 padding: 0.75rem 0.875rem; 23040 cursor: pointer; 23041 text-align: left; 23042 transition: all 120ms ease; 23043 23044 &:hover { 23045 border-color: ${e=>e.$active?Ft:Pe}; 23046 box-shadow: 0 2px 8px rgba(17, 24, 39, 0.06); 23047 } 23048`,kIt=p.div.withConfig({displayName:"AdminInfrastructure__ServiceName",componentId:"sc-1x2ldcm-10"})` 23049 font-weight: 750; 23050 font-size: 0.875rem; 23051 overflow: hidden; 23052 text-overflow: ellipsis; 23053 white-space: nowrap; 23054`,$It=p.div.withConfig({displayName:"AdminInfrastructure__ServiceMeta",componentId:"sc-1x2ldcm-11"})` 23055 font-size: 0.75rem; 23056 color: ${e=>e.$active?"rgba(255,255,255,0.75)":z}; 23057 margin-top: 0.25rem; 23058 display: flex; 23059 align-items: center; 23060 gap: 0.5rem; 23061`,IIt=p.span.withConfig({displayName:"AdminInfrastructure__StatusDot",componentId:"sc-1x2ldcm-12"})` 23062 display: inline-block; 23063 width: 7px; 23064 height: 7px; 23065 border-radius: 50%; 23066 background: ${e=>e.$ok?Vt:oi}; 23067`,cE=p.div.withConfig({displayName:"AdminInfrastructure__RangeBar",componentId:"sc-1x2ldcm-13"})` 23068 display: flex; 23069 align-items: center; 23070 gap: 0.25rem; 23071 flex-wrap: wrap; 23072`,dE=p.button.withConfig({displayName:"AdminInfrastructure__RangeBtn",componentId:"sc-1x2ldcm-14"})` 23073 background: ${e=>e.$active?O:Z}; 23074 color: ${e=>e.$active?Z:z}; 23075 border: 1px solid ${e=>e.$active?O:V}; 23076 border-radius: 0.5rem; 23077 padding: 0.3rem 0.625rem; 23078 font-size: 0.75rem; 23079 font-weight: 700; 23080 cursor: pointer; 23081 transition: all 100ms ease; 23082 23083 &:hover { 23084 border-color: ${Pe}; 23085 } 23086`,uE=p.div.withConfig({displayName:"AdminInfrastructure__ChartsRow",componentId:"sc-1x2ldcm-15"})` 23087 display: grid; 23088 grid-template-columns: 1fr 1fr; 23089 gap: 1rem; 23090 margin-top: 1rem; 23091 23092 @media (max-width: 860px) { 23093 grid-template-columns: 1fr; 23094 } 23095`,PIt=p.div.withConfig({displayName:"AdminInfrastructure__ChartCard",componentId:"sc-1x2ldcm-16"})` 23096 background: ${Z}; 23097 border: 1px solid ${V}; 23098 border-radius: 0.75rem; 23099 padding: 0.75rem; 23100`,AIt=p.div.withConfig({displayName:"AdminInfrastructure__ChartTitle",componentId:"sc-1x2ldcm-17"})` 23101 font-weight: 750; 23102 font-size: 0.8rem; 23103 color: ${O}; 23104 display: flex; 23105 align-items: center; 23106 gap: 0.4rem; 23107 margin-bottom: 0.5rem;
23108`,pf=p.div.withConfig({displayName:"AdminInfrastructure__EmptyMsg",componentId:"sc-1x2ldcm-18"})` 23109 color: ${z}; 23110 font-size: 0.875rem; 23111 padding: 2rem 0; 23112 text-align: center; 23113`,ree=p.span.withConfig({displayName:"AdminInfrastructure__Pill",componentId:"sc-1x2ldcm-19"})` 23114 display: inline-flex; 23115 align-items: center; 23116 padding: 0.15rem 0.5rem; 23117 border-radius: 999px; 23118 font-weight: 700; 23119 font-size: 0.65rem; 23120 text-transform: uppercase; 23121 letter-spacing: 0.02em; 23122 background: ${e=>e.$tone==="ok"?si:kn}; 23123 border: 1px solid ${e=>e.$tone==="ok"?Mo:Er}; 23124 color: ${e=>e.$tone==="ok"?Vt:oi}; 23125`,NIt=p.button.withConfig({displayName:"AdminInfrastructure__BackBtn",componentId:"sc-1x2ldcm-20"})` 23126 display: inline-flex; 23127 align-items: center; 23128 gap: 0.4rem; 23129 background: none; 23130 border: none; 23131 cursor: pointer; 23132 color: ${z}; 23133 font-size: 0.8rem; 23134 font-weight: 700; 23135 padding: 0; 23136 margin-bottom: 0.75rem; 23137 transition: color 100ms ease; 23138 23139 &:hover { 23140 color: ${O}; 23141 } 23142`,zIt=p.div.withConfig({displayName:"AdminInfrastructure__TooltipCard",componentId:"sc-1x2ldcm-21"})` 23143 background: ${Z}; 23144 border: 1px solid ${V}; 23145 color: ${O}; 23146 border-radius: 0.75rem; 23147 padding: 0.5rem 0.625rem; 23148 box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12); 23149`,TIt=p.div.withConfig({displayName:"AdminInfrastructure__TooltipTitle",componentId:"sc-1x2ldcm-22"})` 23150 font-size: 0.7rem; 23151 font-weight: 800; 23152 color: ${O}; 23153 margin-bottom: 0.2rem; 23154`,EIt=p.div.withConfig({displayName:"AdminInfrastructure__TooltipValue",componentId:"sc-1x2ldcm-23"})` 23155 font-size: 0.75rem; 23156 font-weight: 700; 23157 color: ${z}; 23158`,oee=p.div.withConfig({displayName:"AdminInfrastructure__StatsGrid",componentId:"sc-1x2ldcm-24"})` 23159 display: grid; 23160 grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); 23161 gap: 0.625rem; 23162 margin-top: 0.85rem; 23163`,F2=p.div.withConfig({displayName:"AdminInfrastructure__InfoCard",componentId:"sc-1x2ldcm-25"})` 23164 border: 1px solid ${V}; 23165 border-radius: 0.75rem; 23166 background: ${Z}; 23167 padding: 0.65rem 0.75rem; 23168`,W2=p.div.withConfig({displayName:"AdminInfrastructure__InfoLabel",componentId:"sc-1x2ldcm-26"})` 23169 font-size: 0.65rem; 23170 font-weight: 700; 23171 text-transform: uppercase; 23172 letter-spacing: 0.04em; 23173 color: ${z}; 23174 margin-bottom: 0.2rem; 23175 display: flex; 23176 align-items: center; 23177 gap: 0.3rem; 23178`,U2=p.div.withConfig({displayName:"AdminInfrastructure__InfoValue",componentId:"sc-1x2ldcm-27"})` 23179 font-size: 1rem; 23180 font-weight: 800; 23181 color: ${O}; 23182`,Cj=p.div.withConfig({displayName:"AdminInfrastructure__CompoundCard",componentId:"sc-1x2ldcm-28"})` 23183 border: 1px solid ${V}; 23184 border-radius: 0.75rem; 23185 background: ${Z}; 23186 padding: 0.65rem 0.75rem; 23187`,Sj=p.div.withConfig({displayName:"AdminInfrastructure__CompoundTitle",componentId:"sc-1x2ldcm-29"})` 23188 font-size: 0.65rem; 23189 font-weight: 700; 23190 text-transform: uppercase; 23191 letter-spacing: 0.04em; 23192 color: ${z}; 23193 margin-bottom: 0.35rem; 23194 display: flex; 23195 align-items: center; 23196 gap: 0.3rem; 23197`,Sc=p.div.withConfig({displayName:"AdminInfrastructure__CompoundRow",componentId:"sc-1x2ldcm-30"})` 23198 display: flex; 23199 justify-content: space-between; 23200 align-items: center; 23201 padding: 0.1rem 0; 23202`,kc=p.span.withConfig({displayName:"AdminInfrastructure__CompoundLabel",componentId:"sc-1x2ldcm-31"})` 23203 font-size: 0.7rem; 23204 font-weight: 600; 23205 color: ${z}; 23206`,$c=p.span.withConfig({displayName:"AdminInfrastructure__CompoundValue",componentId:"sc-1x2ldcm-32"})` 23207 font-size: 0.85rem; 23208 font-weight: 800; 23209 color: ${O}; 23210`,H2=p.button.withConfig({displayName:"AdminInfrastructure__CollapsibleHeader",componentId:"sc-1x2ldcm-33"})` 23211 display: flex; 23212 align-items: center; 23213 gap: 0.5rem; 23214 background: none; 23215 border: none; 23216 cursor: pointer; 23217 padding: 0; 23218 color: ${O}; 23219 font-weight: 800; 23220 font-size: 0.95rem; 23221 23222 &:hover { 23223 color: ${ot}; 23224 } 23225`,see=p.div.withConfig({displayName:"AdminInfrastructure__DeployList",componentId:"sc-1x2ldcm-34"})` 23226 margin-top: 0.85rem; 23227 display: flex; 23228 flex-direction: column; 23229 gap: 0.5rem; 23230`,aee=p.div.withConfig({displayName:"AdminInfrastructure__DeployRow",componentId:"sc-1x2ldcm-35"})` 23231 display: flex; 23232 align-items: center; 23233 gap: 0.75rem; 23234 padding: 0.6rem 0.75rem; 23235 border: 1px solid ${V}; 23236 border-radius: 0.75rem; 23237 background: ${Z}; 23238 font-size: 0.8rem;
23239`,lee=p.span.withConfig({displayName:"AdminInfrastructure__DeployStatus",componentId:"sc-1x2ldcm-36"})` 23240 display: inline-flex; 23241 align-items: center; 23242 padding: 0.15rem 0.5rem; 23243 border-radius: 999px; 23244 font-weight: 700; 23245 font-size: 0.65rem; 23246 text-transform: uppercase; 23247 letter-spacing: 0.02em; 23248 white-space: nowrap; 23249 background: ${e=>e.$tone==="ok"?si:e.$tone==="error"?kn:e.$tone==="pending"?"#FFF7ED":At}; 23250 border: 1px solid ${e=>e.$tone==="ok"?Mo:e.$tone==="error"?Er:e.$tone==="pending"?"#FED7AA":V}; 23251 color: ${e=>e.$tone==="ok"?Vt:e.$tone==="error"?oi:e.$tone==="pending"?"#EA580C":z}; 23252`,cee=p.div.withConfig({displayName:"AdminInfrastructure__DeployMeta",componentId:"sc-1x2ldcm-37"})` 23253 display: flex; 23254 flex-direction: column; 23255 gap: 0.1rem; 23256 min-width: 0; 23257 flex: 1; 23258`,dee=p.div.withConfig({displayName:"AdminInfrastructure__DeployTitle",componentId:"sc-1x2ldcm-38"})` 23259 font-weight: 700; 23260 font-size: 0.8rem; 23261 color: ${O}; 23262 overflow: hidden; 23263 text-overflow: ellipsis; 23264 white-space: nowrap; 23265`,uee=p.div.withConfig({displayName:"AdminInfrastructure__DeploySub",componentId:"sc-1x2ldcm-39"})` 23266 font-size: 0.7rem; 23267 color: ${z}; 23268 font-weight: 600; 23269 display: flex; 23270 align-items: center; 23271 gap: 0.5rem; 23272 flex-wrap: wrap; 23273`,pee=p.button.withConfig({displayName:"AdminInfrastructure__RetryBtn",componentId:"sc-1x2ldcm-40"})` 23274 display: inline-flex; 23275 align-items: center; 23276 gap: 0.3rem; 23277 background: ${Z}; 23278 border: 1px solid ${V}; 23279 border-radius: 0.5rem; 23280 padding: 0.25rem 0.55rem; 23281 font-size: 0.65rem; 23282 font-weight: 700; 23283 color: ${z}; 23284 cursor: pointer; 23285 white-space: nowrap; 23286 transition: all 100ms ease; 23287 flex-shrink: 0; 23288 23289 &:hover:not(:disabled) { 23290 border-color: ${ot}; 23291 color: ${ot}; 23292 } 23293 23294 &:disabled { 23295 opacity: 0.5; 23296 cursor: not-allowed; 23297 } 23298`;function gp(e){return e==null?"â":e>=1024**3?`${(e/1024**3).toFixed(2)} GB`:e>=1024**2?`${(e/1024**2).toFixed(1)} MB`:e>=1024?`${(e/1024).toFixed(0)} KB`:`${e} B`}function mee(e){return e==null?"â":e>=1024**2?`${(e/1024**2).toFixed(1)} MB/s`:e>=1024?`${(e/1024).toFixed(1)} KB/s`:`${e.toFixed(0)} B/s`}function kj(e,n=0){return e==null?"â":e.toLocaleString(void 0,{minimumFractionDigits:n,maximumFractionDigits:n})}function q2(e){const n=e?.toUpperCase();return["SUCCEED","SUCCEEDED"].includes(n)?"ok":["FAILED","STOPPED","CANCELLED","CANCELED"].includes(n)?"error":["INPROGRESS","IN_PROGRESS","PENDING","PROVISIONING","DEPLOYING","RUNNING"].includes(n)?"pending":"neutral"}function hee(e){if(!e)return"â";try{return new Date(e).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}catch{return"â"}}function fee(e,n){if(!e||!n)return"";try{const i=new Date(n).getTime()-new Date(e).getTime();if(i<0)return"";const r=Math.floor(i/1e3);if(r<60)return`${r}s`;const o=Math.floor(r/60),s=r%60;return s>0?`${o}m ${s}s`:`${o}m`}catch{return""}}const MIt=p.div.withConfig({displayName:"AdminInfrastructure__LegendRow",componentId:"sc-1x2ldcm-41"})` 23299 display: flex; 23300 align-items: center; 23301 gap: 0.75rem; 23302 margin-top: 0.4rem; 23303 padding-top: 0.4rem; 23304 border-top: 1px solid ${$e}; 23305`,pE=p.div.withConfig({displayName:"AdminInfrastructure__LegendItem",componentId:"sc-1x2ldcm-42"})` 23306 display: flex; 23307 align-items: center; 23308 gap: 0.3rem; 23309 font-size: 0.65rem; 23310 font-weight: 700; 23311 color: ${z}; 23312`,mE=p.span.withConfig({displayName:"AdminInfrastructure__LegendDot",componentId:"sc-1x2ldcm-43"})` 23313 display: inline-block; 23314 width: 8px; 23315 height: 3px; 23316 border-radius: 1px; 23317 background: ${e=>e.$color}; 23318`,Kx="#6366f1",Yx="#f59e0b",hE={avg:e=>e,min:e=>"#3b82f6",max:e=>"#f97316"};function RIt(e){if(!e)return[];const n=e.Average||[],i=e.Minimum||[],r=e.Maximum||[],o=new Map(i.map(a=>[a.timestamp,a.value])),s=new Map(r.map(a=>[a.timestamp,a.value]));return n.map(a=>({time:a.timestamp,avg:a.value,min:o.get(a.timestamp)??null,max:s.get(a.timestamp)??null}))}function Xx({title:e,icon:n,stats:i,color:r,loading:o,rangeHours:s,yFormatter:a}){const c=l.useMemo(()=>RIt(i),[i]),u=l.useMemo(()=>c.flatMap($=>[$.avg,$.min,$.max].filter(k=>k!=null)),[c]),m=l.useMemo(()=>Math.max(0,...u),[u]),h=a?[0,Math.ceil(m*1.2)||1]:[0,Math.max(5,Math.min(100,Math.ceil(m*1.2)))],g=l.useMemo(()=>
23318{if(c.length<=1)return c.map(k=>k.time);const $=Math.max(1,Math.floor(c.length/6));return c.filter((k,P)=>P%$===0).map(k=>k.time)},[c]),x=s>24,y=$=>{try{const k=new Date($);return x?`${(k.getMonth()+1).toString().padStart(2,"0")}/${k.getDate().toString().padStart(2,"0")}`:`${k.getHours().toString().padStart(2,"0")}:${k.getMinutes().toString().padStart(2,"0")}`}catch{return""}},w=$=>{try{return new Date($).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}catch{return""}},j=hE.avg(r),v=hE.min(r),_=hE.max(r);return t.jsxs(PIt,{children:[t.jsxs(AIt,{children:[n,e]}),o?t.jsx(pf,{children:"Loading..."}):c.length===0?t.jsx(pf,{children:"No data for this range"}):t.jsxs(t.Fragment,{children:[t.jsx("div",{style:{width:"100%",height:220},children:t.jsx(Gl,{width:"100%",height:"100%",children:t.jsxs(zC,{data:c,margin:{top:6,right:8,left:0,bottom:0},children:[t.jsx("defs",{children:t.jsxs("linearGradient",{id:`grad-avg-${r.replace("#","")}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[t.jsx("stop",{offset:"5%",stopColor:j,stopOpacity:.12}),t.jsx("stop",{offset:"95%",stopColor:j,stopOpacity:0})]})}),t.jsx(Zm,{stroke:$e,strokeDasharray:"4 4"}),t.jsx(Ql,{dataKey:"time",ticks:g,tick:{fill:z,fontSize:11,fontWeight:700},axisLine:{stroke:V},tickLine:{stroke:V},minTickGap:12,tickFormatter:y}),t.jsx(Zl,{domain:h,tick:{fill:z,fontSize:11,fontWeight:700},axisLine:{stroke:V},tickLine:{stroke:V},width:a?56:36,tickFormatter:a||($=>`${$}%`)}),t.jsx(Vl,{cursor:{stroke:Pe,strokeWidth:1},content:({active:$,payload:k,label:P})=>{if(!$||!k?.length)return null;const S=k.find(B=>B.dataKey==="avg")?.value,I=k.find(B=>B.dataKey==="min")?.value,A=k.find(B=>B.dataKey==="max")?.value,E=B=>typeof B=="number"?a?a(B):`${B.toFixed(2)}%`:"â";return t.jsxs(zIt,{children:[t.jsx(TIt,{children:w(String(P??""))}),t.jsxs(EIt,{children:[t.jsxs("span",{style:{color:_},children:["Max ",E(A)]})," · ",t.jsxs("span",{style:{color:j},children:["Avg ",E(S)]})," · ",t.jsxs("span",{style:{color:v},children:["Min ",E(I)]})]})]})}}),t.jsx(jf,{type:"monotone",dataKey:"min",stroke:v,strokeWidth:1,strokeDasharray:"4 3",fill:"none",dot:!1,activeDot:{r:3,fill:v,stroke:Z,strokeWidth:1},connectNulls:!0}),t.jsx(jf,{type:"monotone",dataKey:"max",stroke:_,strokeWidth:1,strokeDasharray:"4 3",fill:"none",dot:!1,activeDot:{r:3,fill:_,stroke:Z,strokeWidth:1},connectNulls:!0}),t.jsx(jf,{type:"monotone",dataKey:"avg",stroke:j,strokeWidth:2,fill:`url(#grad-avg-${r.replace("#","")})`,dot:!1,activeDot:{r:4,fill:j,stroke:Z,strokeWidth:2},connectNulls:!0})]})})}),t.jsxs(MIt,{children:[t.jsxs(pE,{children:[t.jsx(mE,{$color:v}),"Minimum"]}),t.jsxs(pE,{children:[t.jsx(mE,{$color:j}),"Average"]}),t.jsxs(pE,{children:[t.jsx(mE,{$color:_}),"Maximum"]})]})]})]})}function OIt(){const e=zn(),[n,i]=l.useState([]),[r,o]=l.useState(!0),[s,a]=l.useState(null),[c,u]=l.useState(null),[m,h]=l.useState("24h"),[g,x]=l.useState(null),[y,w]=l.useState(!1),[j,v]=l.useState(null),[_,$]=l.useState(!1),[k,P]=l.useState("24h"),[S,I]=l.useState(null),[A,E]=l.useState(!1),[B,T]=l.useState(null),[M,R]=l.useState(!1),[F,Y]=l.useState("24h"),[H,U]=l.useState(null),[X,Q]=l.useState(!1),[K,G]=l.useState(null),L=l.useCallback(async()=>{o(!0),a(null);try{const We=await ue("/api/v1/admin/infrastructure/ecs_services"),Qe=await We.json().catch(()=>null);if(!We.ok)throw new Error(Qe?.error||`Failed (${We.status})`);i(Qe||[])}catch(We){a(We?.message||"Failed to load services"),i([])}finally{o(!1)}},[]);l.useEffect(()=>{ue("/api/v1/admin/ping",{method:"GET"}).then(We=>{We.ok||e("/forbidden",{replace:!0})}).catch(()=>e("/forbidden",{replace:!0})),L()},[e,L]);const q=l.useCallback(async(We,Qe)=>{w(!0),v(null);const ht=bd.find(ze=>ze.key===Qe)||bd[4],pe=new Date().toISOString(),be=new Date(Date.now()-ht.hours*3600*1e3).toISOString(),rt=new URLSearchParams({service_name:We,period:String(ht.period),start_time:be,end_time:pe});try{const ze=await ue(`/api/v1/admin/infrastructure/ecs_metrics?${rt}`),lt=await ze.json().catch(()=>null);if(!ze.ok)throw new Error(lt?.error||`Failed (${ze.status})`);x(lt)}catch(ze){v(ze?.message||"Failed to load metrics"),x(null)}finally{w(!1)}},[]);l.useEffect(()=>{c&&q(c,m)},[c,m,q]);const W=l.useMemo(()=>g?.metrics?.CPUUtilization,[g]),oe=l.useMemo(()=>g?.metrics?.MemoryUtilization,[g]),se=l.useMemo(()=>bd.find(We=>We.key===m)?.hours??24,[m]),de=l.useMemo(()=>n.find(We=>We.name===c),[n,c]),le=l.useCallback(async We=>{E(!0),T(null);const Qe=bd.find(pe=>pe.key===We)||bd[4],ht=new URLSearchParams({period:String(Qe.period),start_time:new Date(Date.now()-Qe.hours*3600*1e3).toISOString(),end_time:new Date().toISOString()});
23318try{const pe=await ue(`/api/v1/admin/infrastructure/rds_metrics?${ht}`),be=await pe.json().catch(()=>null);if(!pe.ok)throw new Error(be?.error||`Failed (${pe.status})`);I(be)}catch(pe){T(pe?.message||"Failed to load RDS metrics"),I(null)}finally{E(!1)}},[]);l.useEffect(()=>{_&&le(k)},[_,k,le]);const me=l.useMemo(()=>bd.find(We=>We.key===k)?.hours??24,[k]),ee=l.useCallback(async We=>{Q(!0),G(null);const Qe=bd.find(pe=>pe.key===We)||bd[4],ht=new URLSearchParams({period:String(Qe.period),start_time:new Date(Date.now()-Qe.hours*3600*1e3).toISOString(),end_time:new Date().toISOString()});try{const pe=await ue(`/api/v1/admin/infrastructure/redis_metrics?${ht}`),be=await pe.json().catch(()=>null);if(!pe.ok)throw new Error(be?.error||`Failed (${pe.status})`);U(be)}catch(pe){G(pe?.message||"Failed to load Redis metrics"),U(null)}finally{Q(!1)}},[]);l.useEffect(()=>{M&&ee(F)},[M,F,ee]);const ne=l.useMemo(()=>bd.find(We=>We.key===F)?.hours??24,[F]),[Ae,_e]=l.useState(!1),[we,Ke]=l.useState(null),[ce,ie]=l.useState(!1),[Re,Be]=l.useState(null),tt=l.useCallback(async()=>{ie(!0),Be(null);try{const We=await ue("/api/v1/admin/infrastructure/codepipeline_deployments"),Qe=await We.json().catch(()=>null);if(!We.ok)throw new Error(Qe?.error||`Failed (${We.status})`);Ke(Qe)}catch(We){Be(We?.message||"Failed to load pipeline data"),Ke(null)}finally{ie(!1)}},[]);l.useEffect(()=>{Ae&&tt()},[Ae,tt]);const[dt,je]=l.useState(null),Me=l.useCallback(async We=>{je(We);try{const Qe=await ue("/api/v1/admin/infrastructure/retry_pipeline",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({execution_id:We})}),ht=await Qe.json().catch(()=>null);Qe.ok?setTimeout(()=>tt(),1500):alert(ht?.error||`Retry failed (${Qe.status})`)}catch{alert("Network error retrying pipeline")}finally{je(null)}},[tt]),[Se,it]=l.useState(!1),[De,te]=l.useState(null),[ge,Je]=l.useState(!1),[Ee,Xe]=l.useState(null),yt=l.useCallback(async()=>{Je(!0),Xe(null);try{const We=await ue("/api/v1/admin/infrastructure/amplify_deployments"),Qe=await We.json().catch(()=>null);if(!We.ok)throw new Error(Qe?.error||`Failed (${We.status})`);te(Qe)}catch(We){Xe(We?.message||"Failed to load Amplify data"),te(null)}finally{Je(!1)}},[]);l.useEffect(()=>{Se&&yt()},[Se,yt]);const[Ne,Le]=l.useState(null),Ue=l.useCallback(async We=>{Le(We);try{const Qe=await ue("/api/v1/admin/infrastructure/retry_amplify_job",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({job_id:We})}),ht=await Qe.json().catch(()=>null);Qe.ok?setTimeout(()=>yt(),1500):alert(ht?.error||`Retry failed (${Qe.status})`)}catch{alert("Network error retrying Amplify job")}finally{Le(null)}},[yt]);return t.jsx(bIt,{children:t.jsxs(vIt,{children:[t.jsxs(wIt,{children:[t.jsxs(jIt,{children:[t.jsx(Lb,{size:18}),t.jsx("span",{children:"Infrastructure"})]}),t.jsx(_It,{children:"ECS, RDS, and Redis metrics from CloudWatch."})]}),t.jsxs(Gx,{children:[t.jsxs(Vx,{children:[t.jsx("div",{style:{minWidth:0},children:t.jsxs(iee,{children:[t.jsx(kP,{size:16}),"ECS Services"]})}),t.jsx(he,{size:"sm",variant:"outline",disabled:r,leftIcon:t.jsx(No,{size:14}),onClick:L,children:"Refresh"})]}),s&&t.jsx("div",{style:{marginTop:"0.75rem",color:oi,fontWeight:650,fontSize:"0.875rem"},children:s}),r&&!n.length?t.jsx(pf,{children:"Loading services..."}):n.length===0&&!r?t.jsx(pf,{children:"No services found in cluster"}):t.jsx(CIt,{children:n.map(We=>{const Qe=We.name===c,ht=We.running_count>=We.desired_count&&We.status==="ACTIVE";return t.jsxs(SIt,{$active:Qe,onClick:()=>u(Qe?null:We.name),title:We.arn,children:[t.jsx(kIt,{children:We.name}),t.jsxs($It,{$active:Qe,children:[t.jsx(IIt,{$ok:ht}),t.jsxs("span",{children:[We.running_count,"/",We.desired_count," tasks"]}),We.launch_type&&t.jsx("span",{children:We.launch_type}),t.jsx(ree,{$tone:ht?"ok":"error",children:We.status})]})]},We.name)})})]}),c&&t.jsxs(Gx,{children:[t.jsxs(NIt,{onClick:()=>u(null),children:[t.jsx(xy,{size:14}),"Back to all services"]}),t.jsxs(Vx,{children:[t.jsx("div",{style:{minWidth:0},children:t.jsxs(iee,{children:[t.jsx(ow,{size:16}),c,de&&t.jsxs(ree,{$tone:de.running_count>=de.desired_count?"ok":"error",children:[de.running_count,"/",de.desired_count]})]})}),t.jsxs("div",{style:{display:"flex",gap:"0.5rem",alignItems:"center"},children:[t.jsx(cE,{children:bd.map(We=>t.jsx(dE,{$active:m===We.key,onClick:()=>h(We.key),children:We.label},We.key))}),t.jsx(he,{size:"sm",variant:"outline",disabled:y,leftIcon:t.jsx(No,{size:14}),onClick:()=>q(c,m),children:"Refresh"})]})]}),j&&t.jsx("div",{style:{marginTop:"0.75rem",color:oi,fontWeight:650,fontSize:"0.875rem"},children:j}),t.jsxs(uE,{children:[t.jsx(Xx,{title:"CPU Utilization",icon:t.jsx(ow,{size:14,style:{color:Kx}}),stats:W,color:Kx,loading:y,rangeHours:se}),t.jsx(Xx,{title:"Memory Utilization",icon:t.jsx(sw,{size:14,style:{color:Yx}}),stats:oe,color:Yx,loading:y,rangeHours:se})]})]}),t.jsxs(Gx,{children:[t.jsxs(Vx,{children:[t.jsxs(H2,{onClick:()=>$(We=>!We),children:[_?t.jsx(qn,{size:16}):t.jsx(Gi,{size:16}),t.jsx(f9,{size:16}),"Database (RDS PostgreSQL)",S?.instance_id&&t.jsx("span",{style:{fontWeight:600,fontSize:"0.75rem",color:z},children:S.instance_id})]}),_&&t.jsxs("div",{style:{display:"flex",gap:"0.5rem",alignItems:"center"},children:[t.jsx(cE,{children:bd.map(We=>t.jsx(dE,{$active:k===We.key,onClick:()=>P(We.key),children:We.label},We.key))}),t.jsx(he,{size:"sm",variant:"outline",disabled:A,leftIcon:t.jsx(No,{size:14}),onClick:()=>le(k),children:"Refresh"})]})]}),_&&t.jsxs(t.Fragment,{children:[B&&t.jsx("div",{style:{marginTop:"0.75rem",color:oi,fontWeight:650,fontSize:"0.875rem"},children:B}),t.jsxs(uE,{children:[t.jsx(Xx,{title:"CPU Utilization",icon:t.jsx(ow,{size:14,style:{color:Kx}}),stats:S?.graphs?.CPUUtilization,color:Kx,loading:A,rangeHours:me}),t.jsx(Xx,{title:"Freeable Memory",icon:t.jsx(sw,{size:14,style:{color:Yx}}),stats:S?.graphs?.FreeableMemory,color:Yx,loading:A,rangeHours:me,yFormatter:gp})]}),t.jsxs(oee,{children:[t.jsxs(Cj,{children:[t.jsxs(Sj,{children:[t.jsx(sw,{size:10})," Memory"]}),t.jsxs(Sc,{children:[t.jsx(kc,{children:"Used"}
23318),t.jsx($c,{children:gp(S?.stats?.MemoryUsed)})]}),t.jsxs(Sc,{children:[t.jsx(kc,{children:"Available"}),t.jsx($c,{children:gp(S?.stats?.MemoryAvailable)})]}),t.jsxs(Sc,{children:[t.jsx(kc,{children:"Total"}),t.jsx($c,{children:gp(S?.stats?.MemoryTotal)})]})]}),t.jsxs(Cj,{children:[t.jsxs(Sj,{children:[t.jsx(f9,{size:10})," Storage"]}),t.jsxs(Sc,{children:[t.jsx(kc,{children:"Used"}),t.jsx($c,{children:gp(S?.stats?.StorageUsed)})]}),t.jsxs(Sc,{children:[t.jsx(kc,{children:"Free"}),t.jsx($c,{children:gp(S?.stats?.StorageFree)})]}),t.jsxs(Sc,{children:[t.jsx(kc,{children:"Total"}),t.jsx($c,{children:gp(S?.stats?.StorageTotal)})]})]}),t.jsxs(F2,{children:[t.jsxs(W2,{children:[t.jsx(n_,{size:10})," Connections"]}),t.jsx(U2,{children:kj(S?.stats?.DatabaseConnections)})]}),t.jsxs(Cj,{children:[t.jsxs(Sj,{children:[t.jsx(Ks,{size:10})," IOPS"]}),t.jsxs(Sc,{children:[t.jsx(kc,{children:"Read"}),t.jsx($c,{children:kj(S?.stats?.ReadIOPS,1)})]}),t.jsxs(Sc,{children:[t.jsx(kc,{children:"Write"}),t.jsx($c,{children:kj(S?.stats?.WriteIOPS,1)})]})]}),t.jsxs(Cj,{children:[t.jsxs(Sj,{children:[t.jsx(n_,{size:10})," Network"]}),t.jsxs(Sc,{children:[t.jsx(kc,{children:"In"}),t.jsx($c,{children:mee(S?.stats?.NetworkReceiveThroughput)})]}),t.jsxs(Sc,{children:[t.jsx(kc,{children:"Out"}),t.jsx($c,{children:mee(S?.stats?.NetworkTransmitThroughput)})]})]})]})]})]}),t.jsxs(Gx,{children:[t.jsxs(Vx,{children:[t.jsxs(H2,{onClick:()=>R(We=>!We),children:[M?t.jsx(qn,{size:16}):t.jsx(Gi,{size:16}),t.jsx(Ks,{size:16}),"Redis (ElastiCache)",H?.cluster_id&&t.jsx("span",{style:{fontWeight:600,fontSize:"0.75rem",color:z},children:H.cluster_id})]}),M&&t.jsxs("div",{style:{display:"flex",gap:"0.5rem",alignItems:"center"},children:[t.jsx(cE,{children:bd.map(We=>t.jsx(dE,{$active:F===We.key,onClick:()=>Y(We.key),children:We.label},We.key))}),t.jsx(he,{size:"sm",variant:"outline",disabled:X,leftIcon:t.jsx(No,{size:14}),onClick:()=>ee(F),children:"Refresh"})]})]}),M&&t.jsxs(t.Fragment,{children:[K&&t.jsx("div",{style:{marginTop:"0.75rem",color:oi,fontWeight:650,fontSize:"0.875rem"},children:K}),t.jsxs(uE,{children:[t.jsx(Xx,{title:"CPU Utilization",icon:t.jsx(ow,{size:14,style:{color:Kx}}),stats:H?.graphs?.CPUUtilization,color:Kx,loading:X,rangeHours:ne}),t.jsx(Xx,{title:"Memory Usage",icon:t.jsx(sw,{size:14,style:{color:Yx}}),stats:H?.graphs?.DatabaseMemoryUsagePercentage,color:Yx,loading:X,rangeHours:ne})]}),t.jsxs(oee,{children:[t.jsxs(Cj,{children:[t.jsxs(Sj,{children:[t.jsx(sw,{size:10})," Memory"]}),t.jsxs(Sc,{children:[t.jsx(kc,{children:"Used"}),t.jsx($c,{children:gp(H?.stats?.MemoryUsed)})]}),t.jsxs(Sc,{children:[t.jsx(kc,{children:"Available"}),t.jsx($c,{children:gp(H?.stats?.MemoryAvailable)})]}),t.jsxs(Sc,{children:[t.jsx(kc,{children:"Total"}),t.jsx($c,{children:gp(H?.stats?.MemoryTotal)})]})]}),t.jsxs(F2,{children:[t.jsxs(W2,{children:[t.jsx(n_,{size:10})," Connections"]}),t.jsx(U2,{children:kj(H?.stats?.CurrConnections)})]}),t.jsxs(F2,{children:[t.jsxs(W2,{children:[t.jsx(Ks,{size:10})," Evictions"]}),t.jsx(U2,{children:kj(H?.stats?.Evictions)})]}),t.jsxs(F2,{children:[t.jsxs(W2,{children:[t.jsx(ow,{size:10})," Cache Hit Rate"]}),t.jsx(U2,{children:H?.stats?.CacheHitRate!=null?`${H.stats.CacheHitRate}%`:"â"})]})]})]})]}),t.jsxs(Gx,{children:[t.jsxs(Vx,{children:[t.jsxs(H2,{onClick:()=>_e(We=>!We),children:[Ae?t.jsx(qn,{size:16}):t.jsx(Gi,{size:16}),t.jsx(Q8,{size:16}),"Server Pipeline (CodePipeline)",we?.pipeline_name&&t.jsx("span",{style:{fontWeight:600,fontSize:"0.75rem",color:z},children:we.pipeline_name})]}),Ae&&t.jsx(he,{size:"sm",variant:"outline",disabled:ce,leftIcon:t.jsx(No,{size:14}),onClick:tt,children:"Refresh"})]}),Ae&&t.jsxs(t.Fragment,{children:[Re&&t.jsx("div",{style:{marginTop:"0.75rem",color:oi,fontWeight:650,fontSize:"0.875rem"},children:Re}),ce&&!we?t.jsx(pf,{children:"Loading pipeline executions..."}):we?.executions?.length===0?t.jsx(pf,{children:"No recent executions"}):t.jsx(see,{children:we?.executions?.map(We=>{const Qe=We.source_revisions?.[0],ht=fee(We.start_time,We.last_update_time),pe=q2(We.status)==="error";return t.jsxs(aee,{children:[t.jsx(lee,{$tone:q2(We.status),children:We.status}),t.jsxs(cee,{children:[t.jsx(dee,{children:Qe?.revision_summary||We.execution_id}
23318),t.jsxs(uee,{children:[Qe?.revision_id&&t.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"0.2rem"},children:[t.jsx(x9,{size:10}),Qe.revision_url?t.jsx("a",{href:Qe.revision_url,target:"_blank",rel:"noopener noreferrer",style:{color:ot,textDecoration:"none"},children:Qe.revision_id}):Qe.revision_id]}),t.jsx("span",{children:hee(We.start_time)}),ht&&t.jsx("span",{children:ht}),We.trigger?.type&&t.jsx("span",{children:We.trigger.type})]})]}),pe&&t.jsxs(pee,{disabled:dt===We.execution_id,onClick:()=>Me(We.execution_id),children:[t.jsx(vb,{size:11}),dt===We.execution_id?"Retryingâ¦":"Retry"]})]},We.execution_id)})})]})]}),t.jsxs(Gx,{children:[t.jsxs(Vx,{children:[t.jsxs(H2,{onClick:()=>it(We=>!We),children:[Se?t.jsx(qn,{size:16}):t.jsx(Gi,{size:16}),t.jsx(Lb,{size:16}),"Client (Amplify)",De?.branch_name&&t.jsx("span",{style:{fontWeight:600,fontSize:"0.75rem",color:z},children:De.branch_name})]}),Se&&t.jsx(he,{size:"sm",variant:"outline",disabled:ge,leftIcon:t.jsx(No,{size:14}),onClick:yt,children:"Refresh"})]}),Se&&t.jsxs(t.Fragment,{children:[Ee&&t.jsx("div",{style:{marginTop:"0.75rem",color:oi,fontWeight:650,fontSize:"0.875rem"},children:Ee}),ge&&!De?t.jsx(pf,{children:"Loading Amplify deployments..."}):De?.jobs?.length===0?t.jsx(pf,{children:"No recent deployments"}):t.jsx(see,{children:De?.jobs?.map(We=>{const Qe=fee(We.start_time,We.end_time),ht=q2(We.status)==="error";return t.jsxs(aee,{children:[t.jsx(lee,{$tone:q2(We.status),children:We.status}),t.jsxs(cee,{children:[t.jsx(dee,{children:We.commit_message||`Job #${We.job_id}`}),t.jsxs(uee,{children:[We.commit_id&&t.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"0.2rem"},children:[t.jsx(x9,{size:10}),We.commit_id]}),t.jsx("span",{children:hee(We.start_time)}),Qe&&t.jsx("span",{children:Qe}),t.jsx("span",{children:We.job_type})]})]}),ht&&t.jsxs(pee,{disabled:Ne===We.job_id,onClick:()=>Ue(We.job_id),children:[t.jsx(vb,{size:11}),Ne===We.job_id?"Retryingâ¦":"Retry"]})]},We.job_id)})})]})]})]})})}const fE=[{key:"5m",label:"5 min",hours:5/60},{key:"15m",label:"15 min",hours:.25},{key:"1h",label:"1 hour",hours:1},{key:"3h",label:"3 hours",hours:3},{key:"6h",label:"6 hours",hours:6},{key:"12h",label:"12 hours",hours:12},{key:"24h",label:"24 hours",hours:24},{key:"3d",label:"3 days",hours:72},{key:"7d",label:"7 days",hours:168}],que=Tn` 23319 from { opacity: 0; transform: translateY(6px); } 23320 to { opacity: 1; transform: translateY(0); } 23321`,DIt=Tn` 23322 from { transform: rotate(0deg); } 23323 to { transform: rotate(360deg); } 23324`,LIt=p.div.withConfig({displayName:"AdminLogs__Wrap",componentId:"sc-kwb4np-0"})` 23325 padding: 1.25rem 1.25rem 2rem; 23326 min-height: 100%; 23327 background: ${At}; 23328`,BIt=p.div.withConfig({displayName:"AdminLogs__Max",componentId:"sc-kwb4np-1"})` 23329 max-width: 68rem; 23330 margin: 0 auto; 23331`,FIt=p.div.withConfig({displayName:"AdminLogs__Hero",componentId:"sc-kwb4np-2"})` 23332 background: ${Z}; 23333 border: 1px solid ${Rt}; 23334 box-shadow: 0 16px 40px rgba(17, 24, 39, 0.08); 23335 border-radius: 1rem; 23336 padding: 1.25rem; 23337 animation: ${que} 180ms ease both; 23338`,WIt=p.div.withConfig({displayName:"AdminLogs__TitleRow",componentId:"sc-kwb4np-3"})` 23339 display: inline-flex; 23340 align-items: center; 23341 gap: 0.625rem; 23342 color: ${O}; 23343 font-weight: 800; 23344 font-size: 1.125rem; 23345`,UIt=p.div.withConfig({displayName:"AdminLogs__Sub",componentId:"sc-kwb4np-4"})` 23346 margin-top: 0.5rem; 23347 color: ${z}; 23348 font-size: 0.875rem; 23349 line-height: 1.45; 23350`,HIt=p.div.withConfig({displayName:"AdminLogs__ServiceGrid",componentId:"sc-kwb4np-5"})` 23351 display: flex; 23352 gap: 0.5rem; 23353 flex-wrap: wrap; 23354 margin-top: 1rem; 23355`,qIt=p.button.withConfig({displayName:"AdminLogs__ServiceBtn",componentId:"sc-kwb4np-6"})` 23356 display: flex; 23357 align-items: center; 23358 gap: 0.5rem; 23359 background: ${e=>e.$active?O:Z}; 23360 color: ${e=>e.$active?Z:O}; 23361 border: 1px solid ${e=>e.$active?O:V}; 23362 border-radius: 0.75rem; 23363 padding: 0.6rem 1rem; 23364 font-size: 0.8rem; 23365 font-weight: 700; 23366 cursor: pointer; 23367 transition: all 120ms ease; 23368 23369 &:hover { 23370 border-color: ${Pe}; 23371 box-shadow: 0 2px 8px rgba(17, 24, 39, 0.06); 23372 } 23373`,GIt=p.span.withConfig({displayName:"AdminLogs__ServiceStatus",componentId:"sc-kwb4np-7"})` 23374 width: 6px; 23375 height: 6px; 23376 border-radius: 50%; 23377 background: ${e=>e.$running?Vt:Pe}; 23378 flex-shrink: 0; 23379`,VIt=p.div.withConfig({displayName:"AdminLogs__Panel",componentId:"sc-kwb4np-8"})` 23380 margin-top: 1rem; 23381 background: ${Z}; 23382 border: 1px solid ${Rt}; 23383 box-shadow: 0 10px 24px rgba(17, 24, 39, 0.06); 23384 border-radius: 1rem; 23385 padding: 1rem; 23386 animation: ${que} 180ms ease both; 23387`,KIt=p.div.withConfig({displayName:"AdminLogs__Controls",componentId:"sc-kwb4np-9"})` 23388 display: flex; 23389 align-items: center; 23390 gap: 0.5rem; 23391 flex-wrap: wrap; 23392`,YIt=p.div.withConfig({displayName:"AdminLogs__RangeBar",componentId:"sc-kwb4np-10"})` 23393 display: flex; 23394 align-items: center; 23395 gap: 0.25rem; 23396 flex-wrap: wrap; 23397`,XIt=p.button.withConfig({displayName:"AdminLogs__RangeBtn",componentId:"sc-kwb4np-11"})` 23398 background: ${e=>e.$active?O:Z}; 23399 color: ${e=>e.$active?Z:z}; 23400 border: 1px solid ${e=>e.$active?O:V}; 23401 border-radius: 0.5rem; 23402 padding: 0.3rem 0.625rem; 23403 font-size: 0.75rem; 23404 font-weight: 700; 23405 cursor: pointer; 23406 transition: all 100ms ease; 23407 23408 &:hover { 23409 border-color: ${Pe}; 23410 }
23411`,QIt=p.div.withConfig({displayName:"AdminLogs__SearchWrap",componentId:"sc-kwb4np-12"})` 23412 position: relative; 23413 flex: 1; 23414 min-width: 10rem; 23415`,ZIt=p.div.withConfig({displayName:"AdminLogs__SearchIcon",componentId:"sc-kwb4np-13"})` 23416 position: absolute; 23417 left: 0.5rem; 23418 top: 50%; 23419 transform: translateY(-50%); 23420 color: ${Pe}; 23421 pointer-events: none; 23422`,JIt=p.input.withConfig({displayName:"AdminLogs__SearchInput",componentId:"sc-kwb4np-14"})` 23423 width: 100%; 23424 padding: 0.4rem 1.75rem 0.4rem 1.8rem; 23425 border: 1px solid ${V}; 23426 border-radius: 0.5rem; 23427 font-size: 0.8rem; 23428 font-weight: 600; 23429 color: ${O}; 23430 background: ${Z}; 23431 23432 &::placeholder { 23433 color: ${Pe}; 23434 } 23435 23436 &:focus { 23437 outline: none; 23438 border-color: ${ot}; 23439 } 23440`,ePt=p.button.withConfig({displayName:"AdminLogs__SearchClear",componentId:"sc-kwb4np-15"})` 23441 position: absolute; 23442 right: 0.4rem; 23443 top: 50%; 23444 transform: translateY(-50%); 23445 background: none; 23446 border: none; 23447 padding: 0.1rem; 23448 color: ${Pe}; 23449 cursor: pointer; 23450 display: flex; 23451 align-items: center; 23452 border-radius: 0.25rem; 23453 23454 &:hover { 23455 color: ${O}; 23456 } 23457`,tPt=p.div.withConfig({displayName:"AdminLogs__LogContainerWrap",componentId:"sc-kwb4np-16"})` 23458 position: relative; 23459 margin-top: 0.75rem; 23460`,nPt=p.div.withConfig({displayName:"AdminLogs__LogContainer",componentId:"sc-kwb4np-17"})` 23461 border: 1px solid ${V}; 23462 border-radius: 0.75rem; 23463 background: #0f172a; 23464 max-height: 40rem; 23465 overflow-y: auto; 23466 font-family: "SF Mono", "Fira Code", "Fira Mono", Menlo, Monaco, Consolas, monospace; 23467`,iPt=p.div.withConfig({displayName:"AdminLogs__LoadingOverlay",componentId:"sc-kwb4np-18"})` 23468 position: absolute; 23469 inset: 0; 23470 display: flex; 23471 align-items: center; 23472 justify-content: center; 23473 background: rgba(15, 23, 42, 0.7); 23474 border-radius: 0.75rem; 23475 z-index: 2; 23476`,gee=p(Tr).withConfig({displayName:"AdminLogs__Spinner",componentId:"sc-kwb4np-19"})` 23477 animation: ${DIt} 0.8s linear infinite; 23478 color: #94a3b8; 23479`,S8={error:"#ef4444",warn:"#f59e0b",info:"#3b82f6",debug:"#6b7280",default:"#475569"},rPt={error:"rgba(239,68,68,0.06)",warn:"rgba(245,158,11,0.04)",info:"transparent",debug:"transparent",default:"transparent"},oPt=p.div.withConfig({displayName:"AdminLogs__LogRow",componentId:"sc-kwb4np-20"})` 23480 border-left: 3px solid ${e=>S8[e.$level]}; 23481 background: ${e=>e.$expanded?"rgba(255,255,255,0.05)":rPt[e.$level]}; 23482 cursor: pointer; 23483 transition: background 80ms ease; 23484 23485 &:hover { 23486 background: rgba(255, 255, 255, 0.05); 23487 } 23488 23489 & + & { 23490 border-top: 1px solid rgba(255, 255, 255, 0.04); 23491 } 23492`,sPt=p.div.withConfig({displayName:"AdminLogs__LogCompact",componentId:"sc-kwb4np-21"})` 23493 display: flex; 23494 align-items: flex-start; 23495 gap: 0.5rem; 23496 padding: 0.35rem 0.625rem; 23497 min-height: 1.5rem; 23498`,aPt=p.span.withConfig({displayName:"AdminLogs__LogChevron",componentId:"sc-kwb4np-22"})` 23499 color: #64748b; 23500 flex-shrink: 0;
23501 margin-top: 1px; 23502 transition: transform 120ms ease; 23503 ${e=>e.$expanded&&Pp`transform: rotate(90deg);`} 23504`,lPt=p.div.withConfig({displayName:"AdminLogs__LogMeta",componentId:"sc-kwb4np-23"})` 23505 display: flex; 23506 align-items: center; 23507 gap: 0.5rem; 23508 flex-shrink: 0; 23509 min-width: 0; 23510`,cPt=p.span.withConfig({displayName:"AdminLogs__LogTimestamp",componentId:"sc-kwb4np-24"})` 23511 color: #94a3b8; 23512 font-size: 0.68rem; 23513 white-space: nowrap; 23514 user-select: none; 23515`,dPt=p.span.withConfig({displayName:"AdminLogs__LogLevelBadge",componentId:"sc-kwb4np-25"})` 23516 font-size: 0.6rem; 23517 font-weight: 800; 23518 text-transform: uppercase; 23519 letter-spacing: 0.04em; 23520 color: ${e=>S8[e.$level]}; 23521 background: ${e=>S8[e.$level]}18; 23522 padding: 0.05rem 0.35rem; 23523 border-radius: 0.25rem; 23524 user-select: none; 23525 white-space: nowrap; 23526`,uPt=p.div.withConfig({displayName:"AdminLogs__LogMessage",componentId:"sc-kwb4np-26"})` 23527 font-size: 0.72rem; 23528 line-height: 1.45; 23529 color: #e2e8f0; 23530 white-space: nowrap; 23531 overflow: hidden; 23532 text-overflow: ellipsis; 23533 min-width: 0; 23534 flex: 1; 23535`,pPt=p.div.withConfig({displayName:"AdminLogs__LogExpanded",componentId:"sc-kwb4np-27"})` 23536 padding: 0.375rem 0.625rem 0.625rem 1.75rem; 23537 border-top: 1px dashed rgba(255, 255, 255, 0.06); 23538`,mPt=p.div.withConfig({displayName:"AdminLogs__DetailGrid",componentId:"sc-kwb4np-28"})` 23539 display: grid; 23540 grid-template-columns: auto 1fr; 23541 gap: 0.2rem 0.75rem; 23542 font-size: 0.68rem; 23543 margin-bottom: 0.5rem; 23544`,G2=p.span.withConfig({displayName:"AdminLogs__DetailLabel",componentId:"sc-kwb4np-29"})` 23545 color: #64748b; 23546 font-weight: 700; 23547 text-transform: uppercase; 23548 letter-spacing: 0.04em; 23549 white-space: nowrap; 23550`,V2=p.span.withConfig({displayName:"AdminLogs__DetailValue",componentId:"sc-kwb4np-30"})` 23551 color: #cbd5e1; 23552 word-break: break-all; 23553`,hPt=p.pre.withConfig({displayName:"AdminLogs__MessageBlock",componentId:"sc-kwb4np-31"})` 23554 margin: 0; 23555 padding: 0.5rem 0.625rem; 23556 background: rgba(0, 0, 0, 0.3); 23557 border-radius: 0.375rem; 23558 font-size: 0.72rem; 23559 line-height: 1.55; 23560 color: #e2e8f0; 23561 white-space: pre-wrap; 23562 word-break: break-all; 23563 max-height: 16rem; 23564 overflow-y: auto; 23565 position: relative; 23566`,fPt=p.button.withConfig({displayName:"AdminLogs__CopyBtn",componentId:"sc-kwb4np-32"})` 23567 position: absolute; 23568 top: 0.35rem; 23569 right: 0.35rem; 23570 background: rgba(255, 255, 255, 0.08); 23571 border: 1px solid rgba(255, 255, 255, 0.1); 23572 border-radius: 0.3rem; 23573 padding: 0.2rem; 23574 color: #94a3b8; 23575 cursor: pointer; 23576 display: flex; 23577 align-items: center; 23578 transition: all 100ms ease; 23579 23580 &:hover { 23581 background: rgba(255, 255, 255, 0.15); 23582 color: #e2e8f0; 23583 } 23584`,gPt=p.div.withConfig({displayName:"AdminLogs__MessageWrap",componentId:"sc-kwb4np-33"})` 23585 position: relative; 23586`,K2=p.div.withConfig({displayName:"AdminLogs__EmptyMsg",componentId:"sc-kwb4np-34"})` 23587 color: ${z}; 23588 font-size: 0.875rem; 23589 padding: 2rem 0; 23590 text-align: center; 23591`,yPt=p.div.withConfig({displayName:"AdminLogs__LoadMoreWrap",componentId:"sc-kwb4np-35"})` 23592 display: flex; 23593 justify-content: center; 23594 padding: 0.75rem 0; 23595`,xPt=p.span.withConfig({displayName:"AdminLogs__CountBadge",componentId:"sc-kwb4np-36"})` 23596 font-size: 0.7rem; 23597 font-weight: 700; 23598 color: ${z}; 23599 margin-left: 0.25rem; 23600`;function bPt(e){if(!e)return"";try{const n=new Date(e),i=n.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit"}),r=String(n.getMilliseconds()).padStart(3,"0");return`${i}.${r}`}catch{return""}}function vPt(e){if(!e)return"";try{const n=new Date(e);return n.toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"})+`.${String(n.getMilliseconds()).padStart(3,"0")}`}catch{return""}}function wPt(e){if(!e)return"default";const n=e.slice(0,200).toUpperCase();return/\bERROR\b|\bFATAL\b|\bCRITICAL\b/.test(n)?"error":/\bWARN(ING)?\b/.test(n)?"warn":/\bINFO\b/.test(n)?"info":/\bDEBUG\b/.test(n)?"debug":"default"}const jPt={error:"ERR",warn:"WRN",info:"INF",debug:"DBG",default:"LOG"},Gue=/^[IDWEF],\s*\[.*?#\d+\]\s*\w+\s*--\s*:\s*/,Vue=/^(\[[^\]]*\]\s*)+/;function _Pt(e){return e?e.replace(Gue,"").replace(Vue,"").trim():""}function CPt(e){if(!e)return[];const i=e.replace(Gue,"").match(Vue);if(!i)return[];const r=[],o=/\[([^\]]+)\]/g;let s;for(;(s=o.exec(i[0]))!==null;)r.push(s[1]);return r}function SPt(e,n=200){if(!e)return"";const r=_Pt(e).replace(/\n/g," ").trim();return r.length>n?r.slice(0,n)+"...":r}function kPt({ev:e}){const[n,i]=l.useState(!1),[r,o]=l.useState(!1),s=wPt(e.message),a=CPt(e.message),c=u=>{u.stopPropagation(),e.message&&navigator.clipboard.writeText(e.message).then(()=>{o(!0),setTimeout(()=>
23600o(!1),1500)})};return t.jsxs(oPt,{$level:s,$expanded:n,onClick:()=>i(u=>!u),children:[t.jsxs(sPt,{children:[t.jsx(aPt,{$expanded:n,children:t.jsx(Gi,{size:10})}),t.jsxs(lPt,{children:[t.jsx(cPt,{children:bPt(e.timestamp)}),t.jsx(dPt,{$level:s,children:jPt[s]})]}),t.jsx(uPt,{children:SPt(e.message)})]}),n&&t.jsxs(pPt,{children:[t.jsxs(mPt,{children:[t.jsx(G2,{children:"Time"}),t.jsx(V2,{children:vPt(e.timestamp)}),a.length>0&&t.jsxs(t.Fragment,{children:[t.jsx(G2,{children:"Tags"}),t.jsx(V2,{children:a.join(" / ")})]}),t.jsx(G2,{children:"Stream"}),t.jsx(V2,{children:e.log_stream||"â"}),t.jsx(G2,{children:"Event ID"}),t.jsx(V2,{children:e.event_id||"â"})]}),t.jsxs(gPt,{children:[t.jsx(hPt,{children:e.message||""}),t.jsx(fPt,{onClick:c,title:"Copy message",children:r?t.jsx(Zn,{size:12}):t.jsx(so,{size:12})})]})]})]})}function $Pt(){const[e,n]=l.useState([]),[i,r]=l.useState(!0),[o,s]=l.useState(null),[a,c]=l.useState(-1),[u,m]=l.useState("1h"),[h,g]=l.useState(""),[x,y]=l.useState(""),[w,j]=l.useState([]),[v,_]=l.useState(null),[$,k]=l.useState(!1),[P,S]=l.useState(null),[I,A]=l.useState(0),E=a>=0?e[a]??null:null,B=l.useCallback(async()=>{r(!0),s(null);try{const R=await ue("/api/v1/admin/logs/groups"),F=await R.json().catch(()=>null);if(!R.ok)throw new Error(F?.error||`Failed (${R.status})`);n(F||[]),F?.length>0&&a<0&&c(0)}catch(R){s(R?.message||"Failed to load services"),n([])}finally{r(!1)}},[a]);l.useEffect(()=>{B()},[B]);const T=l.useCallback(async(R=!1)=>{if(!E)return;k(!0),S(null);const F=fE.find(X=>X.key===u)||fE[1],Y=new Date().toISOString(),H=new Date(Date.now()-F.hours*3600*1e3).toISOString(),U=new URLSearchParams({log_group:E.log_group,start_time:H,end_time:Y});E.stream_prefix&&U.set("stream_prefix",E.stream_prefix),h&&U.set("filter_pattern",h),R&&v&&U.set("next_token",v);try{const X=await ue(`/api/v1/admin/logs/query?${U}`),Q=await X.json().catch(()=>null);if(!X.ok)throw new Error(Q?.error||`Failed (${X.status})`);const K=Q.events||[];j(R?G=>[...G,...K]:K),_(K.length>0&&Q.next_token||null),A(G=>R?G+(Q.count||0):Q.count||0)}catch(X){S(X?.message||"Failed to query logs"),R||(j([]),_(null),A(0))}finally{k(!1)}},[E,u,h,v]);l.useEffect(()=>{E&&T(!1)},[a,u]);const M=()=>{g(x)};return l.useEffect(()=>{E&&T(!1)},[h]),t.jsx(LIt,{children:t.jsxs(BIt,{children:[t.jsxs(FIt,{children:[t.jsxs(WIt,{children:[t.jsx(Ss,{size:18}),t.jsx("span",{children:"Log Viewer"})]}),t.jsx(UIt,{children:"Select an ECS service to browse its CloudWatch logs."}),o&&t.jsx("div",{style:{marginTop:"0.75rem",color:oi,fontWeight:650,fontSize:"0.875rem"},children:o}),i?t.jsx(K2,{children:"Loading services..."}):e.length===0?t.jsx(K2,{children:"No ECS services found"}):t.jsx(HIt,{children:e.map((R,F)=>t.jsxs(qIt,{$active:a===F,onClick:()=>c(F),children:[t.jsx(GIt,{$running:R.running_count>0}),t.jsx(kP,{size:14}),R.name]},R.name))})]}),E&&t.jsxs(VIt,{children:[t.jsxs(KIt,{children:[t.jsx(YIt,{children:fE.map(R=>t.jsx(XIt,{$active:u===R.key,onClick:()=>m(R.key),children:R.label},R.key))}),t.jsxs(QIt,{children:[t.jsx(ZIt,{children:t.jsx(Cs,{size:14})}),t.jsx(JIt,{placeholder:"Filter pattern (e.g. ERROR, status=500)",value:x,onChange:R=>y(R.target.value),onKeyDown:R=>{R.key==="Enter"&&M()}}),(x||h)&&t.jsx(ePt,{onClick:()=>{y(""),g("")},title:"Clear search",children:t.jsx(Ei,{size:13})})]}),t.jsx(he,{size:"sm",variant:"outline",disabled:$,leftIcon:t.jsx(No,{size:14}),onClick:()=>T(!1),children:"Refresh"})]}),P&&t.jsx("div",{style:{marginTop:"0.75rem",color:oi,fontWeight:650,fontSize:"0.875rem"},children:P}),$&&w.length===0?t.jsxs(K2,{children:[t.jsx(gee,{size:20,style:{marginBottom:"0.5rem"}}),t.jsx("div",{children:"Loading logs..."})]}):w.length===0?t.jsx(K2,{children:"No log events found for this range and filter"}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{style:{marginTop:"0.5rem",fontSize:"0.7rem",fontWeight:700,color:z},children:["Showing ",I," events",v&&" (more available)"]}),t.jsxs(tPt,{children:[$&&t.jsx(iPt,{children:t.jsx(gee,{size:24})}),t.jsx(nPt,{children:w.map((R,F)=>t.jsx(kPt,{ev:R},R.event_id||F))})]}),v&&t.jsx(yPt,{children:t.jsxs(he,{size:"sm",variant:"outline",disabled:$,leftIcon:t.jsx(qn,{size:14}),onClick:()=>T(!0),children:[$?"Loading...":"Load more",t.jsx(xPt,{children:"+200"})]})})]})]})]})})}const IPt={chatgpt:"ChatGPT",perplexity:"Perplexity",gemini:"Gemini",google_ai_mode:"AI Mode",google_ai_overview:"AI Overview",grok:"Grok",copilot:"Copilot",claude:"Claude"},PPt={chatgpt:"#10a37f",perplexity:"#20808d",gemini:"#4285f4",google_ai_mode:"#ea4335",google_ai_overview:"#fbbc04",grok:"#1d9bf0",copilot:"#2563eb",claude:"#cc7832"},yee=[{value:"",label:"All statuses"},{value:"pending",label:"Pending"},{value:"running",label:"Running"},{value:"succeeded",label:"Succeeded"},{value:"failed",label:"Failed"}],APt=[{value:"",label:"All triggers"},{value:"scheduled",label:"Scheduled"},{value:"manual",label:"Manual"}],NPt=[{value:"",label:"All billing"},{value:"active",label:"Billing active"},{value:"inactive",label:"Billing inactive"}],Kue=Tn`from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:translateY(0)}`,zPt=Tn`from{transform:rotate(0deg)}to{transform:rotate(360deg)}`,xee=p.div.withConfig({displayName:"AdminRunMonitor__Wrap",componentId:"sc-1ot0cjq-0"})`padding:1.25rem 1.25rem 2rem;min-height:100%;background:${At};color:${O};`,bee=p.div.withConfig({displayName:"AdminRunMonitor__Max",componentId:"sc-1ot0cjq-1"})`max-width:72rem;margin:0 auto;`,vee=p.div.withConfig({displayName:"AdminRunMonitor__Hero",componentId:"sc-1ot0cjq-2"})` 23601 background:${Z};border:1px solid ${Rt};box-shadow:0 16px 40px rgba(17,24,39,.08); 23602 border-radius:1rem;padding:1.25rem;animation:${Kue} 180ms ease both; 23603`,wee=p.div.withConfig({displayName:"AdminRunMonitor__TitleRow",componentId:"sc-1ot0cjq-3"})`display:inline-flex;align-items:center;gap:.625rem;color:${O};font-weight:800;font-size:1.125rem;`,TPt=p.div.withConfig({displayName:"AdminRunMonitor__Sub",componentId:"sc-1ot0cjq-4"})`margin-top:.5rem;color:${z};font-size:.875rem;line-height:1.45;`,jee=p.div.withConfig({displayName:"AdminRunMonitor__Panel",componentId:"sc-1ot0cjq-5"})` 23604 margin-top:1rem;background:${Z};border:1px solid ${Rt}; 23605 box-shadow:0 10px 24px rgba(17,24,39,.06);border-radius:1rem;padding:1rem; 23606`,_ee=p.div.withConfig({displayName:"AdminRunMonitor__Controls",componentId:"sc-1ot0cjq-6"})`display:flex;align-items:center;gap:.5rem;flex-wrap:wrap;margin-bottom:.75rem;`,$j=p.div.withConfig({displayName:"AdminRunMonitor__SelectWrap",componentId:"sc-1ot0cjq-7"})`min-width:9rem;
23606`,EPt=p.div.withConfig({displayName:"AdminRunMonitor__SearchWrap",componentId:"sc-1ot0cjq-8"})`position:relative;min-width:10rem;flex:1;`,MPt=p.div.withConfig({displayName:"AdminRunMonitor__SearchIconWrap",componentId:"sc-1ot0cjq-9"})`position:absolute;left:.5rem;top:50%;transform:translateY(-50%);color:${Pe};pointer-events:none;`,RPt=p.input.withConfig({displayName:"AdminRunMonitor__SearchInput",componentId:"sc-1ot0cjq-10"})` 23607 width:100%;padding:.4rem 1.75rem .4rem 1.8rem;border:1px solid ${V};border-radius:.5rem; 23608 font-size:.8rem;font-weight:600;color:${O};background:${Z}; 23609 &::placeholder{color:${Pe};}&:focus{outline:none;border-color:${ot};} 23610`,OPt=p.button.withConfig({displayName:"AdminRunMonitor__ClearBtn",componentId:"sc-1ot0cjq-11"})` 23611 position:absolute;right:.4rem;top:50%;transform:translateY(-50%);background:none;border:none; 23612 padding:.1rem;color:${Pe};cursor:pointer;display:flex;align-items:center;border-radius:.25rem; 23613 &:hover{color:${O};} 23614`,Cee=p.table.withConfig({displayName:"AdminRunMonitor__Table",componentId:"sc-1ot0cjq-12"})`width:100%;border-collapse:collapse;font-size:.78rem;color:${O};`,Rs=p.th.withConfig({displayName:"AdminRunMonitor__Th",componentId:"sc-1ot0cjq-13"})` 23615 text-align:left;padding:.5rem .5rem;border-bottom:2px solid ${V};font-weight:800; 23616 color:${z};text-transform:uppercase;letter-spacing:.04em;font-size:.68rem;white-space:nowrap; 23617`,Os=p.td.withConfig({displayName:"AdminRunMonitor__Td",componentId:"sc-1ot0cjq-14"})`padding:.5rem;border-bottom:1px solid ${$e};vertical-align:middle;color:${O};`,DPt=p.tr.withConfig({displayName:"AdminRunMonitor__TrClickable",componentId:"sc-1ot0cjq-15"})`cursor:pointer;transition:background 80ms ease;&:hover{background:${At};}`,Ij=p.span.withConfig({displayName:"AdminRunMonitor__Badge",componentId:"sc-1ot0cjq-16"})` 23618 display:inline-flex;align-items:center;gap:.25rem;font-size:.65rem;font-weight:800;text-transform:uppercase; 23619 letter-spacing:.03em;padding:.15rem .45rem;border-radius:.35rem; 23620 color:${e=>e.$color};background:${e=>e.$bg};white-space:nowrap; 23621`,LPt=p.div.withConfig({displayName:"AdminRunMonitor__ProgressBarWrap",componentId:"sc-1ot0cjq-17"})`display:flex;align-items:center;gap:.4rem;min-width:8rem;`,BPt=p.div.withConfig({displayName:"AdminRunMonitor__ProgressTrack",componentId:"sc-1ot0cjq-18"})`flex:1;height:6px;border-radius:3px;background:${V};overflow:hidden;display:flex;`,gE=p.div.withConfig({displayName:"AdminRunMonitor__ProgressFill",componentId:"sc-1ot0cjq-19"})`width:${e=>e.$w}%;background:${e=>e.$color};transition:width 300ms ease;`,FPt=p.span.withConfig({displayName:"AdminRunMonitor__ProgressLabel",componentId:"sc-1ot0cjq-20"})`font-size:.65rem;font-weight:700;color:${z};white-space:nowrap;`,WPt=p.span.withConfig({displayName:"AdminRunMonitor__CountLabel",componentId:"sc-1ot0cjq-21"})`font-size:.75rem;font-weight:700;color:${z};white-space:nowrap;`,Pj=p.div.withConfig({displayName:"AdminRunMonitor__EmptyMsg",componentId:"sc-1ot0cjq-22"})`color:${z};font-size:.875rem;padding:2rem 0;text-align:center;`,See=p(Tr).withConfig({displayName:"AdminRunMonitor__Spinner",componentId:"sc-1ot0cjq-23"})`animation:${zPt} .8s linear infinite;color:${Pe};`,UPt=p.button.withConfig({displayName:"AdminRunMonitor__DetailBack",componentId:"sc-1ot0cjq-24"})` 23622 display:inline-flex;align-items:center;gap:.5rem;background:none;border:none;padding:0; 23623 color:${ot};font-size:.8rem;font-weight:700;cursor:pointer;margin-bottom:.75rem; 23624 &:hover{text-decoration:underline;} 23625`,HPt=p.div.withConfig({displayName:"AdminRunMonitor__SummaryGrid",componentId:"sc-1ot0cjq-25"})`display:flex;gap:.75rem;flex-wrap:wrap;margin-top:.75rem;`,Aj=p.div.withConfig({displayName:"AdminRunMonitor__SummaryCard",componentId:"sc-1ot0cjq-26"})` 23626 background:${e=>e.$bg||At};border:1px solid ${V};border-radius:.75rem; 23627 padding:.5rem .75rem;min-width:6rem;text-align:center; 23628`,Nj=p.div.withConfig({displayName:"AdminRunMonitor__SummaryValue",componentId:"sc-1ot0cjq-27"})`font-size:1.25rem;font-weight:900;color:${O};`,zj=p.div.withConfig({displayName:"AdminRunMonitor__SummaryLabel",componentId:"sc-1ot0cjq-28"})`font-size:.65rem;font-weight:700;color:${z};text-transform:uppercase;letter-spacing:.04em;`,qPt=p.tr.withConfig({displayName:"AdminRunMonitor__DetailRow",componentId:"sc-1ot0cjq-29"})` 23629 ${e=>e.$failed&&Pp`background:${kn};`} 23630 &:hover{background:${At};} 23631`,kee=p.div.withConfig({displayName:"AdminRunMonitor__ErrorText",componentId:"sc-1ot0cjq-30"})`font-size:.68rem;color:${oi};margin-top:.15rem;max-width:20rem;word-break:break-all;`,$ee=p.span.withConfig({displayName:"AdminRunMonitor__LiveDot",componentId:"sc-1ot0cjq-31"})` 23632 width:7px;height:7px;border-radius:50%;display:inline-block; 23633 background:${e=>e.$live?Vt:Pe};margin-right:.35rem; 23634`,Iee=p.div.withConfig({displayName:"AdminRunMonitor__InfoPanel",componentId:"sc-1ot0cjq-32"})` 23635 overflow:hidden;transition:max-height 200ms ease,opacity 200ms ease; 23636 max-height:${e=>e.$open?"30rem":"0"};opacity:${e=>e.$open?1:0}; 23637`,Pee=p.button.withConfig({displayName:"AdminRunMonitor__InfoToggle",componentId:"sc-1ot0cjq-33"})` 23638 display:inline-flex;align-items:center;gap:.3rem;background:none;border:1px solid ${V}; 23639 border-radius:.4rem;padding:.2rem .5rem;font-size:.65rem;font-weight:700;color:${z}; 23640 cursor:pointer;transition:all 100ms ease;white-space:nowrap; 23641 &:hover{border-color:${Pe};color:${O};} 23642`,Aee=p.div.withConfig({displayName:"AdminRunMonitor__InfoContent",componentId:"sc-1ot0cjq-34"})` 23643 margin-top:.5rem;padding:.65rem .75rem;background:${At};border:1px solid ${V}; 23644 border-radius:.5rem;font-size:.72rem;line-height:1.55;color:${O}; 23645 & strong{font-weight:800;} 23646 & ul{margin:.25rem 0 .25rem 1.1rem;padding:0;} 23647 & li{margin-bottom:.15rem;} 23648`,GPt=p.div.withConfig({displayName:"AdminRunMonitor__SummaryPanel",componentId:"sc-1ot0cjq-35"})` 23649 margin-top:1rem;background:${Z};border:1px solid ${Rt}; 23650 box-shadow:0 10px 24px rgba(17,24,39,.06);border-radius:1rem;padding:1rem; 23651 animation:${Kue} 180ms ease both; 23652`,VPt=p.button.withConfig({displayName:"AdminRunMonitor__SummaryHeader",componentId:"sc-1ot0cjq-36"})` 23653 display:flex;align-items:center;justify-content:space-between;width:100%; 23654 background:none;border:none;padding:0;cursor:pointer; 23655`,KPt=p.div.withConfig({displayName:"AdminRunMonitor__SummaryTitle",componentId:"sc-1ot0cjq-37"})` 23656 display:inline-flex;align-items:center;gap:.5rem; 23657 font-weight:800;font-size:.85rem;color:${O}; 23658`,YPt=p.div.withConfig({displayName:"AdminRunMonitor__TotalsRow",componentId:"sc-1ot0cjq-38"})`display:flex;gap:.5rem;flex-wrap:wrap;margin-top:.75rem;`,Tj=p.div.withConfig({displayName:"AdminRunMonitor__TotalChip",componentId:"sc-1ot0cjq-39"})` 23659 display:flex;flex-direction:column;align-items:center; 23660 background:${e=>e.$bg};border:1px solid ${V};border-radius:.6rem; 23661 padding:.35rem .65rem;min-width:5rem; 23662`,Ej=p.div.withConfig({displayName:"AdminRunMonitor__TotalNumber",componentId:"sc-1ot0cjq-40"})`font-size:1.15rem;font-weight:900;color:${O};line-height:1.2;`,Mj=p.div.withConfig({displayName:"AdminRunMonitor__TotalLabel",componentId:"sc-1ot0cjq-41"})`font-size:.58rem;font-weight:700;color:${z};text-transform:uppercase;letter-spacing:.04em;`,XPt=p.div.withConfig({displayName:"AdminRunMonitor__ModelGrid",componentId:"sc-1ot0cjq-42"})` 23663 display:grid;grid-template-columns:repeat(auto-fill,minmax(10rem,1fr));gap:.5rem;margin-top:.75rem; 23664`,QPt=p.div.withConfig({displayName:"AdminRunMonitor__ModelCard",componentId:"sc-1ot0cjq-43"})` 23665 border:1px solid ${V};border-radius:.6rem;padding:.5rem .65rem; 23666 border-left:3px solid ${e=>e.$accent};background:${Z}; 23667`,ZPt=p.div.withConfig({displayName:"AdminRunMonitor__ModelName",componentId:"sc-1ot0cjq-44"})`font-size:.72rem;font-weight:800;color:${O};margin-bottom:.35rem;`,JPt=p.div.withConfig({displayName:"AdminRunMonitor__ModelStats",componentId:"sc-1ot0cjq-45"})`display:flex;gap:.4rem;flex-wrap:wrap;`,Wg=p.span.withConfig({displayName:"AdminRunMonitor__ModelStat",componentId:"sc-1ot0cjq-46"})` 23668 font-size:.6rem;font-weight:700;color:${e=>e.$color};white-space:nowrap; 23669`,eAt=p.div.withConfig({displayName:"AdminRunMonitor__ModelBar",componentId:"sc-1ot0cjq-47"})` 23670 height:4px;border-radius:2px;background:${V};overflow:hidden;display:flex;margin-top:.3rem; 23671`,yE=p.div.withConfig({displayName:"AdminRunMonitor__ModelBarFill",componentId:"sc-1ot0cjq-48"})` 23672 width:${e=>e.$w}%;background:${e=>e.$color};transition:width 300ms ease; 23673`;function xE(e){switch(e){case"succeeded":return t.jsxs(Ij,{$color:Vt,$bg:si,children:[t.jsx(co,{size:11}),"Succeeded"]});case"failed":return t.jsxs(Ij,{$color:oi,$bg:kn,children:[t.jsx(Hc,{size:11}),"Failed"]});case"running":return t.jsxs(Ij,{$color:ot,$bg:$e,children:[t.jsx(Tr,{size:11}),"Running"]});
23673case"pending":return t.jsxs(Ij,{$color:z,$bg:$e,children:[t.jsx(qc,{size:11}),"Pending"]});default:return t.jsx(Ij,{$color:z,$bg:$e,children:e})}}function Nee(e){if(!e)return"â";try{return new Date(e).toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}catch{return e}}function zee(e){if(!e)return"â";try{const n=new Date(e);return n.toLocaleDateString(void 0,{month:"short",day:"numeric"})+" "+n.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1})}catch{return e}}function Yue(e){if(e==null)return"â";if(e<60)return`${e.toFixed(1)}s`;const n=Math.floor(e/60),i=Math.round(e%60);return`${n}m ${i}s`}function tAt(e){if(!e.started_at)return"â";const n=new Date(e.started_at).getTime(),i=e.finished_at?new Date(e.finished_at).getTime():Date.now();return Yue((i-n)/1e3)}function nAt(){const{user:e}=yn(),n=String(e?.admin_role||"").toLowerCase()==="admin",{subscribe:i}=wo(),[r,o]=yr(),[s,a]=l.useState([]),[c,u]=l.useState(!0),[m,h]=l.useState(null),[g,x]=l.useState(1),[y,w]=l.useState(1),[j,v]=l.useState(0),[_,$]=l.useState(""),[k,P]=l.useState(""),[S,I]=l.useState(""),[A,E]=l.useState(""),[B,T]=l.useState(""),[M,R]=l.useState(()=>{const Ne=r.get("date");if(Ne&&/^\d{4}-\d{2}-\d{2}$/.test(Ne))return{start:Ne,end:Ne};const Le=new Date,Ue=`${Le.getFullYear()}-${String(Le.getMonth()+1).padStart(2,"0")}-${String(Le.getDate()).padStart(2,"0")}`;return{start:Ue,end:Ue}}),[F,Y]=l.useState(null),[H,U]=l.useState(!1),[X,Q]=l.useState(null),[K,G]=l.useState(""),[L,q]=l.useState(""),[W,oe]=l.useState(1),[se,de]=l.useState({}),[le,me]=l.useState(!1),ee=l.useRef(null),[ne,Ae]=l.useState(null),[_e,we]=l.useState(!0),Ke=l.useCallback(async()=>{try{const Ne=new URLSearchParams;M.start&&Ne.set("date_from",M.start),M.end&&Ne.set("date_to",M.end);const Le=await ue(`/api/v1/admin/runs/summary?${Ne}`),Ue=await Le.json().catch(()=>null);Le.ok&&Ue&&Ae(Ue)}catch{}},[M]);l.useEffect(()=>{Ke()},[Ke]);const ce=l.useCallback(async()=>{u(!0),h(null);try{const Ne=new URLSearchParams({page:String(g)});_&&Ne.set("status",_),k&&Ne.set("triggered_by",k),S&&Ne.set("billing",S),A&&Ne.set("search",A),M.start&&Ne.set("date_from",M.start),M.end&&Ne.set("date_to",M.end);const Le=await ue(`/api/v1/admin/runs?${Ne}`),Ue=await Le.json().catch(()=>null);if(!Le.ok)throw new Error(Ue?.error||`Failed (${Le.status})`);a(Ue.runs||[]),w(Ue.total_pages||1),v(Ue.total||0)}catch(Ne){h(Ne?.message||"Failed to load runs")}finally{u(!1)}},[g,_,k,S,A,M]);l.useEffect(()=>{ce()},[ce]);const ie=l.useCallback(async(Ne,{updateUrl:Le=!0,page:Ue}={})=>{U(!0),Q(null),ee.current=Ne,Le&&o(We=>{const Qe=new URLSearchParams(We);return Qe.set("run_id",String(Ne)),Qe},{replace:!0});try{const We=new URLSearchParams;We.set("page",String(Ue??W)),K&&We.set("status_filter",K),L&&We.set("model_filter",L);const Qe=await ue(`/api/v1/admin/runs/${Ne}?${We}`),ht=await Qe.json().catch(()=>null);if(!Qe.ok)throw new Error(ht?.error||`Failed (${Qe.status})`);Y(ht)}catch(We){Q(We?.message||"Failed to load run detail")}finally{U(!1)}},[K,L,W,o]);l.useEffect(()=>{ee.current&&ie(ee.current,{updateUrl:!1})},[ie]),l.useEffect(()=>{const Ne=r.get("run_id");Ne&&!F&&!ee.current&&ie(Number(Ne),{updateUrl:!1})},[]),l.useEffect(()=>{const Ne=i({channel:"AdminRunMonitorChannel"},{connected:()=>me(!0),disconnected:()=>me(!1),received:Le=>{if(Le?.type==="run_updated"&&Le.run){const Ue=Le.run;a(We=>We.map(Qe=>Qe.id===Ue.id?{...Qe,...Ue}:Qe)),ee.current===Ue.id&&Y(We=>We&&{...We,run:{...We.run,...Ue},summary:{total:Ue.prompt_runs_total,succeeded:Ue.prompt_runs_succeeded,failed:Ue.prompt_runs_failed,running:Ue.prompt_runs_running,pending:Ue.prompt_runs_pending}})}Le?.type==="summary_updated"&&Le.summary&&Ae(Le.summary)}});return()=>{Ne?.unsubscribe(),me(!1)}},[i]);const Re=async Ne=>{de(Le=>({...Le,[`run-${Ne}`]:!0}));try{const Le=await ue(`/api/v1/admin/runs/${Ne}/retry`,{method:"POST"});if(!Le.ok){const Ue=await Le.json().catch(()=>null);throw new Error(Ue?.error||"Retry failed")}ce(),ee.current===Ne&&ie(Ne)}catch(Le){alert(Le?.message||"Retry failed")}finally{de(Le=>({...Le,[`run-${Ne}`]:!1}))}},Be=async Ne=>{de(Le=>({...Le,[`failed-${Ne}`]:!0}));try{const Le=await ue(`/api/v1/admin/runs/${Ne}/retry_failed`,{method:"POST"});if(!Le.ok){const Ue=await Le.json().catch(()=>null);throw new Error(Ue?.error||"Retry failed")}ee.current===Ne&&ie(Ne)}catch(Le){alert(Le?.message||"Retry failed")}finally{de(Le=>({...Le,[`failed-${Ne}`]:!1}))}},tt=async Ne=>{de(Le=>({...Le,[`pr-${Ne}`]:!0}));try{const Le=await ue(`/api/v1/admin/prompt_runs/${Ne}/retry`,{method:"POST"});if(!Le.ok){const Ue=await Le.json().catch(()=>null);throw new Error(Ue?.error||"Retry failed")}ee.current&&ie(ee.current)}catch(Le){alert(Le?.message||"Retry failed")}finally{de(Le=>({...Le,[`pr-${Ne}`]:!1}))}},[dt,je]=l.useState(null),Me=Ne=>je({type:"run",id:Ne}),Se=Ne=>je({type:"prompt_run",id:Ne}),it=async()=>
23673{if(!dt)return;const{type:Ne,id:Le}=dt;if(je(null),Ne==="run"){de(Ue=>({...Ue,[`reset-${Le}`]:!0}));try{const Ue=await ue(`/api/v1/admin/runs/${Le}/reset`,{method:"POST"});if(!Ue.ok){const We=await Ue.json().catch(()=>null);throw new Error(We?.error||"Reset failed")}ce(),ee.current===Le&&ie(Le)}catch(Ue){alert(Ue?.message||"Reset failed")}finally{de(Ue=>({...Ue,[`reset-${Le}`]:!1}))}}else{de(Ue=>({...Ue,[`reset-pr-${Le}`]:!0}));try{const Ue=await ue(`/api/v1/admin/prompt_runs/${Le}/reset`,{method:"POST"});if(!Ue.ok){const We=await Ue.json().catch(()=>null);throw new Error(We?.error||"Reset failed")}ee.current&&ie(ee.current)}catch(Ue){alert(Ue?.message||"Reset failed")}finally{de(Ue=>({...Ue,[`reset-pr-${Le}`]:!1}))}}},De=async(Ne,Le)=>{if(window.confirm(`Change project run status to "${Le}"?`)){de(Ue=>({...Ue,[`status-${Ne}`]:!0}));try{const Ue=await ue(`/api/v1/admin/runs/${Ne}/status`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:Le})});if(!Ue.ok){const We=await Ue.json().catch(()=>null);throw new Error(We?.error||"Status change failed")}ce(),ee.current===Ne&&ie(Ne)}catch(Ue){alert(Ue?.message||"Status change failed")}finally{de(Ue=>({...Ue,[`status-${Ne}`]:!1}))}}},te=async(Ne,Le)=>{de(Ue=>({...Ue,[`status-pr-${Ne}`]:!0}));try{const Ue=await ue(`/api/v1/admin/prompt_runs/${Ne}/status`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:Le})});if(!Ue.ok){const We=await Ue.json().catch(()=>null);throw new Error(We?.error||"Status change failed")}ee.current&&ie(ee.current)}catch(Ue){alert(Ue?.message||"Status change failed")}finally{de(Ue=>({...Ue,[`status-pr-${Ne}`]:!1}))}},[ge,Je]=l.useState(!1),Ee=()=>{E(B),x(1)},Xe=l.useMemo(()=>F?Object.keys(F.models_summary).sort():[],[F]),yt=l.useMemo(()=>[{value:"",label:"All models"},...Xe.map(Ne=>({value:Ne,label:Ne}))],[Xe]);if(F){const{run:Ne,summary:Le,prompt_runs:Ue}=F,We=Le.failed;return t.jsxs(xee,{children:[t.jsxs(bee,{children:[t.jsxs(vee,{children:[t.jsxs(UPt,{onClick:()=>{Y(null),ee.current=null,oe(1),o(Qe=>{const ht=new URLSearchParams(Qe);return ht.delete("run_id"),ht},{replace:!0}),ce()},children:[t.jsx(Bd,{size:14})," Back to runs"]}),t.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",flexWrap:"wrap",gap:".5rem"},children:[t.jsxs(wee,{children:[t.jsx(gl,{size:18}),t.jsx("span",{children:Ne.project_name}),t.jsxs("span",{style:{fontWeight:600,color:z,fontSize:".85rem"},children:[Ne.bucket_kind," · ",Nee(Ne.bucket_start_on)]}),xE(Ne.status),t.jsx("span",{style:{fontSize:".68rem",fontWeight:600,color:z},children:Ne.triggered_by}),t.jsx($ee,{$live:le})]}),t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".4rem"},children:[n&&t.jsx(ly,{size:"sm",variant:"outline",value:Ne.status,disabled:!!se[`status-${Ne.id}`],onChange:Qe=>{Qe!==Ne.status&&De(Ne.id,Qe)},options:[{value:"pending",label:"pending"},{value:"running",label:"running"},{value:"succeeded",label:"succeeded"},{value:"failed",label:"failed"}]}),t.jsx(he,{size:"sm",variant:"outline",leftIcon:t.jsx(No,{size:14}),onClick:()=>{ee.current&&ie(ee.current)},children:"Refresh"}),n&&t.jsxs(Pee,{onClick:()=>Je(Qe=>!Qe),children:[t.jsx(wn,{size:11})," ",ge?"Hide":"Show"," help"]})]})]}),Ne.error_message&&t.jsxs(kee,{style:{marginTop:".5rem"},children:[t.jsx(ei,{size:12,style:{verticalAlign:"middle",marginRight:".25rem"}}),Ne.error_code,": ",Ne.error_message]}),t.jsxs(HPt,{children:[t.jsxs(Aj,{children:[t.jsx(Nj,{children:Le.total}),t.jsx(zj,{children:"Total"})]}),t.jsxs(Aj,{$bg:si,children:[t.jsx(Nj,{children:Le.succeeded}),t.jsx(zj,{children:"Succeeded"})]}),t.jsxs(Aj,{$bg:kn,children:[t.jsx(Nj,{children:Le.failed}),t.jsx(zj,{children:"Failed"})]}),t.jsxs(Aj,{$bg:$e,children:[t.jsx(Nj,{children:Le.running}),t.jsx(zj,{children:"Running"})]}),t.jsxs(Aj,{$bg:$e,children:[t.jsx(Nj,{children:Le.pending}),t.jsx(zj,{children:"Pending"})]})]}),t.jsx(Iee,{$open:ge,children:t.jsxs(Aee,{children:[t.jsx("strong",{children:"Button Reference"}),t.jsxs("ul",{children:[t.jsxs("li",{children:[t.jsx("strong",{children:"Retry N failed"})," â Re-enqueues only ",t.jsx("em",{children:"failed"})," prompt runs. Succeeded and running prompt runs are untouched."]}),t.jsxs("li",{children:[t.jsx("strong",{children:"Re-run all"}),' â Same as "Retry failed" but uses the scan job for scheduling. Only resets ',t.jsx("em",{children:"failed"})," prompt runs."]}),t.jsxs("li",{children:[t.jsx("strong",{children:"Reset all"})," â Resets ",t.jsx("em",{children:"every"})," prompt run (including succeeded and running) back to pending and restarts the entire project run from scratch."]}),t.jsxs("li",{children:[t.jsx("strong",{children:"Status dropdown (run level)"})," â Manually force the project run status. Use when a run is stuck."]}),t.jsxs("li",{children:[t.jsx("strong",{children:"Retry (row)"})," â Re-enqueues a single ",t.jsx("em",{children:"failed"})," prompt run."]}),t.jsxs("li",{children:[t.jsx("strong",{children:"Reset (row)"})," â Resets a single prompt run regardless of status (even succeeded) and re-enqueues it."]}),t.jsxs("li",{children:[t.jsx("strong",{children:"Status dropdown (row)"})," â Manually force a single prompt run's status."]})]})]})})]}),t.jsxs(jee,{children:[t.jsxs(_ee,{children:[t.jsx($j,{children:t.jsx(Fn,{size:"sm",fullWidth:!0,options:yee,value:K,onChange:Qe=>{G(Qe),oe(1)},dropdownPortal:!0})}),t.jsx($j,{children:t.jsx(Fn,{size:"sm",fullWidth:!0,options:yt,value:L,onChange:Qe=>{q(Qe),oe(1)},dropdownPortal:!0})}),n&&We>0&&t.jsxs(he,{size:"sm",variant:"outline",disabled:!!se[`failed-${Ne.id}`],leftIcon:t.jsx(vb,{size:12}),onClick:()=>Be(Ne.id),children:["Retry ",We," failed"]}),n&&t.jsx(he,{size:"sm",variant:"outline",disabled:!!se[`run-${Ne.id}`],leftIcon:t.jsx(eh,{size:12}),onClick:()=>Re(Ne.id),children:"Re-run all"}),n&&t.jsx(he,{size:"sm",variant:"danger",disabled:!!se[`reset-${Ne.id}`],leftIcon:t.jsx(Fi,{size:12}),onClick:()=>Me(Ne.id),children:"Reset all"})]}),H?t.jsx(Pj,{children:t.jsx(See,{size:20})}):X?t.jsx(Pj,{style:{color:oi},children:X}):Ue.length===0?t.jsx(Pj,{children:"No prompt runs found"}):t.jsxs(t.Fragment,{children:[t.jsx("div",{style:{overflowX:"auto"},children:t.jsxs(Cee,{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx(Rs,{children:"Prompt"}),t.jsx(Rs,{children:"Topic"}),t.jsx(Rs,{children:"Model"}),t.jsx(Rs,{children:"Status"}),t.jsx(Rs,{children:"Queue"}),t.jsx(Rs,{children:"Started"}),t.jsx(Rs,{children:"Duration"}),t.jsx(Rs,{children:"Visibility"}),t.jsx(Rs,{children:"Position"}),n&&t.jsx(Rs,{})]})}),t.jsx("tbody",{children:Ue.map(Qe=>t.jsxs(qPt,{$failed:Qe.status==="failed",children:[t.jsxs(Os,{children:[t.jsx("div",{style:{maxWidth:"16rem",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontWeight:600},children:Qe.prompt_content}),Qe.error_message&&t.jsxs(kee,{children:[Qe.error_code,": ",Qe.error_message]})]}),t.jsx(Os,{children:Qe.topic_name||"â"}),t.jsx(Os,{children:t.jsx("span",{style:{fontWeight:700,fontSize:".7rem"},children:Qe.model_key})}),t.jsx(Os,{children:t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[xE(Qe.status),n&&t.jsx(ly,{size:"sm",variant:"ghost",iconOnly:!0,value:Qe.status,disabled:!!se[`status-pr-${Qe.id}`],onChange:ht=>{ht!==Qe.status&&te(Qe.id,ht)},leftIcon:t.jsx(Lc,{size:11}),options:[{value:"pending",label:"pending"},{value:"running",label:"running"},{value:"succeeded",label:"succeeded"},{value:"failed",label:"failed"}]})]})}),t.jsx(Os,{children:t.jsx("span",{style:{fontSize:".65rem",fontWeight:600,color:z},children:Qe.queue||"â"})}),t.jsx(Os,{style:{whiteSpace:"nowrap",fontSize:".65rem",color:z},children:zee(Qe.started_at)}),t.jsx(Os,{children:Yue(Qe.duration_seconds)}),t.jsx(Os,{children:Qe.visibility_score!=null?Qe.visibility_score.toFixed(1):"â"}),t.jsx(Os,{children:Qe.position??"â"}),n&&t.jsx(Os,{children:t.jsxs("div",{style:{display:"flex",gap:4,alignItems:"center"},children:[t.jsx(he,{size:"sm",variant:"danger",disabled:!!se[`reset-pr-${Qe.id}`],leftIcon:t.jsx(Fi,{size:12}),onClick:()=>Se(Qe.id),children:"Reset"}),Qe.status==="failed"&&t.jsx(he,{size:"sm",variant:"outline",disabled:!!se[`pr-${Qe.id}`],leftIcon:t.jsx(vb,{size:12}),onClick:()=>tt(Qe.id),children:"Retry"})]})})]},Qe.id))})]})}),F.prompt_runs_total_pages>1&&t.jsx(pi,{page:W,totalPages:F.prompt_runs_total_pages,total:F.prompt_runs_total,onPrev:()=>
23673oe(Qe=>Math.max(1,Qe-1)),onNext:()=>oe(Qe=>Math.min(F.prompt_runs_total_pages,Qe+1)),compact:!0})]})]})]}),t.jsx(Hn,{isOpen:!!dt,onClose:()=>je(null),title:dt?.type==="run"?"Reset Entire Project Run?":"Reset Prompt Run?",size:"sm",footer:t.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end"},children:[t.jsx(he,{size:"sm",variant:"outline",onClick:()=>je(null),children:"Cancel"}),t.jsx(he,{size:"sm",variant:"danger",onClick:it,children:"Reset"})]}),children:t.jsx("div",{style:{fontSize:".85rem",lineHeight:1.6,color:O},children:dt?.type==="run"?t.jsxs(t.Fragment,{children:["This will reset ",t.jsx("strong",{children:"all"})," prompt runs in this project run back to ",t.jsx("strong",{children:"pending"})," and restart from scratch.",t.jsx("br",{}),t.jsx("br",{}),t.jsx("strong",{children:"Succeeded, running, and pending prompt runs will all be re-enqueued."})," This cannot be undone."]}):t.jsxs(t.Fragment,{children:["This will reset this prompt run back to ",t.jsx("strong",{children:"pending"})," regardless of its current status and re-enqueue it.",t.jsx("br",{}),t.jsx("br",{}),"If the prompt run already succeeded, its results will be overwritten."]})})})]})}return t.jsxs(xee,{children:[t.jsxs(bee,{children:[t.jsxs(vee,{children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:".75rem"},children:[t.jsxs(wee,{children:[t.jsx(gl,{size:18}),t.jsx("span",{children:"Run Monitor"}),t.jsx($ee,{$live:le}),t.jsx("span",{style:{fontSize:".7rem",fontWeight:600,color:le?Vt:Pe},children:le?"Live":"Connecting..."})]}),t.jsx(rh,{value:M,onChange:Ne=>{R(Ne),x(1),o(Le=>{const Ue=new URLSearchParams(Le);return Ne.start?Ue.set("date",Ne.start):Ue.delete("date"),Ue},{replace:!0})},singleDay:!0})]}),t.jsxs(TPt,{children:["Monitor nightly scan runs, view progress",n?", and retry failed prompt runs":"","."]}),n&&t.jsxs("div",{style:{marginTop:".5rem"},children:[t.jsxs(Pee,{onClick:()=>Je(Ne=>!Ne),children:[t.jsx(wn,{size:11})," ",ge?"Hide":"Show"," button reference"]}),t.jsx(Iee,{$open:ge,children:t.jsxs(Aee,{children:[t.jsx("strong",{children:"Button Reference"}),t.jsxs("ul",{children:[t.jsxs("li",{children:[t.jsx("strong",{children:"Retry N"})," (list row) â Re-enqueues only ",t.jsx("em",{children:"failed"})," prompt runs in that project run. Succeeded runs are untouched."]}),t.jsxs("li",{children:[t.jsx("strong",{children:"Reset"})," (list row) â Resets ",t.jsx("em",{children:"all"})," prompt runs (including succeeded) back to pending and restarts the project run from scratch."]})]}),t.jsx("div",{style:{marginTop:".25rem",color:z},children:"Click into a run for more actions: retry individual prompt runs, reset individual prompt runs, or manually change statuses."})]})})]})]}),ne&&t.jsxs(GPt,{children:[t.jsxs(VPt,{onClick:()=>we(Ne=>!Ne),children:[t.jsxs(KPt,{children:[t.jsx(Eu,{size:15}),"Overall Summary",t.jsxs("span",{style:{fontWeight:600,fontSize:".72rem",color:Pe},children:[ne.totals.total.toLocaleString()," prompt runs"]})]}),t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".35rem"},children:[t.jsx(he,{size:"sm",variant:"outline",leftIcon:t.jsx(No,{size:14}),onClick:Ne=>{Ne.stopPropagation(),Ke()},children:"Refresh"}),_e?t.jsx(yu,{size:15,color:Pe}):t.jsx(qn,{size:15,color:Pe})]})]}),_e&&t.jsxs(t.Fragment,{children:[t.jsxs(YPt,{children:[t.jsxs(Tj,{$bg:At,$color:O,children:[t.jsx(Ej,{children:ne.totals.total.toLocaleString()}),t.jsx(Mj,{children:"Total"})]}),t.jsxs(Tj,{$bg:si,$color:Vt,children:[t.jsx(Ej,{children:(ne.totals.succeeded||0).toLocaleString()}),t.jsx(Mj,{children:"Succeeded"})]}),t.jsxs(Tj,{$bg:kn,$color:oi,children:[t.jsx(Ej,{children:(ne.totals.failed||0).toLocaleString()}),t.jsx(Mj,{children:"Failed"})]}),t.jsxs(Tj,{$bg:$e,$color:ot,children:[t.jsx(Ej,{children:(ne.totals.running||0).toLocaleString()}),t.jsx(Mj,{children:"Running"})]}),t.jsxs(Tj,{$bg:$e,$color:z,children:[t.jsx(Ej,{children:(ne.totals.pending||0).toLocaleString()}),t.jsx(Mj,{children:"Pending"})]})]}),t.jsx(XPt,{children:Object.entries(ne.by_model).sort(([Ne],[Le])=>Ne.localeCompare(Le)).map(([Ne,Le])=>{const Ue=Object.values(Le).reduce((rt,ze)=>rt+ze,0),We=Le.succeeded||0,Qe=Le.failed||0,ht=Le.running||0,pe=Le.pending||0,be=PPt[Ne]||Pe;return t.jsxs(QPt,{$accent:be,children:[t.jsx(ZPt,{children:IPt[Ne]||Ne}),t.jsxs(eAt,{children:[t.jsx(yE,{$w:Ue?We/Ue*100:0,$color:"#22c55e"}),t.jsx(yE,{$w:Ue?ht/Ue*100:0,$color:"#3b82f6"}),t.jsx(yE,{$w:Ue?Qe/Ue*100:0,$color:"#ef4444"})]}),t.jsxs(JPt,{children:[t.jsxs(Wg,{$color:"#22c55e",children:[We.toLocaleStr
23673ing()," ok"]}),t.jsx(Wg,{$color:Pe,children:"/"}),t.jsxs(Wg,{$color:"#3b82f6",children:[ht.toLocaleString()," run"]}),t.jsx(Wg,{$color:Pe,children:"/"}),t.jsxs(Wg,{$color:"#ef4444",children:[Qe.toLocaleString()," fail"]}),pe>0&&t.jsxs(t.Fragment,{children:[t.jsx(Wg,{$color:Pe,children:"/"}),t.jsxs(Wg,{$color:z,children:[pe.toLocaleString()," pend"]})]})]})]},Ne)})})]})]}),t.jsxs(jee,{children:[t.jsxs(_ee,{children:[t.jsx($j,{children:t.jsx(Fn,{size:"sm",fullWidth:!0,options:yee,value:_,onChange:Ne=>{$(Ne),x(1)},dropdownPortal:!0})}),t.jsx($j,{children:t.jsx(Fn,{size:"sm",fullWidth:!0,options:APt,value:k,onChange:Ne=>{P(Ne),x(1)},dropdownPortal:!0})}),t.jsx($j,{children:t.jsx(Fn,{size:"sm",fullWidth:!0,options:NPt,value:S,onChange:Ne=>{I(Ne),x(1)},dropdownPortal:!0})}),t.jsxs(EPt,{children:[t.jsx(MPt,{children:t.jsx(Cs,{size:14})}),t.jsx(RPt,{placeholder:"Search by name or ID...",value:B,onChange:Ne=>T(Ne.target.value),onKeyDown:Ne=>{Ne.key==="Enter"&&Ee()}}),(B||A)&&t.jsx(OPt,{onClick:()=>{T(""),E(""),x(1)},children:t.jsx(Ei,{size:13})})]}),t.jsxs(WPt,{children:[j," run",j!==1?"s":""]}),t.jsx(he,{size:"sm",variant:"outline",disabled:c,leftIcon:t.jsx(No,{size:14}),onClick:()=>ce(),children:"Refresh"})]}),m&&t.jsx("div",{style:{color:oi,fontWeight:650,fontSize:".875rem",marginBottom:".5rem"},children:m}),c&&s.length===0?t.jsx(Pj,{children:t.jsx(See,{size:20})}):s.length===0?t.jsx(Pj,{children:"No project runs found"}):t.jsxs(t.Fragment,{children:[t.jsx("div",{style:{overflowX:"auto"},children:t.jsxs(Cee,{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx(Rs,{children:"Project"}),t.jsx(Rs,{children:t.jsx(at,{content:"The calendar day this scan covers. Scans run overnight after the day ends, so the start time may fall on the next day.",size:"sm",children:t.jsx("span",{style:{cursor:"help",borderBottom:"1px dashed currentColor"},children:"Scan date"})})}),t.jsx(Rs,{children:"Status"}),t.jsx(Rs,{children:"Progress"}),t.jsx(Rs,{children:"Duration"}),t.jsx(Rs,{children:"Trigger"}),t.jsx(Rs,{children:"Started"}),n&&t.jsx(Rs,{})]})}),t.jsx("tbody",{children:s.map(Ne=>{const Le=Ne.prompt_runs_total||1,Ue=Ne.prompt_runs_succeeded/Le*100,We=Ne.prompt_runs_failed/Le*100,Qe=Ne.prompt_runs_running/Le*100;return t.jsxs(DPt,{onClick:()=>{oe(1),ie(Ne.id,{page:1})},children:[t.jsxs(Os,{children:[t.jsx("div",{style:{fontWeight:700},children:Ne.project_name}),t.jsxs("div",{style:{fontSize:".65rem",color:Pe},children:["ID: ",Ne.project_id]})]}),t.jsxs(Os,{children:[t.jsx("div",{style:{fontWeight:700},children:Nee(Ne.bucket_start_on)}),t.jsx("div",{style:{fontSize:".65rem",color:Pe},children:Ne.bucket_kind})]}),t.jsx(Os,{children:xE(Ne.status)}),t.jsx(Os,{children:t.jsxs(LPt,{children:[t.jsxs(BPt,{children:[t.jsx(gE,{$w:Ue,$color:"#22c55e"}),t.jsx(gE,{$w:Qe,$color:"#3b82f6"}),t.jsx(gE,{$w:We,$color:"#ef4444"})]}),t.jsxs(FPt,{children:[Ne.prompt_runs_succeeded,"/",Le]})]})}),t.jsx(Os,{style:{whiteSpace:"nowrap",fontSize:".72rem"},children:tAt(Ne)}),t.jsx(Os,{children:t.jsx("span",{style:{fontSize:".68rem",fontWeight:600},children:Ne.triggered_by})}),t.jsx(Os,{style:{whiteSpace:"nowrap",fontSize:".65rem",color:z},children:zee(Ne.started_at)}),n&&t.jsx(Os,{children:t.jsxs("div",{style:{display:"flex",gap:4,alignItems:"center"},children:[t.jsx(he,{size:"sm",variant:"danger",disabled:!!se[`reset-${Ne.id}`],leftIcon:t.jsx(Fi,{size:12}),onClick:ht=>{ht.stopPropagation(),Me(Ne.id)},children:"Reset"}),Ne.prompt_runs_failed>0&&t.jsxs(he,{size:"sm",variant:"outline",disabled:!!se[`failed-${Ne.id}`],leftIcon:t.jsx(vb,{size:12}),onClick:ht=>{ht.stopPropagation(),Be(Ne.id)},children:["Retry ",Ne.prompt_runs_failed]})]})})]},Ne.id)})})]})}),t.jsx(pi,{page:g,totalPages:y,total:j,onPrev:()=>x(Ne=>Math.max(1,Ne-1)),onNext:()=>x(Ne=>Math.min(y,Ne+1)),compact:!0})]})]})]}),t.jsx(Hn,{isOpen:!!dt,onClose:()=>je(null),title:dt?.type==="run"?"Reset Entire Project Run?":"Reset Prompt Run?",size:"sm",footer:t.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end"},children:[t.jsx(he,{size:"sm",variant:"outline",onClick:()=>je(null),children:"Cancel"}),t.jsx(he,{size:"sm",variant:"danger",onClick:it,children:"Reset"})]}),children:t.jsx("div",{style:{fontSize:".85rem",lineHeight:1.6,color:O},children:dt?.type==="run"?t.jsxs(t.Fragment,{children:["This will reset ",t.jsx("strong",{children:"all"})," prompt runs in this project run back to ",t.jsx("strong",{children:"pending"})," and restart from scratch.",t.jsx("br",{}),t.jsx("br",{}),t.jsx("strong",{children:"Succeeded, running, and pending prompt runs will all be re-enqueued."})," This cannot be undone."]}):t.jsxs(t.Fragment,{children:["This will reset this prompt run back to ",t.jsx("strong",{children:"pending"})," regardless of its current status and re-enqueue it.",t.jsx("br",{}),t.jsx("br",{}),"If the prompt run already succeeded, its results will be overwritten."]})})})]})}const iAt=Tn` 23674 from { opacity: 0; transform: translateY(6px); } 23675 to { opacity: 1; transform: translateY(0); } 23676`,rAt=p.div.withConfig({displayName:"AdminCosts__Wrap",componentId:"sc-17k0nnb-0"})` 23677 padding: 1.25rem 1.25rem 2rem; 23678 min-height: 100%; 23679 background: ${At}; 23680 color: ${O}; 23681`,oAt=p.div.withConfig({displayName:"AdminCosts__Max",componentId:"sc-17k0nnb-1"})`max-width: 72rem; margin: 0 auto;`,sAt=p.div.withConfig({displayName:"AdminCosts__Hero",componentId:"sc-17k0nnb-2"})` 23682 background: ${Z}; 23683 border: 1px solid ${Rt}; 23684 box-shadow: 0 16px 40px rgba(17, 24, 39, 0.08); 23685 border-radius: 1rem; 23686 padding: 1.25rem; 23687 animation: ${iAt} 180ms ease both; 23688`,aAt=p.div.withConfig({displayName:"AdminCosts__HeroTop",componentId:"sc-17k0nnb-3"})` 23689 display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; 23690`,lAt=p.div.withConfig({displayName:"AdminCosts__TitleRow",componentId:"sc-17k0nnb-4"})` 23691 display: inline-flex; align-items: center; gap: 0.625rem; 23692 color: ${O}; font-weight: 800; font-size: 1.125rem; 23693`,cAt=p.div.withConfig({displayName:"AdminCosts__Sub",componentId:"sc-17k0nnb-5"})` 23694 margin-top: 0.35rem; color: ${z}; font-size: 0.8rem; 23695`,Tee=p.div.withConfig({displayName:"AdminCosts__StatsGrid",componentId:"sc-17k0nnb-6"})` 23696 display: grid; 23697 grid-template-columns: repeat(5, 1fr); 23698 gap: 0.75rem; 23699 margin-top: 1rem; 23700 @media (max-width: 768px) { grid-template-columns: repeat(3, 1fr); } 23701 @media (max-width: 640px) { grid-template-columns: repeat(2, 1fr); } 23702`,Qx=p.div.withConfig({displayName:"AdminCosts__StatCard",componentId:"sc-17k0nnb-7"})` 23703 padding: 0.75rem 1rem; 23704 border-radius: 0.75rem; 23705 background: ${At}; 23706 border: 1px solid ${V}; 23707`,Rj=p.div.withConfig({displayName:"AdminCosts__StatValue",componentId:"sc-17k0nnb-8"})` 23708 font-size: 1.35rem; font-weight: 900; color: ${O}; line-height: 1.2; 23709`,Oj=p.div.withConfig({displayName:"AdminCosts__StatLabel",componentId:"sc-17k0nnb-9"})` 23710 font-size: 0.65rem; font-weight: 700; color: ${Pe}; 23711 text-transform: uppercase; letter-spacing: 0.04em; margin-top: 0.2rem; 23712`,lu=p.h2.withConfig({displayName:"AdminCosts__SectionTitle",componentId:"sc-17k0nnb-10"})` 23713 font-size: 0.9rem; font-weight: 700; color: ${O}; 23714 margin: 0 0 0.75rem; 23715`,dAt=p.div.withConfig({displayName:"AdminCosts__ChartCard",componentId:"sc-17k0nnb-11"})` 23716 border: 1px solid ${V}; 23717 background: ${Z}; 23718 border-radius: 0.75rem; 23719 padding: 1rem 1.25rem; 23720 margin-bottom: 1.5rem; 23721`,bE=p.div.withConfig({displayName:"AdminCosts__Row2",componentId:"sc-17k0nnb-12"})` 23722 display: grid; 23723 grid-template-columns: 1fr 1fr; 23724 gap: 1rem; 23725 margin-bottom: 1.5rem; 23726 @media (max-width: 768px) { grid-template-columns: 1fr; } 23727`,yp=p.div.withConfig({displayName:"AdminCosts__TableCard",componentId:"sc-17k0nnb-13"})` 23728 border: 1px solid ${V}; 23729 background: ${Z}; 23730 border-radius: 0.75rem; 23731 overflow: hidden; 23732 margin-bottom: 1.5rem; 23733`,wm=p.table.withConfig({displayName:"AdminCosts__Table",componentId:"sc-17k0nnb-14"})`width: 100%; border-collapse: collapse;`,Zi=p.th.withConfig({displayName:"AdminCosts__Th",componentId:"sc-17k0nnb-15"})` 23734 text-align: left; padding: 0.5rem 0.75rem; font-size: 0.65rem; font-weight: 600; 23735 color: ${Pe}; text-transform: uppercase; letter-spacing: 0.04em; 23736 border-bottom: 1px solid ${$e}; white-space: nowrap; 23737`,Oa=p.td.withConfig({displayName:"AdminCosts__Td",componentId:"sc-17k0nnb-16"})` 23738 padding: 0.55rem 0.75rem; font-size: 0.775rem; color: ${O}; 23739 border-bottom: 1px solid ${$e}; vertical-align: middle; 23740`,Lr=p(Oa).withConfig({displayName:"AdminCosts__TdRight",componentId:"sc-17k0nnb-17"})`text-align: right; font-variant-numeric: tabular-nums;`,uAt={gemini:"#4F46E5",brightdata:"#f59e0b",cloro:"#10b981",dataforseo:"#3b82f6",google_places:"#ea4335",loops:"#8b5cf6"},Y2=e=>uAt[e]||Pe,pAt=p.div.withConfig({displayName:"AdminCosts__CreditsSectionWrap",componentId:"sc-17k0nnb-18"})` 23741 margin-bottom: 1.5rem; 23742`,mAt=p.div.withConfig({displayName:"AdminCosts__CreditsHero",componentId:"sc-17k0nnb-19"})` 23743 display: flex; align-items: center; justify-content: space-between; 23744 padding: 0.75rem 1rem 0; 23745`,hAt=p.div.withConfig({displayName:"AdminCosts__CreditsStatsRow",componentId:"sc-17k0nnb-20"})` 23746 display: grid; 23747 grid-template-columns: repeat(4, 1fr); 23748 gap: 0.5rem; 23749 padding: 0.75rem 1rem; 23750 @media (max-width: 640px) { grid-template-columns: repeat(2, 1fr); } 23751`,X2=p.div.withConfig({displayName:"AdminCosts__CreditsMiniCard",componentId:"sc-17k0nnb-21"})` 23752 padding: 0.5rem 0.75rem; 23753 border-radius: 0.5rem; 23754 background: ${At}; 23755 border: 1px solid ${V}; 23756`,Q2=p.div.withConfig({displayName:"AdminCosts__CreditsMiniValue",componentId:"sc-17k0nnb-22"})` 23757 font-size: 1.1rem; font-weight: 900; color: ${O}; line-height: 1.2; 23758`,Z2=p.div.withConfig({displayName:"AdminCosts__CreditsMiniLabel",componentId:"sc-17k0nnb-23"})` 23759 font-size: 0.6rem; font-weight: 700; color: ${Pe}; 23760 text-transform: uppercase; letter-spacing: 0.04em; margin-top: 0.1rem; 23761`,fAt="#8b5cf6",gAt={chatgpt:"ChatGPT",perplexity:"Perplexity",gemini:"Gemini",google_ai_mode:"AI Mode",google_ai_overview:"AI Overview",grok:"Grok",copilot:"Copilot"},yAt={chatgpt:7,perplexity:3,grok:4,google_ai_mode:4,google_ai_overview:5,gemini:4,copilot:3};function Yh(e){return e>=1?`$${e.toFixed(2)}`:e>=.01?`$${e.toFixed(3)}`:`$${e.toFixed(4)}`}function Ji(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function xAt(e){return e.replace(/_/g," ").replace(/\b\w/g,n=>n.toUpperCase())}function Eee(e){return e==="google_places"?"Google Places":e.replace(/_/g," ").replace(/\b\w/g,n=>n.toUpperCase())}function bAt(e){return e.replace(/_/g," ").replace(/\b\w/g,n=>n.toUpperCase())}function vAt(e,n){const i={};for(const r of e)i[r.date]={date_raw:0};for(const r of n)i[r.date]||(i[r.date]={}),i[r.date][r.provider]=r.cost;return Object.entries(i).sort(([r],[o])=>r.localeCompare(o)).map(([r,o])=>({date:r,...o}))}function wAt(){const e=new Date,n=`${e.getFullYear()}
23761-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`,i=new Date(e);return i.setDate(i.getDate()-6),{start:`${i.getFullYear()}-${String(i.getMonth()+1).padStart(2,"0")}-${String(i.getDate()).padStart(2,"0")}`,end:n}}function jAt(){const[e,n]=l.useState(null),[i,r]=l.useState(!0),[o,s]=l.useState(wAt),a=l.useRef(0),c=l.useCallback(async()=>{const h=++a.current;r(!0),n(null);try{const g=new URLSearchParams;o.start&&g.set("date_from",o.start),o.end&&g.set("date_to",o.end);const x=await ue(`/api/v1/admin/costs?${g}`);if(h!==a.current)return;const y=await x.json().catch(()=>({}));if(h!==a.current)return;x.ok&&y.costs&&n(y.costs)}catch{}finally{h===a.current&&r(!1)}},[o]);l.useEffect(()=>{c()},[c]);const u=l.useMemo(()=>e?[...new Set(e.daily_by_provider.map(h=>h.provider))]:[],[e]),m=l.useMemo(()=>e?vAt(e.daily,e.daily_by_provider):[],[e]);return t.jsx(rAt,{children:t.jsxs(oAt,{children:[t.jsxs(sAt,{children:[t.jsxs(aAt,{children:[t.jsxs("div",{children:[t.jsxs(lAt,{children:[t.jsx(K8,{size:18}),t.jsx("span",{children:"Cost Tracker"})]}),t.jsx(cAt,{children:"API spend across all providers"})]}),t.jsx(rh,{value:o,onChange:s})]}),i?t.jsx(Tee,{children:[1,2,3,4,5].map(h=>t.jsxs(Qx,{children:[t.jsx(nt,{height:"1.8rem",width:"60%"}),t.jsx(nt,{height:"0.5rem",width:"40%",style:{marginTop:"0.4rem"}})]},h))}):e?t.jsxs(Tee,{children:[t.jsxs(Qx,{children:[t.jsx(Rj,{children:Yh(e.totals.cost_usd)}),t.jsx(Oj,{children:"Total Spend"})]}),t.jsxs(Qx,{children:[t.jsx(Rj,{children:Ji(e.totals.events)}),t.jsx(Oj,{children:"API Calls"})]}),t.jsxs(Qx,{children:[t.jsx(Rj,{children:Ji(e.totals.input_tokens)}),t.jsx(Oj,{children:"Input Tokens"})]}),t.jsxs(Qx,{children:[t.jsx(Rj,{children:Ji(e.totals.output_tokens)}),t.jsx(Oj,{children:"Output Tokens"})]}),t.jsxs(Qx,{children:[t.jsx(Rj,{children:Ji(e.platform_credits?.total_used??0)}),t.jsx(Oj,{children:"Platform Credits Used"})]})]}):t.jsx("div",{style:{textAlign:"center",padding:"2rem 0 0.5rem",color:Pe,fontSize:"0.8rem"},children:"No cost data yet. Events will appear once API calls are tracked."})]}),i?t.jsx(nt,{height:"14rem",width:"100%",style:{borderRadius:"0.75rem",marginTop:"1rem"}}):e?t.jsxs(t.Fragment,{children:[t.jsxs(dAt,{style:{marginTop:"1rem"},children:[t.jsx(lu,{children:"Daily Spend by Provider"}),t.jsx(Gl,{width:"100%",height:220,children:t.jsxs(zC,{data:m,margin:{top:5,right:10,left:-10,bottom:0},children:[t.jsx(Zm,{strokeDasharray:"3 3",stroke:$e}),t.jsx(Ql,{dataKey:"date",tick:{fontSize:11,fill:Pe},tickFormatter:h=>{const g=new Date(h);return`${g.getMonth()+1}/${g.getDate()}`},axisLine:{stroke:V},tickLine:!1}),t.jsx(Zl,{tick:{fontSize:11,fill:Pe},tickFormatter:h=>`$${h.toFixed(2)}`,axisLine:!1,tickLine:!1}),t.jsx(Vl,{content:({active:h,payload:g,label:x})=>{if(!h||!g?.length)return null;const y=new Date(x);return t.jsxs("div",{style:{background:Z,border:`1px solid ${V}`,borderRadius:6,padding:"0.5rem 0.75rem",fontSize:"0.75rem",color:O},children:[t.jsx("div",{style:{color:z,marginBottom:4},children:y.toLocaleDateString(void 0,{month:"short",day:"numeric"})}),g.filter(w=>w.value>0).map(w=>t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginTop:2},children:[t.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:w.color,flexShrink:0}}),Eee(String(w.dataKey)),": ",Yh(w.value)]},w.dataKey))]})}}),u.map(h=>t.jsx(jf,{type:"monotone",dataKey:h,stackId:"1",stroke:Y2(h),fill:Y2(h),fillOpacity:.4},h))]})})]}),t.jsxs(bE,{children:[t.jsxs(yp,{children:[t.jsx("div",{style:{padding:"0.75rem 1rem 0"},children:t.jsx(lu,{style:{margin:0},children:"By Provider"})}),t.jsxs(wm,{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx(Zi,{children:"Provider"}),t.jsx(Zi,{style:{textAlign:"right"},children:"Events"}),t.jsx(Zi,{style:{textAlign:"right"},children:"Cost"})]})}),t.jsx("tbody",{children:[...e.by_provider].sort((h,g)=>g.cost-h.cost).map(h=>t.jsxs("tr",{children:[t.jsx(Oa,{children:t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[t.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:Y2(h.provider),flexShrink:0}}),t.jsx("span",{style:{fontWeight:700},children:Eee(h.provider)})]})}
23761),t.jsx(Lr,{children:Ji(h.count)}),t.jsx(Lr,{style:{fontWeight:600},children:Yh(h.cost)})]},h.provider))})]})]}),t.jsxs(yp,{children:[t.jsx("div",{style:{padding:"0.75rem 1rem 0"},children:t.jsx(lu,{style:{margin:0},children:"By Event Type"})}),t.jsxs(wm,{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx(Zi,{children:"Event Type"}),t.jsx(Zi,{style:{textAlign:"right"},children:"Events"}),t.jsx(Zi,{style:{textAlign:"right"},children:"Cost"})]})}),t.jsx("tbody",{children:[...e.by_event_type].sort((h,g)=>g.cost-h.cost).map(h=>t.jsxs("tr",{children:[t.jsx(Oa,{style:{fontWeight:600},children:xAt(h.event_type)}),t.jsx(Lr,{children:Ji(h.count)}),t.jsx(Lr,{style:{fontWeight:600},children:Yh(h.cost)})]},h.event_type))})]})]})]}),e.cloro_credits&&e.cloro_credits.total_events>0&&t.jsxs(yp,{children:[t.jsxs("div",{style:{padding:"0.75rem 1rem 0",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[t.jsx(lu,{style:{margin:0},children:t.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[t.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:Y2("cloro"),flexShrink:0}}),"Cloro Credits"]})}),t.jsxs("span",{style:{fontSize:"0.72rem",fontWeight:700,color:Pe},children:[Ji(e.cloro_credits.total_credits)," credits · ",Ji(e.cloro_credits.total_events)," requests"]})]}),t.jsxs(wm,{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx(Zi,{children:"Model"}),t.jsx(Zi,{style:{textAlign:"right"},children:"Requests"}),t.jsx(Zi,{style:{textAlign:"right"},children:"Credits / req"}),t.jsx(Zi,{style:{textAlign:"right"},children:"Total Credits"}),t.jsx(Zi,{style:{textAlign:"right"},children:"Cost"})]})}),t.jsxs("tbody",{children:[e.cloro_credits.by_model.map(h=>t.jsxs("tr",{children:[t.jsx(Oa,{style:{fontWeight:700},children:gAt[h.model_key]||h.model_key}),t.jsx(Lr,{children:Ji(h.count)}),t.jsx(Lr,{style:{color:z},children:yAt[h.model_key]??"â"}),t.jsx(Lr,{children:Ji(h.credits)}),t.jsx(Lr,{style:{fontWeight:600},children:Yh(h.cost)})]},h.model_key)),t.jsxs("tr",{style:{borderTop:`2px solid ${V}`},children:[t.jsx(Oa,{style:{fontWeight:800},children:"Total"}),t.jsx(Lr,{style:{fontWeight:700},children:Ji(e.cloro_credits.total_events)}),t.jsx(Lr,{}),t.jsx(Lr,{style:{fontWeight:700},children:Ji(e.cloro_credits.total_credits)}),t.jsx(Lr,{style:{fontWeight:800},children:Yh(e.cloro_credits.by_model.reduce((h,g)=>h+g.cost,0))})]})]})]})]}),e.platform_credits&&t.jsxs(pAt,{children:[t.jsxs(yp,{children:[t.jsxs(mAt,{children:[t.jsx(lu,{style:{margin:0},children:t.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[t.jsx(vy,{size:14,color:fAt}),"Platform Credits"]})}),t.jsxs("span",{style:{fontSize:"0.72rem",fontWeight:700,color:Pe},children:["Current month: ",new Date(e.platform_credits.current_month+"T00:00:00").toLocaleDateString(void 0,{month:"short",year:"numeric"})]})]}),t.jsxs(hAt,{children:[t.jsxs(X2,{children:[t.jsx(Q2,{children:Ji(e.platform_credits.total_included)}),t.jsx(Z2,{children:"Included (Plan)"})]}),t.jsxs(X2,{children:[t.jsx(Q2,{children:Ji(e.platform_credits.total_purchased)}),t.jsx(Z2,{children:"Purchased (Top-ups)"})]}),t.jsxs(X2,{children:[t.jsx(Q2,{children:Ji(e.platform_credits.total_used)}),t.jsx(Z2,{children:"Used"})]}),t.jsxs(X2,{children:[t.jsx(Q2,{style:{color:e.platform_credits.total_remaining>0?"#059669":"#dc2626"},children:Ji(e.platform_credits.total_remaining)}),t.jsx(Z2,{children:"Remaining"})]})]}),t.jsxs("div",{style:{padding:"0 1rem 0.25rem",display:"flex",gap:"1.5rem",fontSize:"0.72rem",color:Pe,fontWeight:600},children:[t.jsxs("span",{children:[e.platform_credits.active_orgs," active org",e.platform_credits.active_orgs!==1?"s":""]}),t.jsxs("span",{children:[Ji(e.platform_credits.period_events)," events in period"]}),t.jsxs("span",{children:[Ji(e.platform_credits.period_credits_consumed)," credits consumed in period"]})]})]}),e.platform_credits.by_reason.length>0&&t.jsxs(bE,{style:{marginTop:"0.75rem"},children:[t.jsxs(yp,{style:{marginBottom:0},children:[t.jsx("div",{style:{padding:"0.75rem 1rem 0"},children:t.jsx(lu,{style:{margin:0},children:"Credits by Reason"})}),t.jsxs(wm,{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx(Zi,{children:"Reason"}),t.jsx(Zi,{style:{textAlign:"right"},children:"Events"}),t.jsx(Zi,{style:{textAlign:"right"},children:"Credits"})]})}),t.jsx("tbody",{children:e.platform_credits.by_reason.map(h=>t.jsxs("tr",{children:[t.jsx(Oa,{style:{fontWeight:600},children:bAt(h.reason)}
23761),t.jsx(Lr,{children:Ji(h.events)}),t.jsx(Lr,{style:{fontWeight:600},children:Ji(h.credits)})]},h.reason))})]})]}),t.jsxs(yp,{style:{marginBottom:0},children:[t.jsx("div",{style:{padding:"0.75rem 1rem 0"},children:t.jsx(lu,{style:{margin:0},children:"Top Orgs by Credit Usage"})}),t.jsxs(wm,{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx(Zi,{children:"Organization"}),t.jsx(Zi,{style:{textAlign:"right"},children:"Events"}),t.jsx(Zi,{style:{textAlign:"right"},children:"Credits"})]})}),t.jsx("tbody",{children:e.platform_credits.top_organizations.length===0?t.jsx("tr",{children:t.jsx(Oa,{colSpan:3,style:{textAlign:"center",color:Pe},children:"No credit usage yet."})}):e.platform_credits.top_organizations.map(h=>t.jsxs("tr",{children:[t.jsx(Oa,{style:{fontWeight:600},children:h.organization_name}),t.jsx(Lr,{children:Ji(h.events)}),t.jsx(Lr,{style:{fontWeight:600},children:Ji(h.credits)})]},h.organization_id))})]})]})]}),t.jsxs(bE,{style:{marginTop:"0.75rem"},children:[e.platform_credits.chat_by_tier&&e.platform_credits.chat_by_tier.length>0&&t.jsxs(yp,{style:{marginBottom:0},children:[t.jsx("div",{style:{padding:"0.75rem 1rem 0"},children:t.jsx(lu,{style:{margin:0}
23761,children:"Chat Credits by Model Tier"})}),t.jsxs(wm,{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx(Zi,{children:"Tier"}),t.jsx(Zi,{style:{textAlign:"right"},children:"Messages"}),t.jsx(Zi,{style:{textAlign:"right"},children:"Credits"})]})}),t.jsx("tbody",{children:e.platform_credits.chat_by_tier.map(h=>t.jsxs("tr",{children:[t.jsx(Oa,{style:{fontWeight:700,textTransform:"capitalize"},children:h.tier}),t.jsx(Lr,{children:Ji(h.events)}),t.jsx(Lr,{style:{fontWeight:600},children:Ji(h.credits)})]},h.tier))})]})]}),e.platform_credits.addon_breakdown&&t.jsxs(yp,{style:{marginBottom:0},children:[t.jsx("div",{style:{padding:"0.75rem 1rem 0"},children:t.jsx(lu,{style:{margin:0},children:"Add-on Reservations"})}),t.jsxs(wm,{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx(Zi,{children:"Type"}),t.jsx(Zi,{style:{textAlign:"right"},children:"Events"}),t.jsx(Zi,{style:{textAlign:"right"},children:"Credits"})]})}),t.jsxs("tbody",{children:[t.jsxs("tr",{children:[t.jsx(Oa,{style:{fontWeight:600},children:"Full month"}),t.jsx(Lr,{children:Ji(e.platform_credits.addon_breakdown.full_month.events)}),t.jsx(Lr,{style:{fontWeight:600},children:Ji(e.platform_credits.addon_breakdown.full_month.credits)})]}),t.jsxs("tr",{children:[t.jsx(Oa,{style:{fontWeight:600},children:"Prorated (mid-month)"}),t.jsx(Lr,{children:Ji(e.platform_credits.addon_breakdown.prorated.events)}),t.jsx(Lr,{style:{fontWeight:600},children:Ji(e.platform_credits.addon_breakdown.prorated.credits)})]})]})]})]})]})]}),t.jsx(lu,{children:"Top Projects by Spend"}),t.jsx(yp,{children:t.jsxs(wm,{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx(Zi,{children:"Project"}),t.jsx(Zi,{children:"Organization"}),t.jsx(Zi,{style:{textAlign:"right"},children:"Events"}),t.jsx(Zi,{style:{textAlign:"right"},children:"Cost"})]})}),t.jsx("tbody",{children:e.top_projects.length===0?t.jsx("tr",{children:t.jsx(Oa,{colSpan:4,style:{textAlign:"center",color:Pe},children:"No project-level costs yet."})}):e.top_projects.map(h=>t.jsxs("tr",{children:[t.jsx(Oa,{style:{fontWeight:600},children:h.project_name}),t.jsx(Oa,{style:{color:z},children:h.organization_name}),t.jsx(Lr,{children:Ji(h.count)}),t.jsx(Lr,{style:{fontWeight:600},children:Yh(h.cost)})]},h.project_id))})]})}),t.jsx(lu,{children:"Top Organizations by Spend"}),t.jsx(yp,{children:t.jsxs(wm,{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx(Zi,{children:"Organization"}),t.jsx(Zi,{style:{textAlign:"right"},children:"Events"}),t.jsx(Zi,{style:{textAlign:"right"},children:"Cost"})]})}),t.jsx("tbody",{children:e.top_organizations.length===0?t.jsx("tr",{children:t.jsx(Oa,{colSpan:3,style:{textAlign:"center",color:Pe},children:"No organization-level costs yet."})}):e.top_organizations.map(h=>t.jsxs("tr",{children:[t.jsx(Oa,{style:{fontWeight:600},children:h.organization_name}),t.jsx(Lr,{children:Ji(h.count)}),t.jsx(Lr,{style:{fontWeight:600},children:Yh(h.cost)})]},h.organization_id))})]})})]}):null]})})}const _At=p.div.withConfig({displayName:"AdminResourceTabs__Tabs",componentId:"sc-wwk2qr-0"})` 23762 margin-top: 0.9rem; 23763 display: inline-flex; 23764 gap: 0.5rem; 23765 flex-wrap: wrap; 23766`,jm=p(Dn).withConfig({displayName:"AdminResourceTabs__Tab",componentId:"sc-wwk2qr-1"})` 23767 text-decoration: none; 23768 display: inline-flex; 23769 align-items: center; 23770 gap: 0.5rem; 23771 padding: 0.5rem 0.75rem; 23772 border-radius: 0.75rem; 23773 border: 1px solid ${V}; 23774 color: ${z}; 23775 font-weight: 750; 23776 font-size: 0.8125rem; 23777 background: ${Z}; 23778 23779 ${e=>e.$active?` 23780 color: ${ot}; 23781 border-color: rgba(79, 70, 229, 0.35); 23782 background: rgba(79, 70, 229, 0.08); 23783 box-shadow: inset 0 0 0 1px rgba(79, 70, 229, 0.14); 23784 `:""} 23785`;function CAt({resource:e,canSeeBilling:n}){return t.jsxs(_At,{children:[t.jsxs(jm,{to:"/admin/resources?resource=users",$active:e==="users",children:[t.jsx(Ap,{size:16}),"Users"]}),t.jsxs(jm,{to:"/admin/resources?resource=organizations",$active:e==="organizations",children:[t.jsx(by,{size:16}),"Workspaces"]}),t.jsxs(jm,{to:"/admin/resources?resource=projects",$active:e==="projects",children:[t.jsx(Y8,{size:16}),"Projects"]}
23785),t.jsxs(jm,{to:"/admin/resources?resource=competitors",$active:e==="competitors",children:[t.jsx($P,{size:16}),"Competitors"]}),t.jsxs(jm,{to:"/admin/resources?resource=citations",$active:e==="citations",children:[t.jsx(Mge,{size:16}),"Citations"]}),t.jsxs(jm,{to:"/admin/resources?resource=keyword_volumes",$active:e==="keyword_volumes",children:[t.jsx(Eu,{size:16}),"Keywords"]}),t.jsxs(jm,{to:"/admin/resources?resource=partners",$active:e==="partners",children:[t.jsx(Xye,{size:16}),"Partners"]}),t.jsxs(jm,{to:"/admin/resources?resource=growth&sub=lifecycle",$active:e==="growth",children:[t.jsx(qi,{size:16}),"Growth"]}),n?t.jsxs(jm,{to:"/admin/resources?resource=billing&sub=overview",$active:e==="billing",children:[t.jsx(wp,{size:16}),"Billing"]}):null]})}const SAt=p.div.withConfig({displayName:"BillingTabs__Wrap",componentId:"sc-7ogx7k-0"})` 23786 margin-top: 0.75rem; 23787 display: flex; 23788 flex-wrap: wrap; 23789 min-width: 0; 23790 max-width: 100%; 23791`,kAt=p.div.withConfig({displayName:"BillingTabs__Segmented",componentId:"sc-7ogx7k-1"})` 23792 display: inline-flex; 23793 flex-wrap: wrap; 23794 width: fit-content; 23795 max-width: 100%; 23796 align-self: flex-start; 23797 padding: 0.25rem; 23798 border-radius: 0.95rem; 23799 border: 1px solid ${V}; 23800 background: ${$e}; 23801 gap: 0.25rem; 23802`,J2=p(Dn).withConfig({displayName:"BillingTabs__Seg",componentId:"sc-7ogx7k-2"})` 23803 text-decoration: none; 23804 display: inline-flex; 23805 align-items: center; 23806 gap: 0.5rem; 23807 padding: 0.45rem 0.8rem; 23808 border-radius: 0.75rem; 23809 border: 1px solid transparent; 23810 color: ${z}; 23811 font-weight: 800; 23812 font-size: 0.8125rem; 23813 background: transparent; 23814 max-width: 100%; 23815 min-width: 0; 23816 23817 ${e=>e.$active?` 23818 color: ${ot}; 23819 border-color: rgba(79, 70, 229, 0.25); 23820 background: ${Z}; 23821 box-shadow: 0 1px 1px rgba(0,0,0,0.04); 23822 `:""} 23823`;function $At({isFullAdmin:e}){const[n]=yr(),i=String(n.get("sub")||"overview").toLowerCase(),r="/admin/resources?resource=billing";return t.jsx(SAt,{children:t.jsxs(kAt,{children:[t.jsxs(J2,{to:`${r}&sub=overview`,$active:i==="overview",children:[t.jsx(Eu,{size:16}),"Overview"]}),t.jsxs(J2,{to:`${r}&sub=subscriptions`,$active:i==="subscriptions",children:[t.jsx(wp,{size:16}),"Subscriptions"]}),e?t.jsxs(t.Fragment,{children:[t.jsxs(J2,{to:`${r}&sub=plans`,$active:i==="plans",children:[t.jsx($9,{size:16}),"Plans"]}),t.jsxs(J2,{to:`${r}&sub=discounts`,$active:i==="discounts",children:[t.jsx($9,{size:16}),"Discounts"]})]}):null]})})}const IAt=p.div.withConfig({displayName:"GrowthTabs__Wrap",componentId:"sc-9ibe48-0"})` 23824 margin-top: 0.75rem; 23825 display: flex; 23826 flex-wrap: wrap; 23827 min-width: 0; 23828 max-width: 100%; 23829`,PAt=p.div.withConfig({displayName:"GrowthTabs__Segmented",componentId:"sc-9ibe48-1"})` 23830 display: inline-flex; 23831 flex-wrap: wrap; 23832 width: fit-content; 23833 max-width: 100%; 23834 align-self: flex-start; 23835 padding: 0.25rem; 23836 border-radius: 0.95rem; 23837 border: 1px solid ${V}; 23838 background: ${$e}; 23839 gap: 0.25rem; 23840`,Mee=p(Dn).withConfig({displayName:"GrowthTabs__Seg",componentId:"sc-9ibe48-2"})` 23841 text-decoration: none; 23842 display: inline-flex; 23843 align-items: center; 23844 gap: 0.5rem; 23845 padding: 0.45rem 0.8rem; 23846 border-radius: 0.75rem; 23847 border: 1px solid transparent; 23848 color: ${z}; 23849 font-weight: 800; 23850 font-size: 0.8125rem; 23851 background: transparent; 23852 max-width: 100%; 23853 min-width: 0; 23854 23855 ${e=>e.$active?` 23856 color: ${ot}; 23857 border-color: rgba(79, 70, 229, 0.25); 23858 background: ${Z}; 23859 box-shadow: 0 1px 1px rgba(0,0,0,0.04); 23860 `:""} 23861`;function AAt(){const[e]=yr(),n=String(e.get("sub")||"lifecycle").toLowerCase(),i="/admin/resources?resource=growth";return t.jsx(IAt,{children:t.jsxs(PAt,{children:[t.jsxs(Mee,{to:`${i}&sub=lifecycle`,$active:n==="lifecycle",children:[t.jsx(qi,{size:16}),"Lifecycle"]}),t.jsxs(Mee,{to:`${i}&sub=limits`,$active:n==="limits",children:[t.jsx(Ene,{size:16}),"Limits"]})]})})}function NAt({subs:e,meta:n,selectedSubId:i,onPrev:r,onNext:o,listLoading:s,controls:a}){return t.jsxs("div",{style:{width:"100%",height:"100%",display:"flex",flexDirection:"column",minHeight:0,gap:10},children:[t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",gap:8},children:[t.jsx("div",{style:{fontWeight:950,color:O},children:"Subscriptions"}),t.jsxs("div",{style:{fontSize:"0.75rem",fontWeight:750,color:z},children:[n.total," total"]})]}),a?t.jsx("div",{children:a}):null,t.jsx("div",{style:{flex:1,minHeight:0,overflow:"auto",border:`1px solid ${V}`,borderRadius:12,background:Z},children:s?t.jsx("div",{style:{padding:12,display:"grid",gap:10},children:Array.from({length:8}).map((c,u)=>t.jsxs("div",{style:{display:"grid",gap:6},children:[t.jsx(nt,{height:14,width:`${74-u%4*8}%`}),t.jsx(nt,{height:10,width:`${56-u%3*10}%`})]},u))}):e.length?e.map(c=>{const u=i===c.id,m=[`#${c.id}`,c.organization_name?`org: ${c.organization_name}`:`org_id: ${c.organization_id}`,c.billing_exempt?"exempt":null,c.plan_code?`plan: ${c.plan_code}`:null,c.discount_code?`discount: ${c.discount_code}`:null,c.status?`status: ${c.status}`:null,c.billing_interval?`interval: ${c.billing_interval}
23861`:null].filter(Boolean);return t.jsxs(Dn,{to:`/admin/resources?resource=billing&sub=subscriptions&subscription_id=${c.id}`,style:{display:"block",padding:"10px 12px",textDecoration:"none",borderBottom:`1px solid ${$e}`,background:u?"rgba(79, 70, 229, 0.06)":"transparent"},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[t.jsx("span",{style:{color:O,fontWeight:900,fontSize:"0.875rem",lineHeight:1.15,wordBreak:"break-word"},children:c.organization_name||"Workspace"}),c.billing_exempt_reason==="sales_assisted_setup"?t.jsx("span",{style:{flexShrink:0,padding:"1px 6px",borderRadius:9999,fontSize:"0.6rem",fontWeight:900,letterSpacing:"0.03em",background:"rgba(79, 70, 229, 0.08)",color:"rgb(79, 70, 229)",border:"1px solid rgba(79, 70, 229, 0.18)",lineHeight:1.6},children:"Sales"}):null]}),t.jsx("div",{style:{marginTop:4,color:z,fontWeight:700,fontSize:"0.75rem",lineHeight:1.25},children:m.join(" ⢠")})]},c.id)}):t.jsx("div",{style:{padding:12,color:z,fontWeight:650,fontSize:"0.875rem"},children:"No subscriptions found."})}),t.jsx(pi,{page:n.page,totalPages:n.totalPages,total:n.total,onPrev:r,onNext:o,compact:!0})]})}function zAt({canEdit:e,loading:n,error:i,detail:r,cancelLoading:o,cancelError:s,exemptLoading:a,exemptError:c,grantCreditsLoading:u,grantCreditsError:m,onSetBillingExempt:h,onCancel:g,onUncancel:x,onOpenEntitlements:y,onGrantCredits:w,onBack:j}){const v=r?.provider==="polar";return t.jsxs("div",{style:{padding:14,border:`1px solid ${V}`,borderRadius:12,background:Z,display:"grid",gap:12,maxWidth:"100%",overflow:"hidden"},children:[t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:12,flexWrap:"wrap"},children:[t.jsxs("div",{style:{display:"grid",gap:2},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:2},children:[t.jsx("button",{type:"button",onClick:j,style:{all:"unset",cursor:"pointer",display:"inline-flex",alignItems:"center",color:z,borderRadius:4,marginLeft:-4},"aria-label":"Back to list",children:t.jsx(Bd,{size:18})}),t.jsx("span",{style:{fontWeight:950,color:O,fontSize:"1rem"},children:"Subscription"})]}),t.jsx("div",{style:{color:z,fontSize:"0.8125rem",fontWeight:700,wordBreak:"break-word"},children:r?`#${r.id} ⢠org #${r.organization_id} ⢠${r.status} ⢠${r.billing_interval}`:"â"})]}),t.jsx("div",{style:{display:"flex",gap:8,alignItems:"center",flexWrap:"wrap"},children:r&&e?t.jsx(he,{type:"button",size:"sm",variant:"outline",onClick:()=>y(r.id),children:"Entitlements override"}):null})]}),e?null:t.jsx("div",{style:{color:z,fontSize:"0.75rem",fontWeight:700},children:"Read-only."}),i?t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:i}):null,e&&s?t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:s}):null,e&&c?t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:c}):null,e&&m?t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:m}):null,n?t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:"Loadingâ¦"}):r?t.jsxs("div",{style:{display:"grid",gap:12},children:[t.jsxs("div",{style:{display:"grid",gap:6},children:[t.jsx(Ds,{label:"Workspace",value:t.jsx(Dn,{to:`/admin/resources?resource=organizations&org_id=${r.organization_id}`,style:{color:O,textDecoration:"underline",textUnderlineOffset:3},children:r.organization_name||`#${r.organization_id}`})}),r.partner?t.jsx(Ds,{label:"Partner",value:t.jsxs(Dn,{to:`/admin/resources?resource=partners&partner_id=${r.partner.id}`,style:{color:O,textDecoration:"underline",textUnderlineOffset:3},children:[r.partner.name," #",r.partner.id]})}):null,t.jsx(Ds,{label:"Plan",value:r.plan?`${r.plan.code} (#${r.plan.id})`:"â"}),t.jsx(Ds,{label:"Status",value:r.status}),t.jsx(Ds,{label:"Interval",value:r.billing_interval}),t.jsx(Ds,{label:"Currency",value:r.currency||"â"}),t.jsx(Ds,{label:"Provider",value:r.provider||"â"}),t.jsx(Ds,{label:"Billing exempt",value:r.billing_exempt?"yes":"no"}),t.jsx(Ds,{label:"Exempt reason",value:r.billing_exempt_reason||"â"}),t.jsx(Ds,{label:"Trial override days",value:r.trial_override_days==null?"â":String(r.trial_override_days)}),t.jsx(Ds,{label:"Provider customer id",value:r.provider_customer_id||"â",mono:!0}),t.jsx(Ds,{label:"Provider subscription id",value:r.provider_subscription_id||"â",mono:!0}),t.jsx(Ds,{label:"Cancel at period end",value:r.provider_cancel_at_period_end?"yes":"no"}),t.jsx(Ds,{label:"Period end",value:r.provider_current_period_end?new Date(r.provider_current_period_end).toLocaleStr
23861ing():"â"}),t.jsx(Ds,{label:"Trial used",value:r.trial_used_at?new Date(r.trial_used_at).toLocaleString():"â"}),t.jsx(Ds,{label:"First paid",value:r.first_paid_at?new Date(r.first_paid_at).toLocaleString():"â"}),t.jsx(Ds,{label:"Discount",value:(()=>{const _=r.discount||null;if(!_||!_.code&&!_.percent&&!_.cents)return"â";const $=[];return _.code&&$.push(_.code),typeof _.percent=="number"&&$.push(`${_.percent}%`),typeof _.cents=="number"&&$.push(`${(_.cents/100).toFixed(2)}`),_.applied_at&&$.push(`applied: ${new Date(_.applied_at).toLocaleString()}`),$.join(" ⢠")})()}),t.jsx(Ds,{label:"Created",value:r.created_at?new Date(r.created_at).toLocaleString():"â"})]}),e?t.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap",alignItems:"center"},children:[t.jsx(he,{type:"button",size:"sm",variant:r.billing_exempt?"primary":"outline",disabled:!e||a,onClick:()=>{if(r.billing_exempt){const _=window.prompt(`Optional: set trial days override for this checkout. 23862 23863- Leave blank: use normal plan trial rules 23864- 0: disable trial 23865- e.g. 7: grant 7-day trial 23866`,"");let $;if(_!=null){const k=_.trim();if(k==="")$=null;else{const P=Number(k);if(!Number.isFinite(P)||P<0){window.alert("Trial days must be a non-negative number (or blank).");return}$=Math.floor(P)}}if(!window.confirm("Remove billing exemption? This will block spend until checkout is completed."))return;h(!1,{trialDays:$??void 0})}else{if(!window.confirm("Exempt this workspace from billing enforcement?"))return;h(!0)}},children:a?"Workingâ¦":r.billing_exempt?"Remove exemption":"Exempt"}),v?t.jsxs(t.Fragment,{children:[t.jsx(he,{type:"button",size:"sm",variant:"outline",disabled:!e||o||r.status==="canceled"||!r.provider_cancel_at_period_end,onClick:()=>{window.confirm("Remove the scheduled cancellation (uncancel)?")&&x()},children:o?"Workingâ¦":"Uncancel"}),t.jsx(he,{type:"button",size:"sm",variant:"outline",disabled:!e||o||r.status==="canceled"||r.provider_cancel_at_period_end,onClick:()=>{window.confirm("Cancel this subscription at the end of the current billing period?")&&g("end_of_cycle")},children:o?"Workingâ¦":"Cancel at period end"}),t.jsx(he,{type:"button",size:"sm",variant:"danger",disabled:!e||o||r.status==="canceled",onClick:()=>{window.confirm("Cancel this subscription immediately? This will revoke access right away.")&&g("immediate")},children:o?"Workingâ¦":"Cancel now"})]}):t.jsx(he,{type:"button",size:"sm",variant:"danger",disabled:!e||o||r.status==="canceled",onClick:()=>{window.confirm("Cancel this subscription locally? This will mark it as canceled in Ceyo.")&&g("immediate")},children:o?"Workingâ¦":"Cancel (local)"}),r.status==="canceled"?t.jsx("div",{style:{color:z,fontSize:"0.75rem",fontWeight:650},children:"Already canceled."}):r.provider_cancel_at_period_end?t.jsx("div",{style:{color:z,fontSize:"0.75rem",fontWeight:650},children:"Cancellation scheduled for period end."}):null]}):null,e?t.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap",alignItems:"center"},children:[t.jsx(he,{type:"button",size:"sm",variant:"outline",disabled:u,onClick:()=>{const _=window.prompt("How many extra credits to grant for THIS month only?");if(_==null)return;const $=Number(_.trim());if(!Number.isFinite($)||$<=0||!Number.isInteger($)){window.alert("Enter a positive integer.");return}window.confirm(`Grant ${$} credits for the current month?`)&&w($,"this_month")},children:u?"Workingâ¦":"Grant credits (this month)"}),t.jsx(he,{type:"button",size:"sm",variant:"outline",disabled:u,onClick:()=>{const _=window.prompt(`How many extra credits to add EVERY month? 23867(Also tops up the current month immediately.)`);if(_==null)return;const $=Number(_.trim());if(!Number.isFinite($)||$<=0||!Number.isInteger($)){window.alert("Enter a positive integer.");return}window.confirm(`Add ${$} credits to the monthly allowance (and grant ${$} for this month)?`)&&w($,"every_month")},children:u?"Workingâ¦":"Grant credits (every month)"}),(()=>{const _=r.entitlements?.override?.monthly_credits_allowance,$=r.entitlements?.plan?.monthly_credits_allowance;return typeof _=="number"&&typeof $=="number"&&_>$?t.jsx(he,{type:"button",size:"sm",variant:"danger",disabled:u,onClick:()=>{const P=_-$;window.confirm(`Revoke the monthly credit grant of +${P} credits? 23868 23869This will reset the monthly allowance back to the plan default (${$}) and claw back up to ${P} credits from this month's balance.`)&&w(0,"revoke_every_month")},children:u?"Workingâ¦":`Revoke monthly grant (+${_-$})`}):null})()]}):null]}):t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:"Select a subscription from the list to view details."})]})}function Ds({label:e,value:n,mono:i}){return t.jsxs("div",{style:{display:"grid",gap:2},children:[t.jsx("div",{style:{color:z,fontSize:"0.75rem",fontWeight:800},children:e}),t.jsx("div",{style:{color:O,fontSize:"0.875rem",fontWeight:750,wordBreak:"break-word",fontFamily:i?"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace":void 0},children:n})]})}
23869function TAt({detail:e}){return t.jsxs("details",{style:{border:`1px solid ${V}`,borderRadius:12,padding:14,background:Z},children:[t.jsx("summary",{style:{cursor:"pointer",fontWeight:900,color:O,fontSize:"0.95rem"},children:"Entitlements"}),t.jsxs("div",{style:{display:"grid",gap:10,marginTop:10},children:[t.jsx("div",{style:{color:z,fontSize:"0.75rem",fontWeight:650},children:"Plan entitlements come from the plan, override is admin-set, and effective is the merged result."}),t.jsx(vE,{title:"Plan",obj:e.entitlements?.plan}),t.jsx(vE,{title:"Override",obj:e.entitlements?.override}),t.jsx(vE,{title:"Effective",obj:e.entitlements?.effective})]})]})}function vE({title:e,obj:n}){let i="{}";try{i=JSON.stringify(n||{},null,2)}catch{i="{}"}return t.jsxs("div",{style:{border:`1px solid ${V}`,borderRadius:12,padding:12,background:Z,minWidth:0},children:[t.jsx("div",{style:{color:O,fontWeight:900,fontSize:"0.875rem"},children:e}),t.jsx("pre",{style:{marginTop:8,whiteSpace:"pre-wrap",wordBreak:"break-word",color:z,fontSize:"0.75rem",fontWeight:650,overflow:"auto",maxHeight:220},children:i})]})}function e5(e,n){const i=typeof n=="number"?n:0;return e==null?`${i} / â`:`${i} / ${e}`}function wE(e,n){return e==null||e===0?null:Math.min(100,(typeof n=="number"?n:0)/e*100)}function EAt({loading:e,error:n,usageLimits:i,onOpen:r}){return t.jsxs("details",{style:{border:`1px solid ${V}`,borderRadius:12,padding:14,background:Z},onToggle:o=>{o.currentTarget.open&&r()},children:[t.jsx("summary",{style:{cursor:"pointer",fontWeight:900,color:O,fontSize:"0.95rem"},children:"Usage & limits"}),t.jsxs("div",{style:{display:"grid",gap:10,marginTop:10},children:[n?t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:n}):null,e&&!i?t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:"Loading usage limitsâ¦"}):null,i?t.jsxs("div",{style:{display:"grid",gap:10},children:[t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(180px, 1fr))",gap:10},children:[t.jsx(Xh,{icon:t.jsx(Yl,{size:13}),accent:"#6366f1",title:"Public API",value:i.features.api_access_enabled?"Enabled":"Disabled",sub:"Access to API keys + Public API."}),t.jsx(Xh,{icon:t.jsx(jy,{size:13}),accent:"#3b82f6",title:"Projects",value:e5(i.limits.projects_limit,i.usage.projects.projects_count),bar:wE(i.limits.projects_limit,i.usage.projects.projects_count)}),t.jsx(Xh,{icon:t.jsx(To,{size:13}),accent:"#06b6d4",title:"Countries",value:e5(i.limits.countries_limit,i.usage.countries.distinct_countries_count),sub:i.limits.countries_limit==null?"Unlimited countries.":"Distinct countries across projects."}),t.jsx(Xh,{icon:t.jsx(Ap,{size:13}),accent:"#8b5cf6",title:"Seats",value:e5(i.limits.seats_limit,i.usage.seats.seats_used),sub:`Members: ${i.usage.seats.members}`,bar:wE(i.limits.seats_limit,i.usage.seats.seats_used)}),t.jsx(Xh,{icon:t.jsx(Dy,{size:13}),accent:"#8b5cf6",title:"LLMs enabled",value:`${i.usage?.llms_enabled?.length??"â"}`,sub:"Active AI models."}),t.jsx(Xh,{icon:t.jsx(Ss,{size:13}),accent:"#f59e0b",title:"Active prompts",value:`${i.usage.prompts.active_prompts}`,sub:"Counts active prompts."}),t.jsx(Xh,{icon:t.jsx(eh,{size:13}),accent:"#f97316",title:"Daily prompt runs",value:e5(i.limits.daily_prompt_runs_limit,i.usage.prompts.daily_prompt_runs_used_today),sub:"Resets daily.",bar:wE(i.limits.daily_prompt_runs_limit,i.usage.prompts.daily_prompt_runs_used_today)}),t.jsx(Xh,{icon:t.jsx(vy,{size:13}),accent:"#10b981",title:"Credits",value:`${i.usage.credits.credits_used.toLocaleString()} / ${i.usage.credits.credits_total.toLocaleString()}`,sub:`${i.usage.credits.credits_remaining.toLocaleString()} remaining ⢠${i.usage.site_audit.used_total} cr audits, ${i.usage.project_actions.credits_used??0} cr actions, ${i.usage.fanout?.credits_used??0} cr fanout, chat ⢠Monthly.`,bar:i.usage.credits.credits_total>0?i.usage.credits.credits_used/i.usage.credits.credits_total*100:null})]}),t.jsxs("div",{style:{color:z,fontSize:"0.75rem",fontWeight:650},children:["Period: day ",i.usage.period.day_on," ⢠month starts ",i.usage.period.month_start_on]})]}):null]})]})}function Xh({icon:e,accent:n,title:i,value:r,sub:o,bar:s}){const a=s!=null&&s>=90?"#ef4444":s!=null&&s>=70?"#f59e0b":n;return t.jsxs("div",{style:{border:`1px solid ${V}`,borderRadius:10,padding:11,background:Z},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,marginBottom:4},children:[t.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",color:n,flexShrink:0},children:e}),t.jsx("div",{style:{color:z,fontSize:"0.7rem",fontWeight:800,textTransform:"uppercase",letterSpacing:"0.02em"},children:i})]}),t.jsx("div",{style:{color:O,fontSize:"1rem",fontWeight:950},children:r}),s!=null?t.jsx("div",{style:{marginTop:5,height:4,borderRadius:2,background:V,overflow:"hidden"},children:t.jsx("div",{style:{height:"100%",borderRadius:2,width:`${Math.min(100,s)}%`,background:a,transition:"width 0.3s ease"}})}):null,o?t.jsx("div",{style:{color:Pe,fontSize:"0.7rem",fontWeight:650,marginTop:4,lineHeight:1.35},children:o}):null]})}const Ree=p.div.withConfig({displayName:"CompetitorsTable__Frame",componentId:"sc-shw44d-0"})` 23870 display: flex; 23871 flex-direction: column; 23872 min-height: 0; 23873 height: 200dvh; 23874 overflow: hidden; 23875 23876 @media (max-width: 980px) { 23877 height: 200dvh; 23878 } 23879`;function MAt({series:e}){const n=Math.max(1,...(e||[]).map(i=>Number(i.count||0)));return t.jsx("div",{style:{display:"flex",gap:2,alignItems:"flex-end",height:34},children:(e||[]).map(i=>t.jsx("div",{title:`${i.date}: ${i.count}`,style:{width:8,height:`${Math.max(2,Math.round(Number(i.count||0)/n*34))}px`,background:Rt,borderRadius:2}},i.date))})}function RAt({competitors:e,insights:n,meta:i,onPrev:r,onNext:o}){const s=l.useMemo(()=>{const a=Object.entries(n?.by_competitor_type||{});return a.sort((c,u)=>u[1]-c[1]),a.slice(0,4).map(([c,u])=>`${c} ${u}`).join(" ⢠")},[n?.by_competitor_type]);return e.length?t.jsxs(Ree,{children:[n?t.jsxs("div",{style:{display:"grid",gap:10,marginBottom:12},children:[t.jsxs("div",{style:{display:"grid",gap:12,gridTemplateColumns:"repeat(auto-fit, minmax(220px, 1fr))",alignItems:"stretch"},children:[t.jsxs("div",{style:{padding:10,border:`1px solid ${V}`,background:Z,borderRadius:10,minHeight:74,display:"grid",alignContent:"start"},children:[t.jsx("div",{style:{fontSize:"0.75rem",fontWeight:750,color:z},children:"Total competitors"}),t.jsx("div",{style:{fontSize:"1.1rem",fontWeight:900,color:O},children:n.totals.competitors})]}),t.jsxs("div",{style:{padding:10,border:`1px solid ${V}`,background:Z,borderRadius:10,minHeight:74,display:"grid",alignContent:"start"},children:[t.jsx("div",{style:{fontSize:"0.75rem",fontWeight:750,color:z},children:"Used in projects"}),t.jsx("div",{style:{fontSize:"1.1rem",fontWeight:900,color:O},children:n.totals.competitors_used})]}),t.jsxs("div",{style:{padding:10,border:`1px solid ${V}`,background:Z,borderRadius:10,minHeight:74,display:"grid",alignContent:"start"},children:[t.jsx("div",{style:{fontSize:"0.75rem",fontWeight:750,color:z},children:"Project links"}),t.jsx("div",{style:{fontSize:"1.1rem",fontWeight:900,color:O},children:n.totals.project_competitor_links})]})]}),t.jsxs("div",{style:{display:"grid",gap:12,gridTemplateColumns:"repeat(auto-fit, minmax(320px, 1fr))",alignItems:"stretch"},children:[t.jsxs("div",{style:{padding:10,border:`1px solid ${V}`,background:Z,borderRadius:10,minHeight:92,display:"grid",alignContent:"start"},children:[t.jsx("div",{style:{fontSize:"0.75rem",fontWeight:750,color:z},children:"New competitors (last 14d)"}),t.jsx("div",{style:{marginTop:6},children:t.jsx(MAt,{series:n.created_daily||[]})})]}),t.jsxs("div",{style:{padding:10,border:`1px solid ${V}`,background:Z,borderRadius:10,minHeight:92,display:"grid",alignContent:"start"},children:[t.jsx("div",{style:{fontSize:"0.75rem",fontWeight:750,color:z},children:"Competitor types"}),t.jsx("div",{style:{marginTop:6,fontSize:"0.8125rem",fontWeight:750,color:O},children:s||"â"})]})]})]}):null,t.jsx(tr,{style:{flex:1,minHeight:0,overflow:"auto"},children:t.jsxs(nr,{$minWidth:"70rem",children:[t.jsx(pr,{children:t.jsxs(Cn,{children:[t.jsx(Et,{children:"Competitor"}),t.jsx(Et,{children:"Website"}),t.jsx(Et,{children:"#Projects"}),t.jsx(Et,{children:"Avg visibility"}),t.jsx(Et,{children:"Created"})]})}),t.jsx(mr,{children:e.map(a=>t.jsxs(Cn,{children:[t.jsx(bt,{children:t.jsxs("div",{style:{display:"flex",gap:10,alignItems:"center"},children:[t.jsx(xo,{record:{name:a.name,website:a.website},forceLogoDev:!0,size:22}),t.jsxs("div",{children:[t.jsx("div",{style:{fontWeight:900,color:O,fontSize:"0.875rem"},children:a.name}),t.jsxs("div",{style:{fontSize:"0.75rem",fontWeight:700,color:z},children:["ID ",a.id]})]})]})}),t.jsx(bt,{$muted:!0,children:a.website}),t.jsx(bt,{$muted:!0,children:a.projects_count}),t.jsx(bt,{$muted:!0,children:typeof a.avg_visibility_score=="number"?a.avg_visibility_score.toFixed(2):"â"}),t.jsx(bt,{$muted:!0,children:a.created_at?new Date(a.created_at).toLocaleStr
23879ing():"â"})]},a.id))})]})}),t.jsx(pi,{page:i.page,totalPages:i.totalPages,total:i.total,onPrev:r,onNext:o,compact:!0})]}):t.jsx(Ree,{children:t.jsx(tr,{style:{flex:1,overflow:"auto"},children:t.jsx(Iu,{style:{width:"100%"},children:"No competitors found."})})})}const Oee=p.div.withConfig({displayName:"CitationsTable__Frame",componentId:"sc-v1ma5a-0"})` 23880 display: flex; 23881 flex-direction: column; 23882 min-height: 0; 23883 height: 200dvh; 23884 overflow: hidden; 23885 23886 @media (max-width: 980px) { 23887 height: 200dvh; 23888 } 23889`;function OAt({series:e}){const n=Math.max(1,...(e||[]).map(i=>Number(i.count||0)));return t.jsx("div",{style:{display:"flex",gap:2,alignItems:"flex-end",height:34},children:(e||[]).map(i=>t.jsx("div",{title:`${i.date}: ${i.count}`,style:{width:8,height:`${Math.max(2,Math.round(Number(i.count||0)/n*34))}px`,background:Rt,borderRadius:2}},i.date))})}function DAt({citations:e,insights:n,meta:i,onPrev:r,onNext:o}){const s=l.useMemo(()=>(n?.top_domains_by_citations||[]).slice(0,6).map(a=>`${a.domain_host} ${a.citations_count}`).join(" ⢠"),[n?.top_domains_by_citations]);return e.length?t.jsxs(Oee,{children:[n?t.jsxs("div",{style:{display:"grid",gap:10,marginBottom:12},children:[t.jsxs("div",{style:{display:"grid",gap:12,gridTemplateColumns:"repeat(auto-fit, minmax(220px, 1fr))",alignItems:"stretch"},children:[t.jsxs("div",{style:{padding:10,border:`1px solid ${V}`,background:Z,borderRadius:10,minHeight:74,display:"grid",alignContent:"start"},children:[t.jsx("div",{style:{fontSize:"0.75rem",fontWeight:750,color:z},children:"Total citations"}),t.jsx("div",{style:{fontSize:"1.1rem",fontWeight:900,color:O},children:n.totals.citations})]}),t.jsxs("div",{style:{padding:10,border:`1px solid ${V}`,background:Z,borderRadius:10,minHeight:74,display:"grid",alignContent:"start"},children:[t.jsx("div",{style:{fontSize:"0.75rem",fontWeight:750,color:z},children:"Prompt-run citations"}),t.jsx("div",{style:{fontSize:"1.1rem",fontWeight:900,color:O},children:n.totals.prompt_run_citations})]})]}),t.jsxs("div",{style:{display:"grid",gap:12,gridTemplateColumns:"repeat(auto-fit, minmax(320px, 1fr))",alignItems:"stretch"},children:[t.jsxs("div",{style:{padding:10,border:`1px solid ${V}`,background:Z,borderRadius:10,minHeight:128,display:"grid",alignContent:"start"},children:[t.jsx("div",{style:{fontSize:"0.75rem",fontWeight:750,color:z},children:"New citations (last 14d)"}),t.jsx("div",{style:{marginTop:6},children:t.jsx(OAt,{series:n.created_daily||[]})})]}),t.jsxs("div",{style:{padding:10,border:`1px solid ${V}`,background:Z,borderRadius:10,minHeight:128,display:"grid",alignContent:"start"},children:[t.jsx("div",{style:{fontSize:"0.75rem",fontWeight:750,color:z},children:"Top domains (by citations)"}),t.jsx("div",{style:{marginTop:6,fontSize:"0.8125rem",fontWeight:750,color:O},children:s||"â"})]})]})]}):null,t.jsx(tr,{style:{flex:1,minHeight:0,overflow:"auto"},children:t.jsxs(nr,{$minWidth:"78rem",children:[t.jsx(pr,{children:t.jsxs(Cn,{children:[t.jsx(Et,{children:"Domain"}),t.jsx(Et,{children:"Title"}),t.jsx(Et,{children:"URL"}),t.jsx(Et,{children:"Created"})]})}),t.jsx(mr,{children:e.map(a=>t.jsxs(Cn,{children:[t.jsx(bt,{children:t.jsxs("div",{style:{display:"flex",gap:10,alignItems:"center"},children:[t.jsx($u,{domain:a.domain_host,size:18}),t.jsxs("div",{children:[t.jsx("div",{style:{fontWeight:900,color:O,fontSize:"0.875rem"},children:a.domain_host||"â"}),t.jsxs("div",{style:{fontSize:"0.75rem",fontWeight:700,color:z},children:["ID ",a.id]})]})]})}),t.jsx(bt,{children:a.title||"â"}),t.jsx(bt,{$muted:!0,style:{maxWidth:520,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:a.url}),t.jsx(bt,{$muted:!0,children:a.created_at?new Date(a.created_at).toLocaleString():"â"})]},a.id))})]})}),t.jsx(pi,{page:i.page,totalPages:i.totalPages,total:i.total,onPrev:r,onNext:o,compact:!0})]}):t.jsx(Oee,{children:t.jsx(tr,{style:{flex:1,overflow:"auto"},children:t.jsx(Iu,{style:{width:"100%"},children:"No citations found."})})})}const Dee=p.div.withConfig({displayName:"KeywordVolumesTable__Frame",componentId:"sc-119k34b-0"})` 23890 display: flex; 23891 flex-direction: column; 23892 min-height: 0; 23893 height: 200dvh; 23894 overflow: hidden; 23895 23896 @media (max-width: 980px) { 23897 height: 200dvh; 23898 } 23899`;function Lee({series:e}){const n=Math.max(1,...(e||[]).map(i=>Number(i.count||0)));return t.jsx("div",{style:{display:"flex",gap:2,alignItems:"flex-end",height:34},children:(e||[]).map(i=>t.jsx("div",{title:`${i.date}: ${i.count}`,style:{width:8,height:`${Math.max(2,Math.round(Number(i.count||0)/n*34))}px`,background:Rt,borderRadius:2}},i.date))})}function LAt({rows:e,insights:n,meta:i,onPrev:r,onNext:o}){const s=l.useMemo(()=>(n?.top_sources||[]).slice(0,6).map(a=>`${a.source} ${a.count}`).join(" ⢠"),[n?.top_sources]);return e.length?t.jsxs(Dee,{children:[n?t.jsxs("div",{style:{display:"grid",gap:10,marginBottom:12},children:[t.jsxs("div",{style:{display:"grid",gap:12,gridTemplateColumns:"repeat(auto-fit, minmax(220px, 1fr))",alignItems:"stretch"},children:[t.jsxs("div",{style:{padding:10,border:`1px solid ${V}`,background:Z,borderRadius:10,minHeight:74,display:"grid",alignContent:"start"},children:[t.jsx("div",{style:{fontSize:"0.75rem",fontWeight:750,color:z},children:"Rows"}),t.jsx("div",{style:{fontSize:"1.1rem",fontWeight:900,color:O},children:n.totals.rows})]}),t.jsxs("div",{style:{padding:10,border:`1px solid ${V}`,background:Z,borderRadius:10,minHeight:74,display:"grid",alignContent:"start"},children:[t.jsx("div",{style:{fontSize:"0.75rem",fontWeight:750,color:z},children:"Distinct keywords"}),t.jsx("div",{style:{fontSize:"1.1rem",fontWeight:900,color:O},children:n.totals.distinct_keywords})]}),t.jsxs("div",{style:{padding:10,border:`1px solid ${V}`,background:Z,borderRadius:10,minHeight:74,display:"grid",alignContent:"start"},children:[t.jsx("div",{style:{fontSize:"0.75rem",fontWeight:750,color:z},children:"Avg AI volume"}),t.jsx("div",{style:{fontSize:"1.1rem",fontWeight:900,color:O},children:typeof n.volume.avg_ai_search_volume=="number"?n.volume.avg_ai_search_volume.toFixed(1):"â"})]})]}),t.jsxs("div",{style:{display:"grid",gap:12,gridTemplateColumns:"repeat(auto-fit, minmax(320px, 1fr))",alignItems:"stretch"},children:[t.jsxs("div",{style:{padding:10,border:`1px solid ${V}`,background:Z,borderRadius:10,minHeight:92,display:"grid",alignContent:"start"},children:[t.jsx("div",{style:{fontSize:"0.75rem",fontWeight:750,color:z},children:"Created (last 14d)"}),t.jsx("div",{style:{marginTop:6},children:t.jsx(Lee,{series:n.created_daily||[]})})]}),t.jsxs("div",{style:{padding:10,border:`1px solid ${V}`,background:Z,borderRadius:10,minHeight:92,display:"grid",alignContent:"start"},children:[t.jsx("div",{style:{fontSize:"0.75rem",fontWeight:750,color:z},children:"Fetched (last 14d)"}),t.jsx("div",{style:{marginTop:6},children:t.jsx(Lee,{series:n.fetched_daily||[]})})]})]}),t.jsxs("div",{style:{padding:10,border:`1px solid ${V}`,background:Z,borderRadius:10},children:[t.jsx("div",{style:{fontSize:"0.75rem",fontWeight:750,color:z},children:"Top sources"}),t.jsx("div",{style:{marginTop:6,fontSize:"0.8125rem",fontWeight:750,color:O},children:s||"â"})]})]}):null,t.jsx(tr,{style:{flex:1,minHeight:0,overflow:"auto"},children:t.jsxs(nr,{$minWidth:"78rem",children:[t.jsx(pr,{children:t.jsxs(Cn,{children:[t.jsx(Et,{children:"Keyword"}),t.jsx(Et,{children:"Location"}),t.jsx(Et,{children:"Language"}),t.jsx(Et,{children:"AI volume"}),t.jsx(Et,{children:"Source"}),t.jsx(Et,{children:"Fetched"}),t.jsx(Et,{children:"Created"})]})}),t.jsx(mr,{children:e.map(a=>t.jsxs(Cn,{children:[t.jsx(bt,{children:a.keyword}),t.jsx(bt,{$muted:!0,children:a.location_code}),t.jsx(bt,{$muted:!0,children:a.language_name}),t.jsx(bt,{$muted:!0,children:typeof a.ai_search_volume=="number"?a.ai_search_volume:"â"}),t.jsx(bt,{$muted:!0,children:a.source}),t.jsx(bt,{$muted:!0,children:a.fetched_at?new Date(a.fetched_at).toLocaleStr
23899ing():"â"}),t.jsx(bt,{$muted:!0,children:a.created_at?new Date(a.created_at).toLocaleString():"â"})]},a.id))})]})}),t.jsx(pi,{page:i.page,totalPages:i.totalPages,total:i.total,onPrev:r,onNext:o,compact:!0})]}):t.jsx(Dee,{children:t.jsx(tr,{style:{flex:1,overflow:"auto"},children:t.jsx(Iu,{style:{width:"100%"},children:"No keyword volumes found."})})})}function BAt({plans:e,meta:n,canEdit:i,polarMeta:r,onRefresh:o,onSeedBaseline:s,onCreate:a,onEdit:c,onSyncPolar:u,onArchivePolar:m,onDelete:h,onPrev:g,onNext:x}){const y=(_,$)=>{if(_===null||typeof _>"u")return"â";const k=String($||"").trim().toUpperCase(),P=Number(_)/100;if(!Number.isFinite(P))return"â";try{if(k)return new Intl.NumberFormat(void 0,{style:"currency",currency:k}).format(P)}catch{}return`${P.toFixed(2)}${k?` ${k}`:""}`},w=_=>_.polar_managed===!1||j(_),j=_=>_.billing_channel==="partner"||_.entitlements?.partner_public===!0,v=(_,$)=>{if(w(_))return{label:"outside Polar",color:$i};const k=$==="monthly"?_.polar?.monthly:_.polar?.yearly,P=$==="monthly"?_.price_monthly_cents:_.price_yearly_cents;if(!k)return{label:"missing",color:Ut};const S=typeof k.price_amount=="number"?k.price_amount:null;return(P??null)===S&&String(_.currency||"").toLowerCase()===String(k.price_currency||"").toLowerCase()?{label:"ok",color:Vt}:{label:"mismatch",color:Ut}};return e.length?t.jsxs(t.Fragment,{children:[t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:12,marginBottom:10,flexWrap:"wrap"},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,flexWrap:"wrap"},children:[t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:750},children:"Plans"}),t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[t.jsx(he,{type:"button",size:"sm",variant:"outline",onClick:o,children:"Refresh"}),r?.enabled===!1?t.jsxs("div",{style:{fontSize:"0.75rem",fontWeight:700,color:Ut},children:["Polar disabled",r?.error?`: ${r.error}`:""]}):t.jsxs("div",{style:{fontSize:"0.75rem",fontWeight:700,color:z},children:["Polar: ",r?.enabled?"enabled":"unknown"]})]})]}),t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[i?t.jsx(he,{type:"button",size:"sm",variant:"outline",onClick:s,children:"Seed baseline"}):null,i?t.jsx(he,{type:"button",size:"sm",variant:"outline",onClick:a,children:"Create plan"}):null]})]}),t.jsxs("details",{style:{border:`1px solid ${V}`,borderRadius:12,padding:14,background:Z,marginBottom:12},children:[t.jsx("summary",{style:{cursor:"pointer",fontWeight:900,color:O,fontSize:"0.95rem"},children:"What do these actions do?"}),t.jsxs("div",{style:{display:"grid",gap:10,marginTop:10},children:[t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:"Plans are stored in the DB. Direct SaaS plans are mirrored to Polar; partner plans are billed outside Polar."}),t.jsxs("div",{style:{display:"grid",gap:6},children:[t.jsx("div",{style:{color:O,fontWeight:850,fontSize:"0.875rem"},children:"Top actions"}),t.jsxs("ul",{style:{margin:0,paddingLeft:18,color:z,fontSize:"0.875rem",fontWeight:650,lineHeight:1.45},children:[t.jsxs("li",{children:[t.jsx("span",{style:{color:O,fontWeight:800},children:"Refresh"}),": reloads the current page of plans and their Polar matches."]}),t.jsxs("li",{children:[t.jsx("span",{style:{color:O,fontWeight:800},children:"Create plan"}),": creates the plan in the DB. Polar products are only created for direct SaaS plans."]})]})]}),t.jsxs("div",{style:{display:"grid",gap:6},children:[t.jsx("div",{style:{color:O,fontWeight:850,fontSize:"0.875rem"},children:"Per-row actions"}),t.jsxs("ul",{style:{margin:0,paddingLeft:18,color:z,fontSize:"0.875rem",fontWeight:650,lineHeight:1.45},children:[t.jsxs("li",{children:[t.jsx("span",{style:{color:O,fontWeight:800},children:"Edit"}),": updates the DB plan. After saving:",t.jsxs("ul",{style:{margin:"6px 0 0",paddingLeft:18},children:[t.jsxs("li",{children:["if you change ",t.jsx("span",{style:{color:O,fontWeight:800},children:"currency"})," or ",t.jsx("span",{style:{color:O,fontWeight:800},children:"prices"}),", we"," ",t.jsx("span",{style:{color:O,fontWeight:800},children:"Reset Polar"})," (archive old + recreate new)."]}),t.jsxs("li",{children:["if you set ",t.jsx("span",{style:{color:O,fontWeight:800},children:"active=false"}),", we"," ",t.jsx("span",{style:{color:O,fontWeight:800},children:"Archive Polar"}),"."]})]})]}),t.jsxs("li",{children:[t.jsx("span",{style:{color:O,fontWeight:800},children:"Sync Polar"}),": creates missing Polar products and updates name/metadata (does not recreate prices)."]}),t.jsxs("li",{children:[t.jsx("span",{style:{color:O,fontWeight:800},children:"Reset Polar"}),": archives existing Polar products for this plan and recreates them (use this to fix mismatches / price changes)."]}),t.jsxs("li",{children:[t.jsx("span",{style:{color:O,fontWeight:800},children:"Archive Polar"}),": archives the planâs Polar products (monthly/yearly if they exist)."]}),t.jsxs("li",{children:[t.jsx("span",{style:{color:O,fontWeight:800},children:"Delete"}),": archives Polar products then deletes the DB plan (blocked if the plan has subscriptions)."]})]})]}),t.jsxs("div",{style:{display:"grid",gap:6},children:[t.jsx("div",{style:{color:O,fontWeight:850,fontSize:"0.875rem"},children:"Polar status column"}),t.jsxs("ul",{style:{margin:0,paddingLeft:18,color:z,fontSize:"0.875rem",fontWeight:650,lineHeight:1.45},children:[t.jsxs("li",{children:[t.jsx("span",{style:{color:O,fontWeight:800},children:"ok"}),": DB price + currency match the Polar product."]}),t.jsxs("li",{children:[t.jsx("span",{style:{color:O,fontWeight:800},children:"missing"}),": no matching Polar product found for that interval."]}),t.jsxs("li",{children:[t.jsx("span",{style:{color:O,fontWeight:800},children:"mismatch"}),": a matching Polar product exists but price/currency differ from the DB."]}),t.jsxs("li",{children:["Use the ",t.jsx("span",{style:{color:O,fontWeight:800},children:"Details"})," expander inside the âPolar (mo/yr)â cell to see product names and IDs."]}),t.jsxs("li",{children:[t.jsx("span",{style:{color:O,fontWeight:800},children:"outside Polar"}),": partner plan billed externally."]})]})]})]})]}),t.jsx("div",{style:{flex:1,minHeight:0,display:"flex"},children:t.jsx(tr,{style:{flex:1,minWidth:0},children:t.jsxs(nr,{$minWidth:"92rem",children:[t.jsx(pr,{children:t.jsxs(Cn,{children:[t.jsx(Et,{children:"Code"}),t.jsx(Et,{children:"Name"}),t.jsx(Et,{children:"Channel"}),t.jsx(Et,{children:"Active"}),t.jsx(Et,{children:"Trial days"}),t.jsx(Et,{children:"Currency"}),t.jsx(Et,{children:"Price (mo/yr)"}),t.jsx(Et,{children:"Polar (mo/yr)"}),t.jsx(Et,{children:"Polar status"}),t.jsx(Et,{children:"Original (mo/yr)"}),t.jsx(Et,{children:"Actions"})]})}),t.jsx(mr,{children:e.map(_=>t.jsxs(Cn,{children:[t.jsxs(bt,{children:[t.jsx("div",{style:{fontWeight:900,color:O,fontSize:"0.875rem"},children:_.code}),t.jsxs("div",{style:{fontSize:"0.75rem",fontWeight:700,color:z},children:["ID ",_.id]})]}),t.jsx(bt,{children:_.name}),t.jsx(bt,{children:j(_)?t.jsxs("div",{style:{display:"inline-flex",flexDirection:"column",gap:2,border:`1px solid ${$i}`,background:Oy,color:O,borderRadius:10,padding:"6px 8px",fontSize:"0.75rem",fontWeight:850},children:[t.jsx("span",{children:"Partner"}),t.jsx("span",{style:{color:z,fontWeight:750},children:"outside Polar"})]}):t.jsx("div",{style:{display:"inline-flex",border:`1px solid ${V}`,background:$e,color:z,borderRadius:10,padding:"6px 8px",fontSize:"0.75rem",fontWeight:850},children:"Direct / Polar"})}),t.jsx(bt,{$muted:!0,children:_.active?"yes":"no"}),t.jsx(bt,{$muted:!0,children:typeof _.trial_days=="number"?_.trial_days:"â"}),t.jsx(bt,{$muted:!0,children:_.currency}),t.jsxs(bt,{$muted:!0,children:[y(_.price_monthly_cents,_.currency)," / ",y(_.price_yearly_cents,_.currency)]}),t.jsx(bt,{$muted:!0,children:(()=>
23899{if(w(_))return t.jsx("div",{style:{color:z,fontSize:"0.75rem",fontWeight:800},children:"Not synced to Polar"});const $=_.polar?.monthly||null,k=_.polar?.yearly||null,P=$?y(typeof $.price_amount=="number"?$.price_amount:null,$.price_currency):"â",S=k?y(typeof k.price_amount=="number"?k.price_amount:null,k.price_currency):"â";return t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[t.jsxs("div",{children:["mo: ",P]}),t.jsxs("div",{children:["yr: ",S]}),t.jsxs("details",{style:{marginTop:4},children:[t.jsx("summary",{style:{cursor:"pointer",fontWeight:800,color:O,fontSize:"0.75rem"},children:"Details"}),t.jsxs("div",{style:{marginTop:6,display:"grid",gap:6,fontSize:"0.75rem",color:z,fontWeight:650},children:[t.jsxs("div",{children:[t.jsx("span",{style:{color:O,fontWeight:800},children:"Monthly"}),":"," ",$?t.jsxs(t.Fragment,{children:[t.jsx("span",{style:{color:O,fontWeight:750},children:$.name})," ",t.jsx("span",{style:{fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace"},children:$.product_id})]}):"â"]}),t.jsxs("div",{children:[t.jsx("span",{style:{color:O,fontWeight:800},children:"Yearly"}),":"," ",k?t.jsxs(t.Fragment,{children:[t.jsx("span",{style:{color:O,fontWeight:750},children:k.name})," ",t.jsx("span",{style:{fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace"},children:k.product_id})]}):"â"]})]})]})]})})()}),t.jsx(bt,{children:(()=>{const $=v(_,"monthly"),k=v(_,"yearly");return t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[t.jsx("div",{style:{width:10,height:10,borderRadius:999,background:$.color}}),t.jsxs("div",{style:{fontSize:"0.75rem",fontWeight:800,color:O},children:["mo: ",$.label]})]}),t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[t.jsx("div",{style:{width:10,height:10,borderRadius:999,background:k.color}}),t.jsxs("div",{style:{fontSize:"0.75rem",fontWeight:800,color:O},children:["yr: ",k.label]})]})]})})()}),t.jsxs(bt,{$muted:!0,children:[y(_.original_price_monthly_cents,_.currency)," / ",y(_.original_price_yearly_cents,_.currency)]}),t.jsx(bt,{children:t.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:8,justifyContent:"flex-end"},children:[t.jsx(he,{type:"button",size:"sm",variant:"outline",onClick:()=>c(_.id),children:i?"Edit":"View"}),i?t.jsxs(t.Fragment,{children:[w(_)?t.jsx("div",{style:{alignSelf:"center",color:z,fontSize:"0.75rem",fontWeight:800},children:"No Polar actions"}):t.jsxs(t.Fragment,{children:[t.jsx(he,{type:"button",size:"sm",variant:"outline",onClick:()=>u(_.id),children:"Sync Polar"}),t.jsx(he,{type:"button",size:"sm",variant:"outline",onClick:()=>{window.confirm("Reset Polar products for this plan? This will archive existing products and recreate them (used for price changes).")&&u(_.id,{resetExisting:!0})},style:{borderColor:V},children:"Reset Polar"}),t.jsx(he,{type:"button",size:"sm",variant:"outline",onClick:()=>{window.confirm("Archive Polar products for this plan?")&&m(_.id)},style:{borderColor:V},children:"Archive Polar"})]}),t.jsx(he,{type:"button",size:"sm",variant:"outline",onClick:()=>{const $=w(_)?"Delete this externally billed plan from the DB? This cannot be undone.":"Delete this plan from the DB? This will also archive its Polar products. This cannot be undone.";window.confirm($)&&h(_.id)},style:{borderColor:Ut,color:Ut},children:"Delete"})]}):null]})})]},_.id))})]})})}),t.jsx(pi,{page:n.page,totalPages:n.totalPages,total:n.total,onPrev:g,onNext:x,compact:!0})]}):t.jsx("div",{style:{flex:1,minHeight:0,display:"flex"},children:t.jsx(tr,{style:{flex:1},children:t.jsx(Iu,{style:{width:"100%"},children:"No plans found."})})})}function FAt(e){const n=String(e.type||"").toLowerCase();if(n==="percentage"){const i=typeof e.basis_points=="number"?e.basis_points:null;return i==null?"â":`${i/100}%`}if(n==="fixed"){const i=typeof e.amount=="number"?e.amount:null,r=String(e.currency||"").toUpperCase();if(i==null)return"â";const o=i/100;try{return r?new Intl.NumberFormat(void 0,{style:"currency",currency:r}
23899).format(o):`${o.toFixed(2)}`}catch{return`${o.toFixed(2)}${r?` ${r}`:""}`}}return"â"}function WAt({discounts:e,meta:n,canEdit:i,polarProducts:r,polarProductsLoading:o,polarProductsError:s,onCreate:a,onDelete:c,onPrev:u,onNext:m}){const[h,g]=l.useState(!1),[x,y]=l.useState(null),[w,j]=l.useState("all"),[v,_]=l.useState(""),[$,k]=l.useState(""),[P,S]=l.useState("percentage"),[I,A]=l.useState("1000"),[E,B]=l.useState("1000"),[T,M]=l.useState("usd"),[R,F]=l.useState("once"),[Y,H]=l.useState("3"),[U,X]=l.useState("1"),[Q,K]=l.useState(""),[G,L]=l.useState(""),[q,W]=l.useState(""),oe=l.useMemo(()=>e.length>0,[e.length]),se=l.useMemo(()=>{const ee=new Set;for(const ne of e){const Ae=String(ne.code||"").trim();Ae&&ee.add(Ae.toUpperCase())}return ee},[e]),de=l.useMemo(()=>{if(w==="all")return e;const ee=w==="used";return e.filter(ne=>(ne.redemptions_count||0)>0===ee)},[e,w]),le=()=>{const ee="ABCDEFGHJKLMNPQRSTUVWXYZ23456789",ne=Ae=>{try{const _e=new Uint8Array(Ae);crypto.getRandomValues(_e);let we="";for(let Ke=0;Ke<_e.length;Ke++)we+=ee[_e[Ke]%ee.length];return we}catch{let _e="";for(let we=0;we<Ae;we++)_e+=ee[Math.floor(Math.random()*ee.length)];return _e}};for(let Ae=0;Ae<25;Ae++){const we=`GEO${Date.now().toString(36).toUpperCase().replace(/[^A-Z0-9]/g,"")}${ne(8)}`.slice(0,32);if(!se.has(we.toUpperCase())){k(we);return}}k(`GEO${Date.now()}${Math.floor(Math.random()*1e6)}`.replace(/[^A-Z0-9]/gi,"").slice(0,32).toUpperCase())},me=async()=>{if(i){g(!0),y(null);try{const ee=G?new Date(G):null,ne=q?new Date(q):null;if(G&&(!ee||Number.isNaN(ee.getTime())))throw new Error("Invalid starts_at date/time");if(q&&(!ne||Number.isNaN(ne.getTime())))throw new Error("Invalid ends_at date/time");const Ae={name:v,code:$||void 0,type:P,duration:R,currency:T||void 0,max_redemptions:U||void 0,starts_at:ee?ee.toISOString():void 0,ends_at:ne?ne.toISOString():void 0,products:Q?[Q]:void 0};P==="percentage"?Ae.basis_points=I:Ae.amount=E,R==="repeating"&&(Ae.duration_in_months=Y),await a(Ae),_(""),k(""),X("1"),K(""),L(""),W("")}catch(ee){y(ee instanceof Error?ee.message:"Failed to create discount")}finally{g(!1)}}};return t.jsxs("div",{style:{display:"grid",gap:12,minWidth:0,maxWidth:"100%",overflowX:"hidden"},children:[t.jsxs("details",{style:{border:`1px solid ${V}`,borderRadius:12,padding:14,background:Z,minWidth:0,maxWidth:"100%",overflowX:"hidden"},open:!0,children:[t.jsx("summary",{style:{cursor:"pointer",fontWeight:900,color:O,fontSize:"0.95rem"},children:"Create discount"}),t.jsxs("div",{style:{display:"grid",gap:10,marginTop:10},children:[i?null:t.jsx("div",{style:{color:z,fontSize:"0.75rem",fontWeight:700},children:"Admin-only."}),x?t.jsx("div",{style:{color:Ut,fontSize:"0.875rem",fontWeight:650},children:x}):null,t.jsxs("div",{style:{display:"grid",gap:8},children:[t.jsx(Xt,{value:v,onChange:ee=>_(ee.target.value),placeholder:"Name (shown to customer)",fullWidth:!0,disabled:!i||h}),t.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center",flexWrap:"wrap"},children:[t.jsx("div",{style:{flex:"1 1 260px",minWidth:0},children:t.jsx(Xt,{value:$,onChange:ee=>k(ee.target.value),placeholder:"Code (optional; user can enter at checkout)",fullWidth:!0,disabled:!i||h})}),t.jsx(he,{type:"button",size:"sm",variant:"outline",disabled:!i||h,onClick:le,children:"Generate"})]})]}),t.jsxs("div",{style:{display:"grid",gap:8,gridTemplateColumns:"repeat(auto-fit, minmax(180px, 1fr))"},children:[t.jsxs("div",{children:[t.jsx("div",{style:{color:z,fontSize:"0.75rem",fontWeight:800,marginBottom:6},children:"Type"}),t.jsx(Fn,{value:P,onChange:ee=>S(String(ee||"percentage")||"percentage"),options:[{value:"percentage",label:"percentage"},{value:"fixed",label:"fixed"}],fullWidth:!0,disabled:!i||h})]}),t.jsxs("div",{children:[t.jsx("div",{style:{color:z,fontSize:"0.75rem",fontWeight:800,marginBottom:6},children:P==="percentage"?(()=>{const ee=Number(String(I||"").trim()),ne=Number.isFinite(ee)?ee/100:null;return`Basis points (1000 = 10%). Current: ${ne==null?"â":Number.isInteger(ne)?`${ne}%`:`${ne.toFixed(2).replace(/\.00$/,"")}%`}`})():"Amount (cents)"}),t.jsx(Xt,{value:P==="percentage"?I:E,onChange:ee=>P==="percentage"?A(ee.target.value):B(ee.target.value),fullWidth:!0,disabled:!i||h})]}),t.jsxs("div",{children:[t.jsx("div",{style:{color:z,fontSize:"0.75rem",fontWeight:800,marginBottom:6},children:"Currency (fixed only)"}),t.jsx(Xt,{value:T,onChange:ee=>M(ee.target.value),fullWidth:!0,disabled:!i||h||P!=="fixed"})]})]}),t.jsxs("div",{style:{display:"grid",gap:8,gridTemplateColumns:"repeat(auto-fit, minmax(180px, 1fr))"},children:[t.jsxs("div",{children:[t.jsx("div",{style:{color:z,fontSize:"0.75rem",fontWeight:800,marginBottom:6},children:"Duration"}),t.jsx(Fn,{value:R,onChange:ee=>F(String(ee||"once")||"once"),options:[{value:"once",label:"once"},{value:"forever",label:"forever"},{value:"repeating",label:"repeating"}],fullWidth:!0,disabled:!i||h})]}),t.jsxs("div",{children:[t.jsx("div",{style:{color:z,fontSize:"0.75rem",fontWeight:800,marginBottom:6},children:"Duration in months (repeating only)"}),t.jsx(Xt,{value:Y,onChange:ee=>H(ee.target.value),fullWidth:!0,disabled:!i||h||R!=="repeating"})]}),t.jsxs("div",{children:[t.jsx("div",{style:{color:z,fontSize:"0.75rem",fontWeight:800,marginBottom:6},children:"Max redemptions (blank = unlimited)"}),t.jsx(Xt,{value:U,onChange:ee=>X(ee.target.value),fullWidth:!0,disabled:!i||h,placeholder:"1"})]})]}),t.jsxs("div",{style:{display:"grid",gap:8},children:[t.jsx("div",{style:{color:z,fontSize:"0.75rem",fontWeight:800},children:"Products (optional)"}),s?t.jsx("div",{style:{color:Ut,fontSize:"0.75rem",fontWeight:700},children:s}):null,t.jsx(Fn,{value:Q,onChange:ee=>K(String(ee||"")),options:[{value:"",label:o?"Loading productsâ¦":"All products"},...r.map(ee=>({value:ee.id,label:`${ee.name||"Unnamed"}
23899 (${ee.id})`}))],fullWidth:!0,disabled:!i||h||o,dropdownPortal:!0})]}),t.jsxs("div",{style:{display:"grid",gap:8,gridTemplateColumns:"repeat(auto-fit, minmax(220px, 1fr))"},children:[t.jsxs("div",{style:{display:"grid",gap:6},children:[t.jsx("div",{style:{color:z,fontSize:"0.75rem",fontWeight:800},children:"Starts at (optional)"}),t.jsx(Xt,{type:"datetime-local",value:G,onChange:ee=>L(ee.target.value),fullWidth:!0,disabled:!i||h})]}),t.jsxs("div",{style:{display:"grid",gap:6},children:[t.jsx("div",{style:{color:z,fontSize:"0.75rem",fontWeight:800},children:"Ends at (optional)"}),t.jsx(Xt,{type:"datetime-local",value:q,onChange:ee=>W(ee.target.value),fullWidth:!0,disabled:!i||h})]})]}),t.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:t.jsx(he,{type:"button",size:"sm",variant:"outline",disabled:!i||h,onClick:me,children:h?"Creatingâ¦":"Create discount"})})]})]}),oe?t.jsxs(t.Fragment,{children:[t.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center",flexWrap:"wrap",minWidth:0,maxWidth:"100%"},children:[t.jsx("div",{style:{color:z,fontSize:"0.75rem",fontWeight:800},children:"Filter"}),t.jsx(he,{type:"button",size:"sm",variant:w==="all"?"primary":"outline",onClick:()=>j("all"),children:"All"}),t.jsx(he,{type:"button",size:"sm",variant:w==="unused"?"primary":"outline",onClick:()=>j("unused"),children:"Unused"}),t.jsx(he,{type:"button",size:"sm",variant:w==="used"?"primary":"outline",onClick:()=>j("used"),children:"Used"}),t.jsxs("div",{style:{color:z,fontSize:"0.75rem",fontWeight:700},children:["Showing ",de.length," / ",e.length," (this page)"]})]}),t.jsx("div",{style:{flex:1,minHeight:0,display:"flex",minWidth:0,maxWidth:"100%"},children:t.jsx(tr,{style:{flex:1,minWidth:0},children:t.jsxs(nr,{$minWidth:"84rem",children:[t.jsx(pr,{children:t.jsxs(Cn,{children:[t.jsx(Et,{children:"Code"}),t.jsx(Et,{children:"Name"}),t.jsx(Et,{children:"Type"}),t.jsx(Et,{children:"Value"}),t.jsx(Et,{children:"Duration"}),t.jsx(Et,{children:"Products"}),t.jsx(Et,{children:"Redemptions"}),t.jsx(Et,{children:"Starts"}),t.jsx(Et,{children:"Ends"}),t.jsx(Et,{children:"Created"}),t.jsx(Et,{children:"Actions"})]})}),t.jsx(mr,{children:de.map(ee=>{const ne=(ee.redemptions_count||0)>0;return t.jsxs(Cn,{children:[t.jsxs(bt,{children:[t.jsx("div",{style:{fontWeight:900,color:O,fontSize:"0.875rem"},children:ee.code||"â"}),t.jsx("div",{style:{fontSize:"0.75rem",fontWeight:700,color:z,overflowWrap:"anywhere"},children:ee.id})]}),t.jsx(bt,{style:{overflowWrap:"anywhere"},children:ee.name}),t.jsx(bt,{$muted:!0,children:ee.type}),t.jsx(bt,{$muted:!0,children:FAt(ee)}),t.jsxs(bt,{$muted:!0,children:[ee.duration,ee.duration==="repeating"&&ee.duration_in_months?` (${ee.duration_in_months}mo)`:""]}),t.jsx(bt,{$muted:!0,children:ee.products?.length?`${ee.products.length}`:"all"}),t.jsxs(bt,{$muted:!0,children:[(ee.redemptions_count??0).toString(),typeof ee.max_redemptions=="number"?` / ${ee.max_redemptions}`:""]}),t.jsx(bt,{$muted:!0,children:ee.starts_at?new Date(ee.starts_at).toLocaleString():"â"}),t.jsx(bt,{$muted:!0,children:ee.ends_at?new Date(ee.ends_at).toLocaleString():"â"}),t.jsx(bt,{$muted:!0,children:ee.created_at?new Date(ee.created_at).toLocaleString():"â"}),t.jsx(bt,{children:i?t.jsx(he,{type:"button",size:"sm",variant:"danger",disabled:ne,onClick:()=>{ne||window.confirm("Delete this discount? This is only allowed if it has 0 redemptions.")&&c(ee.id)},children:"Delete"}):null})]},ee.id)})})]})})}),t.jsx(pi,{page:n.page,totalPages:n.totalPages,total:n.total,onPrev:u,onNext:m,compact:!0})]}):t.jsx("div",{style:{flex:1,minHeight:0,display:"flex",minWidth:0,maxWidth:"100%"},children:t.jsx(tr,{style:{flex:1,minWidth:0},children:t.jsx(Iu,{style:{width:"100%"},children:"No discounts found."})})})]})}function al(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function f_(e,n){const i=String(n||"usd").toUpperCase(),r=(Number(e||0)||0)/100;try{return new Intl.NumberFormat(void 0,{style:"currency",currency:i}).format(r)}catch{return`${r.toFixed(2)} ${i}`}}function UAt(e){let n=0;for(const i of e)n=Math.max(n,Number(i||0)||0);return n}function jE({title:e,value:n,subtitle:i,children:r}){return t.jsxs("div",{style:{border:`1px solid ${V}`,borderRadius:12,padding:14,background:Z,minWidth:0},children:[t.jsx("div",{style:{color:z,fontWeight:850,fontSize:"0.75rem"},children:e}),t.jsx("div",{style:{color:O,fontWeight:950,fontSize:"1.35rem",marginTop:6},children:n}),i?t.jsx("div",{style:{color:Pe,fontWeight:750,fontSize:"0.75rem",marginTop:4},children:i}):null,r]})}function HAt({active:e,payload:n,currency:i}){if(!e)return null;const r=n&&n.length?n[0]?.payload:null;if(!r)return null;const o=String(r.name||""),s=Number(r.mrr||0),a=Number(r.arr||0);return t.jsxs("div",{style:{borderRadius:10,border:`1px solid ${V}`,background:Z,padding:"10px 12px"},children:[t.jsx("div",{style:{color:O,fontWeight:950,fontSize:"0.85rem"},children:o}),t.jsxs("div",{style:{marginTop:6,display:"grid",gap:4},children:[t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:10},children:[t.jsx("div",{style:{color:z,fontWeight:800,fontSize:"0.75rem"},children:"MRR"}),t.jsx("div",{style:{color:O,fontWeight:900,fontSize:"0.75rem"},children:f_(s,i)})]}),t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:10},children:[t.jsx("div",{style:{color:z,fontWeight:800,fontSize:"0.75rem"},children:"ARR"}),t.jsx("div",{style:{color:O,fontWeight:900,fontSize:"0.75rem"},children:f_(a,i)})]})]})]})}function qAt({loading:e,error:n,overview:i}){const r=l.useMemo(()=>
23899i?.mrr&&i.mrr.length?i.mrr[0]:null,[i?.mrr]),o=r?f_(r.cents,r.currency):"â",s=r?f_(r.arr_cents,r.currency):"â",a=l.useMemo(()=>i?.breakdown?.mrr&&i.breakdown.mrr.length?i.breakdown.mrr[0]:null,[i?.breakdown?.mrr]),c=l.useMemo(()=>a?{currency:a.currency,rows:[{key:"normal",name:"normal",mrr:Number(a.normal_cents||0),arr:Number(a.normal_arr_cents||0),fill:ot},{key:"exempt",name:"exempt",mrr:Number(a.exempt_cents||0),arr:Number(a.exempt_arr_cents||0),fill:Pe},{key:"partner",name:"partner",mrr:Number(a.partner_cents||0),arr:Number(a.partner_arr_cents||0),fill:Vt}]}:null,[a]),u=i?.breakdown?.subscriptions||null,m=i?.breakdown?.orgs||null,h=i?.saas||null,g=l.useMemo(()=>{if(!u)return null;const v=Number(u.normal||0),_=Number(u.exempt||0),$=Number(u.partner||0);return{total:Math.max(1,v+_+$),data:[{key:"normal",name:"normal",value:v,fill:ot},{key:"exempt",name:"exempt",value:_,fill:Pe},{key:"partner",name:"partner",value:$,fill:Vt}]}},[u]),x=l.useMemo(()=>m?[{key:"normal",name:"normal",value:Number(m.normal||0),fill:ot},{key:"exempt",name:"exempt",value:Number(m.exempt||0),fill:Pe},{key:"partner",name:"partner",value:Number(m.partner||0),fill:Vt}]:null,[m]),y=l.useMemo(()=>{const v=i?.subscriptions?.by_status||{},_=Object.keys(v);return _.sort(),_.map($=>({key:$,value:Number(v[$]||0)}))},[i?.subscriptions?.by_status]),w=l.useMemo(()=>(Array.isArray(i?.plan_mix)?i.plan_mix:[]).map(_=>({key:_.plan_code,label:_.plan_name,value:Number(_.subs_active||0),mrr_cents:Number(_.mrr_cents||0),currency:_.currency||"usd"})).sort((_,$)=>$.value-_.value).slice(0,8),[i]),j=l.useMemo(()=>{const v=i?.last_30_days?.new_subscriptions||[],_=v.slice(Math.max(0,v.length-14)),$=_.map(P=>Number(P.count||0)),k=UAt($)||1;return{last:_,max:k}},[i?.last_30_days?.new_subscriptions]);return t.jsxs("div",{style:{display:"grid",gap:12,minWidth:0,maxWidth:"100%"},children:[n?t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:700},children:n}):null,e?t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:700},children:"Loading billing overviewâ¦"}):null,t.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:8,alignItems:"center",justifyContent:"space-between",minWidth:0},children:t.jsx("div",{style:{minWidth:0},children:t.jsx("div",{style:{color:O,fontWeight:950,fontSize:"1rem"},children:"Billing overview"})})}),h?t.jsxs("div",{style:{display:"grid",gap:10,gridTemplateColumns:"repeat(auto-fit, minmax(220px, 1fr))",minWidth:0},children:[t.jsx(jE,{title:"SaaS organizations",value:al(h.organizations),subtitle:`${al(h.direct_organizations||0)} direct ⢠${al(h.partner_organizations||0)} partner`}),t.jsx(jE,{title:"SaaS subscriptions",value:al(h.subscriptions),subtitle:`${al(h.active_subscriptions||0)} active ⢠${al(h.partner_subscriptions||0)} partner managed`}),t.jsx(jE,{title:"Channel split",value:`${u?al(u.partner||0):"â"}`,subtitle:"Partner subscriptions inside the SaaS commercial channel."})]}):null,t.jsxs("div",{style:{display:"grid",gap:10,gridTemplateColumns:"repeat(auto-fit, minmax(220px, 1fr))",minWidth:0},children:[t.jsxs("div",{style:{border:`1px solid ${V}`,borderRadius:12,padding:14,background:Z,minWidth:0},children:[t.jsx("div",{style:{color:z,fontWeight:850,fontSize:"0.75rem"},children:"MRR (est.)"}),t.jsx("div",{style:{color:O,fontWeight:950,fontSize:"1.35rem",marginTop:6},children:o}),t.jsxs("div",{style:{color:Pe,fontWeight:750,fontSize:"0.75rem",marginTop:4},children:["ARR (est.): ",s]}),c?t.jsxs(t.Fragment,{children:[t.jsx("div",{style:{width:"100%",height:150,marginTop:10},children:t.jsx(Gl,{width:"100%",height:"100%",children:t.jsxs(KV,{data:c.rows,margin:{top:6,right:8,bottom:0,left:0},children:[t.jsx(Ql,{dataKey:"name",tick:{fill:"var(--color-gray-500)",fontSize:12,fontWeight:800},axisLine:!1,tickLine:!1}),t.jsx(Zl,{tick:{fill:"var(--color-gray-500)",fontSize:12,fontWeight:750},axisLine:!1,tickLine:!1,width:44,tickFormatter:v=>{const $=Number(v||0)/100;return Number.isFinite($)?Math.abs($)>=1e3?`${Math.round($/1e3)}k`:`${Math.round($)}`:""}}),t.jsx(Vl,{cursor:{fill:"rgba(79, 70, 229, 0.06)"},content:t.jsx(HAt,{currency:c.currency})}
23899),t.jsx(i8,{dataKey:"mrr",name:"mrr",radius:[8,8,8,8],children:c.rows.map(v=>t.jsx(py,{fill:v.fill},v.key))})]})})}),t.jsx("div",{style:{color:Pe,fontWeight:750,fontSize:"0.75rem",marginTop:6},children:"Hover a bar for MRR + ARR."})]}):t.jsx("div",{style:{color:Pe,fontWeight:750,fontSize:"0.75rem",marginTop:6},children:"Breakdown unavailable."})]}),t.jsxs("div",{style:{border:`1px solid ${V}`,borderRadius:12,padding:14,background:Z,minWidth:0},children:[t.jsx("div",{style:{color:z,fontWeight:850,fontSize:"0.75rem"},children:"Subscriptions"}),t.jsx("div",{style:{color:O,fontWeight:950,fontSize:"1.35rem",marginTop:6},children:i?.totals?.subscriptions??"â"}),t.jsxs("div",{style:{color:Pe,fontWeight:750,fontSize:"0.75rem",marginTop:6},children:["normal: ",u?u.normal:"â"," ⢠exempt: ",u?u.exempt:"â"," ⢠partner: ",u?u.partner:"â"]}),typeof i?.totals?.subs_sales=="number"&&i.totals.subs_sales>0?t.jsxs("div",{style:{color:Pe,fontWeight:750,fontSize:"0.7rem",marginTop:2},children:["+ ",i.totals.subs_sales," sales (excluded)"]}):null,g?t.jsx("div",{style:{width:"100%",height:140,marginTop:8},children:t.jsx(Gl,{width:"100%",height:"100%",children:t.jsxs(VZe,{children:[t.jsx(Vl,{formatter:(v,_)=>{const $=Number(v||0),k=Math.round($/g.total*1e3)/10;return[`${$} (${k}%)`,String(_||"")]},contentStyle:{borderRadius:10,border:`1px solid ${V}`,fontWeight:750}}),t.jsx(rA,{verticalAlign:"bottom",align:"left",wrapperStyle:{paddingTop:6,fontSize:12,fontWeight:750,color:"var(--color-gray-500)"}}),t.jsx(ece,{data:g.data,dataKey:"value",nameKey:"name",cx:"50%",cy:"46%",innerRadius:34,outerRadius:52,paddingAngle:2,stroke:Z,strokeWidth:2,children:g.data.map(v=>t.jsx(py,{fill:v.fill},v.key))})]})})}):null]}),t.jsxs("div",{style:{border:`1px solid ${V}`,borderRadius:12,padding:14,background:Z,minWidth:0},children:[t.jsx("div",{style:{color:z,fontWeight:850,fontSize:"0.75rem"},children:"Organizations"}),t.jsx("div",{style:{color:O,fontWeight:950,fontSize:"1.35rem",marginTop:6},children:i?.totals?.orgs??"â"}),t.jsxs("div",{style:{color:Pe,fontWeight:750,fontSize:"0.75rem",marginTop:6},children:["normal: ",m?m.normal:"â"," ⢠exempt: ",m?m.exempt:"â"," ⢠partner: ",m?m.partner:"â"]}),i?.totals?.orgs_sales||i?.totals?.orgs_onboarding?t.jsxs("div",{style:{color:Pe,fontWeight:750,fontSize:"0.7rem",marginTop:2}
23899,children:[[i.totals.orgs_sales?`+ ${i.totals.orgs_sales} sales`:null,i.totals.orgs_onboarding?`+ ${i.totals.orgs_onboarding} onboarding`:null].filter(Boolean).join(" ⢠")," ","(excluded)"]}):null,x?t.jsx("div",{style:{width:"100%",height:120,marginTop:10},children:t.jsx(Gl,{width:"100%",height:"100%",children:t.jsxs(KV,{data:x,layout:"vertical",margin:{top:0,right:8,bottom:0,left:0},children:[t.jsx(Ql,{type:"number",hide:!0}),t.jsx(Zl,{type:"category",dataKey:"name",width:58,tick:{fill:"var(--color-gray-500)",fontSize:12,fontWeight:800},axisLine:!1,tickLine:!1}),t.jsx(Vl,{formatter:v=>`${Number(v||0)}`,contentStyle:{borderRadius:10,border:`1px solid ${V}`,fontWeight:750}}),t.jsx(i8,{dataKey:"value",radius:[8,8,8,8],children:x.map(v=>t.jsx(py,{fill:v.fill},v.key))})]})})}):null]}),t.jsxs("div",{style:{border:`1px solid ${V}`,borderRadius:12,padding:14,background:Z,minWidth:0},children:[t.jsx("div",{style:{color:z,fontWeight:850,fontSize:"0.75rem"},children:"Users"}),t.jsx("div",{style:{color:O,fontWeight:950,fontSize:"1.35rem",marginTop:6},children:i?.totals?.users??"â"}),t.jsx("div",{style:{height:1,background:V,marginTop:10,marginBottom:10}}),t.jsxs("div",{style:{color:z,fontWeight:850,fontSize:"0.75rem"},children:["Projects ",t.jsx("span",{style:{color:Pe,fontWeight:800},children:"(active)"})]}),t.jsx("div",{style:{color:O,fontWeight:950,fontSize:"1.35rem",marginTop:6},children:typeof i?.totals?.projects=="number"?i.totals.projects:"â"})]})]}),t.jsxs("div",{style:{display:"grid",gap:12,gridTemplateColumns:"repeat(auto-fit, minmax(320px, 1fr))",minWidth:0},children:[t.jsxs("div",{style:{border:`1px solid ${V}`,borderRadius:12,padding:14,background:Z,minWidth:0},children:[t.jsx("div",{style:{color:O,fontWeight:950,fontSize:"0.95rem"},children:"Subscriptions by status"}),t.jsx("div",{style:{display:"grid",gap:8,marginTop:10},children:y.length?y.map(v=>t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"120px 1fr 60px",gap:10,alignItems:"center",minWidth:0},children:[t.jsx("div",{style:{color:z,fontWeight:850,fontSize:"0.75rem",overflow:"hidden",textOverflow:"ellipsis"},children:v.key}),t.jsx("div",{style:{height:10,borderRadius:999,background:V,overflow:"hidden"},children:t.jsx("div",{style:{height:"100%",width:`${Math.min(100,v.value/Math.max(1,i?.totals?.subscriptions||1)*100)}%`,background:ot}})}),t.jsx("div",{style:{color:z,fontWeight:850,fontSize:"0.75rem",textAlign:"right"},children:v.value})]},v.key)):t.jsx("div",{style:{color:z,fontWeight:700,fontSize:"0.875rem"},children:"No data."})})]}),t.jsxs("div",{style:{border:`1px solid ${V}`,borderRadius:12,padding:14,background:Z,minWidth:0},children:[t.jsx("div",{style:{color:O,fontWeight:950,fontSize:"0.95rem"},children:"Active subs by plan (top)"}),t.jsx("div",{style:{display:"grid",gap:10,marginTop:10},children:w.length?w.map(v=>t.jsxs("div",{style:{display:"grid",gap:6,minWidth:0},children:[t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:10,minWidth:0},children:[t.jsxs("div",{style:{color:O,fontWeight:850,fontSize:"0.825rem",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[v.label," ",t.jsxs("span",{style:{color:Pe,fontWeight:800},children:["(",v.key,")"]})]}),t.jsx("div",{style:{color:z,fontWeight:850,fontSize:"0.825rem"},children:v.value})]}),t.jsx("div",{style:{height:10,borderRadius:999,background:V,overflow:"hidden"},children:t.jsx("div",{style:{height:"100%",width:`${Math.min(100,v.value/Math.max(1,w[0]?.value||1)*100)}%`,background:ot}})}),t.jsxs("div",{style:{color:Pe,fontWeight:750,fontSize:"0.75rem"},children:["Est. MRR: ",f_(v.mrr_cents,v.currency)]})]},v.key)):t.jsx("div",{style:{color:z,fontWeight:700,fontSize:"0.875rem"},children:"No data."})})]}),t.jsxs("div",{style:{border:`1px solid ${V}`,borderRadius:12,padding:14,background:Z,minWidth:0},children:[t.jsx("div",{style:{color:O,fontWeight:950,fontSize:"0.95rem"},children:"New subscriptions (last 14 days)"}),t.jsx("div",{style:{display:"grid",gap:10,marginTop:10},children:j.last.length?t.jsx("div",{style:{display:"grid",gridTemplateColumns:`repeat(${j.last.length}, minmax(0, 1fr))`,gap:6,alignItems:"end"},children:j.last.map(v=>t.jsxs("div",{style:{display:"grid",gap:6,justifyItems:"center"},children:[t.jsx("div",{style:{width:"100%",height:46,display:"flex",alignItems:"flex-end"},children:t.jsx("div",{title:`${v.date}: ${v.count}`,style:{width:"100%",height:`${Math.max(6,Math.round(Number(v.count||0)/j.max*46))}px`,borderRadius:6,background:ot,opacity:.9}})}),t.jsx("div",{style:{color:Pe,fontWeight:800,fontSize:"0.7rem"},children:String(v.date).slice(5)})]},v.date))}):t.jsx("div",{style:{color:z,fontWeight:700,fontSize:"0.875rem"},children:"No data."})})]})]}),t.jsxs("div",{style:{display:"grid",gap:12,gridTemplateColumns:"repeat(auto-fit, minmax(220px, 1fr))",minWidth:0},children:[i?.credits&&t.jsxs("div",{style:{border:`1px solid ${V}`,borderRadius:12,padding:14,background:Z,minWidth:0},children:[t.jsx("div",{style:{color:O,fontWeight:950,fontSize:"0.95rem"},children:"Platform Credits"}),t.jsx("div",{style:{color:Pe,fontWeight:750,fontSize:"0.72rem",marginTop:2},children:new Date(i.credits.period+"T00:00:00").toLocaleDateString(void 0,{month:"short",year:"numeric"})}),t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:8,marginTop:10},children:[t.jsxs("div",{children:[t.jsx("div",{style:{color:z,fontWeight:800,fontSize:"0.68rem",textTransform:"uppercase"},children:"Included"}),t.jsx("div",{style:{color:O,fontWeight:900,fontSize:"1.1rem"},children:al(i.credits.total_included)})]}),t.jsxs("div",{children:[t.jsx("div",{style:{color:z,fontWeight:800,fontSize:"0.68rem",textTransform:"uppercase"},children:"Purchased"}),t.jsx("div",{style:{color:O,fontWeight:900,fontSize:"1.1rem"},children:al(i.credits.total_purchased)})]}),t.jsxs("div",{children:[t.jsx("div",{style:{color:z,fontWeight:800,fontSize:"0.68rem",textTransform:"uppercase"},children:"Used"}),t.jsx("div",{style:{color:O,fontWeight:900,fontSize:"1.1rem"},children:al(i.credits.total_used)})]}),t.jsxs("div",{children:[t.jsx("div",{style:{color:z,fontWeight:800,fontSize:"0.68rem",textTransform:"uppercase"},children:"Remaining"}),t.jsx("div",{style:{color:i.credits.total_remaining>0?Vt:"#dc2626",fontWeight:900,fontSize:"1.1rem"},children:al(i.credits.total_remaining)})]})]}),t.jsxs("div",{style:{color:Pe,fontWeight:750,fontSize:"0.72rem",marginTop:8},children:[i.credits.active_orgs," org",i.credits.active_orgs!==1?"s":""," with credit usage"]}),i.credits.chat_by_tier&&i.credits.chat_by_tier.length>0&&t.jsxs("div",{style:{marginTop:10},children:[t.jsx("div",{style:{color:z,fontWeight:800,fontSize:"0.68rem",textTransform:"uppercase",marginBottom:4},children:"Chat by tier"}),i.credits.chat_by_tier.map(v=>t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:8,fontSize:"0.78rem",fontWeight:700,color:O,padding:"2px 0"},children:[t.jsx("span",{style:{textTransform:"capitalize"},children:v.tier}),t.jsxs("span",{style:{color:z},children:[al(v.credits)," cr / ",al(v.events)," msgs"]})]}
23899,v.tier))]})]}),i?.addons&&t.jsxs("div",{style:{border:`1px solid ${V}`,borderRadius:12,padding:14,background:Z,minWidth:0},children:[t.jsx("div",{style:{color:O,fontWeight:950,fontSize:"0.95rem"},children:"Add-on Subscriptions"}),t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:8,marginTop:10},children:[t.jsxs("div",{children:[t.jsx("div",{style:{color:z,fontWeight:800,fontSize:"0.68rem",textTransform:"uppercase"},children:"Orgs with add-ons"}),t.jsx("div",{style:{color:O,fontWeight:900,fontSize:"1.1rem"},children:i.addons.total_orgs})]}),t.jsxs("div",{children:[t.jsx("div",{style:{color:z,fontWeight:800,fontSize:"0.68rem",textTransform:"uppercase"},children:"Monthly credits"}),t.jsx("div",{style:{color:O,fontWeight:900,fontSize:"1.1rem"},children:al(i.addons.total_monthly_credits)})]})]}),i.addons.orgs.length>0&&t.jsx("div",{style:{marginTop:10,maxHeight:200,overflow:"auto"},children:t.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"0.72rem"},children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx("th",{style:{textAlign:"left",fontWeight:700,color:Pe,padding:"3px 4px",borderBottom:`1px solid ${V}`},children:"Org"}),t.jsx("th",{style:{textAlign:"right",fontWeight:700,color:Pe,padding:"3px 4px",borderBottom:`1px solid ${V}`},children:"Extra"}),t.jsx("th",{style:{textAlign:"right",fontWeight:700,color:Pe,padding:"3px 4px",borderBottom:`1px solid ${V}`},children:"Cr/mo"})]})}),t.jsx("tbody",{children:i.addons.orgs.map(v=>t.jsxs("tr",{children:[t.jsxs("td",{style:{fontWeight:650,color:O,padding:"3px 4px",borderBottom:`1px solid ${V}`},children:[v.organization_name,t.jsxs("span",{style:{color:Pe,fontWeight:600,marginLeft:4},children:["(",v.plan_family,")"]})]}),t.jsxs("td",{style:{textAlign:"right",fontWeight:650,color:z,padding:"3px 4px",borderBottom:`1px solid ${V}`},children:[v.extra_models.length>0?`${v.extra_models.length} LLM`:"",v.extra_models.length>0&&v.prompt_packs>0?" + ":"",v.prompt_packs>0?`${v.prompt_packs} pack`:"",v.extra_models.length===0&&v.prompt_packs===0?"â":""]}),t.jsx("td",{style:{textAlign:"right",fontWeight:700,color:O,padding:"3px 4px",borderBottom:`1px solid ${V}`},children:al(v.monthly_addon_credits)})]},v.organization_id))})]})})]}),i?.credit_tier_distribution&&i.credit_tier_distribution.length>0&&t.jsxs("div",{style:{border:`1px solid ${V}`,borderRadius:12,padding:14,background:Z,minWidth:0},children:[t.jsx("div",{style:{color:O,fontWeight:950,fontSize:"0.95rem"},children:"Active Subs by Plan (all tiers)"}),t.jsx("div",{style:{display:"grid",gap:6,marginTop:10},children:i.credit_tier_distribution.map(v=>t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:8},children:[t.jsxs("div",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[t.jsx("span",{style:{fontWeight:800,fontSize:"0.78rem",color:O},children:v.plan_name}),t.jsxs("span",{style:{fontWeight:700,fontSize:"0.68rem",color:Pe,marginLeft:4},children:["(",v.plan_code,")"]})]}),t.jsx("span",{style:{fontWeight:900,fontSize:"0.85rem",color:O,flexShrink:0},children:v.count})]},v.plan_code))})]})]})]})}const Ib=p.textarea.withConfig({displayName:"ui__JsonArea",componentId:"sc-1m30hr0-0"})` 23900 width: 100%; 23901 min-height: 240px; 23902 resize: vertical; 23903 border: 1px solid ${V}; 23904 border-radius: 0.875rem; 23905 padding: 0.75rem 0.875rem; 23906 font-size: 0.8125rem; 23907 font-weight: 650; 23908 color: ${O}; 23909 background: ${Z}; 23910 outline: none; 23911 line-height: 1.35; 23912 font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; 23913 23914 &:focus { 23915 border-color: ${ot}; 23916 box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.16); 23917 } 23918`,Bee=p.pre.withConfig({displayName:"ui__JsonPreview",componentId:"sc-1m30hr0-1"})` 23919 width: 100%; 23920 min-height: 240px; 23921 max-height: 320px; 23922 overflow: auto; 23923 border: 1px solid ${V}; 23924 border-radius: 0.875rem; 23925 padding: 0.75rem 0.875rem; 23926 font-size: 0.75rem; 23927 font-weight: 650; 23928 color: ${O}; 23929 background: ${At}; 23930 line-height: 1.35; 23931 margin: 0; 23932 font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; 23933`,Ni=p.div.withConfig({displayName:"ui__TwoCol",componentId:"sc-1m30hr0-2"})` 23934 display: grid; 23935 grid-template-columns: 1fr 1fr; 23936 gap: 0.75rem; 23937 23938 @media (max-width: 980px) { 23939 grid-template-columns: 1fr; 23940 } 23941`,en=p.div.withConfig({displayName:"ui__MiniLabel",componentId:"sc-1m30hr0-3"})` 23942 font-size: 0.75rem; 23943 font-weight: 850; 23944 letter-spacing: 0.04em; 23945 text-transform: uppercase; 23946 color: ${z}; 23947 margin-bottom: 0.35rem; 23948`;
23948function GAt({open:e,saving:n,loading:i,error:r,detail:o,draft:s,setDraft:a,onClose:c,onSave:u}){return t.jsx(Hn,{isOpen:e,onClose:()=>{n||c()},title:"Subscription entitlements",description:"View plan entitlements and customize overrides for this workspace subscription.",size:"lg",showCloseButton:!1,footer:t.jsxs("div",{style:{display:"flex",gap:"0.75rem",justifyContent:"space-between",flexWrap:"wrap"},children:[t.jsx(he,{type:"button",variant:"outline",size:"sm",disabled:n||i,onClick:()=>a("{}"),children:"Reset overrides"}),t.jsx("div",{style:{display:"flex",gap:"0.75rem",justifyContent:"flex-end"},children:t.jsx(he,{type:"button",variant:"primary",size:"sm",disabled:n||i||!o,onClick:u,children:n?"Savingâ¦":"Save"})})]}),children:i?t.jsx("div",{style:{display:"flex",flexDirection:"column",gap:10},children:t.jsx($p,{rows:6})}):r?t.jsx("div",{style:{fontSize:"0.875rem",fontWeight:650,color:z},children:r}):o?t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"0.85rem"},children:[t.jsxs("div",{style:{fontSize:"0.875rem",fontWeight:700,color:O},children:["Org #",o.organization_id," ⢠",o.organization_name||"â"," ⢠Plan ",o.plan?.name||o.plan?.code||"â"," â¢"," ",o.status]}),t.jsxs(Ni,{children:[t.jsxs("div",{children:[t.jsx(en,{children:"Plan entitlements (read-only)"}),t.jsx(Bee,{children:JSON.stringify(o.entitlements?.plan||{},null,2)})]}),t.jsxs("div",{children:[t.jsx(en,{children:"Overrides (editable)"}),t.jsx(Ib,{value:s,onChange:m=>a(m.target.value),spellCheck:!1})]})]}),t.jsxs("div",{children:[t.jsx(en,{children:"Effective entitlements (plan + overrides)"}),t.jsx(Bee,{children:JSON.stringify(o.entitlements?.effective||{},null,2)})]})]}):t.jsx("div",{style:{fontSize:"0.875rem",fontWeight:650,color:z},children:"No subscription selected."})})}function VAt({open:e,saving:n,error:i,canEdit:r,isNew:o,plan:s,code:a,setCode:c,name:u,setName:m,active:h,setActive:g,trialDays:x,setTrialDays:y,currency:w,setCurrency:j,priceMonthlyCents:v,setPriceMonthlyCents:_,priceYearlyCents:$,setPriceYearlyCents:k,originalPriceMonthlyCents:P,setOriginalPriceMonthlyCents:S,originalPriceYearlyCents:I,setOriginalPriceYearlyCents:A,entitlementsDraft:E,setEntitlementsDraft:B,onClose:T,onSave:M}){return t.jsxs(Hn,{isOpen:e,onClose:()=>{n||T()},title:o?"Create plan":r?"Update plan":"View plan",description:"Plans are global. Edit entitlements carefully.",size:"lg",showCloseButton:!1,footer:t.jsxs("div",{style:{display:"flex",gap:"0.75rem",justifyContent:"space-between",flexWrap:"wrap"},children:[t.jsx(he,{type:"button",variant:"outline",size:"sm",disabled:n,onClick:T,children:"Cancel"}),r?t.jsx(he,{type:"button",variant:"primary",size:"sm",disabled:n,onClick:M,children:n?"Savingâ¦":o?"Create":"Save"}):null]}),children:[i?t.jsx("div",{style:{marginBottom:"0.75rem",color:z,fontSize:"0.875rem",fontWeight:650},children:i}):null,t.jsxs("div",{style:{display:"grid",gap:"0.9rem"},children:[!o&&s?t.jsxs("div",{style:{color:z,fontSize:"0.75rem",fontWeight:650},children:["Plan #",s.id]}):null,t.jsxs(Ni,{children:[t.jsxs("div",{children:[t.jsx(en,{children:"Code"}),t.jsx(Xt,{value:a,onChange:R=>c(R.target.value),disabled:!r,fullWidth:!0})]}),t.jsxs("div",{children:[t.jsx(en,{children:"Name"}),t.jsx(Xt,{value:u,onChange:R=>m(R.target.value),disabled:!r,fullWidth:!0})]})]}),t.jsxs(Ni,{children:[t.jsxs("div",{style:{display:"grid",alignContent:"start"},children:[t.jsx(en,{children:"Active"}),t.jsxs("label",{style:{display:"inline-flex",alignItems:"center",gap:8,fontWeight:750,color:O},children:[t.jsx("input",{type:"checkbox",checked:h,onChange:R=>g(R.target.checked),disabled:!r}),"Enabled"]})]}),t.jsxs("div",{children:[t.jsx(en,{children:"Trial days"}),t.jsx(Xt,{value:x,onChange:R=>y(R.target.value),disabled:!r,placeholder:"e.g. 14",fullWidth:!0})]})]}),t.jsxs(Ni,{children:[t.jsxs("div",{children:[t.jsx(en,{children:"Currency"}),t.jsx(Xt,{value:w,onChange:R=>j(R.target.value),disabled:!r,placeholder:"usd",fullWidth:!0})]}),t.jsx("div",{})]}),t.jsxs(Ni,{children:[t.jsxs("div",{children:[t.jsx(en,{children:"Price monthly (cents)"}
23948),t.jsx(Xt,{value:v,onChange:R=>_(R.target.value),disabled:!r,fullWidth:!0})]}),t.jsxs("div",{children:[t.jsx(en,{children:"Price yearly (cents)"}),t.jsx(Xt,{value:$,onChange:R=>k(R.target.value),disabled:!r,fullWidth:!0})]})]}),t.jsxs(Ni,{children:[t.jsxs("div",{children:[t.jsx(en,{children:"Original monthly (cents)"}),t.jsx(Xt,{value:P,onChange:R=>S(R.target.value),disabled:!r,fullWidth:!0})]}),t.jsxs("div",{children:[t.jsx(en,{children:"Original yearly (cents)"}),t.jsx(Xt,{value:I,onChange:R=>A(R.target.value),disabled:!r,fullWidth:!0})]})]}),t.jsxs("div",{children:[t.jsx(en,{children:"Entitlements (JSON object)"}),t.jsx(Ib,{value:E,onChange:R=>B(R.target.value),disabled:!r,spellCheck:!1,style:{minHeight:240}})]})]})]})}function KAt({open:e,saving:n,error:i,canEdit:r,name:o,setName:s,slug:a,setSlug:c,discountPercent:u,setDiscountPercent:m,returnUrl:h,setReturnUrl:g,active:x,setActive:y,onClose:w,onSave:j}){return t.jsxs(Hn,{isOpen:e,onClose:()=>{n||w()},title:"Create partner",description:"Partners manage customers via the Partner API.",size:"lg",showCloseButton:!1,footer:t.jsxs("div",{style:{display:"flex",gap:"0.75rem",justifyContent:"space-between",flexWrap:"wrap"},children:[t.jsx(he,{type:"button",variant:"outline",size:"sm",disabled:n,onClick:w,children:"Cancel"}),r?t.jsx(he,{type:"button",variant:"primary",size:"sm",disabled:n,onClick:j,children:n?"Creatingâ¦":"Create"}):null]}),children:[i?t.jsx("div",{style:{marginBottom:"0.75rem",color:z,fontSize:"0.875rem",fontWeight:650},children:i}):null,t.jsxs("div",{style:{display:"grid",gap:"0.9rem"},children:[t.jsxs(Ni,{children:[t.jsxs("div",{children:[t.jsx(en,{children:"Name"}),t.jsx(Xt,{value:o,onChange:v=>s(v.target.value),disabled:!r,fullWidth:!0})]}),t.jsxs("div",{children:[t.jsx(en,{children:"Slug"}),t.jsx(Xt,{value:a,onChange:v=>c(v.target.value),disabled:!r,fullWidth:!0})]})]}),t.jsxs(Ni,{children:[t.jsxs("div",{children:[t.jsx(en,{children:"Discount percent"}),t.jsx(Xt,{value:u,onChange:v=>m(v.target.value),disabled:!r,placeholder:"e.g. 10",fullWidth:!0})]}),t.jsxs("div",{children:[t.jsx(en,{children:"Return URL"}),t.jsx(Xt,{value:h,onChange:v=>g(v.target.value),disabled:!r,placeholder:"https://vendor.example.com/...",fullWidth:!0})]})]}),t.jsxs("div",{style:{display:"grid",alignContent:"start"},children:[t.jsx(en,{children:"Active"}),t.jsxs("label",{style:{display:"inline-flex",alignItems:"center",gap:8,fontWeight:750,color:O},children:[t.jsx("input",{type:"checkbox",checked:x,onChange:v=>y(v.target.checked),disabled:!r}),"Enabled"]})]})]})]})}function YAt({users:e,meta:n,selectedUserId:i,onPrev:r,onNext:o,listLoading:s,controls:a}){return t.jsxs("div",{style:{width:"100%",height:"100%",display:"flex",flexDirection:"column",minHeight:0,gap:10},children:[t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",gap:8},children:[t.jsx("div",{style:{fontWeight:950,color:O},children:"Users"}),t.jsxs("div",{style:{fontSize:"0.75rem",fontWeight:750,color:z},children:[n.total," total"]})]}),a?t.jsx("div",{children:a}):null,t.jsx("div",{style:{flex:1,minHeight:0,overflow:"auto",border:`1px solid ${V}`,borderRadius:12,background:Z},children:s?t.jsx("div",{style:{padding:12,display:"grid",gap:10},children:Array.from({length:8}).map((c,u)=>t.jsxs("div",{style:{display:"grid",gap:6},children:[t.jsx(nt,{height:14,width:`${70-u%4*8}%`}),t.jsx(nt,{height:10,width:`${52-u%3*10}%`})]},u))}):e.length?e.map(c=>{const u=i===c.id,m=[`#${c.id}`,c.full_name?c.full_name:null,c.admin_role?`role: ${c.admin_role}`:null,c.email_verified?"verified":"unverified"].filter(Boolean);return t.jsxs(Dn,{to:`/admin/resources?resource=users&user_id=${c.id}`,style:{display:"block",padding:"10px 12px",textDecoration:"none",borderBottom:`1px solid ${$e}`,background:u?"rgba(79, 70, 229, 0.06)":"transparent"},children:[t.jsx("div",{style:{color:O,fontWeight:900,fontSize:"0.875rem",lineHeight:1.15,wordBreak:"break-word"},children:c.email}),t.jsx("div",{style:{marginTop:4,color:z,fontWeight:700,fontSize:"0.75rem",lineHeight:1.25},children:m.join(" ⢠")})]},c.id)}):t.jsx("div",{style:{padding:12,color:z,fontWeight:650,fontSize:"0.875rem"},children:"No users found."})}),t.jsx(pi,{page:n.page,totalPages:n.totalPages,total:n.total,onPrev:r,onNext:o,c
23948ompact:!0})]})}function XAt({canEdit:e,canDelete:n,lockedByPartner:i,loading:r,saving:o,error:s,detail:a,firstName:c,setFirstName:u,lastName:m,setLastName:h,email:g,setEmail:x,password:y,setPassword:w,deleted:j,setDeleted:v,adminRole:_,setAdminRole:$,onSave:k,onAction:P,onDestroy:S,onBack:I}){return t.jsxs("div",{style:{padding:14,border:`1px solid ${V}`,borderRadius:12,background:Z,display:"grid",gap:12},children:[t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:12,flexWrap:"wrap"},children:[t.jsxs("div",{style:{display:"grid",gap:2},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:2},children:[t.jsx("button",{type:"button",onClick:I,disabled:o,style:{all:"unset",cursor:"pointer",display:"inline-flex",alignItems:"center",color:z,borderRadius:4,marginLeft:-4},"aria-label":"Back to list",children:t.jsx(Bd,{size:18})}),t.jsx("span",{style:{fontWeight:950,color:O,fontSize:"1rem"},children:"User"})]}),t.jsx("div",{style:{color:z,fontSize:"0.8125rem",fontWeight:700},children:a?`User #${a.id} ⢠provider: ${a.provider||"â"} ⢠verified: ${a.email_verified?"yes":"no"}`:"â"})]}),t.jsx("div",{style:{display:"flex",gap:8,alignItems:"center"},children:e?t.jsx(he,{type:"button",size:"sm",variant:"primary",disabled:o||r||!a,onClick:k,children:o?"Savingâ¦":"Save"}):null})]}),i?t.jsx("div",{style:{color:z,fontSize:"0.8125rem",fontWeight:750},children:"This user is managed by a partner workspace and cannot be edited."}):null,e?null:t.jsx("div",{style:{color:z,fontSize:"0.75rem",fontWeight:700},children:"Read-only."}),s?t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:s}):null,r||!a?t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:"Loadingâ¦"}):t.jsxs("div",{style:{display:"grid",gap:"0.9rem"},children:[t.jsxs(Ni,{children:[t.jsxs("div",{children:[t.jsx(en,{children:"First name"}),t.jsx(Xt,{value:c,onChange:A=>u(A.target.value),disabled:!e,fullWidth:!0})]}),t.jsxs("div",{children:[t.jsx(en,{children:"Last name"}),t.jsx(Xt,{value:m,onChange:A=>h(A.target.value),disabled:!e,fullWidth:!0})]})]}),t.jsxs("div",{children:[t.jsx(en,{children:"Email"}),t.jsx(Xt,{value:g,onChange:A=>x(A.target.value),disabled:!e,fullWidth:!0})]}),String(a.provider||"")==="google"?null:t.jsxs("div",{children:[t.jsx(en,{children:"Password"}),t.jsx(Em,{value:y,onChange:A=>w(A.target.value),placeholder:"Leave blank to keep unchanged",disabled:!e,fullWidth:!0})]}),t.jsxs(Ni,{children:[t.jsxs("div",{children:[t.jsx(en,{children:"Admin role"}),t.jsx(Fn,{value:_,onChange:A=>$(String(A||"")),disabled:!e,options:[{value:"",label:"none"},{value:"admin",label:"admin"},{value:"editor",label:"editor"},{value:"viewer",label:"viewer"}],fullWidth:!0})]}),n?t.jsxs("div",{style:{display:"grid",alignContent:"start"},children:[t.jsx(en,{children:"Deleted"}),t.jsxs("label",{style:{display:"inline-flex",alignItems:"center",gap:8,fontWeight:750,color:O},children:[t.jsx("input",{type:"checkbox",checked:j,onChange:A=>v(A.target.checked),disabled:!e}),"Mark deleted"]})]}):t.jsx("div",{})]}),e?t.jsxs("div",{style:{display:"grid",gap:8},children:[t.jsx(en,{children:"Actions"}),t.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[t.jsx(he,{type:"button",size:"sm",variant:"outline",disabled:o,onClick:()=>P("verify_email"),children:"Verify email"}),t.jsx(he,{type:"button",size:"sm",variant:"outline",disabled:o,onClick:()=>P("complete_onboarding"),children:"Complete onboarding"}),t.jsx(he,{type:"button",size:"sm",variant:"outline",disabled:o,onClick:()=>P("reset_add_project_flow"),children:"Reset add-project flow"}),n?t.jsx(he,{type:"button",size:"sm",variant:"danger",disabled:o||!a,onClick:S,children:"Destroy user"}):null]})]}):null]})]})}function QAt({canEdit:e,saving:n,refreshTokens:i,refreshTokensLoading:r,refreshTokensError:o,refreshTokensMeta:s,onRefreshTokensPrev:a,onRefreshTokensNext:c,onRefreshTokensOpen:u,onDestroyRefreshToken:m}){return t.jsxs("details",{style:{border:`1px solid ${V}`,borderRadius:12,padding:14,background:Z},onToggle:h=>{h.currentTarget.open&&u()},children:[t.jsx("summary",{style:{cursor:"pointer",fontWeight:900,color:O,fontSize:"0.95rem"},children:"Refresh tokens"}),t.jsxs("div",{style:{display:"grid",gap:10,marginTop:10},children:[o?t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:o}):null,r?t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:"Loading refresh tokensâ¦"}):i.length?t.jsxs(t.Fragment,{children:[t.jsx(tr,{style:{maxHeight:260,overflow:"auto"},children:t.jsxs(nr,{$minWidth:"48rem",children:[t.jsx(pr,{children:t.jsxs(Cn,{children:[t.jsx(Et,{children:"Token"}),t.jsx(Et,{children:"Status"}),t.jsx(Et,{children:"Last used"}),t.jsx(Et,{children:"Expires"}),t.jsx(Et,{children:"IP"}),t.jsx(Et,{children:"Geo"}),t.jsx(Et,{children:"Created"}),e?t.jsx(Et,{children:"Actions"}):null]})}),t.jsx(mr,{children:i.map(h=>{const g=!!h.revoked_at,x=!!(h.expires_at&&new Date(h.expires_at).getTime()<=Date.now()),y=g?"revoked":x?"expired":"active";return t.jsxs(Cn,{children:[t.jsxs(bt,{$muted:!0,children:["â¢â¢â¢â¢ ",h.last4]}),t.jsx(bt,{$muted:!0,children:y}),t.jsx(bt,{$muted:!0,children:h.last_used_at?new Date(h.last_used_at).toLocaleStr
23948ing():"â"}),t.jsx(bt,{$muted:!0,children:h.expires_at?new Date(h.expires_at).toLocaleString():"â"}),t.jsx(bt,{$muted:!0,children:h.ip||"â"}),t.jsx(bt,{$muted:!0,children:h.geo_country||"â"}),t.jsx(bt,{$muted:!0,children:h.created_at?new Date(h.created_at).toLocaleString():"â"}),e?t.jsx(bt,{children:t.jsx(he,{type:"button",size:"sm",variant:"danger",disabled:n,onClick:()=>m(h.id),children:"Destroy"})}):null]},h.id)})})]})}),t.jsx(pi,{page:s.page,totalPages:s.totalPages,total:s.total,onPrev:a,onNext:c,compact:!0})]}):t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:"No refresh tokens."})]})]})}const ZAt=p.div.withConfig({displayName:"AdminUiLayout__Wrap",componentId:"sc-1uyk5sc-0"})` 23949 padding: 1.25rem 1.25rem 2rem; 23950 min-height: 100%; 23951 background: ${At}; 23952 display: flex; 23953 flex-direction: column; 23954`,JAt=p.div.withConfig({displayName:"AdminUiLayout__Max",componentId:"sc-1uyk5sc-1"})` 23955 max-width: 72rem; 23956 margin: 0 auto; 23957 width: 100%; 23958 flex: 1 1 auto; 23959 min-height: 0; 23960 display: flex; 23961 flex-direction: column; 23962`,eNt=p.div.withConfig({displayName:"AdminUiLayout__Hero",componentId:"sc-1uyk5sc-2"})` 23963 background: ${Z}; 23964 border: 1px solid ${Rt}; 23965 box-shadow: 0 16px 40px rgba(17, 24, 39, 0.08); 23966 border-radius: 1rem; 23967 padding: 1.1rem 1.25rem; 23968`,tNt=p.div.withConfig({displayName:"AdminUiLayout__TitleRow",componentId:"sc-1uyk5sc-3"})` 23969 display: inline-flex; 23970 align-items: center; 23971 gap: 0.625rem; 23972 color: ${O}; 23973 font-weight: 850; 23974 font-size: 1.1rem; 23975`,nNt=p.div.withConfig({displayName:"AdminUiLayout__Sub",componentId:"sc-1uyk5sc-4"})` 23976 margin-top: 0.45rem; 23977 color: ${z}; 23978 font-size: 0.875rem; 23979 line-height: 1.45; 23980`,iNt=p.div.withConfig({displayName:"AdminUiLayout__Panel",componentId:"sc-1uyk5sc-5"})` 23981 margin-top: 1rem; 23982 flex: 1 1 auto; 23983 min-height: 0; 23984 display: flex; 23985 flex-direction: column; 23986`,rNt=p.div.withConfig({displayName:"AdminUiLayout__UsersLayout",componentId:"sc-1uyk5sc-6"})` 23987 display: flex; 23988 gap: 0.75rem; 23989 flex: 1; 23990 min-height: 0; 23991 min-width: 0; 23992 align-items: stretch; 23993 23994 @media (max-width: 980px) { 23995 flex-direction: column; 23996 } 23997`,oNt=p.div.withConfig({displayName:"AdminUiLayout__UsersSide",componentId:"sc-1uyk5sc-7"})` 23998 flex: 0 0 340px; 23999 min-width: 300px; 24000 max-width: 380px; 24001 min-height: 0; 24002 position: sticky; 24003 top: 1rem; 24004 height: calc(100vh - 240px); 24005 overflow: hidden; 24006 24007 @media (max-width: 980px) { 24008 flex: 0 0 auto; 24009 width: 100%; 24010 min-width: 0; 24011 max-width: none; 24012 height: clamp(260px, 45vh, 380px); 24013 max-height: none; 24014 position: relative; 24015 overflow: hidden; 24016 } 24017`,sNt=p.div.withConfig({displayName:"AdminUiLayout__UsersMain",componentId:"sc-1uyk5sc-8"})` 24018 flex: 1; 24019 min-height: 0; 24020 min-width: 0; 24021 overflow: auto; 24022 24023 @media (max-width: 980px) { 24024 overflow: visible; 24025 overflow-x: hidden; 24026 } 24027`,aNt=p.div.withConfig({displayName:"AdminUiLayout__OrgsLayout",componentId:"sc-1uyk5sc-9"})` 24028 display: flex; 24029 gap: 0.75rem; 24030 flex: 1; 24031 min-height: 0; 24032 min-width: 0; 24033 align-items: stretch; 24034 24035 @media (max-width: 980px) { 24036 flex-direction: column; 24037 } 24038`,lNt=p.div.withConfig({displayName:"AdminUiLayout__OrgsSide",componentId:"sc-1uyk5sc-10"})` 24039 flex: 0 0 340px; 24040 min-width: 300px; 24041 max-width: 380px; 24042 min-height: 0; 24043 position: sticky; 24044 top: 1rem; 24045 height: calc(100vh - 240px); 24046 overflow: hidden; 24047 24048 @media (max-width: 980px) { 24049 flex: 0 0 auto; 24050 width: 100%; 24051 min-width: 0; 24052 max-width: none; 24053 height: clamp(260px, 45vh, 380px); 24054 max-height: none; 24055 position: relative; 24056 overflow: hidden; 24057 } 24058`,cNt=p.div.withConfig({displayName:"AdminUiLayout__OrgsMain",componentId:"sc-1uyk5sc-11"})` 24059 flex: 1; 24060 min-height: 0; 24061 min-width: 0; 24062 overflow: auto; 24063 24064 @media (max-width: 980px) { 24065 overflow: visible; 24066 overflow-x: hidden; 24067 } 24068`,dNt=p.div.withConfig({displayName:"AdminUiLayout__ProjectsLayout",componentId:"sc-1uyk5sc-12"})` 24069 display: flex; 24070 gap: 0.75rem; 24071 flex: 1; 24072 min-height: 0; 24073 min-width: 0; 24074 align-items: stretch; 24075 24076 @media (max-width: 980px) { 24077 flex-direction: column; 24078 } 24079`,uNt=p.div.withConfig({displayName:"AdminUiLayout__ProjectsSide",componentId:"sc-1uyk5sc-13"})` 24080 flex: 0 0 340px; 24081 min-width: 300px; 24082 max-width: 380px; 24083 min-height: 0; 24084 position: sticky; 24085 top: 1rem; 24086 height: calc(100vh - 240px); 24087 overflow: hidden; 24088 24089 @media (max-width: 980px) { 24090 flex: 0 0 auto; 24091 width: 100%; 24092 min-width: 0; 24093 max-width: none; 24094 height: clamp(260px, 45vh, 380px); 24095 max-height: none; 24096 position: relative; 24097 overflow: hidden; 24098 } 24099`,pNt=p.div.withConfig({displayName:"AdminUiLayout__ProjectsMain",componentId:"sc-1uyk5sc-14"})` 24100 flex: 1; 24101 min-height: 0; 24102 min-width: 0; 24103 overflow: auto; 24104 24105 @media (max-width: 980px) { 24106 overflow: visible; 24107 overflow-x: hidden; 24108 } 24109`,mNt=p.div.withConfig({displayName:"AdminUiLayout__SubsLayout",componentId:"sc-1uyk5sc-15"})` 24110 display: flex; 24111 gap: 0.75rem; 24112 flex: 1; 24113 min-height: 0; 24114 min-width: 0; 24115 align-items: stretch; 24116 24117 @media (max-width: 980px) { 24118 flex-direction: column; 24119 } 24120`,hNt=p.div.withConfig({displayName:"AdminUiLayout__SubsSide",componentId:"sc-1uyk5sc-16"})` 24121 flex: 0 0 340px; 24122 min-width: 300px; 24123 max-width: 380px; 24124 min-height: 0; 24125 position: sticky; 24126 top: 1rem; 24127 height: calc(100vh - 240px); 24128 overflow: hidden; 24129 24130 @media (max-width: 980px) { 24131 flex: 0 0 auto; 24132 width: 100%; 24133 min-width: 0; 24134 max-width: none; 24135 height: clamp(260px, 45vh, 380px); 24136 max-height: none; 24137 position: relative; 24138 overflow: hidden; 24139 } 24140`,fNt=p.div.withConfig({displayName:"AdminUiLayout__SubsMain",componentId:"sc-1uyk5sc-17"})` 24141 flex: 1; 24142 min-height: 0; 24143 min-width: 0; 24144 overflow: auto; 24145 24146 @media (max-width: 980px) { 24147 overflow: visible; 24148 overflow-x: hidden; 24149 } 24150`,gNt=p.div.withConfig({displayName:"AdminUiLayout__PartnersLayout",componentId:"sc-1uyk5sc-18"})` 24151 display: flex; 24152 gap: 0.75rem; 24153 flex: 1; 24154 min-height: 0; 24155 min-width: 0; 24156 align-items: stretch; 24157 24158 @media (max-width: 980px) { 24159 flex-direction: column; 24160 } 24161`,yNt=p.div.withConfig({displayName:"AdminUiLayout__PartnersSide",componentId:"sc-1uyk5sc-19"})` 24162 flex: 0 0 340px; 24163 min-width: 300px; 24164 max-width: 380px; 24165 min-height: 0; 24166 position: sticky; 24167 top: 1rem; 24168 height: calc(100vh - 240px); 24169 overflow: hidden; 24170 24171 @media (max-width: 980px) { 24172 flex: 0 0 auto; 24173 width: 100%; 24174 min-width: 0; 24175 max-width: none; 24176 height: clamp(260px, 45vh, 380px); 24177 max-height: none; 24178 position: relative; 24179 overflow: hidden; 24180 } 24181`,xNt=p.div.withConfig({displayName:"AdminUiLayout__PartnersMain",componentId:"sc-1uyk5sc-20"})` 24182 flex: 1; 24183 min-height: 0; 24184 min-width: 0; 24185 overflow: auto; 24186 24187 @media (max-width: 980px) { 24188 overflow: visible; 24189 overflow-x: hidden; 24190 } 24191`;function bNt(e){const{users:n,meta:i,selectedUserId:r,listLoading:o,searchQuery:s,setSearchQuery:a,isFullAdmin:c,usersAdminsOnly:u,setUsersAdminsOnly:m,onPrev:h,onNext:g,canEdit:x,canDelete:y,lockedByPartner:w,detailLoa
24191ding:j,detailSaving:v,detailError:_,detail:$,firstName:k,setFirstName:P,lastName:S,setLastName:I,email:A,setEmail:E,password:B,setPassword:T,deleted:M,setDeleted:R,adminRole:F,setAdminRole:Y,onSave:H,onAction:U,onDestroy:X,onBack:Q,refreshTokens:K,refreshTokensLoading:G,refreshTokensError:L,refreshTokensMeta:q,onRefreshTokensPrev:W,onRefreshTokensNext:oe,onRefreshTokensOpen:se,onDestroyRefreshToken:de}=e;return t.jsxs(rNt,{children:[t.jsx(oNt,{children:t.jsx(YAt,{users:n,meta:i,selectedUserId:r,listLoading:o,controls:t.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center",flexWrap:"wrap"},children:[t.jsx(Ed,{value:s,onChange:a,placeholder:"Search usersâ¦",containerStyle:{flex:1,minWidth:200}}),c?t.jsx(vf,{label:"Admins only",active:u,onClick:()=>m(le=>!le),title:"Only users with an admin role (admin/editor/viewer)"}):null]}),onPrev:h,onNext:g})}),t.jsx(sNt,{children:r?t.jsxs("div",{style:{display:"grid",gap:12},children:[t.jsx(XAt,{canEdit:x,canDelete:y,lockedByPartner:w,loading:j,saving:v,error:_,detail:$,firstName:k,setFirstName:P,lastName:S,setLastName:I,email:A,setEmail:E,password:B,setPassword:T,deleted:M,setDeleted:R,adminRole:F,setAdminRole:Y,onSave:H,onAction:U,onDestroy:X,onBack:Q}),t.jsx(QAt,{canEdit:x,saving:v,refreshTokens:K,refreshTokensLoading:G,refreshTokensError:L,refreshTokensMeta:q,onRefreshTokensPrev:W,onRefreshTokensNext:oe,onRefreshTokensOpen:se,onDestroyRefreshToken:de},String(r))]}):t.jsx("div",{style:{padding:16,color:z,fontWeight:650},children:"Select a user from the list to view/edit details."})})]})}function vNt({orgs:e,meta:n,selectedOrgId:i,onPrev:r,onNext:o,listLoading:s,controls:a}){return t.jsxs("div",{style:{width:"100%",height:"100%",display:"flex",flexDirection:"column",minHeight:0,gap:10},children:[t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",gap:8},children:[t.jsx("div",{style:{fontWeight:950,color:O},children:"Workspaces"}),t.jsxs("div",{style:{fontSize:"0.75rem",fontWeight:750,color:z},children:[n.total," total"]})]}),a?t.jsx("div",{children:a}):null,t.jsx("div",{style:{flex:1,minHeight:0,overflow:"auto",border:`1px solid ${V}`,borderRadius:12,background:Z},children:s?t.jsx("div",{style:{padding:12,display:"grid",gap:10},children:Array.from({length:8}).map((c,u)=>t.jsxs("div",{style:{display:"grid",gap:6},children:[t.jsx(nt,{height:14,width:`${74-u%4*8}%`}),t.jsx(nt,{height:10,width:`${50-u%3*10}%`})]},u))}):e.length?e.map(c=>{const u=i===c.id,m=[`#${c.id}`,c.organization_type,c.deleted?"deleted":null,c.billing_status?`billing: ${c.billing_status}`:null].filter(Boolean);return t.jsxs(Dn,{to:`/admin/resources?resource=organizations&org_id=${c.id}`,style:{display:"block",padding:"10px 12px",textDecoration:"none",borderBottom:`1px solid ${$e}`,background:u?"rgba(79, 70, 229, 0.06)":"transparent"},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[t.jsx("span",{style:{color:O,fontWeight:900,fontSize:"0.875rem",lineHeight:1.15,wordBreak:"break-word"},children:c.name||"(unnamed)"}),c.billing_exempt_reason==="sales_assisted_setup"?t.jsx("span",{style:{flexShrink:0,padding:"1px 6px",borderRadius:9999,fontSize:"0.6rem",fontWeight:900,letterSpacing:"0.03em",background:"rgba(79, 70, 229, 0.08)",color:"rgb(79, 70, 229)",border:"1px solid rgba(79, 70, 229, 0.18)",lineHeight:1.6},children:"Sales"}):null]}),t.jsx("div",{style:{marginTop:4,color:z,fontWeight:700,fontSize:"0.75rem",lineHeight:1.25},children:m.join(" ⢠")})]},c.id)}):t.jsx("div",{style:{padding:12,color:z,fontWeight:650,fontSize:"0.875rem"},children:"No workspaces found."})}),t.jsx(pi,{page:n.page,totalPages:n.totalPages,total:n.total,onPrev:r,onNext:o,compact:!0})]})}function wNt({detail:e,onClose:n,onConfirm:i}){const r=(e.plan_trial_days||0)>0,[o,s]=l.useState(String(e.plan_trial_days||0));return t.jsx(Hn,{isOpen:!0,onClose:n,title:"Hand off workspace",description:`"${e.name||"(unnamed)"}" (#${e.id})`,size:"md",showCloseButton:!1,footer:t.jsxs("div",{style:{display:"flex",gap:"0.75rem",justifyContent:"space-between",flexWrap:"wrap"},children:[t.jsx(he,{type:"button",variant:"outline",size:"sm",onClick:n,children:"Cancel"}),t.jsx(he,{type:"button",variant:"primary",size:"sm",onClick:()=>{const a=r?Math.max(0,parseInt(o,10)||0):null;i(a)},children:"Confirm Hand Off"})]}),children:t.jsxs("div",{style:{display:"grid",gap:"0.9rem"},children:[t.jsxs("div",{style:{fontSize:"0.8125rem",fontWeight:650,color:O,lineHeight:1.6},children:["This will:",t.jsxs("ul",{style:{margin:"0.35rem 0 0",paddingLeft:"1.2rem"},children:[t.jsx("li",{children:"Remove billing exemption (customer must add billing)"}),t.jsx("li",{children:"Remove you from this workspace"})]})]}),t.jsx("div",{style:{padding:"0.6rem 0.75rem",background:"rgba(245, 158, 11, 0.06)",borderRadius:8,border:"1px solid rgba(245, 158, 11, 0.15)",fontSize:"0.75rem",fontWeight:750,color:z,lineHeight:1.5},children:"Make sure the customer has been added as an owner first."}),r?t.jsxs("div",{children:[t.jsx(en,{children:"Trial days for customer"}),t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[t.jsx(Xt,{type:"number",value:o,onChange:a=>s(a.target.value),min:0,style:{width:120}}),t.jsxs("span",{style:{fontSize:"0.75rem",color:z,fontWeight:650},children:["Plan default: ",e.plan_trial_days," days"]})]})]}):t.jsx("div",{style:{fontSize:"0.75rem",color:z,fontWeight:650},children:"No trial period â the customer's plan does not have a trial configured."})]})})}function jNt({canEdit:e,canDelete:n,loading:i,saving:r,error:o,detail:s,name:a,setName:c,orgType:u,setOrgType:m,description:h,setDescription:g,deleted:x,setDeleted:y,cadence:w,setCadence:j,quickScanEnabled:v,setQuickScanEnabled:_,suggestionGenerationProfile:$,setSuggestionGenerationProfile:k,canEditCa
24191dence:P,onSave:S,onDestroy:I,onHandoff:A,onDeleteSalesSetup:E,onBack:B}){const[T,M]=l.useState(!1),R=s?.billing_exempt&&s?.billing_exempt_reason==="sales_assisted_setup",F=e&&R,Y=e&&R;return t.jsxs("div",{style:{padding:14,border:`1px solid ${V}`,borderRadius:12,background:Z,display:"grid",gap:12,maxWidth:"100%"},children:[t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:12,flexWrap:"wrap"},children:[t.jsxs("div",{style:{display:"grid",gap:2},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:2},children:[t.jsx("button",{type:"button",onClick:B,disabled:r,style:{all:"unset",cursor:"pointer",display:"inline-flex",alignItems:"center",color:z,borderRadius:4,marginLeft:-4},"aria-label":"Back to list",children:t.jsx(Bd,{size:18})}),t.jsx("span",{style:{fontWeight:950,color:O,fontSize:"1rem"},children:"Workspace"})]}),t.jsx("div",{style:{color:z,fontSize:"0.8125rem",fontWeight:700,wordBreak:"break-word"},children:s?t.jsxs(t.Fragment,{children:["Workspace #",s.id," ⢠type: ",s.organization_type," ⢠billing: ",s.billing_status,s.billing_exempt_reason==="sales_assisted_setup"?t.jsx("span",{style:{marginLeft:6,display:"inline-block",padding:"1px 7px",borderRadius:9999,fontSize:"0.675rem",fontWeight:900,letterSpacing:"0.03em",background:"rgba(79, 70, 229, 0.08)",color:"rgb(79, 70, 229)",border:"1px solid rgba(79, 70, 229, 0.18)",verticalAlign:"middle"},children:"Sales Setup"}):null,s.partner?t.jsxs(t.Fragment,{children:[" ","⢠partner:"," ",t.jsxs(Dn,{to:`/admin/resources?resource=partners&partner_id=${s.partner.id}`,style:{color:O,textDecoration:"underline",textUnderlineOffset:3},children:[s.partner.name," #",s.partner.id]})]}):null,s.partner_customer_id?t.jsxs(t.Fragment,{children:[" ⢠customer: ",s.partner_customer_id]}):null,s.subscription_id?t.jsxs(t.Fragment,{children:[" ","â¢"," ",t.jsxs(Dn,{to:`/admin/resources?resource=billing&sub=subscriptions&subscription_id=${s.subscription_id}`,style:{color:O,textDecoration:"underline",textUnderlineOffset:3},children:["subscription #",s.subscription_id]})]}):null]}):"â"})]}),t.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center",flexWrap:"wrap"},children:[e?t.jsx(he,{type:"button",size:"sm",variant:"primary",disabled:r||i||!s,onClick:S,children:r?"Savingâ¦":"Save"}):null,F?t.jsx(he,{type:"button",size:"sm",variant:"outline",disabled:r||i||!s,onClick:()=>M(!0),children:"Hand Off to Customer"}):null,Y?t.jsx(he,{type:"button",size:"sm",variant:"danger",disabled:r||i||!s,onClick:E,children:"Delete Workspace"}):null,n&&!R?t.jsx(he,{type:"button",size:"sm",variant:"danger",disabled:r||i||!s,onClick:I,children:"Destroy workspace"}):null]})]}),e?null:t.jsx("div",{style:{color:z,fontSize:"0.75rem",fontWeight:700},children:"Read-only."}),o?t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:o}):null,i||!s?t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:"Loadingâ¦"}):t.jsxs("div",{style:{display:"grid",gap:"0.9rem"},children:[s.usage_snapshot?t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(110px, 1fr))",gap:8},children:[t.jsx(_E,{label:"Projects",value:s.usage_snapshot.projects}),t.jsx(_E,{label:"Prompts",value:s.usage_snapshot.active_prompts}),t.jsx(_E,{label:"Topics",value:s.usage_snapshot.topics})]}):null,t.jsxs("div",{children:[t.jsx(en,{children:"Name"}),t.jsx(Xt,{value:a,onChange:H=>c(H.target.value),fullWidth:!0,disabled:!e})]}),t.jsxs("div",{children:[t.jsx(en,{children:"Type"}),t.jsx(Fn,{value:u,onChange:H=>m(String(H||"")),options:[{value:"business",label:"business"},{value:"agency",label:"agency"}],fullWidth:!0,disabled:!e})]}),t.jsx(Ni,{children:n?t.jsxs("div",{style:{display:"grid",alignContent:"start"},children:[t.jsx(en,{children:"Deleted"}),t.jsxs("label",{style:{display:"inline-flex",alignItems:"center",gap:8,fontWeight:750,color:O},children:[t.jsx("input",{type:"checkbox",checked:x,onChange:H=>y(H.target.checked),disabled:!e}),"Mark deleted"]})]}):t.jsx("div",{})}),P?t.jsxs(t.Fragment,{children:[t.jsxs("div",{children:[t.jsx(en,{children:"Projects Cadence"}),t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[t.jsx(Fn,{value:w,onChange:H=>j(String(H||"")),options:[...w==="mixed"||w===""?[{value:w,label:w==="mixed"?"mixed (varies)":"â not set â"}]:[],{value:"daily",label:"daily"},{value:"weekly",label:"weekly"},{value:"monthly",label:"monthly"}],fullWidth:!0,disabled:!e,dropdownPortal:!0}),w==="mixed"?t.jsx("span",{style:{fontSize:"0.75rem",color:z,fontWeight:650,whiteSpace:"nowrap"},children:"Projects have different cadences. Selecting one will apply to all."}):null]})]}),t.jsxs("div",{children:[t.jsx(en,{children:"Suggestion Generation"}),t.jsx(Fn,{value:$,onChange:H=>k(String(H||"default_v1")),options:[{value:"default_v1",label:"Default"},{value:"local_restaurant_v1",label:"Local restaurant discovery"}],fullWidth:!0,disabled:!e,dropdownPortal:!0})]})]}):null,t.jsxs("div",{style:{display:"grid",alignContent:"start"}
24191,children:[t.jsx(en,{children:"Quick Scan API"}),t.jsxs("label",{style:{display:"inline-flex",alignItems:"center",gap:8,fontWeight:750,color:O},children:[t.jsx("input",{type:"checkbox",checked:v,onChange:H=>_(H.target.checked),disabled:!P}),"Enabled"]})]}),t.jsxs("div",{children:[t.jsx(en,{children:"Description"}),t.jsx(Xt,{value:h,onChange:H=>g(H.target.value),fullWidth:!0,disabled:!e})]})]}),T&&s?t.jsx(wNt,{detail:s,onClose:()=>M(!1),onConfirm:H=>{M(!1),A(H)}}):null]})}function _E({label:e,value:n}){return t.jsxs("div",{style:{border:`1px solid ${V}`,borderRadius:10,background:Z,padding:"0.6rem 0.7rem"},children:[t.jsx("div",{style:{color:z,fontSize:"0.68rem",fontWeight:850,textTransform:"uppercase",letterSpacing:"0.02em"},children:e}),t.jsx("div",{style:{color:O,fontSize:"1rem",fontWeight:950,marginTop:3},children:n.toLocaleString()})]})}function _Nt({canEdit:e,saving:n,users:i,usersLoading:r,usersError:o,usersMeta:s,onUsersPrev:a,onUsersNext:c,onUsersOpen:u,addUserEmail:m,setAddUserEmail:h,addUserId:g,setAddUserId:x,addUserRole:y,setAddUserRole:w,onAddUser:j,onUpdateUserRole:v,onRemoveUser:_}){return t.jsxs("details",{style:{border:`1px solid ${V}`,borderRadius:12,padding:14,background:Z},onToggle:$=>{$.currentTarget.open&&u()},children:[t.jsx("summary",{style:{cursor:"pointer",fontWeight:900,color:O,fontSize:"0.95rem"},children:"Workspace users"}),t.jsxs("div",{style:{display:"grid",gap:10,marginTop:10},children:[e?null:t.jsx("div",{style:{color:z,fontSize:"0.75rem",fontWeight:650},children:"Read-only."}),o?t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:o}):null,e?t.jsxs("div",{style:{display:"grid",gap:8},children:[t.jsxs(Ni,{children:[t.jsxs("div",{children:[t.jsx(en,{children:"User email"}),t.jsx(Xt,{value:m,onChange:$=>h($.target.value),placeholder:"[email protected]",fullWidth:!0})]}),t.jsxs("div",{children:[t.jsx(en,{children:"Or user ID"}),t.jsx(Xt,{value:g,onChange:$=>x($.target.value),placeholder:"123",fullWidth:!0})]})]}),t.jsxs(Ni,{children:[t.jsxs("div",{children:[t.jsx(en,{children:"Role"}),t.jsx(Fn,{value:y,onChange:$=>w(String($||"viewer")),options:[{value:"owner",label:"owner"},{value:"editor",label:"editor"},{value:"viewer",label:"viewer"}],fullWidth:!0})]}),t.jsx("div",{style:{display:"flex",justifyContent:"flex-end",alignItems:"flex-end"},children:t.jsx(he,{type:"button",size:"sm",variant:"outline",disabled:n||r,onClick:j,children:"Add / update user"})})]})]}):null,r?t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:"Loading usersâ¦"}):i.length?t.jsxs(t.Fragment,{children:[t.jsx(tr,{style:{maxHeight:260,overflow:"auto"},children:t.jsxs(nr,{$minWidth:"48rem",children:[t.jsx(pr,{children:t.jsxs(Cn,{children:[t.jsx(Et,{children:"User"}),t.jsx(Et,{children:"Email"}),t.jsx(Et,{children:"Role"}),t.jsx(Et,{children:"Added"}),e?t.jsx(Et,{children:"Actions"}):null]})}),t.jsx(mr,{children:i.map($=>t.jsxs(Cn,{children:[t.jsxs(bt,{children:[t.jsx("div",{style:{fontWeight:800,color:O,fontSize:"0.875rem"},children:$.full_name||"â"}),t.jsxs("div",{style:{fontSize:"0.75rem",fontWeight:700,color:z},children:["ID ",$.user_id," â¢"," ",t.jsx(Dn,{to:`/admin/resources?resource=users&user_id=${$.user_id}`,style:{color:O,textDecoration:"underline",textUnderlineOffset:3},children:"open user"})]})]}),t.jsx(bt,{$muted:!0,children:$.email}),t.jsx(bt,{children:e?t.jsx(Fn,{value:$.role,onChange:k=>v($.user_id,String(k||$.role)),options:[{value:"owner",label:"owner"},{value:"editor",label:"editor"},{value:"viewer",label:"viewer"}],fullWidth:!0}):t.jsx("span",{style:{color:z,fontWeight:750},children:$.role})}),t.jsx(bt,{$muted:!0,children:$.created_at?new Date($.created_at).toLocaleString():"â"}),e?t.jsx(bt,{children:t.jsx(he,{type:"button",size:"sm",variant:"outline",onClick:()=>_($.user_id,$.email),children:"Remove"})}):null]},$.user_id))})]})}),t.jsx(pi,{page:s.page,totalPages:s.totalPages,total:s.total,onPrev:a,onNext:c,compact:!0})]}):t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:"No users."})]})]})}const aP=92;function lP(e){const[n,i,r]=String(e||"").split("-").map(o=>Number(o));
24191return new Date(n,(i||1)-1,r||1)}function CNt(e){const n=e.getFullYear(),i=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return`${n}-${i}-${r}`}function Xue(e,n){const i=lP(e),o=lP(n).getTime()-i.getTime(),s=Math.floor(o/(1440*60*1e3))+1;return Number.isFinite(s)?s:0}function SNt(e){const n=e.start,i=e.end;if(!n||!i)return{value:e,clamped:!1};const r=lP(n),o=lP(i);if(Number.isNaN(r.getTime())||Number.isNaN(o.getTime()))return{value:e,clamped:!1};if(o.getTime()<r.getTime())return{value:{start:i,end:i},clamped:!0};if(Xue(n,i)<=aP)return{value:e,clamped:!1};const a=new Date(r);return a.setDate(a.getDate()+(aP-1)),{value:{start:n,end:CNt(a)},clamped:!0}}function uD({value:e,onChange:n,disabled:i}){const[r,o]=l.useState(null),s=l.useMemo(()=>!e?.start||!e?.end?0:Xue(e.start,e.end),[e?.start,e?.end]);return t.jsxs("div",{style:{display:"grid",gap:6},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:10,flexWrap:"wrap"},children:[t.jsxs("div",{style:{color:z,fontSize:"0.75rem",fontWeight:800},children:["Range (max ",aP," days)"]}),s>0?t.jsxs("div",{style:{color:z,fontSize:"0.75rem",fontWeight:750},children:[s," days"]}):null]}),t.jsx(rh,{value:e,disabled:i,presets:[7,14,30,90],onChange:a=>{const{value:c,clamped:u}=SNt(a);o(u?`Range limited to ${aP} days.`:null),n(c)}}),r?t.jsx("div",{style:{color:z,fontSize:"0.75rem",fontWeight:700},children:r}):null]})}function kNt({canEdit:e,saving:n,apiKeysLoading:i,apiKeysError:r,apiKeys:o,usageTarget:s,usageLoading:a,usageError:c,usage:u,usageRange:m,onUsageRangeChange:h,onLoadUsage:g,onToggleEnabled:x,onDeleteKey:y,onApiKeysOpen:w}){return t.jsxs("details",{style:{border:`1px solid ${V}`,borderRadius:12,padding:14,background:Z},onToggle:j=>{j.currentTarget.open&&w()},children:[t.jsx("summary",{style:{cursor:"pointer",fontWeight:900,color:O,fontSize:"0.95rem"},children:"API keys"}),t.jsx("div",{style:{display:"grid",gap:10,marginTop:10},children:i?t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:"Loading API keysâ¦"}):r?t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:r}):o.length?t.jsxs("div",{style:{display:"grid",gap:12},children:[t.jsx("div",{style:{display:"flex",minWidth:0},children:t.jsx(tr,{style:{flex:1,minWidth:0,maxWidth:"100%",maxHeight:260,overflowX:"auto",overflowY:"auto",WebkitOverflowScrolling:"touch"},children:t.jsxs(nr,{$minWidth:"44rem",children:[t.jsx(pr,{children:t.jsxs(Cn,{children:[t.jsx(Et,{children:"Name"}),t.jsx(Et,{children:"Last 4"}),t.jsx(Et,{children:"Enabled"}),t.jsx(Et,{children:"Last used"}),t.jsx(Et,{children:"Created"}),t.jsx(Et,{children:"Usage"}),e?t.jsx(Et,{children:"Manage"}):null]})}),t.jsx(mr,{children:o.map(j=>t.jsxs(Cn,{children:[t.jsx(bt,{children:t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[j.name,j.partner_managed?t.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:3,padding:"1px 6px",borderRadius:9999,fontSize:"0.6875rem",fontWeight:800,border:`1px solid ${V}`,background:z,color:Z,whiteSpace:"nowrap"},children:[t.jsx(ku,{size:9}),"Partner"]}):null]})}),t.jsx(bt,{$muted:!0,children:j.last4}),t.jsx(bt,{$muted:!0,children:j.enabled?"yes":"no"}),t.jsx(bt,{$muted:!0,children:j.last_used_at?new Date(j.last_used_at).toLocaleString():"â"}),t.jsx(bt,{$muted:!0,children:j.created_at?new Date(j.created_at).toLocaleString():"â"}),t.jsx(bt,{children:t.jsx(he,{type:"button",size:"sm",variant:"outline",disabled:a&&s?.id!==j.id,onClick:()=>g(j),children:s?.id===j.id?"Hide":a&&s?.id===j.id?"Loadingâ¦":"View"})}),e?t.jsx(bt,{children:j.partner_managed?t.jsx(at,{content:"This key is managed by a partner and cannot be modified here.",children:t.jsxs("div",{style:{display:"inline-flex",gap:8,justifyContent:"flex-end",opacity:.5},children:[t.jsx(he,{type:"button",size:"sm",variant:"outline",disabled:!0,children:j.enabled?"Disable":"Enable"}),t.jsx(he,{type:"button",size:"sm",variant:"danger",disabled:!0,children:"Delete"})]})}):t.jsxs("div",{style:{display:"inline-flex",gap:8,justifyContent:"flex-end"},children:[t.jsx(he,{type:"button",size:"sm",variant:"outline",disabled:n,onClick:()=>x(j,!j.enabled),children:j.enabled?"Disable":"Enable"}),t.jsx(he,{type:"button",size:"sm",variant:"danger",disabled:n,onClick:()=>y(j),children:"Delete"})]})}):null]},j.id))})]})})}),s?t.jsxs("div",{style:{display:"grid",gap:8},children:[t.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:12},children:[t.jsxs("div",{children:[t.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:8,fontWeight:900,color:O,fontSize:"0.875rem"},children:[t.jsx(gl,{size:16}),"Usage ⢠",s.name]}),u?.from&&u?.to?t.jsxs("div",{style:{marginTop:2,color:z,fontSize:"0.75rem",fontWeight:700},children:[new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric"}).format(new Date(u.from))," â"," ",new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric"}).format(new Date(u.to))]}):null]}),t.jsxs("div",{style:{textAlign:"right"},children:[t.jsx("div",{style:{fontSize:"0.875rem",fontWeight:900,color:O},children:(u?.series||[]).reduce((j,v)=>j+(v.requests||0),0)}),t.jsx("div",{style:{fontSize:"0.75rem",fontWeight:700,color:z},children:"requests"})]})]}),t.jsx(uD,{value:m,onChange:h,disabled:a}),c?t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:c}):u?t.jsx("div",{style:{maxWidth:"48rem"},children:t.jsx(TA,{data:u.series||[],height:180})}):t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:a?"Loading usageâ¦":"Select an API key to view usage."})]}):t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:"Select an API key to view usage."})]}):t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:"No API keys."})})]})}function $Nt({onClose:e,onCreate:n}){const[i,r]=l.useState(""),[o,s]=l.useState("business"),[a,c]=l.useState(""),[u,m]=l.useState([]),[h,g]=l.useState(!0),[x,y]=l.useState(!1),[w,j]=l.useState(null);l.useEffect(()=>{let k=!1;return(async()=>{try{const I=await(await ue("/api/v1/admin/plans",{method:"GET"})).json().catch(()=>({}));if(k)return;
24191const E=(I?.admin?.plans||[]).filter(B=>B.active&&B.entitlements?.partner_public!==!0);m(E)}catch{k||m([])}finally{k||g(!1)}})(),()=>{k=!0}},[]);const v=u;l.useEffect(()=>{if(v.length===0){c("");return}if(!v.some(k=>k.code===a)){const k=v.find(P=>P.code==="core");c(k?k.code:v[0].code)}},[v,a]);const _=i.trim().length>0&&a.length>0&&!x&&!h,$=async()=>{if(_){y(!0),j(null);try{await n(i.trim(),o,a,"saas")}catch(k){j(k instanceof Error?k.message:"Failed to create workspace")}finally{y(!1)}}};return t.jsxs(Hn,{isOpen:!0,onClose:()=>{x||e()},title:"Create workspace (sales-assisted)",description:"Creates a billing-exempt workspace. You'll be added as owner to set it up. Hand off to the customer when ready.",size:"lg",showCloseButton:!1,footer:t.jsxs("div",{style:{display:"flex",gap:"0.75rem",justifyContent:"space-between",flexWrap:"wrap"},children:[t.jsx(he,{type:"button",variant:"outline",size:"sm",disabled:x,onClick:e,children:"Cancel"}),t.jsx(he,{type:"button",variant:"primary",size:"sm",disabled:!_,onClick:$,children:x?"Creatingâ¦":"Create workspace"})]}),children:[w?t.jsx("div",{style:{marginBottom:"0.75rem",color:"#b91c1c",fontSize:"0.875rem",fontWeight:650},children:w}):null,t.jsxs("div",{style:{display:"grid",gap:"0.9rem"},children:[t.jsxs("div",{children:[t.jsx(en,{children:"Workspace name"}),t.jsx(Xt,{value:i,onChange:k=>r(k.target.value),placeholder:"e.g. Acme Corp",fullWidth:!0,autoFocus:!0})]}),t.jsxs(Ni,{children:[t.jsxs("div",{children:[t.jsx(en,{children:"Type"}),t.jsx(Fn,{value:o,onChange:k=>s(String(k||"business")),options:[{value:"business",label:"Business"},{value:"agency",label:"Agency"}],fullWidth:!0,dropdownPortal:!0})]}),t.jsx("div",{})]}),t.jsxs("div",{children:[t.jsx(en,{children:"Plan"}),h?t.jsx("div",{style:{color:z,fontSize:"0.8125rem",fontWeight:650,padding:"0.5rem 0"},children:"Loading plansâ¦"}):v.length===0?t.jsx("div",{style:{color:z,fontSize:"0.8125rem",fontWeight:650,padding:"0.5rem 0"},children:"No active plans found for this product."}):t.jsx(Fn,{value:a,onChange:k=>c(String(k||"")),options:v.map(k=>({value:k.code,label:`${k.name} (${k.code})`})),fullWidth:!0,dropdownPortal:!0})]}),t.jsx("div",{style:{marginTop:4,padding:"0.6rem 0.75rem",background:"color-mix(in srgb, var(--color-brand-600) 10%, var(--color-white))",borderRadius:8,border:"1px solid color-mix(in srgb, var(--color-brand-600) 28%, transparent)"},children:t.jsxs("div",{style:{fontSize:"0.75rem",fontWeight:750,color:"color-mix(in srgb, var(--color-gray-900) 88%, var(--color-white))",lineHeight:1.5},children:["The workspace will be created with ",t.jsx("strong",{style:{color:"var(--color-brand-600)"},children:"billing exempt"})," so you can set it up fully.",t.jsxs(t.Fragment,{children:[" When ready, use ",t.jsx("strong",{style:{color:"var(--color-brand-600)"},children:"Hand Off"})," on the workspace detail in the admin UI to remove exemption and your access. The customer will then need to add billing."]})]})})]})]})}function INt(e){const{orgs:n,meta:i,selectedOrgId:r,listLoading:o,searchQuery:s,setSearchQuery:a,isFullAdmin:c,orgsDeletedOnly:u,setOrgsDeletedOnly:m,orgsOnboardingOnly:h,setOrgsOnboardingOnly:g,orgsSalesOnly:x,setOrgsSalesOnly:y,onPrev:w,onNext:j,canEdit:v,canDelete:_,detailLoading:$,detailSaving:k,detailError:P,detail:S,name:I,setName:A,orgType:E,setOrgType:B,description:T,setDescription:M,deleted:R,setDeleted:F,cadence:Y,setCadence:H,quickScanEnabled:U,setQuickScanEnabled:X,suggestionGenerationProfile:Q,setSuggestionGenerationProfile:K,onSave:G,onDestroy:L,onCreateWorkspace:q,onHandoff:W,onDeleteSalesSetup:oe,onBack:se,users:de,usersLoading:le,usersError:me,usersMeta:ee,onUsersPrev:ne,onUsersNext:Ae,onUsersOpen:_e,addUserEmail:we,setAddUserEmail:Ke,addUserId:ce,setAddUserId:ie,addUserRole:Re,setAddUserRole:Be,onAddUser:tt,onUpdateUserRole:dt,onRemoveUser:je,apiKeysLoading:Me,apiKeysError:Se,apiKeys:it,usageTarget:De,usageLoading:te,usageError:ge,usage:Je,onLoadUsage:Ee,usageRange:Xe,onUsageRangeChange:yt,onToggleEnabled:Ne,onDeleteKey:Le,onApiKeysOpen:Ue}=e,[We,Qe]=l.useState(!1);return t.jsxs(aNt,{children:[t.jsx(lNt,{children:t.jsx(vNt,{orgs:n,meta:i,selectedOrgId:r,listLoading:o,controls:t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[t.jsx(Ed,{value:s,onChange:a,placeholder:"Search workspacesâ¦",containerStyle:{width:"100%"}}),t.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[t.jsx(vf,{label:"Onboarding",active:h,onClick:()=>{m(!1),y(!1),g(ht=>!ht)},title:"Show only onboarding workspaces (no subscription yet)"}),t.jsx(vf,{label:"Sales",active:x,onClick:()=>{m(!1),g(!1),y(ht=>!ht)},title:"Show only sales-assisted-setup workspaces"}),c?t.jsx(vf,{label:"Deleted",active:u,onClick:()=>{g(!1),y(!1),m(ht=>!ht)},title:"Show only deleted workspaces"}):null]}),v?t.jsx("button",{type:"button",onClick:()=>Qe(!0),style:{appearance:"none",border:"1px solid rgba(79, 70, 229, 0.25)",background:"rgba(79, 70, 229, 0.06)",color:"rgb(79, 70, 229)",fontWeight:800,fontSize:"0.8rem",padding:"0.45rem 0.75rem",borderRadius:8,cursor:"pointer",width:"100%",textAlign:"center"}
24191,children:"+ Create Workspace (Sales)"}):null]}),onPrev:w,onNext:j})}),t.jsx(cNt,{children:r?t.jsxs("div",{style:{display:"grid",gap:12},children:[t.jsx(jNt,{canEdit:v,canDelete:_,loading:$,saving:k,error:P,detail:S,name:I,setName:A,orgType:E,setOrgType:B,description:T,setDescription:M,deleted:R,setDeleted:F,cadence:Y,setCadence:H,quickScanEnabled:U,setQuickScanEnabled:X,suggestionGenerationProfile:Q,setSuggestionGenerationProfile:K,canEditCadence:c,onSave:G,onDestroy:L,onHandoff:W,onDeleteSalesSetup:oe,onBack:se}),t.jsx(_Nt,{canEdit:v,saving:k,users:de,usersLoading:le,usersError:me,usersMeta:ee,onUsersPrev:ne,onUsersNext:Ae,onUsersOpen:_e,addUserEmail:we,setAddUserEmail:Ke,addUserId:ce,setAddUserId:ie,addUserRole:Re,setAddUserRole:Be,onAddUser:tt,onUpdateUserRole:dt,onRemoveUser:je},`org-users-${String(r)}`),t.jsx(kNt,{canEdit:v,saving:k,apiKeysLoading:Me,apiKeysError:Se,apiKeys:it,usageTarget:De,usageLoading:te,usageError:ge,usage:Je,onLoadUsage:Ee,usageRange:Xe,onUsageRangeChange:yt,onToggleEnabled:Ne,onDeleteKey:Le,onApiKeysOpen:Ue},`org-keys-${String(r)}`)]}):t.jsx("div",{style:{padding:16,color:z,fontWeight:650},children:"Select a workspace from the list to view/edit details."})}),We?t.jsx($Nt,{onClose:()=>Qe(!1),onCreate:async(ht,pe,be,rt)=>{await q(ht,pe,be,rt),Qe(!1)}}):null]})}function PNt({projects:e,meta:n,selectedProjectId:i,activePromptsTotal:r,runnablePromptsTotal:o,onPrev:s,onNext:a,listLoading:c,controls:u}){return t.jsxs("div",{style:{width:"100%",height:"100%",display:"flex",flexDirection:"column",minHeight:0,gap:10},children:[t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",gap:8},children:[t.jsx("div",{style:{fontWeight:950,color:O},children:"Projects"}),t.jsxs("div",{style:{textAlign:"right"},children:[t.jsxs("div",{style:{fontSize:"0.75rem",fontWeight:750,color:z},children:[n.total," total"]}),t.jsxs("div",{style:{fontSize:"0.75rem",fontWeight:750,color:z},children:["Prompts (active): ",typeof r=="number"?r:"â"]}),t.jsxs("div",{style:{fontSize:"0.75rem",fontWeight:750,color:z},children:["Prompts (will run): ",typeof o=="number"?o:"â"]})]})]}),u?t.jsx("div",{children:u}):null,t.jsx("div",{style:{flex:1,minHeight:0,overflow:"auto",border:`1px solid ${V}`,borderRadius:12,background:Z},children:c?t.jsx("div",{style:{padding:12,display:"grid",gap:10},children:Array.from({length:8}).map((m,h)=>t.jsxs("div",{style:{display:"grid",gap:6},children:[t.jsx(nt,{height:14,width:`${74-h%4*8}%`}),t.jsx(nt,{height:10,width:`${54-h%3*10}%`})]},h))}):e.length?e.map(m=>{const h=i===m.id,g=[`#${m.id}`,`org: ${m.organization_id}`,m.country_code?m.country_code:null,m.cadence?m.cadence:null,m.deleted||m.deleted_at?"deleted":null].filter(Boolean);return t.jsxs(Dn,{to:`/admin/resources?resource=projects&project_id=${m.id}`,style:{display:"block",padding:"10px 12px",textDecoration:"none",borderBottom:`1px solid ${$e}`,background:h?"rgba(79, 70, 229, 0.06)":"transparent"},children:[t.jsx("div",{style:{color:O,fontWeight:900,fontSize:"0.875rem",lineHeight:1.15,wordBreak:"break-word"},children:m.name}),t.jsx("div",{style:{marginTop:4,color:z,fontWeight:700,fontSize:"0.75rem",lineHeight:1.25},children:g.join(" ⢠")})]},m.id)}):t.jsx("div",{style:{padding:12,color:z,fontWeight:650,fontSize:"0.875rem"},children:"No projects found."})}),t.jsx(pi,{page:n.page,totalPages:n.totalPages,total:n.total,onPrev:s,onNext:a,compact:!0})]})}function ANt({canEdit:e,canEditCadence:n,canDestroy:i,loading:r,saving:o,error:s,detail:a,name:c,setName:u,website:m,setWebsite:h,city:g,setCity:x,country:y,setCountry:w,language:j,setLanguage:v,focus:_,setFocus:$,description:k,setDescription:P,countryCode:S,setCountryCode:I,cadence:A,setCadence:E,customIdentifier:B,setCustomIdentifier:T,localMode:M,setLocalMode:R,suggestedAt:F,setSuggestedAt:Y,deletedAt:H,setDeletedAt:U,brandAliases:X,setBrandAliases:Q,onSave:K,onDestroy:G,onBack:L,onGaDisconnect:q,onGaResync:W,localContext:oe,setLocalContext:se,onReResolveLocalContext:de}){return t.jsxs("div",{style:{padding:14,border:`1px solid ${V}`,borderRadius:12,background:Z,display:"grid",gap:12,maxWidth:"100%",overflow:"hidden"},children:[t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:12,flexWrap:"wrap"},children:[t.jsxs("div",{style:{display:"grid",gap:2},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:2},children:[t.jsx("button",{type:"button",onClick:L,disabled:o,style:{all:"unset",cursor:"pointer",display:"inline-flex",alignItems:"center",color:z,borderRadius:4,marginLeft:-4},"aria-label":"Back to list",children:t.jsx(Bd,{size:18})}),t.jsx("span",{style:{fontWeight:950,color:O,fontSize:"1rem"},children:"Project"})]}),t.jsx("div",{style:{color:z,fontSize:"0.8125rem",fontWeight:700,wordBreak:"break-word"},children:a?t.jsxs(t.Fragment,{children:["Project #",a.id," ⢠org:"," ",t.jsx(Dn,{to:`/admin/resources?resource=organizations&org_id=${a.organization_id}`,style:{color:O,textDecoration:"underline",textUnderlineOffset:3},children:a.organization_id})," ","⢠cadence: ",a.cadence]}):"â"})]}),t.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center",flexWrap:"wrap"},children:[e?t.jsx(he,{type:"button",size:"sm",variant:"primary",disabled:o||r||!a,onClick:K,children:o?"Savingâ¦":"Save"}):null,i?t.jsx(he,{type:"button",size:"sm",variant:"danger",disabled:o||r||!a,onClick:G,children:"Destroy project"}):null]})]}),e?null:t.jsx("div",{style:{color:z,fontSize:"0.75rem",fontWeight:700},children:"Read-only."}),s?t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:s}):null,r||!a?t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:"Loadingâ¦"}):t.jsxs("div",{style:{display:"grid",gap:"0.9rem"},children:[t.jsxs(Ni,{children:[t.jsxs("div",{children:[t.jsx(en,{children:"Name"}),t.jsx(Xt,{value:c,onChange:le=>u(le.target.value),disabled:!e,fullWidth:!0})]}),t.jsxs("div",{children:[t.jsx(en,{children:"Website"}),t.jsx(Xt,{value:m,onChange:le=>h(le.target.value),disabled:!e,fullWidth:!0})]})]}),t.jsxs(Ni,{children:[t.jsxs("div",{children:[t.jsx(en,{children:"City"}),t.jsx(Xt,{value:g,onChange:le=>x(le.target.value),disabled:!e,fullWidth:!0})]}),t.jsxs("div",{children:[t.jsx(en,{children:"Country"}),t.jsx(Xt,{value:y,onChange:le=>w(le.target.value),disabled:!e,fullWidth:!0})]})]}),t.jsxs(Ni,{children:[t.jsxs("div",{children:[t.jsx(en,{children:"Country code"}),t.jsx(Xt,{value:S,onChange:le=>I(le.target.value),disabled:!e,fullWidth:!0})]}),t.jsxs("div",{children:[t.jsx(en,{children:"Cadence"}),t.jsx(Fn,{value:A,onChange:le=>E(String(le||"daily")),disabled:!e||!n,options:[{value:"daily",label:"daily"},{value:"weekly",label:"weekly"},{value:"monthly",label:"monthly"}],fullWidth:!0})]})]}),t.jsxs(Ni,{children:[t.jsxs("div",{children:[t.jsx(en,{children:"Language"}),t.jsx(Xt,{value:j,onChange:le=>v(le.target.value),disabled:!e,fullWidth:!0})]}),t.jsxs("div",{children:[t.jsx(en,{children:"Focus"}
24191),t.jsx(Xt,{value:_,onChange:le=>$(le.target.value),disabled:!e,fullWidth:!0})]})]}),t.jsxs("div",{children:[t.jsx(en,{children:"Description"}),t.jsx(Xt,{value:k,onChange:le=>P(le.target.value),disabled:!e,fullWidth:!0})]}),t.jsxs(Ni,{children:[t.jsxs("div",{children:[t.jsx(en,{children:"Custom identifier"}),t.jsx(Xt,{value:B,onChange:le=>T(le.target.value),disabled:!e,fullWidth:!0})]}),t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,paddingTop:18},children:[t.jsx("input",{type:"checkbox",checked:M,onChange:le=>R(le.target.checked),disabled:!e,id:"admin-project-local-mode",style:{accentColor:O}}),t.jsx("label",{htmlFor:"admin-project-local-mode",style:{fontSize:"0.8125rem",fontWeight:700,color:O,cursor:e?"pointer":"default"},children:"Local mode"})]})]}),t.jsxs(Ni,{children:[t.jsxs("div",{children:[t.jsx(en,{children:"Suggested prompts generated at"}),t.jsx(Xt,{value:F,onChange:le=>Y(le.target.value),disabled:!e,placeholder:"ISO8601 or blank",fullWidth:!0})]}),t.jsxs("div",{children:[t.jsx(en,{children:"Deleted at"}),t.jsx(Xt,{value:H,onChange:le=>U(le.target.value),disabled:!e,placeholder:"ISO8601 or blank",fullWidth:!0})]})]}),t.jsxs("div",{children:[t.jsx(en,{children:"Brand aliases (one per line)"}),t.jsx(Ib,{value:X,onChange:le=>Q(le.target.value),disabled:!e,spellCheck:!1,style:{minHeight:140}})]}),M&&t.jsx(NNt,{detail:a,canEdit:e,saving:o,localContext:oe,setLocalContext:se,onReResolve:de}),t.jsxs("div",{style:{marginTop:4,padding:12,border:`1px solid ${V}`,borderRadius:8,display:"grid",gap:8},children:[t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",flexWrap:"wrap",gap:8},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[t.jsx(en,{style:{margin:0},children:"Google Analytics"}),a.google_analytics?t.jsxs(t.Fragment,{children:[t.jsx("span",{style:{fontSize:"0.6875rem",fontWeight:700,padding:"2px 8px",borderRadius:6,background:a.google_analytics.status==="connected"?Vt:Ut,color:Z},children:a.google_analytics.status}),a.google_analytics.connected_via==="api"&&t.jsx("span",{style:{fontSize:"0.625rem",fontWeight:700,padding:"2px 6px",borderRadius:4,background:"#EEF2FF",color:"#4F46E5",letterSpacing:"0.02em"},children:"via API"})]}):t.jsx("span",{style:{fontSize:"0.6875rem",fontWeight:700,color:z},children:"Not connected"})]}),a.google_analytics&&q&&W?t.jsxs("div",{style:{display:"flex",gap:6},children:[a.google_analytics.status==="connected"?t.jsx(he,{type:"button",size:"sm",variant:"outline",disabled:o,onClick:W,children:"Resync (full)"}):null,t.jsx(he,{type:"button",size:"sm",variant:"danger",disabled:o,onClick:q,children:"Remove connection"})]}):null]}),a.google_analytics?t.jsxs("div",{style:{display:"grid",gap:4,fontSize:"0.75rem",color:z,fontWeight:600},children:[t.jsxs("div",{children:["Account: ",a.google_analytics.google_account_email||"â"]}),t.jsxs("div",{children:["Property: ",a.google_analytics.property_id||"â"," ⢠Account ID: ",a.google_analytics.account_id||"â"]}),t.jsxs("div",{children:["Last synced: ",a.google_analytics.last_synced_at||"never"," ⢠Connected: ",a.google_analytics.connected_at||"â"]}),a.google_analytics.error_message?t.jsxs("div",{style:{color:Ut},children:["Error: ",a.google_analytics.error_message]}):null]}):null]})]})]})}function NNt({detail:e,canEdit:n,saving:i,localContext:r,setLocalContext:o,onReResolve:s}){const[a,c]=l.useState(!1),u=!!(r.neighborhood||r.business_category),m=(g,x)=>{o({...r,[g]:x||null})},h=(g,x)=>{o({...r,[g]:x.split(",").map(y=>y.trim()).filter(Boolean)})};return t.jsxs("div",{style:{marginTop:4,padding:12,border:`1px solid ${V}`,borderRadius:8,display:"grid",gap:8},children:[t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",flexWrap:"wrap",gap:8},children:[t.jsxs("button",{type:"button",onClick:()=>c(!a),style:{all:"unset",cursor:"pointer",display:"flex",alignItems:"center",gap:6},children:[t.jsx(en,{style:{margin:0},children:"Local Context"}),u?t.jsx("span",{style:{fontSize:"0.625rem",fontWeight:700,padding:"2px 8px",borderRadius:6,background:Vt,color:Z},children:"Resolved"}):t.jsx("span",{style:{fontSize:"0.625rem",fontWeight:700,color:z},children:"Not resolved"}),a?t.jsx(yu,{size:14}):t.jsx(qn,{size:14})]}),t.jsx("div",{style:{display:"flex",gap:6},children:n&&s&&t.jsx(he,{type:"button",size:"sm",variant:"outline",disabled:i,onClick:s,children:"Re-resolve"})})]}),e?.local_context_resolved_at&&t.jsxs("div",{style:{fontSize:"0.6875rem",color:z,fontWeight:600},children:["Last resolved: ",new Date(e.local_context_resolved_at).toLocaleStr
24191ing()]}),a&&t.jsxs("div",{style:{display:"grid",gap:10,paddingTop:4},children:[t.jsxs(Ni,{children:[t.jsxs("div",{children:[t.jsx(en,{children:"Neighborhood"}),t.jsx(Xt,{value:r.neighborhood||"",onChange:g=>m("neighborhood",g.target.value),disabled:!n,fullWidth:!0})]}),t.jsxs("div",{children:[t.jsx(en,{children:"Corridor"}),t.jsx(Xt,{value:r.corridor||"",onChange:g=>m("corridor",g.target.value),disabled:!n,fullWidth:!0})]})]}),t.jsxs(Ni,{children:[t.jsxs("div",{children:[t.jsx(en,{children:"Region"}),t.jsx(Xt,{value:r.region||"",onChange:g=>m("region",g.target.value),disabled:!n,fullWidth:!0})]}),t.jsxs("div",{children:[t.jsx(en,{children:"Business Category"}),t.jsx(Xt,{value:r.business_category||"",onChange:g=>m("business_category",g.target.value),disabled:!n,fullWidth:!0})]})]}),t.jsxs(Ni,{children:[t.jsxs("div",{children:[t.jsx(en,{children:"Business Subcategory"}),t.jsx(Xt,{value:r.business_subcategory||"",onChange:g=>m("business_subcategory",g.target.value),disabled:!n,fullWidth:!0})]}),t.jsxs("div",{children:[t.jsx(en,{children:"Cuisine Types (comma-separated)"}),t.jsx(Xt,{value:(r.cuisine_types||[]).join(", "),onChange:g=>h("cuisine_types",g.target.value),disabled:!n,fullWidth:!0})]})]}),t.jsxs("div",{children:[t.jsx(en,{children:"Landmarks (comma-separated)"}),t.jsx(Xt,{value:(r.landmarks||[]).join(", "),onChange:g=>h("landmarks",g.target.value),disabled:!n,fullWidth:!0})]}),t.jsxs("div",{children:[t.jsx(en,{children:"Adjacent Areas (comma-separated)"}),t.jsx(Xt,{value:(r.adjacent_areas||[]).join(", "),onChange:g=>h("adjacent_areas",g.target.value),disabled:!n,fullWidth:!0})]}),r.listing_presence&&Object.keys(r.listing_presence).length>0&&t.jsx(zNt,{listings:r.listing_presence,websiteLinks:r.website_listing_links})]})]})}function zNt({listings:e,websiteLinks:n}){const i={google:"Google Business Profile",yelp:"Yelp",facebook:"Facebook",instagram:"Instagram",tripadvisor:"TripAdvisor",opentable:"OpenTable",apple_maps:"Apple Maps",bing:"Bing Places"};return t.jsxs("div",{style:{marginTop:6,padding:10,border:`1px solid ${V}`,borderRadius:8,display:"grid",gap:8},children:[t.jsx(en,{style:{margin:0},children:"Listing Presence (verified)"}),t.jsx("div",{style:{display:"grid",gap:6},children:Object.entries(e).map(([r,o])=>{const s=i[r]||r.charAt(0).toUpperCase()+r.slice(1),a=o.found,c=!a&&!!o.error,u=a?"#F0FDF4":c?"#FFFBEB":"#FEF2F2",m=a?Vt:c?"#F59E0B":Ut,h=a?"FOUND":c?"UNKNOWN":"NOT FOUND",g=a?Vt:c?"#F59E0B":Ut;return t.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:8,padding:"6px 8px",borderRadius:6,background:u,fontSize:"0.75rem",fontWeight:600},children:[t.jsx("span",{style:{flexShrink:0,width:8,height:8,borderRadius:"50%",background:m,marginTop:3}}),t.jsxs("div",{style:{flex:1,display:"grid",gap:2},children:[t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[t.jsx("span",{style:{color:O},children:s}),t.jsx("span",{style:{color:g,fontSize:"0.625rem",fontWeight:700},children:h})]}),a&&t.jsxs("div",{style:{color:z,fontSize:"0.6875rem",display:"flex",gap:8,flexWrap:"wrap"},children:[o.name&&t.jsxs("span",{children:["Name: ",o.name]}),o.has_phone!==void 0&&t.jsxs("span",{children:["Phone: ",o.has_phone?"Yes":"No"]}),o.has_website!==void 0&&t.jsxs("span",{children:["Website: ",o.has_website?"Yes":"No"]}),o.has_hours!==void 0&&t.jsxs("span",{children:["Hours: ",o.has_hours?"Yes":"No"]}),o.has_categories!==void 0&&t.jsxs("span",{children:["Categories: ",o.has_categories?"Yes":"No"]}),o.rating!==void 0&&t.jsxs("span",{children:["Rating: ",o.rating]}),o.review_count!==void 0&&t.jsxs("span",{children:["Reviews: ",o.review_count]})]}),c&&t.jsxs("div",{style:{color:"#92400E",fontSize:"0.6875rem"},children:["Probe failed: ",o.error]}),!a&&!c&&o.reason&&t.jsxs("div",{style:{color:z,fontSize:"0.6875rem"},children:["Reason: ",o.reason]}),o.url&&t.jsx("a",{href:o.url,target:"_blank",rel:"noopener noreferrer",style:{color:"#4F46E5",fontSize:"0.625rem",textDecoration:"underline",textUnderlineOffset:2},children:o.url.length>60?o.url.slice(0,60)+"â¦":o.url})]})]},r)})}),n&&Object.keys(n).length>0&&t.jsxs("div",{style:{marginTop:4},children:[t.jsx(en,{style:{margin:0,marginBottom:4}
24191,children:"Links found on brand website"}),t.jsx("div",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:Object.entries(n).map(([r,o])=>t.jsx("a",{href:o,target:"_blank",rel:"noopener noreferrer",style:{fontSize:"0.6875rem",fontWeight:700,padding:"2px 8px",borderRadius:6,background:"#EEF2FF",color:"#4F46E5",textDecoration:"none"},children:r},r))})]})]})}function TNt({canEdit:e,saving:n,detail:i,chatSessions:r,chatSessionsLoading:o,chatSessionsError:s,selectedChatSessionId:a,onSelectChatSession:c,chatMessages:u,chatMessagesLoading:m,chatMessagesError:h,onUpdateChatSession:g,onUpdateChatMessage:x,chatSessionsMeta:y,onChatSessionsPrev:w,onChatSessionsNext:j,chatMessagesMeta:v,onChatMessagesPrev:_,onChatMessagesNext:$,onChatsOpen:k,siteAuditSummary:P,siteAuditSummaryLoading:S,siteAuditSummaryError:I,siteAuditDraft:A,setSiteAuditDraft:E,onSiteAuditOpen:B,users:T,usersLoading:M,usersError:R,usersMeta:F,onUsersPrev:Y,onUsersNext:H,onUsersOpen:U,addUserEmail:X,setAddUserEmail:Q,addUserId:K,setAddUserId:G,addUserRole:L,setAddUserRole:q,onAddUser:W,onUpdateUserRole:oe,onRemoveUser:se,fanoutQueries:de,fanoutQueriesLoading:le,fanoutQueriesError:me,fanoutQueriesMeta:ee,onFanoutQueriesPrev:ne,onFanoutQueriesNext:Ae,onDestroyFanoutQuery:_e,suggestedPrompts:we,suggestedPromptsLoading:Ke,suggestedPromptsError:ce,suggestedPromptsMeta:ie,onSuggestedPromptsPrev:Re,onSuggestedPromptsNext:Be,onDestroySuggestedPrompt:tt,onFanoutAndSuggestedOpen:dt,topics:je,topicsLoading:Me,topicsError:Se,topicsMeta:it,onTopicsPrev:De,onTopicsNext:te,onDestroyTopic:ge,prompts:Je,promptsLoading:Ee,promptsError:Xe,promptsMeta:yt,onPromptsPrev:Ne,onPromptsNext:Le,onDestroyPrompt:Ue,onTopicsAndPromptsOpen:We,projectActionsInfo:Qe,projectActionsInfoLoading:ht,projectActionsInfoError:pe,onProjectActionsInfoOpen:be,projectCompetitors:rt,projectCompetitorsLoading:ze,projectCompetitorsError:lt,projectCompetitorsMeta:vt,onProjectCompetitorsPrev:Wt,onProjectCompetitorsNext:Qt,projectCitations:Yt,projectCitationsLoading:Zt,projectCitationsError:tn,projectCitationsMeta:nn,onProjectCitationsPrev:xn,onProjectCitationsNext:st,onProjectCompetitorsAndCitationsOpen:Ct}){const Ie=l.useMemo(()=>typeof a=="number"&&r.find(qe=>qe.id===a)||null,[r,a]),[ae,Fe]=l.useState(""),[Ge,wt]=l.useState(""),[ke,Ve]=l.useState(null);l.useEffect(()=>{Ie&&(Fe(Ie.title||""),wt(Ie.deleted_at||""))},[Ie?.id]);const pt=P?.runs?.recent_daily_counts||[],Nt=Math.max(1,...pt.map(qe=>Number(qe.count||0)));return t.jsxs(t.Fragment,{children:[t.jsxs("details",{style:{border:`1px solid ${V}`,borderRadius:12,padding:14,background:Z},onToggle:qe=>{qe.currentTarget.open&&U()},children:[t.jsx("summary",{style:{cursor:"pointer",fontWeight:900,color:O,fontSize:"0.95rem"},children:"Users"}),t.jsxs("div",{style:{display:"grid",gap:10,marginTop:10},children:[e?null:t.jsx("div",{style:{color:z,fontSize:"0.75rem",fontWeight:650},children:"Read-only."}),R?t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:R}):null,e?t.jsxs("div",{style:{display:"grid",gap:8},children:[t.jsxs(Ni,{children:[t.jsxs("div",{children:[t.jsx(en,{children:"User email"}),t.jsx(Xt,{value:X,onChange:qe=>Q(qe.target.value),placeholder:"[email protected]",fullWidth:!0})]}),t.jsxs("div",{children:[t.jsx(en,{children:"Or user ID"}),t.jsx(Xt,{value:K,onChange:qe=>G(qe.target.value),placeholder:"123",fullWidth:!0})]})]}),t.jsxs(Ni,{children:[t.jsxs("div",{children:[t.jsx(en,{children:"Role"}),t.jsx(Fn,{value:L,onChange:qe=>q(String(qe||"viewer")),options:[{value:"editor",label:"editor"},{value:"viewer",label:"viewer"}],fullWidth:!0})]}),t.jsx("div",{style:{display:"flex",justifyContent:"flex-end",alignItems:"flex-end"},children:t.jsx(he,{type:"button",size:"sm",variant:"outline",disabled:n||M,onClick:W,children:"Add / update user"})})]})]}):null,M?t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:"Loading usersâ¦"}):T.length?t.jsxs(t.Fragment,{children:[t.jsx(tr,{style:{maxHeight:260,overflow:"auto"},children:t.jsxs(nr,{$minWidth:"48rem",children:[t.jsx(pr,{children:t.jsxs(Cn,{children:[t.jsx(Et,{children:"User"}),t.jsx(Et,{children:"Email"}),t.jsx(Et,{children:"Role"}),t.jsx(Et,{children:"Added"}),e?t.jsx(Et,{children:"Actions"}):null]})}),t.jsx(mr,{children:T.map(qe=>t.jsxs(Cn,{children:[t.jsxs(bt,{children:[t.jsx("div",{style:{fontWeight:800,fontSize:"0.875rem"},children:qe.full_name||"â"}),t.jsxs("div",{style:{fontSize:"0.75rem",fontWeight:700,color:z},children:["ID ",qe.user_id," â¢"," ",t.jsx(Dn,{to:`/admin/resources?resource=users&user_id=${qe.user_id}`,style:{color:O,textDecoration:"underline",textUnderlineOffset:3},children:"open user"})]})]}),t.jsx(bt,{$muted:!0,children:qe.email}),t.jsx(bt,{children:e?t.jsx(Fn,{value:qe.role,onChange:qt=>oe(qe.user_id,String(qt||qe.role)),options:[{value:"editor",label:"editor"},{value:"viewer",label:"viewer"}],fullWidth:!0}):t.jsx("span",{style:{color:z,fontWeight:750},children:qe.role})}),t.jsx(bt,{$muted:!0,children:qe.created_at?new Date(qe.created_at).toLocaleStr
24191ing():"â"}),e?t.jsx(bt,{children:t.jsx(he,{type:"button",size:"sm",variant:"outline",onClick:()=>se(qe.user_id,qe.email),children:"Remove"})}):null]},qe.user_id))})]})}),t.jsx(pi,{page:F.page,totalPages:F.totalPages,total:F.total,onPrev:Y,onNext:H,compact:!0})]}):t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:"No users."})]})]}),t.jsxs("details",{style:{border:`1px solid ${V}`,borderRadius:12,padding:14,background:Z},onToggle:qe=>{qe.currentTarget.open&&Ct()},children:[t.jsx("summary",{style:{cursor:"pointer",fontWeight:900,color:O,fontSize:"0.95rem"},children:"Competitors & citations"}),t.jsxs("div",{style:{display:"grid",gap:14,marginTop:10},children:[t.jsxs("div",{style:{display:"grid",gap:8},children:[t.jsx(en,{children:"Competitors"}),lt?t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:lt}):null,ze?t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:"Loading competitorsâ¦"}):rt.length?t.jsxs(t.Fragment,{children:[t.jsx(tr,{style:{maxHeight:240,overflow:"auto"},children:t.jsxs(nr,{$minWidth:"56rem",children:[t.jsx(pr,{children:t.jsxs(Cn,{children:[t.jsx(Et,{children:"Competitor"}),t.jsx(Et,{children:"Type"}),t.jsx(Et,{children:"Aliases"}),t.jsx(Et,{children:"Visibility"}),t.jsx(Et,{children:"Added"})]})}),t.jsx(mr,{children:rt.map(qe=>t.jsxs(Cn,{children:[t.jsx(bt,{children:t.jsxs("div",{style:{display:"flex",gap:10,alignItems:"center"},children:[t.jsx(xo,{record:{name:qe.name,website:qe.website},forceLogoDev:!0,size:20}),t.jsxs("div",{children:[t.jsx("div",{style:{fontWeight:900,fontSize:"0.875rem"},children:qe.name||"â"}),t.jsxs("div",{style:{fontSize:"0.75rem",fontWeight:700,color:z},children:[qe.website||"â"," ⢠ID ",qe.competitor_id]})]})]})}),t.jsx(bt,{$muted:!0,children:qe.competitor_type}),t.jsx(bt,{$muted:!0,children:qe.aliases_count}),t.jsx(bt,{$muted:!0,children:typeof qe.visibility_score=="number"?qe.visibility_score.toFixed(2):"â"}),t.jsx(bt,{$muted:!0,children:qe.created_at?new Date(qe.created_at).toLocaleString():"â"})]},qe.id))})]})}),t.jsx(pi,{page:vt.page,totalPages:vt.totalPages,total:vt.total,onPrev:Wt,onNext:Qt,compact:!0})]}):t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:"No competitors."})]}),t.jsxs("div",{style:{display:"grid",gap:8},children:[t.jsx(en,{children:"Citations"}),tn?t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:tn}):null,Zt?t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:"Loading citationsâ¦"}):Yt.length?t.jsxs(t.Fragment,{children:[t.jsx(tr,{style:{maxHeight:260,overflow:"auto"},children:t.jsxs(nr,{$minWidth:"70rem",children:[t.jsx(pr,{children:t.jsxs(Cn,{children:[t.jsx(Et,{children:"Domain"}),t.jsx(Et,{children:"Title"}),t.jsx(Et,{children:"URL"}),t.jsx(Et,{children:"Created"})]})}),t.jsx(mr,{children:Yt.map(qe=>t.jsxs(Cn,{children:[t.jsx(bt,{children:t.jsxs("div",{style:{display:"flex",gap:10,alignItems:"center"},children:[t.jsx($u,{domain:qe.domain_host,size:18}),t.jsx("div",{style:{fontWeight:900,fontSize:"0.875rem"},children:qe.domain_host||"â"})]})}),t.jsx(bt,{children:qe.title||"â"}),t.jsx(bt,{$muted:!0,style:{maxWidth:520,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:qe.url}),t.jsx(bt,{$muted:!0,children:qe.created_at?new Date(qe.created_at).toLocaleString():"â"})]},qe.id))})]})}),t.jsx(pi,{page:nn.page,totalPages:nn.totalPages,total:nn.total,onPrev:xn,onNext:st,compact:!0})]}):t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:"No citations."})]})]})]}),t.jsxs("details",{style:{border:`1px solid ${V}`,borderRadius:12,padding:14,background:Z},onToggle:qe=>{qe.currentTarget.open&&dt()},children:[t.jsx("summary",{style:{cursor:"pointer",fontWeight:900,color:O,fontSize:"0.95rem"},children:"Fanout queries & suggested prompts"}),t.jsxs("div",{style:{display:"grid",gap:14,marginTop:10},children:[e?null:t.jsx("div",{style:{color:z,fontSize:"0.75rem",fontWeight:650},children:"Read-only."}),t.jsxs("div",{style:{display:"grid",gap:8},children:[t.jsx(en,{children:"Fanout queries"}),me?t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:me}):null,le?t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:"Loading fanout queriesâ¦"}):de.length?t.jsxs(t.Fragment,{children:[t.jsx(tr,{style:{maxHeight:260,overflow:"auto"},children:t.jsxs(nr,{$minWidth:"56rem",children:[t.jsx(pr,{children:t.jsxs(Cn,{children:[t.jsx(Et,{children:"ID"}),t.jsx(Et,{children:"Topic"}),t.jsx(Et,{children:"Prompt"}),t.jsx(Et,{children:"Model"}),t.jsx(Et,{children:"#Queries"}),t.jsx(Et,{children:"Fetched"}),e?t.jsx(Et,{children:"Actions"}):null]})}),t.jsx(mr,{children:de.map(qe=>t.jsxs(Cn,{children:[t.jsx(bt,{$muted:!0,children:qe.id}),t.jsx(bt,{$muted:!0,children:qe.topic_name||`topic ${qe.topic_id}`}),t.jsx(bt,{children:qe.prompt_content}),t.jsx(bt,{$muted:!0,children:qe.model_key}),t.jsx(bt,{$muted:!0,children:qe.queries_count}),t.jsx(bt,{$muted:!0,children:qe.fetched_at?new Date(qe.fetched_at).toLocaleStr
24191ing():"â"}),e?t.jsx(bt,{children:t.jsx(he,{type:"button",size:"sm",variant:"danger",disabled:n,onClick:()=>_e(qe.id),children:"Destroy"})}):null]},qe.id))})]})}),t.jsx(pi,{page:ee.page,totalPages:ee.totalPages,total:ee.total,onPrev:ne,onNext:Ae,compact:!0})]}):t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:"No fanout queries."})]}),t.jsxs("div",{style:{display:"grid",gap:8},children:[t.jsx(en,{children:"Suggested prompts"}),ce?t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:ce}):null,Ke?t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:"Loading suggested promptsâ¦"}):we.length?t.jsxs(t.Fragment,{children:[t.jsx(tr,{style:{maxHeight:260,overflow:"auto"},children:t.jsxs(nr,{$minWidth:"56rem",children:[t.jsx(pr,{children:t.jsxs(Cn,{children:[t.jsx(Et,{children:"ID"}),t.jsx(Et,{children:"Topic"}),t.jsx(Et,{children:"Status"}),t.jsx(Et,{children:"Category"}),t.jsx(Et,{children:"Content"}),t.jsx(Et,{children:"Created"}),e?t.jsx(Et,{children:"Actions"}):null]})}),t.jsx(mr,{children:we.map(qe=>t.jsxs(Cn,{children:[t.jsx(bt,{$muted:!0,children:qe.id}),t.jsx(bt,{$muted:!0,children:qe.topic_name||`topic ${qe.topic_id}`}),t.jsx(bt,{$muted:!0,children:qe.status}),t.jsx(bt,{$muted:!0,children:qe.category||"â"}),t.jsx(bt,{children:qe.content}),t.jsx(bt,{$muted:!0,children:qe.created_at?new Date(qe.created_at).toLocaleString():"â"}),e?t.jsx(bt,{children:t.jsx(he,{type:"button",size:"sm",variant:"danger",disabled:n,onClick:()=>tt(qe.id),children:"Destroy"})}):null]},qe.id))})]})}),t.jsx(pi,{page:ie.page,totalPages:ie.totalPages,total:ie.total,onPrev:Re,onNext:Be,compact:!0})]}):t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:"No suggested prompts."})]})]})]}),t.jsxs("details",{style:{border:`1px solid ${V}`,borderRadius:12,padding:14,background:Z},onToggle:qe=>{qe.currentTarget.open&&We()},children:[t.jsx("summary",{style:{cursor:"pointer",fontWeight:900,color:O,fontSize:"0.95rem"},children:"Topics & prompts"}),t.jsxs("div",{style:{display:"grid",gap:14,marginTop:10},children:[e?null:t.jsx("div",{style:{color:z,fontSize:"0.75rem",fontWeight:650},children:"Read-only."}),t.jsxs("div",{style:{display:"grid",gap:8},children:[t.jsx(en,{children:"Topics"}),Se?t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:Se}):null,Me?t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:"Loading topicsâ¦"}):je.length?t.jsxs(t.Fragment,{children:[t.jsx(tr,{style:{maxHeight:220,overflow:"auto"},children:t.jsxs(nr,{$minWidth:"48rem",children:[t.jsx(pr,{children:t.jsxs(Cn,{children:[t.jsx(Et,{children:"ID"}),t.jsx(Et,{children:"Name"}),t.jsx(Et,{children:"#Prompts"}),t.jsx(Et,{children:"#Suggested"}),t.jsx(Et,{children:"Created"}),e?t.jsx(Et,{children:"Actions"}):null]})}),t.jsx(mr,{children:je.map(qe=>t.jsxs(Cn,{children:[t.jsx(bt,{$muted:!0,children:qe.id}),t.jsx(bt,{children:qe.name}),t.jsx(bt,{$muted:!0,children:qe.prompts_count}),t.jsx(bt,{$muted:!0,children:qe.suggested_prompts_count}),t.jsx(bt,{$muted:!0,children:qe.created_at?new Date(qe.created_at).toLocaleString():"â"}),e?t.jsx(bt,{children:t.jsx(he,{type:"button",size:"sm",variant:"danger",disabled:n,onClick:()=>ge(qe.id),children:"Destroy"})}):null]},qe.id))})]})}),t.jsx(pi,{page:it.page,totalPages:it.totalPages,total:it.total,onPrev:De,onNext:te,compact:!0})]}):t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:"No topics."})]}),t.jsxs("div",{style:{display:"grid",gap:8},children:[t.jsx(en,{children:"Prompts"}),Xe?t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:Xe}):null,Ee?t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:"Loading promptsâ¦"}):Je.length?t.jsxs(t.Fragment,{children:[t.jsx(tr,{style:{maxHeight:260,overflow:"auto"},children:t.jsxs(nr,{$minWidth:"56rem",children:[t.jsx(pr,{children:t.jsxs(Cn,{children:[t.jsx(Et,{children:"ID"}),t.jsx(Et,{children:"Topic"}),t.jsx(Et,{children:"Category"}),t.jsx(Et,{children:"Archived"}),t.jsx(Et,{children:"Content"}),t.jsx(Et,{children:"Created"}),e?t.jsx(Et,{children:"Actions"}):null]})}),t.jsx(mr,{children:Je.map(qe=>t.jsxs(Cn,{children:[t.jsx(bt,{$muted:!0,children:qe.id}),t.jsx(bt,{$muted:!0,children:qe.topic_name||`topic ${qe.topic_id}`}),t.jsx(bt,{$muted:!0,children:qe.category||"â"}),t.jsx(bt,{$muted:!0,children:qe.archived_at?"yes":"no"}),t.jsx(bt,{children:qe.content}),t.jsx(bt,{$muted:!0,children:qe.created_at?new Date(qe.created_at).toLocaleStr
24191ing():"â"}),e?t.jsx(bt,{children:t.jsx(he,{type:"button",size:"sm",variant:"danger",disabled:n,onClick:()=>Ue(qe.id),children:"Destroy"})}):null]},qe.id))})]})}),t.jsx(pi,{page:yt.page,totalPages:yt.totalPages,total:yt.total,onPrev:Ne,onNext:Le,compact:!0})]}):t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:"No prompts."})]})]})]}),t.jsxs("details",{style:{border:`1px solid ${V}`,borderRadius:12,padding:14,background:Z},onToggle:qe=>{qe.currentTarget.open&&be()},children:[t.jsx("summary",{style:{cursor:"pointer",fontWeight:900,color:O,fontSize:"0.95rem"},children:"Project actions info"}),t.jsxs("div",{style:{display:"grid",gap:10,marginTop:10},children:[pe?t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:pe}):null,ht?t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:"Loading project actions summaryâ¦"}):Qe?t.jsxs("div",{style:{display:"grid",gap:10},children:[t.jsxs("div",{style:{color:z,fontSize:"0.75rem",fontWeight:700},children:["total: ",Qe.total," ⢠latest: ",Qe.latest_created_at?new Date(Qe.latest_created_at).toLocaleString():"â"]}),t.jsxs(Ni,{children:[t.jsxs("div",{style:{display:"grid",gap:6},children:[t.jsx(en,{children:"By status"}),t.jsx("div",{style:{fontSize:"0.8125rem",fontWeight:750,color:O},children:Object.entries(Qe.by_status||{}).sort((qe,qt)=>qt[1]-qe[1]).slice(0,6).map(([qe,qt])=>`${qe} ${qt}`).join(" ⢠")||"â"})]}),t.jsxs("div",{style:{display:"grid",gap:6},children:[t.jsx(en,{children:"By priority"}),t.jsx("div",{style:{fontSize:"0.8125rem",fontWeight:750,color:O},children:Object.entries(Qe.by_priority||{}).sort((qe,qt)=>qt[1]-qe[1]).slice(0,6).map(([qe,qt])=>`${qe} ${qt}`).join(" ⢠")||"â"})]})]})]}):t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:"No actions."})]})]}),t.jsxs("details",{style:{border:`1px solid ${V}`,borderRadius:12,padding:14,background:Z},onToggle:qe=>{qe.currentTarget.open&&(B(),i&&A.trim()==="{}"&&E(JSON.stringify(i.site_audit||{},null,2)))},children:[t.jsx("summary",{style:{cursor:"pointer",fontWeight:900,color:O,fontSize:"0.95rem"},children:"Site audit insights"}),t.jsxs("div",{style:{display:"grid",gap:10,marginTop:10},children:[I?t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:I}):null,S?t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:"Loading site audit summaryâ¦"}):P?t.jsxs(t.Fragment,{children:[t.jsxs(Ni,{children:[t.jsxs("div",{style:{display:"grid",gap:6},children:[t.jsx(en,{children:"Pages"}),t.jsxs("div",{style:{fontSize:"0.875rem",fontWeight:750,color:O},children:[P.pages.total," total"]}),t.jsxs("div",{style:{fontSize:"0.75rem",fontWeight:650,color:z},children:[P.pages.in_home_nav," in home nav"]})]}),t.jsxs("div",{style:{display:"grid",gap:6},children:[t.jsxs(en,{children:["Runs (last ",pt.length||0," days)"]}),t.jsxs("div",{style:{fontSize:"0.875rem",fontWeight:750,color:O},children:[P.runs.total," total ⢠",P.runs.by_status?.succeeded||0," succeeded â¢"," ",P.runs.by_status?.failed||0," failed"]}),t.jsx("div",{style:{display:"flex",gap:2,alignItems:"flex-end",height:36},children:pt.map(qe=>t.jsx("div",{title:`${qe.date}: ${qe.count}`,style:{width:8,height:`${Math.max(2,Math.round(Number(qe.count||0)/Nt*36))}px`,background:Rt,borderRadius:2}},qe.date))})]})]}),t.jsxs(Ni,{children:[t.jsxs("div",{style:{display:"grid",gap:6},children:[t.jsx(en,{children:"Actions"}),t.jsxs("div",{style:{fontSize:"0.875rem",fontWeight:750,color:O},children:[P.actions.total," total ⢠",P.actions.by_status?.open||0," open â¢"," ",P.actions.by_status?.completed||0," completed"]}),t.jsxs("div",{style:{fontSize:"0.75rem",fontWeight:650,color:z},children:["scope: page ",P.actions.by_scope?.page||0," ⢠site ",P.actions.by_scope?.site||0]})]}),t.jsxs("div",{style:{display:"grid",gap:6},children:[t.jsx(en,{children:"Page groups"}),t.jsxs("div",{style:{fontSize:"0.75rem",fontWeight:650,color:z,lineHeight:1.4},children:["kinds:"," ",Object.entries(P.pages.by_kind||{}).sort((qe,qt)=>qt[1]-qe[1]).slice(0,4).map(([qe,qt])=>`${qe} ${qt}`).join(" ⢠")||"â"]}
24191),t.jsxs("div",{style:{fontSize:"0.75rem",fontWeight:650,color:z,lineHeight:1.4},children:["audit:"," ",Object.entries(P.pages.by_audit_status||{}).sort((qe,qt)=>qt[1]-qe[1]).slice(0,4).map(([qe,qt])=>`${qe} ${qt}`).join(" ⢠")||"â"]})]})]})]}):t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:"No site audit data."}),t.jsxs("details",{style:{border:`1px solid ${V}`,borderRadius:10,padding:10,background:Z},children:[t.jsx("summary",{style:{cursor:"pointer",fontWeight:800,color:O,fontSize:"0.9rem"},children:"Site audit JSON"}),t.jsxs("div",{style:{marginTop:10},children:[t.jsx(en,{children:"site_audit (JSON object)"}),t.jsx(Ib,{value:A,onChange:qe=>E(qe.target.value),disabled:!e,spellCheck:!1,style:{minHeight:220}})]})]})]})]}),t.jsxs("details",{style:{border:`1px solid ${V}`,borderRadius:12,padding:14,background:Z},onToggle:qe=>{qe.currentTarget.open&&k()},children:[t.jsx("summary",{style:{cursor:"pointer",fontWeight:900,color:O,fontSize:"0.95rem"},children:"Chats & messages"}),t.jsxs("div",{style:{display:"grid",gap:10,marginTop:10},children:[e?null:t.jsx("div",{style:{color:z,fontSize:"0.75rem",fontWeight:650},children:"Read-only."}),s?t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:s}):null,o?t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:"Loading chat sessionsâ¦"}):r.length?t.jsxs("div",{style:{display:"grid",gap:10},children:[t.jsx(tr,{style:{maxHeight:220,overflow:"auto"},children:t.jsxs(nr,{$minWidth:"48rem",children:[t.jsx(pr,{children:t.jsxs(Cn,{children:[t.jsx(Et,{children:"ID"}),t.jsx(Et,{children:"User"}),t.jsx(Et,{children:"Title"}),t.jsx(Et,{children:"Deleted"}),t.jsx(Et,{children:"Msgs"}),t.jsx(Et,{children:"Actions"})]})}),t.jsx(mr,{children:r.map(qe=>t.jsxs(Cn,{children:[t.jsx(bt,{$muted:!0,children:qe.id}),t.jsx(bt,{$muted:!0,children:qe.user_id}),t.jsx(bt,{children:qe.title}),t.jsx(bt,{$muted:!0,children:qe.deleted_at?"yes":"no"}),t.jsx(bt,{$muted:!0,children:qe.messages_count}),t.jsx(bt,{children:t.jsx(he,{type:"button",size:"sm",variant:"outline",onClick:()=>c(qe.id),children:a===qe.id?"Selected":"Messages"})})]},qe.id))})]})}),t.jsx(pi,{page:y.page,totalPages:y.totalPages,total:y.total,onPrev:w,onNext:j,compact:!0}),Ie?t.jsxs("div",{style:{display:"grid",gap:10},children:[t.jsxs(Ni,{children:[t.jsxs("div",{children:[t.jsx(en,{children:"Session title"}),t.jsx(Xt,{value:ae,onChange:qe=>Fe(qe.target.value),disabled:!e,fullWidth:!0})]}),t.jsxs("div",{children:[t.jsx(en,{children:"Session deleted_at"}),t.jsx(Xt,{value:Ge,onChange:qe=>wt(qe.target.value),disabled:!e,placeholder:"ISO8601 or blank",fullWidth:!0})]})]}),e?t.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:t.jsx(he,{type:"button",size:"sm",variant:"outline",onClick:()=>g(Ie.id,{title:ae,deleted_at:Ge}),children:"Save session"})}):null,h?t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:h}):null,m?t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:"Loading messagesâ¦"}):t.jsxs("div",{style:{display:"grid",gap:10},children:[t.jsx(tr,{style:{maxHeight:260,overflow:"auto"},children:t.jsxs(nr,{$minWidth:"56rem",children:[t.jsx(pr,{children:t.jsxs(Cn,{children:[t.jsx(Et,{children:"ID"}),t.jsx(Et,{children:"Role"}),t.jsx(Et,{children:"Status"}),t.jsx(Et,{children:"Model"}),t.jsx(Et,{children:"Created"}),t.jsx(Et,{children:"Actions"})]})}),t.jsx(mr,{children:u.map(qe=>t.jsxs(Cn,{children:[t.jsx(bt,{$muted:!0,children:qe.id}),t.jsx(bt,{$muted:!0,children:qe.role}),t.jsx(bt,{$muted:!0,children:qe.status}),t.jsx(bt,{$muted:!0,children:qe.model_key||"â"}),t.jsx(bt,{$muted:!0,children:qe.created_at?new Date(qe.created_at).toLocaleString():"â"}),t.jsx(bt,{children:t.jsx(he,{type:"button",size:"sm",variant:"outline",onClick:()=>Ve({id:qe.id,status:qe.status,model_key:qe.model_key||"",content:qe.content||"",metadata:JSON.stringify(qe.metadata||{},null,2)}),children:e?"Edit":"View"})})]},qe.id))})]})}),t.jsx(pi,{page:v.page,totalPages:v.totalPages,total:v.total,onPrev:_,onNext:$,compact:!0})]})]}):t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:"Select a session to view messages."})]}):t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:"No chat sessions."})]})]}),t.jsx(Hn,{isOpen:!!ke,onClose:()=>Ve(null),title:e?"Edit chat message":"View chat message",description:e?"Updates the DB record only (no LLM send).":"Read-only.",size:"lg",showCloseButton:!1,footer:t.jsxs("div",{style:{display:"flex",gap:"0.75rem",justifyContent:"space-between",flexWrap:"wrap"},children:[t.jsx(he,{type:"button",variant:"outline",size:"sm",onClick:()=>Ve(null),children:"Close"}),e?t.jsx(he,{type:"button",variant:"primary",size:"sm",disabled:!ke||!a,onClick:()=>{ke&&a&&(x(a,ke.id,{status:ke.status,model_key:ke.model_key,content:ke.content,metadata:ke.metadata}),Ve(null))},children:"Save message"}):null]}),children:ke?t.jsxs("div",{style:{display:"grid",gap:12},children:[t.jsxs(Ni,{children:[t.jsxs("div",{children:[t.jsx(en,{children:"Status"}),t.jsx(Fn,{value:ke.status,onChange:qe=>Ve(qt=>qt&&{...qt,status:String(qe||"")}),disabled:!e,options:[{value:"pending",label:"pending"},{value:"streaming",label:"streaming"},{value:"done",label:"done"},{value:"failed",label:"failed"}],fullWidth:!0})]}),t.jsxs("div",{children:[t.jsx(en,{children:"Model key"}),t.jsx(Xt,{value:ke.model_key,onChange:qe=>Ve(qt=>qt&&{...qt,model_key:qe.target.value}),disabled:!e,fullWidth:!0})]})]}),t.jsxs("div",{children:[t.jsx(en,{children:"Content"}),t.jsx(Ib,{value:ke.content,onChange:qe=>Ve(qt=>qt&&{...qt,content:qe.target.value}),disabled:!e,spellCheck:!1,style:{minHeight:180}})]}),t.jsxs("div",{children:[t.jsx(en,{children:"Metadata (JSON object)"}),t.jsx(Ib,{value:ke.metadata,onChange:qe=>Ve(qt=>qt&&{...qt,metadata:qe.target.value}),disabled:!e,spellCheck:!1,style:{minHeight:200}})]})]}):t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:"No message selected."})})]})}function ENt(e){const{projects:n,meta:i,selectedProjectId:r,activePromptsTotal:o,runnablePromptsTotal:s,listLoading:a,searchQuery:c,setSearchQuery:u,onPrev:m,onNext:h,canEdit:g,canEditCa
24191dence:x,canDestroy:y,detailLoading:w,detailSaving:j,detailError:v,detail:_,name:$,setName:k,website:P,setWebsite:S,city:I,setCity:A,country:E,setCountry:B,language:T,setLanguage:M,focus:R,setFocus:F,description:Y,setDescription:H,countryCode:U,setCountryCode:X,cadence:Q,setCadence:K,customIdentifier:G,setCustomIdentifier:L,localMode:q,setLocalMode:W,suggestedAt:oe,setSuggestedAt:se,deletedAt:de,setDeletedAt:le,brandAliases:me,setBrandAliases:ee,onSave:ne,onDestroy:Ae,onBack:_e,onGaDisconnect:we,onGaResync:Ke,localContext:ce,setLocalContext:ie,onReResolveLocalContext:Re,extraPanelsProps:Be}=e;return t.jsxs(dNt,{children:[t.jsx(uNt,{children:t.jsx(PNt,{projects:n,meta:i,selectedProjectId:r,activePromptsTotal:o,runnablePromptsTotal:s,listLoading:a,controls:t.jsx(Ed,{value:c,onChange:u,placeholder:"Search projectsâ¦",containerStyle:{width:"100%"}}),onPrev:m,onNext:h})}),t.jsx(pNt,{children:r?t.jsxs("div",{style:{display:"grid",gap:12},children:[t.jsx(ANt,{canEdit:g,canEditCadence:x,canDestroy:y,loading:w,saving:j,error:v,detail:_,name:$,setName:k,website:P,setWebsite:S,city:I,setCity:A,country:E,setCountry:B,language:T,setLanguage:M,focus:R,setFocus:F,description:Y,setDescription:H,countryCode:U,setCountryCode:X,cadence:Q,setCadence:K,customIdentifier:G,setCustomIdentifier:L,localMode:q,setLocalMode:W,suggestedAt:oe,setSuggestedAt:se,deletedAt:de,setDeletedAt:le,brandAliases:me,setBrandAliases:ee,onSave:ne,onDestroy:Ae,onBack:_e,onGaDisconnect:we,onGaResync:Ke,localContext:ce,setLocalContext:ie,onReResolveLocalContext:Re}),t.jsx(TNt,{...Be})]}):t.jsx("div",{style:{padding:16,color:z,fontWeight:650},children:"Select a project from the list to view/edit details."})})]})}function MNt({partners:e,meta:n,selectedPartnerId:i,onPrev:r,onNext:o,listLoading:s,controls:a}){return t.jsxs("div",{style:{width:"100%",height:"100%",display:"flex",flexDirection:"column",minHeight:0,gap:10},children:[t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",gap:8},children:[t.jsx("div",{style:{fontWeight:950,color:O},children:"Partners"}),t.jsxs("div",{style:{fontSize:"0.75rem",fontWeight:750,color:z},children:[n.total," total"]})]}),a?t.jsx("div",{children:a}):null,t.jsx("div",{style:{flex:1,minHeight:0,overflow:"auto",border:`1px solid ${V}`,borderRadius:12,background:Z},children:s?t.jsx("div",{style:{padding:12,display:"grid",gap:10},children:Array.from({length:8}).map((c,u)=>t.jsxs("div",{style:{display:"grid",gap:6},children:[t.jsx(nt,{height:14,width:`${74-u%4*8}%`}),t.jsx(nt,{height:10,width:`${50-u%3*10}%`})]},u))}):e.length?e.map(c=>{const u=i===c.id,m=[`#${c.id}`,c.slug,`${c.discount_percent}%`,c.active?"active":"inactive"].filter(Boolean);return t.jsxs(Dn,{to:`/admin/resources?resource=partners&partner_id=${c.id}`,style:{display:"block",padding:"10px 12px",textDecoration:"none",borderBottom:`1px solid ${$e}`,background:u?"rgba(79, 70, 229, 0.06)":"transparent"},children:[t.jsx("div",{style:{color:O,fontWeight:900,fontSize:"0.875rem",lineHeight:1.15,wordBreak:"break-word"},children:c.name}),t.jsx("div",{style:{marginTop:4,color:z,fontWeight:700,fontSize:"0.75rem",lineHeight:1.25},children:m.join(" ⢠")})]},c.id)}):t.jsx("div",{style:{padding:12,color:z,fontWeight:650,fontSize:"0.875rem"},children:"No partners found."})}),t.jsx(pi,{page:n.page,totalPages:n.totalPages,total:n.total,onPrev:r,onNext:o,compact:!0})]})}function Fee(e,n){const i=String(n||"usd").toUpperCase(),r=(Number(e||0)||0)/100;try{return new Intl.NumberFormat(void 0,{style:"currency",currency:i}).format(r)}catch{return`${r.toFixed(2)} ${i}`}}function RNt({canEdit:e,loading:n,saving:i,error:r,detail:o,onBack:s,name:a,setName:c,slug:u,setSlug:m,discountPercent:h,setDiscountPercent:g,returnUrl:x,setReturnUrl:y,active:w,setActive:j,logoPreviewUrl:v,logoHasLogo:_,onPickLogoFile:$,onRemoveLogo:k,onSave:P,onDelete:S}){const[I,A]=l.useState(!1);return t.jsxs("div",{style:{padding:14,border:`1px solid ${V}`,borderRadius:12,background:Z,display:"grid",gap:12,maxWidth:"100%",overflow:"hidden"},children:[t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:12,flexWrap:"wrap"},children:[t.jsxs("div",{style:{display:"grid",gap:2},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:2},children:[t.jsx("button",{type:"button",onClick:s,disabled:i,style:{all:"unset",cursor:"pointer",display:"inline-flex",alignItems:"center",color:z,borderRadius:4,marginLeft:-4},"aria-label":"Back to list",children:t.jsx(Bd,{size:18})}),t.jsx("span",{style:{fontWeight:950,color:O,fontSize:"1rem"},children:"Partner"})]}),t.jsx("div",{style:{color:z,fontSize:"0.8125rem",fontWeight:700,wordBreak:"break-word"},children:o?`Partner #${o.id} ⢠slug: ${o.slug} ⢠${o.discount_percent}% ⢠${o.active?"active":"inactive"}`:"â"})]}),t.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center",flexWrap:"wrap"},children:[e?t.jsx(he,{type:"button",size:"sm",variant:"danger",disabled:i||n||!o,onClick:()=>A(!0),children:"Delete"}):null,e?t.jsx(he,{type:"button",size:"sm",variant:"primary",disabled:i||n||!o,onClick:P,children:i?"Savingâ¦":"Save"}):null]})]}),e?null:t.jsx("div",{style:{color:z,fontSize:"0.75rem",fontWeight:700},children:"Read-only."}),r?t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:r}):null,n||!o?t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:"Loadingâ¦"}):t.jsxs("div",{style:{display:"grid",gap:"0.9rem"},children:[t.jsxs("details",{style:{border:`1px solid ${V}`,borderRadius:12,padding:12,background:"rgba(107,114,128,0.04)"},children:[t.jsx("summary",{style:{cursor:"pointer",fontWeight:900,color:O,fontSize:"0.9rem"},children:"Summary"}),t.jsxs("div",{style:{display:"grid",gap:10,marginTop:10},children:[t.jsxs(Ni,{children:[t.jsxs("div",{children:[t.jsx(en,{children:"Worksp
24191aces"}),t.jsx("div",{style:{fontWeight:900,color:O},children:o.organizations_count})]}),t.jsxs("div",{children:[t.jsx(en,{children:"Subscriptions"}),t.jsxs("div",{style:{fontWeight:900,color:O},children:[typeof o.subscriptions_count=="number"?o.subscriptions_count:"â"," ",t.jsxs("span",{style:{color:z,fontWeight:800,fontSize:"0.8rem"},children:["(active: ",typeof o.subscriptions_active_count=="number"?o.subscriptions_active_count:"â",")"]})]})]})]}),t.jsxs("div",{children:[t.jsx(en,{children:"MRR (est.)"}),Array.isArray(o.mrr)&&o.mrr.length?t.jsxs("div",{style:{display:"grid",gap:4},children:[o.mrr.slice(0,4).map(E=>t.jsxs("div",{style:{color:O,fontWeight:850},children:[E.currency.toUpperCase(),": ",Fee(E.cents,E.currency),t.jsxs("span",{style:{color:z,fontWeight:750,marginLeft:8},children:["ARR: ",Fee(E.arr_cents,E.currency)]})]},E.currency)),o.mrr.length>4?t.jsx("div",{style:{color:z,fontWeight:750,fontSize:"0.8rem"},children:"â¦"}):null]}):t.jsx("div",{style:{color:z,fontWeight:750},children:"â"})]})]})]}),t.jsxs(Ni,{children:[t.jsxs("div",{children:[t.jsx(en,{children:"Name"}),t.jsx(Xt,{value:a,onChange:E=>c(E.target.value),fullWidth:!0,disabled:!e})]}),t.jsxs("div",{children:[t.jsx(en,{children:"Slug"}),t.jsx(Xt,{value:u,onChange:E=>m(E.target.value),fullWidth:!0,disabled:!e})]})]}),t.jsxs(Ni,{children:[t.jsxs("div",{children:[t.jsx(en,{children:"Discount percent"}),t.jsx(Xt,{value:h,onChange:E=>g(E.target.value),fullWidth:!0,disabled:!e})]}),t.jsxs("div",{children:[t.jsx(en,{children:"Return URL"}),t.jsx(Xt,{value:x,onChange:E=>y(E.target.value),fullWidth:!0,disabled:!e,placeholder:"https://vendor.example.com/..."})]})]}),t.jsxs("div",{style:{display:"grid",gap:6},children:[t.jsx(en,{children:"Logo"}),t.jsx(FO,{previewUrl:v,disabled:!e||i||n,hasLogo:_,previewAriaLabel:"Partner logo preview",previewAlt:"Partner logo",helperText:"SVG, PNG or JPG. Square logos work best.",onPickFile:E=>{$(E)},onRemove:()=>{k()}})]}),t.jsxs(Ni,{children:[t.jsxs("div",{style:{display:"grid",alignContent:"start"},children:[t.jsx(en,{children:"Active"}),t.jsxs("label",{style:{display:"inline-flex",alignItems:"center",gap:8,fontWeight:750,color:O},children:[t.jsx("input",{type:"checkbox",checked:w,onChange:E=>j(E.target.checked),disabled:!e}),"Enabled"]})]}),t.jsxs("div",{style:{display:"grid",gap:2,alignContent:"start"},children:[t.jsx(en,{children:"Organizations"}),t.jsx("div",{style:{fontWeight:850,color:O},children:o.organizations_count})]})]}),t.jsxs(Ni,{children:[t.jsxs("div",{children:[t.jsx(en,{children:"Created"}),t.jsx("div",{style:{fontWeight:750,color:O},children:o.created_at?new Date(o.created_at).toLocaleString():"â"})]}),t.jsxs("div",{children:[t.jsx(en,{children:"Updated"}),t.jsx("div",{style:{fontWeight:750,color:O},children:o.updated_at?new Date(o.updated_at).toLocaleString():"â"})]})]})]}),t.jsx(Hn,{isOpen:I,onClose:()=>{i||A(!1)},title:"Delete partner?",description:"This permanently removes the partner (and its API keys).",size:"sm",showCloseButton:!1,footer:t.jsxs("div",{style:{display:"flex",gap:"0.75rem",justifyContent:"space-between",flexWrap:"wrap"},children:[t.jsx(he,{type:"button",variant:"outline",size:"sm",disabled:i,onClick:()=>A(!1),children:"Cancel"}),t.jsx(he,{type:"button",variant:"danger",size:"sm",disabled:i,onClick:()=>{A(!1),S()},children:"Delete partner"})]}),children:t.jsxs("div",{style:{display:"grid",gap:8,fontSize:"0.875rem",color:O,lineHeight:1.45},children:[t.jsx("div",{children:"This action cannot be undone."}),t.jsx("div",{style:{color:z},children:"Note: deletion will fail if this partner still has any active (non-deleted) workspaces linked to it."})]})})]})}function ONt({canEdit:e,saving:n,apiKeysLoading:i,apiKeysError:r,apiKeys:o,usageTarget:s,usageLoading:a,usageError:c,usage:u,usageRange:m,onUsageRangeChange:h,newKeyName:g,setNewKeyName:x,createdToken:y,onClearCreatedToken:w,onCreateKey:j,onLoadUsage:v,onDeleteKey:_,onApiKeysOpen:$}){return t.jsxs("details",{style:{border:`1px solid ${V}`,borderRadius:12,padding:14,background:Z},onToggle:k=>{k.currentTarget.open&&$()},children:[t.jsx("summary",{style:{cursor:"pointer",fontWeight:900,color:O,fontSize:"0.95rem"},children:"API keys"}),t.jsxs("div",{style:{display:"grid",gap:10,marginTop:10},children:[e?t.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center",flexWrap:"wrap"},children:[t.jsx(Xt,{value:g,onChange:k=>x(k.target.value),placeholder:"API key nameâ¦",style:{minWidth:220},disabled:n}),t.jsx(he,{type:"button",size:"sm",variant:"primary",disabled:n,onClick:()=>j(g),children:n?"Creatingâ¦":"Create API key"}),y?t.jsx(he,{type:"button",size:"sm",variant:"outline",disabled:n,onClick:w,children:"Hide token"}):null]}):t.jsx("div",{style:{color:z,fontSize:"0.75rem",fontWeight:700},children:"Read-only."}),y?t.jsxs("div",{style:{border:`1px dashed ${V}`,borderRadius:12,padding:12,background:"rgba(16, 185, 129, 0.06)"},children:[t.jsx("div",{style:{fontWeight:900,color:O,marginBottom:6},children:"New token (copy now)"}),t.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center",flexWrap:"wrap"},children:[t.jsx(Xt,{value:y,onChange:()=>{},fullWidth:!0}),t.jsx(he,{type:"button",size:"sm",variant:"outline",onClick:async()=>{try{await navigator.clipboard.writeText(y)}catch{}},children:"Copy"})]}),t.jsx("div",{style:{marginTop:6,color:z,fontSize:"0.75rem",fontWeight:700},children:"This token will not be shown again after you leave this page."})]}):null,i?t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:"Loading API keysâ¦"}):r?t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:r}):o.length?t.jsxs("div",{style:{display:"grid",gap:12},children:[t.jsx("div",{style:{display:"flex",minWidth:0},children:t.jsx(tr,{style:{flex:1,minWidth:0,maxWidth:"100%",maxHeight:260,overflowX:"auto",overflowY:"auto",WebkitOverflowScrolling:"touch"},children:t.jsxs(nr,{$minWidth:"44rem",children:[t.jsx(pr,{children:t.jsxs(Cn,{children:[t.jsx(Et,{children:"Name"}),t.jsx(Et,{children:"Last 4"}),t.jsx(Et,{children:"Enabled"}),t.jsx(Et,{children:"Last used"}),t.jsx(Et,{children:"Created"}),t.jsx(Et,{children:"Usage"}),e?t.jsx(Et,{children:"Manage"}):null]})}),t.jsx(mr,{children:o.map(k=>t.jsxs(Cn,{children:[t.jsx(bt,{children:k.name}),t.jsx(bt,{$muted:!0,children:k.last4}),t.jsx(bt,{$muted:!0,children:k.enabled?"yes":"no"}),t.jsx(bt,{$muted:!0,children:k.last_used_at?new Date(k.last_used_at).toLocaleStr
24191ing():"â"}),t.jsx(bt,{$muted:!0,children:k.created_at?new Date(k.created_at).toLocaleString():"â"}),t.jsx(bt,{children:t.jsx(he,{type:"button",size:"sm",variant:"outline",disabled:a&&s?.id!==k.id,onClick:()=>v(k),children:s?.id===k.id?"Hide":a&&s?.id===k.id?"Loadingâ¦":"View"})}),e?t.jsx(bt,{children:t.jsx(he,{type:"button",size:"sm",variant:"danger",disabled:n,onClick:()=>_(k),children:"Delete"})}):null]},k.id))})]})})}),s?t.jsxs("div",{style:{display:"grid",gap:8},children:[t.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",gap:12},children:[t.jsxs("div",{children:[t.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:8,fontWeight:900,color:O,fontSize:"0.875rem"},children:[t.jsx(gl,{size:16}),"Usage ⢠",s.name]}),u?.from&&u?.to?t.jsxs("div",{style:{marginTop:2,color:z,fontSize:"0.75rem",fontWeight:700},children:[new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric"}).format(new Date(u.from))," â"," ",new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric"}).format(new Date(u.to))]}):null]}),t.jsxs("div",{style:{textAlign:"right"},children:[t.jsx("div",{style:{fontSize:"0.875rem",fontWeight:900,color:O},children:(u?.series||[]).reduce((k,P)=>k+(P.requests||0),0)}),t.jsx("div",{style:{fontSize:"0.75rem",fontWeight:700,color:z},children:"requests"})]})]}),t.jsx(uD,{value:m,onChange:h,disabled:a}),c?t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:c}):u?t.jsx("div",{style:{maxWidth:"48rem"},children:t.jsx(TA,{data:u.series||[],height:180})}):t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:a?"Loading usageâ¦":"Select an API key to view usage."})]}):t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:"Select an API key to view usage."})]}):t.jsx("div",{style:{color:z,fontSize:"0.875rem",fontWeight:650},children:"No API keys."})]})]})}function DNt(e){const{partners:n,meta:i,selectedPartnerId:r,listLoading:o,searchQuery:s,setSearchQuery:a,onPrev:c,onNext:u,isFullAdmin:m,saving:h,error:g,onOpenCreate:x,detailLoading:y,detail:w,onBack:j,name:v,setName:_,slug:$,setSlug:k,discountPercent:P,setDiscountPercent:S,returnUrl:I,setReturnUrl:A,active:E,setActive:B,logoPreviewUrl:T,logoHasLogo:M,onPickLogoFile:R,onRemoveLogo:F,onSave:Y,onDelete:H,apiKeysLoading:U,apiKeysError:X,apiKeys:Q,usageTarget:K,usageLoading:G,usageError:L,usage:q,usageRange:W,onUsageRangeChange:oe,onLoadUsage:se,newKeyName:de,setNewKeyName:le,createdToken:me,onClearCreatedToken:ee,onCreateKey:ne,onDeleteKey:Ae,onApiKeysOpen:_e}=e;return t.jsxs(gNt,{children:[t.jsx(yNt,{children:t.jsx(MNt,{partners:n,meta:i,selectedPartnerId:r,listLoading:o,controls:t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[m?t.jsx(he,{type:"button",size:"sm",variant:"primary",disabled:h,onClick:x,children:"Create partner"}):null,t.jsx(Ed,{value:s,onChange:a,placeholder:"Search partnersâ¦",containerStyle:{width:"100%"}})]}),onPrev:c,onNext:u})}),t.jsx(xNt,{children:r?t.jsxs("div",{style:{display:"grid",gap:12},children:[t.jsx(RNt,{canEdit:m,loading:y,saving:h,error:g,detail:w,onBack:j,name:v,setName:_,slug:$,setSlug:k,discountPercent:P,setDiscountPercent:S,returnUrl:I,setReturnUrl:A,active:E,setActive:B,logoPreviewUrl:T,logoHasLogo:M,onPickLogoFile:R,onRemoveLogo:F,onSave:Y,onDelete:H}),t.jsx(ONt,{canEdit:m,saving:h,apiKeysLoading:U,apiKeysError:X,apiKeys:Q,usageTarget:K,usageLoading:G,usageError:L,usage:q,usageRange:W,onUsageRangeChange:oe,newKeyName:de,setNewKeyName:le,createdToken:me,onClearCreatedToken:ee,onCreateKey:ne,onLoadUsage:se,onDeleteKey:Ae,onApiKeysOpen:_e},`partner-keys-${String(r)}`)]}):t.jsx("div",{style:{padding:16,color:z,fontWeight:650},children:"Select a partner from the list to view details."})})]})}const LNt=Tn` 24192 from { opacity: 0; transform: translateY(6px); } 24193 to { opacity: 1; transform: translateY(0); } 24194`,BNt=Tn` 24195 from { transform: rotate(0deg); } 24196 to { transform: rotate(360deg); } 24197`,Wee=p.div.withConfig({displayName:"AdminGrowthOps__StatsGrid",componentId:"sc-1hhdlc6-0"})` 24198 display: grid; 24199 grid-template-columns: repeat(4, minmax(0, 1fr)); 24200 gap: 0.75rem; 24201 margin-top: 1rem; 24202 24203 @media (max-width: 980px) { 24204 grid-template-columns: repeat(2, minmax(0, 1fr)); 24205 } 24206 24207 @media (max-width: 560px) { 24208 grid-template-columns: 1fr; 24209 } 24210`,Qh=p.div.withConfig({displayName:"AdminGrowthOps__StatCard",componentId:"sc-1hhdlc6-1"})` 24211 border: 1px solid ${V}; 24212 background: ${At}; 24213 border-radius: 0.875rem; 24214 padding: 0.85rem; 24215 display: flex; 24216 align-items: center; 24217 gap: 0.75rem; 24218`,Zh=p.div.withConfig({displayName:"AdminGrowthOps__StatIcon",componentId:"sc-1hhdlc6-2"})` 24219 width: 2.4rem; 24220 height: 2.4rem; 24221 border-radius: 0.8rem; 24222 display: inline-flex; 24223 align-items: center; 24224 justify-content: center; 24225 flex: 0 0 auto; 24226 color: ${({$tone:e})=>gy(e).color}; 24227 background: ${({$tone:e})=>gy(e).bg}; 24228 border: 1px solid ${({$tone:e})=>gy(e).border}; 24229`,Jh=p.div.withConfig({displayName:"AdminGrowthOps__StatValue",componentId:"sc-1hhdlc6-3"})` 24230 color: ${O}; 24231 font-size: 1.2rem; 24232 font-weight: 900; 24233 line-height: 1.1; 24234`,ef=p.div.withConfig({displayName:"AdminGrowthOps__StatLabel",componentId:"sc-1hhdlc6-4"})` 24235 color: ${z}; 24236 font-size: 0.68rem; 24237 font-weight: 850; 24238 letter-spacing: 0.045em; 24239 text-transform: uppercase; 24240 margin-top: 0.2rem; 24241`,FNt=p.div.withConfig({displayName:"AdminGrowthOps__StatLabelRow",componentId:"sc-1hhdlc6-5"})` 24242 display: inline-flex; 24243 align-items: baseline; 24244 gap: 0.4rem; 24245 flex-wrap: wrap; 24246`,WNt=p.span.withConfig({displayName:"AdminGrowthOps__StatHint",componentId:"sc-1hhdlc6-6"})` 24247 color: ${Pe}; 24248 font-size: 0.68rem; 24249 font-weight: 750; 24250 text-transform: none; 24251 letter-spacing: 0; 24252`,UNt=p.div.withConfig({displayName:"AdminGrowthOps__ProgressWrap",componentId:"sc-1hhdlc6-7"})` 24253 width: 12rem; 24254 display: grid; 24255 gap: 0.35rem; 24256 24257 @media (max-width: 760px) { 24258 width: 100%; 24259 } 24260`,HNt=p.div.withConfig({displayName:"AdminGrowthOps__ProgressMeta",componentId:"sc-1hhdlc6-8"})` 24261 display: flex; 24262 align-items: center; 24263 justify-content: space-between; 24264 gap: 0.5rem; 24265 color: ${z}; 24266 font-size: 0.72rem; 24267 font-weight: 800; 24268`,qNt=p.div.withConfig({displayName:"AdminGrowthOps__ProgressTrack",componentId:"sc-1hhdlc6-9"})` 24269 height: 0.45rem; 24270 border-radius: 999px; 24271 background: ${V}; 24272 overflow: hidden; 24273`,GNt=p.div.withConfig({displayName:"AdminGrowthOps__ProgressFill",componentId:"sc-1hhdlc6-10"})` 24274 width: ${({$value:e})=>Math.min(Math.max(e,0),100)}%; 24275 height: 100%; 24276 background: ${({$tone:e})=>gy(e).color}; 24277`,gb=p.div.withConfig({displayName:"AdminGrowthOps__Panel",componentId:"sc-1hhdlc6-11"})` 24278 margin-top: 1rem; 24279 background: ${Z}; 24280 border: 1px solid ${Rt}; 24281 border-radius: 1rem; 24282 box-shadow: 0 10px 26px rgba(17, 24, 39, 0.06); 24283 overflow: hidden; 24284 animation: ${LNt} 180ms ease both; 24285`,Uee=p.div.withConfig({displayName:"AdminGrowthOps__ExplorerLayout",componentId:"sc-1hhdlc6-12"})` 24286 margin-top: 1rem; 24287 display: grid; 24288 grid-template-columns: 18rem minmax(0, 1fr); 24289 gap: 1rem; 24290 align-items: start; 24291 24292 @media (max-width: 980px) { 24293 grid-template-columns: 1fr; 24294 } 24295`,Hee=p(gb).withConfig({displayName:"AdminGrowthOps__FilterPanel",componentId:"sc-1hhdlc6-13"})` 24296 margin-top: 0; 24297 padding: 0.9rem; 24298 position: sticky; 24299 top: 1rem; 24300 24301 @media (max-width: 980px) { 24302 position: relative; 24303 top: auto; 24304 } 24305`,qee=p.div.withConfig({displayName:"AdminGrowthOps__FilterTitle",componentId:"sc-1hhdlc6-14"})` 24306 color: ${O}; 24307 font-size: 0.82rem; 24308 font-weight: 900; 24309 margin-bottom: 0.75rem; 24310`,vd=p.div.withConfig({displayName:"AdminGrowthOps__FilterGroup",componentId:"sc-1hhdlc6-15"})` 24311 display: grid; 24312 gap: 0.4rem; 24313 margin-top: 0.75rem; 24314`,xp=p.label.withConfig({displayName:"AdminGrowthOps__FilterLabel",componentId:"sc-1hhdlc6-16"})` 24315 color: ${z}; 24316 font-size: 0.68rem; 24317 font-weight: 900; 24318 letter-spacing: 0.045em; 24319 text-transform: uppercase; 24320`,Gee=p.div.withConfig({displayName:"AdminGrowthOps__QuickChips",componentId:"sc-1hhdlc6-17"})` 24321 display: flex; 24322 gap: 0.4rem; 24323 flex-wrap: wrap; 24324 margin-top: 0.8rem; 24325`,Ug=p.button.withConfig({displayName:"AdminGrowthOps__QuickChip",componentId:"sc-1hhdlc6-18"})` 24326 border: 1px solid ${({$active:e})=>e?ot:V}; 24327 background: ${({$active:e})=>
24327e?cn:Z}; 24328 color: ${({$active:e})=>e?ot:z}; 24329 border-radius: 999px; 24330 padding: 0.28rem 0.55rem; 24331 font-size: 0.7rem; 24332 font-weight: 900; 24333 cursor: pointer; 24334`,Vee=p.div.withConfig({displayName:"AdminGrowthOps__Toolbar",componentId:"sc-1hhdlc6-19"})` 24335 padding: 0.85rem; 24336 display: flex; 24337 align-items: center; 24338 justify-content: space-between; 24339 gap: 0.75rem; 24340 border-bottom: 1px solid ${V}; 24341 background: ${Z}; 24342 24343 @media (max-width: 820px) { 24344 flex-direction: column; 24345 align-items: stretch; 24346 } 24347`,Kee=p.div.withConfig({displayName:"AdminGrowthOps__SearchWrap",componentId:"sc-1hhdlc6-20"})` 24348 position: relative; 24349 min-width: 16rem; 24350 flex: 1; 24351 max-width: 28rem; 24352 24353 @media (max-width: 820px) { 24354 min-width: 0; 24355 max-width: none; 24356 } 24357`,Yee=p(Cs).withConfig({displayName:"AdminGrowthOps__SearchIcon",componentId:"sc-1hhdlc6-21"})` 24358 position: absolute; 24359 left: 0.7rem; 24360 top: 50%; 24361 transform: translateY(-50%); 24362 color: ${Pe}; 24363`,Xee=p.input.withConfig({displayName:"AdminGrowthOps__SearchInput",componentId:"sc-1hhdlc6-22"})` 24364 width: 100%; 24365 height: 2.25rem; 24366 border: 1px solid ${V}; 24367 border-radius: 0.65rem; 24368 background: ${At}; 24369 color: ${O}; 24370 font-size: 0.82rem; 24371 font-weight: 700; 24372 padding: 0 0.8rem 0 2.1rem; 24373 24374 &::placeholder { 24375 color: ${Pe}; 24376 } 24377 24378 &:focus { 24379 outline: none; 24380 border-color: ${ot}; 24381 background: ${Z}; 24382 } 24383`,Qee=p.div.withConfig({displayName:"AdminGrowthOps__ToolbarRight",componentId:"sc-1hhdlc6-23"})` 24384 display: inline-flex; 24385 align-items: center; 24386 gap: 0.55rem; 24387 flex-wrap: wrap; 24388 justify-content: flex-end; 24389 24390 @media (max-width: 820px) { 24391 justify-content: stretch; 24392 24393 > * { 24394 flex: 1; 24395 } 24396 } 24397`,Zee=p.div.withConfig({displayName:"AdminGrowthOps__CountText",componentId:"sc-1hhdlc6-24"})` 24398 color: ${z}; 24399 font-size: 0.75rem; 24400 font-weight: 800; 24401`,Jee=p.div.withConfig({displayName:"AdminGrowthOps__Rows",componentId:"sc-1hhdlc6-25"})` 24402 display: grid; 24403 gap: 0.75rem; 24404 padding: 0.85rem; 24405`,Que=p.article.withConfig({displayName:"AdminGrowthOps__SignalCard",componentId:"sc-1hhdlc6-26"})` 24406 border: 1px solid ${V}; 24407 border-radius: 0.9rem; 24408 background: ${Z}; 24409 padding: 0.9rem; 24410 display: grid; 24411 grid-template-columns: minmax(0, 1fr) auto; 24412 gap: 0.85rem; 24413 transition: border-color 120ms ease, box-shadow 120ms ease; 24414 24415 &:hover { 24416 border-color: ${Rt}; 24417 box-shadow: 0 8px 20px rgba(17, 24, 39, 0.06); 24418 } 24419 24420 @media (max-width: 760px) { 24421 grid-template-columns: 1fr; 24422 } 24423`,Zue=p.div.withConfig({displayName:"AdminGrowthOps__SignalMain",componentId:"sc-1hhdlc6-27"})` 24424 min-width: 0; 24425`,Jue=p.div.withConfig({displayName:"AdminGrowthOps__SignalTop",componentId:"sc-1hhdlc6-28"})` 24426 display: flex; 24427 align-items: center; 24428 gap: 0.5rem; 24429 flex-wrap: wrap; 24430`,epe=p.div.withConfig({displayName:"AdminGrowthOps__SignalTitle",componentId:"sc-1hhdlc6-29"})` 24431 color: ${O}; 24432 font-size: 0.93rem; 24433 font-weight: 900; 24434 overflow: hidden; 24435 text-overflow: ellipsis; 24436`,tpe=p.span.withConfig({displayName:"AdminGrowthOps__Muted",componentId:"sc-1hhdlc6-30"})` 24437 color: ${z}; 24438`,pD=p.div.withConfig({displayName:"AdminGrowthOps__RowText",componentId:"sc-1hhdlc6-31"})` 24439 color: ${z}; 24440 font-size: 0.8rem; 24441 line-height: 1.45; 24442 margin-top: 0.35rem; 24443`,npe=p(pD).withConfig({displayName:"AdminGrowthOps__ActionText",componentId:"sc-1hhdlc6-32"})` 24444 color: ${O}; 24445 font-weight: 700; 24446`,ipe=p.span.withConfig({displayName:"AdminGrowthOps__Badge",componentId:"sc-1hhdlc6-33"})` 24447 display: inline-flex; 24448 align-items: center; 24449 gap: 0.3rem; 24450 border-radius: 999px; 24451 padding: 0.18rem 0.5rem; 24452 font-size: 0.66rem; 24453 font-weight: 900; 24454 letter-spacing: 0.035em; 24455 text-transform: uppercase; 24456 color: ${({$tone:e})=>gy(e).color}; 24457 background: ${({$tone:e})=>gy(e).bg}; 24458 border: 1px solid ${({$tone:e})=>gy(e).border}; 24459`,rpe=p.div.withConfig({displayName:"AdminGrowthOps__Metrics",componentId:"sc-1hhdlc6-34"})` 24460 display: flex; 24461 align-items: center; 24462 gap: 0.4rem; 24463 flex-wrap: wrap; 24464 margin-top: 0.65rem; 24465`,$m=p.span.withConfig({displayName:"AdminGrowthOps__MetricPill",componentId:"sc-1hhdlc6-35"})` 24466 display: inline-flex; 24467 align-items: center; 24468 gap: 0.25rem; 24469 border: 1px solid ${V}; 24470 background: ${At}; 24471 color: ${z}; 24472 border-radius: 999px; 24473 padding: 0.22rem 0.48rem; 24474 font-size: 0.7rem; 24475 font-weight: 800; 24476`,ope=p.div.withConfig({displayName:"AdminGrowthOps__RowSide",componentId:"sc-1hhdlc6-36"})` 24477 min-width: 9rem; 24478 display: flex; 24479 flex-direction: column; 24480 align-items: flex-end; 24481 gap: 0.6rem; 24482 24483 @media (max-width: 760px) {
24484 align-items: stretch; 24485 min-width: 0; 24486 } 24487`,VNt=p.div.withConfig({displayName:"AdminGrowthOps__DateStamp",componentId:"sc-1hhdlc6-37"})` 24488 color: ${Pe}; 24489 font-size: 0.72rem; 24490 font-weight: 800; 24491 white-space: nowrap; 24492`,spe=p.a.withConfig({displayName:"AdminGrowthOps__OpenLink",componentId:"sc-1hhdlc6-38"})` 24493 display: inline-flex; 24494 align-items: center; 24495 justify-content: center; 24496 gap: 0.35rem; 24497 color: ${ot}; 24498 border: 1px solid ${V}; 24499 background: ${Z}; 24500 border-radius: 0.6rem; 24501 padding: 0.42rem 0.55rem; 24502 font-size: 0.75rem; 24503 font-weight: 900; 24504 text-decoration: none; 24505 24506 &:hover { 24507 background: ${cn}; 24508 border-color: ${ot}; 24509 } 24510`,t5=p.div.withConfig({displayName:"AdminGrowthOps__EmptyState",componentId:"sc-1hhdlc6-39"})` 24511 padding: 3rem 1rem; 24512 text-align: center; 24513 color: ${z}; 24514`,n5=p.div.withConfig({displayName:"AdminGrowthOps__EmptyIcon",componentId:"sc-1hhdlc6-40"})` 24515 width: 3rem; 24516 height: 3rem; 24517 border-radius: 1rem; 24518 display: inline-flex; 24519 align-items: center; 24520 justify-content: center; 24521 color: ${Vt}; 24522 background: ${si}; 24523 border: 1px solid ${Ry}; 24524 margin-bottom: 0.75rem; 24525`,ete=p(Tr).withConfig({displayName:"AdminGrowthOps__Spinner",componentId:"sc-1hhdlc6-41"})` 24526 animation: ${BNt} 0.8s linear infinite; 24527`,tte=p(gb).withConfig({displayName:"AdminGrowthOps__LoadingPanel",componentId:"sc-1hhdlc6-42"})` 24528 padding: 2rem; 24529 display: flex; 24530 align-items: center; 24531 justify-content: center; 24532 color: ${z}; 24533 gap: 0.5rem; 24534 font-weight: 800; 24535`,KNt=p.div.withConfig({displayName:"AdminGrowthOps__EmbeddedWrap",componentId:"sc-1hhdlc6-43"})` 24536 display: flex; 24537 flex-direction: column; 24538 min-height: 0; 24539`;function gy(e){return e==="urgent"?{bg:kn,border:Er,color:oi}:e==="warning"?{bg:Jl,border:Oy,color:$i}:e==="positive"?{bg:si,border:Ry,color:Vt}:{bg:cn,border:V,color:ot}}function ape(e){if(!e)return"No date";const n=new Date(e);return Number.isNaN(n.getTime())?"No date":n.toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}function cP(e){return e?e.replace(/_/g," ").replace(/\b\w/g,n=>n.toUpperCase()):"Unknown"}function YNt(e,n){if(!n.trim())return!0;const i=n.trim().toLowerCase();return JSON.stringify(e).toLowerCase().includes(i)}function XNt(e,n){if(!n.trim())return!0;const i=n.trim().toLowerCase();return JSON.stringify(e).toLowerCase().includes(i)}function nte(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function i5(e){const n=new Date,i=new Date;return i.setDate(n.getDate()-Math.max(e-1,0)),{start:nte(i),end:nte(n)}}function r5(e){return{urgent:0,warning:1,positive:2,info:3}[e]??4}function Hg(e){const n=e.event_at?new Date(e.event_at):null;return n&&!Number.isNaN(n.getTime())?n.getTime():0}function QNt({sub:e="lifecycle"}={}){const[n,i]=l.useState(null),[r,o]=l.useState(!0),[s,a]=l.useState(null),[c,u]=l.useState("all"),[m,h]=l.useState("all"),[g,x]=l.useState("all"),[y,w]=l.useState("all"),[j,v]=l.useState("severity"),[_,$]=l.useState(()=>i5(30)),[k,P]=l.useState(""),[S,I]=l.useState("all"),[A,E]=l.useState("all"),[B,T]=l.useState("all"),[M,R]=l.useState("severity"),[F,Y]=l.useState(""),H=l.useCallback(async()=>{o(!0),a(null);try{const ee=await ue("/api/v1/admin/growth_ops"),ne=await ee.json().catch(()=>({}));if(!ee.ok)throw new Error(ne?.error||"Failed to load growth ops");i(ne?.admin?.growth_ops||null)}catch(ee){a(ee?.message||"Failed to load growth ops")}finally{o(!1)}},[]);l.useEffect(()=>{H()},[H]);const U=l.useMemo(()=>{const ee=n?.lifecycle.rows||[],ne=_.start?new Date(`${_.start}T00:00:00`).getTime():null,Ae=_.end?new Date(`${_.end}T23:59:59`).getTime():null;return ee.filter(_e=>c==="all"||_e.severity===c).filter(_e=>m==="all"||_e.stage===m).filter(_e=>g==="all"||_e.status===g).filter(_e=>y==="all"||_e.plan_code===y).filter(_e=>{const we=Hg(_e);return!(ne&&we<ne||Ae&&we>Ae)}).filter(_e=>YNt(_e,k)).sort((_e,we)=>j==="newest"?Hg(we)-Hg(_e):j==="oldest"?Hg(_e)-Hg(we):j==="stage"?_e.stage_label.localeCompare(we.stage_label):j==="plan"?(_e.plan_name||"").localeCompare(we.plan_name||""):r5(_e.severity)-r5(we.severity)||Hg(we)-Hg(_e))},[n,_,y,k,c,j,m,g]),X=l.useMemo(()=>CE(n?.lifecycle.rows||[],"stage",ee=>ee.stage_label),[n]),Q=l.useMemo(()=>CE(n?.lifecycle.rows||[],"status",ee=>cP(ee.status)),[n]),K=l.useMemo(()=>{const ee=n?.filters?.plans||[];return ee.length>0?ee.filter(ne=>ne.code).map(ne=>({value:ne.code,label:ne.active?ne.name:`${ne.name} (archived)`})):CE(n?.lifecycle.rows||[],"plan_code",ne=>ne.plan_name||ne.plan_code||"Unknown")},[n]),G=l.useMemo(()=>ZNt(n?.limits?.rows||[],"limit_key",ee=>ee.limit_label),[n]),L=l.useMemo(()=>(n?.limits?.rows||[]).filter(ne=>S==="all"||ne.severity===S).filter(ne=>A==="all"||ne.limit_key===A).filter(ne=>B==="all"||ne.plan_code===B).filter(ne=>XNt(ne,F)).sort((ne,Ae)=>M==="percent"?Ae.percent_used-ne.percent_used:M==="plan"?(ne.plan_name||"").localeCompare(Ae.plan_name||""):M==="type"?ne.limit_label.localeCompare(Ae.limit_label):M==="organization"?(ne.organization_name||"").localeCompare(Ae.organization_name||""):r5(ne.severity)-r5(Ae.severity)||Ae.percent_used-ne.percent_used),[n,B,F,S,M,A]);function q(){u("all"),h("all"),x("all"),w("all"),v("severity"),$(i5(30)),P("")}const W=i5(7),oe=i5(30),se=_.start===W.start&&_.end===W.end;function de(){if(se){$(oe);return}$(W)}function le(){I("all"),E("all"),T("all"),R("severity"),Y("")}return t.jsx(KNt,{children:e==="limits"?t.jsxs(t.Fragment,{children:[t.jsxs(Wee,{children:[t.jsxs(Qh,{children:[t.jsx(Zh,{$tone:"urgent",children:t.jsx(y9,{size:18})}),t.jsxs("div",{children:[t.jsx(Jh,{children:n?.limits?.summary?.urgent||0}),t.jsx(ef,{children:"At limit"})]})]}),t.jsxs(Qh,{children:[t.jsx(Zh,{$tone:"warning",children:t.jsx(Ene,{size:18})}),t.jsxs("div",{children:[t.jsx(Jh,{children:n?.limits?.summary?.warning||0}),t.jsx(ef,{children:"Near limit"})]})]}),t.jsxs(Qh,{children:[t.jsx(Zh,{$tone:"warning",children:t.jsx(wp,{size:18})}),t.jsxs("div",{children:[t.jsx(Jh,{children:n?.limits?.summary?.credit_pressure||0}),t.jsx(ef,{children:"Credit pressure"})]})]}),t.jsxs(Qh,{children:[t.jsx(Zh,{children:t.jsx(qi,{size:18})}),t.jsxs("div",{children:[t.jsx(Jh,{children:n?.limits?.summary?.total_opportunities||0}),t.jsx(ef,{children:"Total opportunities"})]})]})]}),r&&!n?t.jsxs(tte,{children:[t.jsx(ete,{size:18}),"Loading limit opportunities"]}):s?t.jsx(gb,{children:t.jsxs(t5,{children:[t.jsx(n5,{children:t.jsx(ei,{size:22})}),t.jsx("div",{children:s})]})}):t.jsxs(Uee,{children:[t.jsxs(Hee,{children:[t.jsx(qee,{children:"Explore limits"}),t.jsxs(Kee,{children:[t.jsx(Yee,{size:15}),t.jsx(Xee,{value:F,onChange:ee=>Y(ee.target.value),placeholder:"Search org, plan, limit type..."})]}),t.jsxs(Gee,{children:[t.jsx(Ug,{$active:S==="urgent",onClick:()=>I(S==="urgent"?"all":"urgent"),children:"At limit"}),t.jsx(Ug,{$active:S==="warning",onClick:()=>I(S==="warning"?"all":"warning"),children:"Near limit"}),t.jsx(Ug,{$active:A==="credits",onClick:()=>E(A==="credits"?"all":"credits"),children:"Credits"})]}),t.jsxs(vd,{children:[t.jsx(xp,{children:"Severity"}),t.jsx(Fn,{value:S,onChange:I,fullWidth:!0,size:"sm",dropdownPortal:!0,options:[{value:"all",label:"All severities"},{value:"urgent",label:"At limit"},{value:"warning",label:"Near limit"}]})]}),t.jsxs(vd,{children:[t.jsx(xp,{children:"Limit type"}),t.jsx(Fn,{value:A,onChange:E,fullWidth:!0,size:"sm",dropdownPortal:!0,options:[{value:"all",label:"All limit types"},...G]})]}),t.jsxs(vd,{children:[t.jsx(xp,{children:"Plan"}),t.jsx(Fn,{value:B,onChange:T,fullWidth:!0,size:"sm",dropdownPortal:!0,options:[{value:"all",label:"All plans"},...K]})]}),t.jsxs(vd,{children:[t.jsx(xp,{children:"Sort"}),t.jsx(Fn,{value:M,onChange:ee=>R(ee),fullWidth:!0,size:"sm",dropdownPortal:!0,options:[{value:"severity",label:"Severity first"},{value:"percent",label:"Highest usage"},{value:"type",label:"Limit type"},{value:"plan",label:"Plan"},{value:"organization",label:"Workspace"}]})]}),t.jsx(vd,{children:t.jsx(he,{variant:"outline",size:"sm",onClick:le,children:"Reset filters"})})]}),t.jsxs(gb,{children:[t.jsxs(Vee,{children:[t.jsxs(Zee,{children:["Showing ",L.length," of ",n?.limits?.rows.length||0," limit opportunities"]}),t.jsx(Qee,{children:t.jsx(ly,{value:M,onChange:ee=>R(ee),options:[{value:"severity",label:"Severity first"},{value:"percent",label:"Highest usage"},{value:"type",label:"Limit type"},{value:"plan",label:"Plan"},{value:"organization",label:"Workspace"}],size:"sm",variant:"outline"})})]}),L.length===0?t.jsxs(t5,{children:[t.jsx(n5,{children:t.jsx(co,{size:22})}),t.jsx("div",{children:"No matching limit opportunities right now."})]}):t.jsx(Jee,{children:L.map((ee,ne)=>t.jsx(ezt,{row:ee},`${ee.organization_id}-${ee.limit_key}-${ne}`))})]})]})]}):t.jsxs(t.Fragment,{children:[t.jsxs(Wee,{children:[t.jsxs(Qh,{children:[t.jsx(Zh,{$tone:"urgent",children:t.jsx(y9,{size:18})}),t.jsxs("div",{children:[t.jsx(Jh,{children:n?.lifecycle.summary.urgent||0}),t.jsx(ef,{children:"Urgent lifecycle"})]})]}),t.jsxs(Qh,{children:[t.jsx(Zh,{$tone:"warning",children:t.jsx(qc,{size:18})}),t.jsxs("div",{children:[t.jsx(Jh,{children:n?.lifecycle.summary.warning||0}),t.jsx(ef,{children:"Needs follow-up"})]})]}),t.jsxs(Qh,{children:[t.jsx(Zh,{$tone:"positive",children:t.jsx(co,{size:18})}),t.jsxs("div",{children:[t.jsx(Jh,{children:n?.lifecycle.summary.new_paid||0}),t.jsxs(FNt,{children:[t.jsx(ef,{children:"New paid"}),t.jsxs(WNt,{children:["Last ",n?.window_days||30," days"]})]})]})]}),t.jsxs(Qh,{children:[t.jsx(Zh,{children:t.jsx(sbe,{size:18})}),t.jsxs("div",{children:[t.jsx(Jh,{children:n?.lifecycle.summary.total_signals||0}),t.jsx(ef,{children:"Total signals"})]})]})]}),r&&!n?t.jsxs(tte,{children:[t.jsx(ete,{size:18}),"Loading growth signals"]}):s?t.jsx(gb,{children:t.jsxs(t5,{children:[t.jsx(n5,{children:t.jsx(ei,{size:22})}),t.jsx("div",{children:s})]})}):t.jsxs(Uee,{children:[t.jsxs(Hee,{children:[t.jsx(qee,{children:"Explore lifecycle"}),t.jsxs(Kee,{children:[t.jsx(Yee,{size:15}),t.jsx(Xee,{value:k,onChange:ee=>P(ee.target.value),placeholder:"Search org, user, email, reason..."})]}),t.jsxs(Gee,{children:[t.jsx(Ug,{$active:c==="urgent",onClick:()=>u(c==="urgent"?"all":"urgent"),children:"Urgent"}),t.jsx(Ug,{$active:m==="trialing",onClick:()=>h(m==="trialing"?"all":"trialing"),children:"Trials"}),t.jsx(Ug,{$active:m==="cancel_at_period_end",onClick:()=>h(m==="cancel_at_period_end"?"all":"cancel_at_period_end"),children:"Canceling"}),t.jsx(Ug,{$active:se,onClick:de,children:"Last 7d"})]}),t.jsxs(vd,{children:[t.jsx(xp,{children:"Severity"}),t.jsx(Fn,{value:c,onChange:u,fullWidth:!0,size:"sm",dropdownPortal:!0,options:[{value:"all",label:"All severities"},{value:"urgent",label:"Urgent"},{value:"warning",label:"Warning"},{value:"positive",label:"Positive"},{value:"info",label:"Info"}]})]}),t.jsxs(vd,{children:[t.jsx(xp,{children:"Stage"}),t.jsx(Fn,{value:m,onChange:h,fullWidth:!0,size:"sm",dropdownPortal:!0,options:[{value:"all",label:"All stages"},...X]})]}),t.jsxs(vd,{children:[t.jsx(xp,{children:"Status"}),t.jsx(Fn,{value:g,onChange:x,fullWidth:!0,size:"sm",dropdownPortal:!0,options:[{value:"all",label:"All statuses"},...Q]})]}),t.jsxs(vd,{children:[t.jsx(xp,{children:"Plan"}),t.jsx(Fn,{value:y,onChange:w,fullWidth:!0,size:"sm",dropdownPortal:!0,options:[{value:"all",label:"All plans"},...K]})]}),t.jsxs(vd,{children:[t.jsx(xp,{children:"Date range"}
24539),t.jsx(rh,{value:_,onChange:$,presets:[7,14,30]})]}),t.jsxs(vd,{children:[t.jsx(xp,{children:"Sort"}),t.jsx(Fn,{value:j,onChange:ee=>v(ee),fullWidth:!0,size:"sm",dropdownPortal:!0,options:[{value:"severity",label:"Severity first"},{value:"newest",label:"Newest first"},{value:"oldest",label:"Oldest first"},{value:"stage",label:"Stage"},{value:"plan",label:"Plan"}]})]}),t.jsx(vd,{children:t.jsx(he,{variant:"outline",size:"sm",onClick:q,children:"Reset filters"})})]}),t.jsxs(gb,{children:[t.jsxs(Vee,{children:[t.jsxs(Zee,{children:["Showing ",U.length," of ",n?.lifecycle.rows.length||0," lifecycle signals"]}),t.jsx(Qee,{children:t.jsx(ly,{value:j,onChange:ee=>v(ee),options:[{value:"severity",label:"Severity first"},{value:"newest",label:"Newest"},{value:"oldest",label:"Oldest"},{value:"stage",label:"Stage"},{value:"plan",label:"Plan"}],size:"sm",variant:"outline"})})]}),U.length===0?t.jsxs(t5,{children:[t.jsx(n5,{children:t.jsx(co,{size:22})}),t.jsx("div",{children:"No matching lifecycle signals right now."})]}):t.jsx(Jee,{children:U.map((ee,ne)=>t.jsx(JNt,{row:ee},`${ee.stage}-${ee.organization_id}-${ne}`))})]})]})]})})}function CE(e,n,i){const r=new Map;return e.forEach(o=>{const s=o[n];if(s==null||s==="")return;const a=String(s);r.has(a)||r.set(a,i(o))}),Array.from(r.entries()).map(([o,s])=>({value:o,label:s})).sort((o,s)=>o.label.localeCompare(s.label))}function ZNt(e,n,i){const r=new Map;return e.forEach(o=>{const s=o[n];if(s==null||s==="")return;const a=String(s);r.has(a)||r.set(a,i(o))}),Array.from(r.entries()).map(([o,s])=>({value:o,label:s})).sort((o,s)=>o.label.localeCompare(s.label))}function JNt({row:e}){return t.jsxs(Que,{children:[t.jsxs(Zue,{children:[t.jsxs(Jue,{children:[t.jsx(ipe,{$tone:e.severity,children:e.stage_label}),e.plan_name?t.jsx($m,{children:e.plan_name}):null,e.status?t.jsx($m,{children:cP(e.status)}):null]}),t.jsxs(epe,{children:[e.organization_name||"Unknown workspace"," ",t.jsxs(tpe,{children:["· ",e.user_email||e.user_name||"No owner email"]})]}),t.jsx(pD,{children:e.reason}),t.jsx(npe,{children:e.suggested_action}),t.jsx(rpe,{children:e.metrics.map(n=>t.jsxs($m,{children:[n.label,": ",n.value]},`${n.label}-${n.value}`))})]}),t.jsxs(ope,{children:[t.jsx(VNt,{children:ape(e.event_at)}),e.organization_id?t.jsxs(spe,{href:`/admin/resources?resource=organizations&org_id=${e.organization_id}`,children:["Open org ",t.jsx(G8,{size:13})]}):null]})]})}function ezt({row:e}){const n=e.limit?`${e.used}/${e.limit}`:`${e.used}`;return t.jsxs(Que,{children:[t.jsxs(Zue,{children:[t.jsxs(Jue,{children:[t.jsx(ipe,{$tone:e.severity,children:e.limit_label}),e.plan_name?t.jsx($m,{children:e.plan_name}):null,e.billing_interval?t.jsx($m,{children:cP(e.billing_interval)}):null]}),t.jsxs(epe,{children:[e.organization_name||"Unknown workspace"," ",t.jsxs(tpe,{children:["· ",n," used"]})]}),t.jsx(pD,{children:e.detail}),t.jsx(npe,{children:e.suggested_action}),t.jsxs(rpe,{children:[t.jsxs($m,{children:["Status: ",cP(e.status)]}),e.metadata?.active_prompts!==void 0?t.jsxs($m,{children:["Active prompts: ",e.metadata.active_prompts]}):null,e.metadata?.daily_prompt_runs_used_today!==void 0?t.jsxs($m,{children:["Runs today: ",e.metadata.daily_prompt_runs_used_today]}):null,e.resets_on?t.jsxs($m,{children:["Resets ",ape(e.resets_on)]}):null]})]}),t.jsxs(ope,{children:[t.jsxs(UNt,{children:[t.jsxs(HNt,{children:[t.jsx("span",{children:n}),t.jsxs("span",{children:[e.percent_used,"%"]})]}),t.jsx(qNt,{children:t.jsx(GNt,{$value:e.percent_used,$tone:e.severity})})]}),t.jsxs(spe,{href:`/admin/resources?resource=organizations&org_id=${e.organization_id}`,children:["Open org ",t.jsx(G8,{size:13})]})]})]})}function tzt(e){const n=String(e||"").toLowerCase().trim();return n==="organizations"||n==="workspaces"?"organizations":n==="projects"||n==="project"?"projects":n==="partners"||n==="partner"?"partners":n==="billing"?"billing":n==="growth"||n==="growth_ops"||n==="lifecycle"?"growth":n==="subscriptions"||n==="subs"||n==="plans"||n==="plan"?"billing":n==="competitors"||n==="competitor"?"competitors":n==="citations"||n==="citation"?"citations":n==="keyword_volumes"||n==="keyword_volume"||n==="keywords"?"keyword_volumes":"users"}const _m=25;function ite(e){return`${e}T00:00:00`}function rte(e){return`${e}T23:59:59`}function ote({label:e,icon:n,items:i,onSelect:r}){const[o,s]=l.useState(!1),[a,c]=l.useState(null),u=l.useRef(null),m=l.useRef(null),h=l.useCallback(()=>{const x=u.current;if(!x)return;const y=x.getBoundingClientRect();c({top:Math.round(y.bottom+6),left:Math.round(y.left)})},[]);l.useLayoutEffect(()=>{o&&h()},[o,h]),l.useEffect(()=>{if(!o)return;const x=y=>{u.current?.contains(y.target)||m.current?.contains(y.target)||s(!1)};return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[o]);const g=o&&a?jr.createPortal(t.jsx("div",{ref:m,role:"menu",style:{position:"fixed",top:a.top,left
24539:a.left,zIndex:10002,minWidth:220,background:"white",border:"1px solid rgba(229,231,235,1)",borderRadius:12,boxShadow:"0 18px 60px rgba(0,0,0,0.14)",padding:6},children:i.map(x=>t.jsxs("button",{type:"button",role:"menuitem",disabled:x.disabled,style:{width:"100%",display:"flex",alignItems:"center",gap:10,padding:"10px 10px",borderRadius:10,border:0,background:"transparent",cursor:x.disabled?"default":"pointer",fontWeight:800,fontSize:"0.8125rem",color:x.disabled?"rgba(107,114,128,0.5)":"rgb(17,24,39)"},onClick:()=>{x.disabled||(s(!1),r(x.key))},children:[x.icon??null,x.label]},x.key))}),document.body):null;return t.jsxs("div",{ref:u,style:{display:"inline-flex",position:"relative"},children:[t.jsxs("button",{type:"button",onClick:()=>s(x=>!x),style:{appearance:"none",display:"inline-flex",alignItems:"center",gap:6,padding:"0.4rem 0.7rem",borderRadius:8,border:"1px solid rgba(79, 70, 229, 0.25)",background:"rgba(79, 70, 229, 0.06)",color:"rgb(79, 70, 229)",fontWeight:800,fontSize:"0.8rem",cursor:"pointer",whiteSpace:"nowrap"},children:[n??null,e,t.jsx(qn,{size:14,style:{opacity:.6}})]}),g]})}function nzt(){const e=zn(),{user:n}=yn(),{showToast:i}=Uo(),[r,o]=yr(),s=re=>{const fe=String(re||"").trim();if(fe)try{i(fe,{tone:"error"})}catch{}},a=tzt(r.get("resource")),c=String(r.get("sub")||"overview").toLowerCase(),u=String(r.get("sub")||"lifecycle").toLowerCase(),m=l.useMemo(()=>{if(a!=="users")return null;const re=r.get("user_id"),fe=re?Number(re):NaN;return Number.isFinite(fe)&&fe>0?fe:null},[a,r]),h=l.useMemo(()=>{if(a!=="organizations")return null;const re=r.get("org_id"),fe=re?Number(re):NaN;return Number.isFinite(fe)&&fe>0?fe:null},[a,r]),g=l.useMemo(()=>{if(a!=="projects")return null;const re=r.get("project_id"),fe=re?Number(re):NaN;return Number.isFinite(fe)&&fe>0?fe:null},[a,r]),x=l.useMemo(()=>{if(a!=="partners")return null;const re=r.get("partner_id"),fe=re?Number(re):NaN;return Number.isFinite(fe)&&fe>0?fe:null},[a,r]),y=l.useMemo(()=>{if(a!=="billing"||c!=="subscriptions")return null;const re=r.get("subscription_id"),fe=re?Number(re):NaN;return Number.isFinite(fe)&&fe>0?fe:null},[a,c,r]),[w,j]=l.useState(""),[v,_]=l.useState(""),[$,k]=l.useState(!1),[P,S]=l.useState(!1),[I,A]=l.useState(!1),[E,B]=l.useState(!1),[T,M]=l.useState([]),[R,F]=l.useState([]),[Y,H]=l.useState([]),[U,X]=l.useState(!1);l.useEffect(()=>{const re=window.setTimeout(()=>_(w),250);return()=>window.clearTimeout(re)},[w]),l.useEffect(()=>{K(1)},[w,$,P,I,E,T,U]);const[Q,K]=l.useState(1),[G,L]=l.useState(!1),[q,W]=l.useState(null),[oe,se]=l.useState(null),[de,le]=l.useState([]),[me,ee]=l.useState([]),[ne,Ae]=l.useState([]),[_e,we]=l.useState(null),[Ke,ce]=l.useState(null),[ie,Re]=l.useState([]),[Be,tt]=l.useState([]),[dt,je]=l.useState(!1),[Me,Se]=l.useState(null),[it,De]=l.useState(null),[te,ge]=l.useState(!1),[Je,Ee]=l.useState(null),[Xe,yt]=l.useState(!1),[Ne,Le]=l.useState(null),[Ue,We]=l.useState(!1),[Qe,ht]=l.useState(null),[pe,be]=l.useState(!1),[rt,ze]=l.useState(null),[lt,vt]=l.useState(null),[Wt,Qt]=l.useState(!1),[Yt,Zt]=l.useState([]),[tn,nn]=l.useState(null),[xn,st]=l.useState([]),[Ct,Ie]=l.useState(null),[ae,Fe]=l.useState([]),[Ge,wt]=l.useState(null),[ke,Ve]=l.useState([]),[pt,Nt]=l.useState([]),[qe,qt]=l.useState([]),[Mn,zt]=l.useState(!1),[dn,rn]=l.useState(null),[bn,kt]=l.useState(!1),[Kt,un]=l.useState(null),[pn,$n]=l.useState(0),[Ii,_i]=l.useState(!1),[di,Co]=l.useState(null),[Gr,Go]=l.useState(null),[Qc,Zs]=l.useState(!1),[jl,Vo]=l.useState(!1),[Ro,So]=l.useState(null),[ic,cs]=l.useState(!1),[rc,_l]=l.useState(null),[Ns,Ti]=l.useState(""),[ds,Cl]=l.useState(""),[Sl,Ko]=l.useState(!0),[Zc,us]=l.useState(""),[Js,Fp]=l.useState("usd"),[oc,va]=l.useState(""),[sc,wa]=l.useState(""),[Wp,ac]=l.useState(""),[Vr,Jc]=l.useState(""),[Oo,qa]=l.useState("{}"),Kn=l.useMemo(()=>{const re=String(n?.admin_role||"").toLowerCase();return re==="admin"||re==="editor"},[n?.admin_role]),Ga=l.useMemo(()=>{const re=String(n?.admin_role||"").toLowerCase();return re==="admin"||re==="editor"||re==="viewer"},[n?.admin_role]),an=l.useMemo(()=>String(n?.admin_role||"").toLowerCase()==="admin",[n?.admin_role]),[Va,Ka]=l.useState(!1),[Kr,mo]=l.useState(!1),[ja,gi]=l.useState(null),[Or,ea]=l.useState(null),[Hd,_a]=l.useState(""),[kl,Ca]=l.useState(""),[to,zs]=l.useState(""),[Sa,ta]=l.useState(""),[Du,ps]=l.useState(!1),[lc,na]=l.useState(""),[Ya,Yo]=l.useState(!1),[Up,ed]=l.useState(null),[Xa,$l]=l.useState([]),[Lu,td]=l.useState({page:1,totalPages:1,total:0}),[nd,qd]=l.useState(!1),[id,Qa]=l.useState(!1),[ka,_r]=l.useState(!1),[Gd,Cr]=l.useState(null),[ti,Ts]=l.useState(null),[cc,hh]=l.useState(""),[Hp,dc]=l.useState(""),[Vd,$a]=l.useState(""),[Bu,Za]=l.useState(!1),[Il,Pl]=l.useState(""),[Kd,Ki]=l.useState(!1),[Ia,Pa]=l.useState("default_v1"),[Aa,It]=l.useState(!1),[Dt,ut]=l.useState(null),[Lt,gt]=l.useState([]),[Ln,yi]=l.useState(!1),[Jt,Qn]=l.useState(null),[Ja,ms]=l.useState(!1),[xe,Oe]=l.useState(null),[He,Ye]=l.useState(null),ft=l.useRef(0),[Ot,ln]=l.useState(()=>{const re=qs();return{start:hl(re,-29),end:re}}),[on,In]=l.useState(!1),[xi,ai]=l.useState(null),[Yi,ar]=l.useState([]),[Pi,Xo]=l.useState({page:1,totalPages:1,total:0}),[rd,xr]=l.useState(!1),Yr=l.useRef(0),[Vy,qp]=l.useState(""),[Gp,Fu]=l.useState(""),[Ky,BC]=l.useState("viewer"),[fh,qf]=l.useState(!1),[Do,Di]=l.useState(!1),[FC,hi]=l.useState(null),[vn,Vp]=l.useState(null),[D1,Wu]=l.useState(""),[L1,B1]=l.useState(""),[F1,WC]=l.useState(""),[UC,HC]=l.useState(""),[W1,U1]=l.useState(""),[Yy,Al]=l.useState(""),[Gf,el]=l.useState(""),[Kp,Xy]=l.useState(""),[Vf,Kf]=l.useState("daily"),[Qy,Uu]=l.useState(""),[H1,Yf]=l.useState(!1),[Yp,qC]=l.useState({}),[Na,Zy]=l.useState(""),[od,q1]=l.useState(""),[Xf,Hu]=l.useState(""),[Jy,G1]=l.useState("{}"),[V1,Qf]=l.useState(!1),[Nl,za]=l.useState(null),[zl,ia]=l.useState(!1),[ra,hs]=l.useState(null),[Ta,tl]=l.useState(""),[Tl,oa]=l.useState(""),[uc,Xp]=l.useState("0"),[Zf,qu]=l.useState(""),[e0,no]=l.useState(!0),[Ci,ri]=l.useState(null),[El,fs]=l.useState(!1),K1=l.useMemo(()=>Ci?URL.createObjectURL(Ci):El?null:ra?.logo_url||null,[ra?.logo_url,Ci,El]);l.useEffect(()=>{if(!Ci)return;const re=URL.createObjectURL(Ci);return()=>URL.revokeObjectURL(re)},[Ci]);const[Gu,Jf]=l.useState(!1),[GC,Yd]=l.useState(null),[Vu,t0]=l.useState(""),[gh,n0]=l.useState(""),[Ku,sd]=l.useState("0"),[Xd,ad]=l.useState(""),[i0,r0]=l.useState(!0),[Qp,Yu]=l.useState(!1),[Zp,Sr]=l.useState(null),[o0,Xu]=l.useState([]),[UA,eg]=l.useState(!1),[HA,kr]=l.useState(null),[Y1,Qu]=l.useState(""),[Zu,Jp]=l.useState(null),[em,ld]=l.useState(!1),[qA,yh]=l.useState(null),[GA,tm]=l.useState(null),pc=l.useRef(0),[s0,tg]=l.useState(()=>{const re=qs();return{start:hl(re,-29),end:re}}),[X1,Ju]=l.useState(!1),[Q1,xh]=l.useState(null),[a0,l0]=l.useState([]),[c0,ep]=l.useState(null),[Qd,Z1]=l.useState({page:1,totalPages:1,total:0}),[VC,nm]=l.useState(!1),[ng,tp]=l.useState(!1),[ig,np]=l.useState(null),[KC,mc]=l.useState([]),[d0,hc]=l.useState({page:1,totalPages:1,total:0}),[u0,rg]=l.useState(!1),[ip,cd]=l.useState(null),[og,p0]=l.useState(null),[J1,bh]=l.useState(!1),[vh,wh]=l.useState(!1),[YC,rp]=l.useState(null),[m0,jh]=l.useState([]),[sg,_h]=l.useState({page:1,totalPages:1,total:0}),[nl,sa]=l.useState(!1),il=l.useRef(0),[h0,f0]=l.useState(""),[dd,aa]=l.useState(""),[io,ag]=l.useState("viewer"),[ud,Xn]=l.useState(!1),[Xi,ro]=l.useState(null),[g0,op]=l.useState([]),[Zd,Ch]=l.useState({page:1,totalPages:1,total:0}),[lg,Jd]=l.useState(!1),[XC,Dr]=l.useState(!1),[ev,cg]=l.useState(null),[QC,y0]=l.useState([]),[tv,dg]=l.useState({page:1,totalPages:1,total:0}),[nv,ug]=l.useState(!1),[Es,Xr]=l.useState(!1),[x0,im]=l.useState(null),[b0,Sh]=l.useState([]),[fc,rm]=l.useState({page:1,totalPages:1,total:0}),[iv,pg]=l.useState(!1),[rv,v0]=l.useState(!1),[ZC,w0]=l.useState(null),[JC,kh]=l.useState([]),[mg,hg]=l.useState({page:1,totalPages:1,total:0}),[VA,$h]=l.useState(!1),[ov,j0]=l.useState(!1),[sv,_0]=l.useState(null),[eS,av]=l.useState(null),[tS,lv]=l.useState(!1),[nS,C0]=l.useState(!1),[Ih,S0
24539]=l.useState(null),[k0,fg]=l.useState([]),[$0,I0]=l.useState({page:1,totalPages:1,total:0}),[KA,cv]=l.useState(!1),[dv,P0]=l.useState(!1),[iS,A0]=l.useState(null),[uv,pv]=l.useState([]),[N0,z0]=l.useState({page:1,totalPages:1,total:0}),[rS,mv]=l.useState(!1),[YA,gg]=l.useState(!1),[hv,T0]=l.useState(!1),[fv,gv]=l.useState(!1),[oS,E0]=l.useState(null),[sS,yg]=l.useState("{}"),[om,xg]=l.useState(null);l.useEffect(()=>{ue("/api/v1/admin/ping",{method:"GET"}).then(re=>{re.ok||e("/forbidden",{replace:!0})}).catch(()=>e("/forbidden",{replace:!0}))},[e]),l.useEffect(()=>{if(!r.get("resource")){o({resource:"users"},{replace:!0});return}if(a==="billing"){if(!r.get("sub")){const re=new URLSearchParams(r);re.set("sub","overview"),o(re,{replace:!0});return}if(!Ga){e("/forbidden",{replace:!0});return}if((c==="plans"||c==="discounts")&&!an){e("/admin/resources?resource=billing&sub=subscriptions",{replace:!0});return}}if(a==="growth"&&!r.get("sub")){const re=new URLSearchParams(r);re.set("sub","lifecycle"),o(re,{replace:!0});return}K(1),W(null),se(null),le([]),ee([]),Ae([]),Re([]),tt([]),Zt([]),nn(null),st([]),Ie(null),Fe([]),wt(null),Ve([]),Nt([]),qt([]),rn(null),zt(!1),kt(!1),Go(null),Co(null),_i(!1),j(""),k(!1),S(!1),A(!1),M([]),X(!1),hs(null),Qf(!1),za(null),ia(!1),tl(""),oa(""),Xp("0"),qu(""),no(!0),Jf(!1),Yd(null),Xu([]),Sr(null),Yu(!1),eg(!1),kr(null),Qu(""),Jp(null),ld(!1),yh(null),tm(null)},[a,c,u,an,Ga,e]),l.useEffect(()=>{let re=!1;return(async()=>{if(!(a==="billing"||a==="growth")){L(!0),W(null);try{const ye=v.trim(),Ce=new URLSearchParams({page:String(Q),per_page:String(_m)});(a==="users"||a==="organizations"||a==="projects"||a==="partners")&&ye&&Ce.set("q",ye),a==="users"&&$&&Ce.set("admin_only","1"),a==="organizations"&&P&&an&&Ce.set("deleted_only","1"),a==="organizations"&&I&&Ce.set("onboarding_only","1"),a==="organizations"&&E&&Ce.set("sales_only","1");const et=`/api/v1/admin/${a}?${Ce.toString()}`,mt=await ue(et,{method:"GET"}),Te=await mt.json().catch(()=>({}));if(!mt.ok)throw new Error(Te?.error||`Request failed (${mt.status})`);if(re)return;const Tt=Te?.admin||{},Rn=Tt?.pagination||{},Ma={page:Number(Rn?.page||1),per_page:Number(Rn?.per_page||_m),total:Number(Rn?.total||0),total_pages:Number(Rn?.total_pages||1)};se(Ma),a==="users"&&le(Array.isArray(Tt?.users)?Tt.users:[]),a==="organizations"&&ee(Array.isArray(Tt?.organizations)?Tt.organizations:[]),a==="projects"&&Ae(Array.isArray(Tt?.projects)?Tt.projects:[]),a==="partners"&&Re(Array.isArray(Tt?.partners)?Tt.partners:[]),a==="projects"&&we(Number(Tt?.insights?.totals?.active_prompts??0)),a==="projects"&&ce(Number(Tt?.insights?.totals?.runnable_prompts??0)),a==="competitors"&&(Zt(Array.isArray(Tt?.competitors)?Tt.competitors:[]),nn(Tt?.insights||null)),a==="citations"&&(st(Array.isArray(Tt?.citations)?Tt.citations:[]),Tt?.insights&&Ie(Tt.insights)),a==="keyword_volumes"&&(Fe(Array.isArray(Tt?.keyword_volumes)?Tt.keyword_volumes:[]),wt(Tt?.insights||null))}catch(ye){if(re)return;W(ye instanceof Error?ye.message:"Failed to load")}finally{re||L(!1)}}})(),()=>{re=!0}},[Q,a,v,$,P,I,E,an]),l.useEffect(()=>{a==="billing"&&K(1)},[a,c]),l.useEffect(()=>{let re=!1;return(async()=>{if(a==="billing"&&Ga&&c!=="overview"&&!(c==="plans"&&!an)){L(!0),W(null),se(null);try{const ye=c==="plans"?"plans":c==="discounts"?"discounts":"subscriptions",Ce=v.trim(),et=new URLSearchParams({page:String(Q),per_page:String(_m)});if(ye==="subscriptions"&&Ce&&et.set("q",Ce),ye==="subscriptions"){const Cg=Array.isArray(T)?T.map(String):[],Bv=Cg.includes("exempted"),xc=Cg.includes("paying"),Fv=Cg.filter(Ah=>Ah!=="exempted"&&Ah!=="paying");Fv.length&&et.set("statuses",Fv.join(",")),Bv&&et.set("exempted","1"),xc&&et.set("paying","1"),U&&an&&et.set("deleted_only","1");const am=Array.isArray(R)?R.map(String).filter(Boolean):[];am.length&&et.set("plan_codes",am.join(","))}const mt=`/api/v1/admin/${ye}?${et.toString()}`,Te=await ue(mt,{method:"GET"}),Tt=await Te.json().catch(()=>({}));if(!Te.ok)throw new Error(Tt?.error||`Request failed (${Te.status})`);if(re)return;const Rn=Tt?.admin||{},Ma=Rn?.pagination||{},nu={page:Number(Ma?.page||1),per_page:Number(Ma?.per_page||_m),total:Number(Ma?.total||0),total_pages:Number(Ma?.total_pages||1)};se(nu),ye==="plans"?(Ve(Array.isArray(Rn?.plans)?Rn.plans:[]),tt([]),un(Rn?.polar||null)):ye==="discounts"?(Nt(Array.isArray(Rn?.discounts)?Rn.discounts:[]),Ve([]),tt([]),un(null)):(tt(Array.isArray(Rn?.subscriptions)?Rn.subscriptions:[]),Array.isArray(Rn?.available_plans)&&H(Rn.available_plans),Ve([]),un(null))}catch(ye){if(re)return;W(ye instanceof Error?ye.message:"Failed to load")}finally{re||L(!1)}}})(),()=>{re=!0}},[Q,a,c,an,Ga,pn,v,T,R,U]),l.useEffect(()=>{if(a!=="billing"||c!=="overview"||!Ga)return;let re=!1;return(async()=>{_i(!0),Co(null);try{const ye=await ue("/api/v1/admin/billing_overview",{method:"GET"}),Ce=await ye.json().catch(()=>({}));if(!ye.ok)throw new Error(Ce?.error||`Failed to load billing overview (${ye.status})`);
24539if(re)return;Go(Ce?.admin?.billing_overview||null)}catch(ye){if(re)return;Co(ye instanceof Error?ye.message:"Failed to load billing overview"),Go(null)}finally{re||_i(!1)}})(),()=>{re=!0}},[a,c,Ga,pn]);const M0=async()=>{if(!an)return!1;zt(!0),rn(null);try{const re=await ue("/api/v1/admin/polar_products",{method:"GET"}),fe=await re.json().catch(()=>({}));if(!re.ok)throw new Error(fe?.error||`Failed to load Polar products (${re.status})`);const ye=Array.isArray(fe?.admin?.polar_products)?fe.admin.polar_products:[];return qt(ye),!0}catch(re){return rn(re instanceof Error?re.message:"Failed to load Polar products"),!1}finally{zt(!1)}},aS=async()=>{if(bn||Mn)return;await M0()&&kt(!0)};l.useEffect(()=>{a==="billing"&&c==="discounts"&&an&&aS()},[a,c,an]);const ho=l.useMemo(()=>{const re=oe||{page:1,total:0,total_pages:1};return{page:re.page,totalPages:Math.max(1,re.total_pages||1),total:Math.max(0,re.total||0)}},[oe]),bg=()=>{an&&(Zs(!0),Vo(!1),So(null),cs(!0),_l(null),Ti(""),Cl(""),Ko(!0),us(""),Fp("usd"),va(""),wa(""),ac(""),Jc(""),qa("{}"))},lS=async()=>{if(!(!an||!window.confirm(`Seed baseline plans? 24540 24541This will upsert the baseline plan definitions into the DB (entitlements/prices). It does not sync Polar. Continue?`)))try{const fe=await ue("/api/v1/admin/plans/seed_baseline",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({update_existing:!0})}),ye=await fe.json().catch(()=>({}));if(!fe.ok)throw new Error(ye?.error||`Failed to seed plans (${fe.status})`);i("Seeded baseline plans.",{tone:"success"}),rl()}catch(fe){s(fe instanceof Error?fe.message:"Failed to seed plans")}},yv=async re=>{if(an){Zs(!0),Vo(!1),So(null),cs(!1),_l(null);try{const fe=await ue(`/api/v1/admin/plans/${re}`,{method:"GET"}),ye=await fe.json().catch(()=>({}));if(!fe.ok)throw new Error(ye?.error||`Failed to load plan (${fe.status})`);const Ce=ye?.admin?.plan||null;if(!Ce)throw new Error("Missing plan payload");_l(Ce),Ti(String(Ce.code||"")),Cl(String(Ce.name||"")),Ko(!!Ce.active),us(Ce.trial_days===null||typeof Ce.trial_days>"u"?"":String(Ce.trial_days)),Fp(String(Ce.currency||"usd")),va(Ce.price_monthly_cents===null||typeof Ce.price_monthly_cents>"u"?"":String(Ce.price_monthly_cents)),wa(Ce.price_yearly_cents===null||typeof Ce.price_yearly_cents>"u"?"":String(Ce.price_yearly_cents)),ac(Ce.original_price_monthly_cents===null||typeof Ce.original_price_monthly_cents>"u"?"":String(Ce.original_price_monthly_cents)),Jc(Ce.original_price_yearly_cents===null||typeof Ce.original_price_yearly_cents>"u"?"":String(Ce.original_price_yearly_cents)),qa(JSON.stringify(Ce.entitlements||{},null,2))}catch(fe){const ye=fe instanceof Error?fe.message:"Failed to load plan";So(ye),s(ye)}}},rl=()=>{$n(re=>re+1)},xv=async re=>{if(an){W(null);try{const fe=await ue("/api/v1/admin/discounts",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(re||{})}),ye=await fe.json().catch(()=>({}));if(!fe.ok)throw new Error(ye?.error||`Failed to create discount (${fe.status})`);rl()}catch(fe){const ye=fe instanceof Error?fe.message:"Failed to create discount";throw W(ye),s(ye),fe}}},bv=async re=>{if(an){W(null);try{const fe=await ue(`/api/v1/admin/discounts/${encodeURIComponent(re)}`,{method:"DELETE"}),ye=await fe.json().catch(()=>({}));if(!fe.ok)throw new Error(ye?.error||`Failed to delete discount (${fe.status})`);rl()}catch(fe){const ye=fe instanceof Error?fe.message:"Failed to delete discount";throw W(ye),s(ye),fe}}},cS=async(re,fe)=>{if(an)try{const ye=await ue(`/api/v1/admin/plans/${re}/sync_polar?reset_existing=${fe?.resetExisting?"1":"0"}`,{method:"POST"}),Ce=await ye.json().catch(()=>({}));if(!ye.ok)throw new Error(Ce?.error||`Failed to sync to Polar (${ye.status})`);rl()}catch(ye){const Ce=ye instanceof Error?ye.message:"Failed to sync to Polar";W(Ce),s(Ce)}},dS=async re=>{if(an)try{const fe=await ue(`/api/v1/admin/plans/${re}/archive_polar`,{method:"POST"}),ye=await fe.json().catch(()=>({}));if(!fe.ok)throw new Error(ye?.error||`Failed to archive in Polar (${fe.status})`);rl()}catch(fe){const ye=fe instanceof Error?fe.message:"Failed to archive in Polar";W(ye),s(ye)}},sm=async re=>{if(an)try{const fe=await ue(`/api/v1/admin/plans/${re}`,{method:"DELETE"}),ye=await fe.json().catch(()=>({}));if(!fe.ok)throw new Error(ye?.error||`Failed to delete plan (${fe.status})`);rl()}catch(fe){const ye=fe instanceof Error?fe.message:"Failed to delete plan";W(ye),s(ye)}},uS=async()=>
24541{if(an&&!jl){Vo(!0),So(null);try{let re={};try{const Tt=(Oo||"{}").replace(/,\s*([\]}])/g,"$1");if(re=JSON.parse(Tt),!re||typeof re!="object"||Array.isArray(re))throw new Error("Entitlements must be a JSON object")}catch(Tt){throw new Error(Tt instanceof Error?Tt.message:"Invalid entitlements JSON")}const fe={code:Ns,name:ds,active:Sl,trial_days:Zc,currency:Js,price_monthly_cents:oc,price_yearly_cents:sc,original_price_monthly_cents:Wp,original_price_yearly_cents:Vr,entitlements:JSON.stringify(re)},ye=ic?"/api/v1/admin/plans":`/api/v1/admin/plans/${rc?.id}`,et=await ue(ye,{method:ic?"POST":"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(fe)}),mt=await et.json().catch(()=>({}));if(!et.ok)throw new Error(mt?.error||"Failed to save plan");if(!(mt?.admin?.plan||null))throw new Error("Missing plan payload");a==="billing"&&c==="plans"&&rl(),Zs(!1)}catch(re){const fe=re instanceof Error?re.message:"Failed to save plan";So(fe),s(fe)}finally{Vo(!1)}}};l.useEffect(()=>{if(Se(null),De(null),ge(!1),Ee(null),yt(!1),Le(null),be(!1),ze(null),vt(null),Qt(!1),!y)return;let re=!1;return(async()=>{je(!0);try{const ye=await ue(`/api/v1/admin/subscriptions/${y}`,{method:"GET"}),Ce=await ye.json().catch(()=>({}));if(!ye.ok)throw new Error(Ce?.error||`Failed to load subscription (${ye.status})`);if(re)return;const et=Ce?.admin?.subscription||null;De(et)}catch(ye){if(re)return;Se(ye instanceof Error?ye.message:"Failed to load subscription")}finally{re||je(!1)}})(),()=>{re=!0}},[y]);const pS=async(re,fe)=>{if(an&&y&&!Xe){yt(!0),Le(null);try{const ye={billing_exempt:re};typeof fe?.trialDays=="number"&&(ye.trial_days=fe.trialDays),fe?.trialDays===null&&(ye.trial_days=null),typeof fe?.reason=="string"&&fe.reason.trim()&&(ye.reason=fe.reason.trim());const Ce=await ue(`/api/v1/admin/subscriptions/${y}/billing_exempt`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(ye)}),et=await Ce.json().catch(()=>({}));if(!Ce.ok)throw new Error(et?.error||`Failed to update exemption (${Ce.status})`);const mt=et?.admin?.subscription||null;mt&&De(mt),rl()}catch(ye){const Ce=ye instanceof Error?ye.message:"Failed to update exemption";Le(Ce),s(Ce)}finally{yt(!1)}}},mS=async()=>{if(y&&!pe&&!Wt){be(!0),ze(null);try{const re=await ue(`/api/v1/admin/subscriptions/${y}/usage_limits`,{method:"GET"}),fe=await re.json().catch(()=>({}));if(!re.ok)throw new Error(fe?.error||`Failed to load usage limits (${re.status})`);const ye=fe?.admin?.usage_limits||null;vt(ye),Qt(!0)}catch(re){ze(re instanceof Error?re.message:"Failed to load usage limits"),Qt(!1)}finally{be(!1)}}},R0=async re=>{if(an&&y&&!te){ge(!0),Ee(null);try{const fe=await ue(`/api/v1/admin/subscriptions/${y}/cancel`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({timing:re})}),ye=await fe.json().catch(()=>({}));if(!fe.ok)throw new Error(ye?.error||`Failed to cancel subscription (${fe.status})`);const Ce=ye?.admin?.subscription||null;Ce&&De(Ce),rl()}catch(fe){const ye=fe instanceof Error?fe.message:"Failed to cancel subscription";Ee(ye),s(ye)}finally{ge(!1)}}},hS=async()=>{if(an&&y&&!te){ge(!0),Ee(null);try{const re=await ue(`/api/v1/admin/subscriptions/${y}/uncancel`,{method:"POST"}),fe=await re.json().catch(()=>({}));if(!re.ok)throw new Error(fe?.error||`Failed to uncancel subscription (${re.status})`);const ye=fe?.admin?.subscription||null;ye&&De(ye),rl()}catch(re){const fe=re instanceof Error?re.message:"Failed to uncancel subscription";Ee(fe),s(fe)}finally{ge(!1)}}},vv=async(re,fe)=>{if(an&&y&&!Ue){We(!0),ht(null);try{const ye=await ue(`/api/v1/admin/subscriptions/${y}/grant_credits`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({amount:re,mode:fe})}),Ce=await ye.json().catch(()=>({}));if(!ye.ok)throw new Error(Ce?.error||`Failed to grant credits (${ye.status})`);const et=Ce?.admin?.subscription||null;et&&De(et),Qt(!1),rl()}catch(ye){const Ce=ye instanceof Error?ye.message:"Failed to grant credits";ht(Ce),s(Ce)}finally{We(!1)}}},fS=async re=>{if(an){gg(!0),gv(!0),T0(!1),E0(null),xg(null),yg("{}");try{const fe=await ue(`/api/v1/admin/subscriptions/${re}`,{method:"GET"}),ye=await fe.json().catch(()=>({}));if(!fe.ok)throw new Error(ye?.error||`Request failed (${fe.status})`);const Ce=ye?.admin?.subscription||null;if(!Ce)throw new Error("Missing subscription payload");xg(Ce),yg(JSON.stringify(Ce.entitlements?.override||{},null,2))}catch(fe){const ye=fe instanceof Error?fe.message:"Failed to load entitlements";E0(ye),s(ye)}finally{gv(!1)}}},gS=async()=>
24541{if(an&&om&&!hv){T0(!0),E0(null);try{let re=null;try{re=JSON.parse(sS||"{}")}catch{throw new Error("Overrides must be valid JSON.")}if(!re||typeof re!="object"||Array.isArray(re))throw new Error("Overrides must be a JSON object.");const fe=await ue(`/api/v1/admin/subscriptions/${om.id}/entitlements_override`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({entitlements_override:re})}),ye=await fe.json().catch(()=>({}));if(!fe.ok)throw new Error(ye?.error||"Failed to save overrides");const Ce=ye?.admin?.subscription||null;Ce&&(xg(Ce),yg(JSON.stringify(Ce.entitlements?.override||{},null,2))),gg(!1)}catch(re){const fe=re instanceof Error?re.message:"Failed to save overrides";E0(fe),s(fe)}finally{T0(!1)}}};l.useEffect(()=>{let re=!1;return(async()=>{if(a==="users"){if(!m){ea(null),gi(null),Ka(!1);return}Ka(!0),mo(!1),gi(null),ea(null),ta(""),Yo(!1),ed(null),$l([]),td({page:1,totalPages:1,total:0}),qd(!1);try{const ye=await ue(`/api/v1/admin/users/${m}`,{method:"GET"}),Ce=await ye.json().catch(()=>({}));if(!ye.ok)throw new Error(Ce?.error||`Request failed (${ye.status})`);if(re)return;const et=Ce?.admin?.user||null;if(!et)throw new Error("Missing user payload");ea(et),_a(et.first_name||""),Ca(et.last_name||""),zs(et.email||""),ps(!!et.deleted),na(String(et.admin_role||""))}catch(ye){if(re)return;gi(ye instanceof Error?ye.message:"Failed to load user")}finally{re||Ka(!1)}}})(),()=>{re=!0}},[a,m]);const XA=async()=>{if(Kn&&Or&&!Kr){mo(!0),gi(null);try{const re={first_name:Hd,last_name:kl,email:to,admin_role:lc};an&&(re.deleted=Du),Sa.trim().length>0&&(re.password=Sa);const fe=await ue(`/api/v1/admin/users/${Or.id}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(re)}),ye=await fe.json().catch(()=>({}));if(!fe.ok)throw new Error(ye?.error||"Failed to update user");const Ce=ye?.admin?.user||null;if(Ce){ea(Ce);const et=`${Ce.first_name||""} ${Ce.last_name||""}`.trim();le(mt=>mt.map(Te=>Te.id===Ce.id?{...Te,email:Ce.email,full_name:et.length>0?et:null,email_verified:!!Ce.email_verified,admin_role:Ce.admin_role||null}:Te))}}catch(re){const fe=re instanceof Error?re.message:"Failed to update user";gi(fe),s(fe)}finally{mo(!1)}}},wv=async re=>{if(Kn&&Or&&!(re!=="verify_email"&&re!=="complete_onboarding"&&re!=="reset_add_project_flow")&&!Kr){mo(!0),gi(null);try{const fe=await ue(`/api/v1/admin/users/${Or.id}/${re}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})}),ye=await fe.json().catch(()=>({}));if(!fe.ok)throw new Error(ye?.error||"Action failed");const Ce=ye?.admin?.user||null;if(Ce){ea(Ce),_a(Ce.first_name||""),Ca(Ce.last_name||""),zs(Ce.email||""),ps(!!Ce.deleted),na(String(Ce.admin_role||""));const et=`${Ce.first_name||""} ${Ce.last_name||""}`.trim();le(mt=>mt.map(Te=>Te.id===Ce.id?{...Te,email:Ce.email,full_name:et.length>0?et:null,email_verified:!!Ce.email_verified,admin_role:Ce.admin_role||null}:Te))}}catch(fe){const ye=fe instanceof Error?fe.message:"Action failed";gi(ye),s(ye)}finally{mo(!1)}}},ko=async()=>{if(an&&Or&&!Kr&&window.confirm(`Destroy user #${Or.id}? 24542 24543This schedules deletion via background job and cannot be undone.`)){mo(!0),gi(null);try{const re=await ue(`/api/v1/admin/users/${Or.id}`,{method:"DELETE"}),fe=await re.json().catch(()=>({}));if(!re.ok)throw new Error(fe?.error||"Failed to destroy user");le(ye=>ye.filter(Ce=>Ce.id!==Or.id)),o({resource:"users"},{replace:!0})}catch(re){const fe=re instanceof Error?re.message:"Failed to destroy user";gi(fe),s(fe)}finally{mo(!1)}}};l.useEffect(()=>{let re=!1;return(async()=>{if(a==="organizations"){if(!h){Ts(null),Cr(null),Qa(!1);return}Qa(!0),_r(!1),Cr(null),Ts(null),It(!1),ut(null),gt([]),yi(!1),Qn(null),ms(!1),Oe(null),Ye(null),ln(()=>{const ye=qs();return{start:hl(ye,-29),end:ye}}),In(!1),ai(null),ar([]),Xo({page:1,totalPages:1,total:0}),xr(!1),qp(""),Fu(""),BC("viewer");try{const ye=await ue(`/api/v1/admin/organizations/${h}`,{method:"GET"}),Ce=await ye.json().catch(()=>({}));if(!ye.ok)throw new Error(Ce?.error||`Request failed (${ye.status})`);if(re)return;const et=Ce?.admin?.organization||null;if(!et)throw new Error("Missing workspace payload");Ts(et),hh(et.name||""),dc(et.organization_type||""),$a(et.description||""),Za(!!et.deleted),Pl(et.projects_cadence||""),Ki(!!et.quick_scan_enabled),Pa(et.suggestion_generation_profile||"default_v1")}catch(ye){if(re)return;
24543const Ce=ye instanceof Error?ye.message:"Failed to load workspace";Cr(Ce)}finally{re||Qa(!1)}}})(),()=>{re=!0}},[a,h]);const gs=async()=>{if(Kn&&ti&&!ka){_r(!0),Cr(null);try{const re={name:cc,organization_type:Hp,description:Vd};an&&(re.deleted=Bu),an&&Il&&Il!=="mixed"&&(re.cadence=Il),an&&(re.quick_scan_enabled=Kd),an&&(re.suggestion_generation_profile=Ia);const fe=await ue(`/api/v1/admin/organizations/${ti.id}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(re)}),ye=await fe.json().catch(()=>({}));if(!fe.ok)throw new Error(ye?.error||"Failed to update workspace");const Ce=ye?.admin?.organization||null;Ce&&(Ts(Ce),Pl(Ce.projects_cadence||""),Ki(!!Ce.quick_scan_enabled),Pa(Ce.suggestion_generation_profile||"default_v1"),ee(et=>et.map(mt=>mt.id===Ce.id?{...mt,name:Ce.name,organization_type:Ce.organization_type,product_mode:Ce.product_mode,deleted:!!Ce.deleted}:mt)))}catch(re){const fe=re instanceof Error?re.message:"Failed to update workspace";Cr(fe),s(fe)}finally{_r(!1)}}},yS=async()=>{if(an&&ti&&!ka&&window.confirm(`Destroy workspace #${ti.id}? 24544 24545This schedules deletion via background job and cannot be undone.`)){_r(!0),Cr(null);try{const re=await ue(`/api/v1/admin/organizations/${ti.id}`,{method:"DELETE"}),fe=await re.json().catch(()=>({}));if(!re.ok)throw new Error(fe?.error||"Failed to destroy workspace");ee(ye=>ye.filter(Ce=>Ce.id!==ti.id)),o({resource:"organizations"},{replace:!0})}catch(re){const fe=re instanceof Error?re.message:"Failed to destroy workspace";Cr(fe),s(fe)}finally{_r(!1)}}},xS=async(re,fe,ye,Ce)=>{if(Kn)try{const et=await ue("/api/v1/admin/organizations",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:re,organization_type:fe,plan_code:ye,product_mode:Ce})}),mt=await et.json().catch(()=>({}));if(!et.ok)throw new Error(mt?.error||"Failed to create workspace");const Te=mt?.admin?.organization||null;if(!Te)throw new Error("Missing workspace payload");i(`Workspace "${Te.name}" created (#${Te.id}).`,{tone:"success"});const Tt={id:Te.id,name:Te.name,organization_type:Te.organization_type,product_mode:Te.product_mode,deleted:!!Te.deleted,billing_status:Te.billing_status,billing_exempt_reason:Te.billing_exempt_reason,plan_code:Te.plan_code,created_at:Te.created_at};ee(Rn=>[Tt,...Rn.filter(Ma=>Ma.id!==Te.id)].slice(0,_m)),se(Rn=>Rn&&{...Rn,total:Rn.total+1,total_pages:Math.max(Rn.total_pages,Math.ceil((Rn.total+1)/Rn.per_page))}),o({resource:"organizations",org_id:String(Te.id)},{replace:!0})}catch(et){const mt=et instanceof Error?et.message:"Failed to create workspace";throw s(mt),et}},bS=async re=>{if(Kn&&ti&&!ka){_r(!0),Cr(null);try{const fe={};re!=null&&(fe.trial_days=re);const ye=await ue(`/api/v1/admin/organizations/${ti.id}/handoff`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(fe)}),Ce=await ye.json().catch(()=>({}));if(!ye.ok)throw new Error(Ce?.error||"Failed to hand off workspace");i("Workspace handed off successfully.",{tone:"success"});const et=await ue(`/api/v1/admin/organizations/${ti.id}`,{method:"GET"}),mt=await et.json().catch(()=>({}));if(et.ok){const Te=mt?.admin?.organization||null;Te&&(Ts(Te),ee(Tt=>Tt.map(Rn=>Rn.id===Te.id?{...Rn,name:Te.name,billing_status:Te.billing_status}:Rn)))}}catch(fe){const ye=fe instanceof Error?fe.message:"Failed to hand off workspace";Cr(ye),s(ye)}finally{_r(!1)}}},vS=async()=>{if(Kn&&ti&&!ka&&window.confirm(`Delete sales-setup workspace "${ti.name||"(unnamed)"}" (#${ti.id})? 24546 24547This schedules deletion and cannot be undone.`)){_r(!0),Cr(null);try{const re=await ue(`/api/v1/admin/organizations/${ti.id}/sales_setup`,{method:"DELETE"}),fe=await re.json().catch(()=>({}));if(!re.ok)throw new Error(fe?.error||"Failed to delete workspace");i("Sales-setup workspace deleted.",{tone:"success"}),ee(ye=>ye.filter(Ce=>Ce.id!==ti.id)),o({resource:"organizations"},{replace:!0})}catch(re){const fe=re instanceof Error?re.message:"Failed to delete workspace";Cr(fe),s(fe)}finally{_r(!1)}}},Ph=async(re,fe)=>{if(!ti||Ja)return;const ye=++ft.current;Qn(re),ms(!0),Oe(null),Ye(null);try{const Ce=fe||Ot,et=new URLSearchParams({from:ite(Ce.start),to:rte(Ce.end)}),mt=await ue(`/api/v1/admin/organizations/${ti.id}/api_keys/${re.id}/usage?${et.toString()}`,{method:"GET"}),Te=await mt.json().catch(()=>({}));if(!mt.ok)throw new Error(Te?.error||`Failed to load usage (${mt.status})`);const Tt=Te?.admin?.usage||null;if(!Tt)throw new Error("Missing usage payload");if(ft.current!==ye)return;Ye(Tt)}catch(Ce){if(ft.current!==ye)return;Oe(Ce instanceof Error?Ce.message:"Failed to load usage")}finally{ft.current===ye&&ms(!1)}},wS=async(re,fe)=>{if(ti&&Kn&&!ka){_r(!0),Cr(null);try{const ye=await ue(`/api/v1/admin/organizations/${ti.id}/api_keys/${re.id}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({enabled:fe})}),Ce=await ye.json().catch(()=>({}));if(!ye.ok)throw new Error(Ce?.error||"Failed to update API key");const et=Ce?.admin?.api_keys||[],mt=Array.isArray(et)?et.map(Te=>({id:Number(Te?.id),name:String(Te?.name||""),last4:String(Te?.last4||""),enabled:!!Te?.enabled,partner_managed:!!Te?.partner_managed,created_at:String(Te?.created_at||""),last_used_at:Te?.last_used_at?String(Te.last_used_at):null})):[];gt(mt)}catch(ye){const Ce=ye instanceof Error?ye.message:"Failed to update API key";Cr(Ce),s(Ce)}finally{_r(!1)}}},O0=async re=>{if(!(!ti||!Kn||!window.confirm(`Delete API key "${re.name}"? This cannot be undone.`))&&!ka){_r(!0),Cr(null);try{const ye=await ue(`/api/v1/admin/organizations/${ti.id}/api_keys/${re.id}`,{method:"DELETE"}),Ce=await ye.json().catch(()=>({}));if(!ye.ok)throw new Error(Ce?.error||"Failed to delete API key");const et=Ce?.admin?.api_keys||[],mt=Array.isArray(et)?et.map(Te=>({id:Number(Te?.id),name:String(Te?.name||""),last4:String(Te?.last4||""),enabled:!!Te?.enabled,partner_managed:!!Te?.partner_managed,created_at:String(Te?.created_at||""),last_used_at:Te?.last_used_at?String(Te.last_used_at):null})):[];gt(mt),Jt?.id===re.id&&(Qn(null),Ye(null),Oe(null),ms(!1))}catch(ye){const Ce=ye instanceof Error?ye.message:"Failed to delete API key";Cr(Ce),s(Ce)}finally{_r(!1)}}},jS=async()=>
24547{if(!ti)return!1;It(!0),ut(null);try{const re=await ue(`/api/v1/admin/organizations/${ti.id}/api_keys`,{method:"GET"}),fe=await re.json().catch(()=>({}));if(!re.ok){if(re.status===403)return gt([]),ut("API keys are not enabled for this workspace."),!0;throw new Error(fe?.error||`Failed to load API keys (${re.status})`)}const ye=fe?.admin?.api_keys||[],Ce=Array.isArray(ye)?ye.map(et=>({id:Number(et?.id),name:String(et?.name||""),last4:String(et?.last4||""),enabled:!!et?.enabled,partner_managed:!!et?.partner_managed,created_at:String(et?.created_at||""),last_used_at:et?.last_used_at?String(et.last_used_at):null})):[];return gt(Ce),!0}catch(re){return ut(re instanceof Error?re.message:"Failed to load API keys"),!1}finally{It(!1)}},QA=async()=>{if(Ln||Aa)return;await jS()&&yi(!0)};l.useEffect(()=>{let re=!1;return(async()=>{if(a==="partners"){if(!x){hs(null),za(null),Qf(!1),tl(""),oa(""),Xp("0"),qu(""),no(!0),ri(null),fs(!1),Xu([]),Sr(null),Yu(!1),eg(!1),kr(null);return}Qf(!0),ia(!1),za(null),hs(null),tl(""),oa(""),Xp("0"),qu(""),no(!0),ri(null),fs(!1),Yu(!1),Sr(null),Xu([]),eg(!1),kr(null),Qu(""),Jp(null),ld(!1),yh(null),tm(null),tg(()=>{const ye=qs();return{start:hl(ye,-29),end:ye}});try{const ye=await ue(`/api/v1/admin/partners/${x}`,{method:"GET"}),Ce=await ye.json().catch(()=>({}));if(!ye.ok)throw new Error(Ce?.error||`Request failed (${ye.status})`);if(re)return;const et=Ce?.admin?.partner||null;if(!et)throw new Error("Missing partner payload");hs(et),tl(String(et.name||"")),oa(String(et.slug||"")),Xp(String(et.discount_percent??0)),qu(String(et.return_url||"")),no(!!et.active),ri(null),fs(!1)}catch(ye){if(re)return;const Ce=ye instanceof Error?ye.message:"Failed to load partner";za(Ce)}finally{re||Qf(!1)}}})(),()=>{re=!0}},[a,x]);const D0=async()=>{if(an&&ra&&!zl){ia(!0),za(null);try{const re=!!Ci||El,fe=await(async()=>{if(re){const mt=new FormData;return mt.append("name",Ta),mt.append("slug",Tl),mt.append("discount_percent",String(Number(uc||0))),mt.append("return_url",Zf||""),mt.append("active",e0?"true":"false"),El&&mt.append("remove_logo","true"),Ci&&mt.append("logo",Ci),ue(`/api/v1/admin/partners/${ra.id}`,{method:"PATCH",body:mt})}const et={name:Ta,slug:Tl,discount_percent:Number(uc||0),return_url:Zf||null,active:e0};return ue(`/api/v1/admin/partners/${ra.id}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(et)})})(),ye=await fe.json().catch(()=>({}));if(!fe.ok)throw new Error(ye?.error||"Failed to update partner");const Ce=ye?.admin?.partner||null;Ce&&(hs(Ce),tl(String(Ce.name||"")),oa(String(Ce.slug||"")),Xp(String(Ce.discount_percent??0)),qu(String(Ce.return_url||"")),no(!!Ce.active),ri(null),fs(!1),Re(et=>et.map(mt=>mt.id===Ce.id?{...mt,name:Ce.name,slug:Ce.slug,discount_percent:Number(Ce.discount_percent||0),active:!!Ce.active}:mt)))}catch(re){const fe=re instanceof Error?re.message:"Failed to update partner";za(fe),s(fe)}finally{ia(!1)}}},jv=async()=>{if(an&&ra&&!zl){ia(!0),za(null);try{const re=await ue(`/api/v1/admin/partners/${ra.id}`,{method:"DELETE"}),fe=await re.json().catch(()=>({}));if(!re.ok)throw new Error(fe?.error||"Failed to delete partner");const ye=ie.some(Ce=>Ce.id===ra.id);if(Re(Ce=>Ce.filter(et=>et.id!==ra.id)),ye&&oe){const Ce=Math.max(0,Number(oe.total||0)-1),et=Number(oe.per_page||_m)||_m,mt=Math.max(1,Math.ceil(Ce/et)),Te=Math.min(Q,mt);se(Tt=>Tt&&{...Tt,total:Ce,total_pages:mt,page:Te}),Te!==Q&&K(Te)}hs(null),Xu([]),eg(!1),Jp(null),tm(null),za(null),o({resource:"partners"},{replace:!0})}catch(re){const fe=re instanceof Error?re.message:"Failed to delete partner";za(fe),s(fe)}finally{ia(!1)}}},_v=async()=>{if(!x)return!1;Yu(!0),Sr(null);try{const re=await ue(`/api/v1/admin/partners/${x}/api_keys`,{method:"GET"}),fe=await re.json().catch(()=>({}));if(!re.ok)throw new Error(fe?.error||`Failed to load API keys (${re.status})`);const ye=fe?.admin?.api_keys||[],Ce=Array.isArray(ye)?ye.map(et=>({id:Number(et?.id),name:String(et?.name||""),last4:String(et?.last4||""),enabled:!!et?.enabled,created_at:String(et?.created_at||""),last_used_at:et?.last_used_at?String(et.last_used_at):null})):[];return Xu(Ce),!0}catch(re){return Sr(re instanceof Error?re.message:"Failed to load API keys"),!1}finally{Yu(!1)}},_S=async()=>
24547{if(UA||Qp)return;await _v()&&eg(!0)},CS=()=>{an&&(Yd(null),t0(""),n0(""),sd("0"),ad(""),r0(!0),Jf(!0))},Cv=async()=>{if(an&&!zl){ia(!0),Yd(null);try{const re={name:Vu,slug:gh,discount_percent:Number(Ku||0),return_url:Xd||null,active:i0},fe=await ue("/api/v1/admin/partners",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(re)}),ye=await fe.json().catch(()=>({}));if(!fe.ok)throw new Error(ye?.error||`Failed to create partner (${fe.status})`);const Ce=ye?.admin?.partner||null;if(!Ce)throw new Error("Missing partner payload");Jf(!1);const et={id:Number(Ce.id),name:String(Ce.name||""),slug:String(Ce.slug||""),discount_percent:Number(Ce.discount_percent||0),active:!!Ce.active,created_at:Ce.created_at?String(Ce.created_at):null};Re(mt=>[et,...mt.filter(Te=>Te.id!==et.id)]),se(mt=>{if(!mt)return mt;const Te=Number(mt.total||0)+1,Tt=Number(mt.per_page||_m)||_m;return{...mt,page:1,total:Te,total_pages:Math.max(1,Math.ceil(Te/Tt))}}),o({resource:"partners",partner_id:String(Ce.id)},{replace:!0}),j(""),K(1)}catch(re){const fe=re instanceof Error?re.message:"Failed to create partner";Yd(fe),s(fe)}finally{ia(!1)}}},Sv=async re=>{if(an&&x&&!zl){ia(!0),Sr(null),kr(null);try{const fe=String(re||"").trim(),ye=await ue(`/api/v1/admin/partners/${x}/api_keys`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:fe.length?fe:"Partner API key"})}),Ce=await ye.json().catch(()=>({}));if(!ye.ok)throw new Error(Ce?.error||`Failed to create API key (${ye.status})`);const et=Ce?.admin?.api_key||null,mt=Ce?.admin?.token||null;if(mt&&kr(mt),et?.id){const Te={id:Number(et.id),name:String(et.name||""),last4:String(et.last4||""),enabled:!!et.enabled,created_at:String(et.created_at||""),last_used_at:et.last_used_at?String(et.last_used_at):null};Xu(Tt=>[Te,...Tt]),Qu("")}else await _v()}catch(fe){const ye=fe instanceof Error?fe.message:"Failed to create API key";Sr(ye),s(ye)}finally{ia(!1)}}},kv=async re=>{if(!(!an||!x||!window.confirm(`Delete partner API key "${re.name}"? This cannot be undone.`))&&!zl){ia(!0),Sr(null);try{const ye=await ue(`/api/v1/admin/partners/${x}/api_keys/${re.id}`,{method:"DELETE"}),Ce=await ye.json().catch(()=>({}));if(!ye.ok)throw new Error(Ce?.error||"Failed to delete API key");Xu(et=>et.filter(mt=>mt.id!==re.id))}catch(ye){const Ce=ye instanceof Error?ye.message:"Failed to delete API key";Sr(Ce),s(Ce)}finally{ia(!1)}}},$v=async(re,fe)=>{if(!x||em)return;const ye=++pc.current;Jp(re),ld(!0),yh(null),tm(null);try{const Ce=fe||s0,et=new URLSearchParams({from:ite(Ce.start),to:rte(Ce.end)}),mt=await ue(`/api/v1/admin/partners/${x}/api_keys/${re.id}/usage?${et.toString()}`,{method:"GET"}),Te=await mt.json().catch(()=>({}));if(!mt.ok)throw new Error(Te?.error||`Failed to load usage (${mt.status})`);const Tt=Te?.admin?.usage||null;if(!Tt)throw new Error("Missing usage payload");if(pc.current!==ye)return;tm(Tt)}catch(Ce){if(pc.current!==ye)return;yh(Ce instanceof Error?Ce.message:"Failed to load usage")}finally{pc.current===ye&&ld(!1)}};l.useEffect(()=>{let re=!1;return(async()=>{if(a==="projects"){if(!g){Vp(null),hi(null),qf(!1);return}qf(!0),Di(!1),hi(null),Vp(null),Ju(!1),xh(null),l0([]),ep(null),Z1({page:1,totalPages:1,total:0}),nm(!1),tp(!1),np(null),mc([]),hc({page:1,totalPages:1,total:0}),rg(!1),cd(null),p0(null),bh(!1),wh(!1),rp(null),jh([]),_h({page:1,totalPages:1,total:0}),sa(!1),f0(""),aa(""),ag("viewer"),Xn(!1),ro(null),op([]),Ch({page:1,totalPages:1,total:0}),Jd(!1),Dr(!1),cg(null),y0([]),dg({page:1,totalPages:1,total:0}),ug(!1),Xr(!1),im(null),Sh([]),rm({page:1,totalPages:1,total:0}),pg(!1),v0(!1),w0(null),kh([]),hg({page:1,totalPages:1,total:0}),$h(!1),j0(!1),_0(null),av(null),lv(!1),C0(!1),S0(null),fg([]),I0({page:1,totalPages:1,total:0}),cv(!1),P0(!1),A0(null),pv([]),z0({page:1,totalPages:1,total:0}),mv(!1),G1("{}");try{const ye=await ue(`/api/v1/admin/projects/${g}`,{method:"GET"}),Ce=await ye.json().catch(()=>({}));if(!ye.ok)throw new Error(Ce?.error||`Request failed (${ye.status})`);if(re)return;const et=Ce?.admin?.project||null;if(!et)throw new Error("Missing project payload");Vp(et),Wu(et.name||""),B1(et.website||""),WC(et.city||""),HC(et.country||""),U1(et.language||""),Al(et.focus||""),el(et.description||""),Xy(et.country_code||""),Kf(et.cadence||"daily"),Uu(et.custom_identifier||""),Yf(!!et.local_mode),qC(et.local_context||{}),Zy(et.suggested_prompts_generated_at||""),q1(et.deleted_at||""),Hu(Array.isArray(et.brand_aliases)?et.brand_aliases.join(` 24548`):"")}catch(ye){if(re)return;hi(ye instanceof Error?ye.message:"Failed to load project")}finally{re||qf(!1)}}})(),()=>{re=!0}},[a,g]);const Iv=async()=>
24548{if(!(!Kn||!vn)){Di(!0);try{const re=await ue(`/api/v1/admin/projects/${vn.id}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({re_resolve_local_context:!0})}),fe=await re.json().catch(()=>({}));if(!re.ok)throw new Error(fe?.error||"Failed to trigger re-resolve");i("Local context re-resolution triggered.",{tone:"success"})}catch(re){i(re?.message||"Failed to trigger re-resolve.",{tone:"error"})}finally{Di(!1)}}},L0=async()=>{if(Kn&&vn&&!Do){Di(!0),hi(null);try{const re={name:D1,website:L1,city:F1,country:UC,language:W1,focus:Yy,description:Gf,country_code:Kp,suggested_prompts_generated_at:Na,deleted_at:od,custom_identifier:Qy,local_mode:H1,local_context:Yp,brand_aliases:Xf,site_audit:Jy};an&&(re.cadence=Vf);const fe=await ue(`/api/v1/admin/projects/${vn.id}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(re)}),ye=await fe.json().catch(()=>({}));if(!fe.ok)throw new Error(ye?.error||"Failed to update project");const Ce=ye?.admin?.project||null;Ce&&(Vp(Ce),Ae(et=>et.map(mt=>mt.id===Ce.id?{...mt,name:Ce.name,website:Ce.website,country_code:Ce.country_code,cadence:Ce.cadence,deleted:!!Ce.deleted_at,deleted_at:Ce.deleted_at}:mt)))}catch(re){const fe=re instanceof Error?re.message:"Failed to update project";hi(fe),s(fe)}finally{Di(!1)}}},Pv=async()=>{if(an&&vn&&!Do&&window.confirm(`Destroy project #${vn.id}? 24549 24550This schedules deletion via background job and cannot be undone.`)){Di(!0),hi(null);try{const re=await ue(`/api/v1/admin/projects/${vn.id}`,{method:"DELETE"}),fe=await re.json().catch(()=>({}));if(!re.ok)throw new Error(fe?.error||"Failed to destroy project");Ae(ye=>ye.filter(Ce=>Ce.id!==vn.id)),o({resource:"projects"},{replace:!0})}catch(re){const fe=re instanceof Error?re.message:"Failed to destroy project";hi(fe),s(fe)}finally{Di(!1)}}},SS=async()=>{if(an&&vn&&!Do&&window.confirm(`Remove GA connection for project #${vn.id}? 24551 24552This deletes the stored tokens and all synced metrics.`)){Di(!0),hi(null);try{const re=await ue(`/api/v1/admin/projects/${vn.id}/ga_disconnect`,{method:"DELETE"}),fe=await re.json().catch(()=>({}));if(!re.ok)throw new Error(fe?.error||"Failed to disconnect GA");Vp({...vn,google_analytics:null})}catch(re){const fe=re instanceof Error?re.message:"Failed to disconnect GA";hi(fe)}finally{Di(!1)}}},Av=async()=>{if(an&&vn&&!Do&&window.confirm(`Trigger a full 180-day resync for project #${vn.id}?`)){Di(!0),hi(null);try{const re=await ue(`/api/v1/admin/projects/${vn.id}/ga_resync`,{method:"POST"}),fe=await re.json().catch(()=>({}));if(!re.ok)throw new Error(fe?.error||"Failed to enqueue resync");hi(null)}catch(re){const fe=re instanceof Error?re.message:"Failed to enqueue resync";hi(fe)}finally{Di(!1)}}},kS=async re=>{if(vn){ep(re),tp(!0),np(null),mc([]),hc({page:1,totalPages:1,total:0});try{const fe=await ue(`/api/v1/admin/projects/${vn.id}/chat_sessions/${re}/messages?page=1&per_page=50`,{method:"GET"}),ye=await fe.json().catch(()=>({}));if(!fe.ok)throw new Error(ye?.error||`Failed to load messages (${fe.status})`);const Ce=ye?.admin?.chat_messages||[],et=Array.isArray(Ce)?Ce.map(Te=>({id:Number(Te?.id),chat_session_id:Number(Te?.chat_session_id),role:String(Te?.role||""),status:String(Te?.status||""),model_key:Te?.model_key?String(Te.model_key):null,content:String(Te?.content||""),metadata:Te?.metadata&&typeof Te.metadata=="object"?Te.metadata:{},created_at:Te?.created_at?String(Te.created_at):null,updated_at:Te?.updated_at?String(Te.updated_at):null})):[];mc(et);const mt=ye?.admin?.pagination;mt&&typeof mt=="object"&&hc({page:Number(mt?.page||1),totalPages:Number(mt?.total_pages||1),total:Number(mt?.total||0)})}catch(fe){np(fe instanceof Error?fe.message:"Failed to load messages")}finally{tp(!1)}}},eu=async(re,fe)=>{if(Kn&&vn&&!Do){Di(!0),hi(null);try{const ye=await ue(`/api/v1/admin/projects/${vn.id}/chat_sessions/${re}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(fe)}),Ce=await ye.json().catch(()=>({}));if(!ye.ok)throw new Error(Ce?.error||"Failed to update chat session");const et=Ce?.admin?.chat_session||null;et&&l0(mt=>mt.map(Te=>Te.id===re?{...Te,title:String(et.title||""),deleted_at:et.deleted_at?String(et.deleted_at):null,updated_at:et.updated_at?String(et.updated_at):Te.updated_at}:Te))}catch(ye){hi(ye instanceof Error?ye.message:"Failed to update chat session")}finally{Di(!1)}}},Nv=async(re,fe,ye)=>{if(Kn&&vn&&!Do){Di(!0),hi(null);try{const Ce=await ue(`/api/v1/admin/projects/${vn.id}/chat_sessions/${re}/messages/${fe}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(ye)}),et=await Ce.json().catch(()=>({}));if(!Ce.ok)throw new Error(et?.error||"Failed to update chat message");const mt=et?.admin?.chat_message||null;mt&&mc(Te=>Te.map(Tt=>Tt.id===fe?{...Tt,status:String(mt.status||Tt.status),model_key:mt.model_key?String(mt.model_key):null,content:String(mt.content||Tt.content),metadata:mt.metadata&&typeof mt.metadata=="object"?mt.metadata:Tt.metadata,updated_at:mt.updated_at?String(mt.updated_at):Tt.updated_at}:Tt))}catch(Ce){hi(Ce instanceof Error?Ce.message:"Failed to update chat message")}finally{Di(!1)}}},zv=async re=>{if(vn){Ju(!0),xh(null);try{const fe=await ue(`/api/v1/admin/projects/${vn.id}/chat_sessions?page=${re}&per_page=25`,{method:"GET"}),ye=await fe.json().catch(()=>({}));if(!fe.ok)throw new Error(ye?.error||`Failed to load chat sessions (${fe.status})`);const Ce=ye?.admin?.chat_sessions||[],et=Array.isArray(Ce)?Ce.map(Te=>({id:Number(Te?.id),project_id:Number(Te?.project_id),user_id:Number(Te?.user_id),title:String(Te?.title||""),deleted_at:Te?.deleted_at?String(Te.deleted_at):null,messages_count:Number(Te?.messages_count||0),created_at:Te?.created_at?String(Te.created_at):null,updated_at:Te?.updated_at?String(Te.updated_at):null})):[];l0(et);const mt=ye?.admin?.pagination;return mt&&typeof mt=="object"&&Z1({page:Number(mt?.page||1),totalPages:Number(mt?.total_pages||1),total:Number(mt?.total||0)}),!0}catch(fe){return xh(fe instanceof Error?fe.message:"Failed to load chat sessions"),!1}finally{Ju(!1)}}},Tv=async re=>{if(vn&&c0){tp(!0),np(null);try{const fe=await ue(`/api/v1/admin/projects/${vn.id}/chat_sessions/${c0}/messages?page=${re}&per_page=50`,{method:"GET"}),ye=await fe.json().catch(()=>({}));if(!fe.ok)throw new Error(ye?.error||`Failed to load messages (${fe.status})`);const Ce=ye?.admin?.chat_messages||[],et=Array.isArray(Ce)?Ce.map(Te=>({id:Number(Te?.id),chat_session_id:Number(Te?.chat_session_id),role:String(Te?.role||""),status:String(Te?.status||""),model_key:Te?.model_key?String(Te.model_key):null,content:String(Te?.content||""),metadata:Te?.metadata&&typeof Te.metadata=="object"?Te.metadata:{},created_at:Te?.created_at?String(Te.created_at):null,updated_at:Te?.updated_at?String(Te.updated_at):null})):[];mc(et);const mt=ye?.admin?.pagination;mt&&typeof mt=="object"&&hc({page:Number(mt?.page||1),totalPages:Number(mt?.total_pages||1),total:Number(mt?.total||0)})}catch(fe){np(fe instanceof Error?fe.message:"Failed to load messages")}finally{tp(!1)}}},tu=async()=>
24552{if(VC||X1)return;await zv(1)&&nm(!0)},Ev=async()=>{if(vn&&!J1&&!u0){rg(!0),cd(null);try{const re=await ue(`/api/v1/admin/projects/${vn.id}/site_audit_summary`,{method:"GET"}),fe=await re.json().catch(()=>({}));if(!re.ok)throw new Error(fe?.error||`Failed to load site audit summary (${re.status})`);const ye=fe?.admin?.site_audit_summary||null;if(!ye)throw new Error("Missing site audit summary payload");p0(ye),bh(!0)}catch(re){cd(re instanceof Error?re.message:"Failed to load site audit summary")}finally{rg(!1)}}},B0=async re=>{if(!ti)return!1;const fe=++Yr.current;In(!0),ai(null);try{const ye=await ue(`/api/v1/admin/organizations/${ti.id}/users?page=${re}&per_page=25`,{method:"GET"}),Ce=await ye.json().catch(()=>({}));if(!ye.ok)throw new Error(Ce?.error||`Failed to load users (${ye.status})`);if(fe!==Yr.current)return!1;const et=Ce?.admin?.organization_users||[],mt=Array.isArray(et)?et.map(Tt=>({user_id:Number(Tt?.user_id),email:String(Tt?.email||""),full_name:Tt?.full_name?String(Tt.full_name):null,role:String(Tt?.role||"viewer")||"viewer",created_at:Tt?.created_at?String(Tt.created_at):null})):[];ar(mt);const Te=Ce?.admin?.pagination;return Te&&typeof Te=="object"&&Xo({page:Number(Te?.page||1),totalPages:Number(Te?.total_pages||1),total:Number(Te?.total||0)}),!0}catch(ye){return fe!==Yr.current||ai(ye instanceof Error?ye.message:"Failed to load users"),!1}finally{fe===Yr.current&&In(!1)}},F0=async()=>{if(rd||on)return;await B0(1)&&xr(!0)},vg=async()=>{if(ti&&Kn&&!ka){_r(!0),Cr(null);try{const re={role:Ky};Gp.trim().length?re.user_id=Number(Gp):re.email=Vy.trim();const fe=await ue(`/api/v1/admin/organizations/${ti.id}/users`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(re)}),ye=await fe.json().catch(()=>({}));if(!fe.ok)throw new Error(ye?.error||"Failed to add user");Yr.current+=1;const Ce=ye?.admin?.organization_users||[],et=Array.isArray(Ce)?Ce.map(Te=>({user_id:Number(Te?.user_id),email:String(Te?.email||""),full_name:Te?.full_name?String(Te.full_name):null,role:String(Te?.role||"viewer")||"viewer",created_at:Te?.created_at?String(Te.created_at):null})):[];ar(et);const mt=ye?.admin?.pagination;mt&&typeof mt=="object"&&Xo({page:Number(mt?.page||1),totalPages:Number(mt?.total_pages||1),total:Number(mt?.total||0)}),xr(!0),In(!1),qp(""),Fu("")}catch(re){const fe=re instanceof Error?re.message:"Failed to add user";Cr(fe),s(fe)}finally{_r(!1)}}},$r=async(re,fe)=>{if(ti&&Kn&&!ka){_r(!0),Cr(null);try{const ye=await ue(`/api/v1/admin/organizations/${ti.id}/users/${re}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({role:fe})}),Ce=await ye.json().catch(()=>({}));if(!ye.ok)throw new Error(Ce?.error||"Failed to update role");const et=Ce?.admin?.organization_users||[],mt=Array.isArray(et)?et.map(Te=>({user_id:Number(Te?.user_id),email:String(Te?.email||""),full_name:Te?.full_name?String(Te.full_name):null,role:String(Te?.role||"viewer")||"viewer",created_at:Te?.created_at?String(Te.created_at):null})):[];ar(mt)}catch(ye){const Ce=ye instanceof Error?ye.message:"Failed to update role";Cr(Ce),s(Ce)}finally{_r(!1)}}},ZA=async(re,fe)=>{if(!(!ti||!Kn||!window.confirm(`Remove ${fe} from this workspace?`))&&!ka){_r(!0),Cr(null);try{const Ce=await ue(`/api/v1/admin/organizations/${ti.id}/users/${re}`,{method:"DELETE"}),et=await Ce.json().catch(()=>({}));if(!Ce.ok)throw new Error(et?.error||"Failed to remove user");Yr.current+=1;const mt=et?.admin?.organization_users||[],Te=Array.isArray(mt)?mt.map(Rn=>({user_id:Number(Rn?.user_id),email:String(Rn?.email||""),full_name:Rn?.full_name?String(Rn.full_name):null,role:String(Rn?.role||"viewer")||"viewer",created_at:Rn?.created_at?String(Rn.created_at):null})):[];ar(Te);const Tt=et?.admin?.pagination;Tt&&typeof Tt=="object"&&Xo({page:Number(Tt?.page||1),totalPages:Number(Tt?.total_pages||1),total:Number(Tt?.total||0)}),xr(!0),In(!1)}catch(Ce){const et=Ce instanceof Error?Ce.message:"Failed to remove user";Cr(et),s(et)}finally{_r(!1)}}},Mv=async re=>{if(!vn)return!1;const fe=++il.current;wh(!0),rp(null);try{const ye=await ue(`/api/v1/admin/projects/${vn.id}/users?page=${re}&per_page=25`,{method:"GET"}),Ce=await ye.json().catch(()=>({}));if(!ye.ok)throw new Error(Ce?.error||`Failed to load users (${ye.status})`);
24552if(fe!==il.current)return!1;const et=Ce?.admin?.project_users||[],mt=Array.isArray(et)?et.map(Tt=>({user_id:Number(Tt?.user_id),email:String(Tt?.email||""),full_name:Tt?.full_name?String(Tt.full_name):null,role:String(Tt?.role||"viewer")||"viewer",created_at:Tt?.created_at?String(Tt.created_at):null})):[];jh(mt);const Te=Ce?.admin?.pagination;return Te&&typeof Te=="object"&&_h({page:Number(Te?.page||1),totalPages:Number(Te?.total_pages||1),total:Number(Te?.total||0)}),!0}catch(ye){return fe!==il.current||rp(ye instanceof Error?ye.message:"Failed to load users"),!1}finally{fe===il.current&&wh(!1)}},$S=async()=>{if(nl||vh)return;await Mv(1)&&sa(!0)},wg=async()=>{if(vn&&Kn&&!Do){Di(!0),hi(null);try{const re={role:io};dd.trim().length?re.user_id=Number(dd):re.email=h0.trim();const fe=await ue(`/api/v1/admin/projects/${vn.id}/users`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(re)}),ye=await fe.json().catch(()=>({}));if(!fe.ok)throw new Error(ye?.error||"Failed to add user");il.current+=1;const Ce=ye?.admin?.project_users||[],et=Array.isArray(Ce)?Ce.map(Te=>({user_id:Number(Te?.user_id),email:String(Te?.email||""),full_name:Te?.full_name?String(Te.full_name):null,role:String(Te?.role||"viewer")||"viewer",created_at:Te?.created_at?String(Te.created_at):null})):[];jh(et);const mt=ye?.admin?.pagination;mt&&typeof mt=="object"&&_h({page:Number(mt?.page||1),totalPages:Number(mt?.total_pages||1),total:Number(mt?.total||0)}),sa(!0),wh(!1),f0(""),aa("")}catch(re){hi(re instanceof Error?re.message:"Failed to add user")}finally{Di(!1)}}},sp=async(re,fe)=>{if(vn&&Kn&&!Do){Di(!0),hi(null);try{const ye=await ue(`/api/v1/admin/projects/${vn.id}/users/${re}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({role:fe})}),Ce=await ye.json().catch(()=>({}));if(!ye.ok)throw new Error(Ce?.error||"Failed to update role");const et=Ce?.admin?.project_users||[],mt=Array.isArray(et)?et.map(Te=>({user_id:Number(Te?.user_id),email:String(Te?.email||""),full_name:Te?.full_name?String(Te.full_name):null,role:String(Te?.role||"viewer")||"viewer",created_at:Te?.created_at?String(Te.created_at):null})):[];jh(mt)}catch(ye){hi(ye instanceof Error?ye.message:"Failed to update role")}finally{Di(!1)}}},IS=async(re,fe)=>{if(!(!vn||!Kn||!window.confirm(`Remove ${fe} from this project?`))&&!Do){Di(!0),hi(null);try{const Ce=await ue(`/api/v1/admin/projects/${vn.id}/users/${re}`,{method:"DELETE"}),et=await Ce.json().catch(()=>({}));if(!Ce.ok)throw new Error(et?.error||"Failed to remove user");il.current+=1;const mt=et?.admin?.project_users||[],Te=Array.isArray(mt)?mt.map(Rn=>({user_id:Number(Rn?.user_id),email:String(Rn?.email||""),full_name:Rn?.full_name?String(Rn.full_name):null,role:String(Rn?.role||"viewer")||"viewer",created_at:Rn?.created_at?String(Rn.created_at):null})):[];jh(Te);const Tt=et?.admin?.pagination;Tt&&typeof Tt=="object"&&_h({page:Number(Tt?.page||1),totalPages:Number(Tt?.total_pages||1),total:Number(Tt?.total||0)}),sa(!0),wh(!1)}catch(Ce){hi(Ce instanceof Error?Ce.message:"Failed to remove user")}finally{Di(!1)}}},W0=async re=>{if(!vn)return!1;Xn(!0),ro(null);try{const fe=await ue(`/api/v1/admin/projects/${vn.id}/fanout_queries?page=${re}&per_page=25`,{method:"GET"}),ye=await fe.json().catch(()=>({}));if(!fe.ok)throw new Error(ye?.error||`Failed to load fanout queries (${fe.status})`);const Ce=ye?.admin?.fanout_queries||[],et=Array.isArray(Ce)?Ce.map(Te=>({id:Number(Te?.id),prompt_id:Number(Te?.prompt_id),topic_id:Number(Te?.topic_id),topic_name:Te?.topic_name?String(Te.topic_name):null,prompt_content:String(Te?.prompt_content||""),model_key:String(Te?.model_key||""),queries_count:Number(Te?.queries_count||0),fetched_at:Te?.fetched_at?String(Te.fetched_at):null,created_at:Te?.created_at?String(Te.created_at):null})):[];op(et);const mt=ye?.admin?.pagination;return mt&&typeof mt=="object"&&Ch({page:Number(mt?.page||1),totalPages:Number(mt?.total_pages||1),total:Number(mt?.total||0)}),!0}catch(fe){return ro(fe instanceof Error?fe.message:"Failed to load fanout queries"),!1}finally{Xn(!1)}},jg=async()=>
24552{if(lg||ud)return;await W0(1)&&Jd(!0)},pd=async re=>{if(!(!vn||!Kn||!window.confirm("Delete this fanout query record? This cannot be undone."))&&!Do){Di(!0),hi(null);try{const ye=await ue(`/api/v1/admin/projects/${vn.id}/fanout_queries/${re}`,{method:"DELETE"}),Ce=await ye.json().catch(()=>({}));if(!ye.ok)throw new Error(Ce?.error||"Failed to delete fanout query");const et=Ce?.admin?.fanout_queries||[],mt=Array.isArray(et)?et.map(Tt=>({id:Number(Tt?.id),prompt_id:Number(Tt?.prompt_id),topic_id:Number(Tt?.topic_id),topic_name:Tt?.topic_name?String(Tt.topic_name):null,prompt_content:String(Tt?.prompt_content||""),model_key:String(Tt?.model_key||""),queries_count:Number(Tt?.queries_count||0),fetched_at:Tt?.fetched_at?String(Tt.fetched_at):null,created_at:Tt?.created_at?String(Tt.created_at):null})):[];op(mt);const Te=Ce?.admin?.pagination;Te&&typeof Te=="object"&&Ch({page:Number(Te?.page||1),totalPages:Number(Te?.total_pages||1),total:Number(Te?.total||0)})}catch(ye){hi(ye instanceof Error?ye.message:"Failed to delete fanout query")}finally{Di(!1)}}},U0=async re=>{if(!vn)return!1;Dr(!0),cg(null);try{const fe=await ue(`/api/v1/admin/projects/${vn.id}/suggested_prompts?page=${re}&per_page=25`,{method:"GET"}),ye=await fe.json().catch(()=>({}));if(!fe.ok)throw new Error(ye?.error||`Failed to load suggested prompts (${fe.status})`);const Ce=ye?.admin?.suggested_prompts||[],et=Array.isArray(Ce)?Ce.map(Te=>({id:Number(Te?.id),topic_id:Number(Te?.topic_id),topic_name:Te?.topic_name?String(Te.topic_name):null,content:String(Te?.content||""),status:String(Te?.status||""),category:Te?.category?String(Te.category):null,created_at:Te?.created_at?String(Te.created_at):null})):[];y0(et);const mt=ye?.admin?.pagination;return mt&&typeof mt=="object"&&dg({page:Number(mt?.page||1),totalPages:Number(mt?.total_pages||1),total:Number(mt?.total||0)}),!0}catch(fe){return cg(fe instanceof Error?fe.message:"Failed to load suggested prompts"),!1}finally{Dr(!1)}},Rv=async()=>{if(nv||XC)return;await U0(1)&&ug(!0)},PS=async re=>{if(!(!vn||!Kn||!window.confirm("Delete this suggested prompt? This cannot be undone."))&&!Do){Di(!0),hi(null);try{const ye=await ue(`/api/v1/admin/projects/${vn.id}/suggested_prompts/${re}`,{method:"DELETE"}),Ce=await ye.json().catch(()=>({}));if(!ye.ok)throw new Error(Ce?.error||"Failed to delete suggested prompt");const et=Ce?.admin?.suggested_prompts||[],mt=Array.isArray(et)?et.map(Tt=>({id:Number(Tt?.id),topic_id:Number(Tt?.topic_id),topic_name:Tt?.topic_name?String(Tt.topic_name):null,content:String(Tt?.content||""),status:String(Tt?.status||""),category:Tt?.category?String(Tt.category):null,created_at:Tt?.created_at?String(Tt.created_at):null})):[];y0(mt);const Te=Ce?.admin?.pagination;Te&&typeof Te=="object"&&dg({page:Number(Te?.page||1),totalPages:Number(Te?.total_pages||1),total:Number(Te?.total||0)})}catch(ye){hi(ye instanceof Error?ye.message:"Failed to delete suggested prompt")}finally{Di(!1)}}},Ov=async()=>{await Promise.all([jg(),Rv()])},_g=async re=>{if(!vn)return!1;Xr(!0),im(null);try{const fe=await ue(`/api/v1/admin/projects/${vn.id}/topics?page=${re}&per_page=25`,{method:"GET"}),ye=await fe.json().catch(()=>({}));if(!fe.ok)throw new Error(ye?.error||`Failed to load topics (${fe.status})`);const Ce=ye?.admin?.topics||[],et=Array.isArray(Ce)?Ce.map(Te=>({id:Number(Te?.id),name:String(Te?.name||""),prompts_count:Number(Te?.prompts_count||0),suggested_prompts_count:Number(Te?.suggested_prompts_count||0),created_at:Te?.created_at?String(Te.created_at):null})):[];Sh(et);const mt=ye?.admin?.pagination;return mt&&typeof mt=="object"&&rm({page:Number(mt?.page||1),totalPages:Number(mt?.total_pages||1),total:Number(mt?.total||0)}),!0}catch(fe){return im(fe instanceof Error?fe.message:"Failed to load topics"),!1}finally{Xr(!1)}},H0=async()=>{if(iv||Es)return;await _g(1)&&pg(!0)},AS=async re=>{if(!(!vn||!Kn||!window.confirm("Delete this topic? This will also delete its prompts and suggested prompts."))&&!Do){Di(!0),hi(null),Sh(ye=>ye.filter(Ce=>Ce.id!==re)),kh(ye=>ye.filter(Ce=>Ce.topic_id!==re));try{const ye=await ue(`/api/v1/admin/projects/${vn.id}/topics/${re}`,{method:"DELETE"}),Ce=await ye.json().catch(()=>({}));if(!ye.ok)throw new Error(Ce?.error||"Failed to delete topic");const et=Ce?.admin?.topics||null;if(Array.isArray(et)){const mt=et.map(Tt=>({id:Number(Tt?.id),name:String(Tt?.name||""),prompts_count:Number(Tt?.prompts_count||0),suggested_prompts_count:Number(Tt?.suggested_prompts_count||0),created_at:Tt?.created_at?String(Tt.created_at):null}));Sh(mt);const Te=Ce?.admin?.pagination;Te&&typeof Te=="object"&&rm({page:Number(Te?.page||1),totalPages:Number(Te?.total_pages||1),total:Number(Te?.total||0)})}else rm(mt=>({...mt,total:Math.max(0,Number(mt.total||0)-1)}));$h(!1),ug(!1),Jd(!1)}catch(ye){hi(ye instanceof Error?ye.message:"Failed to delete topic"),pg(!1),$h(!1)}finally{Di(!1)}}},gc=async re=>{if(!vn)return!1;v0(!0),w0(null);try{const fe=await ue(`/api/v1/admin/projects/${vn.id}/prompts?page=${re}&per_page=25`,{method:"GET"}),ye=await fe.json().catch(()=>({}));if(!fe.ok)throw new Error(ye?.error||`Failed to load prompts (${fe.status})`);const Ce=ye?.admin?.prompts||[],et=Array.isArray(Ce)?Ce.map(Te=>
24552({id:Number(Te?.id),topic_id:Number(Te?.topic_id),topic_name:Te?.topic_name?String(Te.topic_name):null,content:String(Te?.content||""),category:Te?.category?String(Te.category):null,archived_at:Te?.archived_at?String(Te.archived_at):null,created_at:Te?.created_at?String(Te.created_at):null})):[];kh(et);const mt=ye?.admin?.pagination;return mt&&typeof mt=="object"&&hg({page:Number(mt?.page||1),totalPages:Number(mt?.total_pages||1),total:Number(mt?.total||0)}),!0}catch(fe){return w0(fe instanceof Error?fe.message:"Failed to load prompts"),!1}finally{v0(!1)}},$o=async()=>{if(VA||rv)return;await gc(1)&&$h(!0)},Dv=async re=>{if(!(!vn||!Kn||!window.confirm("Delete this prompt? This cannot be undone."))&&!Do){Di(!0),hi(null),kh(ye=>ye.filter(Ce=>Ce.id!==re));try{const ye=await ue(`/api/v1/admin/projects/${vn.id}/prompts/${re}`,{method:"DELETE"}),Ce=await ye.json().catch(()=>({}));if(!ye.ok)throw new Error(Ce?.error||"Failed to delete prompt");const et=Ce?.admin?.prompts||null;if(Array.isArray(et)){const mt=et.map(Tt=>({id:Number(Tt?.id),topic_id:Number(Tt?.topic_id),topic_name:Tt?.topic_name?String(Tt.topic_name):null,content:String(Tt?.content||""),category:Tt?.category?String(Tt.category):null,archived_at:Tt?.archived_at?String(Tt.archived_at):null,created_at:Tt?.created_at?String(Tt.created_at):null}));kh(mt);const Te=Ce?.admin?.pagination;Te&&typeof Te=="object"&&hg({page:Number(Te?.page||1),totalPages:Number(Te?.total_pages||1),total:Number(Te?.total||0)})}else hg(mt=>({...mt,total:Math.max(0,Number(mt.total||0)-1)}));Jd(!1)}catch(ye){hi(ye instanceof Error?ye.message:"Failed to delete prompt"),$h(!1)}finally{Di(!1)}}},NS=async()=>{await Promise.all([H0(),$o()])},Qo=async()=>{if(vn&&!tS&&!ov){j0(!0),_0(null);try{const re=await ue(`/api/v1/admin/projects/${vn.id}/project_actions_summary`,{method:"GET"}),fe=await re.json().catch(()=>({}));if(!re.ok)throw new Error(fe?.error||`Failed to load project actions summary (${re.status})`);const ye=fe?.admin?.project_actions_summary||null;if(!ye)throw new Error("Missing project actions summary payload");av(ye),lv(!0)}catch(re){_0(re instanceof Error?re.message:"Failed to load project actions summary")}
24552finally{j0(!1)}}},Lv=async re=>{if(!Or)return!1;Yo(!0),ed(null);try{const fe=await ue(`/api/v1/admin/users/${Or.id}/refresh_tokens?page=${re}&per_page=25`,{method:"GET"}),ye=await fe.json().catch(()=>({}));if(!fe.ok)throw new Error(ye?.error||`Failed to load refresh tokens (${fe.status})`);const Ce=ye?.admin?.refresh_tokens||[],et=Array.isArray(Ce)?Ce.map(Te=>({id:Number(Te?.id),last4:String(Te?.last4||""),created_at:Te?.created_at?String(Te.created_at):null,last_used_at:Te?.last_used_at?String(Te.last_used_at):null,expires_at:Te?.expires_at?String(Te.expires_at):null,revoked_at:Te?.revoked_at?String(Te.revoked_at):null,ip:Te?.ip?String(Te.ip):null,geo_country:Te?.geo_country?String(Te.geo_country):null})):[];$l(et);const mt=ye?.admin?.pagination;return mt&&typeof mt=="object"&&td({page:Number(mt?.page||1),totalPages:Number(mt?.total_pages||1),total:Number(mt?.total||0)}),!0}catch(fe){return ed(fe instanceof Error?fe.message:"Failed to load refresh tokens"),!1}finally{Yo(!1)}},zS=async()=>{if(nd||Ya)return;await Lv(1)&&qd(!0)},TS=async re=>{if(!(!Or||!Kn||!window.confirm("Delete this refresh token (log out that session)?"))&&!Kr){mo(!0),gi(null);try{const ye=await ue(`/api/v1/admin/users/${Or.id}/refresh_tokens/${re}`,{method:"DELETE"}),Ce=await ye.json().catch(()=>({}));if(!ye.ok)throw new Error(Ce?.error||"Failed to delete refresh token");const et=Ce?.admin?.refresh_tokens||[],mt=Array.isArray(et)?et.map(Tt=>({id:Number(Tt?.id),last4:String(Tt?.last4||""),created_at:Tt?.created_at?String(Tt.created_at):null,last_used_at:Tt?.last_used_at?String(Tt.last_used_at):null,expires_at:Tt?.expires_at?String(Tt.expires_at):null,revoked_at:Tt?.revoked_at?String(Tt.revoked_at):null,ip:Tt?.ip?String(Tt.ip):null,geo_country:Tt?.geo_country?String(Tt.geo_country):null})):[];$l(mt);const Te=Ce?.admin?.pagination;Te&&typeof Te=="object"&&td({page:Number(Te?.page||1),totalPages:Number(Te?.total_pages||1),total:Number(Te?.total||0)})}catch(ye){gi(ye instanceof Error?ye.message:"Failed to delete refresh token")}finally{mo(!1)}}},br=async re=>{if(!vn)return!1;C0(!0),S0(null);try{const fe=await ue(`/api/v1/admin/projects/${vn.id}/project_competitors?page=${re}&per_page=25`,{method:"GET"}),ye=await fe.json().catch(()=>({}));if(!fe.ok)throw new Error(ye?.error||`Failed to load competitors (${fe.status})`);const Ce=ye?.admin?.project_competitors||[],et=Array.isArray(Ce)?Ce.map(Te=>({id:Number(Te?.id),competitor_id:Number(Te?.competitor_id),name:Te?.name?String(Te.name):null,website:Te?.website?String(Te.website):null,competitor_type:String(Te?.competitor_type||""),visibility_score:typeof Te?.visibility_score=="number"||Te?.visibility_score?Number(Te.visibility_score):null,aliases_count:Number(Te?.aliases_count||0),created_at:Te?.created_at?String(Te.created_at):null})):[];fg(et);const mt=ye?.admin?.pagination;return mt&&typeof mt=="object"&&I0({page:Number(mt?.page||1),totalPages:Number(mt?.total_pages||1),total:Number(mt?.total||0)}),!0}catch(fe){return S0(fe instanceof Error?fe.message:"Failed to load competitors"),!1}finally{C0(!1)}},Ea=async()=>{if(KA||nS)return;await br(1)&&cv(!0)},yc=async re=>{if(!vn)return!1;P0(!0),A0(null);try{const fe=await ue(`/api/v1/admin/projects/${vn.id}/project_citations?page=${re}&per_page=25`,{method:"GET"}),ye=await fe.json().catch(()=>({}));if(!fe.ok)throw new Error(ye?.error||`Failed to load citations (${fe.status})`);const Ce=ye?.admin?.project_citations||[],et=Array.isArray(Ce)?Ce.map(Te=>({id:Number(Te?.id),domain_host:Te?.domain_host?String(Te.domain_host):null,title:Te?.title?String(Te.title):null,url:String(Te?.url||""),created_at:Te?.created_at?String(Te.created_at):null})):[];pv(et);const mt=ye?.admin?.pagination;return mt&&typeof mt=="object"&&z0({page:Number(mt?.page||1),totalPages:Number(mt?.total_pages||1),total:Number(mt?.total||0)}),!0}catch(fe){return A0(fe instanceof Error?fe.message:"Failed to load citations"),!1}finally{P0(!1)}},ES=async()=>{if(rS||dv)return;await yc(1)&&mv(!0)},MS=async()=>{await Promise.all([Ea(),ES()])};return t.jsxs(ZAt,{children:[t.jsxs(JAt,{children:[t.jsxs(eNt,{children:[t.jsxs(tNt,{children:[t.jsx(Yl,{size:18}),t.jsx("span",{children:"Admin"})]}),t.jsx(nNt,{children:"Browse workspace data."}),t.jsx(CAt,{resource:a,canSeeBilling:Ga}),a==="billing"?t.jsx($At,{isFullAdmin:an}):null,a==="growth"?t.jsx(AAt,{}):null]}),t.jsxs(iNt,{children:[q?t.jsx("div",{style:{marginBottom:"0.75rem",color:z,fontSize:"0.875rem",fontWeight:650},children:q}):null,t.jsx("div",{style:{flex:1,minHeight:0,display:"flex",flexDirection:"column"},children:G&&(a==="competitors"||a==="citations"||a==="keyword_volumes"||a==="billing"&&(c==="plans"||c==="discounts"))?t.jsx($p,{minWidth:"56rem",columns:[{},{},{},{}],rows:8}):a==="users"?(()=>{const re=!!Or?.partner_managed&&!an,fe=Kn&&!re,ye=an;return t.jsx(bNt,{users:de,meta:ho,selectedUserId:m,listLoading:G,searchQuery:w,setSearchQuery:j,isFullAdmin:an,usersAdminsOnly:$,setUsersAdminsOnly:k,onPrev:()=>K(Ce=>Math.max(1,Ce-1)),onNext:()=>K(Ce=>Math.min(ho.totalPages,Ce+1)),canEdit:fe,canDelete:ye,lockedByPartner:re,detailLoa
24552ding:Va,detailSaving:Kr,detailError:ja,detail:Or,firstName:Hd,setFirstName:_a,lastName:kl,setLastName:Ca,email:to,setEmail:zs,password:Sa,setPassword:ta,deleted:Du,setDeleted:ps,adminRole:lc,setAdminRole:na,onSave:XA,onAction:wv,onDestroy:ko,onBack:()=>{o({resource:"users"},{replace:!0})},refreshTokens:Xa,refreshTokensLoading:Ya,refreshTokensError:Up,refreshTokensMeta:Lu,onRefreshTokensPrev:()=>Lv(Lu.page-1),onRefreshTokensNext:()=>Lv(Lu.page+1),onRefreshTokensOpen:zS,onDestroyRefreshToken:TS})})():a==="organizations"?t.jsx(INt,{orgs:me,meta:ho,selectedOrgId:h,listLoading:G,searchQuery:w,setSearchQuery:j,isFullAdmin:an,orgsDeletedOnly:P,setOrgsDeletedOnly:S,orgsOnboardingOnly:I,setOrgsOnboardingOnly:A,orgsSalesOnly:E,setOrgsSalesOnly:B,onPrev:()=>K(re=>Math.max(1,re-1)),onNext:()=>K(re=>Math.min(ho.totalPages,re+1)),canEdit:Kn,canDelete:an,detailLoading:id,detailSaving:ka,detailError:Gd,detail:ti,name:cc,setName:hh,orgType:Hp,setOrgType:dc,description:Vd,setDescription:$a,deleted:Bu,setDeleted:Za,cadence:Il,setCadence:Pl,quickScanEnabled:Kd,setQuickScanEnabled:Ki,suggestionGenerationProfile:Ia,setSuggestionGenerationProfile:Pa,onSave:gs,onDestroy:yS,onCreateWorkspace:xS,onHandoff:bS,onDeleteSalesSetup:vS,onBack:()=>{o({resource:"organizations"},{replace:!0})},users:Yi,usersLoading:on,usersError:xi,usersMeta:Pi,onUsersPrev:()=>B0(Pi.page-1),onUsersNext:()=>B0(Pi.page+1),onUsersOpen:F0,addUserEmail:Vy,setAddUserEmail:qp,addUserId:Gp,setAddUserId:Fu,addUserRole:Ky,setAddUserRole:BC,onAddUser:vg,onUpdateUserRole:$r,onRemoveUser:ZA,apiKeysLoading:Aa,apiKeysError:Dt,apiKeys:Lt,usageTarget:Jt,usageLoading:Ja,usageError:xe,usage:He,onLoadUsage:re=>{if(Jt?.id===re.id){ft.current+=1,Qn(null),Ye(null),Oe(null),ms(!1);return}Ph(re)},usageRange:Ot,onUsageRangeChange:re=>{ln(re),Jt&&Ph(Jt,re)},onToggleEnabled:wS,onDeleteKey:O0,onApiKeysOpen:QA}):a==="projects"?t.jsx(ENt,{projects:ne,meta:ho,selectedProjectId:g,activePromptsTotal:_e,runnablePromptsTotal:Ke,listLoading:G,searchQuery:w,setSearchQuery:j,onPrev:()=>K(re=>Math.max(1,re-1)),onNext:()=>K(re=>Math.min(ho.totalPages,re+1)),canEdit:Kn,canEditCadence:an,canDestroy:an,detailLoading:fh,detailSaving:Do,detailError:FC,detail:vn,name:D1,setName:Wu,website:L1,setWebsite:B1,city:F1,setCity:WC,country:UC,setCountry:HC,language:W1,setLanguage:U1,focus:Yy,setFocus:Al,description:Gf,setDescription:el,countryCode:Kp,setCountryCode:Xy,cadence:Vf,setCadence:Kf,customIdentifier:Qy,setCustomIdentifier:Uu,localMode:H1,setLocalMode:Yf,suggestedAt:Na,setSuggestedAt:Zy,deletedAt:od,setDeletedAt:q1,brandAliases:Xf,setBrandAliases:Hu,onSave:L0,onDestroy:Pv,onBack:()=>o({resource:"projects"},{replace:!0}),onGaDisconnect:an?SS:void 0,onGaResync:an?Av:void 0,localContext:Yp,setLocalContext:qC,onReResolveLocalContext:Kn?Iv:void 0,extraPanelsProps:{key:`project-panels-${String(g)}`,canEdit:Kn,saving:Do,detail:vn,chatSessions:a0,chatSessionsLoading:X1,chatSessionsError:Q1,selectedChatSessionId:c0,onSelectChatSession:kS,chatMessages:KC,chatMessagesLoading:ng,chatMessagesError:ig,onUpdateChatSession:eu,onUpdateChatMessage:Nv,chatSessionsMeta:Qd,onChatSessionsPrev:()=>zv(Qd.page-1),onChatSessionsNext:()=>zv(Qd.page+1),chatMessagesMeta:d0,onChatMessagesPrev:()=>Tv(d0.page-1),onChatMessagesNext:()=>Tv(d0.page+1),onChatsOpen:tu,siteAuditSummary:og,siteAuditSummaryLoading:u0,siteAuditSummaryError:ip,siteAuditDraft:Jy,setSiteAuditDraft:G1,onSiteAuditOpen:Ev,users:m0,usersLoading:vh,usersError:YC,usersMeta:sg,onUsersPrev:()=>Mv(sg.page-1),onUsersNext:()=>Mv(sg.page+1),onUsersOpen:$S,addUserEmail:h0,setAddUserEmail:f0,addUserId:dd,setAddUserId:aa,addUserRole:io,setAddUserRole:ag,onAddUser:wg,onUpdateUserRole:sp,onRemoveUser:IS,fanoutQueries:g0,fanoutQueriesLoading:ud,fanoutQueriesError:Xi,fanoutQueriesMeta:Zd,onFanoutQueriesPrev:()=>W0(Zd.page-1),onFanoutQueriesNext:()=>W0(Zd.page+1),onDestroyFanoutQuery:pd,suggestedPrompts:QC,suggestedPromptsLoading:XC,suggestedPromptsError:ev,suggestedPromptsMeta:tv,onSuggestedPromptsPrev:()=>U0(tv.page-1),onSuggestedPromptsNext:()=>U0(tv.page+1),onDestroySuggestedPrompt:PS,onFanoutAndSuggestedOpen:Ov,topics:b0,topicsLoading:Es,topicsError:x0,topicsMeta:fc,onTo
24552picsPrev:()=>_g(fc.page-1),onTopicsNext:()=>_g(fc.page+1),onDestroyTopic:AS,prompts:JC,promptsLoading:rv,promptsError:ZC,promptsMeta:mg,onPromptsPrev:()=>gc(mg.page-1),onPromptsNext:()=>gc(mg.page+1),onDestroyPrompt:Dv,onTopicsAndPromptsOpen:NS,projectActionsInfo:eS,projectActionsInfoLoading:ov,projectActionsInfoError:sv,onProjectActionsInfoOpen:Qo,projectCompetitors:k0,projectCompetitorsLoading:nS,projectCompetitorsError:Ih,projectCompetitorsMeta:$0,onProjectCompetitorsPrev:()=>br($0.page-1),onProjectCompetitorsNext:()=>br($0.page+1),projectCitations:uv,projectCitationsLoading:dv,projectCitationsError:iS,projectCitationsMeta:N0,onProjectCitationsPrev:()=>yc(N0.page-1),onProjectCitationsNext:()=>yc(N0.page+1),onProjectCompetitorsAndCitationsOpen:MS}}):a==="partners"?t.jsx(DNt,{partners:ie,meta:ho,selectedPartnerId:x,listLoading:G,searchQuery:w,setSearchQuery:j,onPrev:()=>K(re=>Math.max(1,re-1)),onNext:()=>K(re=>Math.min(ho.totalPages,re+1)),isFullAdmin:an,saving:zl,error:Nl,onOpenCreate:CS,detailLoading:V1,detail:ra,onBack:()=>o({resource:"partners"},{replace:!0}),name:Ta,setName:tl,slug:Tl,setSlug:oa,discountPercent:uc,setDiscountPercent:Xp,returnUrl:Zf,setReturnUrl:qu,active:e0,setActive:no,logoPreviewUrl:K1,logoHasLogo:!!((ra?.logo_url||Ci)&&!El),onPickLogoFile:re=>{ri(re),fs(!1)},onRemoveLogo:()=>{ri(null),fs(!0)},onSave:D0,onDelete:jv,apiKeysLoading:Qp,apiKeysError:Zp,apiKeys:o0,usageTarget:Zu,usageLoading:em,usageError:qA,usage:GA,usageRange:s0,onUsageRangeChange:re=>{tg(re),Zu&&$v(Zu,re)},onLoadUsage:re=>{if(Zu?.id===re.id){pc.current+=1,Jp(null),tm(null),yh(null),ld(!1);return}$v(re)},newKeyName:Y1,setNewKeyName:Qu,createdToken:HA,onClearCreatedToken:()=>kr(null),onCreateKey:Sv,onDeleteKey:kv,onApiKeysOpen:_S}):a==="competitors"?t.jsx(RAt,{competitors:Yt,insights:tn,meta:ho,onPrev:()=>K(re=>Math.max(1,re-1)),onNext:()=>K(re=>Math.min(ho.totalPages,re+1))}):a==="citations"?t.jsx(DAt,{citations:xn,insights:Ct,meta:ho,onPrev:()=>K(re=>Math.max(1,re-1)),onNext:()=>K(re=>Math.min(ho.totalPages,re+1))}):a==="keyword_volumes"?t.jsx(LAt,{rows:ae,insights:Ge,meta:ho,onPrev:()=>K(re=>Math.max(1,re-1)),onNext:()=>K(re=>Math.min(ho.totalPages,re+1))}):a==="growth"?t.jsx(QNt,{sub:u}):a==="billing"?c==="overview"?t.jsx(qAt,{loading:Ii,error:di,overview:Gr}):c==="plans"?t.jsx(BAt,{plans:ke,meta:ho,canEdit:an,polarMeta:Kt,onRefresh:rl,onSeedBaseline:lS,onCreate:bg,onEdit:yv,onSyncPolar:cS,onArchivePolar:dS,onDelete:sm,onPrev:()=>K(re=>Math.max(1,re-1)),onNext:()=>K(re=>Math.min(ho.totalPages,re+1))}):c==="discounts"?t.jsx(WAt,{discounts:pt,meta:ho,canEdit:an,polarProducts:qe,polarProductsLoading:Mn,polarProductsError:dn,onCreate:xv,onDelete:bv,onPrev:()=>K(re=>Math.max(1,re-1)),onNext:()=>K(re=>Math.min(ho.totalPages,re+1))}):t.jsxs(mNt,{children:[t.jsx(hNt,{children:t.jsx(NAt,{subs:Be,meta:ho,selectedSubId:y,listLoading:G,controls:t.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center",flexWrap:"wrap"},children:[t.jsx(Ed,{value:w,onChange:j,placeholder:"Search subscriptions by workspaceâ¦",containerStyle:{flex:1,minWidth:200}}),t.jsx(_b,{label:"Status",value:T,onChange:M,options:[{key:"active",label:"active"},{key:"paying",label:"paying"},{key:"trialing",label:"trialing"},{key:"pending",label:"pending"},{key:"past_due",label:"past_due"},{key:"canceled",label:"canceled"},{key:"exempted",label:"exempted"}]}),t.jsx(_b,{label:"Plan",value:R,onChange:F,options:Y.map(re=>({key:re.code,label:re.name}))}),an?t.jsxs(t.Fragment,{children:[t.jsx(vf,{label:"Deleted only",active:U,onClick:()=>X(re=>!re),title:"Only subscriptions for deleted workspaces"}),t.jsx(ote,{label:"Actions",icon:t.jsx(eh,{size:14}),items:[{key:"backfill_first_paid",label:"Backfill first payment dates"},{key:"backfill_ga_events",label:"Backfill GA4 conversion events (180d)"}],onSelect:async re=>{if(re==="backfill_first_paid"){if(!window.confirm("This will query Polar for every subscription to backfill first_paid_at. Continue?"))return;try{const fe=await ue("/api/v1/admin/subscriptions/backfill_first_paid",{method:"POST"});if(!fe.ok){const ye=await fe.json().catch(()=>({}));throw new Error(ye?.error||"Failed")}i("Backfill job enqueued. Payment dates will populate shortly.",{tone:"success"})}catch(fe){s(fe?.message||"Backfill failed")}}else if(re==="backfill_ga_events"){if(!window.confirm("This will run a full 180-day GA4 sync for every connected project to populate per-event conversion metrics. Continue?"))return;try{const fe=await ue("/api/v1/admin/subscriptions/backfill_ga_events",{method:"POST"});if(!fe.ok){const ye=await fe.json().catch(()=>({}));throw new Error(ye?.error||"Failed")}i("GA4 events backfill enqueued. Full sync staggered across all connected projects.",{tone:"success"})}catch(fe){s(fe?.message||"Backfill failed")}}}})]}):null,t.jsx(ote,{label:"Download",icon:t.jsx(wy,{size:14}),items:[{key:"first_payments_csv",label:"First payment dates (CSV)"}],onSelect:async re=>{if(re==="first_payments_csv")try{const fe=await ue("/api/v1/admin/subscriptions/first_payments_csv");if(!fe.ok){const mt=await fe.json().catch(()=>({}));throw new Error(mt?.error||"Download failed")}const ye=await fe.blob(),Ce=URL.createObjectURL(ye),et=document.createElement("a");et.href=Ce,et.download=`first_payments_${new Date().toISOString().slice(0,10)}.csv`,document.body.appendChild(et),et.click(),et.remove(),URL.revokeObjectURL(Ce),i("CSV downloaded.",{tone:"success"})}catch(fe){s(fe?.message||"Download failed")}}})]}),onPrev:()=>K(re=>Math.max(1,re-1)),onNext:()=>K(re=>Math.min(ho.totalPages,re+1))})}),t.jsx(fNt,{children:y?t.jsxs("div",{style:{display:"grid",gap:12},children:[t.jsx(zAt,{canEdit:an,loading:dt,error:Me,detail:it,cancelLoading:te,cancelError:Je,exemptLoading:Xe,exemptError:Ne,grantCreditsLoading:Ue,grantCreditsError:Qe,onSetBillingExempt:pS,onCancel:R0,onUncancel:hS,onOpenEntitlements:fS,onGrantCredits:vv,onBack:()=>{o({resource:"billing",sub:"subscriptions"},{replace:!0})}},`sub-${y}`),it?t.jsxs(t.Fragment,{children:[t.jsx(TAt,{detail:it},`sub-ent-${it.id}`),t.jsx(EAt,{loading:pe,error:rt,usageLimits:lt,onOpen:mS},`sub-usage-${it.id}`)]}):null]}):t.jsx("div",{style:{padding:16,color:z,fontWeight:650},children:"Select a subscription from the list to view details."})})]}):t.jsx("div",{style:{padding:16,color:z,fontWeight:650},children:"Select a resource."})})]})]}),t.jsx(GAt,{open:YA,saving:hv,loading:fv,error:oS,detail:om,draft:sS,setDraft:yg,onClose:()=>gg(!1),onSave:gS}),t.jsx(VAt,{open:Qc,saving:jl,error:Ro,canEdit:an,isNew:ic,plan:rc,code:Ns,setCode:Ti,name:ds,setName:Cl,active:Sl,setActive:Ko,trialDays:Zc,setTrialDays:us,currency:Js,setCurrency:Fp,priceMonthlyCents:oc,setPriceMonthlyCents:va,priceYearlyCents:sc,setPriceYearlyCents:wa,originalPriceMonthlyCents:Wp,setOriginalPriceMonthlyCents:ac,originalPriceYearlyCents:Vr,setOriginalPriceYearlyCents:Jc,entitlementsDraft:Oo,setEntitlementsDraft:qa,onClose:()=>Zs(!1),onSave:uS}),t.jsx(KAt,{open:Gu,saving:zl,error:GC,canEdit:an,name:Vu,setName:t0,slug:gh,setSlug:n0,discountPercent:Ku,setDiscountPercent:sd,returnUrl:Xd,setReturnUrl:ad,active:i0,setActive:r0,onClose:()=>Jf(!1),onSave:Cv})]})}const lpe=[{value:"admin:read",label:"All read access"},{value:"health:read",label:"Health"},{value:"workspaces:read",label:"Workspaces"},{value:"projects:read",label:"Projects"},{value:"users:read",label:"Users"},{value:"billing:read",label:"Billing"},{value:"growth:read",label:"Growth"},{value:"runs:read",label:"Runs"}],cpe=Tn` 24553 from { opacity: 0; transform: translateY(6px); } 24554 to { opacity: 1; transform: translateY(0); } 24555`,izt=Tn` 24556 from { transform: rotate(0deg); } 24557 to { transform: rotate(360deg); } 24558`,rzt=p.div.withConfig({displayName:"AdminApiKeys__Wrap",componentId:"sc-9rprl8-0"})` 24559 min-height: 100%; 24560 padding: 1.25rem 1.25rem 2rem; 24561 background: ${At}; 24562`,ozt=p.div.withConfig({displayName:"AdminApiKeys__Max",componentId:"sc-9rprl8-1"})` 24563 max-width: 72rem; 24564 margin: 0 auto; 24565`,szt=p.div.withConfig({displayName:"AdminApiKeys__Hero",componentId:"sc-9rprl8-2"})` 24566 display: flex; 24567 align-items: flex-start; 24568 justify-content: space-between; 24569 gap: 1rem; 24570 padding: 1.25rem; 24571 border: 1px solid ${Rt}; 24572 border-radius: 1rem; 24573 background: ${Z}; 24574 box-shadow: 0 16px 40px rgba(17, 24, 39, 0.08); 24575 animation: ${cpe} 180ms ease both; 24576 24577 @media (max-width: 760px) { 24578 flex-direction: column; 24579 } 24580`,azt=p.div.withConfig({displayName:"AdminApiKeys__TitleRow",componentId:"sc-9rprl8-3"})` 24581 display: inline-flex; 24582 align-items: center; 24583 gap: 0.625rem; 24584 color: ${O}; 24585 font-size: 1.125rem; 24586 font-weight: 850; 24587`,ste=p.div.withConfig({displayName:"AdminApiKeys__Sub",componentId:"sc-9rprl8-4"})` 24588 margin-top: 0.5rem; 24589 color: ${z}; 24590 font-size: 0.875rem; 24591 line-height: 1.45; 24592`,ate=p.div.withConfig({displayName:"AdminApiKeys__Panel",componentId:"sc-9rprl8-5"})` 24593 margin-top: 1rem; 24594 padding: 1rem; 24595 border: 1px solid ${Rt}; 24596 border-radius: 1rem; 24597 background: ${Z}; 24598 box-shadow: 0 10px 24px rgba(17, 24, 39, 0.06); 24599 animation: ${cpe} 180ms ease both; 24600`,lte=p.div.withConfig({displayName:"AdminApiKeys__PanelTop",componentId:"sc-9rprl8-6"})` 24601 display: flex; 24602 align-items: flex-start; 24603 justify-content: space-between; 24604 gap: 1rem; 24605 24606 @media (max-width: 760px) { 24607 flex-direction: column; 24608 } 24609`,cte=p.div.withConfig({displayName:"AdminApiKeys__PanelTitle",componentId:"sc-9rprl8-7"})` 24610 display: inline-flex; 24611 align-items: center; 24612 gap: 0.5rem; 24613 color: ${O}; 24614 font-size: 0.95rem; 24615 font-weight: 850; 24616`,dte=p.div.withConfig({displayName:"AdminApiKeys__PanelSub",componentId:"sc-9rprl8-8"})` 24617 margin-top: 0.35rem; 24618 color: ${z}; 24619 font-size: 0.875rem; 24620 line-height: 1.45; 24621`,lzt=p.div.withConfig({displayName:"AdminApiKeys__CreateRow",componentId:"sc-9rprl8-9"})` 24622 display: grid; 24623 grid-template-columns: minmax(14rem, 1fr) auto; 24624 gap: 0.5rem; 24625 align-items: center; 24626 24627 @media (max-width: 620px) { 24628 grid-template-columns: 1fr; 24629 } 24630`,czt=p.div.withConfig({displayName:"AdminApiKeys__CreateBox",componentId:"sc-9rprl8-10"})` 24631 display: grid; 24632 gap: 0.7rem; 24633 min-width: min(100%, 34rem); 24634 padding: 0.85rem; 24635 border: 1px solid ${V}; 24636 border-radius: 0.875rem; 24637 background: ${At}; 24638 24639 @media (max-width: 760px) { 24640 width: 100%; 24641 } 24642`,ute=p.div.withConfig({displayName:"AdminApiKeys__CreateLabel",componentId:"sc-9rprl8-11"})` 24643 color: ${z}; 24644 font-size: 0.72rem; 24645 font-weight: 850; 24646 letter-spacing: 0.04em; 24647 text-transform: uppercase; 24648`,pte=p.div.withConfig({displayName:"AdminApiKeys__CreateField",componentId:"sc-9rprl8-12"})` 24649 display: grid; 24650 gap: 0.4rem; 24651`,dzt=p.div.withConfig({displayName:"AdminApiKeys__ScopeGrid",componentId:"sc-9rprl8-13"})` 24652 display: flex; 24653 gap: 0.4rem; 24654 flex-wrap: wrap; 24655`,uzt=p.label.withConfig({displayName:"AdminApiKeys__ScopeOption",componentId:"sc-9rprl8-14"})` 24656 display: inline-flex; 24657 align-items: center; 24658 gap: 0.35rem; 24659 padding: 0.28rem 0.5rem; 24660 border: 1px solid ${V}; 24661 border-radius: 999px; 24662 background: ${Z}; 24663 color: ${O}; 24664 font-size: 0.74rem; 24665 font-weight: 800; 24666 cursor: pointer; 24667 24668 input { 24669 width: 0.85rem; 24670 height: 0.85rem; 24671 margin: 0; 24672 } 24673`,pzt=p.div.withConfig({displayName:"AdminApiKeys__ScopePills",componentId:"sc-9rprl8-15"})` 24674 display: flex; 24675 gap: 0.35rem; 24676 flex-wrap: wrap; 24677 margin-top: 0.45rem; 24678`,mzt=p.div.withConfig({displayName:"AdminApiKeys__TableWrap",componentId:"sc-9rprl8-16"})` 24679 margin-top: 1rem; 24680 border: 1px solid ${V}; 24681 border-radius: 0.875rem; 24682 overflow-x: auto; 24683`,hzt=p.table.withConfig({displayName:"AdminApiKeys__Table",componentId:"sc-9rprl8-17"})` 24684 width: 100%; 24685 min-width: 62rem; 24686 border-collapse: collapse; 24687`,tf=p.th.withConfig({displayName:"AdminApiKeys__TH",componentId:"sc-9rprl8-18"})` 24688 padding: 0.7rem 0.8rem; 24689 background: ${$e}; 24690 color: ${z}; 24691 font-size: 0.72rem; 24692 font-weight: 850; 24693 text-align: left; 24694 text-transform: uppercase; 24695 letter-spacing: 0.04em; 24696`,nf=p.td.withConfig({displayName:"AdminApiKeys__TD",componentId:"sc-9rprl8-19"})` 24697 padding: 0.75rem 0.8rem; 24698 border-top: 1px solid ${V}; 24699 color: ${O}; 24700 font-size: 0.84rem; 24701 vertical-align: top; 24702`,rf=p.span.withConfig({displayName:"AdminApiKeys__Muted",componentId:"sc-9rprl8-20"})` 24703 color: ${z}; 24704 font-weight: 700; 24705`,SE=p.span.withConfig({displayName:"AdminApiKeys__Mono",componentId:"sc-9rprl8-21"})` 24706 font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace; 24707`,mte=p.span.withConfig({displayName:"AdminApiKeys__Pill",componentId:"sc-9rprl8-22"})` 24708 display: inline-flex; 24709 align-items: center; 24710 width: fit-content; 24711 padding: 0.22rem 0.5rem; 24712 border-radius: 999px; 24713 border: 1px solid ${V}; 24714 font-size: 0.72rem; 24715 font-weight: 850; 24716 24717 ${e=>e.$tone==="ok"?` 24718 color: ${Vt}; 24719 background: ${si}; 24720 border-color: ${Mo}; 24721 `:e.$tone==="danger"?` 24722 color: ${oi}; 24723 background: ${kn}; 24724 border-color: ${Er}; 24725 `:` 24726 color: ${z}; 24727 background: ${At}; 24728 border-color: ${V}; 24729 `} 24730`,of=p.div.withConfig({displayName:"AdminApiKeys__Notice",componentId:"sc-9rprl8-23"})` 24731 margin-top: 0.75rem; 24732 padding: 0.75rem; 24733 border-radius: 0.875rem; 24734 border: 1px solid ${e=>e.$tone==="error"?Er:e.$tone==="success"?Mo:V}; 24735 background: ${e=>
24735e.$tone==="error"?kn:e.$tone==="success"?si:At}; 24736 color: ${e=>e.$tone==="error"?oi:O}; 24737 font-size: 0.875rem; 24738 font-weight: 700; 24739`,fzt=p.div.withConfig({displayName:"AdminApiKeys__TokenBox",componentId:"sc-9rprl8-24"})` 24740 margin-top: 0.85rem; 24741 padding: 0.9rem; 24742 border: 1px dashed ${Mo}; 24743 border-radius: 0.875rem; 24744 background: ${si}; 24745`,gzt=p.div.withConfig({displayName:"AdminApiKeys__TokenActions",componentId:"sc-9rprl8-25"})` 24746 display: flex; 24747 gap: 0.5rem; 24748 align-items: center; 24749 flex-wrap: wrap; 24750`,yzt=p(Tr).withConfig({displayName:"AdminApiKeys__Spinner",componentId:"sc-9rprl8-26"})` 24751 animation: ${izt} 900ms linear infinite; 24752`,xzt=p.div.withConfig({displayName:"AdminApiKeys__UsageGrid",componentId:"sc-9rprl8-27"})` 24753 display: grid; 24754 grid-template-columns: minmax(0, 1fr) minmax(18rem, 24rem); 24755 gap: 1rem; 24756 margin-top: 1rem; 24757 24758 @media (max-width: 980px) { 24759 grid-template-columns: 1fr; 24760 } 24761`,bzt=p.div.withConfig({displayName:"AdminApiKeys__EventList",componentId:"sc-9rprl8-28"})` 24762 border: 1px solid ${V}; 24763 border-radius: 0.875rem; 24764 overflow: hidden; 24765`,vzt=p.div.withConfig({displayName:"AdminApiKeys__EventRow",componentId:"sc-9rprl8-29"})` 24766 display: grid; 24767 gap: 0.35rem; 24768 padding: 0.65rem 0.75rem; 24769 background: ${Z}; 24770 24771 & + & { 24772 border-top: 1px solid ${V}; 24773 } 24774`;function hte({value:e,onChange:n,disabled:i}){const r=new Set(e||[]);return t.jsx(dzt,{children:lpe.map(o=>t.jsxs(uzt,{children:[t.jsx("input",{type:"checkbox",checked:r.has(o.value),disabled:i,onChange:s=>{s.target.checked?n(Array.from(new Set([...e,o.value]))):n(e.filter(a=>a!==o.value))}}),o.label]},o.value))})}function wzt(e){return lpe.find(n=>n.value===e)?.label||e}function jzt(e){return`${e}T00:00:00`}function _zt(e){return`${e}T23:59:59`}function o5(e){return e?new Date(e).toLocaleString():"Never"}function qg(e,n){return e instanceof Error&&e.message?e.message:n}function Czt(){const[e,n]=l.useState([]),[i,r]=l.useState(!0),[o,s]=l.useState(!1),[a,c]=l.useState(null),[u,m]=l.useState(null),[h,g]=l.useState(""),[x,y]=l.useState(["health:read"]),[w,j]=l.useState(null),[v,_]=l.useState([]),[$,k]=l.useState(null),[P,S]=l.useState(null),[I,A]=l.useState(null),[E,B]=l.useState(!1),[T,M]=l.useState(null),[R,F]=l.useState(()=>({start:hl(qs(),-30),end:qs()})),Y=l.useMemo(()=>e.filter(L=>L.active).length,[e]),H=l.useCallback(async()=>{r(!0),c(null);try{const L=await ue("/api/v1/admin/admin_api_keys"),q=await L.json().catch(()=>({}));if(!L.ok)throw new Error(q?.error||"Failed to load admin API keys");n(q?.admin?.api_keys||[])}catch(L){c(qg(L,"Failed to load admin API keys"))}finally{r(!1)}},[]);l.useEffect(()=>{let L=!1;return(async()=>{r(!0),c(null);try{const q=await ue("/api/v1/admin/admin_api_keys"),W=await q.json().catch(()=>({}));if(!q.ok)throw new Error(W?.error||"Failed to load admin API keys");L||n(W?.admin?.api_keys||[])}catch(q){L||c(qg(q,"Failed to load admin API keys"))}finally{L||r(!1)}})(),()=>{L=!0}},[]);const U=l.useCallback(async L=>{B(!0),M(null),A(null);try{const q=new URLSearchParams;R.start&&q.set("from",jzt(R.start)),R.end&&q.set("to",_zt(R.end));const W=await ue(`/api/v1/admin/admin_api_keys/${L.id}/usage?${q.toString()}`),oe=await W.json().catch(()=>({}));if(!W.ok)throw new Error(oe?.error||"Failed to load usage");A(oe?.admin?.usage||null)}catch(q){M(qg(q,"Failed to load usage"))}finally{B(!1)}},[R.end,R.start]);l.useEffect(()=>{P&&U(P)},[U,P]);async function X(){const L=h.trim();s(!0),m(null),c(null);try{const q=await ue("/api/v1/admin/admin_api_keys",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:L,scopes:x})}),W=await q.json().catch(()=>({}));if(!q.ok)throw new Error(W?.error||"Failed to create admin API key");const oe=W?.admin?.api_key;n(se=>oe?[oe,...se]:se),k(W?.admin?.token||null),g(""),y(["health:read"]),m("Admin API key created. Copy the token now; it will not be shown again.")}catch(q){c(qg(q,"Failed to create admin API key"))}finally{s(!1)}}async function Q(L,q){if(q||window.confirm(`Disable "${L.name}"? Existing usage logs will remain available.`)){s(!0),m(null),c(null);try{const oe=await ue(`/api/v1/admin/admin_api_keys/${L.id}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({enabled:q})}),se=await oe.json().catch(()=>({}));if(!oe.ok)throw new Error(se?.error||"Failed to update admin API key");const de=se?.admin?.api_key;de&&(n(le=>le.map(me=>me.id===de.id?de:me)),S(le=>le?.id===de.id?de:le)),m(q?"Admin API key enabled.":"Admin API key disabled.")}catch(oe){c(qg(oe,"Failed to update admin API key"))}finally{s(!1)}}}async function K(L){s(!0),m(null),c(null);try{const q=await ue(`/api/v1/admin/admin_api_keys/${L.id}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({scopes:v})}),W=await q.json().catch(()=>({}));if(!q.ok)throw new Error(W?.error||"Failed to update admin API key scopes");const oe=W?.admin?.api_key;oe&&(n(se=>se.map(de=>de.id===oe.id?oe:de)),S(se=>se?.id===oe.id?oe:se)),j(null),_([]),m("Admin API key scopes updated.")}catch(q){c(qg(q,"Failed to update admin API key scopes"))}finally{s(!1)}}async function G(L){if(window.confirm(`Revoke "${L.name}"? This disables the key and keeps its usage logs.`)){s(!0),m(null),c(null);try{const W=await ue(`/api/v1/admin/admin_api_keys/${L.id}`,{method:"DELETE"}),oe=await W.json().catch(()=>({}));if(!W.ok)throw new Error(oe?.error||"Failed to revoke admin API key");const se=oe?.admin?.api_key;se&&(n(de=>de.map(le=>le.id===se.id?se:le)),S(de=>de?.id===se.id?se:de)),m("Admin API key revoked.")}catch(W){c(qg(W,"Failed to revoke admin API key"))}finally{s(!1)}}}return t.jsx(rzt,{children:t.jsxs(ozt,{children:[t.jsxs(szt,{children:[t.jsxs("div",{children:[t.jsxs(azt,{children:[t.jsx(th,{size:20}),"Admin API Keys"]}),t.jsx(ste,{children:"Manage global admin API credentials and audit their usage across internal admin endpoints and MCP tools."})]}),t.jsxs(he,{type:"button",size:"sm",variant:"outline",onClick:H,disabled:i||o,children:[i?t.jsx(yzt,{size:14}):t.jsx(No,{size:14}),"Refresh"]})]}),t.jsxs(ate,{children:[t.jsxs(lte,{children:[t.jsxs("div",{children:[t.jsxs(cte,{children:[t.jsx(Rc,{size:16}),"Keys"]}),t.jsxs(dte,{children:[Y," active of ",e.length," total. Tokens are shown once during creation."]})]}),t.jsxs(czt,{children:[t.jsxs(pte,{children:[t.jsx(ute,{children:"New key"}),t.jsxs(lzt,{children:[t.jsx(Xt,{value:h,onChange:L=>g(L.target.value),placeholder:"Key name...",fullWidth:!0,disabled:o}),t.jsx(he,{type:"button",size:"sm",variant:"primary",onClick:X,disabled:o,children:o?"Saving...":"Create key"})]})]}),t.jsxs(pte,{children:[t.jsx(ute,{children:"Scopes"}),t.jsx(hte,{value:x,onChange:y,disabled:o})]})]})]}),$?t.jsxs(fzt,{children:[t.jsx("div",{style:{color:O,fontWeight:900,marginBottom:8},children:"New token: copy now"}),t.jsxs(gzt,{children:[t.jsx(Xt,{value:$,onChange:()=>{},fullWidth:!0}),t.jsxs(he,{type:"button",size:"sm",variant:"outline",onClick:async()=>{try{await navigator.clipboard.writeText($)}catch{}},children:[t.jsx(so,{size:14}),"Copy"]}),t.jsx(he,{type:"button",size:"sm",variant:"outline",onClick:()=>k(null),children:"Hide"})]}),t.jsx(ste,{children:"This token is not stored in plaintext and will disappear when hidden or when you leave the page."})]}):null,u?t.jsx(of,{$tone:"success",children:u}):null,a?t.jsx(of,{$tone:"error",children:a}):null,i?t.jsx(of,{children:"Loading admin API keys..."}):e.length?t.jsx(mzt,{children:t.jsxs(hzt,{children:[t.jsx("thead",{children:t.jsxs("tr",{children:[t.jsx(tf,{children:"Name"}),t.jsx(tf,{children:"Status"}),t.jsx(tf,{children:"Last 4"}),t.jsx(tf,{children:"Last used"}),t.jsx(tf,{children:"Created by"}),t.jsx(tf,{children:"Created"}),t.jsx(tf,{children:"Usage"}),t.jsx(tf,{children:"Manage"})]})}),t.jsx("tbody",{children:e.map(L=>t.jsxs("tr",{children:[t.jsxs(nf,{children:[t.jsx("div",{style:{fontWeight:850},children:L.name}),L.revoked_at?t.jsxs(rf,{children:["Revoked ",o5(L.revoked_at)]}):null,t.jsx(pzt,{children:(L.scopes||[]).length?L.scopes.map(q=>t.jsx(mte,{$tone:"muted",children:wzt(q)},q)):t.jsx(rf,{children:"No scopes"})})]}),t.jsx(nf,{children:t.jsx(mte,{$tone:L.active?"ok":L.revoked_at?"danger":"muted",children:L.active?"Active":L.revoked_at?"Revoked":"Disabled"})}),t.jsx(nf,{children:t.jsx(SE,{children:L.last4})}),t.jsx(nf,{children:t.jsx(rf,{children:o5(L.last_used_at)})}),t.jsxs(nf,{children:[t.jsx("div",{children:L.created_by?.full_name||L.created_by?.email||"Unknown"}),L.created_by?.email?t.jsx(rf,{children:L.created_by.email}):null]}),t.jsx(nf,{children:t.jsx(rf,{children:o5(L.created_at)})}),t.jsx(nf,{children:t.jsx(he,{type:"button",size:"sm",variant:"outline",disabled:E&&P?.id===L.id,onClick:()=>
24774{if(P?.id===L.id){S(null),A(null),M(null);return}S(L)},children:E&&P?.id===L.id?"Loading...":P?.id===L.id?"Hide":"View"})}),t.jsxs(nf,{children:[t.jsxs("div",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:[t.jsx(he,{type:"button",size:"sm",variant:"outline",disabled:o||!!L.revoked_at,onClick:()=>Q(L,!L.enabled),children:L.enabled?"Disable":"Enable"}),t.jsx(he,{type:"button",size:"sm",variant:"danger",disabled:o||!!L.revoked_at,onClick:()=>G(L),children:"Revoke"}),t.jsx(he,{type:"button",size:"sm",variant:"outline",disabled:o||!!L.revoked_at,onClick:()=>{if(w===L.id){j(null),_([]);return}j(L.id),_(L.scopes||[])},children:w===L.id?"Cancel scopes":"Edit scopes"})]}),w===L.id?t.jsxs("div",{style:{display:"grid",gap:8,marginTop:10,minWidth:260},children:[t.jsx(hte,{value:v,onChange:_,disabled:o}),t.jsx(he,{type:"button",size:"sm",variant:"primary",disabled:o,onClick:()=>K(L),children:"Save scopes"})]}):null]})]},L.id))})]})}):t.jsx(of,{children:"No admin API keys yet."})]}),P?t.jsxs(ate,{children:[t.jsxs(lte,{children:[t.jsxs("div",{children:[t.jsxs(cte,{children:[t.jsx(gl,{size:16}),"Usage: ",P.name]}),t.jsx(dte,{children:"Daily request counts and the latest 50 log events for this key."})]}),t.jsx(uD,{value:R,onChange:F,disabled:E})]}),T?t.jsx(of,{$tone:"error",children:T}):null,t.jsxs(xzt,{children:[t.jsx("div",{children:E?t.jsx(of,{children:"Loading usage..."}):I?t.jsx(TA,{data:I.series||[],height:220}):t.jsx(of,{children:"Select a key to view usage."})}),t.jsxs("div",{children:[t.jsx("div",{style:{color:O,fontWeight:900,marginBottom:8},children:"Recent events"}),I?.recent_events?.length?t.jsx(bzt,{children:I.recent_events.map(L=>t.jsxs(vzt,{children:[t.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:8},children:[t.jsxs("div",{style:{fontWeight:850},children:[L.method," ",t.jsx(SE,{children:L.status})]}),t.jsx(rf,{children:o5(L.created_at)})]}),t.jsx(rf,{children:t.jsx(SE,{children:L.path})}),t.jsxs(rf,{children:[L.duration_ms,"ms ",L.ip?`from ${L.ip}`:""]})]},L.id))}):t.jsx(of,{children:"No usage events in this range."})]})]})]}):null]})})}const k8=[{id:"health",method:"GET",path:"/api/admin/v1/health",scope:"health:read",summary:"Checks that the admin API key is valid and returns basic server/key metadata.",response:["ok","server_time","admin_api_key.id","admin_api_key.name","admin_api_key.last4","admin_api_key.scopes","admin_api_key.last_used_at","admin_api_key.expires_at"],example:`{ 24775 "ok": true, 24776 "server_time": "2026-05-22T15:30:00Z", 24777 "admin_api_key": { "id": 12, "name": "Ops", "last4": "abcd", "scopes": ["admin:read"] } 24778}`},{id:"workspaces-index",method:"GET",path:"/api/admin/v1/workspaces",scope:"workspaces:read",summary:"Lists workspaces with billing/plan summary data.",params:[{name:"q",type:"string",description:"Search by workspace name."},{name:"deleted",type:"boolean | all",description:"Default active only. Use true for deleted only, all for both."},{name:"page",type:"integer",description:"Page number, 1-based. Defaults to 1."},{name:"per_page",type:"integer",description:"Results per page. Defaults to 25, max 100."}],response:["workspaces[].id","workspaces[].name","workspaces[].organization_type","workspaces[].deleted","workspaces[].billing_status","workspaces[].billing_exempt","workspaces[].billing_exempt_reason","workspaces[].plan_code","workspaces[].partner","workspaces[].created_at","workspaces[].updated_at","pagination"],example:`{ 24779 "workspaces": [{ "id": 42, "name": "Acme", "billing_status": "active", "plan_code": "pro" }], 24780 "pagination": { "page": 1, "per_page": 25, "total": 1, "total_pages": 1 } 24781}`},{id:"workspaces-show",method:"GET",path:"/api/admin/v1/workspaces/:id",scope:"workspaces:read",summary:"Returns one workspace with partner, subscription, credit balance, and resource counts.",params:[{name:"id",type:"integer",description:"Workspace ID in the path."}],response:["workspace.id","workspace.name","workspace.description","workspace.organization_type","workspace.deleted","workspace.partner","workspace.partner_customer_id","workspace.quick_scan_enabled","workspace.subscription","workspace.credit_balance","workspace.counts.projects","workspace.counts.users","workspace.counts.api_keys","workspace.created_at","workspace.updated_at"],example:`{ 24782 "workspace": { 24783 "id": 42, 24784 "name": "Acme", 24785 "subscription": { "status": "active", "plan_code": "pro" }, 24786 "counts": { "projects": 3, "users": 5, "api_keys": 1 } 24787 } 24788}`},{id:"credits-overview",method:"GET",path:"/api/admin/v1/credits/overview",scope:"credits:read",summary:"Returns platform-level credit usage totals, current-period balances, reason breakdowns, add-ons, top workspaces, and daily usage.",params:[{name:"days",type:"integer",description:"Trailing days when no explicit date range is supplied. Defaults to 30."},{name:"date_from / date_to",type:"date",description:"Filter credit events by creation date. from/to aliases are accepted."}],response:["current_period.total_included","current_period.total_purchased","current_period.total_used","current_period.total_remaining","event_window","by_event_type","by_reason","chat_by_tier","addon_breakdown","top_organizations","daily"],example:`{ 24789 "current_period": { "total_included": 120000, "total_purchased": 5000, "total_used": 38420, "total_remaining": 86580 }, 24790 "event_window": { "events": 250, "credits_consumed": 38420 }, 24791 "top_organizations": [{ "organization_id": 42, "organization_name": "Acme", "credits": 9210 }] 24792}`},{id:"credits-events",method:"GET",path:"/api/admin/v1/credits/events",scope:"credits:read",summary:"Lists platform credit ledger events with pagination and filters.",params:[{name:"event_type",type:"string",description:"consume, grant, purchase, refund, tier_upgrade, addon_reservation, addon_stripped."},{name:"reason",type:"string",description:"Reason filter, for example chat_message or addon_reservation."},{name:"resource_type / resource_id",type:"string | integer",description:"Filter by associated resource."},{name:"date_from / date_to",type:"date",description:"Filter event creation date. from/to aliases are accepted."},{name:"page / per_page",type:"integer",description:"Pagination. per_page max 100."}],response:["events[].id","events[].organization_id","events[].organization_name","events[].event_type","events[].amount","events[].reason","events[].resource_type","events[].resource_id","events[].actor_id","events[].metadata","events[].created_at","pagination"],example:`{ 24793 "events": [{ "id": 501, "organization_id": 42, "event_type": "consume", "amount": 5, "reason": "chat_message" }], 24794 "pagination": { "page": 1, "per_page": 25, "total": 1, "total_pages": 1 } 24795}`},{id:"workspace-credits",method:"GET",path:"/api/admin/v1/workspaces
24795/:id/credits",scope:"credits:read",summary:"Returns one workspace's current balance, totals, reason/resource breakdowns, daily usage, and recent ledger events.",params:[{name:"id",type:"integer",description:"Workspace ID in the path."},{name:"event_type / reason",type:"string",description:"Filter events included in the summary."},{name:"resource_type / resource_id",type:"string | integer",description:"Filter by associated resource."},{name:"date_from / date_to",type:"date",description:"Filter event creation date. from/to aliases are accepted."}],response:["workspace","current_balance","totals","by_event_type","by_reason","by_actor","by_resource_type","daily","recent_events"],example:`{ 24796 "workspace": { "id": 42, "name": "Acme" }, 24797 "current_balance": { "credits_total": 10000, "credits_used": 2500, "credits_remaining": 7500 }, 24798 "totals": { "events": 120, "credits_consumed": 2500 } 24799}`},{id:"workspace-credit-events",method:"GET",path:"/api/admin/v1/workspaces/:id/credit_events",scope:"credits:read",summary:"Lists one workspace's credit ledger events with pagination and filters.",params:[{name:"id",type:"integer",description:"Workspace ID in the path."},{name:"event_type / reason",type:"string",description:"Filter ledger rows."},{name:"resource_type / resource_id",type:"string | integer",description:"Filter by associated resource."},{name:"date_from / date_to",type:"date",description:"Filter event creation date. from/to aliases are accepted."},{name:"page / per_page",type:"integer",description:"Pagination. per_page max 100."}],response:["workspace","events[].id","events[].event_type","events[].amount","events[].reason","events[].resource_type","events[].resource_id","events[].actor_id","events[].metadata","events[].created_at","pagination"],example:`{ 24800 "workspace": { "id": 42, "name": "Acme" }, 24801 "events": [{ "id": 501, "event_type": "consume", "amount": 5, "reason": "chat_message" }], 24802 "pagination": { "total": 1 } 24803}`},{id:"workspace-credit-resource-rollups",method:"GET",path:"/api/admin/v1/workspaces/:id/credit_resource_rollups",scope:"credits:read",summary:"Lists one workspace's consumed credits grouped by resource type, resource ID, and reason, with pagination.",params:[{name:"id",type:"integer",description:"Workspace ID in the path."},{name:"reason",type:"string",description:"Filter by credit reason."},{name:"resource_type / resource_id",type:"string | integer",description:"Filter by associated resource."},{name:"date_from / date_to",type:"date",description:"Filter event creation date. from/to aliases are accepted."},{name:"page / per_page",type:"integer",description:"Pagination. per_page max 100."}],response:["workspace","resources[].resource_type","resources[].resource_id","resources[].reason","resources[].events","resources[].credits","resources[].first_seen_at","resources[].last_seen_at","pagination"],example:`{ 24804 "workspace": { "id": 42, "name": "Acme" }, 24805 "resources": [{ "resource_type": "ChatMessage", "resource_id": 77, "reason": "chat_message", "credits": 5 }], 24806 "pagination": { "total": 1 } 24807}`},{id:"projects-index",method:"GET",path:"/api/admin/v1/projects",scope:"projects:read",summary:"Lists projects with workspace context.",params:[{name:"q",type:"string",description:"Search project name, website, or workspace name."},{name:"workspace_id",type:"integer",description:"Filter by workspace ID. organization_id is also accepted."},{name:"deleted",type:"boolean | all",description:"Default active only. Use true for deleted only, all for both."},{name:"page",type:"integer",description:"Page number, 1-based. Defaults to 1."},{name:"per_page",type:"integer",description:"Results per page. Defaults to 25, max 100."}],response:["projects[].id","projects[].organization_id","projects[].organization","projects[].name","projects[].website","projects[].country_code","projects[].cadence","projects[].deleted","projects[].deleted_at","projects[].created_at","projects[].updated_at","pagination"],example:`{ 24808 "projects": [{ "id": 7, "name": "Acme Site", "website": "https://acme.com" }], 24809 "pagination": { "total": 1 } 24810}`},{id:"projects-show",method:"GET",path:"/api/admin/v1/projects/:id",scope:"projects:read",summary:"Returns one project with workspace, latest run, Google Analytics, and count details.",params:[{name:"id",type:"integer",description:"Project ID in the path."}],response:["project.id","project.organization_id","project.organization","project.name","project.website","project.city","project.country","project.language","project.focus","project.description","project.local_mode","project.address","project.state","project.postal_code","project.local_context","project.custom_identifier","project.brand_aliases","project.site_audit","project.counts","project.latest_run","project.google_analytics","project.created_at","project.updated_at"],example:`{ 24811 "project": { "id": 7, "name": "Acme Site", "organization": { "id": 42, "name": "Acme" } } 24812}`},{id:"project-metrics",method:"GET",path:"/api/admin/v1/projects/:id/metrics",scope:"projects:read",summary:"Returns project-level GEO metrics over recent buckets, including visibility, position, mentions, coverage, and competitor ranking rows.",params:[{name:"id",type:"integer",description:"Project ID in the path."}],response:["project_name","rows[].date","rows[].visibility_score","rows[].avg_position","rows[].mentions","rows[].coverage_pct","rows[].ranking"],example:`{ 24813 "project_name": "Acme Site", 24814 "rows": [{ "date": "2026-05-22", "visibility_score": 61.2, "avg_position": 2.4, "mentions": 18 }] 24815}`},{id:"project-visibility-timeseries",method:"GET",path:"/api/admin/v1/projects/:id/visibility_timeseries",scope:"projects:read",summary:"Returns visibility score time series by model for one project.",params:[{name:"id",type:"integer",description:"Project ID in the path."},{name:"start / end",type:"date",description:"Date range. Defaults to the last 7 days; max 3 months."},{name:"models",type:"string",description:"Comma-separated model keys. Defaults to all enabled models."}],response:["project_id","start","end","models","points[].date","points[].totals","points[].total"],example:`{ 24816 "project_id": 7, 24817 "models": ["chatgpt", "gemini"], 24818 "points": [{ "date": "2026-05-22", "totals": { "chatgpt": 63.2, "gemini": 55.1 }, "total": 59.4 }] 24819}`},{id:"project-citations",method:"GET",path:"/api/admin/v1/projects/:id/citations",scope:"projects:read",summary:"Returns project-level citation domains/URLs with frequency and per-model breakdown.",params:[{name:"id",type:"integer",description:"Project ID in the path."},{name:"start / end",type:"date",description:"Date range. Defaults to the last 7 days; max 3 months."},{name:"models",type:"string",description:"Comma-separated model keys."},{name:"group",type:"string",description:"page or domain. Defaults to page."},{name:"topic_ids",type:"string",description:"Comma-separated topic IDs."},{name:"page / per_page",type:"integer",description:"Pagination. per_page max 50."}],response:["project_id","rows[].domain","rows[].page","rows[].url","rows[].frequency","rows[].model_frequencies","groups[].domain","groups[].pages","pagination"],example:`{ 24820 "project_id": 7, 24821 "rows": [{ "domain": "example.com", "page": "/", "url": "https://example.com/", "frequency": 4 }], 24822 "pagination": { "total": 1 } 24823}`},{id:"project-competitor-visibility",method:"GET",path:"/api/admin/v1/projects/:id/compet
24823itor_visibility",scope:"projects:read",summary:"Returns latest brand vs direct competitor visibility ranking for one project.",params:[{name:"id",type:"integer",description:"Project ID in the path."},{name:"start / end",type:"date",description:"Date range. Defaults to the last 7 days; max 1 month."},{name:"models",type:"string",description:"Comma-separated model keys."}],response:["project_id","denominator","rows[].rank","rows[].name","rows[].is_main_brand","rows[].mentions","rows[].visibility","rows[].position"],example:`{ 24824 "project_id": 7, 24825 "denominator": 20, 24826 "rows": [{ "rank": 1, "name": "Acme", "is_main_brand": true, "visibility": 65.0 }] 24827}`},{id:"project-prompts-with-metrics",method:"GET",path:"/api/admin/v1/projects/:id/prompts_with_metrics",scope:"projects:read",summary:"Lists tracked prompts with visibility, trend, position, sentiment, and competitor mention metrics.",params:[{name:"id",type:"integer",description:"Project ID in the path."},{name:"start / end",type:"date",description:"Date range. Defaults to the last 7 days; max 3 months."},{name:"models",type:"string",description:"Comma-separated model keys."},{name:"competitor_ids",type:"string",description:"Comma-separated direct competitor IDs to filter prompts by mentions."},{name:"page / per_page",type:"integer",description:"Pagination. per_page max 50."}],response:["project_id","start","end","models","prompts[].id","prompts[].content","prompts[].metrics","prompts[].direct_competitor_mentions","pagination"],example:`{ 24828 "project_id": 7, 24829 "prompts": [{ "id": 12, "content": "Best tools for GEO?", "metrics": { "visibility_score": 58.1 } }] 24830}`},{id:"project-prompt-detail",method:"GET",path:"/api/admin/v1/projects/:id/prompts/:prompt_id",scope:"projects:read",summary:"Returns one tracked prompt with visibility, trend, position, sentiment, and competitor mention metrics.",params:[{name:"id",type:"integer",description:"Project ID in the path."},{name:"prompt_id",type:"integer",description:"Prompt ID in the path."},{name:"start / end",type:"date",description:"Date range. Defaults to the last 7 days; max 3 months."},{name:"models",type:"string",description:"Comma-separated model keys."}],response:["prompt.id","prompt.content","prompt.category","prompt.topic","prompt.metrics","prompt.direct_competitor_mentions"],example:`{ 24831 "prompt": { "id": 12, "content": "Best tools for GEO?", "metrics": { "visibility_score": 58.1 } } 24832}`},{id:"project-prompt-responses",method:"GET",path:"/api/admin/v1/projects/:id/prompts/:prompt_id/responses",scope:"projects:read",summary:"Lists LLM responses for one prompt, including model, brand presence, response text, and citation preview.",params:[{name:"id",type:"integer",description:"Project ID in the path."},{name:"prompt_id",type:"integer",description:"Prompt ID in the path."},{name:"start / end",type:"date",description:"Date range. Defaults to the last 7 days; max 3 months."},{name:"models",type:"string",description:"Comma-separated model keys."},{name:"page / per_page",type:"integer",description:"Pagination. per_page max 50."}],response:["project_id","prompt_id","rows[].model_key","rows[].position","rows[].brand_present","rows[].response_text","rows[].citations_count","rows[].citations","pagination"],example:`{ 24833 "project_id": 7, 24834 "prompt_id": 12, 24835 "rows": [{ "model_key": "chatgpt", "brand_present": true, "response_text": "..." }] 24836}`},{id:"project-prompt-citations",method:"GET",path:"/api/admin/v1/projects/:id/prompts/:prompt_id/citations",scope:"projects:read",summary:"Lists citation domains and URLs for one prompt with frequency and per-model breakdown.",params:[{name:"id",type:"integer",description:"Project ID in the path."},{name:"prompt_id",type:"integer",description:"Prompt ID in the path."},{name:"start / end",type:"date",description:"Date range. Defaults to the last 7 days; max 3 months."},{name:"models",type:"string",description:"Comma-separated model keys."},{name:"page / per_page",type:"integer",description:"Pagination. per_page max 50."}],response:["project_id","prompt_id","rows[].domain","rows[].page","rows[].url","rows[].frequency","rows[].model_frequencies","pagination"],example:`{ 24837 "project_id": 7, 24838 "prompt_id": 12, 24839 "rows": [{ "domain": "example.com", "url": "https://example.com/", "frequency": 2 }] 24840}`},{id:"project-prompt-competitors",method:"GET",path:"/api/admin/v1/projects/:id/prompts/:prompt_id/compet
24840itors",scope:"projects:read",summary:"Returns brand vs direct competitor ranking for one prompt over a date range.",params:[{name:"id",type:"integer",description:"Project ID in the path."},{name:"prompt_id",type:"integer",description:"Prompt ID in the path."},{name:"start / end",type:"date",description:"Date range. Defaults to the last 7 days; max 3 months."},{name:"models",type:"string",description:"Comma-separated model keys."}],response:["project_id","prompt_id","denominator","rows[].rank","rows[].name","rows[].visibility","rows[].position","rows[].mentions"],example:`{ 24841 "project_id": 7, 24842 "prompt_id": 12, 24843 "rows": [{ "rank": 1, "name": "Acme", "visibility": 50.0 }] 24844}`},{id:"project-fanout-queries",method:"GET",path:"/api/admin/v1/projects/:id/fanout_queries",scope:"projects:read",summary:"Lists fan-out query variants grouped by topic and prompt.",params:[{name:"id",type:"integer",description:"Project ID in the path."},{name:"topic_ids",type:"string",description:"Comma-separated topic IDs."},{name:"models",type:"string",description:"Comma-separated model keys."},{name:"q",type:"string",description:"Search topic names, prompt text, and fan-out query text."},{name:"page / per_page",type:"integer",description:"Pagination. per_page max 200."}],response:["project_id","models","topics[].id","topics[].name","topics[].prompts[].id","topics[].prompts[].content","topics[].prompts[].fanout_queries","pagination"],example:`{ 24845 "project_id": 7, 24846 "topics": [{ "id": 3, "name": "GEO", "prompts": [{ "id": 12, "fanout_queries": [] }] }] 24847}`},{id:"project-actions-summary",method:"GET",path:"/api/admin/v1/projects/:id/project_actions_summary",scope:"projects:read",summary:"Returns aggregate AI-generated optimization action counts for one project.",params:[{name:"id",type:"integer",description:"Project ID in the path."}],response:["total","by_status","by_priority","by_category","latest_created_at"],example:`{ 24848 "total": 12, 24849 "by_status": { "todo": 5, "in_progress": 2, "completed": 4, "dismissed": 1 }, 24850 "by_priority": { "high": 3, "medium": 7, "low": 2 }, 24851 "by_category": { "internal_content": 8, "external_authority": 4 }, 24852 "latest_created_at": "2026-05-22T15:30:00Z" 24853}`},{id:"project-actions-index",method:"GET",path:"/api/admin/v1/projects/:id/actions",scope:"projects:read",summary:"Lists AI-generated optimization actions for one project with action IDs and compact details.",params:[{name:"id",type:"integer",description:"Project ID in the path."},{name:"q / search",type:"string",description:"Search action title, detail, target URL, or action type."},{name:"status",type:"string",description:"todo, in_progress, completed, dismissed."},{name:"priority",type:"string",description:"high, medium, low."},{name:"category",type:"string",description:"internal_content or external_authority."},{name:"action_type / source_category",type:"string",description:"Filter by taxonomy fields."},{name:"include_completed / include_dismissed",type:"boolean",description:"Include completed/dismissed actions in addition to active actions."},{name:"page / per_page",type:"integer",description:"Pagination. per_page max 100."}],response:["project_id","actions[].id","actions[].prompt_id","actions[].status","actions[].priority","actions[].title","actions[].detail","actions[].action_type","actions[].target_url","actions[].guide_status","actions[].related_prompt_ids","actions[].created_at","pagination"],example:`{ 24854 "project_id": 7, 24855 "actions": [{ "id": 91, "status": "todo", "priority": "high", "title": "Improve homepage citations" }], 24856 "pagination": { "page": 1, "per_page": 25, "total": 1, "total_pages": 1 } 24857}`},{id:"project-actions-show",method:"GET",path:"/api/admin/v1/projects/:id/actions/:action_id",scope:"projects:read",summary:"Returns one project action with evidence, linked prompts, target details, and implementation guide fields.",params:[{name:"id",type:"integer",description:"Project ID in the path."},{name:"action_id",type:"integer",description:"Project action ID in the path."}],response:["action.id","action.project_id","action.status","action.priority","action.title","action.detail","action.evidence","action.linked_prompts","action.md_implementation_guide","action.target_specifics","action.created_at"],example:`{ 24858 "action": { "id": 91, "title": "Improve homepage citations", "evidence": {}, "linked_prompts": [] } 24859}`},{id:"site-audit-summary",method:"GET",path:"/api/admin/v1/projects/:id/site_audit_summary",scope:"projects:read",summary:"Returns aggregate site audit page, finding/action, and run counts for one project.",params:[{name:"id",type:"integer",description:"Project ID in the path."}],response:["pages.total","pages.in_home_nav","pages.by_kind","pages.by_status","pages.by_audit_status","actions.total","actions.by_status","actions.by_scope","actions.by_severity","runs.total","runs.by_status","runs.recent_daily_counts"],example:`{ 24860 "pages": { "total": 18, "in_home_nav": 6, "by_kind": { "main": 1, "content": 17 } }, 24861 "actions": { "total": 9, "by_status": { "open": 7, "completed": 2 }, "by_severity": { "high": 2 } }, 24862 "runs": { "total": 24, "by_status": { "succeeded": 22, "failed": 2 }, "recent_daily_counts": [{ "date": "2026-05-22", "count": 3 }] } 24863}`},{id:"site-audit-issue-groups",method:"GET",path:"/api/admin/v1/projects/:id/site_audit_issues/grouped",scope:"projects:read",summary:"Lists grouped site audit issue types with affected counts and fix guidance.",params:[{name:"id",type:"integer",description:"Project ID in the path."},{name:"category",type:"string",description:"Filter by issue category."},{name:"severity",type:"string",description:"high, medium, low."},{name:"include_completed",type:"boolean",description:"Include completed issues. Defaults to open only."}],response:["project_id","issues[].code","issues[].message","issues[].severity","issues[].category","issues[].fix_markdown","issues[].affected_count","issues[].open_count"],example:`{ 24864 "project_id": 7, 24865 "issues": [{ "code": "title_missing", "severity": "high", "affected_count": 3, "open_count": 3 }] 24866}`},{id:"site-audit-issues-index",method:"GET",path:"/api/admin/v1/projects/:id/site_audit_issues",scope:"projects:read",summary:"Lists individual site audit issue rows with issue IDs and affected page details.",params:[{name:"id",type:"integer",description:"Project ID in the path."},{name:"code",type:"string",description:"Filter by issue code from grouped issues."},{name:"page_id",type:"integer",description:"Filter by site audit page ID."},{name:"scope",type:"string",description:"page or site."},{name:"severity",type:"string",description:"high, medium, low."},{name:"category",type:"string",description:"Filter by issue category."},{name:"include_completed",type:"boolean",description:"Include completed issues. Defaults to open only."},{name:"include_evidence",type:"boolean",description:"Include evidence JSON in each row. Defaults false for compact MCP payloads."},{name:"page / per_page",type:"integer",description:"Pagination. per_page max 100."}],response:["project_id","issues[].id","issues[].page_id","issues[].page_path","issues[].page_url","issues[].scope","issues[].code","issues[].severity","issues[].category","issues[].message","issues[].fix_markdown","issues[].status","issues[].evidence","pagination"],example:`{ 24867 "project_id": 7, 24868 "issues": [{ "id": 144, "page_path": "/", "code": "title_missing", "severity": "high", "status": "open" }], 24869 "pagination": { "total": 1 } 24870}`},{id:"site-audit-issues-show",method:"GET",path:"/api/admin/v1/projects/:id/site_audit_issues/:issue_id",scope:"projects:read",summary:"Returns one site audit issue with evidence JSON.",params:[{name:"id",type:"integer",description:"Project ID in the path."},{name:"issue_id",type:"integer",description:"Site audit issue/action ID in the path."}],response:["issue.id","issue.page_id","issue.page_path","issue.page_url","issue.scope","issue.code","issue.fingerprint","issue.severity","issue.category","issue.message","issue.fix_markdown","issue.evidence","issue.status","issue.first_seen_at","issue.last_seen_at"],example:`{ 24871 "issue": { "id": 144, "code": "title_missing", "message": "Missing title", "evidence": {} } 24872}`},{id:"site-audit-pages-index",method:"GET",path:"/api/admin/v1/projects/:id/site_audit_pages",scope:"projects:read",summary:"Lists active site audit pages with audit status and open issue counts.",params:[{name:"id",type:"integer",description:"Project ID in the path."},{name:"q / search",type:"string",description:"Search page path or URL."},{name:"kind",type:"string",description:"main, content, docs, other."},{name:"audit_status",type:"string",description:"idle, running, succeeded, failed."},{name:"in_home_nav",type:"boolean",description:"Filter by home navigation membership."},{name:"page / per_page",type:"integer",description:"Pagination. per_page max 100."}],response:["project_id","pages[].id","pages[].url","pages[].path","pages[].kind","pages[].audit_status","pages[].open_issues_count","pages[].open_issues_by_severity","pages[].audit_error_message","pagination"],example:`{ 24873 "project_id": 7, 24874 "pages": [{ "id": 33, "path": "/", "audit_status": "succeeded", "open_issues_count": 2 }], 24875 "pagination": { "total": 1 } 24876}`},{id:"users-index",method:"GET",path:"/api/admin/v1/users",scope:"users:read",summary:"Lists users with admin/support filters.",params:[{name:"q",type:"string",description:"Search email, first name, or last name."},{name:"admin_role",type:"string",description:"Filter by admin role. Use none for no admin role, all to disable."},{name:"admin_only",type:"boolean",description:"Only users with an admin role."},{name:"provider",type:"string",description:"Filter by auth provider."},{name:"email_verified",type:"boolean",description:"Filter by email verification state."},{name:"deleted",type:"boolean | all",description:"Default active only. Use true for deleted only, all for both."},{name:"page",type:"integer",description:"Page number, 1-based. Defaults to 1."},{name:"per_page",type:"integer",description:"Results per page. Defaults to 25, max 100."}],response:["users[].id","users[].email","users[].first_name","users[].last_name","users[].full_name","users[].provider","users[].email_verified","users[].deleted","users[].admin_role","users[].last_signed_in_at","users[].created_at","users[].updated_at","pagination"],example:`{ 24877 "users": [{ "id": 99, "email": "[email protected]", "admin_role": "admin", "last_signed_in_at": "2026-05-22T15:30:00Z" }], 24878 "pagination": { "total": 1 } 24879}`},{id:"users-show",method:"GET",path:"/api/admin/v1/users/:id",scope:"users:read",summary:"Returns one user and all organization/project memberships and roles.",params:[{name:"id",type:"integer",description:"User ID in the path."}],response:["user.id","user.email","user.first_name","user.last_name","user.full_name","user.provider","user.email_verified","user.deleted","user.admin_role","user.last_signed_in_at","user.onboarding_completed","user.onboarding_step","user.onboarding_organization_id","user.onboarding_project_id","user.onboarding_failed","user.memberships.organizations[]","user.memberships.projects[]","user.created_at","user.updated_at"],example:`{ 24880 "user": { 24881 "id": 99, 24882 "email": "[email protected]", 24883 "last_signed_in_at": "2026-05-22T15:30:00Z", 24884 "memberships": { "organizations": [{ "role": "owner" }], "projects": [{ "role": "viewer" }] } 24885 } 24886}`},{id:"billing-subscriptions",method:"GET",path:"/api/admin/v1/billing/subscriptions",scope:"billing:read",summary:"Lists billing subscriptions with workspace and plan context.",params:[{name:"q",type:"string",description:"Search workspace name, provider customer ID, or provider subscription ID."},{name:"status / statuses",type:"string",description:"One status or comma-separated statuses."},{name:"plan_code / plan_codes",type:"string",description:"One plan code or comma-separated plan codes."},{name:"exempted",type:"boolean",description:"Filter by billing_exempt."},{name:"paying",type:"boolean",description:"Active, non-exempt subscriptions only."}
24886,{name:"deleted",type:"boolean | all",description:"Workspace deleted filter."},{name:"page / per_page",type:"integer",description:"Pagination. per_page max 100."}],response:["subscriptions[].id","subscriptions[].organization_id","subscriptions[].organization","subscriptions[].plan","subscriptions[].status","subscriptions[].billing_interval","subscriptions[].currency","subscriptions[].price_cents","subscriptions[].original_price_cents","subscriptions[].discount_cents","subscriptions[].discount_percent","subscriptions[].discount_code","subscriptions[].billing_exempt","subscriptions[].billing_exempt_reason","subscriptions[].provider","subscriptions[].provider_customer_id","subscriptions[].provider_subscription_id","subscriptions[].provider_price_id","subscriptions[].provider_cancel_at_period_end","subscriptions[].provider_current_period_end","subscriptions[].trial_used_at","subscriptions[].trial_override_days","subscriptions[].pending_plan_id","subscriptions[].pending_billing_interval","subscriptions[].pending_plan_change_at","subscriptions[].first_paid_at","subscriptions[].created_at","subscriptions[].updated_at","pagination"],example:`{ 24887 "subscriptions": [{ "id": 5, "status": "active", "organization": { "id": 42 }, "plan": { "code": "pro" } }], 24888 "pagination": { "total": 1 } 24889}`},{id:"runs",method:"GET",path:"/api/admin/v1/runs",scope:"runs:read",summary:"Lists project runs with run status, project/workspace context, and prompt-run status counts.",params:[{name:"q / search",type:"string",description:"Search project/workspace name. Numeric values search project ID."},{name:"status",type:"string",description:"pending, running, succeeded, failed."},{name:"triggered_by",type:"string",description:"scheduled, manual, quick_scan, onboard."},{name:"project_id",type:"integer",description:"Filter by project."},{name:"workspace_id / organization_id",type:"integer",description:"Filter by workspace."},{name:"date_from / date_to",type:"date",description:"Filter by bucket_start_on. from/to aliases are accepted."},{name:"billing",type:"string",description:"all/default, active, inactive."},{name:"page / per_page",type:"integer",description:"Pagination. per_page max 100."}],response:["runs[].id","runs[].project_id","runs[].project","runs[].organization","runs[].bucket_kind","runs[].bucket_start_on","runs[].status","runs[].triggered_by","runs[].models_requested","runs[].models_ran","runs[].error_code","runs[].error_message","runs[].started_at","runs[].finished_at","runs[].created_at","runs[].updated_at","runs[].prompt_runs","pagination"],example:`{ 24890 "runs": [{ "id": 123, "status": "running", "prompt_runs": { "total": 10, "succeeded": 8 } }], 24891 "pagination": { "total": 1 } 24892}`},{id:"growth-lifecycle",method:"GET",path:"/api/admin/v1/growth/lifecycle",scope:"growth:read",summary:"Returns lifecycle growth cards using the same search/filter/sort behavior as Admin Growth.",params:[{name:"q / search",type:"string",description:"Search the full lifecycle card payload."},{name:"severity",type:"string",description:"urgent, warning, positive, info, or all."},{name:"stage",type:"string",description:"Lifecycle stage, such as signup_no_subscription, trialing, cancel_at_period_end."},{name:"status",type:"string",description:"Subscription status filter."},{name:"plan / plan_code",type:"string",description:"Plan code filter."},{name:"from / to",type:"date",description:"Event date range. date_from/date_to aliases are accepted."},{name:"sort",type:"string",description:"severity/default, newest, oldest, stage, plan."},{name:"page / per_page",type:"integer",description:"Pagination. per_page max 100."}],response:["generated_at","window_days","summary","rows[].organization_id","rows[].organization_name","rows[].user_id","rows[].user_name","rows[].user_email","rows[].subscription_id","rows[].plan_code","rows[].plan_name","rows[].status","rows[].stage","rows[].stage_label","rows[].severity","rows[].event_at","rows[].reason","rows[].suggested_action","rows[].metrics","filters.plans","filters.stages","filters.statuses","pagination"],example:`{ 24893 "summary": { "total_signals": 4, "urgent": 1 }, 24894 "rows": [{ "stage": "trialing", "severity": "warning", "organization_name": "Acme" }] 24895}`},{id:"growth-limits",method:"GET",path:"/api/admin/v1/growth/limits",scope:"growth:read",summary:"Returns usage/limit opportunity cards using the same search/filter/sort behavior as Admin Growth.",params:[{name:"q / search",type:"string",description:"Search the full limit card payload."},{name:"severity",type:"string",description:"urgent, warning, or all."},{name:"limit_type / limit_key",type:"string",description:"projects, prompt_capacity, workspace_seats, countries, credits."},{name:"plan / plan_code",type:"string",description:"Plan code filter."},{name:"sort",type:"string",description:"severity/default, percent, type, plan, organization."},{name:"page / per_page",type:"integer",description:"Pagination. per_page max 100."}],response:["generated_at","window_days","summary","rows[].organization_id","rows[].organization_name","rows[].subscription_id","rows[].plan_code","rows[].plan_name","rows[].plan_family","rows[].billing_interval","rows[].status","rows[].limit_key","rows[].limit_label","rows[].used","rows[].limit","rows[].percent_used","rows[].severity","rows[].detail","rows[].suggested_action","rows[].resets_on","rows[].metadata","filters.plans","filters.limit_types","pagination"],example:`{ 24896 "summary": { "total_opportunities": 3, "urgent": 1 }, 24897 "rows": [{ "limit_key": "projects", "percent_used": 100, "severity": "urgent" }] 24898}`}],dpe=Td().replace(/\/+$/,""),upe="/api/admin/v1",mD=`${dpe}${upe}`,ppe=`curl "${mD}
24898/workspaces?q=acme" \\ 24899 -H "Accept: application/json" \\ 24900 -H "X-Admin-Api-Key: $CEYO_ADMIN_API_KEY"`,hD=[{name:"admin_health",scope:"health:read",description:"Check admin MCP/API health and return metadata for the authenticated admin API key."},{name:"list_workspaces",scope:"workspaces:read",description:"List workspaces with the same search, deleted filter, and pagination as the REST workspaces endpoint.",arguments:[{name:"q",type:"string",description:"Search by workspace name."},{name:"deleted",type:"boolean | all",description:"Default active only. Use true for deleted only, all for both."},{name:"page / per_page",type:"integer",description:"Pagination. per_page max 100."}]},{name:"get_workspace",scope:"workspaces:read",description:"Get one workspace by ID, including billing, partner, credits, and count details.",arguments:[{name:"id",type:"integer",description:"Workspace ID."}]},{name:"get_credits_overview",scope:"credits:read",description:"Get platform-level credit usage totals, current-period balances, reason breakdowns, chat tiers, add-ons, top workspaces, and daily usage.",arguments:[{name:"days",type:"integer",description:"Trailing days when no explicit date range is supplied. Defaults to 30."},{name:"date_from / date_to",type:"date",description:"Filter event creation date. from/to aliases are accepted."}]},{name:"list_credit_events",scope:"credits:read",description:"List platform credit ledger events with pagination and filters.",arguments:[{name:"event_type",type:"string",description:"consume, grant, purchase, refund, tier_upgrade, addon_reservation, addon_stripped."},{name:"reason",type:"string",description:"Filter by reason."},{name:"resource_type / resource_id",type:"string | integer",description:"Filter by associated resource."},{name:"date_from / date_to",type:"date",description:"Filter event creation date. from/to aliases are accepted."},{name:"page / per_page",type:"integer",description:"Pagination. per_page max 100."}]},{name:"get_workspace_credits",scope:"credits:read",description:"Get one workspace's current balance, credit totals, reason/resource breakdowns, daily usage, and recent ledger events.",arguments:[{name:"id",type:"integer",description:"Workspace ID."},{name:"event_type / reason",type:"string",description:"Filter events included in the summary."},{name:"resource_type / resource_id",type:"string | integer",description:"Filter by associated resource."},{name:"date_from / date_to",type:"date",description:"Filter event creation date. from/to aliases are accepted."}]},{name:"list_workspace_credit_events",scope:"credits:read",description:"List one workspace's credit ledger events with pagination and filters. Use page/per_page to inspect the ledger over time.",arguments:[{name:"id",type:"integer",description:"Workspace ID."},{name:"event_type / reason",type:"string",description:"Filter ledger rows."},{name:"resource_type / resource_id",type:"string | integer",description:"Filter by associated resource."},{name:"date_from / date_to",type:"date",description:"Filter event creation date. from/to aliases are accepted."},{name:"page / per_page",type:"integer",description:"Pagination. per_page max 100."}]},{name:"list_workspace_credit_resource_rollups",scope:"credits:read",description:"List one workspace's consumed credits grouped by resource type, resource ID, and reason, with pagination.",arguments:[{name:"id",type:"integer",description:"Workspace ID."},{name:"reason",type:"string",description:"Filter by credit reason."},{name:"resource_type / resource_id",type:"string | integer",description:"Filter by associated resource."},{name:"date_from / date_to",type:"date",description:"Filter event creation date. from/to aliases are accepted."},{name:"page / per_page",type:"integer",description:"Pagination. per_page max 100."}]},{name:"list_projects",scope:"projects:read",description:"List projects with search, deleted filter, workspace filter, and pagination.",arguments:[{name:"q",type:"string",description:"Search by project name, website, or workspace name."},{name:"workspace_id / organization_id",type:"integer",description:"Filter by workspace."},{name:"deleted",type:"boolean | all",description:"Default active only. Use true for deleted only, all for both."},{name:"page / per_page",type:"integer",description:"Pagination. per_page max 100."}]},{name:"get_project",scope:"projects:read",description:"Get one project by ID, including workspace, latest run, Google Analytics, and counts.",arguments:[{name:"id",type:"integer",description:"Project ID."}]},{name:"get_project_metrics",scope:"projects:read",description:"Get project-level GEO metrics over recent buckets: visibility, average position, mentions, coverage, and competitor ranking rows.",arguments:[{name:"project_id",type:"integer",description:"Project ID."}]},{name:"get_project_visibility_timeseries",scope:"projects:read",description:"Get visibility score time series by model for one project.",arguments:[{name:"project_id",type:"integer",description:"Project ID."},{name:"start / end",type:"date",description:"Date range. Defaults to the last 7 days."},{name:"models",type:"string",description:"Comma-separated model keys."}]},{name:"get_project_citations",scope:"projects:read",description:"Get project-level citation domains/URLs with frequency and per-model breakdown.",arguments:[{name:"project_id",type:"integer",description:"Project ID."},{name:"start / end",type:"date",description:"Date range. Defaults to the last 7 days."},{name:"models",type:"string",description:"Comma-separated model keys."},{name:"group",type:"string",description:"page or domain. Defaults to page."},{name:"topic_ids",type:"string",description:"Comma-separated topic IDs."},{name:"page / per_page",type:"integer",description:"Pagination. per_page max 50."}]},{name:"get_project_competitor_visibility",scope:"projects:read",description:"Get latest brand vs direct competitor visibility ranking for one project.",arguments:[{name:"project_id",type:"integer",description:"Project ID."},{name:"start / end",type:"date",description:"Date range. Defaults to the last 7 days."},{name:"models",type:"string",description:"Comma-separated model keys."}]},{name:"list_project_prompts_with_metrics",scope:"projects:read",description:"List tracked prompts with visibility, trend, average position, sentiment, and competitor mention metrics.",arguments:[{name:"project_id",type:"integer",description:"Project ID."},{name:"start / end",type:"date",description:"Date range. Defaults to the last 7 days."},{name:"models",type:"string",description:"Comma-separated model keys."},{name:"topic_ids",type:"string",description:"Comma-separated topic IDs."},{name:"competitor_ids",type:"string",description:"Comma-separated competitor IDs."},{name:"page / per_page",type:"integer",description:"Pagination. per_page max 50."}]},{name:"get_project_prompt",scope:"projects:read",description:"Get one tracked prompt with visibility, trend, position, sentiment, and competitor mention metrics.",arguments:[{name:"project_id",type:"integer",description:"Project ID."},{name:"prompt_id",type:"integer",description:"Prompt ID."},{name:"start / end",type:"date",description:"Date range. Defaults to the last 7 days."},{name:"models",type:"string",description:"Comma-separated model keys."}]},{name:"list_prompt_responses",scope:"projects:read",description:"List LLM responses for one prompt, including model, brand presence, response text, and citation preview.",arguments:[{name:"project_id",type:"integer",description:"Project ID."},{name:"prompt_id",type:"integer",description:"Prompt ID."},{name:"start / end",type:"date",description:"Date range. Defaults to the last 7 days."},{name:"models",type:"string",description:"Comma-separated model keys."},{name:"page / per_page",type:"integer",description:"Pagination. per_page max 50."}]},{name:"list_prompt_citations",scope:"projects:read",description:"List citation domains and URLs for one prompt with frequency and per-model breakdown.",arguments:[{name:"project_id",type:"integer",description:"Project ID."},{name:"prompt_id",type:"integer",description:"Prompt ID."},{name:"start / end",type:"date",description:"Date range. Defaults to the last 7 days."},{name:"models",type:"string",description:"Comma-separated model keys."},{name:"page / per_page",type:"integer",description:"Pagination. per_page max 50."}]},{name:"list_prompt_competitors",scope:"projects:read",description:"Get brand vs direct competitor ranking for one prompt over a date range.",arguments:[{name:"project_id",type:"integer",description:"Project ID."},{name:"prompt_id",type:"integer",description:"Prompt ID."},{name:"start / end",type:"date",description:"Date range. Defaults to the last 7 days."},{name:"models",type:"string",description:"Comma-separated model keys."}]},{name:"list_project_fanout_queries",scope:"projects:read",description:"List fan-out query variants grouped by topic and prompt for one project.",arguments:[{name:"project_id",type:"integer",description:"Project ID."},{name:"topic_ids",type:"string",description:"Comma-separated topic IDs."},{name:"models",type:"string",description:"Comma-separated model keys."},{name:"q",type:"string",description:"Search topic names, prompt text, and fan-out query text."},{name:"page / per_page",type:"integer",description:"Pagination. per_page max 200."}]},{name:"list_project_actions",scope:"projects:read",description:"List AI-generated optimization actions for one project, returning action IDs and compact details.",arguments:[{name:"project_id",type:"integer",description:"Project ID."},{name:"q / search",type:"string",description:"Search action title, detail, target URL, or action type."},{name:"status",type:"string",description:"todo, in_progress, completed, dismissed."},{name:"priority",type:"string",description:"high, medium, low."},{name:"category",type:"string",description:"internal_content or external_authority."},{name:"action_type / source_category",type:"string",description:"Filter by taxonomy fields."},{name:"include_completed / include_dismissed",type:"boolean",description:"Include completed/dismissed actions."},{name:"page / per_page",type:"integer",description:"Pagination. per_page max 100."}]},{name:"get_project_action",scope:"projects:read",description:"Get one project action by ID, including evidence, linked prompts, and implementation guide fields.",arguments:[{name:"project_id",type:"integer",description:"Project ID."},{name:"action_id",type:"integer",description:"Project action ID."}]},{name:"get_project_actions_summary",scope:"projects:read",description:"Get aggregate AI-generated optimization action counts for one project by status, priority, c
24900ategory, and latest creation time.",arguments:[{name:"project_id",type:"integer",description:"Project ID."}]},{name:"get_site_audit_summary",scope:"projects:read",description:"Get aggregate site audit page, finding/action, and run counts for one project.",arguments:[{name:"project_id",type:"integer",description:"Project ID."}]},{name:"list_site_audit_issue_groups",scope:"projects:read",description:"List grouped site audit issue types for one project, with affected counts and fix guidance.",arguments:[{name:"project_id",type:"integer",description:"Project ID."},{name:"category",type:"string",description:"Filter by issue category."},{name:"severity",type:"string",description:"high, medium, low."},{name:"include_completed",type:"boolean",description:"Include completed issues. Defaults to open only."}]},{name:"list_site_audit_issues",scope:"projects:read",description:"List site audit issue rows for one project, returning issue IDs and affected page details.",arguments:[{name:"project_id",type:"integer",description:"Project ID."},{name:"code",type:"string",description:"Filter by issue code."},{name:"page_id",type:"integer",description:"Filter by site audit page ID."},{name:"scope",type:"string",description:"page or site."},{name:"severity",type:"string",description:"high, medium, low."},{name:"category",type:"string",description:"Filter by issue category."},{name:"include_completed",type:"boolean",description:"Include completed issues. Defaults to open only."},{name:"include_evidence",type:"boolean",description:"Include evidence JSON in each row. Defaults false."},{name:"page / per_page",type:"integer",description:"Pagination. per_page max 100."}]},{name:"get_site_audit_issue",scope:"projects:read",description:"Get one site audit issue by ID, including evidence JSON.",arguments:[{name:"project_id",type:"integer",description:"Project ID."},{name:"issue_id",type:"integer",description:"Site audit issue/action ID."}]},{name:"list_site_audit_pages",scope:"projects:read",description:"List active site audit pages for one project, with audit status and open issue counts.",arguments:[{name:"project_id",type:"integer",description:"Project ID."},{name:"q / search",type:"string",description:"Search page path or URL."},{name:"kind",type:"string",description:"main, content, docs, other."},{name:"audit_status",type:"string",description:"idle, running, succeeded, failed."},{name:"in_home_nav",type:"boolean",description:"Filter by home navigation membership."},{name:"page / per_page",type:"integer",description:"Pagination. per_page max 100."}]},{name:"list_users",scope:"users:read",description:"List users with search and filters for admin role, provider, email verification, deleted status, last sign-in timestamp, and pagination.",arguments:[{name:"q",type:"string",description:"Search by email, first name, or last name."},{name:"admin_role",type:"string",description:"Filter by admin role. Use none for no admin role."},{name:"admin_only",type:"boolean",description:"Only users with an admin role."},{name:"provider",type:"string",description:"Filter by auth provider."},{name:"email_verified",type:"boolean",description:"Filter by email verification state."},{name:"deleted",type:"boolean | all",description:"Default active only. Use true for deleted only, all for both."},{name:"page / per_page",type:"integer",description:"Pagination. per_page max 100."}]},{name:"get_user",scope:"users:read",description:"Get one user by ID, including last sign-in timestamp plus all organization and project memberships and roles.",arguments:[{name:"id",type:"integer",description:"User ID."}]},{name:"list_billing_subscriptions",scope:"billing:read",description:"List billing subscriptions with search, status, plan, exempted, paying, deleted filters, and pagination.",arguments:[{name:"q",type:"string",description:"Search workspace name, provider customer ID, or provider subscription ID."},{name:"status / statuses",type:"string",description:"One status or comma-separated statuses."},{name:"plan_code / plan_codes",type:"string",description:"One plan code or comma-separated plan codes."},{name:"exempted",type:"boolean",description:"Filter by billing_exempt."},{name:"paying",type:"boolean",description:"Active, non-exempt subscriptions only."}
24900,{name:"deleted",type:"boolean | all",description:"Workspace deleted filter."},{name:"page / per_page",type:"integer",description:"Pagination. per_page max 100."}]},{name:"list_runs",scope:"runs:read",description:"List project runs with search, status, trigger, project/workspace, billing, date filters, and prompt-run counts.",arguments:[{name:"q / search",type:"string",description:"Search project/workspace name. Numeric values search project ID."},{name:"status",type:"string",description:"pending, running, succeeded, failed."},{name:"triggered_by",type:"string",description:"scheduled, manual, quick_scan, onboard."},{name:"project_id",type:"integer",description:"Filter by project."},{name:"workspace_id / organization_id",type:"integer",description:"Filter by workspace."},{name:"date_from / date_to",type:"date",description:"Filter by bucket_start_on. from/to aliases are accepted."},{name:"billing",type:"string",description:"all/default, active, inactive."},{name:"page / per_page",type:"integer",description:"Pagination. per_page max 100."}]},{name:"get_growth_lifecycle",scope:"growth:read",description:"Get growth lifecycle cards with the same search, filters, sort, and pagination as the REST growth lifecycle endpoint.",arguments:[{name:"q / search",type:"string",description:"Search the full lifecycle card payload."},{name:"severity",type:"string",description:"urgent, warning, positive, info, or all."},{name:"stage",type:"string",description:"Lifecycle stage filter."},{name:"status",type:"string",description:"Subscription status filter."},{name:"plan / plan_code",type:"string",description:"Plan code filter."},{name:"from / to",type:"date",description:"Event date range. date_from/date_to aliases are accepted."},{name:"sort",type:"string",description:"severity/default, newest, oldest, stage, plan."},{name:"page / per_page",type:"integer",description:"Pagination. per_page max 100."}]},{name:"get_growth_limits",scope:"growth:read",description:"Get growth limit opportunity cards with the same search, filters, sort, and pagination as the REST growth limits endpoint.",arguments:[{name:"q / search",type:"string",description:"Search the full limit card payload."},{name:"severity",type:"string",description:"urgent, warning, or all."},{name:"limit_type / limit_key",type:"string",description:"projects, prompt_capacity, workspace_seats, countries, credits."},{name:"plan / plan_code",type:"string",description:"Plan code filter."},{name:"sort",type:"string",description:"severity/default, percent, type, plan, organization."},{name:"page / per_page",type:"integer",description:"Pagination. per_page max 100."}]}],uu=`${mD}/mcp`,Szt=`{ 24901 "url": "${uu}", 24902 "headers": { 24903 "X-Admin-Api-Key": "$CEYO_ADMIN_API_KEY" 24904 } 24905}`,kzt=btoa(JSON.stringify({url:uu,headers:{"X-Admin-Api-Key":"$CEYO_ADMIN_API_KEY"}})),$zt=`cursor://anysphere.cursor-deeplink/mcp/install?name=ceyo-admin&config=${encodeURIComponent(kzt)}`,$8=`{ 24906 "mcpServers": { 24907 "ceyo-admin": { 24908 "command": "npx", 24909 "args": [ 24910 "mcp-remote", 24911 "${uu}", 24912 "--header", 24913 "X-Admin-Api-Key: $CEYO_ADMIN_API_KEY" 24914 ] 24915 } 24916 } 24917}`,Izt=`curl "${uu}" \\ 24918 -H "Content-Type: application/json" \\ 24919 -H "X-Admin-Api-Key: $CEYO_ADMIN_API_KEY" \\ 24920 -d '{ 24921 "jsonrpc": "2.0", 24922 "id": 1, 24923 "method": "initialize", 24924 "params": {} 24925 }'`,mpe=`{ 24926 "jsonrpc": "2.0", 24927 "id": 2, 24928 "method": "tools/list", 24929 "params": {} 24930}`,hpe=`{ 24931 "jsonrpc": "2.0", 24932 "id": 3, 24933 "method": "tools/call", 24934 "params": { 24935 "name": "list_workspaces", 24936 "arguments": { 24937 "q": "acme", 24938 "page": 1, 24939 "per_page": 10 24940 } 24941 } 24942}`;function fte(e){return e?.length?e.map(n=>`- \`${n.name}\` (${n.type}): ${n.description}`).join(` 24943`):"No parameters."}function Pzt(e){const n=k8.map(r=>`## ${r.method} ${r.path} 24944 24945Scope: \`${r.scope}\` 24946 24947${r.summary} 24948 24949### Request Params 24950${fte(r.params)} 24951 24952### Response Fields 24953${r.response.map(o=>`- \`${o}\``).join(` 24954`)} 24955 24956### Example Response 24957\`\`\`json 24958${r.example} 24959\`\`\``).join(` 24960 24961`),i=hD.map(r=>`## ${r.name} 24962 24963Scope: \`${r.scope}\` 24964 24965${r.description} 24966 24967### Arguments 24968${fte(r.arguments)}`).join(` 24969 24970`);return`# Ceyo Internal Admin API & MCP Agent Context 24971 24972This document is for internal agents and teammates using Ceyo admin programmatic access. Treat all data returned by these endpoints and tools as internal admin data. 24973 24974Configured API base URL: \`${e}\` 24975 24976## What You Can Ask 24977 24978- Which workspaces are active, deleted, trialing, canceled, or past due?
24979- Which subscriptions are active, exempted, paying, trialing, or canceled? 24980- Which customers are close to usage limits? 24981- Which workspaces are consuming the most credits, and why? 24982- For workspace 42, page through the credit ledger and explain usage by reason/resource. 24983- Which projects have failed, running, or scheduled runs? 24984- Which projects have site audit findings or AI optimization actions? 24985- Which projects gained or lost AI visibility, citations, and competitor position? 24986- What did AI models answer for a specific customer prompt? 24987- Which users are members of a workspace or project, and what roles do they have? 24988- Which growth lifecycle accounts need follow-up? 24989 24990## Safety And Access Rules 24991 24992- Base REST URL: \`${mD}\` 24993- Base REST path: \`${upe}\` 24994- Admin MCP endpoint: \`${uu}\` 24995- Authentication header: \`X-Admin-Api-Key: <admin-api-key>\` 24996- \`Authorization: Bearer <admin-api-key>\` is also accepted. 24997- Requests must come from an IP allowed by \`ADMIN_ALLOWED_IPS\`. 24998- Use the smallest required scope. \`admin:read\` can read all current admin API and MCP tools. 24999- Missing or invalid keys return HTTP \`401\`; missing scopes return HTTP \`403\` for REST or an MCP tool error for MCP. 25000 25001## Scopes 25002 25003- \`admin:read\`: all current read tools/endpoints 25004- \`health:read\`: health 25005- \`workspaces:read\`: workspace list/detail 25006- \`credits:read\`: credit overview, credit ledgers, workspace credit summaries, and resource rollups 25007- \`projects:read\`: project list/detail, visibility insights, prompt responses/citations, project actions, site audit pages/issues, and summaries 25008- \`users:read\`: user list/detail and memberships 25009- \`billing:read\`: billing subscriptions 25010- \`runs:read\`: project runs 25011- \`growth:read\`: growth lifecycle and limits 25012 25013## REST Setup Example 25014 25015\`\`\`bash 25016${ppe} 25017\`\`\` 25018 25019# REST Endpoints 25020 25021${n} 25022 25023# MCP Quickstart 25024 25025Configure a remote MCP client with: 25026 25027\`\`\`json 25028${Szt} 25029\`\`\` 25030 25031Claude Desktop / mcp-remote style: 25032 25033\`\`\`json 25034${$8} 25035\`\`\` 25036 25037List visible tools first. The server only returns tools allowed by the key scopes. 25038 25039\`\`\`json 25040${mpe} 25041\`\`\` 25042 25043Call a tool: 25044 25045\`\`\`json 25046${hpe} 25047\`\`\` 25048 25049# MCP Tools 25050 25051${i} 25052`}const fpe=Tn` 25053 from { opacity: 0; transform: translateY(6px); } 25054 to { opacity: 1; transform: translateY(0); } 25055`,Azt=p.div.withConfig({displayName:"AdminApiDocs__Wrap",componentId:"sc-1617wq2-0"})` 25056 min-height: 100%; 25057 padding: 1.25rem 1.25rem 2rem; 25058 background: ${At}; 25059 color: ${O}; 25060`,Nzt=p.div.withConfig({displayName:"AdminApiDocs__Max",componentId:"sc-1617wq2-1"})` 25061 max-width: 78rem; 25062 margin: 0 auto; 25063`,zzt=p.div.withConfig({displayName:"AdminApiDocs__Hero",componentId:"sc-1617wq2-2"})` 25064 border: 1px solid ${Rt}; 25065 border-radius: 1rem; 25066 background: ${Z}; 25067 box-shadow: 0 16px 40px rgba(17, 24, 39, 0.08); 25068 padding: 1.25rem; 25069 animation: ${fpe} 180ms ease both; 25070`,Tzt=p.div.withConfig({displayName:"AdminApiDocs__HeroTop",componentId:"sc-1617wq2-3"})` 25071 display: flex; 25072 align-items: flex-start; 25073 justify-content: space-between; 25074 gap: 1rem; 25075 25076 @media (max-width: 760px) { 25077 flex-direction: column; 25078 } 25079`,Ezt=p.div.withConfig({displayName:"AdminApiDocs__HeroActions",componentId:"sc-1617wq2-4"})` 25080 display: inline-flex; 25081 align-items: center; 25082 gap: 0.5rem; 25083 flex-wrap: wrap; 25084 justify-content: flex-end; 25085 25086 @media (max-width: 760px) { 25087 justify-content: flex-start; 25088 } 25089`,dP=p.button.withConfig({displayName:"AdminApiDocs__ActionButton",componentId:"sc-1617wq2-5"})` 25090 border: 1px solid ${({$primary:e})=>e?ot:V}; 25091 border-radius: 0.7rem; 25092 background: ${({$primary:e})=>e?ot:Z}; 25093 color: ${({$primary:e})=>e?Z:O}; 25094 display: inline-flex; 25095 align-items: center; 25096 gap: 0.4rem; 25097 min-height: 2.1rem; 25098 padding: 0.45rem 0.7rem; 25099 cursor: pointer; 25100 font-size: 0.78rem; 25101 font-weight: 850; 25102 25103 &:hover { 25104 opacity: 0.86; 25105 } 25106`,Mzt=p.div.withConfig({displayName:"AdminApiDocs__TitleRow",componentId:"sc-1617wq2-6"})` 25107 display: inline-flex; 25108 align-items: center; 25109 gap: 0.625rem; 25110 color: ${O}; 25111 font-size: 1.125rem; 25112 font-weight: 900; 25113`,Rzt=p.div.withConfig({displayName:"AdminApiDocs__Sub",componentId:"sc-1617wq2-7"})` 25114 margin-top: 0.5rem; 25115 color: ${z}; 25116 font-size: 0.875rem; 25117 line-height: 1.5; 25118 max-width: 58rem; 25119`,Ozt=p.div.withConfig({displayName:"AdminApiDocs__Tabs",componentId:"sc-1617wq2-8"})` 25120 display: inline-flex; 25121 gap: 0.25rem; 25122 padding: 0.25rem; 25123 border: 1px solid ${V}; 25124 border-radius: 0.95rem; 25125 background: ${$e}; 25126 margin-top: 1rem; 25127`,gte=p.button.withConfig({displayName:"AdminApiDocs__TabButton",componentId:"sc-1617wq2-9"})` 25128 border: 1px solid transparent; 25129 border-radius: 0.75rem; 25130 background: ${({$active:e})=>e?Z:"transparent"}; 25131 color: ${({$active:e})=>e?ot:z}; 25132 box-shadow: ${({$active:e})=>e?"0 1px 1px rgba(0,0,0,0.04)":"none"}; 25133 padding: 0.5rem 0.8rem; 25134 display: inline-flex; 25135 align-items: center; 25136 gap: 0.5rem; 25137 cursor: pointer; 25138 font-size: 0.8125rem; 25139 font-weight: 850; 25140`,yte=p.div.withConfig({displayName:"AdminApiDocs__Grid",componentId:"sc-1617wq2-10"})` 25141 margin-top: 1rem; 25142 display: grid; 25143 grid-template-columns: 18rem minmax(0, 1fr); 25144 gap: 1rem; 25145 align-items: start; 25146 25147 @media (max-width: 920px) { 25148 grid-template-columns: 1fr; 25149 } 25150`,xte=p.div.withConfig({displayName:"AdminApiDocs__Side",componentId:"sc-1617wq2-11"})` 25151 position: sticky; 25152 top: 1rem; 25153 overflow: hidden; 25154 min-width: 0; 25155 border: 1px solid ${Rt}; 25156 border-radius: 1rem; 25157 background: ${Z}; 25158 padding: 0.85rem; 25159 25160 @media (max-width: 920px) { 25161 position: relative; 25162 top: auto; 25163 } 25164`,bte=p.div.withConfig({displayName:"AdminApiDocs__SideTitle",componentId:"sc-1617wq2-12"})` 25165 color: ${O}; 25166 font-size: 0.8rem; 25167 font-weight: 900; 25168 margin-bottom: 0.5rem; 25169`,vte=p.div.withConfig({displayName:"AdminApiDocs__AnchorList",componentId:"sc-1617wq2-13"})` 25170 display: grid; 25171 gap: 0.25rem; 25172`,s5=p.a.withConfig({displayName:"AdminApiDocs__Anchor",componentId:"sc-1617wq2-14"})` 25173 display: block; 25174 overflow: hidden; 25175 text-overflow: ellipsis; 25176 white-space: nowrap; 25177 color: ${z}; 25178 text-decoration: none; 25179 font-size: 0.78rem; 25180 font-weight: 750; 25181 border-radius: 0.55rem; 25182 padding: 0.35rem 0.45rem; 25183 25184 &:hover { 25185 color: ${ot}; 25186 background: ${cn}; 25187 } 25188`,wte=p.div.withConfig({displayName:"AdminApiDocs__Content",componentId:"sc-1617wq2-15"})` 25189 display: grid; 25190 gap: 1rem; 25191 min-width: 0; 25192`,qy=p.section.withConfig({displayName:"AdminApiDocs__Card",componentId:"sc-1617wq2-16"})` 25193 border: 1px solid ${Rt}; 25194 border-radius: 1rem; 25195 background: ${Z}; 25196 box-shadow: 0 10px 24px rgba(17, 24, 39, 0.06); 25197 overflow: hidden; 25198 animation: ${fpe} 180ms ease both; 25199`,Gy=p.div.withConfig({displayName:"AdminApiDocs__CardBody",componentId:"sc-1617wq2-17"})` 25200 padding: 1rem; 25201`,O1=p.div.withConfig({displayName:"AdminApiDocs__CardTitle",componentId:"sc-1617wq2-18"})` 25202 display: inline-flex; 25203 align-items: center; 25204 gap: 0.5rem; 25205 color: ${O}; 25206 font-size: 0.95rem; 25207 font-weight: 900; 25208`,zu=p.div.withConfig({displayName:"AdminApiDocs__CardText",componentId:"sc-1617wq2-19"})` 25209 margin-top: 0.45rem; 25210 color: ${z}; 25211 font-size: 0.84rem; 25212 line-height: 1.5; 25213`,Dzt=p.div.withConfig({displayName:"AdminApiDocs__PlatformGrid",componentId:"sc-1617wq2-20"})` 25214 display: grid; 25215 gap: 0.75rem; 25216 margin-top: 0.85rem; 25217 25218 @media (min-width: 760px) { 25219 grid-template-columns: repeat(5, minmax(0, 1fr)); 25220 } 25221`,Lzt=p.div.withConfig({displayName:"AdminApiDocs__MobilePlatformDetails",componentId:"sc-1617wq2-21"})` 25222 display: block; 25223 25224 @media (min-width: 760px) { 25225 display: none; 25226 } 25227`,Bzt=p.div.withConfig({displayName:"AdminApiDocs__DesktopPlatformDetails",componentId:"sc-1617wq2-22"})` 25228 display: none; 25229 margin-top: 0.85rem; 25230 25231 @media (min-width: 760px) { 25232 display: block; 25233 } 25234`,Fzt=p.button.withConfig({displayName:"AdminApiDocs__PlatformButton",componentId:"sc-1617wq2-23"})` 25235 border: 1px solid ${({$active:e})=>e?O:V}; 25236 border-radius: 0.875rem; 25237 background: ${Z}; 25238 padding: 0.875rem; 25239 display: grid; 25240 gap: 0.65rem; 25241 min-width: 0; 25242 cursor: pointer; 25243 text-align: left; 25244 transition: border-color 0.15s, background 0.15s; 25245 25246 &:hover { 25247 border-color: ${O}; 25248 background: ${At}; 25249 } 25250`,Wzt=p.div.withConfig({displayName:"AdminApiDocs__PlatformButtonTop",componentId:"sc-1617wq2-24"})` 25251 display: flex; 25252 align-items: center; 25253 justify-content: space-between; 25254 gap: 0.5rem; 25255`,Uzt=p.span.withConfig({displayName:"AdminApiDocs__PlatformIcon",componentId:"sc-1617wq2-25"})` 25256 width: 2.125rem; 25257 height: 2.125rem; 25258 border-radius: 999px; 25259 display: inline-grid; 25260 place-items: center; 25261 background: ${Z}; 25262 color: ${O}; 25263 border: 1px solid ${V}; 25264 flex-shrink: 0; 25265 overflow: hidden; 25266`,Hzt=p.img.withConfig({displayName:"AdminApiDocs__PlatformLogoImg",componentId:"sc-1617wq2-26"})` 25267 width: 1.35rem; 25268 height: 1.35rem; 25269 border-radius: 999px; 25270 border: 0; 25271 background: transparent; 25272 object-fit: contain; 25273 display: block; 25274`,qzt=p.span.withConfig({displayName:"AdminApiDocs__SetupPill",componentId:"sc-1617wq2-27"})` 25275 border-radius: 999px; 25276 border: 1px solid ${({$active:e})=>e?O:V}; 25277 background: ${({$active:e})=>e?O:Z}; 25278 color: ${({$active:e})=>e?Z:z}; 25279 padding: 0.2rem 0.45rem; 25280 font-size: 0.6875rem; 25281 font-weight: 850; 25282 white-space: nowrap; 25283`,Gzt=p.div.withConfig({displayName:"AdminApiDocs__PlatformName",componentId:"sc-1617wq2-28"})` 25284 color: ${O}; 25285 font-size: 0.875rem; 25286 font-weight: 850; 25287`,Dj=p.div.withConfig({displayName:"AdminApiDocs__PlatformPanel",componentId:"sc-1617wq2-29"})` 25288 border: 1px solid ${V}; 25289 border-radius: 1rem; 25290 background: ${Z}; 25291 padding: 1rem; 25292 display: grid; 25293 gap: 1rem; 25294 min-width: 0; 25295`,Lj=p.div.withConfig({displayName:"AdminApiDocs__PlatformPanelHeader",componentId:"sc-1617wq2-30"})` 25296 display: flex; 25297 align-items: flex-start; 25298 justify-content: space-between; 25299 gap: 1rem; 25300 25301 @media (max-width: 640px) { 25302 flex-direction: column; 25303 } 25304`,Bj=p.div.withConfig({displayName:"AdminApiDocs__PlatformPanelTitle",componentId:"sc-1617wq2-31"})` 25305 color: ${O}; 25306 font-size: 0.95rem; 25307 font-weight: 850; 25308`,Fj=p.div.withConfig({displayName:"AdminApiDocs__PlatformPanelText",componentId:"sc-1617wq2-32"})` 25309 color: ${z}; 25310 font-size: 0.84rem; 25311 line-height: 1.5; 25312 margin-top: 0.25rem; 25313`,kE=p.div.withConfig({displayName:"AdminApiDocs__ConnectorActions",componentId:"sc-1617wq2-33"})` 25314 display: flex; 25315 flex-wrap: wrap; 25316 gap: 0.75rem; 25317 25318 @media (max-width: 640px) { 25319 width: 100%; 25320 25321 > * { 25322 width: 100%; 25323 } 25324 } 25325`,Vzt=p.a.withConfig({displayName:"AdminApiDocs__ConnectorLink",componentId:"sc-1617wq2-34"})` 25326 display: inline-flex; 25327 align-items: center; 25328 justify-content: center; 25329 gap: 0.45rem; 25330 border: 1px solid ${({$variant:e})=>e==="secondary"?V:O}; 25331 border-radius: 0.5rem; 25332 background: ${({$variant:e})=>e==="secondary"?Z:O}; 25333 color: ${({$variant:e})=>e==="secondary"?O:Z}; 25334 min-height: 2rem; 25335 padding: 0.45rem 0.75rem; 25336 font-size: 0.8125rem; 25337 font-weight: 800; 25338 text-decoration: none; 25339 line-height: 1; 25340 25341 &:hover { 25342 background: ${({$variant:e})=>e==="secondary"?At:O}; 25343 opacity: ${({$variant:e})=>e==="secondary"?1:.82}; 25344 } 25345`,Kzt=p.div.withConfig({displayName:"AdminApiDocs__DetailBody",componentId:"sc-1617wq2-35"})` 25346 display: grid; 25347 gap: 0.75rem; 25348`,Yzt=p.div.withConfig({displayName:"AdminApiDocs__OptionGrid",componentId:"sc-1617wq2-36"})` 25349 display: grid; 25350 gap: 0.75rem; 25351`,jte=p.div.withConfig({displayName:"AdminApiDocs__OptionRow",componentId:"sc-1617wq2-37"})` 25352 border: 1px solid ${V}; 25353 border-radius: 0.875rem; 25354 background: ${At}; 25355 padding: 0.875rem; 25356 display: flex; 25357 align-items: flex-start; 25358 justify-content: space-between; 25359 gap: 1rem; 25360 25361 @media (max-width: 640px) { 25362 flex-direction: column; 25363 } 25364`,_te=p.div.withConfig({displayName:"AdminApiDocs__OptionMain",componentId:"sc-1617wq2-38"})` 25365 display: grid; 25366 gap: 0.35rem; 25367 min-width: 0; 25368`,Cte=p.div.withConfig({displayName:"AdminApiDocs__OptionTitleRow",componentId:"sc-1617wq2-39"})` 25369 display: flex; 25370 align-items: center; 25371 flex-wrap: wrap; 25372 gap: 0.5rem; 25373`,Ste=p.div.withConfig({displayName:"AdminApiDocs__OptionTitle",componentId:"sc-1617wq2-40"})` 25374 color: ${O}; 25375 font-size: 0.875rem; 25376 font-weight: 850; 25377`,kte=p.div.withConfig({displayName:"AdminApiDocs__OptionText",componentId:"sc-1617wq2-41"})` 25378 color: ${z}; 25379 font-size: 0.8125rem; 25380 line-height: 1.45; 25381`,$te=p.span.withConfig({displayName:"AdminApiDocs__OptionBadge",componentId:"sc-1617wq2-42"})` 25382 border: 1px solid ${V}; 25383 border-radius: 999px; 25384 background: ${Z}; 25385 color: ${z}; 25386 padding: 0.15rem 0.45rem; 25387 font-size: 0.6875rem; 25388 font-weight: 850; 25389`,Ite=p.div.withConfig({displayName:"AdminApiDocs__ValueGrid",componentId:"sc-1617wq2-43"})` 25390 display: grid; 25391 gap: 0.75rem; 25392 25393 @media (min-width: 720px) { 25394 grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); 25395 } 25396`,Zx=p.div.withConfig({displayName:"AdminApiDocs__ValueCard",componentId:"sc-1617wq2-44"})` 25397 border: 1px solid ${V}; 25398 border-radius: 0.75rem; 25399 background: ${At}; 25400 padding: 0.75rem; 25401 display: grid; 25402 gap: 0.4rem; 25403 min-width: 0; 25404`,Jx=p.div.withConfig({displayName:"AdminApiDocs__ValueLabel",componentId:"sc-1617wq2-45"})` 25405 font-size: 0.75rem; 25406 font-weight: 800; 25407 color: ${z}; 25408 text-transform: uppercase; 25409 letter-spacing: 0.03em; 25410`,eb=p.div.withConfig({displayName:"AdminApiDocs__ValueBox",componentId:"sc-1617wq2-46"})` 25411 background: ${Z}; 25412 border: 1px solid ${V}; 25413 border-radius: 0.65rem; 25414 color: ${O}; 25415 font-size: 0.8125rem; 25416 display: flex; 25417 align-items: center; 25418 justify-content: space-between; 25419 gap: 0.5rem; 25420 min-height: 2.35rem; 25421 min-width: 0; 25422 padding: 0.45rem 0.6rem; 25423`,tb=p.div.withConfig({displayName:"AdminApiDocs__ValueText",componentId:"sc-1617wq2-47"})` 25424 min-width: 0; 25425 overflow: hidden; 25426 text-overflow: ellipsis; 25427 white-space: nowrap; 25428 font-size: 0.8125rem; 25429 25430 @media (max-width: 640px) { 25431 white-space: normal;
25432 overflow-wrap: anywhere; 25433 } 25434`,nb=p.button.withConfig({displayName:"AdminApiDocs__CopyIconButton",componentId:"sc-1617wq2-48"})` 25435 display: inline-flex; 25436 align-items: center; 25437 justify-content: center; 25438 flex-shrink: 0; 25439 width: 1.75rem; 25440 height: 1.75rem; 25441 border: 1px solid ${({$copied:e})=>e?Vt:V}; 25442 border-radius: 0.375rem; 25443 background: ${Z}; 25444 color: ${({$copied:e})=>e?Vt:z}; 25445 cursor: pointer; 25446 padding: 0; 25447 25448 &:hover { 25449 background: ${At}; 25450 color: ${O}; 25451 } 25452`,$E=p.div.withConfig({displayName:"AdminApiDocs__InlineNote",componentId:"sc-1617wq2-49"})` 25453 color: ${z}; 25454 font-size: 0.75rem; 25455 line-height: 1.45; 25456`,gpe=p.div.withConfig({displayName:"AdminApiDocs__SetupGrid",componentId:"sc-1617wq2-50"})` 25457 display: grid; 25458 grid-template-columns: repeat(3, minmax(0, 1fr)); 25459 gap: 0.75rem; 25460 margin-top: 0.85rem; 25461 25462 @media (max-width: 860px) { 25463 grid-template-columns: 1fr; 25464 } 25465`,Pb=p.div.withConfig({displayName:"AdminApiDocs__SetupItem",componentId:"sc-1617wq2-51"})` 25466 border: 1px solid ${V}; 25467 border-radius: 0.85rem; 25468 background: ${At}; 25469 padding: 0.8rem; 25470`,Ab=p.div.withConfig({displayName:"AdminApiDocs__SetupIcon",componentId:"sc-1617wq2-52"})` 25471 width: 2.1rem; 25472 height: 2.1rem; 25473 border-radius: 0.75rem; 25474 display: inline-flex; 25475 align-items: center; 25476 justify-content: center; 25477 color: ${Vt}; 25478 background: ${si}; 25479 border: 1px solid ${Mo}; 25480`,Nb=p.div.withConfig({displayName:"AdminApiDocs__SetupLabel",componentId:"sc-1617wq2-53"})` 25481 margin-top: 0.55rem; 25482 color: ${O}; 25483 font-size: 0.82rem; 25484 font-weight: 900; 25485`,zb=p.div.withConfig({displayName:"AdminApiDocs__SetupText",componentId:"sc-1617wq2-54"})` 25486 margin-top: 0.25rem; 25487 color: ${z}; 25488 font-size: 0.78rem; 25489 line-height: 1.45; 25490`,Tb=p.pre.withConfig({displayName:"AdminApiDocs__CodeBlock",componentId:"sc-1617wq2-55"})` 25491 margin: 0.85rem 0 0; 25492 padding: 0.85rem; 25493 border: 1px solid ${V}; 25494 border-radius: 0.85rem; 25495 background: ${_ne}; 25496 color: ${O}; 25497 overflow-x: auto; 25498 font-size: 0.78rem; 25499 line-height: 1.5; 25500`,dr=p.code.withConfig({displayName:"AdminApiDocs__InlineCode",componentId:"sc-1617wq2-56"})` 25501 background: ${jne}; 25502 border-radius: 0.35rem; 25503 padding: 0.05rem 0.25rem; 25504 color: ${O}; 25505`,Xzt=p.div.withConfig({displayName:"AdminApiDocs__EndpointHead",componentId:"sc-1617wq2-57"})` 25506 border-bottom: 1px solid ${V}; 25507 background: ${At}; 25508 padding: 0.85rem 1rem; 25509 display: flex; 25510 align-items: flex-start; 25511 justify-content: space-between; 25512 gap: 1rem; 25513 25514 @media (max-width: 760px) { 25515 flex-direction: column; 25516 } 25517`,Qzt=p.div.withConfig({displayName:"AdminApiDocs__EndpointPath",componentId:"sc-1617wq2-58"})` 25518 display: flex; 25519 align-items: center; 25520 gap: 0.5rem; 25521 flex-wrap: wrap; 25522`,Zzt=p.span.withConfig({displayName:"AdminApiDocs__Method",componentId:"sc-1617wq2-59"})` 25523 border: 1px solid ${Mo}; 25524 border-radius: 999px; 25525 background: ${si}; 25526 color: ${Vt}; 25527 padding: 0.16rem 0.45rem; 25528 font-size: 0.66rem; 25529 font-weight: 950; 25530`,Jzt=p.code.withConfig({displayName:"AdminApiDocs__Path",componentId:"sc-1617wq2-60"})` 25531 color: ${O}; 25532 font-size: 0.86rem; 25533 font-weight: 850; 25534`,ype=p.span.withConfig({displayName:"AdminApiDocs__Scope",componentId:"sc-1617wq2-61"})` 25535 border: 1px solid ${V}; 25536 border-radius: 999px; 25537 background: ${Z}; 25538 color: ${z}; 25539 padding: 0.2rem 0.5rem; 25540 font-size: 0.68rem; 25541 font-weight: 850; 25542 white-space: nowrap; 25543`,xpe=p.div.withConfig({displayName:"AdminApiDocs__EndpointSummary",componentId:"sc-1617wq2-62"})` 25544 margin-top: 0.45rem; 25545 color: ${z}; 25546 font-size: 0.82rem; 25547 line-height: 1.45; 25548`,bpe=p.div.withConfig({displayName:"AdminApiDocs__Columns",componentId:"sc-1617wq2-63"})` 25549 display: grid; 25550 grid-template-columns: 1fr 1fr; 25551 gap: 1rem; 25552 25553 @media (max-width: 860px) { 25554 grid-template-columns: 1fr; 25555 } 25556`,yy=p.div.withConfig({displayName:"AdminApiDocs__SectionLabel",componentId:"sc-1617wq2-64"})` 25557 color: ${O}; 25558 font-size: 0.78rem; 25559 font-weight: 900; 25560 letter-spacing: 0.04em; 25561 text-transform: uppercase; 25562 margin-bottom: 0.55rem; 25563`,fD=p.div.withConfig({displayName:"AdminApiDocs__ParamTable",componentId:"sc-1617wq2-65"})` 25564 border: 1px solid ${V}; 25565 border-radius: 0.85rem; 25566 overflow: hidden; 25567`,yb=p.div.withConfig({displayName:"AdminApiDocs__ParamRow",componentId:"sc-1617wq2-66"})` 25568 display: grid; 25569 grid-template-columns: 9rem 8rem minmax(0, 1fr); 25570 gap: 0.75rem; 25571 padding: 0.55rem 0.65rem; 25572 border-top: 1px solid ${$e}; 25573 color: ${z}; 25574 font-size: 0.76rem; 25575 line-height: 1.4; 25576 25577 &:first-child { 25578 border-top: 0; 25579 } 25580 25581 @media (max-width: 760px) { 25582 grid-template-columns: 1fr; 25583 gap: 0.2rem; 25584 } 25585`,xb=p.div.withConfig({displayName:"AdminApiDocs__ParamName",componentId:"sc-1617wq2-67"})` 25586 color: ${O}; 25587 font-weight: 850; 25588`,bb=p.div.withConfig({displayName:"AdminApiDocs__ParamType",componentId:"sc-1617wq2-68"})` 25589 color: ${Pe}; 25590 font-weight: 800; 25591`,eTt=p.div.withConfig({displayName:"AdminApiDocs__FieldList",componentId:"sc-1617wq2-69"})` 25592 display: flex; 25593 flex-wrap: wrap; 25594 gap: 0.35rem; 25595`,tTt=p.span.withConfig({displayName:"AdminApiDocs__Field",componentId:"sc-1617wq2-70"})` 25596 border: 1px solid ${V}; 25597 border-radius: 999px; 25598 background: ${At}; 25599 color: ${z}; 25600 padding: 0.2rem 0.45rem; 25601 font-size: 0.7rem; 25602 font-weight: 750; 25603`,nTt=p.ol.withConfig({displayName:"AdminApiDocs__Steps",componentId:"sc-1617wq2-71"})` 25604 margin: 0.85rem 0 0; 25605 padding-left: 1.25rem; 25606 display: grid; 25607 gap: 0.55rem; 25608 color: ${z}; 25609 font-size: 0.84rem; 25610 line-height: 1.5; 25611`,iTt=p.div.withConfig({displayName:"AdminApiDocs__ToolGrid",componentId:"sc-1617wq2-72"})` 25612 display: grid; 25613 gap: 0.75rem; 25614`,rTt=p.div.withConfig({displayName:"AdminApiDocs__ToolCard",componentId:"sc-1617wq2-73"})` 25615 border: 1px solid ${V}; 25616 border-radius: 0.9rem; 25617 background: ${Z}; 25618 overflow: hidden; 25619`,oTt=p.div.withConfig({displayName:"AdminApiDocs__ToolHeader",componentId:"sc-1617wq2-74"})` 25620 display: flex; 25621 align-items: flex-start; 25622 justify-content: space-between; 25623 gap: 0.75rem; 25624 padding: 0.75rem 0.85rem; 25625 background: ${At}; 25626 border-bottom: 1px solid ${V}; 25627 25628 @media (max-width: 720px) { 25629 flex-direction: column; 25630 } 25631`,sTt=p.code.withConfig({displayName:"AdminApiDocs__ToolName",componentId:"sc-1617wq2-75"})` 25632 color: ${O}; 25633 font-size: 0.84rem; 25634 font-weight: 900; 25635`,aTt=p.div.withConfig({displayName:"AdminApiDocs__ToolBody",componentId:"sc-1617wq2-76"})` 25636 padding: 0.85rem; 25637`;function lTt(){const[e,n]=l.useState("rest"),[i,r]=l.useState(!1),o=l.useMemo(()=>k8.map(m=>({id:m.id,label:m.path})),[]),s=l.useMemo(()=>[{id:"mcp-quickstart",label:"Quickstart"},{id:"mcp-auth",label:"Client config"},{id:"mcp-protocol",label:"Protocol"},{id:"mcp-tools",label:"Tools"},{id:"mcp-errors",label:"Errors"}],[]),a=l.useMemo(()=>Pzt(dpe),[]),c=async()=>{await navigator.clipboard.writeText(a),r(!0),window.setTimeout(()=>r(!1),1500)},u=()=>{const m=new Blob([a],{type:"text/markdown;charset=utf-8"}),h=URL.createObjectURL(m),g=document.createElement("a");g.href=h,g.download="ceyo-admin-api-mcp-agent-context.md",document.body.appendChild(g),g.click(),g.remove(),URL.revokeObjectURL(h)};return t.jsx(Azt,{children:t.jsxs(Nzt,{children:[t.jsxs(zzt,{children:[t.jsxs(Tzt,{children:[t.jsxs("div",{children:[t.jsxs(Mzt,{children:[t.jsx(vP,{size:20}),"Admin API & MCP Docs"]}),t.jsx(Rzt,{children:"Internal reference for admin-only programmatic access. These endpoints use admin API keys, admin scopes, and the same admin IP allowlist as the admin UI."})]}),t.jsxs(Ezt,{children:[t.jsxs(dP,{type:"button",$primary:!0,onClick:c,children:[t.jsx(so,{size:15}),i?"Copied":"Copy Agent Context"]}),t.jsxs(dP,{type:"button",onClick:u,children:[t.jsx(wy,{size:15}),"Download Markdown"]})]})]}),t.jsxs(Ozt,{children:[t.jsxs(gte,{$active:e==="rest",onClick:()=>n("rest"),children:[t.jsx(Nne,{size:16}),"REST API"]}),t.jsxs(gte,{$active:e==="mcp",onClick:()=>n("mcp"),children:[t.jsx(Hne,{size:16}),"MCP"]})]})]}),e==="rest"?t.jsxs(yte,{children:[t.jsxs(xte,{children:[t.jsx(bte,{children:"REST Endpoints"}),t.jsxs(vte,{children:[t.jsx(s5,{href:"#setup",children:"Setup"}),o.map(m=>t.jsx(s5,{href:`#${m.id}`,children:m.label},m.id))]})]}),t.jsxs(wte,{children:[t.jsx(fTt,{}),k8.map(m=>t.jsx(gTt,{endpoint:m},m.id))]})]}):t.jsxs(yte,{children:[t.jsxs(xte,{children:[t.jsx(bte,{children:"MCP Docs"}),t.jsxs(vte,{children:[s.map(m=>t.jsx(s5,{href:`#${m.id}`,children:m.label},m.id)),hD.map(m=>t.jsx(s5,{href:`#mcp-tool-${m.name}`,children:m.name},m.name))]})]}),t.jsxs(wte,{children:[t.jsx(cTt,{}),t.jsx(dTt,{}),t.jsx(uTt,{}),t.jsx(pTt,{}),t.jsx(hTt,{})]})]})]})})}function cTt(){return t.jsx(qy,{id:"mcp-quickstart",children:t.jsxs(Gy,{children:[t.jsxs(O1,{children:[t.jsx(Hne,{size:17}),"MCP Quickstart"]}),t.jsx(zu,{children:"Admin MCP exposes the same internal admin data as tools for Claude, Cursor, and other MCP clients. Use it only from the admin VPN/IP allowlist and with an admin API key that has the required read scopes."}),t.jsxs(gpe,{children:[t.jsxs(Pb,{children:[t.jsx(Ab,{children:t.jsx(Rc,{size:16})}),t.jsx(Nb,{children:"1. Create an admin API key"}),t.jsxs(zb,{children:["Create a key in Admin API Keys. Use ",t.jsx(dr,{children:"admin:read"})," for broad internal access or choose only the scopes needed by the client."]})]}),t.jsxs(Pb,{children:[t.jsx(Ab,{children:t.jsx(kP,{size:16})}),t.jsx(Nb,{children:"2. Configure the MCP endpoint"}),t.jsxs(zb,{children:["Endpoint: ",t.jsx(dr,{children:"/api/admin/v1/mcp"}),". Send the key as ",t.jsx(dr,{children:"X-Admin-Api-Key"}),"."]})]}),t.jsxs(Pb,{children:[t.jsx(Ab,{children:t.jsx(th,{size:16})}),t.jsx(Nb,{children:"3. Connect from an allowed IP"}),t.jsx(zb,{children:"The admin IP allowlist runs before MCP tool handling. A valid key alone is not enough."})]})]})]})})}function dTt(){const[e,n]=l.useState(null),[i,r]=l.useState(!1),[o,s]=l.useState(null),a=l.useMemo(()=>[{key:"claude",label:"Claude",setup:"Manual",icon:Dy,domain:"anthropic.com"},{key:"chatgpt",label:"ChatGPT",setup:"Coming soon",icon:Ane,domain:"openai.com"},{key:"n8n",label:"n8n",setup:"Manual",icon:Gne,domain:"n8n.io"},{key:"cursor",label:"Cursor",setup:"Deeplink",icon:V8,domain:"cursor.com"},{key:"other",label:"Other",setup:"Generic",icon:n_,domain:null}],[]),c=async(m,h)=>{await navigator.clipboard.writeText(m),s(h),window.setTimeout(()=>s(null),1500)},u=m=>m==="chatgpt"?t.jsx(Dj,{children:t.jsx(Lj,{children:t.jsxs("div",{children:[t.jsx(Bj,{children:"ChatGPT"}),t.jsx(Fj,{children:"ChatGPT setup requires OAuth support. Coming soon."})]})})}):m==="claude"?t.jsxs(Dj,{children:[t.jsx(Lj,{children:t.jsxs("div",{children:[t.jsx(Bj,{children:"Connect Admin MCP to Claude"}),t.jsx(Fj,{children:"Admin MCP currently works through Claude Desktop manual config."})]})}),t.jsxs(Yzt,{children:[t.jsx(jte,{children:t.jsxs(_te,{children:[t.jsxs(Cte,{children:[t.jsx(Ste,{children:"Claude.ai"}),t.jsx($te,{children:"Coming soon"})]}),t.jsx(kte,{children:"Remote Claude.ai setup requires OAuth support."})]})}),t.jsxs(jte,{children:[t.jsxs(_te,{children:[t.jsxs(Cte,{children:[t.jsx(Ste,{children:"Claude Desktop"}),t.jsx($te,{children:"Live"})]}),t.jsx(kte,{children:"Manual local config with the admin MCP endpoint and admin API key."})]}),t.jsx(kE,{children:t.jsxs(dP,{type:"button",onClick:()=>r(h=>!h),children:[i?t.jsx(qn,{size:16}):t.jsx(Gi,{size:16}),i?"Hide instructions":"Show instructions"]})})]})]}),i?t.jsxs(Kzt,{children:[t.jsxs(nTt,{children:[t.jsxs("li",{children:["Set ",t.jsx(dr,{children:"CEYO_ADMIN_API_KEY"})," to an active admin API key."]}),t.jsx("li",{children:"Paste this config into Claude Desktop and restart the app."})]}),t.jsx(Tb,{children:$8}),t.jsx(kE,{children:t.jsxs(dP,{type:"button",onClick:()=>c($8,"admin-claude-config"),children:[t.jsx(so,{size:15}),o==="admin-claude-config"?"Copied config":"Copy config"]})})]}):null]}):m==="cursor"?t.jsxs(Dj,{children:[t.jsxs(Lj,{children:[t.jsxs("div",{children:[t.jsx(Bj,{children:"Cursor"}),t.jsx(Fj,{children:"Install the admin MCP server entry in Curs
25637or."})]}),t.jsx(kE,{children:t.jsxs(Vzt,{href:$zt,children:[t.jsx(Q8,{size:15}),"Add to Cursor"]})})]}),t.jsx($E,{children:"After install, replace the API key placeholder with an active admin API key."})]}):m==="n8n"?t.jsxs(Dj,{children:[t.jsx(Lj,{children:t.jsxs("div",{children:[t.jsx(Bj,{children:"n8n"}),t.jsx(Fj,{children:"Add the admin MCP server through an MCP Client node."})]})}),t.jsxs(Ite,{children:[t.jsxs(Zx,{children:[t.jsx(Jx,{children:"Node"}),t.jsxs(eb,{children:[t.jsx(tb,{children:"MCP Client or MCP Client Tool"}),t.jsx(nb,{type:"button",$copied:o==="admin-n8n-node",onClick:()=>c("MCP Client or MCP Client Tool","admin-n8n-node"),"aria-label":"Copy n8n node",children:o==="admin-n8n-node"?t.jsx(Zn,{size:14}):t.jsx(so,{size:14})})]})]}),t.jsxs(Zx,{children:[t.jsx(Jx,{children:"Authentication"}),t.jsxs(eb,{children:[t.jsx(tb,{children:"Header Auth / Multiple Headers Auth"}),t.jsx(nb,{type:"button",$copied:o==="admin-n8n-auth",onClick:()=>c("Header Auth / Multiple Headers Auth","admin-n8n-auth"),"aria-label":"Copy n8n authentication",children:o==="admin-n8n-auth"?t.jsx(Zn,{size:14}):t.jsx(so,{size:14})})]})]}),t.jsxs(Zx,{children:[t.jsx(Jx,{children:"Header name"}),t.jsxs(eb,{children:[t.jsx(tb,{children:"X-Admin-Api-Key"}),t.jsx(nb,{type:"button",$copied:o==="admin-n8n-header",onClick:()=>c("X-Admin-Api-Key","admin-n8n-header"),"aria-label":"Copy n8n header",children:o==="admin-n8n-header"?t.jsx(Zn,{size:14}):t.jsx(so,{size:14})})]})]}),t.jsxs(Zx,{children:[t.jsx(Jx,{children:"MCP URL"}),t.jsxs(eb,{children:[t.jsx(tb,{title:uu,children:uu}),t.jsx(nb,{type:"button",$copied:o==="admin-n8n-url",onClick:()=>c(uu,"admin-n8n-url"),"aria-label":"Copy n8n MCP URL",children:o==="admin-n8n-url"?t.jsx(Zn,{size:14}):t.jsx(so,{size:14})})]})]})]}),t.jsxs($E,{children:["Paste an admin API key as the ",t.jsx(dr,{children:"X-Admin-Api-Key"})," header value."]})]}):t.jsxs(Dj,{children:[t.jsx(Lj,{children:t.jsxs("div",{children:[t.jsx(Bj,{children:"Other MCP client"}),t.jsx(Fj,{children:"Copy the values your client asks for."})]})}),t.jsxs(Ite,{children:[t.jsxs(Zx,{children:[t.jsx(Jx,{children:"MCP Endpoint"}),t.jsxs(eb,{children:[t.jsx(tb,{title:uu,children:uu}),t.jsx(nb,{type:"button",$copied:o==="admin-mcp-endpoint",onClick:()=>c(uu,"admin-mcp-endpoint"),"aria-label":"Copy MCP endpoint",children:o==="admin-mcp-endpoint"?t.jsx(Zn,{size:14}):t.jsx(so,{size:14})})]})]}),t.jsxs(Zx,{children:[t.jsx(Jx,{children:"Auth Header"}),t.jsxs(eb,{children:[t.jsx(tb,{children:"X-Admin-Api-Key"}),t.jsx(nb,{type:"button",$copied:o==="admin-mcp-header",onClick:()=>c("X-Admin-Api-Key","admin-mcp-header"),"aria-label":"Copy auth header",children:o==="admin-mcp-header"?t.jsx(Zn,{size:14}):t.jsx(so,{size:14})})]})]})]}),t.jsx($E,{children:"Ask your MCP client to list tools to verify the connection."})]});return t.jsx(qy,{id:"mcp-auth",children:t.jsxs(Gy,{children:[t.jsxs(O1,{children:[t.jsx(Dne,{size:17}),"Client Configuration"]}),t.jsx(zu,{children:"MCP clients connect to the admin endpoint with the same admin API key header used by REST."}),t.jsx(Dzt,{children:a.map(m=>{const h=e===m.key,g=m.icon;return t.jsxs(l.Fragment,{children:[t.jsxs(Fzt,{type:"button",$active:h,onClick:()=>n(x=>x===m.key?null:m.key),"aria-pressed":h,children:[t.jsxs(Wzt,{children:[t.jsx(Uzt,{children:t.jsx($u,{domain:m.domain,alt:`${m.label} logo`,size:22,Img:Hzt,fallback:t.jsx(g,{size:17})})}),t.jsx(qzt,{$active:h,children:m.setup})]}),t.jsx(Gzt,{children:m.label})]}),h?t.jsx(Lzt,{children:u(m.key)},`${m.key}-mobile-details`):null]},m.key)})}),e?t.jsx(Bzt,{children:u(e)}):null,t.jsxs(zu,{children:["Required scopes are enforced per tool. ",t.jsx(dr,{children:"admin:read"})," can call every current admin MCP tool; otherwise assign resource scopes such as ",t.jsx(dr,{children:"workspaces:read"}),", ",t.jsx(dr,{children:"credits:read"}),", ",t.jsx(dr,{children:"billing:read"}),", or ",t.jsx(dr,{children:"growth:read"}),"."]})]})})}function uTt(){return t.jsx(qy,{id:"mcp-protocol",children:t.jsxs(Gy,{children:[t.jsxs(O1,{children:[t.jsx(V8,{size:17}),"Protocol"]}),t.jsxs(zu,{children:["The endpoint accepts JSON-RPC 2.0 over HTTP PO
25637ST. It supports ",t.jsx(dr,{children:"initialize"}),", ",t.jsx(dr,{children:"tools/list"}),", ",t.jsx(dr,{children:"tools/call"}),", ",t.jsx(dr,{children:"ping"}),", and standard notification acknowledgements."]}),t.jsxs(bpe,{children:[t.jsxs("div",{children:[t.jsx(yy,{children:"Initialize"}),t.jsx(Tb,{children:Izt})]}),t.jsxs("div",{children:[t.jsx(yy,{children:"List Tools"}),t.jsx(Tb,{children:mpe})]})]}),t.jsx(yy,{style:{marginTop:"1rem"},children:"Call A Tool"}),t.jsx(Tb,{children:hpe}),t.jsxs(zu,{children:["Tool results are returned in MCP content format: ",t.jsx(dr,{children:'{ content: [{ type: "text", text: "..." }] }'}),". The ",t.jsx(dr,{children:"text"})," value contains a JSON string for successful calls."]})]})})}function pTt(){return t.jsx(qy,{id:"mcp-tools",children:t.jsxs(Gy,{children:[t.jsxs(O1,{children:[t.jsx(vP,{size:17}),"Tools"]}),t.jsx(zu,{children:"These are the admin MCP tools currently exposed. Tool arguments match the REST filters and sorts documented in the REST tab."}),t.jsx(iTt,{children:hD.map(e=>t.jsx(mTt,{tool:e},e.name))})]})})}function mTt({tool:e}){return t.jsxs(rTt,{id:`mcp-tool-${e.name}`,children:[t.jsxs(oTt,{children:[t.jsxs("div",{children:[t.jsx(sTt,{children:e.name}),t.jsx(xpe,{children:e.description})]}),t.jsx(ype,{children:e.scope})]}),t.jsxs(aTt,{children:[t.jsx(yy,{children:"Arguments"}),e.arguments?.length?t.jsx(fD,{children:e.arguments.map(n=>t.jsxs(yb,{children:[t.jsx(xb,{children:n.name}),t.jsx(bb,{children:n.type}),t.jsx("div",{children:n.description})]},`${e.name}-${n.name}`))}):t.jsx(zu,{children:"No arguments."})]})]})}function hTt(){return t.jsx(qy,{id:"mcp-errors",children:t.jsxs(Gy,{children:[t.jsxs(O1,{children:[t.jsx(th,{size:17}),"Errors & Access"]}),t.jsxs(zu,{children:["Admin MCP follows JSON-RPC conventions. Protocol errors use the JSON-RPC ",t.jsx(dr,{children:"error"})," object with HTTP 200. Tool-level failures return ",t.jsx(dr,{children:"isError: true"})," inside the MCP result."]}),t.jsxs(fD,{children:[t.jsxs(yb,{children:[t.jsx(xb,{children:"401"}),t.jsx(bb,{children:"HTTP"}),t.jsx("div",{children:"Missing, invalid, disabled, revoked, or expired admin API key."})]}),t.jsxs(yb,{children:[t.jsx(xb,{children:"403"}),t.jsx(bb,{children:"HTTP"}),t.jsx("div",{children:"Blocked by admin IP allowlist before the MCP request is processed."})]}),t.jsxs(yb,{children:[t.jsx(xb,{children:"isError"}),t.jsx(bb,{children:"MCP result"}),t.jsx("div",{children:"Tool call failed, for example missing scope, invalid arguments, or record not found."})]}),t.jsxs(yb,{children:[t.jsx(xb,{children:"tools/list"}),t.jsx(bb,{children:"scope-aware"}),t.jsx("div",{children:"Only returns tools allowed by the authenticated key scopes."})]})]})]})})}function fTt(){return t.jsx(qy,{id:"setup",children:t.jsxs(Gy,{children:[t.jsxs(O1,{children:[t.jsx(th,{size:17}),"REST API Setup"]}),t.jsxs(zu,{children:["Base path is ",t.jsx(dr,{children:"/api/admin/v1"}),". Send an admin API key in ",t.jsx(dr,{children:"X-Admin-Api-Key"})," or as ",t.jsx(dr,{children:"Authorization: Bearer ..."}),". Requests must come from an IP allowed by ",t.jsx(dr,{children:"ADMIN_ALLOWED_IPS"}),"."]}),t.jsxs(gpe,{children:[t.jsxs(Pb,{children:[t.jsx(Ab,{children:t.jsx(Rc,{size:16})}),t.jsx(Nb,{children:"Create a key"}),t.jsx(zb,{children:"Create keys in Admin API Keys. Assign only the scopes required by the integration."})]}),t.jsxs(Pb,{children:[t.jsx(Ab,{children:t.jsx(Dne,{size:16})}),t.jsx(Nb,{children:"Choose scopes"}),t.jsxs(zb,{children:["Use resource scopes like ",t.jsx(dr,{children:"users:read"})," or ",t.jsx(dr,{children:"credits:read"}),", or ",t.jsx(dr,{children:"admin:read"})," for all read tools."]})]}),t.jsxs(Pb,{children:[t.jsx(Ab,{children:t.jsx(kP,{size:16})}),t.jsx(Nb,{children:"Call from VPN/IP"}),t.jsx(zb,{children:"The admin IP allowlist is enforced before API key authentication."})]})]}),t.jsx(Tb,{children:ppe}),t.jsxs(zu,{children:["All endpoints return JSON. List endpoints return a top-level resource array plus ",t.jsx(dr,{children:"pagination"}),". Authentication failures return ",t.jsx(dr,{children:"401"}),"; missing scopes return ",t.jsx(dr,{children:"403"})," with ",t.jsx(dr,{children:'error_code: "missing_scope"'}),"."]})]})})}function gTt({endpoint:e}){return t.jsxs(qy,{id:e.id,children:[t.jsxs(Xzt,{children:[t.jsxs("div",{children:[t.jsxs(Qzt,{children:[t.jsx(Zzt,{children:e.method}),t.jsx(Jzt,{children:e.path})]}),t.jsx(xpe,{children:e.summary})]}),t.jsx(ype,{children:e.scope})]}),t.jsxs(Gy,{children:[t.jsxs(bpe,{children:[t.jsxs("div",{children:[t.jsx(yy,{children:"Request Params"}),e.params?.length?t.jsx(fD,{children:e.params.map(n=>t.jsxs(yb,{children:[t.jsx(xb,{children:n.name}),t.jsx(bb,{children:n.type}),t.jsx("div",{children:n.description})]},`${e.id}-${n.name}`))}):t.jsx(zu,{children:"No parameters."})]}),t.jsxs("div",{children:[t.jsx(yy,{children:"Response Fields"}),t.jsx(eTt,{children:e.response.map(n=>t.jsx(tTt,{children:n},`${e.id}-${n}`))})]})]}),t.jsx(yy,{style:{marginTop:"1rem"},children:"Example Response"}),t.jsx(Tb,{children:e.example})]})]})}function yTt(){return t.jsxs(whe,{children:[t.jsx(An,{path:"/signin",element:t.jsx(iwe,{})}),t.jsx(An,{path:"/signup",element:t.jsx(mwe,{})}),t.jsx(An,{path:"/signup-disabled",element:t.jsx(hwe,{})}),t.jsx(An,{path:"/forgot-password",element:t.jsx(KJe,{})}),t.jsx(An,{path:"/reset-password",element:t.jsx(YJe,{})}),t.jsx(An,{path:"/invite",element:t.jsx(A5t,{})}),t.jsx(An,{path:"/auth/callback",element:t.jsx(GJe,{})}),t.jsx(An,{path:"/auth/google-analytics/callback",element:t.jsx(Ogt,{})}),t.jsx(An,{path:"/auth/partner",element:t.jsx(VJe,{})}),t.jsx(An,{path:"/report/s/:token",element:t.jsx(X_t,{})}),t.jsx(An,{path:"/site-audit-report/s/:token",element:t.jsx(YSt,{})}),t.jsx(An,{path:"/verify-email",element:t.jsx(Qce,{})}),t.jsx(An,{path:"/onboarding",element:t.jsx(Int,{})}),t.jsx(An,{path:"/onboarding-failed",element:t.jsx(ede,{})}
25637),t.jsx(An,{path:"workspaces/:workspaceId/projects/:projectId/report",element:t.jsx(xs,{require:"view",children:t.jsx(Pr,{children:t.jsx(Y_t,{})})})}),t.jsx(An,{path:"workspaces/:workspaceId/projects/:projectId/site-audit-report",element:t.jsx(xs,{require:"view",children:t.jsx(Pr,{children:t.jsx(KSt,{})})})}),t.jsxs(An,{path:"/",element:t.jsx(Knt,{}),children:[t.jsx(An,{index:!0,element:t.jsx(sit,{})}),t.jsx(An,{path:"admin",element:t.jsx(um,{children:t.jsx(nIt,{})})}),t.jsx(An,{path:"admin/health",element:t.jsx(um,{allowRoles:["admin"],children:t.jsx(xIt,{})})}),t.jsx(An,{path:"admin/infrastructure",element:t.jsx(um,{allowRoles:["admin"],children:t.jsx(OIt,{})})}),t.jsx(An,{path:"admin/logs",element:t.jsx(um,{allowRoles:["admin"],children:t.jsx($Pt,{})})}),t.jsx(An,{path:"admin/api-keys",element:t.jsx(um,{allowRoles:["admin"],children:t.jsx(Czt,{})})}),t.jsx(An,{path:"admin/api-docs",element:t.jsx(um,{children:t.jsx(lTt,{})})}),t.jsx(An,{path:"admin/runs",element:t.jsx(um,{children:t.jsx(nAt,{})})}),t.jsx(An,{path:"admin/costs",element:t.jsx(um,{children:t.jsx(jAt,{})})}),t.jsx(An,{path:"admin/resources",element:t.jsx(um,{children:t.jsx(nzt,{})})}),t.jsx(An,{path:"workspaces/:workspaceId",element:t.jsx(Hh,{allow:["owner","editor","viewer","project"],children:t.jsx(Pr,{children:t.jsx(Mit,{})})})}),t.jsx(An,{path:"workspaces/:workspaceId/overview",element:t.jsx(Hh,{allow:["owner","editor","viewer","project"],children:t.jsx(Pr,{children:t.jsx(srt,{})})})}),t.jsx(An,{path:"workspaces/:workspaceId/settings",element:t.jsx(Hh,{allow:["owner"],children:t.jsx(Pr,{children:t.jsx(J$t,{})})})}),t.jsx(An,{path:"workspaces/:workspaceId/settings/users",element:t.jsx(Hh,{allow:["owner"],children:t.jsx(Pr,{children:t.jsx(g2t,{})})})}),t.jsx(An,{path:"workspaces/:workspaceId/settings/api-keys",element:t.jsx(Hh,{allow:["owner"],children:t.jsx(Pr,{children:t.jsx($2t,{})})})}),t.jsx(An,{path:"workspaces/:workspaceId/settings/billing",element:t.jsx(Hh,{allow:["owner"],children:t.jsx(Pr,{children:t.jsx(H2t,{})})})}),t.jsx(An,{path:"workspaces/:workspaceId/settings/plan",element:t.jsx(Hh,{allow:["owner"],children:t.jsx(Pr,{children:t.jsx(g5t,{})})})}),t.jsx(An,{path:"workspaces/:workspaceId/projects/new",element:t.jsx(Hh,{allow:["owner","editor"],children:t.jsx(Pr,{children:t.jsx(uyt,{})})})}),t.jsx(An,{path:"workspaces/:workspaceId/projects/:projectId",element:t.jsx(xs,{require:"view",children:t.jsx(Pr,{children:t.jsx(tot,{})})})}),t.jsxs(An,{path:"workspaces/:workspaceId/projects/:projectId/prompts",element:t.jsx(xs,{require:"view",children:t.jsx(Pr,{children:t.jsx(Cot,{})})}),children:[t.jsx(An,{index:!0,element:t.jsx(O0t,{})}),t.jsx(An,{path:"fanout",element:t.jsx(Z0t,{})}),t.jsx(An,{path:"citations",element:t.jsx(bot,{})})]}),t.jsx(An,{path:"workspaces/:workspaceId/projects/:projectId/prompts/:promptId",element:t.jsx(xs,{require:"view",children:t.jsx(Pr,{children:t.jsx(cst,{})})})}),t.jsx(An,{path:"workspaces/:workspaceId/projects/:projectId/actions",element:t.jsx(xs,{require:"view",children:t.jsx(Pr,{children:t.jsx(Fct,{})})})}),t.jsx(An,{path:"workspaces/:workspaceId/projects/:projectId/actions/prompt/:promptId",element:t.jsx(xs,{require:"view",children:t.jsx(Pr,{children:t.jsx(odt,{})})})}),t.jsx(An,{path:"workspaces/:workspaceId/projects/:projectId/actions/impact",element:t.jsx(xs,{require:"view",children:t.jsx(Pr,{children:t.jsx(iut,{})})})}),t.jsx(An,{path:"workspaces/:workspaceId/projects/:projectId/actions/:actionId",element:t.jsx(xs,{require:"view",children:t.jsx(Pr,{children:t.jsx(Bdt,{})})})}),t.jsx(An,{path:"workspaces/:workspaceId/projects/:projectId/site-audit",element:t.jsx(xs,{require:"view",children:t.jsx(Pr,{children:t.jsx(tft,{})})})}),t.jsx(An,{path:"workspaces/:workspaceId/projects/:projectId/analytics",element:t.jsx(xs,{require:"view",children:t.jsx(Pr,{children:t.jsx(Rgt,{})})})}),t.jsx(An,{path:"workspaces/:workspaceId/projects/:projectId/chat",element:t.jsx(xs,{require:"view",children:t.jsx(Pr,{children:t.jsx(pbt,{})})})}),t.jsx(An,{path:"workspaces/:workspaceId/projects/:projectId/agents",element:t.jsx(xs,{require:"view",children:t.jsx(Pr,{children:t.jsx(zbt,{})})})}
25637),t.jsx(An,{path:"workspaces/:workspaceId/projects/:projectId/agents/rules",element:t.jsx(xs,{require:"view",children:t.jsx(Pr,{children:t.jsx(Kbt,{})})})}),t.jsx(An,{path:"workspaces/:workspaceId/projects/:projectId/agents/log",element:t.jsx(xs,{require:"view",children:t.jsx(Pr,{children:t.jsx(B1t,{})})})}),t.jsx(An,{path:"workspaces/:workspaceId/projects/:projectId/settings",element:t.jsx(xs,{require:"settings",children:t.jsx(Pr,{children:t.jsx(QSt,{})})})}),t.jsx(An,{path:"workspaces/:workspaceId/projects/:projectId/settings/integrations",element:t.jsx(xs,{require:"settings",children:t.jsx(Pr,{children:t.jsx(kkt,{})})})}),t.jsx(An,{path:"workspaces/:workspaceId/projects/:projectId/settings/users",element:t.jsx(xs,{require:"users",children:t.jsx(Pr,{children:t.jsx(Hkt,{})})})}),t.jsx(An,{path:"workspaces/:workspaceId/projects/:projectId/settings/competitors",element:t.jsx(xs,{require:"settings",children:t.jsx(Pr,{children:t.jsx(q$t,{})})})})]}),t.jsx(An,{path:"/forbidden",element:t.jsx(xet,{})}),t.jsx(An,{path:"*",element:t.jsx(yet,{})})]})}const IE=e=>Q_.includes(e)||nM.some(n=>e.startsWith(n));function xTt({children:e}){const[n,i]=l.useState(null),[r,o]=l.useState(!1),[s,a]=l.useState(!0),c=vo(),u=zn(),m=c.pathname,h=l.useRef(!0);l.useEffect(()=>{const P=wne(),S=W8(n?.theme??P);F5(S),n?.theme&&BE(S)},[n?.theme]);const g=l.useCallback(async()=>{if(!Bb())return null;try{const S=await ue("/api/v1/users/me",{method:"GET"});if(S.ok){const I=await S.json();if(I.user)return i(I.user),o(!0),I.user}else if(S.status===401)return null}catch(S){return console.error("Error verifying authentication:",S),null}return null},[]),x=l.useCallback((P,S,I)=>{window.opener===null&&(b_(P,S),i(I),o(!0))},[]),y=l.useCallback(async()=>{const P=x5();if(P)try{await ue("/api/v1/auth/signout",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({refresh_token:P})})}catch(S){console.error("Error during signout:",S)}Im(),i(null),o(!1),u("/signin")},[u]),w=l.useCallback(async()=>{const P=x5();if(!P)return null;try{const S=await ue("/api/v1/auth/refresh",{method:"POST",body:JSON.stringify({refresh_token:P})});if(S.ok){const I=await S.json();if(I.access_token&&I.refresh_token)return b_(I.access_token,I.refresh_token),await g()}}catch(S){console.error("Error refreshing token:",S)}return null},[g]),j=l.useCallback(async()=>{if(!await w())throw await y(),new Error("Failed to refresh token")},[w,y]),v=l.useCallback(async()=>{await g()||await w()},[g,w]);l.useEffect(()=>{if(window.opener!==null){a(!1),h.current=!1;return}(async()=>{a(!0);const I=Bb(),A=x5();let E=null;I&&!Vne(I)&&(E=await g()),!E&&A&&(E=await w()),E||(Im(),i(null),o(!1),IE(m)||u("/signin",{replace:!0})),a(!1),h.current=!1})()},[]),l.useEffect(()=>{if(!(h.current||window.opener!==null)&&!IE(m)&&!r){u("/signin",{replace:!0});return}},[m,r,u]);const _={user:n,isAuthenticated:r,isLoading:s,login:x,logout:y,refreshToken:j,refreshUser:v,setUser:P=>i(P)};return window.opener!==null?t.jsx(b5.Provider,{value:_,children:e}):s?t.jsx(b5.Provider,{value:_,children:t.jsx(IP,{message:"Loading..."})}):IE(m)||r?t.jsx(b5.Provider,{value:_,children:e}):null}var O5={logger:typeof console<"u"?console:void 0,WebSocket:typeof WebSocket<"u"?WebSocket:void 0},yo={log(...e){this.enabled&&(e.push(Date.now()),O5.logger.log("[ActionCable]",...e))}};const Jj=()=>new Date().getTime(),a5=e=>(Jj()-e)/1e3;class gD{constructor(n){this.visibilityDidChange=this.visibilityDidChange.bind(this),this.connection=n,this.reconnectAttempts=0}start(){this.isRunning()||(this.startedAt=Jj(),delete this.stoppedAt,this.startPolling(),addEventListener("visibilitychange",this.visibilityDidChange),yo.log(`ConnectionMonitor started. stale threshold = ${this.constructor.staleThreshold} s`))}stop(){this.isRunning()&&(this.stoppedAt=Jj(),this.stopPolling(),removeEventListener("visibilitychange",this.visibilityDidChange),yo.log("ConnectionMonitor stopped"))}isRunning(){return this.startedAt&&!this.stoppedAt}recordMessage(){this.pingedAt=Jj()}recordConnect(){this.reconnectAttempts=0,delete this.disconnectedAt,yo.log("ConnectionMonitor recorded connect")}recordDisconnect(){this.disconnectedAt=Jj(),yo.log("ConnectionMonitor recorded disconnect")}startPolling(){this.stopPolling(),this.poll()}stopPolling(){clearTimeout(this.pollTimeout)}poll(){this.pollTimeout=setTimeout((()=>{this.reconnectIfStale(),this.poll()}),this.getPollInterval())}getPollInterval(){const{staleThreshold:n,reconnectionBackoffRate:i}=this.constructor,r=Math.pow(1+i,Math.min(this.reconnectAttempts,10)),s=(this.reconnectAttempts===0?1:i)*Math.random();return n*1e3*r*(1+s)}reconnectIfStale(){this.connectionIsStale()&&(yo.log(`ConnectionMonitor detected stale c
25637onnection. reconnectAttempts = ${this.reconnectAttempts}, time stale = ${a5(this.refreshedAt)} s, stale threshold = ${this.constructor.staleThreshold} s`),this.reconnectAttempts++,this.disconnectedRecently()?yo.log(`ConnectionMonitor skipping reopening recent disconnect. time disconnected = ${a5(this.disconnectedAt)} s`):(yo.log("ConnectionMonitor reopening"),this.connection.reopen()))}get refreshedAt(){return this.pingedAt?this.pingedAt:this.startedAt}connectionIsStale(){return a5(this.refreshedAt)>this.constructor.staleThreshold}disconnectedRecently(){return this.disconnectedAt&&a5(this.disconnectedAt)<this.constructor.staleThreshold}visibilityDidChange(){document.visibilityState==="visible"&&setTimeout((()=>{(this.connectionIsStale()||!this.connection.isOpen())&&(yo.log(`ConnectionMonitor reopening stale connection on visibilitychange. visibilityState = ${document.visibilityState}`),this.connection.reopen())}),200)}}gD.staleThreshold=6;gD.reconnectionBackoffRate=.15;var vpe={message_types:{welcome:"welcome",disconnect:"disconnect",ping:"ping",confirmation:"confirm_subscription",rejection:"reject_subscription"},default_mount_path:"/cable",protocols:["actioncable-v1-json","actioncable-unsupported"]};const{message_types:Wj,protocols:I8}=vpe,bTt=I8.slice(0,I8.length-1),Pte=[].indexOf;class yD{constructor(n){this.open=this.open.bind(this),this.consumer=n,this.subscriptions=this.consumer.subscriptions,this.monitor=new gD(this),this.disconnected=!0}send(n){return this.isOpen()?(this.webSocket.send(JSON.stringify(n)),!0):!1}open(){if(this.isActive())return yo.log(`Attempted to open WebSocket, but existing socket is ${this.getState()}`),!1;{const n=[...I8,...this.consumer.subprotocols||[]];return yo.log(`Opening WebSocket, current state is ${this.getState()}, subprotocols: ${n}`),this.webSocket&&this.uninstallEventHandlers(),this.webSocket=new O5.WebSocket(this.consumer.url,n),this.installEventHandlers(),this.monitor.start(),!0}}close({allowReconnect:n}={allowReconnect:!0}){if(n||this.monitor.stop(),this.isOpen())return this.webSocket.close()}reopen(){if(yo.log(`Reopening WebSocket, current state is ${this.getState()}`),this.isActive())try{return this.close()}catch(n){yo.log("Failed to reopen WebSocket",n)}finally{yo.log(`Reopening WebSocket in ${this.constructor.reopenDelay}ms`),setTimeout(this.open,this.constructor.reopenDelay)}else return this.open()}getProtocol(){if(this.webSocket)return this.webSocket.protocol}isOpen(){return this.isState("open")}isActive(){return this.isState("open","connecting")}triedToReconnect(){return this.monitor.reconnectAttempts>0}isProtocolSupported(){return Pte.call(bTt,this.getProtocol())>=0}isState(...n){return Pte.call(n,this.getState())>=0}getState(){if(this.webSocket){for(let n in O5.WebSocket)if(O5.WebSocket[n]===this.webSocket.readyState)return n.toLowerCase()}return null}installEventHandlers(){for(let n in this.events){const i=this.events[n].bind(this);this.webSocket[`on${n}`]=i}}uninstallEventHandlers(){for(let n in this.events)this.webSocket[`on${n}`]=function(){}}}yD.reopenDelay=500;yD.prototype.events={message(e){if(!this.isProtocolSupported())return;const{identifier:n,message:i,reason:r,reconnect:o,type:s}=JSON.parse(e.data);switch(this.monitor.recordMessage(),s){case Wj.welcome:return this.triedToReconnect()&&(this.reconnectAttempted=!0),this.monitor.recordConnect(),this.subscriptions.reload();case Wj.disconnect:return yo.log(`Disconnecting. Reason: ${r}`),this.close({allowReconnect:o});case Wj.ping:return null;case Wj.confirmation:return this.subscriptions.confirmSubscription(n),this.reconnectAttempted?(this.reconnectAttempted=!1,this.subscriptions.notify(n,"connected",{reconnected:!0})):this.subscriptions.notify(n,"connected",{reconnected:!1});case Wj.rejection:return this.subscriptions.reject(n);default:return this.subscriptions.notify(n,"received",i)}},open(){if(yo.log(`WebSocket onopen event, using '${this.getProtocol()}' subprotocol`),this.disconnected=!1,!this.isProtocolSupported())return yo.log("Protocol is unsupported. Stopping monitor and disconnecting."),this.close({allowReconnect:!1})},close(e){if(yo.log("WebSocket onclose event"),!this.disconnected)return this.disconnected=!0,this.monitor.recordDisconnect(),this.subscriptions.notifyAll("disconnected",{willAttemptReconnect:this.monitor.isRunning()})},error(){yo.log("WebSocket onerror event")}};const vTt=function(e,n){if(n!=null)for(let i in n){const r=n[i];e[i]=r}return e};class wTt{constructor(n,i={},r){this.consumer=n,this.identifier=JSON.stringify(i),vTt(this,r)}perform(n,i={}){return i.action=n,this.send(i)}send(n){return this.consumer.send({command:"message",identifier:this.identifier,data:JSON.stringify(n)})}unsubscribe(){return this.consumer.subscriptions.remove(this)}}class jTt{constructor(n){this.subscriptions=n,this.pendingSubscriptions=[]}guarantee(n){this.pendingSubscriptions.indexOf(n)==-1?(yo.log(`SubscriptionGuarantor guaranteeing ${n.identifier}`),this.pendingSubscriptions.push(n)):yo.log(`SubscriptionGuarantor already guaranteeing ${n.identifier}`),this.startGuaranteeing()}forget(n){yo.log(`SubscriptionGuarantor forgetting ${n.identifier}`),this.pendingSubscriptions=this.pendingSubscriptions.filter((i=>i!==n))}startGuaranteeing(){this.stopGuaranteeing(),this.retrySubscribing()}stopGuaranteeing(){clearTimeout(this.retryTimeout)}retrySubscribing(){this.retryTimeout=setTimeout((()=>{this.subscriptions&&typeof this.subscriptions.subscribe=="function"&&this.pendingSubscriptions.map((n=>{yo.log(`SubscriptionGuarantor resubscribing ${n.identifier}`),this.subscriptions.subscribe(n)}))}),500)}}class _Tt{constructor(n){this.consumer=n,this.guarantor=new jTt(this),this.subscriptions=[]}create(n,i){const r=n,o=typeof r=="object"?r:{channel:r},s=new wTt(this.consumer,o,i);return this.add(s)}add(n){return this.subscriptions.push(n),this.consumer.ensureActiveConnection(),this.notify(n,"initialized"),this.subscribe(n),n}remove(n){return this.forget(n),this.findAll(n.identifier).length||this.sendCommand(n,"unsubscribe"),n}reject(n){return this.findAll(n).map((i=>(this.forget(i),this.notify(i,"rejected"),i)))}forget(n){return this.guarantor.forget(n),this.subscriptions=this.subscriptions.filter((i=>i!==n)),n}findAll(n){return this.subscriptions.filter((i=>i.identifier===n))}reload(){return this.subscriptions.map((n=>this.subscribe(n)))}notifyAll(n,...i){return this.subscriptions.map((r=>this.notify(r,n,...i)))}notify(n,i,...r){let o;return typeof n=="string"?o=this.findAll(n):o=[n],o.map((s=>typeof s[i]=="function"?s[i](...r):void 0))}subscribe(n){this.sendCommand(n,"subscribe")&&this.guarantor.guarantee(n)}
25637confirmSubscription(n){yo.log(`Subscription confirmed ${n}`),this.findAll(n).map((i=>this.guarantor.forget(i)))}sendCommand(n,i){const{identifier:r}=n;return this.consumer.send({command:i,identifier:r})}}class CTt{constructor(n){this._url=n,this.subscriptions=new _Tt(this),this.connection=new yD(this),this.subprotocols=[]}get url(){return STt(this._url)}send(n){return this.connection.send(n)}connect(){return this.connection.open()}disconnect(){return this.connection.close({allowReconnect:!1})}ensureActiveConnection(){if(!this.connection.isActive())return this.connection.open()}addSubProtocol(n){this.subprotocols=[...this.subprotocols,n]}}function STt(e){if(typeof e=="function"&&(e=e()),e&&!/^wss?:/i.test(e)){const n=document.createElement("a");return n.href=e,n.href=n.href,n.protocol=n.protocol.replace("http","ws"),n.href}else return e}function kTt(e=$Tt("url")||vpe.default_mount_path){return new CTt(e)}function $Tt(e){const n=document.head.querySelector(`meta[name='action-cable-${e}']`);if(n)return n.getAttribute("content")}function ITt(e){const n=Td(),i=new URL(n);return i.protocol=i.protocol==="https:"?"wss:":"ws:",i.pathname="/cable",i.search="",i.searchParams.set("token",e),i.toString()}function PTt(e){const n={...e};if(Object.prototype.hasOwnProperty.call(n,"project_id")&&n.project_id!=null){const i=n.project_id;typeof i=="string"&&/^\d+$/.test(i)&&(n.project_id=Number(i))}return n}function ATt(e){const n=i=>{if(Array.isArray(i))return i.map(n);if(i&&typeof i=="object"){const r={};return Object.keys(i).sort().forEach(o=>{r[o]=n(i[o])}),r}return i};return JSON.stringify(n(e))}function NTt({children:e}){const{isAuthenticated:n,refreshToken:i}=yn(),r=l.useRef(null),o=l.useRef(null),[s,a]=l.useState("idle"),[c,u]=l.useState(null),m=l.useRef(!1),h=l.useRef(null),g=l.useRef(i),x=l.useRef(new Map);l.useEffect(()=>{g.current=i},[i]);const y=l.useCallback(k=>{m.current=!1;try{h.current?.unsubscribe()}catch{}h.current=null,x.current.forEach(P=>{try{P.subscription?.unsubscribe?.()}catch{}P.subscription=null}),k?.clearSubscriptions&&x.current.clear();try{r.current?.disconnect?.()}catch{}r.current=null,o.current=null,a("idle")},[]),w=l.useCallback(k=>{const P=r.current;if(!P)return;const S=x.current.get(k);if(!S)return;try{S.subscription?.unsubscribe?.()}catch{}const I=P.subscriptions.create(S.identifier,{connected:()=>{x.current.get(k)?.connectedListeners.forEach(A=>A())},disconnected:()=>{x.current.get(k)?.disconnectedListeners.forEach(A=>A())},received:A=>{x.current.get(k)?.receivedListeners.forEach(E=>E(A))}});S.subscription=I},[]),j=l.useCallback(()=>{x.current.forEach((k,P)=>{w(P)})},[w]),v=l.useCallback((k,P)=>{const S=PTt(k),I=ATt(S);let A=x.current.get(I);A?A.identifier=S:(A={identifier:S,subscription:null,receivedListeners:new Set,connectedListeners:new Set,disconnectedListeners:new Set},x.current.set(I,A));const E=P.received,B=P.connected,T=P.disconnected;return E&&A.receivedListeners.add(E),B&&A.connectedListeners.add(B),T&&A.disconnectedListeners.add(T),r.current&&!A.subscription&&w(I),{perform:(M,R)=>{x.current.get(I)?.subscription?.perform?.(M,R)},unsubscribe:()=>{const M=x.current.get(I);if(!M)return;if(E&&M.receivedListeners.delete(E),B&&M.connectedListeners.delete(B),T&&M.disconnectedListeners.delete(T),M.receivedListeners.size===0&&M.connectedListeners.size===0&&M.disconnectedListeners.size===0){try{M.subscription?.unsubscribe?.()}catch{}x.current.delete(I)}}}},[w]),_=l.useCallback(async()=>{if(!n){y({clearSubscriptions:!0});return}const k=Bb();if(k&&Vne(k))try{await g.current()}catch{y();return}const P=Bb();if(!P){y();return}a("connecting");let S="";try{S=ITt(P)}catch(A){console.error("[cable] invalid VITE_API_BASE_URL for websocket:",A),a("error");return}if(r.current&&o.current===S)return;y({clearSubscriptions:!1});const I=kTt(S);r.current=I,o.current=S,h.current=v({channel:"SystemChannel"},{connected:()=>{a("connected"),m.current||(m.current=!0,h.current?.perform("ping",{ts:Date.now()}))},disconnected:()=>a("disconnected"),received:A=>{u(A),console.log("[cable] received:",A)}}),h.current||a("error"),j()},[n,j,v,y]);l.useEffect(()=>{let k=!1;_();const P=()=>{k||_()};return window.addEventListener("auth:tokens_updated",P),()=>{k=!0,window.removeEventListener("auth:tokens_updated",P),y()}},[_,n,y]);const $=l.useMemo(()=>({status:s,lastEvent:c,subscribe:v}),[s,c,v]);return t.jsx($re.Provider,{value:$,children:e})}function zTt({children:e}){const{user:n}=yn(),i=zn(),o=vo().pathname,s=Q_.includes(o)||nM.some(u=>o.startsWith(u)),a=window.opener!==null,c=o==="/auth/callback"||o==="/auth/google-analytics/callback";return l.useEffect(()=>{if(!(a||c)){if(n&&s){n.email_verified||i("/verify-email",{replace:!0});return}if(!s){if(n&&!n.email_verified&&o!=="/verify-email"){i("/verify-email",{replace:!0});return}if(n&&n.email_verified&&o==="/verify-email"){i("/",{replace:!0});return}}}},[n,i,s,a,c,o]),a||c?t.jsx(t.Fragment,{children:e}):s?t.jsx(t.Fragment,{children:e}):(n||i("/signin",{replace:!0}),n&&!n.email_verified?t.jsx(Qce,{}):t.jsx(t.Fragment,{children:e}))}function TTt({children:e}){const{user:n}=yn(),i=zn(),r=vo(),o=l.useRef(!1),s=l.useRef(!1),a=r.pathname,c=`${r.pathname}${r.search||""}`,u="/onboarding",m="/onboarding-failed",h=Q_.includes(a)||nM.some(w=>a.startsWith(w)),g=window.opener!==null,x=a==="/auth/callback",y=a==="/invite";return l.useEffect(()=>{if(g||x||y)return;const w=n?.onboarding_completed===!0,j=n?.onboarding_failed===!0&&!w;if(s.current||(s.current=!0,o.current=w),j&&a!==m){i(m,{replace:!0});return}if(n&&h){const _=wb();if(_){const $=`/invite?token=${encodeURIComponent(_)}`;$!==c&&i($,{replace:!0});return}if(!w){const k=(n.onboarding_step?d_(n.onboarding_step):"/onboarding?type=user-type")||"/onboarding?type=user-type";k!==c&&i(k,{replace:!0});return}c!=="/"&&i("/",{replace:!0});return}const v=!o.current&&w;
25637if(n&&w&&a.startsWith(u)){const $=(new URLSearchParams(r.search).get("type")||"").toString();v&&($==="report"||$==="competitors")||c!=="/"&&i("/",{replace:!0});return}if(!h){if(!n){i("/signin",{replace:!0});return}if(!j&&a===m){c!=="/"&&i("/",{replace:!0});return}if(!w&&!a.startsWith(u)){const $=(n.onboarding_step?d_(n.onboarding_step):"/onboarding?type=user-type")||"/onboarding?type=user-type";$!==c&&i($,{replace:!0})}if(!w&&a.startsWith(u)&&n.onboarding_step&&n.onboarding_step>=5){const $=new URLSearchParams(r.search).get("type");if($){const k=HO($);if(k&&k<n.onboarding_step){const P=d_(n.onboarding_step);P&&P!==c&&i(P,{replace:!0})}}}o.current=w}},[n,a,c,i,h,g,x,r.search]),g||x?t.jsx(t.Fragment,{children:e}):h?t.jsx(t.Fragment,{children:e}):n?n.onboarding_failed&&!n.onboarding_completed?a!==m?null:t.jsx(ede,{}):n.onboarding_completed?t.jsx(t.Fragment,{children:e}):t.jsx(t.Fragment,{children:e}):null}function ETt(e){switch(Number(e||1)){case 1:return"website";case 2:return"location";case 3:return"topic_analysis";case 4:return"prompt_analysis";case 5:return"competitor_analysis";default:return"website"}}function MTt(e){switch((e||"").toLowerCase()){case"website":return 1;case"location":return 2;case"topic_analysis":case"topics":return 3;case"prompt_analysis":case"prompts":return 4;case"competitor_analysis":case"competitors":return 5;default:return null}}function RTt({children:e}){const{user:n,setUser:i}=yn(),r=zn(),o=vo(),s=o.pathname,a=`${o.pathname}${o.search||""}`,c=Q_.includes(s),[u,m]=l.useState(!1),[h,g]=l.useState(null),[x,y]=l.useState(!1),[w,j]=l.useState(null),v=typeof n?.add_project_organization_id=="number"?n.add_project_organization_id:null,_=n?.add_project_active===!0&&!!v,$=k=>{const P=(k||"").toString();if(P){if(!_){r(P);return}g(P),j(null),m(!0)}};return l.useEffect(()=>{if(window.opener!==null||!n||!n.onboarding_completed)return;const P=n.add_project_active===!0,S=typeof n.add_project_organization_id=="number"?n.add_project_organization_id:null;if(!P||!S)return;const I=Number(n.add_project_step||1),A=ETt(I),B=`${`/workspaces
25637/${S}/projects/new`}?step=${encodeURIComponent(A)}`;if(c){a!==B&&r(B,{replace:!0});return}if(!(!!pu({path:"/workspaces/:workspaceId/projects/new",end:!0},s)||!!pu({path:"/workspaces/:workspaceId/projects/new/*",end:!1},s))){u||r(B,{replace:!0});return}const R=new URLSearchParams(o.search).get("step"),F=MTt(R);if(!F){a!==B&&r(B,{replace:!0});return}if(F>I){a!==B&&r(B,{replace:!0});return}if(I>=3&&F<I){a!==B&&r(B,{replace:!0});return}},[a,s,c,u,r,n]),t.jsxs(Cre.Provider,{value:{requestLeave:$},children:[e,t.jsxs(Hn,{isOpen:u,onClose:()=>{x||(m(!1),g(null),j(null))},title:"Leave add project setup?",description:"To leave this setup flow, you must cancel it. You can start again later.",size:"sm",children:[w?t.jsx("div",{style:{color:"rgba(239, 68, 68, 0.95)",fontSize:13,marginBottom:12},children:w}):null,t.jsx("div",{style:{display:"flex",flexDirection:"column",gap:8,fontSize:14,color:"rgba(17, 24, 39, 0.9)"},children:t.jsx("div",{children:"If you cancel now, any in-progress setup choices will be discarded."})}),t.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:12,marginTop:16},children:[t.jsx(he,{type:"button",variant:"outline",disabled:x,onClick:()=>{m(!1),g(null),j(null)},children:"Stay in setup"}),t.jsx(he,{type:"button",variant:"danger",disabled:x||!_||!v,onClick:async()=>{if(!v)return;const k=h;if(k){y(!0),j(null);try{const P=await ue(`/api/v1/organizations/${v}/projects/add_flow/cancel`,{method:"POST"}),S=await P.json().catch(()=>({}));if(!P.ok)throw new Error(S?.error||S?.errors?.[0]||"Failed to cancel add project flow");S?.user&&i(S.user),m(!1),g(null),r(k)}catch(P){j(P instanceof Error?P.message:"Failed to cancel add project flow")}finally{y(!1)}}},children:x?"Cancelingâ¦":"Cancel & leave"})]})]})]})}function OTt({children:e}){const n=vo(),{user:i,isAuthenticated:r}=yn(),o=l.useMemo(()=>
25637{const Q=n.pathname,K=pu({path:"/workspaces/:workspaceId/*",end:!1},Q),G=pu({path:"/workspaces/:workspaceId",end:!0},Q);return K?.params?.workspaceId||G?.params?.workspaceId||null},[n.pathname]),s=l.useMemo(()=>{const Q=Number(o);return Number.isFinite(Q)&&Q>0?Q:null},[o]),[a,c]=l.useState([]),[u,m]=l.useState(null),[h,g]=l.useState({}),[x,y]=l.useState(null),[w,j]=l.useState(null),[v,_]=l.useState(null),[$,k]=l.useState(!1),[P,S]=l.useState(null),[I,A]=l.useState(null),[E,B]=l.useState({}),T=l.useCallback(Q=>{const K=Number(Q);if(!Number.isFinite(K)||K<=0)return;const G=Date.now(),L=6e4;B(q=>{const W={};for(const[oe,se]of Object.entries(q)){const de=Number(oe),le=Number(se);Number.isFinite(de)&&Number.isFinite(le)&&G-le<L&&(W[de]=le)}return W[K]=G,W})},[]),M=l.useCallback(Q=>{const K=Number(Q);if(!Number.isFinite(K)||K<=0)return!1;const G=E[K];return G?Date.now()-G<6e4:!1},[E]),R=l.useRef(null),F=`${s||"none"}:${i?.id||"anon"}:${r?"1":"0"}`,Y=l.useMemo(()=>!!pu({path:"/workspaces/:workspaceId",end:!0},n.pathname),[n.pathname]),H=l.useMemo(()=>
25637{const Q=n.pathname,K=pu({path:"/workspaces/:workspaceId/projects/:projectId/*",end:!1},Q),G=pu({path:"/workspaces/:workspaceId/projects/:projectId",end:!0},Q),L=K?.params?.projectId||G?.params?.projectId||null,q=Number(L);return Number.isFinite(q)&&q>0?q:null},[n.pathname]),U=l.useCallback(async()=>{if(!(!r||!i)){if(!s){c([]),m(null),g({}),y(null),j(null),_(null),k(!1),S(null),A(F);return}k(!0),S(null);try{const K=(i.organizations||[]).find(de=>Number(de?.id)===Number(s))?.llm_models;g(K&&typeof K=="object"?K:{});const G=await ue(`/api/v1/organizations/${s}/projects`,{method:"GET"}),L=await G.json().catch(()=>({}));if(!G.ok)throw new Error(L?.error||L?.errors?.[0]||"Failed to load projects");const W=(Array.isArray(L.projects)?L.projects:[]).map(de=>({id:Number(de?.id),custom_identifier:de?.custom_identifier!=null?String(de.custom_identifier):null,name:String(de?.name||""),brand_aliases:Array.isArray(de?.brand_aliases)?de.brand_aliases.map(le=>String(le||"").trim()).filter(Boolean):[],website:String(de?.website||""),active_prompts_count:Number.isFinite(Number(de?.active_prompts_count))?Number(de.active_prompts_count):0,logo_url:de?.logo_url?String(de.logo_url):null,description:de?.description!=null?String(de.description):null,description_autofetched:!!de?.description_autofetched,logo_autofetched:!!de?.logo_autofetched,city:de?.city!=null?String(de.city):null,country:de?.country!=null?String(de.country):null,country_code:de?.country_code!=null?String(de.country_code):null,language:de?.language!=null?String(de.language):null,action_language:de?.action_language!=null?String(de.action_language):null,focus:de?.focus!=null?String(de.focus):null,onboard_status:de?.onboard_status!=null?String(de.onboard_status):null,initial_crunching:!!de?.initial_crunching,is_crunching:!!de?.is_crunching,has_successful_run:!!de?.has_successful_run,site_audit:de?.site_audit&&typeof de.site_audit=="object"?{enumeration_status:de.site_audit?.enumeration_status!=null?String(de.site_audit.enumeration_status):null,enumeration_mode:de.site_audit?.enumeration_mode!=null?String(de.site_audit.enumeration_mode):null,enumeration_started_at:de.site_audit?.enumeration_started_at!=null?String(de.site_audit.enumeration_started_at):null,enumeration_finished_at:de.site_audit?.enumeration_finished_at!=null?String(de.site_audit.enumeration_finished_at):null,enumeration_error_message:de.site_audit?.enumeration_error_message!=null?String(de.site_audit.enumeration_error_message):null,enumeration_pages_count:Number.isFinite(Number(de.site_audit?.enumeration_pages_count))?Number(de.site_audit.enumeration_pages_count):null,sitemap_url:de.site_audit?.sitemap_url!=null?String(de.site_audit.sitemap_url):null,sitemap_source:de.site_audit?.sitemap_source!=null?String(de.site_audit.sitemap_source):null,site_technical_score:Number.isFinite(Number(de.site_audit?.site_technical_score))?Number(de.site_audit.site_technical_score):null,site_content_score:Number.isFinite(Number(de.site_audit?.site_content_score))?Number(de.site_audit.site_content_score):null,site_subcategory_scores:de.site_audit?.site_subcategory_scores??null}:null,project_role:de?.project_role==="viewer"||de?.project_role==="editor"?de.project_role:null,can:de?.can&&typeof de.can=="object"?{view:!!de.can.view,edit:!!de.can.edit,settings:!!de.can.settings,users:!!de.can.users}:void 0})).filter(de=>Number.isFinite(de.id)&&de.id>0&&de.name.trim()!==""&&de.website.trim()!=="");c(W);const oe=L?.limits&&typeof L.limits=="object"?L.limits:{},se=L?.usage&&typeof L.usage=="object"?L.usage:{};y(oe.projects_limit==null?null:Number(oe.projects_limit)),j(se.projects_count==null?null:Number(se.projects_count)),_(oe.countries_limit==null?null:Number(oe.countries_limit)),m(de=>H?H&&W.some(le=>le.id===H)?H:de&&W.some(le=>le.id===de)?de:W[0]?.id??null:null)}catch(Q){c([]),m(null),g({}),y(null),j(null),_(null),S(Q?.message||"Failed to load projects")}finally{k(!1),A(F)}}},[H,r,F,s,i]);l.useEffect(()=>{if(!r||!i||!s)return;const K=(i.organizations||[]).find(G=>Number(G?.id)===Number(s))?.llm_models;g(K&&typeof K=="object"?K:{})},[r,s,i]),l.useEffect(()=>{if(R.current!==F){if(R.current=F,!s){c([]),m(null),g({}),k(!1),S(null),A(F);return}Y||U()}},[Y,U,F,s]),l.useEffect(()=>{H&&I===F&&($||a.some(Q=>Q.id===H)&&m(Q=>Q===H?Q:H))},[H,$,F,I,a]),l.useEffect(()=>{H||m(null)},[H]);const X=l.useMemo(()=>({organizationId:s,organizationLlmModels:h,setOrganizationLlmModels:g,projects:a,projectsLimit:x,projectsCount:w,countriesLimit:v,isLoading:$,error:P,loadKey:F,loadedKey:I,selectedProjectId:u,setSelectedProjectId:m,hydrateProjects:(Q,K)=>{const G=Array.isArray(Q)?Q:[];c(G),K&&typeof K=="object"&&(Object.prototype.hasOwnProperty.call(K,"projectsLimit")&&y(K.projectsLimit==null?null:Number(K.projectsLimit)),Object.prototype.hasOwnProperty.call(K,"projectsCount")&&j(K.projectsCount==null?null:Number(K.projectsCount))),m(L=>H?H&&G.some(q=>q.id===H)?H:L&&G.some(q=>q.id===L)?L:G[0]?.id??null:null),k(!1),S(null),A(F)},refreshProjects:U,updateProject:Q=>{c(K=>K.map(G=>
25637G.id===Q.id?{...G,...Q}:G))},markProjectDeleted:T,isProjectRecentlyDeleted:M,removeProject:Q=>{T(Q),c(K=>K.filter(G=>G.id!==Q)),m(K=>K===Q?null:K)}}),[P,$,M,U,F,I,T,s,h,a,x,w,v,u]);return t.jsx(uie.Provider,{value:X,children:e})}const DTt=Tn` 25638 0% { opacity: 0; transform: translateX(-50%) translateY(8px) scale(0.92); } 25639 12% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); } 25640 75% { opacity: 1; transform: translateX(-50%) translateY(-4px) scale(1); } 25641 100% { opacity: 0; transform: translateX(-50%) translateY(-18px) scale(0.96); } 25642`,LTt=Tn` 25643 0% { transform: rotate(0deg) scale(1); } 25644 40% { transform: rotate(12deg) scale(1.18); } 25645 100% { transform: rotate(0deg) scale(1); } 25646`,BTt=Tn` 25647 0% { box-shadow: 0 0 0 0 rgba(99,102,241,0.35); } 25648 50% { box-shadow: 0 0 0 6px rgba(99,102,241,0); } 25649 100% { box-shadow: 0 0 0 0 rgba(99,102,241,0); } 25650`,FTt=p.div.withConfig({displayName:"CreditSpendEffect__Chip",componentId:"sc-1pb6soa-0"})` 25651 position: fixed; 25652 bottom: 2rem; 25653 left: 50%; 25654 transform: translateX(-50%); 25655 z-index: 99999; 25656 pointer-events: none; 25657 25658 display: inline-flex; 25659 align-items: center; 25660 gap: 6px; 25661 padding: 7px 14px 7px 10px; 25662 border-radius: 20px; 25663 background: rgba(99, 102, 241, 0.10); 25664 border: 1px solid rgba(99, 102, 241, 0.22); 25665 backdrop-filter: blur(10px); 25666 box-shadow: 0 4px 20px rgba(99, 102, 241, 0.12); 25667 25668 animation: ${DTt} 2s ease forwards, ${BTt} 0.6s ease; 25669`,WTt=p.span.withConfig({displayName:"CreditSpendEffect__IconWrap",componentId:"sc-1pb6soa-1"})` 25670 display: flex; 25671 color: rgb(99, 102, 241); 25672 filter: drop-shadow(0 0 4px rgba(99,102,241,0.4)); 25673 animation: ${LTt} 0.6s ease; 25674`,UTt=p.span.withConfig({displayName:"CreditSpendEffect__Label",componentId:"sc-1pb6soa-2"})` 25675 font-size: 0.7rem; 25676 font-weight: 700; 25677 color: rgb(79, 70, 229); 25678 white-space: nowrap; 25679`;function HTt(){const[e,n]=l.useState(!1),i=l.useRef(void 0),r=l.useRef(0),o=l.useCallback(()=>{n(!1),r.current+=1,requestAnimationFrame(()=>{n(!0),clearTimeout(i.current),i.current=setTimeout(()=>n(!1),2e3)})},[]);return l.useEffect(()=>(window.addEventListener(VE,o),()=>window.removeEventListener(VE,o)),[o]),e?jr.createPortal(t.jsxs(FTt,{children:[t.jsx(WTt,{children:t.jsx(Sn,{size:14,strokeWidth:2.5})}),t.jsx(UTt,{children:"Credits used"})]},r.current),document.body):null}function qTt({children:e}){return t.jsx(ETe,{children:t.jsx(xTt,{children:t.jsx(NTt,{children:t.jsx(zTt,{children:t.jsx(TTt,{children:t.jsx(RTt,{children:t.jsx(OTt,{children:t.jsx(Wze,{children:t.jsxs(art,{children:[e,t.jsx(HTt,{})]})})})})})})})})})}F5(W8(wne()));kme.createRoot(document.getElementById("root")).render(t.jsx(qhe,{children:t.jsx(qTt,{children:t.jsx(yTt,{})})}));
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.