| 8 |
`+e.stack}return{value:e,source:t,stack:i,digest:null}}function Ts(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Es(e,t){try{console.error(t.value)}catch(e){setTimeout(function(){throw e})}}var Ds=typeof WeakMap==`function`?WeakMap:Map;function Os(e,t,n){n=to(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){rl||(rl=!0,il=r),Es(e,t)},n}function ks(e,t,n){n=to(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r==`function`){var i=t.value;n.payload=function(){return r(i)},n.callback=function(){Es(e,t)}}var a=e.stateNode;return a!==null&&typeof a.componentDidCatch==`function`&&(n.callback=function(){Es(e,t),typeof r!=`function`&&(al===null?al=new Set([this]):al.add(this));var n=t.stack;this.componentDidCatch(t.value,{componentStack:n===null?``:n})}),n}function As(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Ds;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(i.add(n),e=zl.bind(null,e,t,n),t.then(e,e))}function js(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t===null?!0:t.dehydrated!==null),t)return e;e=e.return}while(e!==null);return null}function Ms(e,t,n,r,i){return e.mode&1?(e.flags|=65536,e.lanes=i,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=to(-1,1),t.tag=2,no(n,t,1))),n.lanes|=1),e)}var Ns=C.ReactCurrentOwner,Ps=!1;function Fs(e,t,n,r){t.child=e===null?Ra(t,null,n,r):La(t,e.child,n,r)}function Is(e,t,n,r,i){n=n.render;var a=t.ref;return Ka(t,i),r=jo(e,t,n,r,a,i),n=Mo(),e!==null&&!Ps?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,nc(e,t,i)):(q&&n&&va(t),t.flags|=1,Fs(e,t,r,i),t.child)}function Ls(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!ql(a)&&a.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=a,Rs(e,t,a,r,i)):(e=Xl(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,(e.lanes&i)===0){var o=a.memoizedProps;if(n=n.compare,n=n===null?Or:n,n(o,r)&&e.ref===t.ref)return nc(e,t,i)}return t.flags|=1,e=Yl(a,r),e.ref=t.ref,e.return=t,t.child=e}function Rs(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Or(a,r)&&e.ref===t.ref)if(Ps=!1,t.pendingProps=r=a,(e.lanes&i)!==0)e.flags&131072&&(Ps=!0);else return t.lanes=e.lanes,nc(e,t,i)}return Vs(e,t,n,r,i)}function zs(e,t,n){var r=t.pendingProps,i=r.children,a=e===null?null:e.memoizedState;if(r.mode===`hidden`)if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},K(Kc,Gc),Gc|=n;else{if(!(n&1073741824))return e=a===null?n:a.baseLanes|n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,K(Kc,Gc),Gc|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=a===null?n:a.baseLanes,K(Kc,Gc),Gc|=r}else a===null?r=n:(r=a.baseLanes|n,t.memoizedState=null),K(Kc,Gc),Gc|=r;return Fs(e,t,i,n),t.child}function Bs(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Vs(e,t,n,r,i){var a=Yi(n)?qi:Gi.current;return a=Ji(t,a),Ka(t,i),n=jo(e,t,n,r,a,i),r=Mo(),e!==null&&!Ps?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,nc(e,t,i)):(q&&r&&va(t),t.flags|=1,Fs(e,t,n,i),t.child)}function Hs(e,t,n,r,i){if(Yi(n)){var a=!0;$i(t)}else a=!1;if(Ka(t,i),t.stateNode===null)tc(e,t),xs(t,n,r),Cs(t,n,r,i),r=!0;else if(e===null){var o=t.stateNode,s=t.memoizedProps;o.props=s;var c=o.context,l=n.contextType;typeof l==`object`&&l?l=qa(l):(l=Yi(n)?qi:Gi.current,l=Ji(t,l));var u=n.getDerivedStateFromProps,d=typeof u==`function`||typeof o.getSnapshotBeforeUpdate==`function`;d||typeof o.UNSAFE_componentWillReceiveProps!=`function`&&typeof o.componentWillReceiveProps!=`function`||(s!==r||c!==l)&&Ss(t,o,r,l),Qa=!1;var f=t.memoizedState;o.state=f,ao(t,r,o,i),c=t.memoizedState,s!==r||f!==c||Ki.current||Qa?(typeof u==`function`&&(vs(t,n,u,r),c=t.memoizedState),(s=Qa||bs(t,n,s,r,f,c,l))?(d||typeof o.UNSAFE_componentWillMount!=`function`&&typeof o.componentWillMount!=`function`||(typeof o.componentWillMount==`function`&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount==`function`&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount==`function`&&(t.flags|=4194308)):(typeof o.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),o.props=r,o.state=c,o.context=l,r=s):(typeof o.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,eo(e,t),s=t.memoizedProps,l=t.type===t.elementType?s:_s(t.type,s),o.props=l,d=t.pendingProps,f=o.context,c=n.contextType,typeof c==`object`&&c?c=qa(c):(c=Yi(n)?qi:Gi.current,c=Ji(t,c));var p=n.getDerivedStateFromProps;(u=typeof p==`function`||typeof o.getSnapshotBeforeUpdate==`function`)||typeof o.UNSAFE_componentWillReceiveProps!=`function`&&typeof o.componentWillReceiveProps!=`function`||(s!==d||f!==c)&&Ss(t,o,r,c),Qa=!1,f=t.memoizedState,o.state=f,ao(t,r,o,i);var m=t.memoizedState;s!==d||f!==m||Ki.current||Qa?(typeof p==`function`&&(vs(t,n,p,r),m=t.memoizedState),(l=Qa||bs(t,n,l,r,f,m,c)||!1)?(u||typeof o.UNSAFE_componentWillUpdate!=`function`&&typeof o.componentWillUpdate!=`function`||(typeof o.componentWillUpdate==`function`&&o.componentWillUpdate(r,m,c),typeof o.UNSAFE_componentWillUpdate==`function`&&o.UNSAFE_componentWillUpdate(r,m,c)),typeof o.componentDidUpdate==`function`&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof o.componentDidUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=m),o.props=r,o.state=m,o.context=c,r=l):(typeof o.componentDidUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!=`function`||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return Us(e,t,n,r,a,i)}function Us(e,t,n,r,i,a){Bs(e,t);var o=(t.flags&128)!=0;if(!r&&!o)return i&&ea(t,n,!1),nc(e,t,a);r=t.stateNode,Ns.current=t;var s=o&&typeof n.getDerivedStateFromError!=`function`?null:r.render();return t.flags|=1,e!==null&&o?(t.child=La(t,e.child,null,a),t.child=La(t,null,s,a)):Fs(e,t,s,a),t.memoizedState=r.state,i&&ea(t,n,!0),t.child}function Ws(e){var t=e.stateNode;t.pendingContext?Zi(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Zi(e,t.context,!1),po(e,t.containerInfo)}function Gs(e,t,n,r,i){return Aa(),ja(i),t.flags|=256,Fs(e,t,n,r),t.child}var Ks={dehydrated:null,treeContext:null,retryLane:0};function qs(e){return{baseLanes:e,cachePool:null,transitions:null}}function Js(e,t,n){var r=t.pendingProps,i=J.current,a=!1,o=(t.flags&128)!=0,s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:(i&2)!=0),s?(a=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(i|=1),K(J,i&1),e===null)return Ea(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data===`$!`?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(o=r.children,e=r.fallback,a?(r=t.mode,a=t.child,o={mode:`hidden`,children:o},!(r&1)&&a!==null?(a.childLanes=0,a.pendingProps=o):a=Ql(o,r,0,null),e=Zl(e,r,n,null),a.return=t,e.return=t,a.sibling=e,t.child=a,t.child.memoizedState=qs(n),t.memoizedState=Ks,e):Ys(t,o));if(i=e.memoizedState,i!==null&&(s=i.dehydrated,s!==null))return Zs(e,t,o,r,s,i,n);if(a){a=r.fallback,o=t.mode,i=e.child,s=i.sibling;var c={mode:`hidden`,children:r.children};return!(o&1)&&t.child!==i?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=Yl(i,c),r.subtreeFlags=i.subtreeFlags&14680064),s===null?(a=Zl(a,o,n,null),a.flags|=2):a=Yl(s,a),a.return=t,r.return=t,r.sibling=a,t.child=r,r=a,a=t.child,o=e.child.memoizedState,o=o===null?qs(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},a.memoizedState=o,a.childLanes=e.childLanes&~n,t.memoizedState=Ks,r}return a=e.child,e=a.sibling,r=Yl(a,{mode:`visible`,children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function Ys(e,t){return t=Ql({mode:`visible`,children:t},e.mode,0,null),t.return=e,e.child=t}function Xs(e,t,n,r){return r!==null&&ja(r),La(t,e.child,null,n),e=Ys(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Zs(e,t,n,i,a,o,s){if(n)return t.flags&256?(t.flags&=-257,i=Ts(Error(r(422))),Xs(e,t,s,i)):t.memoizedState===null?(o=i.fallback,a=t.mode,i=Ql({mode:`visible`,children:i.children},a,0,null),o=Zl(o,a,s,null),o.flags|=2,i.return=t,o.return=t,i.sibling=o,t.child=i,t.mode&1&&La(t,e.child,null,s),t.child.memoizedState=qs(s),t.memoizedState=Ks,o):(t.child=e.child,t.flags|=128,null);if(!(t.mode&1))return Xs(e,t,s,null);if(a.data===`$!`){if(i=a.nextSibling&&a.nextSibling.dataset,i)var c=i.dgst;return i=c,o=Error(r(419)),i=Ts(o,i,void 0),Xs(e,t,s,i)}if(c=(s&e.childLanes)!==0,Ps||c){if(i=Uc,i!==null){switch(s&-s){case 4:a=2;break;case 16:a=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:a=32;break;case 536870912:a=268435456;break;default:a=0}a=(a&(i.suspendedLanes|s))===0?a:0,a!==0&&a!==o.retryLane&&(o.retryLane=a,Za(e,a),hl(i,e,a,-1))}return kl(),i=Ts(Error(r(421))),Xs(e,t,s,i)}return a.data===`$?`?(t.flags|=128,t.child=e.child,t=Vl.bind(null,e),a._reactRetry=t,null):(e=o.treeContext,xa=Oi(a.nextSibling),ba=t,q=!0,Sa=null,e!==null&&(da[fa++]=ma,da[fa++]=ha,da[fa++]=pa,ma=e.id,ha=e.overflow,pa=t),t=Ys(t,i.children),t.flags|=4096,t)}function Qs(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Ga(e.return,t,n)}function $s(e,t,n,r,i){var a=e.memoizedState;a===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(a.isBackwards=t,a.rendering=null,a.renderingStartTime=0,a.last=r,a.tail=n,a.tailMode=i)}function ec(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;if(Fs(e,t,r.children,n),r=J.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Qs(e,n,t);else if(e.tag===19)Qs(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(K(J,r),!(t.mode&1))t.memoizedState=null;else switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&_o(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),$s(t,!1,i,n,a);break;case`backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&_o(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}$s(t,!0,n,null,a);break;case`together`:$s(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function tc(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function nc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Yc|=t.lanes,(n&t.childLanes)===0)return null;if(e!==null&&t.child!==e.child)throw Error(r(153));if(t.child!==null){for(e=t.child,n=Yl(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Yl(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function rc(e,t,n){switch(t.tag){case 3:Ws(t),Aa();break;case 5:ho(t);break;case 1:Yi(t.type)&&$i(t);break;case 4:po(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,i=t.memoizedProps.value;K(za,r._currentValue),r._currentValue=i;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(K(J,J.current&1),e=nc(e,t,n),e===null?null:e.sibling):Js(e,t,n):(K(J,J.current&1),t.flags|=128,null);K(J,J.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return ec(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),K(J,J.current),r)break;return null;case 22:case 23:return t.lanes=0,zs(e,t,n)}return nc(e,t,n)}var ic=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},ac=function(e,t,n,r){var i=e.memoizedProps;if(i!==r){e=t.stateNode,fo(co.current);var o=null;switch(n){case`input`:i=ye(e,i),r=ye(e,r),o=[];break;case`select`:i=N({},i,{value:void 0}),r=N({},r,{value:void 0}),o=[];break;case`textarea`:i=De(e,i),r=De(e,r),o=[];break;default:typeof i.onClick!=`function`&&typeof r.onClick==`function`&&(e.onclick=vi)}Be(n,r);var s;for(u in n=null,i)if(!r.hasOwnProperty(u)&&i.hasOwnProperty(u)&&i[u]!=null)if(u===`style`){var c=i[u];for(s in c)c.hasOwnProperty(s)&&(n||={},n[s]=``)}else u!==`dangerouslySetInnerHTML`&&u!==`children`&&u!==`suppressContentEditableWarning`&&u!==`suppressHydrationWarning`&&u!==`autoFocus`&&(a.hasOwnProperty(u)?o||=[]:(o||=[]).push(u,null));for(u in r){var l=r[u];if(c=i?.[u],r.hasOwnProperty(u)&&l!==c&&(l!=null||c!=null))if(u===`style`)if(c){for(s in c)!c.hasOwnProperty(s)||l&&l.hasOwnProperty(s)||(n||={},n[s]=``);for(s in l)l.hasOwnProperty(s)&&c[s]!==l[s]&&(n||={},n[s]=l[s])}else n||(o||=[],o.push(u,n)),n=l;else u===`dangerouslySetInnerHTML`?(l=l?l.__html:void 0,c=c?c.__html:void 0,l!=null&&c!==l&&(o||=[]).push(u,l)):u===`children`?typeof l!=`string`&&typeof l!=`number`||(o||=[]).push(u,``+l):u!==`suppressContentEditableWarning`&&u!==`suppressHydrationWarning`&&(a.hasOwnProperty(u)?(l!=null&&u===`onScroll`&&W(`scroll`,e),o||c===l||(o=[])):(o||=[]).push(u,l))}n&&(o||=[]).push(`style`,n);var u=o;(t.updateQueue=u)&&(t.flags|=4)}},oc=function(e,t,n,r){n!==r&&(t.flags|=4)};function sc(e,t){if(!q)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function cc(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function lc(e,t,n){var i=t.pendingProps;switch(ya(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return cc(t),null;case 1:return Yi(t.type)&&Xi(),cc(t),null;case 3:return i=t.stateNode,mo(),G(Ki),G(Gi),yo(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(e===null||e.child===null)&&(Oa(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Sa!==null&&(yl(Sa),Sa=null))),cc(t),null;case 5:go(t);var o=fo(uo.current);if(n=t.type,e!==null&&t.stateNode!=null)ac(e,t,n,i,o),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!i){if(t.stateNode===null)throw Error(r(166));return cc(t),null}if(e=fo(co.current),Oa(t)){i=t.stateNode,n=t.type;var s=t.memoizedProps;switch(i[ji]=t,i[Mi]=s,e=(t.mode&1)!=0,n){case`dialog`:W(`cancel`,i),W(`close`,i);break;case`iframe`:case`object`:case`embed`:W(`load`,i);break;case`video`:case`audio`:for(o=0;o<ti.length;o++)W(ti[o],i);break;case`source`:W(`error`,i);break;case`img`:case`image`:case`link`:W(`error`,i),W(`load`,i);break;case`details`:W(`toggle`,i);break;case`input`:be(i,s),W(`invalid`,i);break;case`select`:i._wrapperState={wasMultiple:!!s.multiple},W(`invalid`,i);break;case`textarea`:Oe(i,s),W(`invalid`,i)}for(var c in Be(n,s),o=null,s)if(s.hasOwnProperty(c)){var l=s[c];c===`children`?typeof l==`string`?i.textContent!==l&&(!0!==s.suppressHydrationWarning&&_i(i.textContent,l,e),o=[`children`,l]):typeof l==`number`&&i.textContent!==``+l&&(!0!==s.suppressHydrationWarning&&_i(i.textContent,l,e),o=[`children`,``+l]):a.hasOwnProperty(c)&&l!=null&&c===`onScroll`&&W(`scroll`,i)}switch(n){case`input`:ge(i),Ce(i,s,!0);break;case`textarea`:ge(i),Ae(i);break;case`select`:case`option`:break;default:typeof s.onClick==`function`&&(i.onclick=vi)}i=o,t.updateQueue=i,i!==null&&(t.flags|=4)}else{c=o.nodeType===9?o:o.ownerDocument,e===`http://www.w3.org/1999/xhtml`&&(e=je(n)),e===`http://www.w3.org/1999/xhtml`?n===`script`?(e=c.createElement(`div`),e.innerHTML=`<script><\/script>`,e=e.removeChild(e.firstChild)):typeof i.is==`string`?e=c.createElement(n,{is:i.is}):(e=c.createElement(n),n===`select`&&(c=e,i.multiple?c.multiple=!0:i.size&&(c.size=i.size))):e=c.createElementNS(e,n),e[ji]=t,e[Mi]=i,ic(e,t,!1,!1),t.stateNode=e;a:{switch(c=Ve(n,i),n){case`dialog`:W(`cancel`,e),W(`close`,e),o=i;break;case`iframe`:case`object`:case`embed`:W(`load`,e),o=i;break;case`video`:case`audio`:for(o=0;o<ti.length;o++)W(ti[o],e);o=i;break;case`source`:W(`error`,e),o=i;break;case`img`:case`image`:case`link`:W(`error`,e),W(`load`,e),o=i;break;case`details`:W(`toggle`,e),o=i;break;case`input`:be(e,i),o=ye(e,i),W(`invalid`,e);break;case`option`:o=i;break;case`select`:e._wrapperState={wasMultiple:!!i.multiple},o=N({},i,{value:void 0}),W(`invalid`,e);break;case`textarea`:Oe(e,i),o=De(e,i),W(`invalid`,e);break;default:o=i}for(s in Be(n,o),l=o,l)if(l.hasOwnProperty(s)){var u=l[s];s===`style`?P(e,u):s===`dangerouslySetInnerHTML`?(u=u?u.__html:void 0,u!=null&&Pe(e,u)):s===`children`?typeof u==`string`?(n!==`textarea`||u!==``)&&Fe(e,u):typeof u==`number`&&Fe(e,``+u):s!==`suppressContentEditableWarning`&&s!==`suppressHydrationWarning`&&s!==`autoFocus`&&(a.hasOwnProperty(s)?u!=null&&s===`onScroll`&&W(`scroll`,e):u!=null&&S(e,s,u,c))}switch(n){case`input`:ge(e),Ce(e,i,!1);break;case`textarea`:ge(e),Ae(e);break;case`option`:i.value!=null&&e.setAttribute(`value`,``+pe(i.value));break;case`select`:e.multiple=!!i.multiple,s=i.value,s==null?i.defaultValue!=null&&Ee(e,!!i.multiple,i.defaultValue,!0):Ee(e,!!i.multiple,s,!1);break;default:typeof o.onClick==`function`&&(e.onclick=vi)}switch(n){case`button`:case`input`:case`select`:case`textarea`:i=!!i.autoFocus;break a;case`img`:i=!0;break a;default:i=!1}}i&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return cc(t),null;case 6:if(e&&t.stateNode!=null)oc(e,t,e.memoizedProps,i);else{if(typeof i!=`string`&&t.stateNode===null)throw Error(r(166));if(n=fo(uo.current),fo(co.current),Oa(t)){if(i=t.stateNode,n=t.memoizedProps,i[ji]=t,(s=i.nodeValue!==n)&&(e=ba,e!==null))switch(e.tag){case 3:_i(i.nodeValue,n,(e.mode&1)!=0);break;case 5:!0!==e.memoizedProps.suppressHydrationWarning&&_i(i.nodeValue,n,(e.mode&1)!=0)}s&&(t.flags|=4)}else i=(n.nodeType===9?n:n.ownerDocument).createTextNode(i),i[ji]=t,t.stateNode=i}return cc(t),null;case 13:if(G(J),i=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(q&&xa!==null&&t.mode&1&&!(t.flags&128))ka(),Aa(),t.flags|=98560,s=!1;else if(s=Oa(t),i!==null&&i.dehydrated!==null){if(e===null){if(!s)throw Error(r(318));if(s=t.memoizedState,s=s===null?null:s.dehydrated,!s)throw Error(r(317));s[ji]=t}else Aa(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;cc(t),s=!1}else Sa!==null&&(yl(Sa),Sa=null),s=!0;if(!s)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(i=i!==null,i!==(e!==null&&e.memoizedState!==null)&&i&&(t.child.flags|=8192,t.mode&1&&(e===null||J.current&1?qc===0&&(qc=3):kl())),t.updateQueue!==null&&(t.flags|=4),cc(t),null);case 4:return mo(),e===null&&si(t.stateNode.containerInfo),cc(t),null;case 10:return Wa(t.type._context),cc(t),null;case 17:return Yi(t.type)&&Xi(),cc(t),null;case 19:if(G(J),s=t.memoizedState,s===null)return cc(t),null;if(i=(t.flags&128)!=0,c=s.rendering,c===null)if(i)sc(s,!1);else{if(qc!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(c=_o(e),c!==null){for(t.flags|=128,sc(s,!1),i=c.updateQueue,i!==null&&(t.updateQueue=i,t.flags|=4),t.subtreeFlags=0,i=n,n=t.child;n!==null;)s=n,e=i,s.flags&=14680066,c=s.alternate,c===null?(s.childLanes=0,s.lanes=e,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=c.childLanes,s.lanes=c.lanes,s.child=c.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=c.memoizedProps,s.memoizedState=c.memoizedState,s.updateQueue=c.updateQueue,s.type=c.type,e=c.dependencies,s.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return K(J,J.current&1|2),t.child}e=e.sibling}s.tail!==null&&I()>tl&&(t.flags|=128,i=!0,sc(s,!1),t.lanes=4194304)}else{if(!i)if(e=_o(c),e!==null){if(t.flags|=128,i=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),sc(s,!0),s.tail===null&&s.tailMode===`hidden`&&!c.alternate&&!q)return cc(t),null}else 2*I()-s.renderingStartTime>tl&&n!==1073741824&&(t.flags|=128,i=!0,sc(s,!1),t.lanes=4194304);s.isBackwards?(c.sibling=t.child,t.child=c):(n=s.last,n===null?t.child=c:n.sibling=c,s.last=c)}return s.tail===null?(cc(t),null):(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=I(),t.sibling=null,n=J.current,K(J,i?n&1|2:n&1),t);case 22:case 23:return Tl(),i=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==i&&(t.flags|=8192),i&&t.mode&1?Gc&1073741824&&(cc(t),t.subtreeFlags&6&&(t.flags|=8192)):cc(t),null;case 24:return null;case 25:return null}throw Error(r(156,t.tag))}function uc(e,t){switch(ya(t),t.tag){case 1:return Yi(t.type)&&Xi(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return mo(),G(Ki),G(Gi),yo(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return go(t),null;case 13:if(G(J),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));Aa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return G(J),null;case 4:return mo(),null;case 10:return Wa(t.type._context),null;case 22:case 23:return Tl(),null;case 24:return null;default:return null}}var dc=!1,fc=!1,pc=typeof WeakSet==`function`?WeakSet:Set,X=null;function mc(e,t){var n=e.ref;if(n!==null)if(typeof n==`function`)try{n(null)}catch(n){$(e,t,n)}else n.current=null}function hc(e,t,n){try{n()}catch(n){$(e,t,n)}}var gc=!1;function _c(e,t){if(yi=hn,e=Mr(),Nr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var i=n.getSelection&&n.getSelection();if(i&&i.rangeCount!==0){n=i.anchorNode;var a=i.anchorOffset,o=i.focusNode;i=i.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||i!==0&&f.nodeType!==3||(l=s+i),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===i&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(bi={focusedElem:e,selectionRange:n},hn=!1,X=t;X!==null;)if(t=X,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,X=e;else for(;X!==null;){t=X;try{var h=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(h!==null){var g=h.memoizedProps,_=h.memoizedState,v=t.stateNode;v.__reactInternalSnapshotBeforeUpdate=v.getSnapshotBeforeUpdate(t.elementType===t.type?g:_s(t.type,g),_)}break;case 3:var y=t.stateNode.containerInfo;y.nodeType===1?y.textContent=``:y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(e){$(t,t.return,e)}if(e=t.sibling,e!==null){e.return=t.return,X=e;break}X=t.return}return h=gc,gc=!1,h}function vc(e,t,n){var r=t.updateQueue;if(r=r===null?null:r.lastEffect,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var a=i.destroy;i.destroy=void 0,a!==void 0&&hc(t,n,a)}i=i.next}while(i!==r)}}function yc(e,t){if(t=t.updateQueue,t=t===null?null:t.lastEffect,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function bc(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t==`function`?t(e):t.current=e}}function xc(e){var t=e.alternate;t!==null&&(e.alternate=null,xc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[ji],delete t[Mi],delete t[Pi],delete t[Fi],delete t[Ii])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Sc(e){return e.tag===5||e.tag===3||e.tag===4}function Cc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Sc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function wc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=vi));else if(r!==4&&(e=e.child,e!==null))for(wc(e,t,n),e=e.sibling;e!==null;)wc(e,t,n),e=e.sibling}function Tc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Tc(e,t,n),e=e.sibling;e!==null;)Tc(e,t,n),e=e.sibling}var Ec=null,Dc=!1;function Oc(e,t,n){for(n=n.child;n!==null;)kc(e,t,n),n=n.sibling}function kc(e,t,n){if(Et&&typeof Et.onCommitFiberUnmount==`function`)try{Et.onCommitFiberUnmount(Tt,n)}catch{}switch(n.tag){case 5:fc||mc(n,t);case 6:var r=Ec,i=Dc;Ec=null,Oc(e,t,n),Ec=r,Dc=i,Ec!==null&&(Dc?(e=Ec,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Ec.removeChild(n.stateNode));break;case 18:Ec!==null&&(Dc?(e=Ec,n=n.stateNode,e.nodeType===8?Di(e.parentNode,n):e.nodeType===1&&Di(e,n),pn(e)):Di(Ec,n.stateNode));break;case 4:r=Ec,i=Dc,Ec=n.stateNode.containerInfo,Dc=!0,Oc(e,t,n),Ec=r,Dc=i;break;case 0:case 11:case 14:case 15:if(!fc&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var a=i,o=a.destroy;a=a.tag,o!==void 0&&(a&2||a&4)&&hc(n,t,o),i=i.next}while(i!==r)}Oc(e,t,n);break;case 1:if(!fc&&(mc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(e){$(n,t,e)}Oc(e,t,n);break;case 21:Oc(e,t,n);break;case 22:n.mode&1?(fc=(r=fc)||n.memoizedState!==null,Oc(e,t,n),fc=r):Oc(e,t,n);break;default:Oc(e,t,n)}}function Ac(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new pc),t.forEach(function(t){var r=Hl.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))})}}function jc(e,t){var n=t.deletions;if(n!==null)for(var i=0;i<n.length;i++){var a=n[i];try{var o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 5:Ec=c.stateNode,Dc=!1;break a;case 3:Ec=c.stateNode.containerInfo,Dc=!0;break a;case 4:Ec=c.stateNode.containerInfo,Dc=!0;break a}c=c.return}if(Ec===null)throw Error(r(160));kc(o,s,a),Ec=null,Dc=!1;var l=a.alternate;l!==null&&(l.return=null),a.return=null}catch(e){$(a,t,e)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)Mc(t,e),t=t.sibling}function Mc(e,t){var n=e.alternate,i=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(jc(t,e),Nc(e),i&4){try{vc(3,e,e.return),yc(3,e)}catch(t){$(e,e.return,t)}try{vc(5,e,e.return)}catch(t){$(e,e.return,t)}}break;case 1:jc(t,e),Nc(e),i&512&&n!==null&&mc(n,n.return);break;case 5:if(jc(t,e),Nc(e),i&512&&n!==null&&mc(n,n.return),e.flags&32){var a=e.stateNode;try{Fe(a,``)}catch(t){$(e,e.return,t)}}if(i&4&&(a=e.stateNode,a!=null)){var o=e.memoizedProps,s=n===null?o:n.memoizedProps,c=e.type,l=e.updateQueue;if(e.updateQueue=null,l!==null)try{c===`input`&&o.type===`radio`&&o.name!=null&&xe(a,o),Ve(c,s);var u=Ve(c,o);for(s=0;s<l.length;s+=2){var d=l[s],f=l[s+1];d===`style`?P(a,f):d===`dangerouslySetInnerHTML`?Pe(a,f):d===`children`?Fe(a,f):S(a,d,f,u)}switch(c){case`input`:Se(a,o);break;case`textarea`:ke(a,o);break;case`select`:var p=a._wrapperState.wasMultiple;a._wrapperState.wasMultiple=!!o.multiple;var m=o.value;m==null?p!==!!o.multiple&&(o.defaultValue==null?Ee(a,!!o.multiple,o.multiple?[]:``,!1):Ee(a,!!o.multiple,o.defaultValue,!0)):Ee(a,!!o.multiple,m,!1)}a[Mi]=o}catch(t){$(e,e.return,t)}}break;case 6:if(jc(t,e),Nc(e),i&4){if(e.stateNode===null)throw Error(r(162));a=e.stateNode,o=e.memoizedProps;try{a.nodeValue=o}catch(t){$(e,e.return,t)}}break;case 3:if(jc(t,e),Nc(e),i&4&&n!==null&&n.memoizedState.isDehydrated)try{pn(t.containerInfo)}catch(t){$(e,e.return,t)}break;case 4:jc(t,e),Nc(e);break;case 13:jc(t,e),Nc(e),a=e.child,a.flags&8192&&(o=a.memoizedState!==null,a.stateNode.isHidden=o,!o||a.alternate!==null&&a.alternate.memoizedState!==null||(el=I())),i&4&&Ac(e);break;case 22:if(d=n!==null&&n.memoizedState!==null,e.mode&1?(fc=(u=fc)||d,jc(t,e),fc=u):jc(t,e),Nc(e),i&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!d&&e.mode&1)for(X=e,d=e.child;d!==null;){for(f=X=d;X!==null;){switch(p=X,m=p.child,p.tag){case 0:case 11:case 14:case 15:vc(4,p,p.return);break;case 1:mc(p,p.return);var h=p.stateNode;if(typeof h.componentWillUnmount==`function`){i=p,n=p.return;try{t=i,h.props=t.memoizedProps,h.state=t.memoizedState,h.componentWillUnmount()}catch(e){$(i,n,e)}}break;case 5:mc(p,p.return);break;case 22:if(p.memoizedState!==null){Lc(f);continue}}m===null?Lc(f):(m.return=p,X=m)}d=d.sibling}a:for(d=null,f=e;;){if(f.tag===5){if(d===null){d=f;try{a=f.stateNode,u?(o=a.style,typeof o.setProperty==`function`?o.setProperty(`display`,`none`,`important`):o.display=`none`):(c=f.stateNode,l=f.memoizedProps.style,s=l!=null&&l.hasOwnProperty(`display`)?l.display:null,c.style.display=Re(`display`,s))}catch(t){$(e,e.return,t)}}}else if(f.tag===6){if(d===null)try{f.stateNode.nodeValue=u?``:f.memoizedProps}catch(t){$(e,e.return,t)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===e)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===e)break a;for(;f.sibling===null;){if(f.return===null||f.return===e)break a;d===f&&(d=null),f=f.return}d===f&&(d=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:jc(t,e),Nc(e),i&4&&Ac(e);break;case 21:break;default:jc(t,e),Nc(e)}}function Nc(e){var t=e.flags;if(t&2){try{a:{for(var n=e.return;n!==null;){if(Sc(n)){var i=n;break a}n=n.return}throw Error(r(160))}switch(i.tag){case 5:var a=i.stateNode;i.flags&32&&(Fe(a,``),i.flags&=-33),Tc(e,Cc(e),a);break;case 3:case 4:var o=i.stateNode.containerInfo;wc(e,Cc(e),o);break;default:throw Error(r(161))}}catch(t){$(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Pc(e,t,n){X=e,Fc(e,t,n)}function Fc(e,t,n){for(var r=(e.mode&1)!=0;X!==null;){var i=X,a=i.child;if(i.tag===22&&r){var o=i.memoizedState!==null||dc;if(!o){var s=i.alternate,c=s!==null&&s.memoizedState!==null||fc;s=dc;var l=fc;if(dc=o,(fc=c)&&!l)for(X=i;X!==null;)o=X,c=o.child,o.tag===22&&o.memoizedState!==null||c===null?Rc(i):(c.return=o,X=c);for(;a!==null;)X=a,Fc(a,t,n),a=a.sibling;X=i,dc=s,fc=l}Ic(e,t,n)}else i.subtreeFlags&8772&&a!==null?(a.return=i,X=a):Ic(e,t,n)}}function Ic(e){for(;X!==null;){var t=X;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:fc||yc(5,t);break;case 1:var i=t.stateNode;if(t.flags&4&&!fc)if(n===null)i.componentDidMount();else{var a=t.elementType===t.type?n.memoizedProps:_s(t.type,n.memoizedProps);i.componentDidUpdate(a,n.memoizedState,i.__reactInternalSnapshotBeforeUpdate)}var o=t.updateQueue;o!==null&&oo(t,o,i);break;case 3:var s=t.updateQueue;if(s!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}oo(t,s,n)}break;case 5:var c=t.stateNode;if(n===null&&t.flags&4){n=c;var l=t.memoizedProps;switch(t.type){case`button`:case`input`:case`select`:case`textarea`:l.autoFocus&&n.focus();break;case`img`:l.src&&(n.src=l.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var u=t.alternate;if(u!==null){var d=u.memoizedState;if(d!==null){var f=d.dehydrated;f!==null&&pn(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}fc||t.flags&512&&bc(t)}catch(e){$(t,t.return,e)}}if(t===e){X=null;break}if(n=t.sibling,n!==null){n.return=t.return,X=n;break}X=t.return}}function Lc(e){for(;X!==null;){var t=X;if(t===e){X=null;break}var n=t.sibling;if(n!==null){n.return=t.return,X=n;break}X=t.return}}function Rc(e){for(;X!==null;){var t=X;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{yc(4,t)}catch(e){$(t,n,e)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount==`function`){var i=t.return;try{r.componentDidMount()}catch(e){$(t,i,e)}}var a=t.return;try{bc(t)}catch(e){$(t,a,e)}break;case 5:var o=t.return;try{bc(t)}catch(e){$(t,o,e)}}}catch(e){$(t,t.return,e)}if(t===e){X=null;break}var s=t.sibling;if(s!==null){s.return=t.return,X=s;break}X=t.return}}var zc=Math.ceil,Bc=C.ReactCurrentDispatcher,Vc=C.ReactCurrentOwner,Hc=C.ReactCurrentBatchConfig,Z=0,Uc=null,Q=null,Wc=0,Gc=0,Kc=Ui(0),qc=0,Jc=null,Yc=0,Xc=0,Zc=0,Qc=null,$c=null,el=0,tl=1/0,nl=null,rl=!1,il=null,al=null,ol=!1,sl=null,cl=0,ll=0,ul=null,dl=-1,fl=0;function pl(){return Z&6?I():dl===-1?dl=I():dl}function ml(e){return e.mode&1?Z&2&&Wc!==0?Wc&-Wc:Ma.transition===null?(e=R,e===0?(e=window.event,e=e===void 0?16:yn(e.type),e):e):(fl===0&&(fl=zt()),fl):1}function hl(e,t,n,i){if(50<ll)throw ll=0,ul=null,Error(r(185));Vt(e,n,i),(!(Z&2)||e!==Uc)&&(e===Uc&&(!(Z&2)&&(Xc|=n),qc===4&&xl(e,Wc)),gl(e,i),n===1&&Z===0&&!(t.mode&1)&&(tl=I()+500,na&&oa()))}function gl(e,t){var n=e.callbackNode;Lt(e,t);var r=Ft(e,e===Uc?Wc:0);if(r===0)n!==null&&F(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&F(n),t===1)e.tag===0?aa(Sl.bind(null,e)):ia(Sl.bind(null,e)),Ti(function(){!(Z&6)&&oa()}),n=null;else{switch(Wt(r)){case 1:n=xt;break;case 4:n=St;break;case 16:n=L;break;case 536870912:n=wt;break;default:n=L}n=Wl(n,_l.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function _l(e,t){if(dl=-1,fl=0,Z&6)throw Error(r(327));var n=e.callbackNode;if(Ll()&&e.callbackNode!==n)return null;var i=Ft(e,e===Uc?Wc:0);if(i===0)return null;if(i&30||(i&e.expiredLanes)!==0||t)t=Al(e,i);else{t=i;var a=Z;Z|=2;var o=Ol();(Uc!==e||Wc!==t)&&(nl=null,tl=I()+500,El(e,t));do try{Ml();break}catch(t){Dl(e,t)}while(1);Ua(),Bc.current=o,Z=a,Q===null?(Uc=null,Wc=0,t=qc):t=0}if(t!==0){if(t===2&&(a=Rt(e),a!==0&&(i=a,t=vl(e,a))),t===1)throw n=Jc,El(e,0),xl(e,i),gl(e,I()),n;if(t===6)xl(e,i);else{if(a=e.current.alternate,!(i&30)&&!bl(a)&&(t=Al(e,i),t===2&&(o=Rt(e),o!==0&&(i=o,t=vl(e,o))),t===1))throw n=Jc,El(e,0),xl(e,i),gl(e,I()),n;switch(e.finishedWork=a,e.finishedLanes=i,t){case 0:case 1:throw Error(r(345));case 2:Fl(e,$c,nl);break;case 3:if(xl(e,i),(i&130023424)===i&&(t=el+500-I(),10<t)){if(Ft(e,0)!==0)break;if(a=e.suspendedLanes,(a&i)!==i){pl(),e.pingedLanes|=e.suspendedLanes&a;break}e.timeoutHandle=Si(Fl.bind(null,e,$c,nl),t);break}Fl(e,$c,nl);break;case 4:if(xl(e,i),(i&4194240)===i)break;for(t=e.eventTimes,a=-1;0<i;){var s=31-Ot(i);o=1<<s,s=t[s],s>a&&(a=s),i&=~o}if(i=a,i=I()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*zc(i/1960))-i,10<i){e.timeoutHandle=Si(Fl.bind(null,e,$c,nl),i);break}Fl(e,$c,nl);break;case 5:Fl(e,$c,nl);break;default:throw Error(r(329))}}}return gl(e,I()),e.callbackNode===n?_l.bind(null,e):null}function vl(e,t){var n=Qc;return e.current.memoizedState.isDehydrated&&(El(e,t).flags|=256),e=Al(e,t),e!==2&&(t=$c,$c=n,t!==null&&yl(t)),e}function yl(e){$c===null?$c=e:$c.push.apply($c,e)}function bl(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!Dr(a(),i))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function xl(e,t){for(t&=~Zc,t&=~Xc,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Ot(t),r=1<<n;e[n]=-1,t&=~r}}function Sl(e){if(Z&6)throw Error(r(327));Ll();var t=Ft(e,0);if(!(t&1))return gl(e,I()),null;var n=Al(e,t);if(e.tag!==0&&n===2){var i=Rt(e);i!==0&&(t=i,n=vl(e,i))}if(n===1)throw n=Jc,El(e,0),xl(e,t),gl(e,I()),n;if(n===6)throw Error(r(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Fl(e,$c,nl),gl(e,I()),null}function Cl(e,t){var n=Z;Z|=1;try{return e(t)}finally{Z=n,Z===0&&(tl=I()+500,na&&oa())}}function wl(e){sl!==null&&sl.tag===0&&!(Z&6)&&Ll();var t=Z;Z|=1;var n=Hc.transition,r=R;try{if(Hc.transition=null,R=1,e)return e()}finally{R=r,Hc.transition=n,Z=t,!(Z&6)&&oa()}}function Tl(){Gc=Kc.current,G(Kc)}function El(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,Ci(n)),Q!==null)for(n=Q.return;n!==null;){var r=n;switch(ya(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Xi();break;case 3:mo(),G(Ki),G(Gi),yo();break;case 5:go(r);break;case 4:mo();break;case 13:G(J);break;case 19:G(J);break;case 10:Wa(r.type._context);break;case 22:case 23:Tl()}n=n.return}if(Uc=e,Q=e=Yl(e.current,null),Wc=Gc=t,qc=0,Jc=null,Zc=Xc=Yc=0,$c=Qc=null,Ja!==null){for(t=0;t<Ja.length;t++)if(n=Ja[t],r=n.interleaved,r!==null){n.interleaved=null;var i=r.next,a=n.pending;if(a!==null){var o=a.next;a.next=i,r.next=o}n.pending=r}Ja=null}return e}function Dl(e,t){do{var n=Q;try{if(Ua(),bo.current=ps,To){for(var i=Y.memoizedState;i!==null;){var a=i.queue;a!==null&&(a.pending=null),i=i.next}To=!1}if(So=0,wo=Co=Y=null,Eo=!1,Do=0,Vc.current=null,n===null||n.return===null){qc=1,Jc=t,Q=null;break}a:{var o=e,s=n.return,c=n,l=t;if(t=Wc,c.flags|=32768,typeof l==`object`&&l&&typeof l.then==`function`){var u=l,d=c,f=d.tag;if(!(d.mode&1)&&(f===0||f===11||f===15)){var p=d.alternate;p?(d.updateQueue=p.updateQueue,d.memoizedState=p.memoizedState,d.lanes=p.lanes):(d.updateQueue=null,d.memoizedState=null)}var m=js(s);if(m!==null){m.flags&=-257,Ms(m,s,c,o,t),m.mode&1&&As(o,u,t),t=m,l=u;var h=t.updateQueue;if(h===null){var g=new Set;g.add(l),t.updateQueue=g}else h.add(l);break a}else{if(!(t&1)){As(o,u,t),kl();break a}l=Error(r(426))}}else if(q&&c.mode&1){var _=js(s);if(_!==null){!(_.flags&65536)&&(_.flags|=256),Ms(_,s,c,o,t),ja(ws(l,c));break a}}o=l=ws(l,c),qc!==4&&(qc=2),Qc===null?Qc=[o]:Qc.push(o),o=s;do{switch(o.tag){case 3:o.flags|=65536,t&=-t,o.lanes|=t;var v=Os(o,l,t);io(o,v);break a;case 1:c=l;var y=o.type,b=o.stateNode;if(!(o.flags&128)&&(typeof y.getDerivedStateFromError==`function`||b!==null&&typeof b.componentDidCatch==`function`&&(al===null||!al.has(b)))){o.flags|=65536,t&=-t,o.lanes|=t;var x=ks(o,c,t);io(o,x);break a}}o=o.return}while(o!==null)}Pl(n)}catch(e){t=e,Q===n&&n!==null&&(Q=n=n.return);continue}break}while(1)}function Ol(){var e=Bc.current;return Bc.current=ps,e===null?ps:e}function kl(){(qc===0||qc===3||qc===2)&&(qc=4),Uc===null||!(Yc&268435455)&&!(Xc&268435455)||xl(Uc,Wc)}function Al(e,t){var n=Z;Z|=2;var i=Ol();(Uc!==e||Wc!==t)&&(nl=null,El(e,t));do try{jl();break}catch(t){Dl(e,t)}while(1);if(Ua(),Z=n,Bc.current=i,Q!==null)throw Error(r(261));return Uc=null,Wc=0,qc}function jl(){for(;Q!==null;)Nl(Q)}function Ml(){for(;Q!==null&&!vt();)Nl(Q)}function Nl(e){var t=Ul(e.alternate,e,Gc);e.memoizedProps=e.pendingProps,t===null?Pl(e):Q=t,Vc.current=null}function Pl(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=uc(n,t),n!==null){n.flags&=32767,Q=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{qc=6,Q=null;return}}else if(n=lc(n,t,Gc),n!==null){Q=n;return}if(t=t.sibling,t!==null){Q=t;return}Q=t=e}while(t!==null);qc===0&&(qc=5)}function Fl(e,t,n){var r=R,i=Hc.transition;try{Hc.transition=null,R=1,Il(e,t,n,r)}finally{Hc.transition=i,R=r}return null}function Il(e,t,n,i){do Ll();while(sl!==null);if(Z&6)throw Error(r(327));n=e.finishedWork;var a=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(r(177));e.callbackNode=null,e.callbackPriority=0;var o=n.lanes|n.childLanes;if(Ht(e,o),e===Uc&&(Q=Uc=null,Wc=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||ol||(ol=!0,Wl(L,function(){return Ll(),null})),o=(n.flags&15990)!=0,n.subtreeFlags&15990||o){o=Hc.transition,Hc.transition=null;var s=R;R=1;var c=Z;Z|=4,Vc.current=null,_c(e,n),Mc(n,e),Pr(bi),hn=!!yi,bi=yi=null,e.current=n,Pc(n,e,a),yt(),Z=c,R=s,Hc.transition=o}else e.current=n;if(ol&&(ol=!1,sl=e,cl=a),o=e.pendingLanes,o===0&&(al=null),Dt(n.stateNode,i),gl(e,I()),t!==null)for(i=e.onRecoverableError,n=0;n<t.length;n++)a=t[n],i(a.value,{componentStack:a.stack,digest:a.digest});if(rl)throw rl=!1,e=il,il=null,e;return cl&1&&e.tag!==0&&Ll(),o=e.pendingLanes,o&1?e===ul?ll++:(ll=0,ul=e):ll=0,oa(),null}function Ll(){if(sl!==null){var e=Wt(cl),t=Hc.transition,n=R;try{if(Hc.transition=null,R=16>e?16:e,sl===null)var i=!1;else{if(e=sl,sl=null,cl=0,Z&6)throw Error(r(331));var a=Z;for(Z|=4,X=e.current;X!==null;){var o=X,s=o.child;if(X.flags&16){var c=o.deletions;if(c!==null){for(var l=0;l<c.length;l++){var u=c[l];for(X=u;X!==null;){var d=X;switch(d.tag){case 0:case 11:case 15:vc(8,d,o)}var f=d.child;if(f!==null)f.return=d,X=f;else for(;X!==null;){d=X;var p=d.sibling,m=d.return;if(xc(d),d===u){X=null;break}if(p!==null){p.return=m,X=p;break}X=m}}}var h=o.alternate;if(h!==null){var g=h.child;if(g!==null){h.child=null;do{var _=g.sibling;g.sibling=null,g=_}while(g!==null)}}X=o}}if(o.subtreeFlags&2064&&s!==null)s.return=o,X=s;else b:for(;X!==null;){if(o=X,o.flags&2048)switch(o.tag){case 0:case 11:case 15:vc(9,o,o.return)}var v=o.sibling;if(v!==null){v.return=o.return,X=v;break b}X=o.return}}var y=e.current;for(X=y;X!==null;){s=X;var b=s.child;if(s.subtreeFlags&2064&&b!==null)b.return=s,X=b;else b:for(s=y;X!==null;){if(c=X,c.flags&2048)try{switch(c.tag){case 0:case 11:case 15:yc(9,c)}}catch(e){$(c,c.return,e)}if(c===s){X=null;break b}var x=c.sibling;if(x!==null){x.return=c.return,X=x;break b}X=c.return}}if(Z=a,oa(),Et&&typeof Et.onPostCommitFiberRoot==`function`)try{Et.onPostCommitFiberRoot(Tt,e)}catch{}i=!0}return i}finally{R=n,Hc.transition=t}}return!1}function Rl(e,t,n){t=ws(n,t),t=Os(e,t,1),e=no(e,t,1),t=pl(),e!==null&&(Vt(e,1,t),gl(e,t))}function $(e,t,n){if(e.tag===3)Rl(e,e,n);else for(;t!==null;){if(t.tag===3){Rl(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(al===null||!al.has(r))){e=ws(n,e),e=ks(t,e,1),t=no(t,e,1),e=pl(),t!==null&&(Vt(t,1,e),gl(t,e));break}}t=t.return}}function zl(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=pl(),e.pingedLanes|=e.suspendedLanes&n,Uc===e&&(Wc&n)===n&&(qc===4||qc===3&&(Wc&130023424)===Wc&&500>I()-el?El(e,0):Zc|=n),gl(e,t)}function Bl(e,t){t===0&&(e.mode&1?(t=Nt,Nt<<=1,!(Nt&130023424)&&(Nt=4194304)):t=1);var n=pl();e=Za(e,t),e!==null&&(Vt(e,t,n),gl(e,n))}function Vl(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Bl(e,n)}function Hl(e,t){var n=0;switch(e.tag){case 13:var i=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:i=e.stateNode;break;default:throw Error(r(314))}i!==null&&i.delete(t),Bl(e,n)}var Ul=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Ki.current)Ps=!0;else{if((e.lanes&n)===0&&!(t.flags&128))return Ps=!1,rc(e,t,n);Ps=!!(e.flags&131072)}else Ps=!1,q&&t.flags&1048576&&_a(t,ua,t.index);switch(t.lanes=0,t.tag){case 2:var i=t.type;tc(e,t),e=t.pendingProps;var a=Ji(t,Gi.current);Ka(t,n),a=jo(null,t,i,e,a,n);var o=Mo();return t.flags|=1,typeof a==`object`&&a&&typeof a.render==`function`&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Yi(i)?(o=!0,$i(t)):o=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,$a(t),a.updater=ys,t.stateNode=a,a._reactInternals=t,Cs(t,i,e,n),t=Us(null,t,i,!0,o,n)):(t.tag=0,q&&o&&va(t),Fs(null,t,a,n),t=t.child),t;case 16:i=t.elementType;a:{switch(tc(e,t),e=t.pendingProps,a=i._init,i=a(i._payload),t.type=i,a=t.tag=Jl(i),e=_s(i,e),a){case 0:t=Vs(null,t,i,e,n);break a;case 1:t=Hs(null,t,i,e,n);break a;case 11:t=Is(null,t,i,e,n);break a;case 14:t=Ls(null,t,i,_s(i.type,e),n);break a}throw Error(r(306,i,``))}return t;case 0:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:_s(i,a),Vs(e,t,i,a,n);case 1:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:_s(i,a),Hs(e,t,i,a,n);case 3:a:{if(Ws(t),e===null)throw Error(r(387));i=t.pendingProps,o=t.memoizedState,a=o.element,eo(e,t),ao(t,i,null,n);var s=t.memoizedState;if(i=s.element,o.isDehydrated)if(o={element:i,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){a=ws(Error(r(423)),t),t=Gs(e,t,i,n,a);break a}else if(i!==a){a=ws(Error(r(424)),t),t=Gs(e,t,i,n,a);break a}else for(xa=Oi(t.stateNode.containerInfo.firstChild),ba=t,q=!0,Sa=null,n=Ra(t,null,i,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Aa(),i===a){t=nc(e,t,n);break a}Fs(e,t,i,n)}t=t.child}return t;case 5:return ho(t),e===null&&Ea(t),i=t.type,a=t.pendingProps,o=e===null?null:e.memoizedProps,s=a.children,xi(i,a)?s=null:o!==null&&xi(i,o)&&(t.flags|=32),Bs(e,t),Fs(e,t,s,n),t.child;case 6:return e===null&&Ea(t),null;case 13:return Js(e,t,n);case 4:return po(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=La(t,null,i,n):Fs(e,t,i,n),t.child;case 11:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:_s(i,a),Is(e,t,i,a,n);case 7:return Fs(e,t,t.pendingProps,n),t.child;case 8:return Fs(e,t,t.pendingProps.children,n),t.child;case 12:return Fs(e,t,t.pendingProps.children,n),t.child;case 10:a:{if(i=t.type._context,a=t.pendingProps,o=t.memoizedProps,s=a.value,K(za,i._currentValue),i._currentValue=s,o!==null)if(Dr(o.value,s)){if(o.children===a.children&&!Ki.current){t=nc(e,t,n);break a}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var c=o.dependencies;if(c!==null){s=o.child;for(var l=c.firstContext;l!==null;){if(l.context===i){if(o.tag===1){l=to(-1,n&-n),l.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),Ga(o.return,n,t),c.lanes|=n;break}l=l.next}}else if(o.tag===10)s=o.type===t.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(r(341));s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),Ga(s,n,t),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===t){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}Fs(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,i=t.pendingProps.children,Ka(t,n),a=qa(a),i=i(a),t.flags|=1,Fs(e,t,i,n),t.child;case 14:return i=t.type,a=_s(i,t.pendingProps),a=_s(i.type,a),Ls(e,t,i,a,n);case 15:return Rs(e,t,t.type,t.pendingProps,n);case 17:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:_s(i,a),tc(e,t),t.tag=1,Yi(i)?(e=!0,$i(t)):e=!1,Ka(t,n),xs(t,i,a),Cs(t,i,a,n),Us(null,t,i,!0,e,n);case 19:return ec(e,t,n);case 22:return zs(e,t,n)}throw Error(r(156,t.tag))};function Wl(e,t){return _t(e,t)}function Gl(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Kl(e,t,n,r){return new Gl(e,t,n,r)}function ql(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Jl(e){if(typeof e==`function`)return+!!ql(e);if(e!=null){if(e=e.$$typeof,e===re)return 11;if(e===A)return 14}return 2}function Yl(e,t){var n=e.alternate;return n===null?(n=Kl(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Xl(e,t,n,i,a,o){var s=2;if(i=e,typeof e==`function`)ql(e)&&(s=1);else if(typeof e==`string`)s=5;else a:switch(e){case E:return Zl(n.children,a,o,t);case ee:s=8,a|=8;break;case te:return e=Kl(12,n,t,a|2),e.elementType=te,e.lanes=o,e;case O:return e=Kl(13,n,t,a),e.elementType=O,e.lanes=o,e;case k:return e=Kl(19,n,t,a),e.elementType=k,e.lanes=o,e;case ie:return Ql(n,a,o,t);default:if(typeof e==`object`&&e)switch(e.$$typeof){case D:s=10;break a;case ne:s=9;break a;case re:s=11;break a;case A:s=14;break a;case j:s=16,i=null;break a}throw Error(r(130,e==null?e:typeof e,``))}return t=Kl(s,n,t,a),t.elementType=e,t.type=i,t.lanes=o,t}function Zl(e,t,n,r){return e=Kl(7,e,r,t),e.lanes=n,e}function Ql(e,t,n,r){return e=Kl(22,e,r,t),e.elementType=ie,e.lanes=n,e.stateNode={isHidden:!1},e}function $l(e,t,n){return e=Kl(6,e,null,t),e.lanes=n,e}function eu(e,t,n){return t=Kl(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function tu(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Bt(0),this.expirationTimes=Bt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Bt(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function nu(e,t,n,r,i,a,o,s,c){return e=new tu(e,t,n,s,c),t===1?(t=1,!0===a&&(t|=8)):t=0,a=Kl(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},$a(a),e}function ru(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:T,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}function iu(e){if(!e)return Wi;e=e._reactInternals;a:{if(dt(e)!==e||e.tag!==1)throw Error(r(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break a;case 1:if(Yi(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break a}}t=t.return}while(t!==null);throw Error(r(171))}if(e.tag===1){var n=e.type;if(Yi(n))return Qi(e,n,t)}return t}function au(e,t,n,r,i,a,o,s,c){return e=nu(n,r,!0,e,i,a,o,s,c),e.context=iu(null),n=e.current,r=pl(),i=ml(n),a=to(r,i),a.callback=t??null,no(n,a,i),e.current.lanes=i,Vt(e,i,r),gl(e,r),e}function ou(e,t,n,r){var i=t.current,a=pl(),o=ml(i);return n=iu(n),t.context===null?t.context=n:t.pendingContext=n,t=to(a,o),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=no(i,t,o),e!==null&&(hl(e,i,o,a),ro(e,i,o)),o}function su(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function cu(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function lu(e,t){cu(e,t),(e=e.alternate)&&cu(e,t)}function uu(){return null}var du=typeof reportError==`function`?reportError:function(e){console.error(e)};function fu(e){this._internalRoot=e}pu.prototype.render=fu.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(r(409));ou(e,t,null,null)},pu.prototype.unmount=fu.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;wl(function(){ou(null,e,null,null)}),t[Ni]=null}};function pu(e){this._internalRoot=e}pu.prototype.unstable_scheduleHydration=function(e){if(e){var t=Jt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<rn.length&&t!==0&&t<rn[n].priority;n++);rn.splice(n,0,e),n===0&&ln(e)}};function mu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function hu(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==` react-mount-point-unstable `))}function gu(){}function _u(e,t,n,r,i){if(i){if(typeof r==`function`){var a=r;r=function(){var e=su(o);a.call(e)}}var o=au(t,r,e,0,null,!1,!1,``,gu);return e._reactRootContainer=o,e[Ni]=o.current,si(e.nodeType===8?e.parentNode:e),wl(),o}for(;i=e.lastChild;)e.removeChild(i);if(typeof r==`function`){var s=r;r=function(){var e=su(c);s.call(e)}}var c=nu(e,0,!1,null,null,!1,!1,``,gu);return e._reactRootContainer=c,e[Ni]=c.current,si(e.nodeType===8?e.parentNode:e),wl(function(){ou(t,c,n,r)}),c}function vu(e,t,n,r,i){var a=n._reactRootContainer;if(a){var o=a;if(typeof i==`function`){var s=i;i=function(){var e=su(o);s.call(e)}}ou(t,o,e,i)}else o=_u(n,t,e,i,r);return su(o)}Gt=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Pt(t.pendingLanes);n!==0&&(Ut(t,n|1),gl(t,I()),!(Z&6)&&(tl=I()+500,oa()))}break;case 13:wl(function(){var t=Za(e,1);t!==null&&hl(t,e,1,pl())}),lu(e,1)}},Kt=function(e){if(e.tag===13){var t=Za(e,134217728);t!==null&&hl(t,e,134217728,pl()),lu(e,134217728)}},qt=function(e){if(e.tag===13){var t=ml(e),n=Za(e,t);n!==null&&hl(n,e,t,pl()),lu(e,t)}},Jt=function(){return R},Yt=function(e,t){var n=R;try{return R=e,t()}finally{R=n}},We=function(e,t,n){switch(t){case`input`:if(Se(e,n),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name=`+JSON.stringify(``+t)+`][type="radio"]`),t=0;t<n.length;t++){var i=n[t];if(i!==e&&i.form===e.form){var a=Bi(i);if(!a)throw Error(r(90));_e(i),Se(i,a)}}}break;case`textarea`:ke(e,n);break;case`select`:t=n.value,t!=null&&Ee(e,!!n.multiple,t,!1)}},Xe=Cl,Ze=wl;var yu={usingClientEntryPoint:!1,Events:[Ri,zi,Bi,Je,Ye,Cl]},bu={findFiberByHostInstance:Li,bundleType:0,version:`18.3.1`,rendererPackageName:`react-dom`},xu={bundleType:bu.bundleType,version:bu.version,rendererPackageName:bu.rendererPackageName,rendererConfig:bu.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:C.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=ht(e),e===null?null:e.stateNode},findFiberByHostInstance:bu.findFiberByHostInstance||uu,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:`18.3.1-next-f1338f8080-20240426`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var Su=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Su.isDisabled&&Su.supportsFiber)try{Tt=Su.inject(xu),Et=Su}catch{}}e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=yu,e.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!mu(t))throw Error(r(200));return ru(e,t,null,n)},e.createRoot=function(e,t){if(!mu(e))throw Error(r(299));var n=!1,i=``,a=du;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(i=t.identifierPrefix),t.onRecoverableError!==void 0&&(a=t.onRecoverableError)),t=nu(e,1,!1,null,null,n,!1,i,a),e[Ni]=t.current,si(e.nodeType===8?e.parentNode:e),new fu(t)},e.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(r(188)):(e=Object.keys(e).join(`,`),Error(r(268,e)));return e=ht(t),e=e===null?null:e.stateNode,e},e.flushSync=function(e){return wl(e)},e.hydrate=function(e,t,n){if(!hu(t))throw Error(r(200));return vu(null,e,t,!0,n)},e.hydrateRoot=function(e,t,n){if(!mu(e))throw Error(r(405));var i=n!=null&&n.hydratedSources||null,a=!1,o=``,s=du;if(n!=null&&(!0===n.unstable_strictMode&&(a=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onRecoverableError!==void 0&&(s=n.onRecoverableError)),t=au(t,null,e,1,n??null,a,!1,o,s),e[Ni]=t.current,si(e),i)for(e=0;e<i.length;e++)n=i[e],a=n._getVersion,a=a(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,a]:t.mutableSourceEagerHydrationData.push(n,a);return new pu(t)},e.render=function(e,t,n){if(!hu(t))throw Error(r(200));return vu(null,e,t,!1,n)},e.unmountComponentAtNode=function(e){if(!hu(e))throw Error(r(40));return e._reactRootContainer?(wl(function(){vu(null,null,e,!1,function(){e._reactRootContainer=null,e[Ni]=null})}),!0):!1},e.unstable_batchedUpdates=Cl,e.unstable_renderSubtreeIntoContainer=function(e,t,n,i){if(!hu(n))throw Error(r(200));if(e==null||e._reactInternals===void 0)throw Error(r(38));return vu(e,t,n,!1,i)},e.version=`18.3.1-next-f1338f8080-20240426`})),m=o(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=p()})),h=o((e=>{var t=m();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot})),g=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),_=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),v={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`},y=c(u()),b=(0,y.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>(0,y.createElement)(`svg`,{ref:c,...v,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:_(`lucide`,i),...s},[...o.map(([e,t])=>(0,y.createElement)(e,t)),...Array.isArray(a)?a:[a]])),x=(e,t)=>{let n=(0,y.forwardRef)(({className:n,...r},i)=>(0,y.createElement)(b,{ref:i,iconNode:t,className:_(`lucide-${g(e)}`,n),...r}));return n.displayName=`${e}`,n},S=x(`Activity`,[[`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`}]]),C=x(`ArrowRight`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),w=x(`BookOpen`,[[`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`}]]),T=x(`Boxes`,[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]),E=x(`CalendarCheck`,[[`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`}],[`path`,{d:`m9 16 2 2 4-4`,key:`19s6y9`}]]),ee=x(`CalendarClock`,[[`path`,{d:`M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5`,key:`1osxxc`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M3 10h5`,key:`r794hk`}],[`path`,{d:`M17.5 17.5 16 16.3V14`,key:`akvzfd`}],[`circle`,{cx:`16`,cy:`16`,r:`6`,key:`qoo3c4`}]]),te=x(`ChartColumn`,[[`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`}]]),D=x(`Check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),ne=x(`ChevronDown`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),re=x(`ChevronRight`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),O=x(`ChevronUp`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),k=x(`ChevronsLeft`,[[`path`,{d:`m11 17-5-5 5-5`,key:`13zhaf`}],[`path`,{d:`m18 17-5-5 5-5`,key:`h8a8et`}]]),A=x(`ChevronsRight`,[[`path`,{d:`m6 17 5-5-5-5`,key:`xnjwq`}],[`path`,{d:`m13 17 5-5-5-5`,key:`17xmmf`}]]),j=x(`CircleAlert`,[[`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`}]]),ie=x(`CircleCheck`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),ae=x(`CircleX`,[[`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`}]]),M=x(`Clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16 14`,key:`68esgv`}]]),N=x(`Cloud`,[[`path`,{d:`M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z`,key:`p7xjir`}]]),oe=x(`Copy`,[[`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`}]]),se=x(`Crown`,[[`path`,{d:`M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z`,key:`1vdc57`}],[`path`,{d:`M5 21h14`,key:`11awu3`}]]),ce=x(`Database`,[[`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`}]]),le=x(`Download`,[[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`polyline`,{points:`7 10 12 15 17 10`,key:`2ggqvy`}],[`line`,{x1:`12`,x2:`12`,y1:`15`,y2:`3`,key:`1vk2je`}]]),ue=x(`ExternalLink`,[[`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`}]]),de=x(`EyeOff`,[[`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`}]]),fe=x(`Eye`,[[`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`}]]),pe=x(`FileX`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`m14.5 12.5-5 5`,key:`b62r18`}],[`path`,{d:`m9.5 12.5 5 5`,key:`1rk7el`}]]),me=x(`Filter`,[[`polygon`,{points:`22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3`,key:`1yg77f`}]]),he=x(`Flame`,[[`path`,{d:`M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z`,key:`96xj49`}]]),ge=x(`Gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),_e=x(`Gift`,[[`rect`,{x:`3`,y:`8`,width:`18`,height:`4`,rx:`1`,key:`bkv52`}],[`path`,{d:`M12 8v13`,key:`1c76mn`}],[`path`,{d:`M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7`,key:`6wjy6b`}],[`path`,{d:`M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5`,key:`1ihvrl`}]]),ve=x(`Globe`,[[`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`}]]),ye=x(`HardDrive`,[[`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`}]]),be=x(`HeartPulse`,[[`path`,{d:`M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z`,key:`c3ymky`}],[`path`,{d:`M3.22 12H9.5l.5-1 2 4.5 2-7 1.5 3.5h5.27`,key:`1uw2ng`}]]),xe=x(`History`,[[`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`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),Se=x(`ImagePlus`,[[`path`,{d:`M16 5h6`,key:`1vod17`}],[`path`,{d:`M19 2v6`,key:`4bpg5p`}],[`path`,{d:`M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5`,key:`1ue2ih`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}]]),Ce=x(`Image`,[[`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`}]]),we=x(`Import`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m8 11 4 4 4-4`,key:`1dohi6`}],[`path`,{d:`M8 5H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-4`,key:`1ywtjm`}]]),Te=x(`Info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),Ee=x(`KeyRound`,[[`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`}]]),De=x(`Layers`,[[`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:`8b97xw`}],[`path`,{d:`m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65`,key:`dd6zsq`}],[`path`,{d:`m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65`,key:`ep9fru`}]]),Oe=x(`LayoutDashboard`,[[`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`}]]),ke=x(`LifeBuoy`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m4.93 4.93 4.24 4.24`,key:`1ymg45`}],[`path`,{d:`m14.83 9.17 4.24-4.24`,key:`1cb5xl`}],[`path`,{d:`m14.83 14.83 4.24 4.24`,key:`q42g0n`}],[`path`,{d:`m9.17 14.83-4.24 4.24`,key:`bqpfvv`}],[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}]]),Ae=x(`Lightbulb`,[[`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`}]]),je=x(`LoaderCircle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),Me=x(`Lock`,[[`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`}]]),Ne=x(`Moon`,[[`path`,{d:`M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z`,key:`a7tn18`}]]),Pe=x(`Network`,[[`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`}]]),Fe=x(`Pencil`,[[`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`}]]),Ie=x(`Play`,[[`polygon`,{points:`6 3 20 12 6 21 6 3`,key:`1oa8hb`}]]),Le=x(`Plug`,[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M9 8V2`,key:`14iosj`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z`,key:`osxo6l`}]]),Re=x(`Power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),P=x(`RefreshCw`,[[`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`}]]),ze=x(`Replace`,[[`path`,{d:`M14 4a2 2 0 0 1 2-2`,key:`1w2hp7`}],[`path`,{d:`M16 10a2 2 0 0 1-2-2`,key:`shjach`}],[`path`,{d:`M20 2a2 2 0 0 1 2 2`,key:`188mtx`}],[`path`,{d:`M22 8a2 2 0 0 1-2 2`,key:`ddf4tu`}],[`path`,{d:`m3 7 3 3 3-3`,key:`x25e72`}],[`path`,{d:`M6 10V5a3 3 0 0 1 3-3h1`,key:`3y3t5z`}],[`rect`,{x:`2`,y:`14`,width:`8`,height:`8`,rx:`2`,key:`4rksxw`}]]),Be=x(`Rocket`,[[`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`}]]),Ve=x(`RotateCw`,[[`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`}]]),He=x(`Rss`,[[`path`,{d:`M4 11a9 9 0 0 1 9 9`,key:`pv89mb`}],[`path`,{d:`M4 4a16 16 0 0 1 16 16`,key:`k0647b`}],[`circle`,{cx:`5`,cy:`19`,r:`1`,key:`bfqh0e`}]]),Ue=x(`Scissors`,[[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M8.12 8.12 12 12`,key:`1alkpv`}],[`path`,{d:`M20 4 8.12 15.88`,key:`xgtan2`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`path`,{d:`M14.8 14.8 20 20`,key:`ptml3r`}]]),We=x(`ScrollText`,[[`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`}]]),Ge=x(`Search`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`path`,{d:`m21 21-4.3-4.3`,key:`1qie3q`}]]),Ke=x(`Server`,[[`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`}]]),qe=x(`Settings`,[[`path`,{d:`M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z`,key:`1qme2f`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Je=x(`Shield`,[[`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`}]]),Ye=x(`Shrink`,[[`path`,{d:`m15 15 6 6m-6-6v4.8m0-4.8h4.8`,key:`17vawe`}],[`path`,{d:`M9 19.8V15m0 0H4.2M9 15l-6 6`,key:`chjx8e`}],[`path`,{d:`M15 4.2V9m0 0h4.8M15 9l6-6`,key:`lav6yq`}],[`path`,{d:`M9 4.2V9m0 0H4.2M9 9 3 3`,key:`1pxi2q`}]]),Xe=x(`SlidersVertical`,[[`line`,{x1:`4`,x2:`4`,y1:`21`,y2:`14`,key:`1p332r`}],[`line`,{x1:`4`,x2:`4`,y1:`10`,y2:`3`,key:`gb41h5`}],[`line`,{x1:`12`,x2:`12`,y1:`21`,y2:`12`,key:`hf2csr`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`3`,key:`1kfi7u`}],[`line`,{x1:`20`,x2:`20`,y1:`21`,y2:`16`,key:`1lhrwl`}],[`line`,{x1:`20`,x2:`20`,y1:`12`,y2:`3`,key:`16vvfq`}],[`line`,{x1:`2`,x2:`6`,y1:`14`,y2:`14`,key:`1uebub`}],[`line`,{x1:`10`,x2:`14`,y1:`8`,y2:`8`,key:`1yglbp`}],[`line`,{x1:`18`,x2:`22`,y1:`16`,y2:`16`,key:`1jxqpz`}]]),Ze=x(`Smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]),Qe=x(`Sparkles`,[[`path`,{d:`M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z`,key:`4pj2yx`}],[`path`,{d:`M20 3v4`,key:`1olli1`}],[`path`,{d:`M22 5h-4`,key:`1gvqau`}],[`path`,{d:`M4 17v2`,key:`vumght`}],[`path`,{d:`M5 18H3`,key:`zchphs`}]]),$e=x(`Square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),et=x(`Star`,[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]),tt=x(`Sun`,[[`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`}]]),nt=x(`Tag`,[[`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`}]]),rt=x(`Timer`,[[`line`,{x1:`10`,x2:`14`,y1:`2`,y2:`2`,key:`14vaq8`}],[`line`,{x1:`12`,x2:`15`,y1:`14`,y2:`11`,key:`17fdiu`}],[`circle`,{cx:`12`,cy:`14`,r:`8`,key:`1e1u0o`}]]),it=x(`Trash2`,[[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6`,key:`4alrt4`}],[`path`,{d:`M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2`,key:`v07s0e`}],[`line`,{x1:`10`,x2:`10`,y1:`11`,y2:`17`,key:`1uufr5`}],[`line`,{x1:`14`,x2:`14`,y1:`11`,y2:`17`,key:`xtxkd`}]]),at=x(`TrendingUp`,[[`polyline`,{points:`22 7 13.5 15.5 8.5 10.5 2 17`,key:`126l90`}],[`polyline`,{points:`16 7 22 7 22 13`,key:`kwv8wd`}]]),ot=x(`TriangleAlert`,[[`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`}]]),st=x(`Type`,[[`polyline`,{points:`4 7 4 4 20 4 20 7`,key:`1nosan`}],[`line`,{x1:`9`,x2:`15`,y1:`20`,y2:`20`,key:`swin9y`}],[`line`,{x1:`12`,x2:`12`,y1:`4`,y2:`20`,key:`1tx1rr`}]]),ct=x(`Upload`,[[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`polyline`,{points:`17 8 12 3 7 8`,key:`t8dd8p`}],[`line`,{x1:`12`,x2:`12`,y1:`3`,y2:`15`,key:`widbto`}]]),lt=x(`WandSparkles`,[[`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`}]]),ut=x(`Webhook`,[[`path`,{d:`M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2`,key:`q3hayz`}],[`path`,{d:`m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06`,key:`1go1hn`}],[`path`,{d:`m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8`,key:`qlwsc0`}]]),dt=x(`Wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z`,key:`cbrjhi`}]]),ft=x(`X`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),pt=x(`Zap`,[[`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`}]]),mt=o((e=>{var t=u(),n=Symbol.for(`react.element`),r=Symbol.for(`react.fragment`),i=Object.prototype.hasOwnProperty,a=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function s(e,t,r){var s,c={},l=null,u=null;for(s in r!==void 0&&(l=``+r),t.key!==void 0&&(l=``+t.key),t.ref!==void 0&&(u=t.ref),t)i.call(t,s)&&!o.hasOwnProperty(s)&&(c[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps,t)c[s]===void 0&&(c[s]=t[s]);return{$$typeof:n,type:e,key:l,ref:u,props:c,_owner:a.current}}e.Fragment=r,e.jsx=s,e.jsxs=s})),ht=o(((e,t)=>{t.exports=mt()})),gt=c(m(),1),_t=h(),F=ht(),vt={Activity:S,BarChart3:te,CalendarClock:ee,Clock:M,Cloud:N,Database:ce,Eye:fe,FileX:pe,Filter:me,Gauge:ge,Globe:ve,HardDrive:ye,HeartPulse:be,Image:Ce,Import:we,Layers:De,LayoutDashboard:Oe,LifeBuoy:ke,Lightbulb:Ae,Network:Pe,Replace:ze,Rss:He,Scissors:Ue,Search:Ge,Server:Ke,Settings:qe,Shield:Je,Shrink:Ye,Sliders:Xe,Sparkles:Qe,Square:$e,Tag:nt,Trash2:it,TrendingUp:at,Type:st,Wand2:lt,Webhook:ut,Wrench:dt,Zap:pt};function yt({name:e,size:t=15,className:n}){return(0,F.jsx)(vt[e]??$e,{size:t,className:n})}var I={"critical-css":{host:`minify`,subtab:`critical`},"unused-css":{host:`minify`,subtab:`unused`},"brotli-compression":{host:`gzip`,subtab:`brotli`},images:{host:`lazy`,subtab:`images`},"smart-image":{host:`lazy`,subtab:`smart`},fonts:{host:`lazy`,subtab:`fonts`},"smart-predict":{host:`resource-hints`,subtab:`speculation`},"prewarm-schedule":{host:`preloader`,subtab:`scheduled`},"predictive-warm":{host:`preloader`,subtab:`predictive`},"cloudflare-apo":{host:`cloudflare`},analytics:{host:`health`,subtab:`cache`},rum:{host:`health`,subtab:`visitors`},pagespeed:{host:`health`,subtab:`pagespeed`},"performance-health":{host:`health`,subtab:`pagespeed`},recommendations:{host:`health`},"cache-404":{host:`cache-coverage`,subtab:`coverage`},"search-cache":{host:`cache-coverage`,subtab:`coverage`},"feed-cache":{host:`cache-coverage`,subtab:`beyond`},"rest-cache":{host:`cache-coverage`,subtab:`beyond`},"custom-rules":{host:`cache-coverage`,subtab:`rules`},"maintenance-cache":{host:`cache-coverage`,subtab:`rules`},license:{host:`settings`,subtab:`license`},"white-label":{host:`settings`,subtab:`branding`},multisite:{host:`settings`,subtab:`multisite`}};function bt(e){return I[e]??null}var xt=`xspeed`;function St(){return typeof window>`u`?null:window.wp?.i18n??null}function L(e,t=xt){let n=St();return n?n.__(e,t):e}function Ct(e,...t){let n=St();if(n)return n.sprintf(e,...t);let r=0;return e.replace(/%[sd]/g,()=>String(t[r++]??``))}var wt=(0,y.createContext)(``);function Tt({query:e,children:t}){return(0,F.jsx)(wt.Provider,{value:e,children:t})}function Et(e,t){let n=new Map(e.map(e=>[e.slug,e])),r=(e,t)=>{let r={displayLabel:e.label??e.slug,displayDescription:e.description,...t?.fieldKey?{fieldModuleSlug:e.slug}:{},...t},i=bt(e.slug);if(!i)return{module:e,isChild:!1,...r};let a=n.get(i.host);return a?{module:a,subtab:i.subtab,parentLabel:a.label,isChild:!0,...r}:{module:e,isChild:!1,...r}},i=t.trim().toLowerCase();if(!i)return e.filter(e=>!bt(e.slug)).map(e=>({module:e,isChild:!1,displayLabel:e.label??e.slug,displayDescription:e.description}));let a=new Set,o=e=>{if(!e)return;let t=`${e.module.slug}::${e.subtab??``}`;a.has(t)||(a.add(t),s.push(e))},s=[];for(let t of e){let e=(t.label??``).toLowerCase().includes(i),n=(t.description??``).toLowerCase().includes(i),a=(t.tab_label??``).toLowerCase().includes(i);if(e||n||a){o(r(t));continue}let s=t.schema??{},c=null;for(let[e,n]of Object.entries(s)){let a=(n.label??e).toString();if(`${a} ${(n.description??``).toString()} ${n.option_labels?Object.values(n.option_labels).join(` `):``} ${e}`.toLowerCase().includes(i)){c=r(t,{fieldKey:e,fieldLabel:a});break}}c&&o(c)}return s}function Dt({value:e,onChange:t,collapsed:n,resultCount:r,onSubmit:i}){let a=(0,y.useRef)(null),o=typeof navigator<`u`&&/Mac|iPhone|iPad|iPod/.test(navigator.platform||navigator.userAgent||``)?`⌘J`:`Ctrl J`;return(0,y.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&!e.altKey&&!e.shiftKey&&e.key.toLowerCase()===`j`&&(e.preventDefault(),a.current?.focus()),e.key===`Escape`&&document.activeElement===a.current&&(t(``),a.current?.blur())};window.addEventListener(`keydown`,e);let n=()=>a.current?.focus();return window.addEventListener(`xspeed:focus-search`,n),()=>{window.removeEventListener(`keydown`,e),window.removeEventListener(`xspeed:focus-search`,n)}},[t]),n?null:(0,F.jsxs)(`form`,{className:`hidden sm:block px-2 pt-2 pb-1`,onSubmit:e=>{e.preventDefault(),i&&(i(),a.current?.blur())},children:[(0,F.jsxs)(`div`,{className:`relative`,children:[(0,F.jsx)(Ge,{size:13,className:`absolute left-2 top-1/2 -translate-y-1/2 text-neutral-400 pointer-events-none`}),(0,F.jsx)(`input`,{ref:a,type:`text`,value:e,onChange:e=>t(e.target.value),placeholder:L(`Search settings`),"aria-label":L(`Search settings`),className:`w-full pl-7 pr-12 py-1.5 text-[12px] rounded border border-neutral-200 dark:border-neutral-700 bg-white dark:bg-neutral-900 placeholder-neutral-400 focus:outline-none focus:ring-1 focus:ring-accent`}),e?(0,F.jsx)(`button`,{type:`button`,onClick:()=>t(``),"aria-label":L(`Clear search`),className:`absolute right-1 top-1/2 -translate-y-1/2 p-0.5 text-neutral-400 hover:text-neutral-700 dark:hover:text-neutral-200`,children:(0,F.jsx)(ft,{size:12})}):(0,F.jsx)(`kbd`,{"aria-hidden":`true`,className:`absolute right-2 top-1/2 -translate-y-1/2 pointer-events-none select-none inline-flex items-center justify-center h-[18px] min-w-[18px] px-1 rounded text-[10px] leading-none font-sans font-medium bg-neutral-100 dark:bg-neutral-800 text-neutral-500 dark:text-neutral-400`,children:o})]}),e&&(0,F.jsxs)(`div`,{className:`text-[10px] text-neutral-500 dark:text-neutral-400 mt-1 px-1 flex items-center justify-between gap-2`,children:[(0,F.jsx)(`span`,{children:r>0?`${r} ${L(r===1?`match`:`matches`)}`:L(`No matches`)}),r>0&&(0,F.jsx)(`kbd`,{className:`text-[9px] font-mono px-1 py-px rounded border border-neutral-200 dark:border-neutral-700 text-neutral-500 dark:text-neutral-400`,children:`↵`})]})]})}function Ot(e){let[t,n]=(0,y.useState)(``);return{query:t,setQuery:n,results:(0,y.useMemo)(()=>Et(e,t),[e,t])}}var kt=new Set([`INPUT`,`TEXTAREA`,`SELECT`,`OPTION`,`PRE`,`CODE`,`KBD`,`SVG`,`STYLE`,`SCRIPT`]),At=`xspeed-search`;function jt(){return typeof CSS<`u`&&!!CSS.highlights&&typeof globalThis.Highlight==`function`}function Mt(e,t){let n=t.trim();if(!n)return[];let r=n.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),i=new RegExp(r,`gi`),a=[],o=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode(t){if(!t.nodeValue||!t.nodeValue.trim())return NodeFilter.FILTER_REJECT;let n=t.parentNode;for(;n&&n!==e;){if(n instanceof Element&&kt.has(n.tagName))return NodeFilter.FILTER_REJECT;n=n.parentNode}return NodeFilter.FILTER_ACCEPT}}),s=o.nextNode();for(;s;){let e=s.nodeValue??``;i.lastIndex=0;let t;for(;(t=i.exec(e))!==null;){let e=document.createRange();e.setStart(s,t.index),e.setEnd(s,t.index+t[0].length),a.push(e),t[0].length===0&&i.lastIndex++}s=o.nextNode()}return a}function Nt({query:e,children:t}){let n=(0,y.useRef)(null);return(0,y.useEffect)(()=>{let t=n.current;if(!t||!jt())return;let r=CSS.highlights,i=globalThis.Highlight,a=0,o=()=>{let n=Mt(t,e);if(n.length===0){r.delete(At);return}r.set(At,new i(...n))};o();let s=new MutationObserver(()=>{cancelAnimationFrame(a),a=requestAnimationFrame(o)});return s.observe(t,{childList:!0,subtree:!0,characterData:!0}),()=>{s.disconnect(),cancelAnimationFrame(a),r.delete(At)}},[e]),(0,F.jsx)(`div`,{ref:n,className:`contents`,children:t})}function Pt(e,t){if(!e)return e;let n=t.trim();if(!n)return e;let r=n.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),i=RegExp(`(${r})`,`gi`),a=e.split(i);return a.length===1?e:(0,F.jsx)(F.Fragment,{children:a.map((e,t)=>t%2==1?(0,F.jsx)(`mark`,{className:`bg-amber-200/70 dark:bg-amber-500/30 text-inherit rounded-sm`,children:e},t):(0,F.jsx)(y.Fragment,{children:e},t))})}function Ft({label:e,hint:t,children:n,disabled:r=!1}){let[i,a]=(0,y.useState)(null),o=(0,y.useRef)(null),s=(0,y.useRef)(null),c=(0,y.useRef)(null);if((0,y.useEffect)(()=>()=>{s.current&&window.clearTimeout(s.current),c.current&&window.clearTimeout(c.current)},[]),r)return n;let l=e=>{o.current=e;let t=n.ref;typeof t==`function`?t(e):t&&typeof t==`object`&&(t.current=e)},u=()=>{if(!o.current)return;let e=o.current.getBoundingClientRect();a({top:e.top+e.height/2,left:e.right+8})},d=()=>{c.current&&=(window.clearTimeout(c.current),null),!s.current&&(s.current=window.setTimeout(()=>{u(),s.current=null},200))},f=()=>{s.current&&=(window.clearTimeout(s.current),null),c.current=window.setTimeout(()=>{a(null),c.current=null},60)},p=n.props;return(0,F.jsxs)(F.Fragment,{children:[(0,y.cloneElement)(n,{ref:l,onMouseEnter:e=>{d(),p.onMouseEnter?.(e)},onMouseLeave:e=>{f(),p.onMouseLeave?.(e)},onFocus:e=>{d(),p.onFocus?.(e)},onBlur:e=>{f(),p.onBlur?.(e)},title:void 0}),i&&typeof document<`u`&&(0,gt.createPortal)((0,F.jsxs)(`div`,{role:`tooltip`,style:{position:`fixed`,top:i.top,left:i.left,transform:`translateY(-50%)`,zIndex:60,pointerEvents:`none`},className:`whitespace-nowrap rounded-md bg-neutral-900 dark:bg-neutral-800 text-white text-[11px] px-2 py-1 shadow-md border border-neutral-800 dark:border-neutral-700`,children:[(0,F.jsx)(`span`,{className:`block`,children:e}),t&&(0,F.jsx)(`span`,{className:`block text-[10px] text-neutral-400 mt-0.5`,children:t})]}),document.getElementById(`xspeed-app`)??document.body)]})}var It=[{slug:`pagespeed`,label:`PageSpeed`,icon:`Gauge`,description:`Run Google PageSpeed Insights audits without leaving the dashboard. Scores + CWV cached 24h.`,teaser:`pagespeed`,embedded:!0},{slug:`recommendations`,label:`Recommendations`,icon:`Lightbulb`,description:`Rule-based engine surfaces the 5 things most likely to improve your score.`,teaser:`recommendations`,embedded:!0},{slug:`rum`,label:`Real-User Monitoring`,icon:`Eye`,description:`Sample LCP / FCP / CLS / INP / TTFB from real visitors. Per-URL percentile charts.`,teaser:`rum`,embedded:!0},{slug:`images`,label:`Image Optimization`,icon:`Replace`,description:`Convert new JPEG/PNG uploads to WebP and AVIF; serve modern formats to supporting browsers.`,teaser:`webp-avif`,embedded:!0},{slug:`cloudflare-apo`,label:`Cloudflare APO`,icon:`Zap`,description:`Toggle Automatic Platform Optimization, edge cache level, and TTL. No separate dashboard.`,teaser:`cloudflare-apo`,embedded:!0},{slug:`feed-cache`,label:`Feed Caching`,icon:`Rss`,description:`Cache RSS / Atom / comment feeds so polling aggregators skip a full render. Correct feed content-type preserved; purges on new posts.`,teaser:`feed-cache`,embedded:!0},{slug:`cache-404`,label:`404 Caching`,icon:`FileX`,description:`Serve one cached 404 so bot / scanner floods on unknown URLs don't each cost a render. Short-lived, shared entry, purged on publish.`,teaser:`cache-404`,embedded:!0},{slug:`search-cache`,label:`Search Caching`,icon:`Search`,description:`Cache internal search-results pages (/?s=…) so popular repeated searches skip a full query + render. Keyed per term, short-lived, purged on publish.`,teaser:`search-cache`,embedded:!0},{slug:`rest-cache`,label:`REST API Cache`,icon:`Webhook`,description:`Cache read-only REST responses with a TTL you set per route — built for headless sites and app backends. Auth'd and write requests never cache.`,teaser:`rest-cache`,embedded:!0},{slug:`maintenance-cache`,label:`Maintenance`,icon:`Wrench`,description:`Skip caching while the site is in maintenance / coming-soon mode, and auto-purge when it goes live again.`,teaser:null,embedded:!0},{slug:`prewarm-schedule`,label:`On a Schedule`,icon:`CalendarClock`,description:`Warm target URLs ahead of posts, sales, and campaigns so the spike hits a warm cache. One-off, recurring, and auto-warm on scheduled-post publish.`,teaser:`prewarm-schedule`,embedded:!0},{slug:`predictive-warm`,label:`Auto (AI)`,icon:`TrendingUp`,description:`Proactively warm the hottest URLs — ranked by real traffic, recency, and content — so popular and about-to-be-popular pages always serve from cache.`,teaser:`predictive-warm`,embedded:!0},{slug:`brotli-compression`,label:`Brotli`,icon:`Shrink`,description:`Serve Brotli where supported — smaller than GZIP — with automatic GZIP fallback.`,teaser:`brotli`,embedded:!0},{slug:`custom-rules`,label:`Custom Cache Rules`,icon:`Filter`,description:`Bypass cache or override expiry by URL glob, post type, category, tag, or author.`,teaser:`custom-rules`,embedded:!0},{slug:`analytics`,label:`Analytics`,icon:`BarChart3`,description:`Hit-ratio trends, slowest URLs from RUM samples, recent activity timeline.`,teaser:`analytics`,embedded:!0},{slug:`critical-css`,label:`Critical CSS`,icon:`Sparkles`,description:`Inline above-the-fold styles, defer the rest. Pluggable generator endpoint.`,teaser:`critical-css`,embedded:!0},{slug:`unused-css`,label:`Unused CSS`,icon:`Scissors`,description:`Per-URL pruned stylesheet inlined; original <link> tags stripped.`,teaser:`unused-css`,embedded:!0},{slug:`multisite`,label:`Multisite`,icon:`Network`,description:`One dashboard across every site in a WP Multisite network with network-wide purge.`,teaser:`multisite`,embedded:!0},{slug:`white-label`,label:`White Label`,icon:`Tag`,description:`Rebrand the dashboard chrome — name, footer credit, hide help links.`,teaser:`white-label`,embedded:!0},{slug:`ai-provider`,label:`AI Provider`,icon:`Sparkles`,description:`Connect OpenAI, Anthropic, Gemini, or OpenRouter once — every Pro AI feature shares the connection.`,teaser:null},{slug:`smart-predict`,label:`Speculation Rules`,icon:`Wand2`,description:`Predict each visitor's next page and prefetch it via Chrome's Speculation Rules API.`,teaser:null,embedded:!0},{slug:`performance-health`,label:`Performance Health`,icon:`HeartPulse`,description:`Core Web Vitals health monitor with AI anomaly detection and a 7-day regression baseline.`,teaser:null,embedded:!0},{slug:`smart-image`,label:`AI Suggestions`,icon:`Sparkles`,description:`AI-recommended format + quality settings, applied into Image Optimization in one click.`,teaser:null,embedded:!0},{slug:`adaptive-cache`,label:`Adaptive Cache`,icon:`Lightbulb`,description:`AI-tuned cache TTL based on 24-hour traffic patterns, applied into the Cache module in one click.`,teaser:null}],Lt=new Set(It.filter(e=>e.embedded).map(e=>e.slug)),Rt=new Set([`license`,`fonts`]),zt=[{id:`cache`,label:`Cache`,icon:`Zap`,slugs:[`cache`,`preloader`,`browser-cache`,`object-cache`,`cache-coverage`]},{id:`performance`,label:`Optimization`,icon:`Gauge`,slugs:[`minify`,`gzip`,`lazy`,`resource-hints`,`bloat`,`heartbeat`]},{id:`network`,label:`Network`,icon:`Network`,slugs:[`cdn`,`cloudflare`]},{id:`insights`,label:`Health`,icon:`HeartPulse`,slugs:[`health`],leaf:!0},{id:`tools`,label:`Tools`,icon:`Sliders`,slugs:[`database`,`migration`]},{id:`ai-agents`,label:`AI & Agents`,icon:`Sparkles`,slugs:[`ai-provider`,`mcp`,`ai-privacy`,`adaptive-cache`]},{id:`settings`,label:`Settings`,icon:`Settings`,slugs:[`settings`],leaf:!0},{id:`support`,label:`Help & Support`,icon:`LifeBuoy`,slugs:[`support`],leaf:!0}];function Bt(e,t=!0){let n=new Map(e.map(e=>[e.slug,e])),r=new Set,i=[];for(let e of zt){let t=[];for(let i of e.slugs){let e=n.get(i);e&&(t.push(e),r.add(i))}t.length>0&&i.push({id:e.id,label:e.label,icon:e.icon,modules:t,leaf:e.leaf})}let a=e.filter(e=>!r.has(e.slug)&&!Lt.has(e.slug)&&!Rt.has(e.slug));return a.length>0&&i.push({id:`other`,label:`Other`,icon:`Square`,modules:a}),i}var Vt=`overview`,Ht={cache:!0,performance:!0};function Ut(){let[e,t]=(0,y.useState)(()=>({...Ht}));return{isOpen:(0,y.useCallback)(t=>e[t]===!0,[e]),toggle:(0,y.useCallback)(e=>{t(t=>({...t,[e]:!t[e]}))},[]),open:(0,y.useCallback)(e=>{t(t=>t[e]?t:{...t,[e]:!0})},[])}}var R={},Wt=`xspeed:panels-changed`,Gt=`xspeed:tier-changed`,Kt=`xspeed:branding-changed`;function qt(e){return R[e]}function Jt(){typeof window>`u`||window.XSpeedPro||(window.XSpeedPro={panels:R,registerPanel(e,t){R[e]=t,window.dispatchEvent(new CustomEvent(Wt,{detail:{slug:e}}))},setTier(e){let t=window.XSpeedConfig;t&&(t.tier=e),window.dispatchEvent(new CustomEvent(Gt,{detail:{tier:e}}))},setBranding(e){let t=window.XSpeedConfig;t&&(t.branding=e),window.dispatchEvent(new CustomEvent(Kt,{detail:{branding:e}}))}})}function Yt(){let[e,t]=(0,y.useState)(0);return(0,y.useEffect)(()=>{let e=()=>t(e=>e+1);return window.addEventListener(Wt,e),()=>window.removeEventListener(Wt,e)},[]),e}var Xt={name:`xSpeed Cache`,footer_credit:null,hide_help_links:!1,logo_svg:null};function Zt(){let e=window.XSpeedConfig?.branding;return e?{...Xt,...e}:Xt}function Qt(){let[e,t]=(0,y.useState)(Zt);return(0,y.useEffect)(()=>{let e=()=>t(Zt());return window.addEventListener(Kt,e),()=>window.removeEventListener(Kt,e)},[]),e}var $t=`data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2078%2080'%20fill='currentColor'%3e%3cpath%20d='M21.3338%2039.5736L31.9365%2039.569C34.2801%2039.5679%2035.4523%2039.5676%2036.2312%2040.0567C36.913%2040.485%2037.408%2041.1552%2037.6165%2041.9329C37.8546%2042.8212%2037.508%2043.9413%2036.8171%2046.1808L32.6658%2059.6398C31.6247%2063.0143%2031.1044%2064.7012%2031.4487%2065.3027C31.745%2065.8198%2032.3041%2066.1285%2032.8995%2066.1036C33.4188%2066.0818%2034.1959%2065.3232%2035.5221%2063.8145L37.043%2062.0552L56.0558%2039.5795C62.7569%2041.0202%2067.7803%2047.2973%2067.7804%2054.4289C67.7804%2062.6374%2061.1259%2069.2919%2052.9174%2069.2919H26.3952C17.2528%2069.2918%209.84031%2061.8804%209.83984%2052.7381V39.5658H21.3416L21.3338%2039.5736Z'/%3e%3cpath%20d='M51.2251%209.83978C60.3678%209.83978%2067.7803%2017.2524%2067.7804%2026.3951V39.5658H56.3441L56.3519%2039.5565L46.974%2039.5534C44.4567%2039.5525%2043.1977%2039.5516%2042.3973%2039.022C41.6975%2038.5589%2041.2081%2037.8393%2041.0354%2037.018C40.8379%2036.0789%2041.301%2034.9082%2042.2275%2032.5675L47.3605%2019.5994C48.7246%2016.1534%2049.407%2014.4296%2049.1042%2013.7994C48.8435%2013.2582%2048.3008%2012.9083%2047.7002%2012.8956C47.0013%2012.881%2045.7161%2014.2175%2043.1469%2016.8895L21.6455%2039.5495C14.9041%2038.1394%209.83989%2031.863%209.83984%2024.7028C9.83994%2016.4945%2016.4946%209.84003%2024.7029%209.83978H51.2251Z'/%3e%3c/svg%3e`;function en({className:e=`w-6 h-6 rounded shrink-0`}){let t=Qt(),n=t.logo_svg?.trim(),r=t.name||`xSpeed Cache`,[i,a]=(0,y.useState)(!1);return(0,y.useEffect)(()=>{a(!1)},[n]),n&&!i?n.startsWith(`<svg`)?(0,F.jsx)(`span`,{className:`inline-flex items-center justify-center ${e}`,role:`img`,"aria-label":r,dangerouslySetInnerHTML:{__html:n}}):(0,F.jsx)(`img`,{src:n,alt:r,className:e,onError:()=>a(!0)}):(0,F.jsx)(`img`,{src:$t,alt:r,className:`${e} dark:invert`})}function tn({active:e,onChange:t,theme:n,onToggleTheme:r,collapsed:i,onToggleCollapse:a,modules:o=[],searchQuery:s=``,onSearchChange:c,onSearchSubmit:l,visibleModules:u,visibleResults:d,onResultClick:f,scrollToActiveTick:p}){let m=Qt().name,h=d??(u??o).map(e=>({module:e,isChild:!1,displayLabel:e.label??e.slug,displayDescription:e.description})),{isOpen:g,toggle:_,open:v}=Ut(),b=s.trim().length>0,x=!h.some(e=>e.module.locked===!0),S=Bt(h.map(e=>e.module),x);(0,y.useEffect)(()=>{let t=S.find(t=>t.modules.some(t=>t.slug===e));t&&v(t.id)},[e,v]),(0,y.useEffect)(()=>{if(b)for(let e of S)v(e.id)},[b,h.length,v]),(0,y.useEffect)(()=>{if(typeof window>`u`||i||!p)return;let t=0,n=0,r=()=>{let i=document.querySelector(`[data-row-slug="${CSS.escape(e)}"][data-active="true"]`),a=i?.closest(`nav`);if(i&&a&&i.offsetParent!==null){let e=i.getBoundingClientRect().top-a.getBoundingClientRect().top+a.scrollTop;a.scrollTo({top:Math.max(0,e)});return}n++<12&&(t=window.requestAnimationFrame(r))};return t=window.requestAnimationFrame(r),()=>window.cancelAnimationFrame(t)},[p,i]);let C=i?`w-14`:`w-14 sm:w-56`,w=i?`hidden`:`hidden sm:inline`,T=i?`hidden`:`hidden sm:inline`,E=i?`justify-center`:`justify-center sm:justify-start`,ee=i?`justify-center`:`justify-center sm:justify-start`;return(0,F.jsxs)(`aside`,{className:`${C} shrink-0 border-r border-neutral-200 dark:border-neutral-800 bg-neutral-50 dark:bg-neutral-950 flex flex-col transition-[width] duration-200`,children:[(0,F.jsxs)(`div`,{className:`sticky top-0 z-20 h-16 px-2 sm:px-4 flex items-center ${ee} gap-2 border-b border-neutral-200 dark:border-neutral-800 bg-neutral-50 dark:bg-neutral-950`,children:[(0,F.jsx)(en,{className:`w-6 h-6 rounded shrink-0`}),(0,F.jsx)(`span`,{className:`${T} font-semibold text-[14px] text-neutral-900 dark:text-neutral-50 truncate`,children:m}),(0,F.jsxs)(`span`,{className:`${T} text-neutral-400 dark:text-neutral-500 text-[12px] inline-flex items-center`,children:[(0,F.jsx)(`span`,{"aria-hidden":`true`,className:`text-[18px] leading-none mr-2`,children:`·`}),`v`,window.XSpeedConfig?.version??`1.0.0`]})]}),c&&(0,F.jsx)(Dt,{value:s,onChange:c,collapsed:i,resultCount:h.length,onSubmit:l}),c&&i&&(0,F.jsx)(`div`,{className:`p-1.5 sm:p-2 pb-0 sm:pb-0`,children:(0,F.jsx)(Ft,{label:L(`Search settings`),hint:L(`Cmd/Ctrl + K`),children:(0,F.jsx)(`button`,{type:`button`,onClick:()=>{a(),window.requestAnimationFrame(()=>window.dispatchEvent(new CustomEvent(`xspeed:focus-search`)))},"aria-label":L(`Search settings`),className:`w-full flex items-center ${E} gap-3 px-2 sm:px-3 py-2 rounded text-[13px] text-neutral-500 dark:text-neutral-400 hover:bg-sidebar-hover dark:hover:bg-neutral-900 hover:text-neutral-900 dark:hover:text-neutral-100 transition-colors`,children:(0,F.jsx)(Ge,{size:15,className:`shrink-0`})})})}),(0,F.jsxs)(`nav`,{className:`flex-1 p-1.5 sm:p-2 overflow-y-auto`,children:[(0,F.jsx)(`div`,{"data-group":`overview`,className:`mb-1`,children:(0,F.jsx)(Ft,{label:L(`Overview`),disabled:!i,children:(0,F.jsxs)(`button`,{type:`button`,"data-row-slug":Vt,"data-active":e===`overview`?`true`:void 0,onClick:()=>{i&&a(),t(Vt)},title:L(`Overview`),className:`group w-full flex items-center ${E} gap-3 px-2 sm:px-3 py-2 rounded text-[13px] font-medium transition-colors ${e===`overview`?`bg-sidebar-hover dark:bg-neutral-900 text-neutral-900 dark:text-neutral-100`:`text-neutral-700 dark:text-neutral-300 hover:bg-sidebar-hover dark:hover:bg-neutral-900 hover:text-neutral-900 dark:hover:text-neutral-100`}`,children:[(0,F.jsx)(yt,{name:`LayoutDashboard`,className:`shrink-0 text-neutral-500 dark:text-neutral-400 group-hover:text-neutral-900 dark:group-hover:text-white transition-colors`}),(0,F.jsx)(`span`,{className:`${i?`hidden`:`hidden sm:flex`} min-w-0 flex-1 items-center gap-1.5 text-left`,children:(0,F.jsx)(`span`,{className:`truncate`,children:L(`Overview`)})})]})})}),b&&!i?h.length===0?(0,F.jsx)(`div`,{className:`px-3 py-6 text-center text-[12px] text-neutral-500 dark:text-neutral-400`,children:L(`No matches`)}):(0,F.jsx)(`div`,{className:`space-y-0.5`,children:h.map(n=>(0,F.jsxs)(`button`,{type:`button`,onClick:()=>f?f(n):t(n.module.slug,n.subtab),className:`w-full text-left px-3 py-2 rounded text-[13px] transition-colors ${e===n.module.slug&&(n.subtab??``)===``?`bg-sidebar-hover dark:bg-neutral-900 text-neutral-900 dark:text-neutral-100`:`text-neutral-700 dark:text-neutral-300 hover:bg-sidebar-hover dark:hover:bg-neutral-900`}`,children:[(0,F.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,F.jsx)(`span`,{className:`font-medium truncate`,children:Pt(n.displayLabel,s)}),n.isChild&&n.parentLabel&&(0,F.jsxs)(`span`,{className:`shrink-0 text-[10px] text-neutral-400 dark:text-neutral-500`,children:[L(`in`),` `,n.parentLabel]})]}),(n.fieldLabel||n.displayDescription)&&(0,F.jsx)(`span`,{className:`block truncate text-[11px] text-neutral-500 dark:text-neutral-400 mt-0.5`,children:Pt(n.fieldLabel||n.displayDescription||``,s)})]},`${n.module.slug}:${n.subtab??``}:${n.fieldKey??``}`))}):(()=>{let n=new Map(h.map(e=>[e.module.slug,e]));return Bt(h.map(e=>e.module),x).map((r,o)=>{let c=i||g(r.id),l=`xspeed-group-${r.id}`;if(r.leaf){let n=r.modules[0];if(!n)return null;let c=n.locked===!0,l=e===n.slug;return(0,F.jsx)(`div`,{"data-group":r.id,className:o===0?``:`mt-2`,children:(0,F.jsx)(Ft,{label:n.label,disabled:!i,children:(0,F.jsxs)(`button`,{type:`button`,"data-row-slug":n.slug,"data-active":l?`true`:void 0,onClick:()=>{i&&a(),t(n.slug)},title:c?`${n.label} — ${L(`Pro feature`)}`:n.label,className:`group w-full flex items-center ${E} gap-3 px-2 sm:px-3 py-2 rounded text-[13px] font-medium transition-colors ${l?`bg-sidebar-hover dark:bg-neutral-900 text-neutral-900 dark:text-neutral-100`:`text-neutral-700 dark:text-neutral-300 hover:bg-sidebar-hover dark:hover:bg-neutral-900 hover:text-neutral-900 dark:hover:text-neutral-100`}`,children:[(0,F.jsx)(yt,{name:r.icon,className:`shrink-0 text-neutral-500 dark:text-neutral-400 group-hover:text-neutral-900 dark:group-hover:text-white transition-colors`}),(0,F.jsx)(`span`,{className:`${i?`hidden`:`hidden sm:flex`} min-w-0 flex-1 items-center gap-1.5 text-left`,children:(0,F.jsx)(`span`,{className:`truncate`,children:Pt(n.label,s)})})]})})},r.id)}return(0,F.jsxs)(`div`,{"data-group":r.id,"data-expanded":c?`true`:`false`,className:o===0?``:`mt-2`,children:[(0,F.jsx)(Ft,{label:r.label,disabled:!i,children:(0,F.jsxs)(`button`,{type:`button`,onClick:()=>{i?(v(r.id),a()):_(r.id)},"aria-expanded":c?`true`:`false`,"aria-controls":l,title:r.label,className:`group w-full flex items-center ${E} gap-3 px-2 sm:px-3 py-2 rounded text-[13px] font-medium text-neutral-700 dark:text-neutral-300 hover:bg-sidebar-hover dark:hover:bg-neutral-900 hover:text-neutral-900 dark:hover:text-neutral-100 transition-colors`,children:[(0,F.jsx)(yt,{name:r.icon,className:`shrink-0 text-neutral-500 dark:text-neutral-400 group-hover:text-neutral-900 dark:group-hover:text-white transition-colors`}),(0,F.jsxs)(`span`,{className:`${i?`hidden`:`hidden sm:flex`} min-w-0 flex-1 items-center justify-between gap-2 text-left`,children:[(0,F.jsx)(`span`,{className:`truncate`,children:r.label}),(0,F.jsx)(ne,{size:14,className:`shrink-0 text-neutral-400 dark:text-neutral-500 group-hover:text-neutral-900 dark:group-hover:text-white transition-[transform,color] duration-150 ${c?``:`-rotate-90`}`})]})]})}),(0,F.jsx)(`div`,{id:l,className:`${c&&!i?`hidden sm:block`:`hidden`} mt-0.5 ml-4 pl-2 border-l border-neutral-200 dark:border-neutral-800 space-y-0.5`,children:r.modules.map(r=>{let i=n.get(r.slug)?.fieldLabel,a=r.locked===!0,o=e===r.slug;return(0,F.jsxs)(`button`,{type:`button`,"data-row-slug":r.slug,"data-active":o?`true`:void 0,onClick:()=>t(r.slug),title:a?`${r.label} — ${L(`Pro feature`)}`:i?`${r.label} — ${i}`:r.label,className:`w-full text-left px-3 py-1.5 rounded text-[13px] transition-colors ${o?`bg-sidebar-hover dark:bg-neutral-900 text-neutral-900 dark:text-neutral-100 font-medium`:`text-neutral-600 dark:text-neutral-400 hover:bg-sidebar-hover dark:hover:bg-neutral-900 hover:text-neutral-900 dark:hover:text-neutral-100`}`,children:[(0,F.jsx)(`span`,{className:`flex items-center gap-1.5 truncate`,children:(0,F.jsx)(`span`,{className:`truncate`,children:Pt(r.label,s)})}),i&&(0,F.jsx)(`span`,{className:`block truncate text-[10px] text-neutral-500 dark:text-neutral-400 font-normal mt-0.5`,children:Pt(i,s)})]},r.slug)})})]},r.id)})})()]}),(0,F.jsxs)(`div`,{className:`p-1.5 sm:p-2 border-t border-neutral-200 dark:border-neutral-800 space-y-0.5`,children:[(0,F.jsx)(Ft,{label:L(n===`dark`?`Switch to light`:`Switch to dark`),disabled:!i,children:(0,F.jsxs)(`button`,{type:`button`,onClick:r,"aria-label":L(`Toggle theme`),title:L(n===`dark`?`Switch to light`:`Switch to dark`),className:`w-full flex items-center ${E} gap-3 px-2 sm:px-3 py-2 rounded text-[13px] text-neutral-600 dark:text-neutral-400 hover:bg-sidebar-hover dark:hover:bg-neutral-900 hover:text-neutral-900 dark:hover:text-neutral-100 transition-colors`,children:[n===`dark`?(0,F.jsx)(tt,{size:15,className:`shrink-0`}):(0,F.jsx)(Ne,{size:15,className:`shrink-0`}),(0,F.jsx)(`span`,{className:w,children:L(n===`dark`?`Light Mode`:`Dark Mode`)})]})}),(0,F.jsx)(Ft,{label:L(i?`Expand sidebar`:`Collapse sidebar`),disabled:!i,children:(0,F.jsxs)(`button`,{type:`button`,onClick:a,"aria-label":L(i?`Expand sidebar`:`Collapse sidebar`),title:L(i?`Expand sidebar`:`Collapse sidebar`),className:`hidden sm:flex w-full items-center ${E} gap-3 px-2 sm:px-3 py-2 rounded text-[13px] text-neutral-600 dark:text-neutral-400 hover:bg-sidebar-hover dark:hover:bg-neutral-900 hover:text-neutral-900 dark:hover:text-neutral-100 transition-colors`,children:[i?(0,F.jsx)(A,{size:15,className:`shrink-0`}):(0,F.jsx)(k,{size:15,className:`shrink-0`}),(0,F.jsx)(`span`,{className:w,children:L(`Collapse`)})]})})]})]})}function nn(){return(0,F.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center gap-5 px-6`,role:`status`,"aria-label":L(`Loading`),children:[(0,F.jsx)(en,{className:`w-12 h-12 rounded-lg shrink-0 motion-safe:animate-pulse`}),(0,F.jsxs)(`div`,{className:`w-full max-w-[220px] space-y-2.5`,children:[(0,F.jsx)(`div`,{className:`h-3 rounded bg-neutral-200 dark:bg-neutral-800 motion-safe:animate-pulse mx-auto w-1/2`}),(0,F.jsx)(`div`,{className:`h-2.5 rounded bg-neutral-100 dark:bg-neutral-900 motion-safe:animate-pulse w-full`}),(0,F.jsx)(`div`,{className:`h-2.5 rounded bg-neutral-100 dark:bg-neutral-900 motion-safe:animate-pulse w-5/6 mx-auto`})]}),(0,F.jsx)(`span`,{className:`sr-only`,children:L(`Loading…`)})]})}function rn({message:e}){return(0,F.jsx)(`div`,{className:`fixed bottom-6 left-1/2 -translate-x-1/2 bg-neutral-900 dark:bg-neutral-50 text-white dark:text-neutral-900 text-[13px] px-4 py-2 rounded shadow-sm z-50`,children:e})}function an({checked:e,onChange:t,size:n=`md`,label:r=`Toggle`}){let i=n===`lg`?{track:`w-11 h-6`,dot:`w-5 h-5`,tx:`translate-x-[22px]`,off:`translate-x-0.5`}:{track:`w-9 h-5`,dot:`w-4 h-4`,tx:`translate-x-[18px]`,off:`translate-x-0.5`};return(0,F.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":e?`true`:`false`,"aria-label":r,title:r,onClick:()=>t(!e),className:`relative inline-flex shrink-0 ${i.track} items-center rounded-full transition-colors duration-150 focus:outline-none ${e?`bg-accent`:`bg-neutral-300`}`,children:(0,F.jsx)(`span`,{className:`inline-block ${i.dot} transform rounded-full bg-white shadow-sm transition-transform duration-150 ${e?i.tx:i.off}`})})}function on(e){if(!e.module)return`#`;let t=`#${e.module}`;e.subtab&&(t+=`/${e.subtab}`);let n=[];return e.focus&&n.push(`focus=${encodeURIComponent(e.focus)}`),e.suggest!==void 0&&e.suggest!==null&&n.push(`suggest=${encodeURIComponent(String(e.suggest))}`),n.length>0&&(t+=`?${n.join(`&`)}`),t}function sn(e){let[t=``,n=``]=(e||``).replace(/^#/,``).split(`?`),[r=``,i=``]=t.split(`/`),a={module:r};i&&(a.subtab=i);for(let e of n.split(`&`)){if(!e)continue;let t=e.indexOf(`=`);if(t<0)continue;let n=e.slice(0,t),r=decodeURIComponent(e.slice(t+1));n===`focus`&&r&&(a.focus=r),n===`suggest`&&r!==``&&(a.suggest=r)}return a}function cn(e){if(!e)return null;let t=e.indexOf(`:`);return t<=0||t===e.length-1?null:{module:e.slice(0,t),field:e.slice(t+1)}}var ln={info:{border:`border-blue-200 dark:border-blue-900/60`,bg:`bg-blue-50 dark:bg-blue-950/40`,iconColor:`text-blue-600 dark:text-blue-400`,titleColor:`text-blue-900 dark:text-blue-200`,bodyColor:`text-blue-800/90 dark:text-blue-200/80`,preBorder:`border-blue-200 dark:border-blue-900/60`,preBg:`bg-white dark:bg-neutral-900`,preText:`text-neutral-800 dark:text-neutral-200`,copyBtnBorder:`border-blue-300 dark:border-blue-800`,copyBtnBg:`bg-white dark:bg-neutral-900`,copyBtnText:`text-blue-800 dark:text-blue-200`,copyBtnHover:`hover:bg-blue-100 dark:hover:bg-blue-900/40`,Icon:Te},warn:{border:`border-amber-200 dark:border-amber-900/60`,bg:`bg-amber-50 dark:bg-amber-950/40`,iconColor:`text-amber-600 dark:text-amber-400`,titleColor:`text-amber-900 dark:text-amber-200`,bodyColor:`text-amber-800/90 dark:text-amber-200/80`,preBorder:`border-amber-200 dark:border-amber-900/60`,preBg:`bg-white dark:bg-neutral-900`,preText:`text-neutral-800 dark:text-neutral-200`,copyBtnBorder:`border-amber-300 dark:border-amber-800`,copyBtnBg:`bg-white dark:bg-neutral-900`,copyBtnText:`text-amber-800 dark:text-amber-200`,copyBtnHover:`hover:bg-amber-100 dark:hover:bg-amber-900/40`,Icon:ot},danger:{border:`border-red-200 dark:border-red-900/60`,bg:`bg-red-50 dark:bg-red-950/40`,iconColor:`text-red-600 dark:text-red-400`,titleColor:`text-red-900 dark:text-red-200`,bodyColor:`text-red-800/90 dark:text-red-200/80`,preBorder:`border-red-200 dark:border-red-900/60`,preBg:`bg-white dark:bg-neutral-900`,preText:`text-neutral-800 dark:text-neutral-200`,copyBtnBorder:`border-red-300 dark:border-red-800`,copyBtnBg:`bg-white dark:bg-neutral-900`,copyBtnText:`text-red-800 dark:text-red-200`,copyBtnHover:`hover:bg-red-100 dark:hover:bg-red-900/40`,Icon:j},success:{border:`border-emerald-200 dark:border-emerald-900/60`,bg:`bg-emerald-50 dark:bg-emerald-950/40`,iconColor:`text-emerald-600 dark:text-emerald-400`,titleColor:`text-emerald-900 dark:text-emerald-200`,bodyColor:`text-emerald-800/90 dark:text-emerald-200/80`,preBorder:`border-emerald-200 dark:border-emerald-900/60`,preBg:`bg-white dark:bg-neutral-900`,preText:`text-neutral-800 dark:text-neutral-200`,copyBtnBorder:`border-emerald-300 dark:border-emerald-800`,copyBtnBg:`bg-white dark:bg-neutral-900`,copyBtnText:`text-emerald-800 dark:text-emerald-200`,copyBtnHover:`hover:bg-emerald-100 dark:hover:bg-emerald-900/40`,Icon:ie}};function z({tone:e,title:t,body:n,snippet:r,action:i}){let a=ln[e],[o,s]=(0,y.useState)(!1);return(0,F.jsx)(`div`,{className:`border ${a.border} ${a.bg} rounded-lg p-4 sm:p-5`,children:(0,F.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[(0,F.jsx)(a.Icon,{size:16,className:`${a.iconColor} shrink-0 mt-0.5`}),(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsx)(`div`,{className:`font-medium ${a.titleColor} text-[13px]`,children:t}),n&&(0,F.jsx)(`p`,{className:`text-[12px] ${a.bodyColor} mt-1`,children:n}),r&&(0,F.jsxs)(`div`,{className:`mt-3 relative`,children:[(0,F.jsx)(`pre`,{className:`text-[11px] font-mono ${a.preBg} border ${a.preBorder} rounded p-3 overflow-x-auto whitespace-pre ${a.preText}`,children:r}),(0,F.jsxs)(`button`,{type:`button`,onClick:async()=>{r&&(await navigator.clipboard.writeText(r),s(!0),setTimeout(()=>s(!1),1500))},className:`absolute top-2 right-2 flex items-center gap-1 text-[11px] px-2 py-1 rounded border ${a.copyBtnBorder} ${a.copyBtnBg} ${a.copyBtnText} ${a.copyBtnHover} transition-colors`,children:[o?(0,F.jsx)(D,{size:11}):(0,F.jsx)(oe,{size:11}),o?`Copied`:`Copy`]})]}),i&&(0,F.jsxs)(`a`,{href:on(i),className:`mt-3 inline-flex items-center gap-1.5 text-[12px] px-2.5 py-1 rounded border ${a.copyBtnBorder} ${a.copyBtnBg} ${a.copyBtnText} ${a.copyBtnHover} transition-colors`,children:[i.label,(0,F.jsx)(C,{size:12})]})]})]})})}function un(){return window.wp?.media}function dn({value:e,onChange:t,label:n}){let r=un(),i=()=>{if(!r)return;let e=r({title:n,button:{text:`Use this image`},library:{type:`image`},multiple:!1});e.on(`select`,()=>{let n=e.state().get(`selection`).first();n&&t(n.toJSON().url)}),e.open()};return r?(0,F.jsx)(`div`,{className:`flex items-center gap-2`,children:e?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`img`,{src:e,alt:n,className:`w-8 h-8 rounded object-contain border border-neutral-200 dark:border-neutral-700 bg-white`}),(0,F.jsx)(`button`,{type:`button`,onClick:i,className:`text-[12px] px-2.5 py-1 rounded border border-neutral-200 dark:border-neutral-700 text-neutral-700 dark:text-neutral-300 hover:bg-neutral-50 dark:hover:bg-neutral-800 transition-colors`,children:`Change`}),(0,F.jsx)(`button`,{type:`button`,onClick:()=>t(``),"aria-label":`Remove ${n}`,className:`text-neutral-400 hover:text-red-600 dark:hover:text-red-400 transition-colors`,children:(0,F.jsx)(ft,{size:14})})]}):(0,F.jsxs)(`button`,{type:`button`,onClick:i,className:`text-[12px] px-2.5 py-1 rounded border border-neutral-200 dark:border-neutral-700 text-neutral-700 dark:text-neutral-300 hover:bg-neutral-50 dark:hover:bg-neutral-800 transition-colors inline-flex items-center gap-1.5`,children:[(0,F.jsx)(Se,{size:13}),`Select image`]})}):(0,F.jsx)(`input`,{type:`url`,value:e??``,onChange:e=>t(e.target.value),className:`w-56`,"aria-label":n,placeholder:`https://…`})}function fn({title:e,body:t}){let[n,r]=(0,y.useState)(null),i=(0,y.useRef)(null),a=(0,y.useRef)(null),o=(0,y.useId)(),s=n!==null,c=()=>{let e=i.current;if(!e)return;let t=e.getBoundingClientRect();r({top:t.bottom+6,left:t.left})};return(0,y.useEffect)(()=>{if(!s)return;let e=e=>{!a.current?.contains(e.target)&&!i.current?.contains(e.target)&&r(null)},t=e=>{e.key===`Escape`&&r(null)},n=()=>r(null);return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),window.addEventListener(`scroll`,n,!0),window.addEventListener(`resize`,n),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t),window.removeEventListener(`scroll`,n,!0),window.removeEventListener(`resize`,n)}},[s]),(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`button`,{ref:i,type:`button`,onClick:()=>s?r(null):c(),"aria-expanded":s,"aria-label":e?`Info: ${e}`:`More information`,className:`inline-flex items-center justify-center text-neutral-400 hover:text-accent dark:hover:text-blue-400 transition-colors align-middle`,children:(0,F.jsx)(Te,{size:14})}),s&&typeof document<`u`&&(0,gt.createPortal)((0,F.jsxs)(`div`,{ref:a,role:`dialog`,"aria-labelledby":e?o:void 0,style:{position:`fixed`,top:n.top,left:n.left,zIndex:60},className:`w-[min(20rem,calc(100vw-2rem))] rounded-md bg-white dark:bg-neutral-900 border border-neutral-200 dark:border-neutral-700 shadow-md p-3`,children:[e&&(0,F.jsx)(`div`,{id:o,className:`text-[12px] font-medium text-neutral-900 dark:text-neutral-50 mb-1`,children:e}),(0,F.jsx)(`p`,{className:`text-[12px] leading-relaxed text-neutral-600 dark:text-neutral-400`,children:t})]}),document.getElementById(`xspeed-app`)??document.body)]})}var pn={ok:`bg-emerald-500`,warn:`bg-amber-500`,fail:`bg-red-500`,info:`bg-neutral-300 dark:bg-neutral-600`};function mn({tone:e,label:t,labelAfter:n,detail:r,trailing:i,first:a=!1}){return(0,F.jsxs)(`div`,{className:`flex items-start gap-3 px-4 sm:px-5 py-3.5 ${a?``:`border-t border-neutral-200 dark:border-neutral-800`}`,children:[(0,F.jsx)(`span`,{className:`w-2 h-2 rounded-full mt-1.5 shrink-0 ${pn[e]}`}),(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsxs)(`div`,{className:`inline-flex items-center gap-1.5 text-[13px] font-medium text-neutral-900 dark:text-neutral-50`,children:[(0,F.jsx)(`span`,{children:t}),n]}),r!=null&&r!==``&&(0,F.jsx)(`div`,{className:`text-[12px] text-neutral-500 dark:text-neutral-400 mt-0.5`,children:r})]}),i&&(0,F.jsx)(`div`,{className:`shrink-0`,children:i})]})}function hn({content:e,tone:t=`neutral`}){let[n,r]=(0,y.useState)(!1);return(0,F.jsxs)(`div`,{className:`relative rounded ${t===`amber`?`bg-white dark:bg-neutral-900 border border-amber-200 dark:border-amber-900/60`:t===`blue`?`bg-white dark:bg-neutral-900 border border-blue-200 dark:border-blue-900/60`:`bg-neutral-50 dark:bg-neutral-950 border border-neutral-200 dark:border-neutral-800`}`,children:[(0,F.jsxs)(`button`,{type:`button`,onClick:async()=>{try{await navigator.clipboard.writeText(e),r(!0),window.setTimeout(()=>r(!1),1800)}catch{}},className:`absolute top-2 right-2 inline-flex items-center gap-1 text-[11px] px-2 py-1 rounded border border-neutral-300 dark:border-neutral-700 bg-white/90 dark:bg-neutral-800/90 text-neutral-700 dark:text-neutral-200 hover:bg-neutral-100 dark:hover:bg-neutral-700 transition-colors`,"aria-label":n?`Snippet copied`:`Copy snippet`,children:[n?(0,F.jsx)(D,{size:12}):(0,F.jsx)(oe,{size:12}),n?`Copied`:`Copy`]}),(0,F.jsx)(`pre`,{className:`text-[11px] font-mono p-3 pr-16 overflow-x-auto whitespace-pre text-neutral-800 dark:text-neutral-200`,children:e})]})}var gn=window.XSpeedConfig;async function B(e,t={}){let n=await fetch(`${gn.restUrl}${e}`,{...t,headers:{"Content-Type":`application/json`,"X-WP-Nonce":gn.nonce,...t.headers||{}},credentials:`same-origin`});if(!n.ok)throw Error(`HTTP ${n.status}`);return n.json()}var V={request:(e,t={})=>B(e,t),getStatus:()=>B(`/status`),getSettings:()=>B(`/settings`),getModules:()=>B(`/modules`),getBranding:()=>B(`/branding`),updateSettings:e=>B(`/settings`,{method:`POST`,body:JSON.stringify(e)}),toggleCache:e=>B(`/cache/toggle`,{method:`POST`,body:JSON.stringify({enabled:e})}),purge:()=>B(`/cache/purge`,{method:`POST`}),preload:()=>B(`/preloader/start`,{method:`POST`}),getRecommendations:()=>B(`/recommendations`),applyRecommendation:e=>B(`/recommendations/apply`,{method:`POST`,body:JSON.stringify({id:e})}),getProAudit:()=>B(`/audit/pro`),getActivity:()=>B(`/activity`),mobileEqualityProbe:()=>B(`/cache/mobile-probe`,{method:`POST`}),dismissMobileReview:()=>B(`/cache/mobile-review-dismiss`,{method:`POST`}),onboardingApply:e=>B(`/onboarding/apply`,{method:`POST`,body:JSON.stringify(e)}),onboardingComplete:()=>B(`/onboarding/complete`,{method:`POST`}),getModuleSettings:e=>B(`/${e}/`),updateModuleSettings:(e,t)=>B(`/${e}/`,{method:`POST`,body:JSON.stringify(t)})};function _n(e){if(!e)return`Never`;let t=Math.floor(Date.now()/1e3)-e;return t<60?`${t}s ago`:t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}var vn={info:`bg-neutral-300 dark:bg-neutral-600`,warn:`bg-amber-500`,error:`bg-red-500`,success:`bg-emerald-500`};function yn({module:e}){let[t,n]=(0,y.useState)(null),[r,i]=(0,y.useState)(null);if((0,y.useEffect)(()=>{V.getModuleSettings(`health`).then(n).catch(e=>i(e instanceof Error?e.message:`Failed to load`))},[]),r)return(0,F.jsx)(`div`,{className:`text-[12px] text-red-600 dark:text-red-400`,children:r});if(!t)return(0,F.jsx)(`div`,{className:`text-[13px] text-neutral-500 dark:text-neutral-400`,children:`Loading…`});let{checks:a,stats:o,buckets:s,activity:c}=t;return(0,F.jsxs)(`div`,{className:`space-y-4`,children:[(0,F.jsx)(bn,{stats:o,buckets:s}),(0,F.jsx)(`div`,{className:`border border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 rounded-lg overflow-hidden`,children:a.map((e,t)=>(0,F.jsxs)(`div`,{children:[(0,F.jsx)(mn,{first:t===0,tone:e.tone,label:e.label,detail:e.detail,labelAfter:e.id===`static_rewrite_nginx`?(0,F.jsx)(fn,{title:`Good to know`,body:`You added this snippet to your nginx config yourself, so it's yours to manage — xSpeed never touches it. If you ever need to uninstall xSpeed, just remove this snippet from your nginx config first to keep everything tidy and your server running happily.`}):void 0}),e.snippet&&(0,F.jsx)(`div`,{className:`px-4 pb-4 pt-1 border-b border-neutral-200 dark:border-neutral-800 last:border-b-0`,children:(0,F.jsx)(hn,{content:e.snippet})})]},e.id))}),(0,F.jsx)(Sn,{activity:c})]})}function bn({stats:e,buckets:t}){let n=e.hits_24h+e.misses_24h,r=n>0?Math.round(e.hit_ratio*100):0;return(0,F.jsxs)(`div`,{className:`border border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 rounded-lg p-5`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,F.jsx)(`div`,{className:`text-[11px] uppercase tracking-wider text-neutral-500 dark:text-neutral-400 font-medium`,children:`Hit ratio · 24h`}),(0,F.jsx)(S,{size:14,className:`text-neutral-400 dark:text-neutral-500`})]}),(0,F.jsxs)(`div`,{className:`flex items-baseline gap-3 mb-3`,children:[(0,F.jsx)(`div`,{className:`text-[28px] font-semibold text-neutral-900 dark:text-neutral-50 leading-none`,children:n>0?`${r}%`:`—`}),(0,F.jsx)(`div`,{className:`text-[12px] text-neutral-500 dark:text-neutral-400`,children:n>0?`${e.hits_24h} hits · ${e.misses_24h} misses`:`No traffic captured in the last 24h yet.`})]}),(0,F.jsx)(xn,{buckets:t})]})}function xn({buckets:e}){if(!e.length)return(0,F.jsx)(`div`,{className:`h-8`});let t=Math.max(1,...e.map(e=>e.hits+e.misses)),n=480/Math.max(e.length-1,1),r=e.map((e,r)=>{let i=32-(e.hits+e.misses)/t*28-2;return`${(r*n).toFixed(1)},${i.toFixed(1)}`}).join(` `);return(0,F.jsx)(`svg`,{viewBox:`0 0 480 32`,preserveAspectRatio:`none`,className:`w-full h-8 text-accent`,role:`img`,"aria-label":`24-hour cache request volume`,children:(0,F.jsx)(`polyline`,{points:r,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`})})}function Sn({activity:e}){return e.length===0?(0,F.jsx)(`div`,{className:`border border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 rounded-lg p-5 text-center text-[13px] text-neutral-500 dark:text-neutral-400`,children:`No activity yet.`}):(0,F.jsxs)(`div`,{className:`border border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 rounded-lg overflow-hidden`,children:[(0,F.jsxs)(`div`,{className:`px-4 sm:px-5 py-3 border-b border-neutral-200 dark:border-neutral-800`,children:[(0,F.jsx)(`div`,{className:`font-medium text-[13px] text-neutral-900 dark:text-neutral-50`,children:`Recent activity`}),(0,F.jsxs)(`div`,{className:`text-[12px] text-neutral-500 dark:text-neutral-400 mt-0.5`,children:[`Most recent `,e.length,` event`,e.length===1?``:`s`,` captured by the cache engine.`]})]}),(0,F.jsx)(`ul`,{className:`divide-y divide-neutral-200 dark:divide-neutral-800`,children:e.map((e,t)=>(0,F.jsxs)(`li`,{className:`px-4 sm:px-5 py-3 flex items-start gap-3`,children:[(0,F.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full mt-2 shrink-0 ${vn[e.severity]}`}),(0,F.jsxs)(`div`,{className:`min-w-0 flex-1 flex items-baseline justify-between gap-3`,children:[(0,F.jsx)(`div`,{className:`text-[13px] text-neutral-700 dark:text-neutral-300 min-w-0 truncate`,children:e.message}),(0,F.jsx)(`div`,{className:`text-[11px] text-neutral-500 dark:text-neutral-400 shrink-0`,children:_n(e.ts)})]})]},`${e.ts}-${t}`))})]})}function Cn({items:e,value:t,onChange:n,idBase:r}){let i=(0,y.useId)(),a=r??i;function o(r){let i=e.findIndex(e=>e.key===t);if(i===-1)return;let a=e[(i+r+e.length)%e.length];n(a.key)}return(0,F.jsx)(`div`,{role:`tablist`,className:`flex items-center gap-1 border-b border-neutral-200 dark:border-neutral-800`,onKeyDown:e=>{e.key===`ArrowRight`?(e.preventDefault(),o(1)):e.key===`ArrowLeft`&&(e.preventDefault(),o(-1))},children:e.map(e=>{let r=e.key===t;return(0,F.jsx)(`button`,{id:wn(a,e.key),role:`tab`,type:`button`,"aria-selected":r,"aria-controls":Tn(a,e.key),tabIndex:r?0:-1,onClick:()=>n(e.key),className:`text-[12px] px-3 py-1.5 -mb-px border-b-2 transition-colors ${r?`border-accent text-neutral-900 dark:text-neutral-50 font-medium`:`border-transparent text-neutral-500 dark:text-neutral-400 hover:text-neutral-700 dark:hover:text-neutral-200`} ${e.locked?`opacity-70`:``}`,children:(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[e.label,e.locked&&(0,F.jsx)(`span`,{"aria-hidden":`true`,className:`inline-block w-[10px] h-[10px] rounded-[2px] bg-amber-400/80`,title:`Pro`})]})},e.key)})})}function wn(e,t){return`xspeed-tab-${e}-${t}`}function Tn(e,t){return`xspeed-tabpanel-${e}-${t}`}function En(){return typeof window>`u`?`free`:window.XSpeedConfig?.tier??`free`}function Dn(){if(typeof window>`u`)return`not_installed`;let e=window.XSpeedConfig;return e?.proState?e.proState:On()?`active`:`not_installed`}function H(){let[e,t]=(0,y.useState)(En);return(0,y.useEffect)(()=>{if(typeof window>`u`)return;let e=()=>t(En());return window.addEventListener(Gt,e),()=>window.removeEventListener(Gt,e)},[]),e}function On(){let e=En();return e===`pro`||e===`trial`}function kn(){let[e,t]=(0,y.useState)(Dn);return(0,y.useEffect)(()=>{if(typeof window>`u`)return;let e=()=>t(Dn());return window.addEventListener(Gt,e),()=>window.removeEventListener(Gt,e)},[]),e}var An=`https://xspeedcache.com/pricing/`,jn={"critical-css":{id:`critical-css`,icon:`Sparkles`,title:`Critical CSS`,body:`Inline above-the-fold styles and defer the rest. Cuts first paint on theme-heavy pages by 30-60%.`},"unused-css":{id:`unused-css`,icon:`Scissors`,title:`Remove Unused CSS`,body:`Per-URL pruned stylesheet inlined; original <link> tags stripped. Pairs with Critical CSS.`},"webp-avif":{id:`webp-avif`,icon:`Replace`,title:`Auto WebP / AVIF on upload`,body:`New JPEG/PNG uploads get .webp + .avif siblings; browsers that support modern formats get them automatically.`},"cloudflare-apo":{id:`cloudflare-apo`,icon:`Zap`,title:`Cloudflare APO + edge cache`,body:`Toggle Automatic Platform Optimization right from here, set edge cache TTL, no separate dashboard.`},"feed-cache":{id:`feed-cache`,icon:`Rss`,title:`Feed caching`,body:`Cache RSS / Atom / comment feeds so aggregators polling your feed skip a full render — with the correct feed content-type preserved and auto-purge on new posts.`},"cache-404":{id:`cache-404`,icon:`FileX`,title:`404 caching`,body:`Serve one short-lived cached 404 so bot and scanner floods on nonexistent URLs don't each trigger a full render. Shared entry, correct 404 status, purged when you publish.`},"search-cache":{id:`search-cache`,icon:`Search`,title:`Search caching`,body:`Cache internal search-results pages (/?s=…) so popular repeated searches skip a full query + render. Keyed per term, short-lived, and purged when you publish new content.`},"rest-cache":{id:`rest-cache`,icon:`Webhook`,title:`REST API per-route cache`,body:`Cache read-only REST responses with a TTL you set per route — ideal for headless front-ends and app backends. Authenticated and write requests are never cached.`},"prewarm-schedule":{id:`prewarm-schedule`,icon:`CalendarClock`,title:`Scheduled prewarming`,body:`Warm target URLs ahead of a post going live, a sale, or a campaign so the traffic spike hits a warm cache. One-off, recurring, and auto-warm when a scheduled post publishes.`},"predictive-warm":{id:`predictive-warm`,icon:`TrendingUp`,title:`Predictive warming`,body:`Proactively warm the pages most likely to be visited next — ranked by real traffic, recency, and content — so your hottest URLs are always served from cache, not a cold render.`},brotli:{id:`brotli`,icon:`Shrink`,title:`Brotli compression`,body:`Serve Brotli where the browser and server support it — typically 15-25% smaller than GZIP — with automatic GZIP fallback.`},rum:{id:`rum`,icon:`Eye`,title:`Real-User Monitoring`,body:`See actual LCP / CLS / INP from your visitors’ browsers, not synthetic Lighthouse. Per-URL percentiles.`},pagespeed:{id:`pagespeed`,icon:`Gauge`,title:`PageSpeed Insights, in-dashboard`,body:`Run Google PSI on any URL without leaving xSpeed. Scores + Core Web Vitals + cached for 24h.`},recommendations:{id:`recommendations`,icon:`Lightbulb`,title:`Smart recommendations`,body:`Pro audits your current settings + server state and surfaces the 5 things most likely to move your score.`},analytics:{id:`analytics`,icon:`BarChart3`,title:`Per-URL cache analytics`,body:`Slowest pages, hit-ratio chart, recent activity timeline. Powered by the RUM data you’re already collecting.`},migration:{id:`migration`,icon:`Import`,title:`One-click migration`,body:`Import settings from WP Rocket, W3 Total Cache, or WP Super Cache. No manual reconfiguration.`},"white-label":{id:`white-label`,icon:`Tag`,title:`White-label dashboard`,body:`Rebrand the plugin name, footer credit, and help links for client work.`},multisite:{id:`multisite`,icon:`Network`,title:`Multisite network view`,body:`One dashboard across every site in your network with per-site cache state and network-wide purge.`},"custom-rules":{id:`custom-rules`,icon:`Filter`,title:`Pattern-based cache rules`,body:`Bypass cache or override expiry by URL glob, post type, category, tag, or author — beyond per-post settings.`}},Mn=`admin.php?page=xspeed#license`;function Nn({icon:e,title:t,description:n,teaser:r}){let i=r?jn[r]:null,a=kn()===`unlicensed`,o=a?{card:`border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900`,iconWrap:`bg-blue-50 dark:bg-blue-950/40 border-blue-100 dark:border-blue-900/50 text-blue-600 dark:text-blue-400`,badge:`text-blue-700 dark:text-blue-300 bg-blue-50 dark:bg-blue-950/40 border-blue-100 dark:border-blue-900/50`,cta:`bg-blue-600 hover:bg-blue-700 dark:bg-blue-500 dark:hover:bg-blue-400 text-white`}:{card:`border-amber-200 dark:border-amber-900/60 bg-amber-50/60 dark:bg-amber-950/20`,iconWrap:`bg-amber-100 dark:bg-amber-950/60 border-amber-200 dark:border-amber-900/60 text-amber-600 dark:text-amber-400`,badge:`text-amber-700 dark:text-amber-300 bg-amber-100 dark:bg-amber-950/60 border-amber-200 dark:border-amber-900/60`,cta:`bg-amber-600 hover:bg-amber-700 dark:bg-amber-500 dark:hover:bg-amber-400 text-white dark:text-neutral-900`};return(0,F.jsx)(`div`,{className:`border rounded-lg p-4 sm:p-5 ${o.card}`,children:(0,F.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,F.jsx)(`div`,{className:`shrink-0 w-9 h-9 rounded-full border flex items-center justify-center ${o.iconWrap}`,children:(0,F.jsx)(yt,{name:e,size:17})}),(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2 mb-0.5`,children:[(0,F.jsx)(`h3`,{className:`text-[14px] font-semibold text-neutral-900 dark:text-neutral-50`,children:t}),(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[10px] uppercase tracking-wider font-medium border rounded-full px-1.5 py-0.5 ${o.badge}`,children:[a?(0,F.jsx)(Ee,{size:9}):(0,F.jsx)(se,{size:9}),(0,F.jsx)(`span`,{children:L(a?`License`:`Pro`)})]})]}),n&&(0,F.jsx)(`p`,{className:`text-[12px] text-neutral-600 dark:text-neutral-300 leading-relaxed`,children:n}),i&&(0,F.jsx)(`p`,{className:`text-[12px] text-neutral-500 dark:text-neutral-400 mt-2 leading-relaxed`,children:i.body}),a?(0,F.jsxs)(`a`,{href:Mn,className:`inline-flex items-center gap-1.5 mt-3 px-3 py-1.5 rounded-md text-[12px] font-medium transition-colors ${o.cta}`,children:[L(`Activate your license`),(0,F.jsx)(C,{size:12})]}):(0,F.jsxs)(`a`,{href:An,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1.5 mt-3 px-3 py-1.5 rounded-md text-[12px] font-medium transition-colors ${o.cta}`,children:[L(`Upgrade to Pro`),(0,F.jsx)(C,{size:12})]})]})]})})}function U({panel:e,slug:t,getModule:n,onSaved:r,title:i,description:a,icon:o}){Yt();let s=H(),c=It.find(e=>e.slug===t),l=(0,F.jsx)(Nn,{icon:o??c?.icon??`Sparkles`,title:i??c?.label??t,description:a??c?.description,teaser:c?.teaser??void 0});if(s!==`pro`&&s!==`trial`)return l;let u=n?.(t);if(!u)return l;let d=e?qt(e):void 0;return d?(0,F.jsx)(d,{module:u,onSaved:r}):e?l:(0,F.jsx)(wi,{module:u,onSaved:r})}var Pn={"ai-provider":{id:`ai-provider`,title:`One AI connection, every AI feature`,subtitle:`Connect OpenAI, Anthropic, Gemini, or OpenRouter once — every Pro AI feature shares the same key, no per-feature setup.`,icon:`Sparkles`,mock:{kind:`toggles`,rows:[{label:`OpenAI`,on:!0,stat:`connected`},{label:`Anthropic`,on:!1,stat:`available`},{label:`Google Gemini`,on:!1,stat:`available`},{label:`OpenRouter`,on:!1,stat:`available`}]},points:[{icon:`Sparkles`,text:`Connect one provider; Speculation Rules, AI Suggestions, and Adaptive Cache all use it.`},{icon:`Lock`,text:`Your key stays on your server — stored in wp-config or the database, never shipped to us.`},{icon:`Check`,text:`Swap providers any time without reconfiguring each feature.`}]},"adaptive-cache":{id:`adaptive-cache`,title:`Cache TTL that tunes itself`,subtitle:`xSpeed reads your last 24 hours of traffic and recommends the cache lifetime that balances freshness against hit-rate — applied in one click.`,icon:`Lightbulb`,mock:{kind:`chart`,headline:`+18%`,headlineNote:`projected hit-rate at the suggested TTL`,bars:[{label:`Now`,value:71},{label:`Suggested`,value:89}]},points:[{icon:`Lightbulb`,text:`AI-tuned TTL from real 24-hour traffic patterns — no more guessing a number.`},{icon:`Check`,text:`Review the recommendation, then apply it into the Cache module in one click.`}]},"coverage-what":{id:`coverage-what`,title:`Cache more than HTML pages`,subtitle:`Page Cache serves anonymous HTML. Pro extends that to the requests that quietly cost you the most renders.`,icon:`Layers`,mock:{kind:`toggles`,rows:[{label:`404 Caching`,on:!0,stat:`3,180 bot hits absorbed`},{label:`Search Caching`,on:!0,stat:`/?s= results cached`}]},points:[{icon:`FileX`,text:`Serve one shared cached 404 so scanner floods stop costing a render each.`},{icon:`Search`,text:`Cache internal search pages (/?s=…), keyed per term, purged on publish.`},{icon:`ShieldCheck`,text:`Correct status codes preserved; auto-purge when you publish new content.`}]},"coverage-beyond":{id:`coverage-beyond`,title:`Cache feeds & API responses`,subtitle:`Aggregators and headless front-ends hammer endpoints Page Cache never touches. Pro caches those too.`,icon:`Rss`,mock:{kind:`toggles`,rows:[{label:`Feed Caching (RSS / Atom)`,on:!0,stat:`content-type preserved`},{label:`REST API Cache`,on:!0,stat:`per-route TTL`}]},points:[{icon:`Rss`,text:`Cache RSS / Atom / comment feeds so polling aggregators skip a full render.`},{icon:`Webhook`,text:`Cache read-only REST routes with a TTL you set — built for headless sites.`},{icon:`Lock`,text:`Authenticated and write requests are never cached.`}]},"coverage-rules":{id:`coverage-rules`,title:`Bypass & override by rule`,subtitle:`Go past per-post toggles: shape caching with patterns, and stand down cleanly during maintenance.`,icon:`Filter`,mock:{kind:`code`,code:[`BYPASS /cart/* (never cache)`,`BYPASS post_type=product when logged in`,`EXPIRE /blog/* override → 12h`,`MAINT. coming-soon mode → skip + auto-purge on go-live`]},points:[{icon:`Filter`,text:`Bypass or override expiry by URL glob, post type, category, tag, or author.`},{icon:`Wrench`,text:`Skip caching in maintenance / coming-soon mode, auto-purge when live again.`}]},"media-formats":{id:`media-formats`,title:`Modern image formats, automatically`,subtitle:`Every new upload gets lighter WebP + AVIF siblings, served to the browsers that support them.`,icon:`Replace`,mock:{kind:`formats`,badges:[`JPEG`,`WebP`,`AVIF`],headline:`−62%`,headlineNote:`typical transfer saved vs original JPEG`},points:[{icon:`Replace`,text:`New JPEG/PNG uploads get .webp + .avif siblings generated automatically.`},{icon:`Zap`,text:`Browsers that support modern formats get them; others fall back cleanly.`}]},"media-smart":{id:`media-smart`,title:`AI-tuned image settings`,subtitle:`Let xSpeed recommend the format and quality for each image, then apply it into Image Optimization in one click.`,icon:`Sparkles`,mock:{kind:`toggles`,rows:[{label:`hero.jpg → AVIF @ 72`,on:!0,stat:`−240 KB`},{label:`logo.png → WebP lossless`,on:!0,stat:`−31 KB`}]},points:[{icon:`Sparkles`,text:`AI recommends the best format + quality per image, not a blanket setting.`},{icon:`Check`,text:`Review the suggestions, then apply them all with one click.`}]},"compression-brotli":{id:`compression-brotli`,title:`Brotli compression`,subtitle:`Smaller than GZIP where the browser supports it — with automatic GZIP fallback everywhere else.`,icon:`Shrink`,mock:{kind:`chart`,headline:`−21%`,headlineNote:`smaller responses vs GZIP (typical)`,bars:[{label:`None`,value:100},{label:`GZIP`,value:34},{label:`Brotli`,value:27}]},points:[{icon:`Shrink`,text:`Serve Brotli where the browser and server support it — typically 15–25% smaller.`},{icon:`ShieldCheck`,text:`Automatic GZIP fallback, so nothing breaks on older clients.`}]},"cssjs-critical":{id:`cssjs-critical`,title:`Inline critical CSS, defer the rest`,subtitle:`Send only the styles the first screen needs up front so the page paints without waiting on the full stylesheet.`,icon:`Sparkles`,mock:{kind:`chart`,headline:`−48%`,headlineNote:`render-blocking CSS on first paint`,bars:[{label:`Before`,value:100},{label:`Critical`,value:52}]},points:[{icon:`Sparkles`,text:`Inline above-the-fold CSS and defer the rest — cuts first paint 30–60%.`},{icon:`Gauge`,text:`Pluggable generator endpoint; regenerates when your theme changes.`}]},"cssjs-unused":{id:`cssjs-unused`,title:`Strip the CSS a page never uses`,subtitle:`Most themes ship one giant stylesheet for the whole site. Pro serves each URL only the rules it actually needs.`,icon:`Scissors`,mock:{kind:`chart`,headline:`−71%`,headlineNote:`stylesheet bytes on a typical post`,bars:[{label:`Full CSS`,value:100},{label:`Pruned`,value:29}]},points:[{icon:`Scissors`,text:`Per-URL pruned stylesheet inlined; original <link> tags stripped.`},{icon:`Sparkles`,text:`Pairs with Critical CSS for the smallest possible first paint.`}]},"health-pagespeed":{id:`health-pagespeed`,title:`Real scores, in your dashboard`,subtitle:`Run Google PageSpeed on any URL and watch Core Web Vitals from real visitors — without leaving xSpeed.`,icon:`Gauge`,mock:{kind:`chart`,headline:`98`,headlineNote:`PageSpeed score · mobile`,bars:[{label:`LCP`,value:92},{label:`CLS`,value:99},{label:`INP`,value:95}]},points:[{icon:`Gauge`,text:`Run Google PSI on any URL — scores + Core Web Vitals, cached 24h.`},{icon:`Eye`,text:`Real-User Monitoring: LCP / CLS / INP from actual visitors, per-URL percentiles.`},{icon:`HeartPulse`,text:`Performance Health flags regressions against a 7-day baseline.`}]},"hints-speculation":{id:`hints-speculation`,title:`Prefetch the next page, before the click`,subtitle:`xSpeed predicts where each visitor is headed and quietly prefetches it via Chrome’s Speculation Rules API — so the next page feels instant.`,icon:`Wand2`,mock:{kind:`toggles`,rows:[{label:`Prefetch on hover / viewport`,on:!0,stat:`eager`},{label:`Prerender top predicted page`,on:!0,stat:`moderate`}]},points:[{icon:`Wand2`,text:`Predict each visitor’s next page and prefetch it via Speculation Rules.`},{icon:`Zap`,text:`The next navigation feels instant — the page is already there.`}]},"network-cloudflare":{id:`network-cloudflare`,title:`Drive Cloudflare from here`,subtitle:`Toggle Automatic Platform Optimization and edge cache without a second dashboard.`,icon:`Zap`,mock:{kind:`toggles`,rows:[{label:`Automatic Platform Optimization`,on:!0,stat:`edge HTML cache`},{label:`Edge cache TTL`,on:!0,stat:`4 hours`}]},points:[{icon:`Zap`,text:`Toggle APO, set edge cache level and TTL from inside xSpeed.`},{icon:`RefreshCw`,text:`Edge purge stays in sync with your local cache purges.`}]},"preloader-scheduled":{id:`preloader-scheduled`,title:`Warm the cache before the traffic`,subtitle:`Schedule warm-ups around launches, sales, and scheduled posts so the spike hits a warm cache — never a cold render.`,icon:`CalendarClock`,mock:{kind:`toggles`,rows:[{label:`Nightly full-site warm`,on:!0,stat:`02:00`},{label:`On scheduled-post publish`,on:!0,stat:`auto`},{label:`One-off: /black-friday`,on:!0,stat:`Fri 08:00`}]},points:[{icon:`CalendarClock`,text:`Warm target URLs ahead of a post, sale, or campaign going live.`},{icon:`RefreshCw`,text:`One-off, recurring, and auto-warm when a scheduled post publishes.`}]},"preloader-predictive":{id:`preloader-predictive`,title:`Keep the hottest pages always warm`,subtitle:`Let xSpeed rank your URLs by real traffic, recency, and content, and warm the ones most likely to be hit next.`,icon:`TrendingUp`,mock:{kind:`toggles`,rows:[{label:`/pricing`,on:!0,stat:`rank #1 · warm`},{label:`/blog/new-release`,on:!0,stat:`rank #2 · warm`},{label:`/features`,on:!0,stat:`rank #3 · warm`}]},points:[{icon:`TrendingUp`,text:`Proactively warm the pages most likely to be visited next.`},{icon:`BarChart3`,text:`Ranked by real traffic, recency, and content — no manual list to maintain.`}]},"health-visitors":{id:`health-visitors`,title:`Measure real visitors, not lab tests`,subtitle:`A lightweight beacon samples Core Web Vitals from your actual visitors’ browsers — the numbers Google ranks on.`,icon:`Eye`,mock:{kind:`chart`,headline:`p75`,headlineNote:`real-user Core Web Vitals`,bars:[{label:`LCP`,value:88},{label:`CLS`,value:96},{label:`INP`,value:91}]},points:[{icon:`Eye`,text:`Sample LCP / FCP / CLS / INP / TTFB from real visitors, per-URL percentiles.`},{icon:`BarChart3`,text:`See which pages actually feel slow — powered by the data you already collect.`}]}};function Fn(e){return Pn[e]}var In=`admin.php?page=xspeed#license`;function Ln({id:e}){let t=Fn(e),n=kn()===`unlicensed`;if(!t)return null;let r=n?{frame:`border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900`,iconWrap:`bg-blue-50 dark:bg-blue-950/40 border-blue-100 dark:border-blue-900/50 text-blue-600 dark:text-blue-400`,badge:`text-blue-700 dark:text-blue-300 bg-blue-50 dark:bg-blue-950/40 border-blue-100 dark:border-blue-900/50`,cta:`bg-blue-600 hover:bg-blue-700 dark:bg-blue-500 dark:hover:bg-blue-400 text-white`,accent:`text-blue-600 dark:text-blue-400`,check:`text-blue-500 dark:text-blue-400`}:{frame:`border-amber-200 dark:border-amber-900/60 bg-amber-50/40 dark:bg-amber-950/10`,iconWrap:`bg-amber-100 dark:bg-amber-950/60 border-amber-200 dark:border-amber-900/60 text-amber-600 dark:text-amber-400`,badge:`text-amber-700 dark:text-amber-300 bg-amber-100 dark:bg-amber-950/60 border-amber-200 dark:border-amber-900/60`,cta:`bg-amber-600 hover:bg-amber-700 dark:bg-amber-500 dark:hover:bg-amber-400 text-white dark:text-neutral-900`,accent:`text-amber-600 dark:text-amber-400`,check:`text-amber-500 dark:text-amber-400`};return(0,F.jsxs)(`div`,{className:`border rounded-xl overflow-hidden ${r.frame}`,children:[(0,F.jsxs)(`div`,{className:`flex items-start gap-3 p-4 sm:p-5 pb-3`,children:[(0,F.jsx)(`div`,{className:`shrink-0 w-9 h-9 rounded-full border flex items-center justify-center ${r.iconWrap}`,children:(0,F.jsx)(yt,{name:t.icon,size:17})}),(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2 mb-0.5`,children:[(0,F.jsx)(`h3`,{className:`text-[14px] font-semibold text-neutral-900 dark:text-neutral-50`,children:t.title}),(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[10px] uppercase tracking-wider font-medium border rounded-full px-1.5 py-0.5 ${r.badge}`,children:[n?(0,F.jsx)(Ee,{size:9}):(0,F.jsx)(se,{size:9}),(0,F.jsx)(`span`,{children:L(n?`License`:`Pro`)})]})]}),(0,F.jsx)(`p`,{className:`text-[12px] text-neutral-600 dark:text-neutral-300 leading-relaxed`,children:t.subtitle})]})]}),(0,F.jsx)(`div`,{className:`px-4 sm:px-5`,children:(0,F.jsx)(Rn,{mock:t.mock,accent:r.accent})}),(0,F.jsxs)(`div`,{className:`p-4 sm:p-5 pt-4`,children:[(0,F.jsx)(`ul`,{className:`space-y-2`,children:t.points.map((e,t)=>(0,F.jsxs)(`li`,{className:`flex items-start gap-2.5`,children:[(0,F.jsx)(D,{size:15,className:`shrink-0 mt-0.5 ${r.check}`,strokeWidth:2.5}),(0,F.jsx)(`span`,{className:`text-[12px] text-neutral-700 dark:text-neutral-200 leading-relaxed`,children:e.text})]},t))}),n?(0,F.jsxs)(`a`,{href:In,className:`inline-flex items-center gap-1.5 mt-4 px-3.5 py-2 rounded-md text-[12px] font-medium transition-colors ${r.cta}`,children:[L(`Activate your license`),(0,F.jsx)(C,{size:12})]}):(0,F.jsxs)(`a`,{href:An,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1.5 mt-4 px-3.5 py-2 rounded-md text-[12px] font-medium transition-colors ${r.cta}`,children:[L(`Upgrade to Pro`),(0,F.jsx)(C,{size:12})]})]})]})}function Rn({mock:e,accent:t}){return(0,F.jsxs)(`div`,{className:`relative rounded-lg border border-neutral-200 dark:border-neutral-800 bg-neutral-50/80 dark:bg-neutral-950/40 p-3.5 overflow-hidden`,children:[(0,F.jsxs)(`div`,{className:`absolute right-2 top-2 z-10 flex items-center gap-1 rounded-full bg-white/80 dark:bg-neutral-900/80 border border-neutral-200 dark:border-neutral-700 px-1.5 py-0.5 text-[9px] uppercase tracking-wider text-neutral-400 dark:text-neutral-500`,children:[(0,F.jsx)(Me,{size:8}),L(`Preview`)]}),(0,F.jsxs)(`div`,{"aria-hidden":`true`,className:`select-none`,children:[e.kind===`toggles`&&(0,F.jsx)(zn,{mock:e,accent:t}),e.kind===`chart`&&(0,F.jsx)(Bn,{mock:e,accent:t}),e.kind===`code`&&(0,F.jsx)(Vn,{mock:e}),e.kind===`formats`&&(0,F.jsx)(Hn,{mock:e,accent:t})]})]})}function zn({mock:e,accent:t}){return(0,F.jsx)(`div`,{className:`space-y-2`,children:(e.rows??[]).map((e,n)=>(0,F.jsxs)(`div`,{className:`flex items-center gap-3 rounded-md bg-white dark:bg-neutral-900 border border-neutral-200 dark:border-neutral-800 px-3 py-2`,children:[(0,F.jsx)(`span`,{className:`relative inline-flex shrink-0 w-9 h-5 items-center rounded-full ${e.on?`bg-accent`:`bg-neutral-300 dark:bg-neutral-700`}`,children:(0,F.jsx)(`span`,{className:`inline-block w-4 h-4 rounded-full bg-white shadow-sm transform ${e.on?`translate-x-[18px]`:`translate-x-0.5`}`})}),(0,F.jsx)(`span`,{className:`text-[12px] font-medium text-neutral-800 dark:text-neutral-100 flex-1 min-w-0 truncate`,children:e.label}),e.stat&&(0,F.jsx)(`span`,{className:`text-[11px] font-medium tabular-nums ${t}`,children:e.stat})]},n))})}function Bn({mock:e,accent:t}){let n=e.bars??[];return(0,F.jsxs)(`div`,{className:`flex items-end gap-4`,children:[e.headline&&(0,F.jsxs)(`div`,{className:`shrink-0`,children:[(0,F.jsx)(`div`,{className:`text-[26px] font-bold leading-none tabular-nums ${t}`,children:e.headline}),e.headlineNote&&(0,F.jsx)(`div`,{className:`text-[10px] text-neutral-500 dark:text-neutral-400 mt-1 max-w-[130px] leading-snug`,children:e.headlineNote})]}),(0,F.jsx)(`div`,{className:`flex-1 flex items-end justify-around gap-2 h-[64px]`,children:n.map((e,t)=>(0,F.jsxs)(`div`,{className:`flex flex-col items-center gap-1 flex-1 h-full justify-end`,children:[(0,F.jsx)(`div`,{className:`w-full rounded-t ${t===n.length-1?`bg-accent`:`bg-neutral-300 dark:bg-neutral-700`}`,style:{height:`${Math.max(6,e.value)}%`}}),(0,F.jsx)(`span`,{className:`text-[9px] text-neutral-500 dark:text-neutral-400 truncate max-w-full`,children:e.label})]},t))})]})}function Vn({mock:e}){return(0,F.jsx)(`div`,{className:`font-mono text-[11px] leading-relaxed text-neutral-600 dark:text-neutral-300 space-y-0.5 overflow-x-auto`,children:(e.code??[]).map((e,t)=>(0,F.jsx)(`div`,{className:`whitespace-pre`,children:e},t))})}function Hn({mock:e,accent:t}){let n=e.badges??[];return(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,F.jsx)(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:n.map((e,t)=>{let r=t===n.length-1;return(0,F.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,F.jsx)(`span`,{className:`rounded-md border px-2 py-1 text-[11px] font-semibold ${r?`border-accent/40 bg-accent/10 text-accent`:`border-neutral-200 dark:border-neutral-700 bg-white dark:bg-neutral-900 text-neutral-500 dark:text-neutral-400`}`,children:e}),!r&&(0,F.jsx)(`span`,{className:`text-neutral-300 dark:text-neutral-600 text-[11px]`,children:`→`})]},t)})}),e.headline&&(0,F.jsxs)(`div`,{className:`text-right shrink-0`,children:[(0,F.jsx)(`div`,{className:`text-[22px] font-bold leading-none tabular-nums ${t}`,children:e.headline}),e.headlineNote&&(0,F.jsx)(`div`,{className:`text-[10px] text-neutral-500 dark:text-neutral-400 mt-1 max-w-[130px] leading-snug`,children:e.headlineNote})]})]})}function Un({demo:e,children:t}){return On()?(0,F.jsx)(F.Fragment,{children:t}):(0,F.jsx)(Ln,{id:e})}var Wn=[{key:`lcp`,label:`LCP`,unit:`ms`},{key:`tbt`,label:`TBT`,unit:`ms`},{key:`cls`,label:`CLS`,unit:`raw`},{key:`ttfb`,label:`TTFB`,unit:`ms`}];function Gn(e,t,n){let r=n[e];return t==null||!r?`unknown`:t<=r.good?`good`:t<=r.poor?`needs-improvement`:`poor`}var Kn={good:`border-emerald-200 dark:border-emerald-900/60 bg-emerald-50 dark:bg-emerald-950/40 text-emerald-800 dark:text-emerald-200`,"needs-improvement":`border-amber-200 dark:border-amber-900/60 bg-amber-50 dark:bg-amber-950/40 text-amber-800 dark:text-amber-200`,poor:`border-red-200 dark:border-red-900/60 bg-red-50 dark:bg-red-950/40 text-red-800 dark:text-red-200`,unknown:`border-neutral-200 dark:border-neutral-800 bg-neutral-50 dark:bg-neutral-900 text-neutral-500 dark:text-neutral-400`};function qn(e){return e===null?`text-neutral-400 dark:text-neutral-500`:e>=90?`text-emerald-600 dark:text-emerald-400`:e>=50?`text-amber-600 dark:text-amber-400`:`text-red-600 dark:text-red-400`}function Jn(e,t){return e==null?`—`:t===`raw`?e.toFixed(3):`${Math.round(e)} ms`}function Yn(e){let t=Math.floor(Date.now()/1e3)-e;return t<60?L(`just now`):t<3600?`${Math.floor(t/60)}m ${L(`ago`)}`:t<86400?`${Math.floor(t/3600)}h ${L(`ago`)}`:`${Math.floor(t/86400)}d ${L(`ago`)}`}function Xn({module:e,onSaved:t}){let[n,r]=(0,y.useState)(null),[i,a]=(0,y.useState)(!1),[o,s]=(0,y.useState)(!1),[c,l]=(0,y.useState)(null),u=(0,y.useRef)(null),d=e.settings?.enabled===!0,f=(0,y.useCallback)(async()=>{try{r(await V.request(`/score/history`))}catch{r({runs:[],latest:null,thresholds:{}})}},[]);(0,y.useEffect)(()=>{f()},[f]);let p=(0,y.useCallback)(async()=>{try{if(!(await V.request(`/score/status`)).pending){s(!1),await f();return}u.current=window.setTimeout(()=>void p(),6e3)}catch(e){s(!1),l(e instanceof Error?e.message:L(`Could not check the test status.`))}},[f]);(0,y.useEffect)(()=>()=>{u.current&&window.clearTimeout(u.current)},[]);let m=async()=>{a(!0),l(null);try{let e=await V.request(`/score/run`,{method:`POST`,body:JSON.stringify({})});e.pending?(s(!0),u.current=window.setTimeout(()=>void p(),6e3)):(await f(),!e.ok&&e.error&&l(e.error))}catch(e){l(e instanceof Error?e.message:L(`The test could not be started.`))}finally{a(!1)}},h=n?.latest??null,g=n?.thresholds??{};return(0,F.jsxs)(`div`,{className:`space-y-4`,children:[(0,F.jsxs)(`div`,{className:`border border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 rounded-lg p-4 sm:p-5`,children:[(0,F.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,F.jsx)(ge,{size:18,className:`text-accent shrink-0`}),(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsx)(`div`,{className:`font-medium text-neutral-900 dark:text-neutral-50`,children:L(`External score`)}),(0,F.jsx)(`div`,{className:`text-[12px] text-neutral-500 dark:text-neutral-400`,children:h?`${h.provider===`gtmetrix`?`GTmetrix`:`PageSpeed Insights`} · ${Yn(h.ts)}`:L(`No audit run yet.`)})]})]}),(0,F.jsxs)(`button`,{type:`button`,onClick:m,disabled:!d||i||o,title:d?void 0:L(`Turn on external scores below first.`),className:`flex items-center gap-1.5 text-[13px] px-3 py-1.5 rounded bg-accent text-white hover:bg-blue-700 transition-colors disabled:opacity-50`,children:[(i||o)&&(0,F.jsx)(P,{size:13,className:`animate-spin`}),L(o?`Running…`:`Test now`)]})]}),!d&&(0,F.jsx)(`p`,{className:`mt-3 text-[12px] text-neutral-500 dark:text-neutral-400`,children:L(`External scores are off. Turning them on lets you run an audit from here — nothing is sent anywhere until you press Test.`)}),c&&(0,F.jsxs)(`div`,{className:`mt-3 flex items-start gap-2 text-[12px] text-red-700 dark:text-red-300`,children:[(0,F.jsx)(ot,{size:13,className:`mt-0.5 shrink-0`}),(0,F.jsx)(`span`,{children:c})]}),h&&(0,F.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-5`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`text-[34px] font-semibold leading-none ${qn(h.score)}`,children:h.score===null?`—`:h.score}),(0,F.jsxs)(`div`,{className:`text-[11px] uppercase tracking-wider text-neutral-500 dark:text-neutral-400 mt-1`,children:[L(`Performance`),h.strategy?` · ${h.strategy}`:``]})]}),(0,F.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:Wn.map(e=>{let t=h.metrics?.[e.key]??null,n=Gn(e.key,t,g);return(0,F.jsxs)(`div`,{className:`rounded border px-2.5 py-1.5 ${Kn[n]}`,title:n===`unknown`?L(`Not reported by this provider.`):n,children:[(0,F.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider opacity-80`,children:e.label}),(0,F.jsx)(`div`,{className:`text-[13px] font-medium tabular-nums`,children:Jn(t,e.unit)})]},e.key)})})]}),h?.issues&&h.issues.length>0&&(0,F.jsx)(`ul`,{className:`mt-4 space-y-1`,children:h.issues.slice(0,3).map(e=>(0,F.jsxs)(`li`,{className:`flex items-baseline justify-between gap-3 text-[12px] text-neutral-700 dark:text-neutral-300`,children:[(0,F.jsx)(`span`,{className:`min-w-0 truncate`,children:e.title}),(0,F.jsxs)(`span`,{className:`tabular-nums text-neutral-500 dark:text-neutral-400 shrink-0`,children:[`−`,Math.round(e.savings_ms),` ms`]})]},e.id))})]}),n&&n.runs.length>1&&(0,F.jsxs)(`div`,{className:`border border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 rounded-lg p-4 sm:p-5`,children:[(0,F.jsx)(`div`,{className:`text-[12px] font-medium text-neutral-900 dark:text-neutral-50 mb-2`,children:L(`Run history`)}),(0,F.jsx)(`ul`,{className:`space-y-1`,children:n.runs.slice(0,10).map((e,t)=>(0,F.jsxs)(`li`,{className:`flex items-baseline gap-3 text-[12px] border-t border-neutral-100 dark:border-neutral-800 first:border-t-0 pt-1.5 first:pt-0`,children:[(0,F.jsx)(`span`,{className:`w-16 shrink-0 text-[11px] text-neutral-500 dark:text-neutral-400`,children:Yn(e.ts)}),(0,F.jsx)(`span`,{className:`w-10 shrink-0 tabular-nums font-medium ${qn(e.score)}`,children:e.ok?e.score??`—`:`—`}),(0,F.jsx)(`span`,{className:`min-w-0 truncate text-neutral-600 dark:text-neutral-400`,children:e.ok?e.url:e.error}),e.ok&&e.url&&(0,F.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`shrink-0 text-neutral-400 dark:text-neutral-500 hover:text-neutral-600 dark:hover:text-neutral-300`,"aria-label":L(`Open the tested page`),children:(0,F.jsx)(ue,{size:11})})]},`${e.ts}-${t}`))})]}),(0,F.jsx)(wi,{module:e,onSaved:t})]})}var Zn=[{key:`cache`,label:`Overview`},{key:`visitors`,label:`Visitors`,locked:!0},{key:`pagespeed`,label:`PageSpeed`}],Qn=`cache`,$n=new Set(Zn.map(e=>e.key));function er({module:e,onSaved:t,subtab:n,onSubtabChange:r,getModule:i}){let a=H(),o=a===`pro`||a===`trial`,s=Zn.map(e=>({...e,locked:e.locked&&!o})),c=n&&$n.has(n)?n:Qn,l=i?.(`score`);return(0,y.useEffect)(()=>{n&&!$n.has(n)&&r?.(Qn)},[n,r]),(0,F.jsxs)(`div`,{className:`space-y-5`,children:[(0,F.jsx)(U,{panel:`RecommendationsPanel`,slug:`recommendations`,getModule:i,onSaved:t}),(0,F.jsx)(Cn,{items:s,value:c,onChange:e=>r?.(e),idBase:`health`}),c===`cache`&&(0,F.jsxs)(`div`,{className:`space-y-5`,children:[(0,F.jsx)(yn,{module:e}),(0,F.jsx)(U,{panel:`AnalyticsPanel`,slug:`analytics`,getModule:i,onSaved:t})]}),c===`visitors`&&(0,F.jsx)(Un,{demo:`health-visitors`,children:(0,F.jsx)(`div`,{className:`space-y-5`,children:(0,F.jsx)(U,{panel:`RumPanel`,slug:`rum`,getModule:i,onSaved:t})})}),c===`pagespeed`&&(0,F.jsxs)(`div`,{className:`space-y-5`,children:[l&&(0,F.jsx)(Xn,{module:l,onSaved:t}),(0,F.jsx)(U,{panel:`PageSpeedPanel`,slug:`pagespeed`,getModule:i,onSaved:t}),(0,F.jsx)(U,{panel:`PerformanceHealthPanel`,slug:`performance-health`,getModule:i,onSaved:t})]})]})}function tr({state:e}){let[t,n]=(0,y.useState)(null),r=(0,y.useRef)(`saving`);if((e===`saving`||e===`saved`)&&(r.current=e),(0,y.useEffect)(()=>{if(typeof document>`u`)return;let e=document.getElementById(`xspeed-toast-host`);if(!e){let t=document.getElementById(`xspeed-app`);if(!t)return;e=document.createElement(`div`),e.id=`xspeed-toast-host`,t.appendChild(e)}n(e)},[]),!t)return null;let i=e!==`idle`,a=e===`saved`||e===`idle`&&r.current===`saved`;return(0,gt.createPortal)((0,F.jsx)(`div`,{"aria-hidden":!i,className:`fixed bottom-6 left-1/2 -translate-x-1/2 z-50 pointer-events-none transition-opacity duration-150 ${i?`opacity-100`:`opacity-0`}`,children:(0,F.jsx)(`div`,{className:`flex items-center gap-2 px-4 py-2 rounded-full border shadow-md text-[12px] font-medium ${a?`bg-emerald-50 dark:bg-emerald-950/60 border-emerald-200 dark:border-emerald-800 text-emerald-700 dark:text-emerald-300`:`bg-white dark:bg-neutral-900 border-neutral-200 dark:border-neutral-700 text-neutral-600 dark:text-neutral-300`}`,children:a?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(D,{size:14,className:`text-emerald-600 dark:text-emerald-400`}),(0,F.jsx)(`span`,{children:L(`Settings saved`)})]}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(je,{size:13,className:`animate-spin text-neutral-400 dark:text-neutral-500`}),(0,F.jsx)(`span`,{children:L(`Saving changes…`)})]})})}),t)}var nr=1500;function rr({saving:e}){let[t,n]=(0,y.useState)(`idle`),r=(0,y.useRef)(`idle`),i=(0,y.useRef)(!1),a=(0,y.useRef)(null);return(0,y.useEffect)(()=>{r.current=t},[t]),(0,y.useEffect)(()=>{if(e){r.current!==`saved`&&(a.current&&=(window.clearTimeout(a.current),null),n(`saving`)),i.current=!0;return}i.current&&(i.current=!1,n(`saved`),a.current&&window.clearTimeout(a.current),a.current=window.setTimeout(()=>{n(`idle`),a.current=null},nr))},[e]),(0,y.useEffect)(()=>()=>{a.current&&window.clearTimeout(a.current)},[]),(0,F.jsx)(tr,{state:t})}function ir(e,t,n){let r={...t},i=!1,a=new Set([...Object.keys(t),...Object.keys(n),...Object.keys(e)]);for(let o of a)ar(n[o],e[o])?Object.prototype.hasOwnProperty.call(t,o)?r[o]=t[o]:r[o]=n[o]:(r[o]=n[o],i=!0);return{next:r,dirty:i}}function ar(e,t){if(e===t)return!0;if(e===null||t===null||e===void 0||t===void 0||typeof e!=`object`||typeof t!=`object`)return!1;try{return JSON.stringify(e)===JSON.stringify(t)}catch{return!1}}var or=4e3;function sr({module:e,onSaved:t}){let[n,r]=(0,y.useState)(e.settings),[i,a]=(0,y.useState)(null),[o,s]=(0,y.useState)(!1),[c,l]=(0,y.useState)(null),[u,d]=(0,y.useState)(null),f=(0,y.useRef)(null),p=(0,y.useRef)(!0),m=(0,y.useRef)(JSON.stringify(e.settings)),h=(0,y.useRef)(n);(0,y.useEffect)(()=>{h.current=n},[n]),(0,y.useEffect)(()=>{let e=!1,t=async()=>{try{let t=await V.request(`/preloader/status`);e||a(t)}catch{}};t();let n=window.setInterval(()=>{i?.running&&t()},or);return()=>{e=!0,window.clearInterval(n)}},[i?.running]),(0,y.useEffect)(()=>{if(p.current){p.current=!1;return}if(JSON.stringify(n)!==m.current)return f.current&&window.clearTimeout(f.current),f.current=window.setTimeout(async()=>{s(!0);let i=n;try{let{next:n,dirty:a}=ir(i,await V.updateModuleSettings(e.slug,i),h.current);r(n),m.current=a?``:JSON.stringify(n),t?.(n)}catch(e){l(e instanceof Error?e.message:`Save failed`)}finally{s(!1)}},600),()=>{f.current&&window.clearTimeout(f.current)}},[n,e.slug]);let g=(e,t)=>r(n=>({...n,[e]:t})),_=(0,y.useMemo)(()=>Object.entries(e.schema),[e.schema]);return(0,F.jsxs)(`div`,{className:`space-y-4`,children:[(0,F.jsx)(cr,{state:i,enabled:!!n.enabled,percent:i&&i.total>0?Math.round(i.processed/i.total*100):0,actioning:u,onStart:async()=>{d(`start`),l(null);try{a(await V.request(`/preloader/start`,{method:`POST`}))}catch(e){l(e instanceof Error?e.message:`Failed to start`)}finally{d(null)}},onStop:async()=>{d(`stop`);try{a(await V.request(`/preloader/stop`,{method:`POST`}))}catch(e){l(e instanceof Error?e.message:`Failed to stop`)}finally{d(null)}}}),c&&(0,F.jsx)(z,{tone:`danger`,title:`Preloader error`,body:c}),(0,F.jsx)(`div`,{className:`border border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 rounded-lg overflow-hidden`,children:_.map(([e,t],r)=>(0,F.jsx)(lr,{fieldKey:e,spec:t,value:n[e],onChange:t=>g(e,t),first:r===0},e))}),(0,F.jsx)(rr,{saving:o})]})}function cr({state:e,enabled:t,percent:n,actioning:r,onStart:i,onStop:a}){let o=!!e?.running,s=!!(e&&(e.total>0||e.finished_at>0));return(0,F.jsxs)(`div`,{className:`border border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 rounded-lg p-4 sm:p-5`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-4 mb-3`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,F.jsx)(`span`,{className:`w-2 h-2 rounded-full shrink-0 ${o?`bg-accent animate-pulse`:t?`bg-emerald-500`:`bg-neutral-300 dark:bg-neutral-600`}`}),(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsx)(`div`,{className:`font-medium text-neutral-900 dark:text-neutral-50`,children:o?`Crawling…`:t?`Ready`:`Disabled`}),(0,F.jsx)(`div`,{className:`text-[12px] text-neutral-500 dark:text-neutral-400`,children:e?s?`${e.processed} / ${e.total} URLs warmed${e.errors.length>0?` · ${e.errors.length} error${e.errors.length===1?``:`s`}`:``}`:t?`No crawl yet. Hit "Start now" to warm the cache.`:`Enable below, then start a crawl.`:`Loading…`})]})]}),(0,F.jsx)(`div`,{className:`flex items-center gap-2 shrink-0`,children:o?(0,F.jsxs)(`button`,{type:`button`,onClick:a,disabled:r!==null,className:`flex items-center gap-1.5 text-[13px] px-3 py-1.5 rounded border border-neutral-200 dark:border-neutral-700 text-neutral-700 dark:text-neutral-300 hover:bg-neutral-50 dark:hover:bg-neutral-800 transition-colors disabled:opacity-50`,children:[(0,F.jsx)($e,{size:13}),`Stop`]}):(0,F.jsxs)(`button`,{type:`button`,onClick:i,disabled:!t||r!==null,className:`flex items-center gap-1.5 text-[13px] px-3 py-1.5 rounded bg-accent text-white hover:bg-blue-700 transition-colors disabled:opacity-40 disabled:cursor-not-allowed`,children:[r===`start`?(0,F.jsx)(P,{size:13,className:`animate-spin`}):(0,F.jsx)(Ie,{size:13}),`Start now`]})})]}),(o||s)&&e&&e.total>0&&(0,F.jsxs)(`div`,{className:`mt-3`,children:[(0,F.jsx)(`div`,{className:`h-1.5 w-full bg-neutral-100 dark:bg-neutral-800 rounded-full overflow-hidden`,children:(0,F.jsx)(`div`,{className:`h-full bg-accent transition-all duration-300`,style:{width:`${n}%`}})}),e.last_url&&(0,F.jsxs)(`div`,{className:`mt-2 text-[11px] text-neutral-500 dark:text-neutral-400 font-mono truncate`,children:[`Last: `,e.last_url]})]})]})}function lr({fieldKey:e,spec:t,value:n,onChange:r,first:i}){let a=t.label??e;return(0,F.jsxs)(`div`,{className:`px-4 sm:px-5 py-4 flex items-center justify-between gap-3 sm:gap-4 ${i?``:`border-t border-neutral-200 dark:border-neutral-800`}`,children:[(0,F.jsxs)(`div`,{className:`min-w-0 pr-2`,children:[(0,F.jsx)(`div`,{className:`font-medium text-neutral-900 dark:text-neutral-50`,children:a}),t.description&&(0,F.jsx)(`div`,{className:`text-[12px] text-neutral-500 dark:text-neutral-400 mt-0.5`,children:t.description})]}),(0,F.jsx)(`div`,{className:`shrink-0`,children:ur(t,n,r,a)})]})}function ur(e,t,n,r){switch(e.type){case`bool`:return(0,F.jsx)(an,{checked:!!t,onChange:n,label:r});case`int`:return(0,F.jsx)(`input`,{type:`number`,min:e.min,max:e.max,value:t==null?``:Number(t),onChange:e=>n(Number(e.target.value)),className:`w-20 text-right`,"aria-label":r});case`enum`:return(0,F.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:(e.options??[]).map(r=>{let i=t===r,a=e.option_labels?.[r]??r;return(0,F.jsx)(`button`,{type:`button`,onClick:()=>n(r),className:`text-[12px] px-2.5 py-1 rounded border transition-colors ${i?`bg-accent border-accent text-white`:`border-neutral-200 dark:border-neutral-700 text-neutral-700 dark:text-neutral-300 hover:bg-neutral-50 dark:hover:bg-neutral-800`}`,children:a},r)})});case`string`:case`url`:return(0,F.jsx)(`input`,{type:e.type===`url`?`url`:`text`,value:t==null?``:String(t),onChange:e=>n(e.target.value),className:`w-56`,"aria-label":r});default:return null}}var dr={...Object.fromEntries(It.map(e=>[e.slug,e.label])),fonts:`Fonts`};function fr(e,t){let{module:n,getModule:r,isPro:i,subtab:a}=t,o=(0,y.useMemo)(()=>e.map(e=>{let t;return t=e.self?n.tab_label??n.label??e.slug:r?.(e.slug)?.label??dr[e.slug]??e.slug,{key:e.key,label:t,locked:!!e.pro&&!i}}),[e,n,r,i]);return{items:o,active:a&&o.some(e=>e.key===a)?a:e[0]?.key??``}}var pr=[{key:`manual`,slug:`preloader`,self:!0},{key:`scheduled`,slug:`prewarm-schedule`,panel:`PrewarmSchedulePanel`,pro:!0},{key:`predictive`,slug:`predictive-warm`,panel:`PredictiveWarmPanel`,pro:!0}];function mr({module:e,onSaved:t,subtab:n,onSubtabChange:r,getModule:i}){let a=H(),{items:o,active:s}=fr(pr,{module:e,getModule:i,isPro:a===`pro`||a===`trial`,subtab:n});return(0,y.useEffect)(()=>{n&&!o.some(e=>e.key===n)&&r?.(pr[0].key)},[n,o,r]),(0,F.jsxs)(`div`,{className:`space-y-5`,children:[(0,F.jsx)(Cn,{items:o,value:s,onChange:e=>r?.(e),idBase:`preloader`}),s===`manual`&&(0,F.jsx)(sr,{module:e,onSaved:t}),s===`scheduled`&&(0,F.jsx)(Un,{demo:`preloader-scheduled`,children:(0,F.jsx)(U,{panel:`PrewarmSchedulePanel`,slug:`prewarm-schedule`,getModule:i,onSaved:t})}),s===`predictive`&&(0,F.jsx)(Un,{demo:`preloader-predictive`,children:(0,F.jsx)(U,{panel:`PredictiveWarmPanel`,slug:`predictive-warm`,getModule:i,onSaved:t})})]})}function hr({id:e}){if(H()!==`free`)return null;let t=jn[e];return t?(0,F.jsxs)(`div`,{className:`relative overflow-hidden border border-amber-200 dark:border-amber-900/60 bg-gradient-to-br from-amber-50 to-white dark:from-amber-950/30 dark:to-neutral-900 rounded-lg p-4 sm:p-5`,children:[(0,F.jsxs)(`div`,{className:`absolute top-3 right-3 flex items-center gap-1 text-[10px] uppercase tracking-wider font-medium text-amber-700 dark:text-amber-300`,children:[(0,F.jsx)(se,{size:11}),(0,F.jsx)(`span`,{children:L(`Pro`)})]}),(0,F.jsxs)(`div`,{className:`flex items-start gap-3 pr-12`,children:[(0,F.jsx)(`span`,{className:`shrink-0 mt-0.5 text-amber-600 dark:text-amber-400`,children:(0,F.jsx)(yt,{name:t.icon,size:18})}),(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsx)(`div`,{className:`text-[14px] font-medium text-neutral-900 dark:text-neutral-50`,children:t.title}),(0,F.jsx)(`p`,{className:`text-[12px] text-neutral-600 dark:text-neutral-300 mt-1 leading-relaxed`,children:t.body}),(0,F.jsxs)(`a`,{href:An,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 mt-2.5 text-[12px] font-medium text-amber-700 dark:text-amber-300 hover:text-amber-800 dark:hover:text-amber-200 transition-colors`,children:[t.cta??L(`Learn more about Pro`),(0,F.jsx)(C,{size:12})]})]})]})]}):(typeof console<`u`&&console.warn(`[xSpeed] Unknown ProTeaser id: "${String(e)}"`),null)}function gr({module:e,onSaved:t}){let[n,r]=(0,y.useState)(e.settings),[i,a]=(0,y.useState)(null),[o,s]=(0,y.useState)({}),[c,l]=(0,y.useState)({}),[u,d]=(0,y.useState)(null),[f,p]=(0,y.useState)(null),[m,h]=(0,y.useState)(null),[g,_]=(0,y.useState)(!1),v=(0,y.useRef)(null),b=(0,y.useRef)(!0),x=(0,y.useRef)(JSON.stringify(e.settings)),S=(0,y.useRef)(n);(0,y.useEffect)(()=>{S.current=n},[n]);let C=async()=>{d(`scan`),p(null);try{let e=await V.request(`/database/scan`);a(e.scan),s(e.labels)}catch(e){p(e instanceof Error?e.message:`Scan failed`)}finally{d(null)}};(0,y.useEffect)(()=>{C()},[]),(0,y.useEffect)(()=>{if(b.current){b.current=!1;return}if(JSON.stringify(n)!==x.current)return v.current&&window.clearTimeout(v.current),v.current=window.setTimeout(async()=>{_(!0);let i=n;try{let{next:n,dirty:a}=ir(i,await V.updateModuleSettings(e.slug,i),S.current);r(n),x.current=a?``:JSON.stringify(n),t?.(n)}catch(e){p(e instanceof Error?e.message:`Save failed`)}finally{_(!1)}},600),()=>{v.current&&window.clearTimeout(v.current)}},[n,e.slug]);let w=(e,t)=>r(n=>({...n,[e]:t})),T=(0,y.useMemo)(()=>Object.keys(c).filter(e=>c[e]&&(i?.[e]?.count??0)>0),[c,i]),E=(0,y.useMemo)(()=>T.reduce((e,t)=>e+(i?.[t]?.count??0),0),[T,i]),ee=e=>l(t=>({...t,[e]:!t[e]})),te=()=>{if(!i)return;let e={};Object.entries(i).forEach(([t,n])=>{n.count>0&&(e[t]=!0)}),l(e)},D=()=>l({}),ne=async()=>{if(T.length!==0){d(`clean`),p(null),h(null);try{let e=await V.request(`/database/clean`,{method:`POST`,body:JSON.stringify({types:T})});a(e.scan);let t=Object.values(e.cleaned).reduce((e,t)=>e+t,0);h(`Removed ${t.toLocaleString()} row${t===1?``:`s`}.`),l({})}catch(e){p(e instanceof Error?e.message:`Cleanup failed`)}finally{d(null)}}},re=async()=>{d(`optimize`),p(null),h(null);try{let e=await V.request(`/database/optimize`,{method:`POST`}),t=Object.keys(e.optimized).length;h(`Optimized ${t} table${t===1?``:`s`}.`)}catch(e){p(e instanceof Error?e.message:`Optimize failed`)}finally{d(null)}},O=(0,y.useMemo)(()=>Object.entries(e.schema),[e.schema]),k=i?Object.entries(i):[],A=k.reduce((e,[,t])=>e+t.count,0);return(0,F.jsxs)(`div`,{className:`space-y-4`,children:[(0,F.jsxs)(`div`,{className:`border border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 rounded-lg p-4 sm:p-5`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-4 mb-4`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,F.jsx)(ce,{size:18,className:`text-accent shrink-0`}),(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsx)(`div`,{className:`font-medium text-neutral-900 dark:text-neutral-50`,children:`Database bloat`}),(0,F.jsx)(`div`,{className:`text-[12px] text-neutral-500 dark:text-neutral-400`,children:i?A===0?`Nothing to clean — your database is tidy.`:`${A.toLocaleString()} row${A===1?``:`s`} across ${k.filter(([,e])=>e.count>0).length} categor${k.filter(([,e])=>e.count>0).length===1?`y`:`ies`}`:`Scanning…`})]})]}),(0,F.jsx)(`div`,{className:`flex items-center gap-2 shrink-0`,children:(0,F.jsxs)(`button`,{type:`button`,onClick:C,disabled:u!==null,className:`flex items-center gap-1.5 text-[13px] px-3 py-1.5 rounded border border-neutral-200 dark:border-neutral-700 text-neutral-700 dark:text-neutral-300 hover:bg-neutral-50 dark:hover:bg-neutral-800 transition-colors disabled:opacity-50`,children:[(0,F.jsx)(P,{size:13,className:u===`scan`?`animate-spin`:``}),`Rescan`]})})]}),k.length>0&&(0,F.jsx)(`div`,{className:`border border-neutral-200 dark:border-neutral-800 rounded overflow-hidden`,children:k.map(([e,t],n)=>{let r=!!c[e],i=t.count===0;return(0,F.jsxs)(`label`,{className:`flex items-center justify-between gap-3 px-3 py-2.5 cursor-pointer ${n===0?``:`border-t border-neutral-200 dark:border-neutral-800`} ${i?`opacity-50 cursor-not-allowed`:`hover:bg-neutral-50 dark:hover:bg-neutral-800/40`}`,children:[(0,F.jsxs)(`span`,{className:`flex items-center gap-2.5 min-w-0`,children:[(0,F.jsx)(`input`,{type:`checkbox`,checked:r,disabled:i,onChange:()=>ee(e),className:`accent-accent`}),(0,F.jsx)(`span`,{className:`text-[13px] text-neutral-800 dark:text-neutral-200 truncate`,children:o[e]??t.label})]}),(0,F.jsx)(`span`,{className:`text-[12px] tabular-nums text-neutral-500 dark:text-neutral-400 shrink-0`,children:t.count.toLocaleString()})]},e)})}),(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 mt-3`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2 text-[12px]`,children:[(0,F.jsx)(`button`,{type:`button`,onClick:te,className:`text-accent hover:underline`,disabled:!i||A===0,children:`Select all`}),(0,F.jsx)(`span`,{className:`text-neutral-300 dark:text-neutral-700`,children:`·`}),(0,F.jsx)(`button`,{type:`button`,onClick:D,className:`text-neutral-500 hover:underline`,disabled:T.length===0,children:`Clear`})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsxs)(`button`,{type:`button`,onClick:re,disabled:u!==null,className:`flex items-center gap-1.5 text-[13px] px-3 py-1.5 rounded border border-neutral-200 dark:border-neutral-700 text-neutral-700 dark:text-neutral-300 hover:bg-neutral-50 dark:hover:bg-neutral-800 transition-colors disabled:opacity-50`,children:[(0,F.jsx)(pt,{size:13,className:u===`optimize`?`animate-pulse`:``}),`Optimize tables`]}),(0,F.jsxs)(`button`,{type:`button`,onClick:ne,disabled:u!==null||T.length===0,className:`flex items-center gap-1.5 text-[13px] px-3 py-1.5 rounded bg-accent text-white hover:bg-blue-700 transition-colors disabled:opacity-40 disabled:cursor-not-allowed`,children:[u===`clean`?(0,F.jsx)(P,{size:13,className:`animate-spin`}):(0,F.jsx)(it,{size:13}),`Clean selected`,E>0?` (${E.toLocaleString()})`:``]})]})]})]}),f&&(0,F.jsx)(z,{tone:`danger`,title:`Database error`,body:f}),m&&!f&&(0,F.jsx)(z,{tone:`success`,title:`Done`,body:m}),O.length>0&&(0,F.jsx)(`div`,{className:`border border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 rounded-lg overflow-hidden`,children:O.map(([e,t],r)=>(0,F.jsx)(_r,{fieldKey:e,spec:t,value:n[e],labels:o,onChange:t=>w(e,t),first:r===0},e))}),(0,F.jsx)(rr,{saving:g}),(0,F.jsx)(hr,{id:`migration`})]})}function _r({fieldKey:e,spec:t,value:n,labels:r,onChange:i,first:a}){let o=t.label??e,s=e===`included_types`;return(0,F.jsxs)(`div`,{className:`px-4 sm:px-5 py-4 ${a?``:`border-t border-neutral-200 dark:border-neutral-800`}`,children:[(0,F.jsxs)(`div`,{className:`flex items-start justify-between gap-3 sm:gap-4`,children:[(0,F.jsxs)(`div`,{className:`min-w-0 pr-2`,children:[(0,F.jsx)(`div`,{className:`font-medium text-neutral-900 dark:text-neutral-50`,children:o}),t.description&&(0,F.jsx)(`div`,{className:`text-[12px] text-neutral-500 dark:text-neutral-400 mt-0.5`,children:t.description})]}),!s&&(0,F.jsx)(`div`,{className:`shrink-0`,children:yr(t,n,i,o)})]}),s&&Object.keys(r).length>0&&(0,F.jsx)(vr,{value:Array.isArray(n)?n:[],labels:r,onChange:i})]})}function vr({value:e,labels:t,onChange:n}){let r=t=>{n(e.includes(t)?e.filter(e=>e!==t):[...e,t])};return(0,F.jsx)(`div`,{className:`flex flex-wrap gap-1.5 mt-3`,children:Object.entries(t).map(([t,n])=>(0,F.jsx)(`button`,{type:`button`,onClick:()=>r(t),className:`text-[12px] px-2.5 py-1 rounded border transition-colors ${e.includes(t)?`bg-accent border-accent text-white`:`border-neutral-200 dark:border-neutral-700 text-neutral-700 dark:text-neutral-300 hover:bg-neutral-50 dark:hover:bg-neutral-800`}`,children:n},t))})}function yr(e,t,n,r){switch(e.type){case`bool`:return(0,F.jsx)(an,{checked:!!t,onChange:n,label:r});case`enum`:return(0,F.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:(e.options??[]).map(r=>{let i=t===r,a=e.option_labels?.[r]??r;return(0,F.jsx)(`button`,{type:`button`,onClick:()=>n(r),className:`text-[12px] px-2.5 py-1 rounded border transition-colors ${i?`bg-accent border-accent text-white`:`border-neutral-200 dark:border-neutral-700 text-neutral-700 dark:text-neutral-300 hover:bg-neutral-50 dark:hover:bg-neutral-800`}`,children:a},r)})});default:return null}}function br(e,t,n){return e.dependsOn?xr(e.dependsOn,t,n,new Set):!0}function xr(e,t,n,r){if(`all`in e)return e.all.every(e=>xr(e,t,n,r));if(`any`in e)return e.any.some(e=>xr(e,t,n,r));if(r.has(e.field))return!0;let i=n[e.field];if(i?.dependsOn){let a=new Set(r);if(a.add(e.field),!xr(i.dependsOn,t,n,a))return!1}let a=t[e.field];return Object.prototype.hasOwnProperty.call(e,`value`)?a===e.value:!!a}function Sr(e,t,n){return(0,y.useMemo)(()=>Object.entries(e).filter(([r,i])=>br(i,t,e)&&(n?n(r,i):!0)),[e,t])}function Cr({module:e,onSaved:t,getModule:n}){let[r,i]=(0,y.useState)(e.settings),[a,o]=(0,y.useState)(null),[s,c]=(0,y.useState)(null),[l,u]=(0,y.useState)(null),[d,f]=(0,y.useState)(null),[p,m]=(0,y.useState)(!1),h=(0,y.useRef)(null),g=(0,y.useRef)(!0),_=(0,y.useRef)(JSON.stringify(e.settings)),v=(0,y.useRef)(r);(0,y.useEffect)(()=>{v.current=r},[r]),(0,y.useEffect)(()=>{if(g.current){g.current=!1;return}if(JSON.stringify(r)!==_.current)return h.current&&window.clearTimeout(h.current),h.current=window.setTimeout(async()=>{m(!0);let n=r;try{let{next:r,dirty:a}=ir(n,await V.updateModuleSettings(e.slug,n),v.current);i(r),_.current=a?``:JSON.stringify(r),t?.(r)}catch(e){u(e instanceof Error?e.message:`Save failed`)}finally{m(!1)}},600),()=>{h.current&&window.clearTimeout(h.current)}},[r,e.slug]);let b=(e,t)=>i(n=>({...n,[e]:t})),x=async(e,t,n=`POST`,r)=>{c(e),u(null),f(null);try{let i=await V.request(t,{method:n,body:r?JSON.stringify(r):void 0});t===`/cloudflare/verify`&&o(i),i.ok?f(`Cloudflare: ${wr(e)} succeeded.`):u(i.body?.message||`Cloudflare API returned HTTP ${i.status}.`)}catch(e){u(e instanceof Error?e.message:`Request failed`)}finally{c(null)}},S=String(r.auth_method??`token`),C=Sr(e.schema,r,e=>!(S===`token`&&(e===`email`||e===`api_key`)||S===`key`&&e===`api_token`));return(0,F.jsxs)(`div`,{className:`space-y-4`,children:[(0,F.jsxs)(`div`,{className:`border border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 rounded-lg p-4 sm:p-5`,children:[(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[a?.ok?(0,F.jsx)(ie,{size:18,className:`text-emerald-500 shrink-0`}):a?(0,F.jsx)(j,{size:18,className:`text-rose-500 shrink-0`}):(0,F.jsx)(`span`,{className:`w-2 h-2 rounded-full bg-neutral-300 dark:bg-neutral-600 shrink-0 ml-2`}),(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsx)(`div`,{className:`font-medium text-neutral-900 dark:text-neutral-50`,children:a?.ok?`Connected: ${a.body.result?.name??`zone`}`:a?`Verification failed`:`Not verified yet`}),(0,F.jsx)(`div`,{className:`text-[12px] text-neutral-500 dark:text-neutral-400`,children:a?.ok?`Plan: ${a.body.result?.plan?.name??`unknown`}`:`Fill in credentials below, then click Verify.`})]})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,F.jsxs)(`button`,{type:`button`,onClick:()=>x(`verify`,`/cloudflare/verify`),disabled:s!==null,className:`flex items-center gap-1.5 text-[13px] px-3 py-1.5 rounded border border-neutral-200 dark:border-neutral-700 text-neutral-700 dark:text-neutral-300 hover:bg-neutral-50 dark:hover:bg-neutral-800 transition-colors disabled:opacity-50`,children:[(0,F.jsx)(P,{size:13,className:s===`verify`?`animate-spin`:``}),`Verify`]}),(0,F.jsxs)(`button`,{type:`button`,onClick:()=>x(`purge`,`/cloudflare/purge`),disabled:s!==null,className:`flex items-center gap-1.5 text-[13px] px-3 py-1.5 rounded bg-accent text-white hover:bg-blue-700 transition-colors disabled:opacity-40 disabled:cursor-not-allowed`,children:[s===`purge`?(0,F.jsx)(P,{size:13,className:`animate-spin`}):(0,F.jsx)(it,{size:13}),`Purge Cloudflare`]})]})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2 mt-3`,children:[(0,F.jsx)(`button`,{type:`button`,onClick:()=>x(`devon`,`/cloudflare/dev-mode`,`POST`,{on:!0}),disabled:s!==null,className:`text-[12px] px-2.5 py-1 rounded border border-neutral-200 dark:border-neutral-700 text-neutral-700 dark:text-neutral-300 hover:bg-neutral-50 dark:hover:bg-neutral-800 transition-colors disabled:opacity-50`,children:`Dev mode: ON`}),(0,F.jsx)(`button`,{type:`button`,onClick:()=>x(`devoff`,`/cloudflare/dev-mode`,`POST`,{on:!1}),disabled:s!==null,className:`text-[12px] px-2.5 py-1 rounded border border-neutral-200 dark:border-neutral-700 text-neutral-700 dark:text-neutral-300 hover:bg-neutral-50 dark:hover:bg-neutral-800 transition-colors disabled:opacity-50`,children:`Dev mode: OFF`})]})]}),l&&(0,F.jsx)(z,{tone:`danger`,title:`Cloudflare error`,body:l}),d&&!l&&(0,F.jsx)(z,{tone:`success`,title:`Done`,body:d}),(0,F.jsx)(`div`,{className:`border border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 rounded-lg overflow-hidden`,children:C.map(([e,t],n)=>(0,F.jsx)(Tr,{fieldKey:e,spec:t,value:r[e],onChange:t=>b(e,t),first:n===0},e))}),(0,F.jsx)(rr,{saving:p}),(0,F.jsxs)(`div`,{className:`pt-2`,children:[(0,F.jsx)(`div`,{className:`text-[11px] uppercase tracking-wider text-neutral-500 dark:text-neutral-400 font-medium mb-2`,children:`Automatic Platform Optimization`}),(0,F.jsx)(Un,{demo:`network-cloudflare`,children:(0,F.jsx)(U,{panel:`CloudflareApoPanel`,slug:`cloudflare-apo`,getModule:n,onSaved:t})})]})]})}function wr(e){switch(e){case`verify`:return`verify`;case`purge`:return`purge`;case`devon`:return`dev mode on`;case`devoff`:return`dev mode off`;default:return`action`}}function Tr({fieldKey:e,spec:t,value:n,onChange:r,first:i}){let a=t.label??e,o=e===`api_token`||e===`api_key`;return(0,F.jsxs)(`div`,{"data-field-anchor":`cloudflare:${e}`,className:`xspeed-field px-4 sm:px-5 py-4 flex items-start justify-between gap-3 sm:gap-4 ${i?``:`border-t border-neutral-200 dark:border-neutral-800`}`,children:[(0,F.jsxs)(`div`,{className:`min-w-0 pr-2`,children:[(0,F.jsx)(`div`,{className:`font-medium text-neutral-900 dark:text-neutral-50`,children:a}),t.description&&(0,F.jsx)(`div`,{className:`text-[12px] text-neutral-500 dark:text-neutral-400 mt-0.5`,children:t.description})]}),(0,F.jsx)(`div`,{className:`shrink-0`,children:Er(t,n,r,a,o)})]})}function Er(e,t,n,r,i){switch(e.type){case`bool`:return(0,F.jsx)(an,{checked:!!t,onChange:n,label:r});case`enum`:return(0,F.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:(e.options??[]).map(r=>{let i=t===r,a=e.option_labels?.[r]??r;return(0,F.jsx)(`button`,{type:`button`,onClick:()=>n(r),className:`text-[12px] px-2.5 py-1 rounded border transition-colors ${i?`bg-accent border-accent text-white`:`border-neutral-200 dark:border-neutral-700 text-neutral-700 dark:text-neutral-300 hover:bg-neutral-50 dark:hover:bg-neutral-800`}`,children:a},r)})});case`string`:return(0,F.jsx)(`input`,{type:i?`password`:`text`,value:t==null?``:String(t),onChange:e=>n(e.target.value),className:`w-64`,autoComplete:`off`,"aria-label":r});default:return null}}function Dr({module:e,onSaved:t}){let[n,r]=(0,y.useState)(e.settings),[i,a]=(0,y.useState)(null),[o,s]=(0,y.useState)(``),[c,l]=(0,y.useState)(null),[u,d]=(0,y.useState)(null),[f,p]=(0,y.useState)(null),[m,h]=(0,y.useState)(null),[g,_]=(0,y.useState)(!1),[v,b]=(0,y.useState)(!1),[x,S]=(0,y.useState)(!1),C=(0,y.useRef)(null),w=(0,y.useRef)(!0),T=(0,y.useRef)(JSON.stringify(e.settings)),E=(0,y.useRef)(n);(0,y.useEffect)(()=>{E.current=n},[n]);let ee=async()=>{l(`detect`),d(null);try{let[e,t]=await Promise.all([V.request(`/object-cache/detect`),V.request(`/object-cache/snippet`)]);a(e),s(t.snippet)}catch(e){d(e instanceof Error?e.message:`Detection failed`)}finally{l(null)}};(0,y.useEffect)(()=>{ee()},[]),(0,y.useEffect)(()=>{if(w.current){w.current=!1;return}if(JSON.stringify(n)!==T.current)return C.current&&window.clearTimeout(C.current),C.current=window.setTimeout(async()=>{S(!0);let i=n;try{let{next:n,dirty:a}=ir(i,await V.updateModuleSettings(e.slug,i),E.current);r(n),T.current=a?``:JSON.stringify(n),t?.(n),s((await V.request(`/object-cache/snippet`)).snippet)}catch(e){d(e instanceof Error?e.message:`Save failed`)}finally{S(!1)}},600),()=>{C.current&&window.clearTimeout(C.current)}},[n,e.slug]);let te=(e,t)=>r(n=>({...n,[e]:t})),D=async()=>{l(`flush`),d(null),p(null);try{p((await V.request(`/object-cache/flush`,{method:`POST`})).ok?`Object cache flushed.`:`Flush returned false — cache backend may not be active.`)}catch(e){d(e instanceof Error?e.message:`Flush failed`)}finally{l(null)}},ne=async()=>{l(`test`),d(null),p(null),h(null);try{let e=await V.request(`/object-cache/test-connection`,{method:`POST`,body:JSON.stringify(n)});h(e),e.ok||d(e.message)}catch(e){d(e instanceof Error?e.message:`Connection test failed`)}finally{l(null)}},re=async()=>{l(`enable`),d(null),p(null),_(!1);try{let e=await V.request(`/object-cache/enable`,{method:`POST`,body:JSON.stringify(n)});h(e.test??null),e.ok?(p(e.message),a(e.detect)):(d(e.message),e.steps.drop_in&&!e.steps.wp_config&&_(!0)),await ee()}catch(e){d(e instanceof Error?e.message:`Enable failed`)}finally{l(null)}},O=async()=>{l(`disable`),d(null),p(null);try{p((await V.request(`/object-cache/disable`,{method:`POST`})).message),h(null),_(!1),await ee()}catch(e){d(e instanceof Error?e.message:`Disable failed`)}finally{l(null)}},k=async()=>{try{await navigator.clipboard.writeText(o),b(!0),window.setTimeout(()=>b(!1),1500)}catch{d(`Clipboard write blocked — select + copy the snippet manually.`)}},A=String(n.backend??`redis`),ae=(0,y.useMemo)(()=>Object.entries(e.schema),[e.schema]).filter(([e])=>!(A===`redis`&&(e===`memcached_host`||e===`memcached_port`)||A===`memcached`&&(e===`redis_host`||e===`redis_port`||e===`redis_user`||e===`redis_password`||e===`redis_database`))),M=i?i.wp_cache_active?{tone:`ok`,label:`Active: ${i.drop_in_label||i.backend}`,sub:`Backend: ${i.backend}`}:{tone:`warn`,label:`No persistent object cache`,sub:`WordPress is using its built-in in-memory cache (resets every request).`}:null;return(0,F.jsxs)(`div`,{className:`space-y-4`,children:[(0,F.jsxs)(`div`,{className:`border border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 rounded-lg p-4 sm:p-5`,children:[(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[M?.tone===`ok`?(0,F.jsx)(ie,{size:18,className:`text-emerald-500 shrink-0`}):M?.tone===`warn`?(0,F.jsx)(j,{size:18,className:`text-amber-500 shrink-0`}):(0,F.jsx)(Ke,{size:18,className:`text-neutral-400 shrink-0`}),(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsx)(`div`,{className:`font-medium text-neutral-900 dark:text-neutral-50`,children:M?M.label:`Detecting…`}),(0,F.jsx)(`div`,{className:`text-[12px] text-neutral-500 dark:text-neutral-400`,children:M?.sub??``})]})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,F.jsxs)(`button`,{type:`button`,onClick:ee,disabled:c!==null,className:`flex items-center gap-1.5 text-[13px] px-3 py-1.5 rounded border border-neutral-200 dark:border-neutral-700 text-neutral-700 dark:text-neutral-300 hover:bg-neutral-50 dark:hover:bg-neutral-800 transition-colors disabled:opacity-50`,children:[(0,F.jsx)(P,{size:13,className:c===`detect`?`animate-spin`:``}),`Re-detect`]}),i?.drop_in_installed&&(0,F.jsxs)(`button`,{type:`button`,onClick:D,disabled:c!==null,className:`flex items-center gap-1.5 text-[13px] px-3 py-1.5 rounded border border-neutral-200 dark:border-neutral-700 text-neutral-700 dark:text-neutral-300 hover:bg-neutral-50 dark:hover:bg-neutral-800 transition-colors disabled:opacity-50`,children:[c===`flush`?(0,F.jsx)(P,{size:13,className:`animate-spin`}):(0,F.jsx)(it,{size:13}),`Flush`]})]})]}),i&&(()=>{let e=A===`redis`?!!i.class_available.Redis:!!(i.class_available.Memcached||i.class_available.Memcache);return(0,F.jsxs)(`div`,{className:`mt-3 flex items-center gap-2 text-[12px]`,children:[(0,F.jsxs)(`span`,{className:`px-2 py-0.5 rounded border border-emerald-300 bg-emerald-50 text-emerald-700 dark:border-emerald-700 dark:bg-emerald-900/30 dark:text-emerald-300 whitespace-nowrap`,children:[A===`redis`?`Redis`:`Memcached`,` ready`]}),(0,F.jsx)(`span`,{className:`text-neutral-500 dark:text-neutral-400`,children:e?`Native ${A===`redis`?`phpredis`:`memcached`} extension detected — fastest path.`:`xSpeed uses its built-in client — no extension to install.`})]})})()]}),u&&(0,F.jsx)(z,{tone:`danger`,title:`Error`,body:u}),f&&!u&&(0,F.jsx)(z,{tone:`success`,title:`Done`,body:f}),(0,F.jsx)(`div`,{className:`border border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 rounded-lg p-4 sm:p-5`,children:(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsxs)(`div`,{className:`font-medium text-neutral-900 dark:text-neutral-50 flex items-center gap-2`,children:[(0,F.jsx)(pt,{size:15,className:`text-accent`}),`One-click setup`]}),(0,F.jsx)(`div`,{className:`text-[12px] text-neutral-500 dark:text-neutral-400 mt-0.5`,children:i?.drop_in_installed?`Object cache is installed. Disable to remove the drop-in and clean wp-config.php.`:`Test the ${A} connection, then enable — xSpeed writes the drop-in and wp-config.php for you. No manual steps.`}),m&&(0,F.jsxs)(`div`,{className:`mt-2 inline-flex items-center gap-1.5 text-[12px] px-2 py-1 rounded ${m.ok?`bg-emerald-50 text-emerald-700 dark:bg-emerald-900/30 dark:text-emerald-300`:`bg-red-50 text-red-700 dark:bg-red-900/30 dark:text-red-300`}`,children:[m.ok?(0,F.jsx)(ie,{size:13}):(0,F.jsx)(j,{size:13}),m.message,m.latency_ms!=null&&m.ok?` (${m.latency_ms} ms)`:``]})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,F.jsxs)(`button`,{type:`button`,onClick:ne,"data-field-anchor":`object-cache:connection_test`,disabled:c!==null,className:`flex items-center gap-1.5 text-[13px] px-3 py-1.5 rounded border border-neutral-200 dark:border-neutral-700 text-neutral-700 dark:text-neutral-300 hover:bg-neutral-50 dark:hover:bg-neutral-800 transition-colors disabled:opacity-50`,children:[c===`test`?(0,F.jsx)(P,{size:13,className:`animate-spin`}):(0,F.jsx)(Le,{size:13}),`Test connection`]}),i?.drop_in_installed?(0,F.jsxs)(`button`,{type:`button`,onClick:O,disabled:c!==null,className:`flex items-center gap-1.5 text-[13px] px-3 py-1.5 rounded border border-red-300 dark:border-red-800 text-red-700 dark:text-red-300 hover:bg-red-50 dark:hover:bg-red-900/20 transition-colors disabled:opacity-50`,children:[c===`disable`?(0,F.jsx)(P,{size:13,className:`animate-spin`}):(0,F.jsx)(Re,{size:13}),`Disable`]}):(0,F.jsxs)(`button`,{type:`button`,onClick:re,disabled:c!==null,className:`flex items-center gap-1.5 text-[13px] px-3 py-1.5 rounded bg-accent text-white hover:bg-blue-700 transition-colors disabled:opacity-40 disabled:cursor-not-allowed`,children:[c===`enable`?(0,F.jsx)(P,{size:13,className:`animate-spin`}):(0,F.jsx)(Re,{size:13}),`Enable object cache`]})]})]})}),(0,F.jsx)(`div`,{className:`border border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 rounded-lg overflow-hidden`,children:ae.map(([e,t],r)=>(0,F.jsx)(Or,{fieldKey:e,spec:t,value:n[e],onChange:t=>te(e,t),first:r===0},e))}),g&&(0,F.jsxs)(`div`,{className:`border border-amber-200 dark:border-amber-800 bg-amber-50/40 dark:bg-amber-900/10 rounded-lg p-4 sm:p-5`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-3 mb-3`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`font-medium text-neutral-900 dark:text-neutral-50`,children:`Manual step needed — wp-config.php isn’t writable`}),(0,F.jsx)(`div`,{className:`text-[12px] text-neutral-500 dark:text-neutral-400 mt-0.5`,children:`The drop-in was installed, but xSpeed couldn’t edit wp-config.php automatically. Paste this above the “That’s all, stop editing!” comment to finish.`})]}),(0,F.jsxs)(`button`,{type:`button`,onClick:k,disabled:!o,className:`flex items-center gap-1.5 text-[13px] px-3 py-1.5 rounded border border-neutral-200 dark:border-neutral-700 text-neutral-700 dark:text-neutral-300 hover:bg-neutral-50 dark:hover:bg-neutral-800 transition-colors disabled:opacity-50`,children:[v?(0,F.jsx)(ie,{size:13,className:`text-emerald-500`}):(0,F.jsx)(oe,{size:13}),v?`Copied`:`Copy`]})]}),(0,F.jsx)(`pre`,{className:`text-[11px] leading-relaxed font-mono whitespace-pre-wrap break-all bg-neutral-50 dark:bg-neutral-950 text-neutral-700 dark:text-neutral-300 border border-neutral-200 dark:border-neutral-800 rounded p-3 max-h-72 overflow-auto`,children:o||`// Adjust the settings above to generate a snippet.`})]}),(0,F.jsx)(rr,{saving:x})]})}function Or({fieldKey:e,spec:t,value:n,onChange:r,first:i}){let a=t.label??e,o=e===`redis_password`;return(0,F.jsxs)(`div`,{className:`px-4 sm:px-5 py-4 flex items-start justify-between gap-3 sm:gap-4 ${i?``:`border-t border-neutral-200 dark:border-neutral-800`}`,children:[(0,F.jsxs)(`div`,{className:`min-w-0 pr-2`,children:[(0,F.jsx)(`div`,{className:`font-medium text-neutral-900 dark:text-neutral-50`,children:a}),t.description&&(0,F.jsx)(`div`,{className:`text-[12px] text-neutral-500 dark:text-neutral-400 mt-0.5`,children:t.description})]}),(0,F.jsx)(`div`,{className:`shrink-0`,children:kr(t,n,r,a,o)})]})}function kr(e,t,n,r,i){switch(e.type){case`bool`:return(0,F.jsx)(an,{checked:!!t,onChange:n,label:r});case`int`:return(0,F.jsx)(`input`,{type:`number`,min:e.min,max:e.max,value:t==null?``:Number(t),onChange:e=>n(Number(e.target.value)),className:`w-24 text-right`,"aria-label":r});case`enum`:return(0,F.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:(e.options??[]).map(r=>{let i=t===r,a=e.option_labels?.[r]??r;return(0,F.jsx)(`button`,{type:`button`,onClick:()=>n(r),className:`text-[12px] px-2.5 py-1 rounded border transition-colors ${i?`bg-accent border-accent text-white`:`border-neutral-200 dark:border-neutral-700 text-neutral-700 dark:text-neutral-300 hover:bg-neutral-50 dark:hover:bg-neutral-800`}`,children:a},r)})});case`string`:return(0,F.jsx)(`input`,{type:i?`password`:`text`,value:t==null?``:String(t),onChange:e=>n(e.target.value),className:`w-56`,autoComplete:`off`,"aria-label":r});default:return null}}function Ar({title:e,body:t,confirmLabel:n,cancelLabel:r=`Cancel`,busy:i=!1,onConfirm:a,onCancel:o}){return(0,F.jsx)(`div`,{role:`alertdialog`,"aria-labelledby":`xspeed-inline-confirm-title`,className:`border border-red-200 dark:border-red-900/60 bg-red-50 dark:bg-red-950/40 rounded-lg p-4 sm:p-5`,children:(0,F.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[(0,F.jsx)(ot,{size:16,className:`text-red-600 dark:text-red-400 shrink-0 mt-0.5`}),(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsx)(`div`,{id:`xspeed-inline-confirm-title`,className:`font-medium text-red-900 dark:text-red-200 text-[13px]`,children:e}),t&&(0,F.jsx)(`p`,{className:`text-[12px] text-red-800/90 dark:text-red-200/80 mt-1`,children:t}),(0,F.jsxs)(`div`,{className:`mt-3 flex items-center gap-2`,children:[(0,F.jsxs)(`button`,{type:`button`,onClick:a,disabled:i,style:{height:32,boxSizing:`border-box`},className:`flex items-center gap-1.5 whitespace-nowrap text-[12px] px-3 rounded-md !border !border-solid !border-red-600 dark:!border-red-500 bg-red-600 dark:bg-red-500 text-white hover:bg-red-700 hover:!border-red-700 dark:hover:bg-red-600 transition-colors disabled:opacity-50`,children:[i&&(0,F.jsx)(je,{size:12,className:`animate-spin`}),n]}),(0,F.jsx)(`button`,{type:`button`,onClick:o,disabled:i,style:{height:32,boxSizing:`border-box`},className:`flex items-center gap-1.5 whitespace-nowrap text-[12px] px-3 rounded-md !border !border-solid !border-red-300 dark:!border-red-800 bg-white dark:bg-neutral-900 text-red-800 dark:text-red-200 hover:bg-red-100 dark:hover:bg-red-900/40 transition-colors disabled:opacity-50`,children:r})]})]})]})})}var jr=`xspeed_migration_applied_${typeof window<`u`?window.location.host:``}`;function Mr(){if(typeof window>`u`)return[];try{let e=window.localStorage.getItem(jr),t=e?JSON.parse(e):[];return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}function Nr(e){if(!(typeof window>`u`))try{window.localStorage.setItem(jr,JSON.stringify(e))}catch{}}var Pr={cache:`Page Cache`,minify:`Minify`,lazy:`Lazy Load`,preloader:`Preloader`,"browser-cache":`Browser Cache`,"object-cache":`Object Cache`},Fr={cache_enabled:`Enable caching`,cache_expiry:`Cache lifetime (hours)`,mobile_separate:`Separate mobile cache`,excluded_urls:`Excluded URLs`,excluded_cookies:`Excluded cookies`,bypass_user_agents:`Bypass user agents`,ignored_query_params:`Ignored query params`,minify_html:`Minify HTML`,minify_css:`Minify CSS`,minify_js:`Minify JS`,lazy_images:`Lazy-load images`,lazy_iframes:`Lazy-load iframes`,lazy_videos:`Lazy-load videos`,enabled:`Enabled`,schedule:`Schedule`};function Ir(e){return Fr[e]??e.replace(/_/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}function Lr(e){return typeof e==`boolean`?e?`On`:`Off`:Array.isArray(e)?e.length?`${e.length} item${e.length===1?``:`s`}: ${e.join(`, `)}`:`—`:e==null||e===``?`—`:String(e)}function Rr({patch:e,title:t}){return(0,F.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,F.jsx)(`div`,{className:`text-[11px] font-medium text-neutral-500 dark:text-neutral-400 uppercase tracking-wider`,children:t}),Object.entries(e).map(([e,t])=>(0,F.jsxs)(`div`,{className:`rounded-lg overflow-hidden bg-neutral-50/60 dark:bg-[#0a0a0a4d]`,children:[(0,F.jsx)(`div`,{className:`px-4 pt-2.5 pb-1.5 text-[12px] font-semibold text-neutral-900 dark:text-neutral-50`,children:Pr[e]??Ir(e)}),Object.entries(t).map(([e,t])=>(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-4 px-4 py-2`,children:[(0,F.jsx)(`span`,{className:`text-[12px] text-neutral-500 dark:text-neutral-400 shrink-0`,children:Ir(e)}),(0,F.jsx)(`span`,{className:`text-[12px] text-neutral-900 dark:text-neutral-100 text-right truncate`,title:Lr(t),children:Lr(t)})]},e))]},e))]})}function zr(e){let t=H(),n=t===`pro`||t===`trial`,[r,i]=(0,y.useState)(null),[a,o]=(0,y.useState)({}),[s,c]=(0,y.useState)(null),[l,u]=(0,y.useState)([]),[d,f]=(0,y.useState)(null),[p,m]=(0,y.useState)(null),[h,g]=(0,y.useState)(null),[_,v]=(0,y.useState)(null),[b,x]=(0,y.useState)({}),[S,w]=(0,y.useState)(null),[T,E]=(0,y.useState)(()=>Mr()),[ee,te]=(0,y.useState)(null);(0,y.useEffect)(()=>{Nr(T)},[T]);let[D,ne]=(0,y.useState)(``),[re,O]=(0,y.useState)(null),[k,A]=(0,y.useState)(null),[j,ae]=(0,y.useState)(null),[M,N]=(0,y.useState)(null),[oe,ce]=(0,y.useState)(!1),ue=async()=>{c({source:`*`,op:`status`}),m(null);try{i((await V.request(`/migration/status`)).sources)}catch(e){m(e instanceof Error?e.message:`Status check failed`)}finally{c(null)}},pe=async()=>{try{v((await V.request(`/migration-pro/profiles`)).profiles)}catch{v([])}};(0,y.useEffect)(()=>{ue(),n&&pe()},[n]);let me=async e=>{c({source:e,op:`preview`}),m(null);try{let t=await V.request(`/migration/preview`,{method:`POST`,body:JSON.stringify({source:e})});o(n=>({...n,[e]:t.patch}))}catch(e){m(e instanceof Error?e.message:`Preview failed`)}finally{c(null)}},he=e=>{e.active?g(e):ge(e.id)},ge=async e=>{g(null),c({source:e,op:`apply`}),m(null),f(null);try{let t=await V.request(`/migration/apply`,{method:`POST`,body:JSON.stringify({source:e})});u(t=>[...t,e]);let n=t.source_label||`the source plugin`;f({title:`Imported settings from ${n}`,body:t.deactivated?`Your ${n} settings are now active in xSpeed, and ${n} has been deactivated so the two caching plugins don't conflict. Review the imported values in the panels and re-enable anything you want to tweak.`:`Your ${n} settings are now active in xSpeed. Review the imported values in the panels. (${n} was already inactive, so nothing was changed there.)`}),ue()}catch(e){m(e instanceof Error?e.message:`Apply failed`)}finally{c(null)}},_e=async e=>{if(b[e]){x(t=>{let n={...t};return delete n[e],n});return}w({id:e,op:`preview`}),m(null);try{let t=await V.request(`/migration-pro/profiles/preview`,{method:`POST`,body:JSON.stringify({profile:e})});x(n=>({...n,[e]:t.patch}))}catch(e){m(e instanceof Error?e.message:`Preview failed`)}finally{w(null)}},ve=e=>te(e),ye=async e=>{te(null),w({id:e,op:`apply`}),m(null);try{await V.request(`/migration-pro/profiles/apply`,{method:`POST`,body:JSON.stringify({profile:e})}),E(t=>t.includes(e)?t:[...t,e])}catch(e){m(e instanceof Error?e.message:`Apply failed`)}finally{w(null)}},be=async()=>{A(`export`),m(null),ae(null);try{let e=await V.request(`/migration-pro/profile/export`),t=JSON.stringify(e.profile,null,2),n=new Blob([t],{type:`application/json`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`xspeed-profile.json`,document.body.appendChild(i),i.click(),i.remove(),URL.revokeObjectURL(r),ae(`Profile exported — saved as xspeed-profile.json.`)}catch(e){m(e instanceof Error?e.message:`Export failed`)}finally{A(null)}},xe=e=>{let t=e instanceof Error?e.message:``;return/422|format|profile|parse|json/i.test(t)||!t?`That doesn’t look like an xSpeed profile. Paste the JSON from an exported profile, or choose a .json file.`:t},Se=async()=>{if(D.trim()){A(`preview`),N(null),ae(null),O(null);try{O((await V.request(`/migration-pro/profile/import/preview`,{method:`POST`,body:JSON.stringify({profile:D.trim()})})).patch)}catch(e){N(xe(e))}finally{A(null)}}},Ce=()=>{D.trim()&&(N(null),ce(!0))},Te=async()=>{ce(!1),A(`apply`),N(null),ae(null);try{let e=await V.request(`/migration-pro/profile/import/apply`,{method:`POST`,body:JSON.stringify({profile:D.trim()})}),t=Object.keys(e.results).length;ae(`Imported — applied settings to ${t} module${t===1?``:`s`}.`),O(null),ne(``)}catch(e){N(xe(e))}finally{A(null)}},Ee=e=>{let t=new FileReader;t.onload=()=>ne(String(t.result??``)),t.readAsText(e)};return(0,F.jsxs)(`div`,{className:`space-y-4`,children:[(0,F.jsx)(`div`,{className:`border border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 rounded-lg p-4 sm:p-5`,children:(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,F.jsx)(we,{size:18,className:`text-accent shrink-0`}),(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsx)(`div`,{className:`font-medium text-neutral-900 dark:text-neutral-50`,children:`Migrate from another plugin`}),(0,F.jsx)(`div`,{className:`text-[12px] text-neutral-500 dark:text-neutral-400`,children:`Read settings from a detected caching plugin and apply the equivalent xSpeed configuration.`})]})]}),(0,F.jsxs)(`button`,{type:`button`,onClick:ue,disabled:s!==null,className:`flex items-center gap-1.5 text-[13px] px-3 py-1.5 rounded border border-neutral-200 dark:border-neutral-700 text-neutral-700 dark:text-neutral-300 hover:bg-neutral-50 dark:hover:bg-neutral-800 transition-colors disabled:opacity-50`,children:[(0,F.jsx)(P,{size:13,className:s?.op===`status`?`animate-spin`:``}),`Re-scan`]})]})}),p&&(0,F.jsx)(z,{tone:`danger`,title:`Migration error`,body:p}),d&&(0,F.jsx)(z,{tone:`success`,title:d.title,body:d.body}),r?.map(e=>{let t=l.includes(e.id)||e.imported,n=a[e.id],r=e.mapped_count,i=`${r} ${r===1?`setting`:`settings`}`,o=t?`Imported${e.active?``:` · plugin deactivated`}`:e.detected?`Detected — imports ${i}`:`Not installed (or settings not present)`;return(0,F.jsxs)(`div`,{className:`border border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 rounded-lg p-4 sm:p-5`,children:[(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,F.jsx)(`span`,{className:`w-2 h-2 rounded-full shrink-0 ${t||e.detected?`bg-emerald-500`:`bg-neutral-300 dark:bg-neutral-700`}`}),(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsx)(`div`,{className:`font-medium text-neutral-900 dark:text-neutral-50`,children:e.label}),(0,F.jsx)(`div`,{className:`text-[12px] text-neutral-500 dark:text-neutral-400`,children:o})]})]}),(0,F.jsx)(`div`,{className:`flex items-center gap-2 shrink-0`,children:t?(0,F.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[13px] px-3 py-1.5 text-emerald-700 dark:text-emerald-400 font-medium`,children:[(0,F.jsx)(ie,{size:14}),`Imported`]}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`button`,{type:`button`,onClick:()=>me(e.id),disabled:!e.detected||s!==null,className:`flex items-center gap-1.5 text-[13px] px-3 py-1.5 rounded border border-neutral-200 dark:border-neutral-700 text-neutral-700 dark:text-neutral-300 hover:bg-neutral-50 dark:hover:bg-neutral-800 transition-colors disabled:opacity-40 disabled:cursor-not-allowed`,children:[s?.source===e.id&&s?.op===`preview`?(0,F.jsx)(P,{size:13,className:`animate-spin`}):(0,F.jsx)(fe,{size:13}),`Preview`]}),(0,F.jsxs)(`button`,{type:`button`,onClick:()=>he(e),disabled:!e.detected||s!==null,className:`flex items-center gap-1.5 text-[13px] px-3 py-1.5 rounded bg-accent text-white hover:bg-blue-700 transition-colors disabled:opacity-40 disabled:cursor-not-allowed`,children:[s?.source===e.id&&s?.op===`apply`?(0,F.jsx)(P,{size:13,className:`animate-spin`}):(0,F.jsx)(C,{size:13}),`Import`]})]})})]}),h?.id===e.id&&(0,F.jsx)(`div`,{className:`mt-4`,children:(0,F.jsx)(Ar,{title:`${e.label} will be deactivated after import`,body:(0,F.jsxs)(F.Fragment,{children:[`xSpeed will import `,e.label,`’s `,i,`, then deactivate`,` `,e.label,` — two page-caching plugins can’t run together (they double-cache and fight over the cache drop-in, breaking caching for both). Your `,e.label,` settings stay saved in its own options, so you can reactivate it anytime to switch back.`]}),confirmLabel:`Import & switch to xSpeed`,cancelLabel:`Cancel`,busy:s?.source===e.id&&s?.op===`apply`,onConfirm:()=>ge(e.id),onCancel:()=>g(null)})}),n&&(0,F.jsx)(Rr,{patch:n,title:`Translation preview`})]},e.id)}),(0,F.jsxs)(`div`,{className:`border border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 rounded-lg p-4 sm:p-5`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,F.jsx)(lt,{size:18,className:`text-accent shrink-0`}),(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,F.jsx)(`span`,{className:`font-medium text-neutral-900 dark:text-neutral-50`,children:`One-click cache profiles`}),!n&&(0,F.jsx)(se,{size:12,className:`text-amber-500 dark:text-amber-400 shrink-0`})]}),(0,F.jsx)(`div`,{className:`text-[12px] text-neutral-500 dark:text-neutral-400`,children:`Apply a curated, best-practice xSpeed setup for your site type — no manual tuning.`})]})]}),n?_===null?(0,F.jsx)(`div`,{className:`mt-4 text-[12px] text-neutral-500 dark:text-neutral-400 text-center py-4`,children:`Loading…`}):_.length===0?(0,F.jsx)(`div`,{className:`mt-4 text-[12px] text-neutral-500 dark:text-neutral-400 text-center py-4`,children:`No profiles available.`}):(0,F.jsx)(`div`,{className:`mt-4 space-y-3`,children:_.map(e=>{let t=T.includes(e.id),n=b[e.id],r=!!n,i=ee?.id===e.id;return(0,F.jsxs)(`div`,{className:`border border-neutral-200 dark:border-neutral-800 rounded-lg p-4`,children:[(0,F.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsx)(`div`,{className:`font-medium text-neutral-900 dark:text-neutral-50`,children:e.label}),(0,F.jsx)(`div`,{className:`text-[12px] text-neutral-500 dark:text-neutral-400 mt-0.5`,children:e.description})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,F.jsxs)(`button`,{type:`button`,onClick:()=>_e(e.id),disabled:S!==null,"aria-expanded":r?`true`:`false`,className:`flex items-center gap-1.5 text-[13px] px-3 py-1.5 rounded border border-neutral-200 dark:border-neutral-700 text-neutral-700 dark:text-neutral-300 hover:bg-neutral-50 dark:hover:bg-neutral-800 transition-colors disabled:opacity-40`,children:[S?.id===e.id&&S?.op===`preview`?(0,F.jsx)(P,{size:13,className:`animate-spin`}):r?(0,F.jsx)(de,{size:13}):(0,F.jsx)(fe,{size:13}),r?`Hide preview`:`Preview`]}),(0,F.jsxs)(`button`,{type:`button`,onClick:()=>ve(e),disabled:S!==null||t,className:`flex items-center gap-1.5 text-[13px] px-3 py-1.5 rounded bg-accent text-white hover:bg-blue-700 transition-colors disabled:opacity-40 disabled:cursor-not-allowed`,children:[S?.id===e.id&&S?.op===`apply`?(0,F.jsx)(P,{size:13,className:`animate-spin`}):t?(0,F.jsx)(ie,{size:13}):(0,F.jsx)(C,{size:13}),t?`Applied`:`Apply`]})]})]}),n&&(0,F.jsx)(Rr,{patch:n,title:`Will set`}),i&&(0,F.jsx)(`div`,{className:`mt-4`,children:(0,F.jsx)(Ar,{title:`Apply the "${e.label}" profile?`,body:(0,F.jsxs)(F.Fragment,{children:[`This overwrites your site-wide cache settings (cache lifetime, exclusions, minify & lazy options) with the `,e.label,` preset. Your existing safety exclusions are kept. You can re-tune anything afterward in each panel.`]}),confirmLabel:`Apply profile`,cancelLabel:`Cancel`,busy:S?.id===e.id&&S?.op===`apply`,onConfirm:()=>ye(e.id),onCancel:()=>te(null)})})]},e.id)})}):(0,F.jsx)(`div`,{className:`mt-4 rounded-lg border border-dashed border-neutral-300 dark:border-neutral-700 px-4 py-3 text-[12px] text-neutral-500 dark:text-neutral-400`,children:`Curated one-click profiles (Blog, WooCommerce, Membership, LMS, News) and portable save\xA0&\xA0share are a Pro feature. Activate Pro to unlock them here.`})]}),n&&(0,F.jsxs)(`div`,{className:`border border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 rounded-lg p-4 sm:p-5`,children:[(0,F.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,F.jsx)(le,{size:18,className:`text-accent shrink-0`}),(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsx)(`div`,{className:`font-medium text-neutral-900 dark:text-neutral-50`,children:`Save & share your config`}),(0,F.jsx)(`div`,{className:`text-[12px] text-neutral-500 dark:text-neutral-400`,children:`Export this site’s xSpeed settings as a portable profile, then import it on another site.`})]})]}),(0,F.jsxs)(`button`,{type:`button`,onClick:be,disabled:k!==null,className:`flex items-center gap-1.5 text-[13px] px-3 py-1.5 rounded bg-accent text-white hover:bg-blue-700 transition-colors disabled:opacity-40 shrink-0`,children:[k===`export`?(0,F.jsx)(P,{size:13,className:`animate-spin`}):(0,F.jsx)(le,{size:13}),`Export profile`]})]}),(0,F.jsxs)(`div`,{className:`mt-3 text-[11px] text-neutral-500 dark:text-neutral-400 leading-snug`,children:[`For your security, API keys, tokens, and other secrets are `,(0,F.jsx)(`strong`,{children:`excluded`}),` from the exported file — re-enter them manually on the destination site after importing.`]}),j&&!M&&(0,F.jsx)(`div`,{className:`mt-3`,children:(0,F.jsx)(z,{tone:`success`,title:`Done`,body:j})}),(0,F.jsxs)(`div`,{className:`mt-5`,children:[(0,F.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider font-medium text-neutral-500 dark:text-neutral-400 mb-1`,children:`Import a profile`}),(0,F.jsx)(`textarea`,{rows:4,value:D,onChange:e=>{ne(e.target.value),O(null)},placeholder:`Paste an xSpeed profile JSON here, or choose a .json file below.`,className:`w-full font-mono text-[11px]`,"aria-label":`Profile JSON to import`}),(0,F.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2`,children:[(0,F.jsxs)(`label`,{className:`flex items-center gap-1.5 text-[13px] px-3 py-1.5 rounded border border-neutral-200 dark:border-neutral-700 text-neutral-700 dark:text-neutral-300 hover:bg-neutral-50 dark:hover:bg-neutral-800 transition-colors cursor-pointer`,children:[(0,F.jsx)(ct,{size:13}),`Choose file`,(0,F.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`hidden`,onChange:e=>{let t=e.target.files?.[0];t&&Ee(t)}})]}),(0,F.jsxs)(`button`,{type:`button`,onClick:Se,disabled:k!==null||!D.trim(),className:`flex items-center gap-1.5 text-[13px] px-3 py-1.5 rounded border border-neutral-200 dark:border-neutral-700 text-neutral-700 dark:text-neutral-300 hover:bg-neutral-50 dark:hover:bg-neutral-800 transition-colors disabled:opacity-40`,children:[k===`preview`?(0,F.jsx)(P,{size:13,className:`animate-spin`}):(0,F.jsx)(fe,{size:13}),`Preview`]}),(0,F.jsxs)(`button`,{type:`button`,onClick:Ce,disabled:k!==null||!D.trim(),className:`flex items-center gap-1.5 text-[13px] px-3 py-1.5 rounded bg-accent text-white hover:bg-blue-700 transition-colors disabled:opacity-40 disabled:cursor-not-allowed`,children:[k===`apply`?(0,F.jsx)(P,{size:13,className:`animate-spin`}):(0,F.jsx)(C,{size:13}),`Import & apply`]})]}),M&&(0,F.jsx)(`div`,{className:`mt-3`,children:(0,F.jsx)(z,{tone:`danger`,title:`Import error`,body:M})}),oe&&(0,F.jsx)(`div`,{className:`mt-3`,children:(0,F.jsx)(Ar,{title:`Apply this imported profile?`,body:(0,F.jsx)(F.Fragment,{children:`This overwrites your site-wide xSpeed settings with the values in the imported profile (cache lifetime, exclusions, minify & lazy options, …). Secrets aren’t included — re-enter them after. You can re-tune anything afterward in each panel.`}),confirmLabel:`Import & apply`,cancelLabel:`Cancel`,busy:k===`apply`,onConfirm:Te,onCancel:()=>ce(!1)})}),re&&(0,F.jsx)(Rr,{patch:re,title:`Will import`})]})]})]})}function Br({module:e}){let[t,n]=(0,y.useState)(null),[r,i]=(0,y.useState)(!1),[a,o]=(0,y.useState)(null),[s,c]=(0,y.useState)(!1),l=Qt(),u=String(e.settings.support_url??`https://wpdeveloper.com/support`),d=async()=>{i(!0),o(null);try{n(await V.request(`/support/snapshot`))}catch(e){o(e instanceof Error?e.message:`Snapshot failed`)}finally{i(!1)}};return(0,y.useEffect)(()=>{d()},[]),(0,F.jsxs)(`div`,{className:`space-y-4`,children:[(0,F.jsx)(`div`,{className:`border border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 rounded-lg p-4 sm:p-5`,children:(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,F.jsx)(ke,{size:18,className:`text-accent shrink-0`}),(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsx)(`div`,{className:`font-medium text-neutral-900 dark:text-neutral-50`,children:`Help & Support`}),(0,F.jsx)(`div`,{className:`text-[12px] text-neutral-500 dark:text-neutral-400`,children:`Open a ticket with your system snapshot already attached so we can help faster.`})]})]}),!l.hide_help_links&&(0,F.jsxs)(`a`,{href:u,target:`_blank`,rel:`noopener noreferrer`,className:`flex items-center gap-1.5 text-[13px] px-3 py-1.5 rounded bg-accent text-white hover:bg-blue-700 transition-colors`,children:[(0,F.jsx)(ue,{size:13}),`Open ticket`]})]})}),a&&(0,F.jsx)(z,{tone:`danger`,title:`Support snapshot error`,body:a}),(0,F.jsxs)(`div`,{className:`border border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 rounded-lg p-4 sm:p-5`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-3 mb-3`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`font-medium text-neutral-900 dark:text-neutral-50`,children:`System snapshot`}),(0,F.jsx)(`div`,{className:`text-[12px] text-neutral-500 dark:text-neutral-400`,children:`Paste this into your support ticket. License key is masked — first 4 + last 4 only.`})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsxs)(`button`,{type:`button`,onClick:d,disabled:r,className:`flex items-center gap-1.5 text-[13px] px-3 py-1.5 rounded border border-neutral-200 dark:border-neutral-700 text-neutral-700 dark:text-neutral-300 hover:bg-neutral-50 dark:hover:bg-neutral-800 transition-colors disabled:opacity-50`,children:[(0,F.jsx)(P,{size:13,className:r?`animate-spin`:``}),`Refresh`]}),(0,F.jsxs)(`button`,{type:`button`,onClick:async()=>{if(t)try{await navigator.clipboard.writeText(t.markdown),c(!0),window.setTimeout(()=>c(!1),1500)}catch{o(`Clipboard blocked. Select the text below and copy manually.`)}},disabled:!t,className:`flex items-center gap-1.5 text-[13px] px-3 py-1.5 rounded border border-neutral-200 dark:border-neutral-700 text-neutral-700 dark:text-neutral-300 hover:bg-neutral-50 dark:hover:bg-neutral-800 transition-colors disabled:opacity-50`,children:[s?(0,F.jsx)(ie,{size:13,className:`text-emerald-500`}):(0,F.jsx)(oe,{size:13}),s?`Copied`:`Copy markdown`]})]})]}),t?(0,F.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-x-6 gap-y-2 text-[12px]`,children:Object.entries(t.snapshot).map(([e,t])=>(0,F.jsxs)(`div`,{className:`flex justify-between gap-3 border-b border-neutral-100 dark:border-neutral-800 pb-1`,children:[(0,F.jsx)(`span`,{className:`text-neutral-500 dark:text-neutral-400 font-mono`,children:e}),(0,F.jsx)(`span`,{className:`text-neutral-900 dark:text-neutral-100 text-right truncate font-mono`,children:Array.isArray(t)?t.join(`, `):typeof t==`boolean`?t?`yes`:`no`:String(t)})]},e))}):(0,F.jsx)(`div`,{className:`text-[12px] text-neutral-500 dark:text-neutral-400 italic`,children:`Loading snapshot…`})]}),(()=>{let e=l.footer_credit?.trim();return e?(0,F.jsx)(`div`,{className:`text-[11px] text-neutral-400 dark:text-neutral-500 text-center pt-1`,children:e}):l.hide_help_links?null:(0,F.jsxs)(`div`,{className:`text-[11px] text-neutral-400 dark:text-neutral-500 text-center pt-1`,children:[`Built by`,` `,(0,F.jsx)(`a`,{href:`https://wpdeveloper.com`,target:`_blank`,rel:`noopener noreferrer`,className:`hover:text-accent`,children:`WPDeveloper`})]})})()]})}function Vr(e){let t=Math.max(0,Math.floor(Date.now()/1e3)-e);return t<60?`just now`:t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}function Hr(){let[e,t]=(0,y.useState)(!1),[n,r]=(0,y.useState)(null),[i,a]=(0,y.useState)(!1),[o,s]=(0,y.useState)(!1),c=async()=>{a(!0);try{r(await V.request(`/mcp/activity?limit=50`))}catch{r({entries:[],summary:{total:0,failed:0,last_ts:0,top_tool:``}})}finally{a(!1)}};(0,y.useEffect)(()=>{e&&n===null&&c()},[e]);let l=async()=>{a(!0);try{r(await V.request(`/mcp/activity/clear`,{method:`POST`}))}finally{a(!1),s(!1)}},u=n?.summary,d=n?.entries??[];return(0,F.jsxs)(`div`,{className:`mt-4 rounded-lg border border-neutral-200 dark:border-neutral-800`,children:[(0,F.jsxs)(`button`,{type:`button`,onClick:()=>t(e=>!e),"aria-expanded":e,className:`flex w-full items-center gap-2 px-3 py-2.5 text-left`,children:[e?(0,F.jsx)(ne,{size:14,className:`text-neutral-400 dark:text-neutral-500`}):(0,F.jsx)(re,{size:14,className:`text-neutral-400 dark:text-neutral-500`}),(0,F.jsx)(We,{size:14,className:`text-neutral-500 dark:text-neutral-400`}),(0,F.jsx)(`span`,{className:`text-[13px] font-medium text-neutral-800 dark:text-neutral-200`,children:`Activity log`}),u&&u.total>0&&(0,F.jsxs)(`span`,{className:`text-[11px] text-neutral-400 dark:text-neutral-500`,children:[u.total,` call`,u.total===1?``:`s`,u.failed>0&&(0,F.jsxs)(`span`,{className:`text-red-500 dark:text-red-400`,children:[` · `,u.failed,` failed`]})]}),(0,F.jsx)(`span`,{className:`ml-auto text-[11px] text-neutral-400 dark:text-neutral-500`,children:`what the AI did`})]}),e&&(0,F.jsxs)(`div`,{className:`border-t border-neutral-200 dark:border-neutral-800 px-3 py-3`,children:[(0,F.jsxs)(`div`,{className:`mb-2 flex items-center justify-between`,children:[(0,F.jsx)(`p`,{className:`text-[11px] text-neutral-500 dark:text-neutral-400`,children:`Every tool call an assistant dispatched to this site, newest first.`}),(0,F.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,F.jsx)(`button`,{type:`button`,onClick:c,disabled:i,"aria-label":`Refresh activity log`,className:`rounded border border-neutral-200 dark:border-neutral-700 p-1.5 text-neutral-500 dark:text-neutral-400 hover:bg-neutral-50 dark:hover:bg-neutral-800 disabled:opacity-40`,children:(0,F.jsx)(P,{size:12,className:i?`animate-spin`:``})}),d.length>0&&(0,F.jsx)(`button`,{type:`button`,onClick:()=>o?l():s(!0),onBlur:()=>s(!1),disabled:i,className:`rounded border px-2 py-1 text-[11px] disabled:opacity-40 ${o?`border-red-300 dark:border-red-800 text-red-600 dark:text-red-400`:`border-neutral-200 dark:border-neutral-700 text-neutral-500 dark:text-neutral-400 hover:bg-neutral-50 dark:hover:bg-neutral-800`}`,children:o?`Confirm clear`:`Clear`})]})]}),d.length===0?(0,F.jsx)(`p`,{className:`py-4 text-center text-[12px] text-neutral-400 dark:text-neutral-500`,children:n===null?`Loading…`:`No tool calls recorded yet.`}):(0,F.jsx)(`ul`,{className:`space-y-1`,children:d.map((e,t)=>(0,F.jsxs)(`li`,{className:`flex items-start gap-2 rounded-md bg-neutral-50 dark:bg-neutral-950/50 px-2.5 py-1.5`,children:[e.ok?(0,F.jsx)(ie,{size:13,className:`mt-0.5 shrink-0 text-emerald-500 dark:text-emerald-400`,"aria-label":`succeeded`}):(0,F.jsx)(ae,{size:13,className:`mt-0.5 shrink-0 text-red-500 dark:text-red-400`,"aria-label":`failed`}),(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,F.jsx)(`code`,{className:`text-[12px] font-medium text-neutral-800 dark:text-neutral-200`,children:e.tool}),e.scope===`read`?(0,F.jsx)(fe,{size:11,className:`text-neutral-400 dark:text-neutral-500`,"aria-label":`read-only call`}):(0,F.jsx)(Fe,{size:11,className:`text-amber-500 dark:text-amber-400`,"aria-label":`write call`})]}),e.args!==``&&(0,F.jsx)(`div`,{className:`truncate text-[11px] text-neutral-500 dark:text-neutral-400`,children:e.args}),e.error!==``&&(0,F.jsx)(`div`,{className:`text-[11px] text-red-500 dark:text-red-400`,children:e.error})]}),(0,F.jsx)(`span`,{className:`shrink-0 text-[11px] tabular-nums text-neutral-400 dark:text-neutral-500`,children:Vr(e.ts)})]},`${e.ts}-${e.tool}-${t}`))})]})]})}var Ur=!1;function Wr({module:e}){let[t,n]=(0,y.useState)(null),[r,i]=(0,y.useState)(null),[a,o]=(0,y.useState)(null),[s,c]=(0,y.useState)(!1),[l,u]=(0,y.useState)(`cli`),[d,f]=(0,y.useState)(!1),[p,m]=(0,y.useState)(null),h=async()=>{i(`load`),o(null);try{n(await V.request(`/mcp/connection`))}catch(e){o(e instanceof Error?e.message:`Failed to load MCP status.`)}finally{i(null)}};(0,y.useEffect)(()=>{h()},[]);let g=async()=>{i(`connect`),o(null);try{n(await V.request(`/mcp/connect`,{method:`POST`,body:JSON.stringify({read_only:s})}))}catch(e){o(e instanceof Error?e.message:`Could not connect to xSpeed MCP.`)}finally{i(null)}},_=async()=>{m(null),i(`rotate`),o(null);try{n(await V.request(`/mcp/rotate`,{method:`POST`}))}catch(e){o(e instanceof Error?e.message:`Token rotation failed.`)}finally{i(null)}},v=async()=>{m(null),i(`disconnect`),o(null);try{n(await V.request(`/mcp/disconnect`,{method:`POST`}))}catch(e){o(e instanceof Error?e.message:`Disconnect failed.`)}finally{i(null)}},b=!!t?.connected;return(0,F.jsxs)(`div`,{className:`space-y-4`,children:[(0,F.jsxs)(`div`,{className:`border border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 rounded-lg p-4 sm:p-5`,children:[(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[b?(0,F.jsx)(ie,{size:18,className:`text-emerald-500 shrink-0`}):(0,F.jsx)(Re,{size:18,className:`text-neutral-400 shrink-0`}),(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2 font-medium text-neutral-900 dark:text-neutral-50`,children:[b?`Connected`:`Not connected`,Ur]}),(0,F.jsx)(`div`,{className:`text-[12px] text-neutral-500 dark:text-neutral-400`,children:`Control this site's cache from Claude and other MCP-compatible AI agents.`})]})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[(0,F.jsxs)(`button`,{type:`button`,onClick:h,disabled:r!==null,className:`flex items-center gap-1.5 text-[13px] px-3 py-1.5 rounded border border-neutral-200 dark:border-neutral-700 text-neutral-700 dark:text-neutral-300 hover:bg-neutral-50 dark:hover:bg-neutral-800 transition-colors disabled:opacity-50`,children:[(0,F.jsx)(P,{size:13,className:r===`load`?`animate-spin`:``}),`Refresh`]}),b?(0,F.jsxs)(F.Fragment,{children:[Ur,(0,F.jsxs)(`button`,{type:`button`,onClick:()=>m(`rotate`),disabled:r!==null||p!==null,title:`Mint a fresh token and invalidate the current one`,className:`flex items-center gap-1.5 text-[13px] px-3 py-1.5 rounded border border-neutral-200 dark:border-neutral-700 text-neutral-700 dark:text-neutral-300 hover:bg-neutral-50 dark:hover:bg-neutral-800 transition-colors disabled:opacity-50`,children:[r===`rotate`?(0,F.jsx)(P,{size:13,className:`animate-spin`}):(0,F.jsx)(Ve,{size:13}),`Rotate`]}),(0,F.jsxs)(`button`,{type:`button`,onClick:()=>m(`disconnect`),disabled:r!==null||p!==null,className:`flex items-center gap-1.5 text-[13px] px-3 py-1.5 rounded border border-red-200 dark:border-red-900 text-red-700 dark:text-red-300 hover:bg-red-50 dark:hover:bg-red-950/40 transition-colors disabled:opacity-50`,children:[r===`disconnect`?(0,F.jsx)(P,{size:13,className:`animate-spin`}):(0,F.jsx)(Re,{size:13}),`Disconnect`]})]}):(0,F.jsxs)(`button`,{type:`button`,onClick:g,disabled:r!==null,className:`flex items-center gap-1.5 text-[13px] px-3 py-1.5 rounded bg-accent text-white hover:bg-blue-700 transition-colors disabled:opacity-40 disabled:cursor-not-allowed`,children:[r===`connect`?(0,F.jsx)(P,{size:13,className:`animate-spin`}):(0,F.jsx)(Qe,{size:13}),`Connect`]})]})]}),Ur]}),p===`rotate`&&(0,F.jsx)(Ar,{title:`Rotate the MCP token?`,body:`A fresh token is minted and the current one is invalidated immediately. Any AI agent using the old token stops working until you paste the new one.`,confirmLabel:`Rotate token`,busy:r===`rotate`,onConfirm:_,onCancel:()=>m(null)}),p===`disconnect`&&(0,F.jsx)(Ar,{title:`Disconnect MCP?`,body:`This revokes the token and every OAuth grant immediately — any AI agent using this site stops working until you reconnect.`,confirmLabel:`Disconnect`,busy:r===`disconnect`,onConfirm:v,onCancel:()=>m(null)}),a&&(0,F.jsx)(z,{tone:`danger`,title:`MCP error`,body:a}),t&&(0,F.jsxs)(`div`,{className:`border border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 rounded-lg p-4 sm:p-5 space-y-3`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`font-medium text-neutral-900 dark:text-neutral-50`,children:`Add this MCP server to your AI client`}),(0,F.jsxs)(`div`,{className:`text-[12px] text-neutral-500 dark:text-neutral-400 mt-0.5`,children:[`Pick the format your client uses. The token travels in an`,` `,(0,F.jsx)(`code`,{className:`font-mono text-[11px]`,children:`Authorization`}),` header, so it never lands in a URL or server log.`]})]}),(0,F.jsx)(`div`,{className:`flex items-center gap-1 border-b border-neutral-200 dark:border-neutral-800`,children:[[`cli`,`Claude Code (CLI)`],[`json`,`JSON config`],[`prompt`,`AI prompt`],[`oauth`,`Remote (OAuth)`]].map(([e,t])=>(0,F.jsx)(`button`,{type:`button`,onClick:()=>u(e),className:`flex items-center gap-1.5 text-[12px] px-3 py-1.5 -mb-px border-b-2 transition-colors ${l===e?`border-accent text-neutral-900 dark:text-neutral-50 font-medium`:`border-transparent text-neutral-500 dark:text-neutral-400 hover:text-neutral-700 dark:hover:text-neutral-200`}`,children:t},e))}),!b&&(0,F.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-neutral-200 dark:border-neutral-800 bg-neutral-50 dark:bg-neutral-950/40 px-3 py-2 text-[12px] text-neutral-500 dark:text-neutral-400`,children:[(0,F.jsx)(Qe,{size:14,className:`mt-0.5 shrink-0 text-accent`}),(0,F.jsxs)(`span`,{children:[`Click `,(0,F.jsx)(`strong`,{className:`font-medium text-neutral-700 dark:text-neutral-300`,children:`Connect`}),` `,`above to mint this site's token, then copy your connection config here.`]})]}),l===`cli`&&b&&(0,F.jsxs)(`div`,{className:`space-y-2`,children:[(0,F.jsx)(`div`,{className:`text-[12px] text-neutral-500 dark:text-neutral-400`,children:`Run this once in your terminal — it registers xSpeed with Claude Code:`}),(0,F.jsx)(hn,{content:t.config.cli,tone:`blue`})]}),l===`json`&&b&&(0,F.jsxs)(`div`,{className:`space-y-2`,children:[(0,F.jsx)(`div`,{className:`text-[12px] text-neutral-500 dark:text-neutral-400`,children:`Add this to your client's MCP config (e.g. Claude Desktop's config file):`}),(0,F.jsx)(hn,{content:t.config.json,tone:`blue`})]}),l===`prompt`&&b&&(0,F.jsxs)(`div`,{className:`space-y-2`,children:[(0,F.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-amber-300 dark:border-amber-800/60 bg-amber-50 dark:bg-amber-950/40 px-3 py-2 text-[12px] text-amber-800 dark:text-amber-200`,children:[(0,F.jsx)(ot,{size:14,className:`mt-0.5 shrink-0`}),(0,F.jsxs)(`span`,{children:[(0,F.jsx)(`strong`,{className:`font-semibold`,children:`Not recommended.`}),` This pastes your token into a chat, so the AI provider may see and store it. Prefer the`,` `,(0,F.jsx)(`strong`,{className:`font-medium`,children:`Claude Code (CLI)`}),`,`,` `,(0,F.jsx)(`strong`,{className:`font-medium`,children:`JSON config`}),`, or`,` `,(0,F.jsx)(`strong`,{className:`font-medium`,children:`Remote (OAuth)`}),` methods, which keep the token out of the conversation.`]})]}),(0,F.jsx)(`div`,{className:`text-[12px] text-neutral-500 dark:text-neutral-400`,children:`Paste this to your AI agent so it knows what it's connected to and how to act:`}),(0,F.jsx)(hn,{content:t.ai_prompt})]}),l===`oauth`&&b&&(0,F.jsxs)(`div`,{className:`space-y-2`,children:[(0,F.jsx)(`div`,{className:`text-[12px] text-neutral-500 dark:text-neutral-400`,children:`For clients that connect by URL only (e.g. claude.ai connectors). Paste just the server URL — no token field:`}),(0,F.jsx)(hn,{content:t.mcp_endpoint,tone:`blue`}),(0,F.jsxs)(`div`,{className:`flex items-start gap-2 text-[12px] text-neutral-500 dark:text-neutral-400 pt-1`,children:[(0,F.jsx)(`span`,{className:`text-accent shrink-0`,children:`•`}),(0,F.jsxs)(`span`,{children:[`No token needed. Your client opens a browser page where you`,` `,(0,F.jsx)(`strong`,{className:`font-medium text-neutral-700 dark:text-neutral-300`,children:`approve access`}),` `,`(you must be signed in here as an administrator). Approval grants the same`,` `,t.read_only?`read-only`:`read & write`,` access as the token above.`]})]})]}),b&&(0,F.jsxs)(`div`,{className:`flex items-start gap-2 text-[12px] text-neutral-500 dark:text-neutral-400 pt-1`,children:[(0,F.jsx)(`span`,{className:`text-amber-500 shrink-0`,children:`•`}),(0,F.jsxs)(`span`,{children:[`Treat the token like a password — it lets an AI control this site.`,` `,(0,F.jsx)(`strong`,{className:`font-medium text-neutral-700 dark:text-neutral-300`,children:`Rotate`}),` `,`if it may have leaked;`,` `,(0,F.jsx)(`strong`,{className:`font-medium text-neutral-700 dark:text-neutral-300`,children:`Disconnect`}),` `,`to revoke entirely.`,t.scopes.length>0&&(0,F.jsxs)(F.Fragment,{children:[` Granted scopes: `,t.scopes.join(`, `),`.`]})]})]})]}),b&&t&&t.tools.length>0&&(0,F.jsxs)(`div`,{className:`border border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 rounded-lg p-4 sm:p-5`,children:[(0,F.jsxs)(`button`,{type:`button`,onClick:()=>f(e=>!e),"aria-expanded":d?`true`:`false`,className:`flex w-full items-center gap-2 text-left focus:outline-none`,children:[d?(0,F.jsx)(ne,{size:16,className:`shrink-0 text-neutral-500 dark:text-neutral-400`}):(0,F.jsx)(re,{size:16,className:`shrink-0 text-neutral-500 dark:text-neutral-400`}),(0,F.jsx)(`span`,{className:`font-medium text-neutral-900 dark:text-neutral-50`,children:`Tools your AI agent can call`}),(0,F.jsxs)(`span`,{className:`text-[12px] text-neutral-400 dark:text-neutral-500`,children:[`(`,t.tools.length,`)`]})]}),d&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`div`,{className:`text-[12px] text-neutral-500 dark:text-neutral-400 mt-2`,children:t.read_only?(0,F.jsxs)(F.Fragment,{children:[`This is a `,(0,F.jsx)(`strong`,{className:`font-medium`,children:`read-only`}),` connection, so the`,` `,(0,F.jsx)(`span`,{className:`text-amber-600 dark:text-amber-400`,children:`write`}),` tools below are refused.`]}):(0,F.jsx)(F.Fragment,{children:`Each tool maps to an xSpeed action. Write tools can change this site.`})}),(0,F.jsx)(`ul`,{className:`mt-3 divide-y divide-neutral-100 dark:divide-neutral-800`,children:t.tools.map(e=>(0,F.jsxs)(`li`,{className:`flex items-start gap-3 py-2`,children:[(0,F.jsx)(`code`,{className:`font-mono text-[11px] text-neutral-800 dark:text-neutral-200 shrink-0 mt-0.5`,children:e.name}),(0,F.jsx)(`span`,{className:`shrink-0 mt-0.5 text-[10px] font-medium px-1.5 py-0.5 rounded ${e.write?`bg-amber-100 dark:bg-amber-950/50 text-amber-700 dark:text-amber-300`:`bg-neutral-100 dark:bg-neutral-800 text-neutral-500 dark:text-neutral-400`}`,children:e.write?`write`:`read`}),(0,F.jsx)(`span`,{className:`text-[12px] text-neutral-500 dark:text-neutral-400`,children:e.description})]},e.name))})]})]}),!b&&t!==null&&(0,F.jsxs)(`div`,{className:`border border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 rounded-lg p-4 sm:p-5`,children:[(0,F.jsx)(`div`,{className:`font-medium text-neutral-900 dark:text-neutral-50`,children:`What your AI agent can do`}),(0,F.jsxs)(`div`,{className:`text-[12px] text-neutral-500 dark:text-neutral-400 mt-1`,children:[`Once connected, your AI can read cache status & stats, purge the cache, toggle caching on or off, and read or change module settings — all scoped to this site.`,Ur,` `,`Rotate or disconnect any time to revoke access.`]})]}),(0,F.jsx)(Hr,{})]})}var Gr=[{key:`gzip`,slug:`gzip`,self:!0},{key:`brotli`,slug:`brotli-compression`,pro:!0}];function Kr({module:e,onSaved:t,subtab:n,onSubtabChange:r,getModule:i}){let a=H(),{items:o,active:s}=fr(Gr,{module:e,getModule:i,isPro:a===`pro`||a===`trial`,subtab:n});return(0,y.useEffect)(()=>{n&&!o.some(e=>e.key===n)&&r?.(Gr[0].key)},[n,o,r]),(0,F.jsxs)(`div`,{className:`space-y-5`,children:[(0,F.jsx)(Cn,{items:o,value:s,onChange:e=>r?.(e),idBase:`compression`}),s===`gzip`&&(0,F.jsx)(wi,{module:e,onSaved:t}),s===`brotli`&&(0,F.jsx)(Un,{demo:`compression-brotli`,children:(0,F.jsx)(U,{slug:`brotli-compression`,getModule:i,onSaved:t})})]})}var qr=[{key:`minify`,slug:`minify`,self:!0},{key:`critical`,slug:`critical-css`,panel:`CriticalCssPanel`,pro:!0},{key:`unused`,slug:`unused-css`,panel:`UnusedCssPanel`,pro:!0}];function Jr({module:e,onSaved:t,subtab:n,onSubtabChange:r,getModule:i}){let a=H(),{items:o,active:s}=fr(qr,{module:e,getModule:i,isPro:a===`pro`||a===`trial`,subtab:n});return(0,y.useEffect)(()=>{n&&!o.some(e=>e.key===n)&&r?.(qr[0].key)},[n,o,r]),(0,F.jsxs)(`div`,{className:`space-y-5`,children:[(0,F.jsx)(Cn,{items:o,value:s,onChange:e=>r?.(e),idBase:`cssjs`}),s===`minify`&&(0,F.jsx)(wi,{module:e,onSaved:t}),s===`critical`&&(0,F.jsx)(Un,{demo:`cssjs-critical`,children:(0,F.jsx)(U,{panel:`CriticalCssPanel`,slug:`critical-css`,getModule:i,onSaved:t})}),s===`unused`&&(0,F.jsx)(Un,{demo:`cssjs-unused`,children:(0,F.jsx)(U,{panel:`UnusedCssPanel`,slug:`unused-css`,getModule:i,onSaved:t})})]})}var Yr=[{key:`lazy`,slug:`lazy`,self:!0},{key:`images`,slug:`images`,panel:`ImagesPanel`,pro:!0},{key:`smart`,slug:`smart-image`,panel:`SmartImagePanel`,pro:!0},{key:`fonts`,slug:`fonts`,free:!0}];function Xr({module:e,onSaved:t,subtab:n,onSubtabChange:r,getModule:i}){let a=H(),{items:o,active:s}=fr(Yr,{module:e,getModule:i,isPro:a===`pro`||a===`trial`,subtab:n});(0,y.useEffect)(()=>{n&&!o.some(e=>e.key===n)&&r?.(Yr[0].key)},[n,o,r]);let c=i?.(`fonts`);return(0,F.jsxs)(`div`,{className:`space-y-5`,children:[(0,F.jsx)(Cn,{items:o,value:s,onChange:e=>r?.(e),idBase:`media`}),s===`lazy`&&(0,F.jsx)(wi,{module:e,onSaved:t}),s===`images`&&(0,F.jsx)(Un,{demo:`media-formats`,children:(0,F.jsx)(U,{panel:`ImagesPanel`,slug:`images`,getModule:i,onSaved:t})}),s===`smart`&&(0,F.jsx)(Un,{demo:`media-smart`,children:(0,F.jsx)(U,{panel:`SmartImagePanel`,slug:`smart-image`,getModule:i,onSaved:t})}),s===`fonts`&&(c?(0,F.jsx)(wi,{module:c,onSaved:t}):(0,F.jsx)(Nn,{icon:`Type`,title:`Fonts`,description:`Stop web fonts from blocking text; preload critical fonts.`}))]})}var Zr=[{key:`hints`,slug:`resource-hints`,self:!0},{key:`speculation`,slug:`smart-predict`,panel:`SmartPredictPanel`,pro:!0}];function Qr({module:e,onSaved:t,subtab:n,onSubtabChange:r,getModule:i}){let a=H(),{items:o,active:s}=fr(Zr,{module:e,getModule:i,isPro:a===`pro`||a===`trial`,subtab:n});return(0,y.useEffect)(()=>{n&&!o.some(e=>e.key===n)&&r?.(Zr[0].key)},[n,o,r]),(0,F.jsxs)(`div`,{className:`space-y-5`,children:[(0,F.jsx)(Cn,{items:o,value:s,onChange:e=>r?.(e),idBase:`resource-hints`}),s===`hints`&&(0,F.jsx)(wi,{module:e,onSaved:t}),s===`speculation`&&(0,F.jsx)(Un,{demo:`hints-speculation`,children:(0,F.jsx)(U,{panel:`SmartPredictPanel`,slug:`smart-predict`,getModule:i,onSaved:t})})]})}function $r({active:e}){let[t,n]=(0,y.useState)(null),[r,i]=(0,y.useState)(null),[a,o]=(0,y.useState)(null),[s,c]=(0,y.useState)(!1),[l,u]=(0,y.useState)(!1),[d,f]=(0,y.useState)(!1),p=async()=>{i(`load`),o(null);try{n(await V.request(`/mcp/hub`))}catch(e){o(e instanceof Error?e.message:`Failed to load xSpeed Hub status.`)}finally{i(null),u(!0)}},m=async(e=!1)=>{try{let t=e?{headers:{"X-XSpeed-Reconcile":`1`}}:{};n(await V.request(`/mcp/hub`,t))}catch{}};(0,y.useEffect)(()=>{e&&!l&&r!==`load`&&p()},[e]),(0,y.useEffect)(()=>{let t=()=>{document.visibilityState===`visible`&&e&&l&&m(!0)};return document.addEventListener(`visibilitychange`,t),window.addEventListener(`focus`,t),()=>{document.removeEventListener(`visibilitychange`,t),window.removeEventListener(`focus`,t)}},[e,l]);let h=async()=>{i(`token`),o(null);try{n(await V.request(`/mcp/hub/token`,{method:`POST`}))}catch(e){o(e instanceof Error?e.message:`Could not generate a token.`)}finally{i(null)}},g=async()=>{c(!1),i(`disconnect`),o(null);try{n(await V.request(`/mcp/hub/disconnect`,{method:`POST`}))}catch(e){o(e instanceof Error?e.message:`Disconnect failed.`)}finally{i(null)}};if(!l)return(0,F.jsxs)(`div`,{className:`flex items-center gap-2 text-[12px] text-neutral-400 dark:text-neutral-500 py-6`,children:[(0,F.jsx)(P,{size:13,className:`animate-spin`}),` Loading xSpeed Hub…`]});let _=!!t?.attached,v=(()=>{let e=t?.attach_url;if(!e||typeof window>`u`)return e;try{let t=new URL(e),n=new URL(window.location.href);return n.searchParams.set(`xspeed_connected`,`1`),t.searchParams.set(`return_url`,n.toString()),t.toString()}catch{return e}})(),b=!!t?.site_token;return(0,F.jsxs)(`div`,{className:`space-y-4`,children:[(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,F.jsx)(T,{size:18,className:`text-accent shrink-0`}),(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsx)(`div`,{className:`font-medium text-neutral-900 dark:text-neutral-50`,children:`xSpeed Hub`}),(0,F.jsx)(`div`,{className:`text-[12px] text-neutral-500 dark:text-neutral-400`,children:`Control caching on all your sites from one AI connection.`})]})]}),_&&(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-[12px] text-emerald-600 dark:text-emerald-400 shrink-0`,children:[(0,F.jsx)(ie,{size:14}),`Connected`]})]}),_&&(0,F.jsxs)(`div`,{className:`rounded-md border border-emerald-200 dark:border-emerald-900/60 bg-emerald-50/60 dark:bg-emerald-950/30 px-3 py-2.5 flex flex-wrap items-center justify-between gap-2`,children:[(0,F.jsxs)(`p`,{className:`text-[12px] text-neutral-700 dark:text-neutral-300`,children:[`This site is managed at xSpeed Hub`,t?.account_email?(0,F.jsxs)(F.Fragment,{children:[` — signed in as `,(0,F.jsx)(`strong`,{children:t.account_email})]}):``,`.`]}),(0,F.jsxs)(`a`,{href:t?.hub_url,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1.5 text-[13px] px-3 py-1.5 rounded bg-accent text-white hover:bg-blue-700 transition-colors shrink-0`,children:[(0,F.jsx)(ue,{size:13}),` Go to dashboard`]})]}),(0,F.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-3 gap-2 text-[12px]`,children:[[`1`,`Connect this site`,`One click — sign in and approve`],[`2`,`Connect AI once`,`Add one connection from your xSpeed Hub dashboard`],[`3`,`Control every site`,`“Purge cache on acme” — done`]].map(([e,t,n])=>(0,F.jsxs)(`div`,{className:`rounded-md border border-neutral-100 dark:border-neutral-800 bg-neutral-50 dark:bg-neutral-950/40 px-3 py-2`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-1.5 font-medium text-neutral-800 dark:text-neutral-200`,children:[(0,F.jsx)(`span`,{className:`inline-flex h-4 w-4 items-center justify-center rounded-full bg-accent text-white text-[10px]`,children:e}),t]}),(0,F.jsx)(`div`,{className:`text-neutral-500 dark:text-neutral-400 mt-0.5`,children:n})]},e))}),a&&(0,F.jsx)(z,{tone:`danger`,title:`xSpeed Hub error`,body:a}),!_&&(0,F.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,F.jsxs)(`a`,{href:v,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1.5 text-[13px] px-3 py-1.5 rounded bg-accent text-white hover:bg-blue-700 transition-colors`,children:[(0,F.jsx)(Qe,{size:13}),` Connect via xSpeed Hub`]}),(0,F.jsx)(`p`,{className:`text-[12px] text-neutral-500 dark:text-neutral-400`,children:`One click — sign in to your account and approve. No token to copy.`})]}),!_&&(0,F.jsxs)(`div`,{className:`border-t border-neutral-100 dark:border-neutral-800 pt-3`,children:[(0,F.jsxs)(`button`,{type:`button`,onClick:()=>{b||h(),f(e=>!e)},className:`flex items-center gap-1.5 text-[12px] text-neutral-500 dark:text-neutral-400 hover:text-neutral-700 dark:hover:text-neutral-200`,children:[(0,F.jsx)(Ee,{size:12}),`Can't redirect? Add with a token instead`]}),d&&(0,F.jsxs)(`div`,{className:`mt-3 space-y-2`,children:[(0,F.jsxs)(`p`,{className:`text-[12px] text-neutral-500 dark:text-neutral-400`,children:[`Paste this site's URL + token into the`,` `,(0,F.jsxs)(`a`,{href:t?.add_site_url,target:`_blank`,rel:`noreferrer`,className:`text-accent hover:underline inline-flex items-center gap-0.5`,children:[`Add site form `,(0,F.jsx)(ue,{size:11})]}),` `,`on xspeedcache.com.`]}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`text-[11px] font-medium text-neutral-500 dark:text-neutral-400 mb-1`,children:`Site URL`}),(0,F.jsx)(hn,{content:t?.site_url??``})]}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`text-[11px] font-medium text-neutral-500 dark:text-neutral-400 mb-1`,children:`Token`}),(0,F.jsx)(hn,{content:t?.site_token??``,tone:`blue`})]}),(0,F.jsx)(`p`,{className:`text-[12px] text-neutral-500 dark:text-neutral-400`,children:`Same token as your MCP connection — treat it like a password.`})]})]}),_&&(0,F.jsx)(`div`,{className:`border-t border-neutral-100 dark:border-neutral-800 pt-3`,children:s?(0,F.jsx)(Ar,{title:`Disconnect this site from xSpeed Hub?`,body:`This clears the hub link on this site. To fully cut off the hub's access, also Rotate the token above so its stored copy stops working.`,confirmLabel:`Disconnect`,busy:r===`disconnect`,onConfirm:g,onCancel:()=>c(!1)}):(0,F.jsxs)(`button`,{type:`button`,onClick:()=>c(!0),disabled:r!==null,className:`flex items-center gap-1.5 text-[13px] px-3 py-1.5 rounded border border-red-200 dark:border-red-900 text-red-700 dark:text-red-300 hover:bg-red-50 dark:hover:bg-red-950/40 transition-colors disabled:opacity-50`,children:[(0,F.jsx)(Re,{size:13}),` Disconnect from Hub`]})})]})}var ei=[{key:`license`,label:`License`,locked:!0},{key:`branding`,label:`Branding`,locked:!0},{key:`multisite`,label:`Multisite`,locked:!0}],ti=`license`,ni=new Set(ei.map(e=>e.key));function ri({onSaved:e,subtab:t,onSubtabChange:n,getModule:r}){let i=H(),a=i===`pro`||i===`trial`,o=ei.map(e=>({...e,locked:e.locked&&!a})),s=t&&ni.has(t)?t:ti;return(0,y.useEffect)(()=>{t&&!ni.has(t)&&n?.(ti)},[t,n]),(0,F.jsxs)(`div`,{className:`space-y-5`,children:[(0,F.jsx)(Cn,{items:o,value:s,onChange:e=>n?.(e),idBase:`settings`}),s===`license`&&(0,F.jsx)(U,{panel:`LicensePanel`,slug:`license`,getModule:r,onSaved:e,icon:`KeyRound`,title:`License`,description:`Activate xSpeed Pro and manage automatic updates.`}),s===`branding`&&(0,F.jsx)(U,{slug:`white-label`,getModule:r,onSaved:e}),s===`multisite`&&(0,F.jsx)(U,{panel:`NetworkPanel`,slug:`multisite`,getModule:r,onSaved:e}),(0,F.jsx)(`div`,{className:`border border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 rounded-lg p-4 sm:p-5`,children:(0,F.jsx)($r,{active:!0})})]})}var ii=[{key:`coverage`,label:`What to cache`,locked:!0},{key:`beyond`,label:`Feeds & API`,locked:!0},{key:`rules`,label:`Rules & bypass`,locked:!0}],W=`coverage`,ai=new Set(ii.map(e=>e.key));function oi({getModule:e,onSaved:t,subtab:n,onSubtabChange:r}){let i=H(),a=i===`pro`||i===`trial`,o=ii.map(e=>({...e,locked:e.locked&&!a})),s=n&&ai.has(n)?n:W;return(0,y.useEffect)(()=>{n&&!ai.has(n)&&r?.(W)},[n,r]),(0,F.jsxs)(`div`,{className:`space-y-4`,children:[(0,F.jsx)(Cn,{items:o,value:s,onChange:e=>r?.(e),idBase:`cache-extras`}),s===`coverage`&&(a?(0,F.jsxs)(`div`,{className:`space-y-4`,children:[(0,F.jsx)(U,{slug:`cache-404`,getModule:e,onSaved:t}),(0,F.jsx)(U,{slug:`search-cache`,getModule:e,onSaved:t})]}):(0,F.jsx)(Ln,{id:`coverage-what`})),s===`beyond`&&(a?(0,F.jsxs)(`div`,{className:`space-y-4`,children:[(0,F.jsx)(U,{slug:`feed-cache`,getModule:e,onSaved:t}),(0,F.jsx)(U,{panel:`RestCachePanel`,slug:`rest-cache`,getModule:e,onSaved:t})]}):(0,F.jsx)(Ln,{id:`coverage-beyond`})),s===`rules`&&(a?(0,F.jsxs)(`div`,{className:`space-y-4`,children:[(0,F.jsx)(U,{panel:`CustomRulesPanel`,slug:`custom-rules`,getModule:e,onSaved:t}),(0,F.jsx)(U,{panel:`MaintenanceCachePanel`,slug:`maintenance-cache`,getModule:e,onSaved:t})]}):(0,F.jsx)(Ln,{id:`coverage-rules`}))]})}function si({onSaved:e,subtab:t,onSubtabChange:n,getModule:r}){return(0,F.jsx)(oi,{getModule:e=>r?.(e),subtab:t,onSubtabChange:n,onSaved:e})}var ci={HealthPanel:er,PreloaderHost:mr,DatabaseCleanerPanel:gr,CloudflarePanel:Cr,ObjectCachePanel:Dr,MigrationPanel:zr,SupportPanel:Br,McpPanel:Wr,CompressionPanel:Kr,CssJsPanel:Jr,MediaPanel:Xr,ResourceHintsPanel:Qr,SettingsPanel:ri,CacheCoveragePanel:si,ScorePanel:Xn},li=`admin.php?page=xspeed#license`;function ui({module:e}){let t=It.find(t=>t.slug===e.slug),n=t?.teaser?jn[t.teaser]:null,r=kn()===`unlicensed`;if(Fn(e.slug))return(0,F.jsxs)(`div`,{className:`space-y-4`,children:[(0,F.jsx)(Ln,{id:e.slug}),(0,F.jsx)(`div`,{className:`text-[12px] text-neutral-500 dark:text-neutral-400 text-center px-4`,children:L(r?`Activating your license unlocks this module + every other locked row in the sidebar. Your current settings stay unchanged.`:`Pro unlocks this module + every other locked row in the sidebar. Your current Free settings stay unchanged.`)})]});let i=r?{card:`border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900`,iconWrap:`bg-blue-50 dark:bg-blue-950/40 border-blue-100 dark:border-blue-900/50 text-blue-600 dark:text-blue-400`,badge:`text-blue-700 dark:text-blue-300 bg-blue-50 dark:bg-blue-950/40 border-blue-100 dark:border-blue-900/50`,cta:`bg-blue-600 hover:bg-blue-700 dark:bg-blue-500 dark:hover:bg-blue-400 text-white`,link:`text-blue-700 dark:text-blue-300`}:{card:`border-amber-200 dark:border-amber-900/60 bg-amber-50/60 dark:bg-amber-950/20`,iconWrap:`bg-amber-100 dark:bg-amber-950/60 border-amber-200 dark:border-amber-900/60 text-amber-600 dark:text-amber-400`,badge:`text-amber-700 dark:text-amber-300 bg-amber-100 dark:bg-amber-950/60 border-amber-200 dark:border-amber-900/60`,cta:`bg-amber-600 hover:bg-amber-700 dark:bg-amber-500 dark:hover:bg-amber-400 text-white dark:text-neutral-900`,link:`text-amber-700 dark:text-amber-300`};return(0,F.jsxs)(`div`,{className:`space-y-4`,children:[(0,F.jsx)(`div`,{className:`relative overflow-hidden border rounded-lg p-6 sm:p-8 ${i.card}`,children:(0,F.jsxs)(`div`,{className:`flex items-start gap-4`,children:[(0,F.jsx)(`div`,{className:`shrink-0 w-12 h-12 rounded-full border flex items-center justify-center ${i.iconWrap}`,children:(0,F.jsx)(yt,{name:e.icon,size:22})}),(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsx)(`div`,{className:`flex items-center gap-2 mb-1`,children:(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[10px] uppercase tracking-wider font-medium border rounded-full px-2 py-0.5 ${i.badge}`,children:[r?(0,F.jsx)(Ee,{size:10}):(0,F.jsx)(se,{size:10}),(0,F.jsx)(`span`,{children:L(r?`Pro — license needed`:`Pro feature`)})]})}),(0,F.jsx)(`h2`,{className:`text-[18px] font-semibold text-neutral-900 dark:text-neutral-50`,children:e.label}),e.description&&(0,F.jsx)(`p`,{className:`text-[13px] text-neutral-600 dark:text-neutral-300 mt-2 leading-relaxed`,children:e.description}),r?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`p`,{className:`text-[13px] text-neutral-600 dark:text-neutral-300 mt-3 leading-relaxed`,children:L(`xSpeed Pro is installed — activate your license to unlock this module and every other Pro feature.`)}),(0,F.jsxs)(`a`,{href:li,className:`inline-flex items-center gap-1.5 mt-4 px-4 py-2 rounded-md text-[13px] font-medium transition-colors ${i.cta}`,children:[L(`Activate your license`),(0,F.jsx)(C,{size:13})]})]}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`a`,{href:An,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1.5 mt-4 px-4 py-2 rounded-md text-[13px] font-medium transition-colors ${i.cta}`,children:[L(`Upgrade to Pro`),(0,F.jsx)(C,{size:13})]}),(0,F.jsxs)(`a`,{href:An,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 ml-3 text-[12px] hover:underline ${i.link}`,children:[L(`Compare plans`),(0,F.jsx)(ue,{size:11})]})]})]})]})}),n&&(0,F.jsxs)(`div`,{className:`border border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 rounded-lg p-4 sm:p-5`,children:[(0,F.jsx)(`div`,{className:`text-[11px] uppercase tracking-wider text-neutral-500 dark:text-neutral-400 font-medium mb-2`,children:L(`What this adds`)}),(0,F.jsx)(`p`,{className:`text-[13px] text-neutral-700 dark:text-neutral-300 leading-relaxed`,children:n.body})]}),(0,F.jsx)(`div`,{className:`text-[12px] text-neutral-500 dark:text-neutral-400 text-center px-4`,children:L(r?`Activating your license unlocks this module + every other locked row in the sidebar. Your current settings stay unchanged.`:`Pro unlocks this module + every other locked row in the sidebar. Your current Free settings stay unchanged.`)})]})}var di=null,fi=new Set;function pi(){for(let e of fi)e(di)}function mi(e){di=e,pi()}function hi(){return di}function gi(e,t){e&&t&&(di?.module!==e||di?.field!==t)||(di=null,pi())}function _i(e){return fi.add(e),()=>{fi.delete(e)}}function vi(e,t){switch(t){case`bool`:case`boolean`:return e===`1`||e===`true`?!0:e===`0`||e===`false`?!1:void 0;case`int`:return/^-?\d+$/.test(e.trim())?parseInt(e,10):void 0;case`list`:return e.split(`,`).map(e=>e.trim()).filter(Boolean);default:return e}}function yi(e,t){let n=vi(e,t);return n===void 0?e:typeof n==`boolean`?n?`On`:`Off`:Array.isArray(n)?n.join(`, `):String(n)}function bi(e,t,n,r,i){let[a,o]=(0,y.useState)(()=>hi());if((0,y.useEffect)(()=>_i(o),[]),!a||a.module!==e||a.field!==t)return null;let s=vi(a.value,n.type);if(s===void 0||!xi(s,n)||JSON.stringify(s)===JSON.stringify(r))return null;let c=yi(a.value,n.type);return c.trim()===``?null:{display:c,value:s,apply:()=>{i(s),gi(e,t)},dismiss:()=>gi(e,t)}}function xi(e,t){if(t.type===`int`)return!(typeof e!=`number`||t.min!==void 0&&e<t.min||t.max!==void 0&&e>t.max);if(t.type===`enum`){let n=Array.isArray(t.options)?t.options:[];return n.length>0&&n.includes(String(e))}if(t.type===`list`)return Array.isArray(e)&&e.length>0;if(t.type===`url`){let t=String(e??``).trim();return t!==``&&/^https?:\/\//i.test(t)}return!0}function Si({strip:e}){return(0,F.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 rounded border border-amber-200 dark:border-amber-900/60 bg-amber-50 dark:bg-amber-950/40 px-2.5 py-1.5`,children:[(0,F.jsx)(Ae,{size:13,className:`text-amber-600 dark:text-amber-400 shrink-0`}),(0,F.jsxs)(`span`,{className:`text-[12px] text-amber-900 dark:text-amber-200`,children:[L(`Recommended:`),` `,(0,F.jsx)(`span`,{className:`font-medium`,children:e.display})]}),(0,F.jsxs)(`button`,{type:`button`,onClick:e.apply,className:`ml-auto inline-flex items-center gap-1 text-[12px] px-2 py-1 rounded bg-accent text-white hover:bg-blue-700 transition-colors`,children:[(0,F.jsx)(D,{size:12}),L(`Apply`)]}),(0,F.jsx)(`button`,{type:`button`,onClick:e.dismiss,className:`text-[12px] text-amber-800 dark:text-amber-300 hover:underline`,children:L(`Dismiss`)})]})}function Ci({module:e,onSaved:t,subtab:n,onSubtabChange:r,getModule:i}){if(Yt(),e.locked)return(0,F.jsx)(ui,{module:e});if(e.custom_panel){let a={onSaved:t,subtab:n,onSubtabChange:r,getModule:i},o=ci[e.custom_panel];if(o)return(0,F.jsx)(o,{module:e,...a});let s=qt(e.custom_panel);if(s)return(0,F.jsx)(s,{module:e,...a})}return(0,F.jsx)(wi,{module:e,onSaved:t})}function wi({module:e,onSaved:t}){let[n,r]=(0,y.useState)(e.settings),[i,a]=(0,y.useState)(`idle`),[o,s]=(0,y.useState)(null),c=(0,y.useRef)(!0),l=(0,y.useRef)(null),u=(0,y.useRef)(null),d=(0,y.useRef)(JSON.stringify(e.settings)),f=(0,y.useRef)(`idle`);(0,y.useEffect)(()=>{f.current=i},[i]);let p=(0,y.useRef)(n);(0,y.useEffect)(()=>{p.current=n},[n]),(0,y.useEffect)(()=>{r(e.settings),d.current=JSON.stringify(e.settings),c.current=!0,a(`idle`),s(null)},[e.slug]),(0,y.useEffect)(()=>{if(c.current){c.current=!1;return}if(JSON.stringify(n)!==d.current)return l.current&&window.clearTimeout(l.current),l.current=window.setTimeout(async()=>{f.current!==`saved`&&a(`saving`),s(null);let i=n;try{let n=await V.updateModuleSettings(e.slug,i),{next:o,dirty:s}=ir(i,n,p.current);r(o),d.current=s?``:JSON.stringify(o),a(`saved`),u.current&&window.clearTimeout(u.current),u.current=window.setTimeout(()=>a(`idle`),1500),t?.(n)}catch(e){s(e instanceof Error?e.message:`Save failed`),a(`idle`)}},600),()=>{l.current&&window.clearTimeout(l.current)}},[n,e.slug]);let m=Sr(e.schema,n),h=(e,t)=>r(n=>({...n,[e]:t})),g=e.notices??[];return(0,F.jsxs)(`div`,{className:`space-y-4`,children:[(0,F.jsx)(tr,{state:i}),g.map((e,t)=>(0,F.jsx)(z,{tone:e.tone,title:e.title,body:e.body,snippet:e.snippet,action:e.action},t)),(0,F.jsx)(`div`,{className:`border border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 rounded-lg overflow-hidden`,children:m.map(([t,r],i)=>(0,F.jsx)(Ti,{moduleSlug:e.slug,fieldKey:t,spec:r,value:n[t],onChange:e=>h(t,e),first:i===0},t))}),o&&(0,F.jsx)(`div`,{className:`text-[12px] text-red-600 dark:text-red-400`,children:o})]})}function Ti({moduleSlug:e,fieldKey:t,spec:n,value:r,onChange:i,first:a}){let o=n.label??Di(t),s=`${e}:${t}`,c=bi(e,t,n,r,i),l=n.description,u=n.type===`int`&&(n.min!==void 0||n.max!==void 0)?`Range: ${n.min??`-∞`} – ${n.max??`∞`}`:null,d=n.type===`list`,f=a?``:`border-t border-neutral-200 dark:border-neutral-800`;return d?(0,F.jsxs)(`div`,{"data-field-anchor":s,className:`xspeed-field px-4 sm:px-5 py-4 ${f}`,children:[(0,F.jsxs)(`div`,{className:`mb-1.5`,children:[(0,F.jsxs)(`div`,{className:`font-medium text-neutral-900 dark:text-neutral-50 inline-flex items-center gap-1.5`,children:[(0,F.jsx)(`span`,{children:o}),n.info&&(0,F.jsx)(fn,{title:n.info_title,body:n.info})]}),l&&(0,F.jsx)(`div`,{className:`text-[12px] text-neutral-500 dark:text-neutral-400 mt-0.5`,children:l})]}),Ei(n,r,i,o),c&&(0,F.jsx)(Si,{strip:c})]}):(0,F.jsxs)(`div`,{"data-field-anchor":s,className:`xspeed-field px-4 sm:px-5 py-4 ${f}`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-3 sm:gap-4`,children:[(0,F.jsxs)(`div`,{className:`min-w-0 max-w-[70%] pr-2`,children:[(0,F.jsxs)(`div`,{className:`font-medium text-neutral-900 dark:text-neutral-50 inline-flex items-center gap-1.5`,children:[(0,F.jsx)(`span`,{children:o}),n.info&&(0,F.jsx)(fn,{title:n.info_title,body:n.info})]}),l&&(0,F.jsx)(`div`,{className:`text-[12px] text-neutral-500 dark:text-neutral-400 mt-0.5`,children:l}),!l&&u&&(0,F.jsx)(`div`,{className:`text-[12px] text-neutral-500 dark:text-neutral-400 mt-0.5`,children:u})]}),(0,F.jsx)(`div`,{className:`shrink-0`,children:Ei(n,r,i,o)})]}),c&&(0,F.jsx)(Si,{strip:c})]})}function Ei(e,t,n,r){switch(e.type){case`bool`:return(0,F.jsx)(an,{checked:!!t,onChange:e=>n(e),label:r});case`int`:return(0,F.jsx)(`input`,{type:`number`,value:t==null?``:Number(t),min:e.min,max:e.max,onChange:e=>n(Number(e.target.value)),className:`w-24 text-right`,"aria-label":r});case`enum`:return(0,F.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:(e.options??[]).map(r=>{let i=t===r,a=e.option_labels?.[r]??Di(r);return(0,F.jsx)(`button`,{type:`button`,onClick:()=>n(r),className:`text-[12px] px-2.5 py-1 rounded border transition-colors ${i?`bg-accent border-accent text-white`:`border-neutral-200 dark:border-neutral-700 text-neutral-700 dark:text-neutral-300 hover:bg-neutral-50 dark:hover:bg-neutral-800`}`,children:a},r)})});case`string`:case`url`:return(0,F.jsx)(`input`,{type:e.type===`url`?`url`:`text`,value:t==null?``:String(t),onChange:e=>n(e.target.value),className:`w-56`,"aria-label":r});case`media`:return(0,F.jsx)(dn,{value:t==null?``:String(t),onChange:e=>n(e),label:r});case`list`:return(0,F.jsx)(`textarea`,{value:Array.isArray(t)?t.map(String).join(` |
| 11 |
`).length;return(0,F.jsxs)(`section`,{"data-field-anchor":`cache:nginx_snippet`,className:`xspeed-field border border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 rounded-lg overflow-hidden`,children:[(0,F.jsxs)(`div`,{className:`flex items-start gap-2.5 p-4 sm:p-5`,children:[(0,F.jsx)(`button`,{type:`button`,onClick:i,"aria-expanded":n?`true`:`false`,"aria-label":n?`Collapse server config`:`Expand server config`,className:`shrink-0 mt-0.5 text-neutral-500 dark:text-neutral-400 hover:text-neutral-700 dark:hover:text-neutral-200 transition-colors focus:outline-none`,children:n?(0,F.jsx)(ne,{size:16}):(0,F.jsx)(re,{size:16})}),(0,F.jsx)(Ke,{size:16,className:`shrink-0 mt-0.5 text-neutral-500 dark:text-neutral-400`}),(0,F.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,F.jsxs)(`h2`,{className:`inline-flex items-center gap-1.5 text-[13px] font-semibold text-neutral-900 dark:text-neutral-50`,children:[(0,F.jsxs)(`span`,{children:[`Server config `,(0,F.jsxs)(`span`,{className:`text-neutral-400 dark:text-neutral-500 font-normal`,children:[`· `,o,` lines`]})]}),(0,F.jsx)(fn,{title:`Good to know`,body:`You added this snippet to your nginx config yourself, so it's yours to manage — xSpeed never touches it. If you ever need to uninstall xSpeed, just remove this snippet from your nginx config first to keep everything tidy and your server running happily.`})]}),(0,F.jsxs)(`p`,{className:`text-[12px] text-neutral-500 dark:text-neutral-400 mt-0.5`,children:[`Paste this once into `,a,`, above the `,(0,F.jsx)(`code`,{className:`text-[11px]`,children:`location /`}),` block, then reload nginx.`]})]})]}),n&&(0,F.jsx)(`div`,{className:`px-4 pb-4 sm:px-5 sm:pb-5`,children:(0,F.jsx)(hn,{content:e,tone:`neutral`})})]})}function Ni({label:e,value:t,icon:n,onClick:r,expanded:i,hint:a}){let o=(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,F.jsx)(`div`,{className:`text-[11px] uppercase tracking-wider text-neutral-500 dark:text-neutral-400 font-medium`,children:e}),r?(0,F.jsx)(ne,{size:14,className:`text-neutral-400 dark:text-neutral-500 transition-transform ${i?`rotate-180`:``}`}):n&&(0,F.jsx)(n,{size:14,className:`text-neutral-400 dark:text-neutral-500`})]}),(0,F.jsx)(`div`,{className:`text-[22px] font-semibold text-neutral-900 dark:text-neutral-50 leading-none`,children:t})]}),s=`border bg-white dark:bg-neutral-900 rounded-lg p-5 text-left w-full transition-colors`;return r?(0,F.jsx)(`button`,{type:`button`,onClick:r,"aria-expanded":i??!1,"aria-label":a?`${e} — ${a}`:e,className:`${s} cursor-pointer hover:border-neutral-300 dark:hover:border-neutral-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent ${i?`border-accent dark:border-accent`:`border-neutral-200 dark:border-neutral-800`}`,children:o}):(0,F.jsx)(`div`,{className:`${s} border-neutral-200 dark:border-neutral-800`,children:o})}function Pi(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(2)} MB`}function Fi(e){return e<60?`${e}s`:e<3600?`${Math.floor(e/60)}m`:e<86400?`${Math.floor(e/3600)}h`:`${Math.floor(e/86400)}d`}function Ii({title:e,busy:t,onRefresh:n,children:r}){return(0,F.jsxs)(`div`,{className:`border border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 rounded-lg p-4 sm:p-5`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,F.jsx)(`div`,{className:`text-[12px] font-medium text-neutral-900 dark:text-neutral-50`,children:e}),(0,F.jsx)(`button`,{type:`button`,onClick:n,disabled:t,"aria-label":L(`Refresh`),className:`text-neutral-400 dark:text-neutral-500 hover:text-neutral-700 dark:hover:text-neutral-300 disabled:opacity-40`,children:(0,F.jsx)(P,{size:13,className:t?`animate-spin`:``})})]}),r]})}function Li({text:e}){return(0,F.jsx)(`div`,{className:`text-[12px] text-neutral-500 dark:text-neutral-400 py-2`,children:e})}function Ri(){let[e,t]=(0,y.useState)(null),[n,r]=(0,y.useState)(!1),i=async(e=!1)=>{r(!0);try{t(await V.request(`/cache/inventory?limit=50${e?`&fresh=1`:``}`))}catch{t({entries:[],total:0,capped:!1})}finally{r(!1)}};return(0,y.useEffect)(()=>{i()},[]),(0,F.jsx)(Ii,{title:L(`Cached pages`),busy:n,onRefresh:()=>void i(!0),children:e?e.entries.length===0?(0,F.jsx)(Li,{text:L(`Nothing cached yet. Visit a page as a logged-out visitor to warm the cache.`)}):(0,F.jsxs)(F.Fragment,{children:[e.capped&&(0,F.jsxs)(`div`,{className:`flex items-start gap-2 mb-3 text-[11px] text-amber-700 dark:text-amber-400`,children:[(0,F.jsx)(ot,{size:12,className:`mt-0.5 shrink-0`}),(0,F.jsx)(`span`,{children:L(`This cache is large enough that the scan stopped early — the list below is a recent sample, not every page.`)})]}),(0,F.jsx)(`div`,{className:`overflow-x-auto`,children:(0,F.jsxs)(`table`,{className:`w-full text-[12px]`,children:[(0,F.jsx)(`thead`,{children:(0,F.jsxs)(`tr`,{className:`text-[11px] uppercase tracking-wider text-neutral-500 dark:text-neutral-400`,children:[(0,F.jsx)(`th`,{className:`text-left font-medium pb-2`,children:L(`Page`)}),(0,F.jsx)(`th`,{className:`text-right font-medium pb-2 whitespace-nowrap`,children:L(`Size`)}),(0,F.jsx)(`th`,{className:`text-right font-medium pb-2 whitespace-nowrap`,children:L(`Age`)}),(0,F.jsx)(`th`,{className:`text-right font-medium pb-2 whitespace-nowrap`,children:L(`Stored`)})]})}),(0,F.jsx)(`tbody`,{children:e.entries.map(e=>(0,F.jsxs)(`tr`,{className:`border-t border-neutral-100 dark:border-neutral-800`,children:[(0,F.jsx)(`td`,{className:`py-1.5 pr-3 max-w-0`,children:e.url?(0,F.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-neutral-800 dark:text-neutral-200 hover:underline inline-flex items-center gap-1 truncate max-w-full`,children:[(0,F.jsx)(`span`,{className:`truncate`,children:e.url}),(0,F.jsx)(ue,{size:10,className:`shrink-0 opacity-60`})]}):(0,F.jsx)(`span`,{className:`text-neutral-500 dark:text-neutral-400 font-mono text-[11px]`,title:e.key,children:L(`Address not recorded`)})}),(0,F.jsx)(`td`,{className:`py-1.5 text-right tabular-nums text-neutral-600 dark:text-neutral-400 whitespace-nowrap`,children:Pi(e.bytes)}),(0,F.jsx)(`td`,{className:`py-1.5 pl-3 text-right tabular-nums text-neutral-600 dark:text-neutral-400 whitespace-nowrap`,children:Fi(e.age)}),(0,F.jsx)(`td`,{className:`py-1.5 pl-3 text-right text-[11px] text-neutral-500 dark:text-neutral-400 whitespace-nowrap`,children:e.stored_in.join(` + `)})]},e.url??e.key))})]})}),(0,F.jsxs)(`div`,{className:`mt-2 text-[11px] text-neutral-500 dark:text-neutral-400`,children:[L(`Showing`),` `,e.entries.length,` `,L(`of`),` `,e.total]})]}):(0,F.jsx)(Li,{text:L(`Loading…`)})})}function zi(){let[e,t]=(0,y.useState)(null),[n,r]=(0,y.useState)(!1),i=async()=>{r(!0);try{t(await V.request(`/cache/size`))}catch{t(null)}finally{r(!1)}};(0,y.useEffect)(()=>{i()},[]);let a=e?.buckets.filter(e=>e.files>0)??[],o=a.reduce((e,t)=>Math.max(e,t.bytes),0);return(0,F.jsx)(Ii,{title:L(`Where the cache size goes`),busy:n,onRefresh:()=>void i(),children:e?a.length===0?(0,F.jsx)(Li,{text:L(`Nothing on disk yet.`)}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`div`,{className:`space-y-2`,children:a.map(e=>(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`div`,{className:`flex items-baseline justify-between text-[12px]`,children:[(0,F.jsx)(`span`,{className:`text-neutral-700 dark:text-neutral-300`,children:e.label}),(0,F.jsxs)(`span`,{className:`tabular-nums text-neutral-600 dark:text-neutral-400`,children:[Pi(e.bytes),(0,F.jsxs)(`span`,{className:`text-neutral-400 dark:text-neutral-500`,children:[` · `,e.files]})]})]}),(0,F.jsx)(`div`,{className:`mt-1 h-1.5 rounded-full bg-neutral-100 dark:bg-neutral-800 overflow-hidden`,children:(0,F.jsx)(`div`,{className:`h-full rounded-full bg-accent`,style:{width:o>0?`${Math.max(2,e.bytes/o*100)}%`:`0%`}})})]},e.key))}),e.compressed_bytes>0&&(0,F.jsxs)(`div`,{className:`mt-3 text-[11px] text-neutral-500 dark:text-neutral-400`,children:[L(`Precompressed copies on disk:`),` `,Pi(e.compressed_bytes),`.`,` `,L(`Pages without one are compressed by the server when requested.`)]})]}):(0,F.jsx)(Li,{text:L(`Loading…`)})})}function Bi(){let[e,t]=(0,y.useState)(null),[n,r]=(0,y.useState)(!1),i=async()=>{r(!0);try{t(await V.request(`/cache/purge-log?limit=25`))}catch{t({events:[],last_purge:0})}finally{r(!1)}};(0,y.useEffect)(()=>{i()},[]);let a=Math.floor(Date.now()/1e3);return(0,F.jsx)(Ii,{title:L(`Purge history`),busy:n,onRefresh:()=>void i(),children:e?e.events.length===0?(0,F.jsx)(Li,{text:L(`No purges recorded yet.`)}):(0,F.jsx)(`ul`,{className:`space-y-1.5`,children:e.events.map((e,t)=>(0,F.jsxs)(`li`,{className:`flex items-baseline gap-3 text-[12px] border-t border-neutral-100 dark:border-neutral-800 first:border-t-0 pt-1.5 first:pt-0`,children:[(0,F.jsx)(`span`,{className:`tabular-nums text-[11px] text-neutral-500 dark:text-neutral-400 w-12 shrink-0`,children:Fi(Math.max(0,a-e.ts))}),(0,F.jsx)(`span`,{className:`text-neutral-700 dark:text-neutral-300`,children:e.message})]},`${e.ts}-${t}`))}):(0,F.jsx)(Li,{text:L(`Loading…`)})})}function Vi({which:e}){return e===`pages`?(0,F.jsx)(Ri,{}):e===`size`?(0,F.jsx)(zi,{}):e===`purge`?(0,F.jsx)(Bi,{}):null}function Hi(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(2)} MB`}function Ui(e){return(e.hits_24h??0)+(e.misses_24h??0)===0?`—`:`${Math.round((e.hit_ratio??0)*100)}%`}function G(e){if(!e)return`Never`;let t=Math.floor(Date.now()/1e3)-e;return t<60?`${t}s ago`:t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}function K({settings:e,stats:t,onToggle:n,onPurge:r}){let[i,a]=(0,y.useState)(null),o=e=>a(t=>t===e?null:e);return(0,F.jsxs)(`div`,{className:`space-y-6`,children:[(0,F.jsxs)(`div`,{"data-field-anchor":`cache:cache_enabled`,className:`xspeed-field border border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 rounded-lg p-4 sm:p-5 flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,F.jsx)(`span`,{className:`w-2 h-2 rounded-full shrink-0 ${e.cache_enabled?`bg-emerald-500`:`bg-neutral-300 dark:bg-neutral-600`}`}),(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsx)(`div`,{className:`font-medium text-neutral-900 dark:text-neutral-50`,children:`Enable Cache`}),(0,F.jsx)(`div`,{className:`text-[12px] text-neutral-500 dark:text-neutral-400`,children:e.cache_enabled?`Active — serving cached HTML`:`Inactive`})]})]}),(0,F.jsxs)(`div`,{className:`flex items-center justify-end gap-3 shrink-0`,children:[(0,F.jsxs)(`button`,{type:`button`,onClick:r,className:`flex items-center gap-1.5 text-[13px] px-3 py-1.5 rounded border border-neutral-200 dark:border-neutral-700 text-neutral-700 dark:text-neutral-300 hover:bg-neutral-50 dark:hover:bg-neutral-800 transition-colors`,children:[(0,F.jsx)(it,{size:13}),`Purge`]}),(0,F.jsx)(an,{checked:e.cache_enabled,onChange:n,size:`lg`,label:`Enable Cache`})]})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-2 lg:grid-cols-4 gap-3 sm:gap-4`,children:[(0,F.jsx)(Ni,{label:`Cached Pages`,value:String(t.cached_pages),onClick:()=>o(`pages`),expanded:i===`pages`,hint:L(`show which pages are cached`)}),(0,F.jsx)(Ni,{label:`Cache Size`,value:Hi(t.cache_size),onClick:()=>o(`size`),expanded:i===`size`,hint:L(`show what is taking the space`)}),(0,F.jsx)(Ni,{label:`Last Purge`,value:G(t.last_purge),onClick:()=>o(`purge`),expanded:i===`purge`,hint:L(`show what cleared the cache and why`)}),(0,F.jsx)(Ni,{label:`Hit Ratio · 24h`,value:Ui(t),onClick:()=>{document.querySelector(`[data-xspeed-anchor="hit-trend"]`)?.scrollIntoView({block:`start`,behavior:`smooth`})},hint:L(`jump to the hit-ratio trend`)})]}),i&&(0,F.jsx)(Vi,{which:i})]})}function Wi(e){let t=e/1e3;return t<60?`${t.toFixed(1)}s`:t<3600?`${(t/60).toFixed(1)} ${L(`min`)}`:`${(t/3600).toFixed(1)} ${L(`hrs`)}`}function Gi({stats:e}){let[t,n]=(0,y.useState)(void 0),[r,i]=(0,y.useState)([]);if((0,y.useEffect)(()=>{(async()=>{try{let[e,t]=await Promise.all([V.request(`/cache/benchmark/history`),V.request(`/stats/hit-daily?days=30`)]),r=e.runs.filter(e=>e.cache_enabled&&e.savings_ms!=null&&e.savings_ms>0);n(r.length?r[r.length-1].savings_ms:null),i(t.days)}catch{n(null)}})()},[]),t===void 0)return null;let a=e.hits_24h??0;if(t===null||a===0)return(0,F.jsxs)(`div`,{className:`border border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 rounded-lg p-4 sm:p-5 flex items-center gap-3`,children:[(0,F.jsx)(rt,{size:18,className:`text-neutral-400 dark:text-neutral-500 shrink-0`}),(0,F.jsx)(`div`,{className:`text-[12px] text-neutral-500 dark:text-neutral-400`,children:L(t===null?`Run the benchmark once and this card shows how much combined wait time the cache saves your visitors.`:`Serving cached pages… impact numbers appear once today’s hits accumulate.`)})]});let o=e=>r.slice(-e).reduce((e,t)=>e+(t.hits??0),0),s=[{label:L(`last 24h`),hits:a},{label:L(`7 days`),hits:o(7)},{label:L(`30 days`),hits:o(30)}];return(0,F.jsxs)(`div`,{className:`border border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 rounded-lg p-4 sm:p-5`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,F.jsx)(pt,{size:16,className:`text-accent shrink-0`}),(0,F.jsx)(`span`,{className:`text-[11px] uppercase tracking-wider font-medium text-neutral-500 dark:text-neutral-400`,children:L(`Real visitor impact`)})]}),(0,F.jsxs)(`div`,{className:`text-neutral-900 dark:text-neutral-50`,children:[L(`xSpeed served`),` `,(0,F.jsx)(`span`,{className:`font-semibold tabular-nums`,children:a.toLocaleString()}),` `,L(`cached pages in 24h — saving your visitors`),` `,(0,F.jsx)(`span`,{className:`font-semibold text-emerald-600 dark:text-emerald-400 tabular-nums`,children:Wi(a*t)}),` `,L(`of combined wait time`),` `,(0,F.jsxs)(`span`,{className:`text-neutral-500 dark:text-neutral-400 text-[13px]`,children:[`(`,Math.round(t),`ms `,L(`faster per page`),`)`]})]}),(0,F.jsx)(`div`,{className:`flex flex-wrap gap-x-5 gap-y-1 mt-2 text-[12px] text-neutral-500 dark:text-neutral-400`,children:s.slice(1).map(e=>e.hits>0?(0,F.jsxs)(`span`,{children:[e.label,`:`,` `,(0,F.jsx)(`span`,{className:`tabular-nums text-neutral-700 dark:text-neutral-300 font-medium`,children:Wi(e.hits*t)}),` `,L(`saved across`),` `,e.hits.toLocaleString(),` `,L(`hits`)]},e.label):null)})]})}function Ki(){let[e,t]=(0,y.useState)(null),[n,r]=(0,y.useState)(!1),[i,a]=(0,y.useState)(!1),[o,s]=(0,y.useState)(null),c=(0,y.useCallback)(async()=>{try{t((await V.request(`/recommendations`)).recommendations)}catch{t([])}},[]);(0,y.useEffect)(()=>{c()},[c]);let l=e?.[0];return e===null?null:l?(0,F.jsx)(`div`,{className:`border border-amber-200 dark:border-amber-900/60 bg-amber-50 dark:bg-amber-950/40 rounded-lg p-4 sm:p-5`,children:(0,F.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-center gap-3 sm:gap-4`,children:[(0,F.jsx)(Ae,{size:18,className:`text-amber-600 dark:text-amber-300 shrink-0 hidden sm:block`}),(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsxs)(`div`,{className:`text-[11px] uppercase tracking-wider font-medium text-amber-700 dark:text-amber-300 mb-0.5`,children:[L(`Next best action`),e.length>1&&(0,F.jsxs)(`span`,{className:`normal-case tracking-normal font-normal`,children:[` `,`· `,e.length-1,` `,L(`more after this`)]})]}),(0,F.jsx)(`div`,{className:`font-medium text-neutral-900 dark:text-neutral-50`,children:l.title}),(0,F.jsx)(`div`,{className:`text-[12px] text-amber-900/80 dark:text-amber-200/80 mt-0.5`,children:l.detail}),o&&(0,F.jsx)(`div`,{className:`text-[12px] text-red-700 dark:text-red-300 mt-1`,children:o})]}),(0,F.jsx)(`div`,{className:`shrink-0`,children:l.action.type===`apply`?(0,F.jsxs)(`button`,{type:`button`,onClick:async()=>{if(l){r(!0),s(null);try{let e=await V.request(`/recommendations/apply`,{method:`POST`,body:JSON.stringify({id:l.id})});a(!0),setTimeout(()=>{a(!1),t(e.recommendations)},1600)}catch(e){s(e instanceof Error?e.message:L(`Could not apply the fix.`))}finally{r(!1)}}},disabled:n||i,className:`flex items-center gap-1.5 text-[13px] px-3 py-1.5 rounded bg-accent text-white hover:bg-blue-700 transition-colors disabled:opacity-60`,children:[n?(0,F.jsx)(P,{size:13,className:`animate-spin`}):i?(0,F.jsx)(D,{size:13}):null,i?L(`Applied`):l.action.label]}):(0,F.jsxs)(`a`,{href:l.action.module?on({module:l.action.module,subtab:l.action.subtab,focus:l.action.focus,suggest:l.action.suggest}):`#`,className:`flex items-center gap-1.5 text-[13px] px-3 py-1.5 rounded border border-amber-300 dark:border-amber-800 text-amber-800 dark:text-amber-200 hover:bg-amber-100 dark:hover:bg-amber-900/40 transition-colors`,children:[l.action.label,` `,(0,F.jsx)(C,{size:13})]})})]})}):(0,F.jsxs)(`div`,{className:`border border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 rounded-lg p-4 sm:p-5 flex items-center gap-3`,children:[(0,F.jsx)(ie,{size:18,className:`text-emerald-500 shrink-0`}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`font-medium text-neutral-900 dark:text-neutral-50`,children:L(`No recommendations right now`)}),(0,F.jsx)(`div`,{className:`text-[12px] text-neutral-500 dark:text-neutral-400`,children:L(`Every deterministic check passes — your configuration looks healthy.`)})]})]})}function qi({compact:e=!1}){let[t,n]=(0,y.useState)(null),[r,i]=(0,y.useState)(!1),[a,o]=(0,y.useState)(null);return(0,F.jsxs)(`div`,{className:`border border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 rounded-lg p-4 sm:p-5`,children:[(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 mb-3`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,F.jsx)(pt,{size:18,className:`text-accent shrink-0`}),(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsx)(`div`,{className:`font-medium text-neutral-900 dark:text-neutral-50`,children:L(`Cache impact benchmark`)}),(0,F.jsx)(`div`,{className:`text-[12px] text-neutral-500 dark:text-neutral-400`,children:L(`Compare your homepage with and without cache.`)})]})]}),(0,F.jsxs)(`button`,{type:`button`,onClick:async()=>{i(!0),o(null);try{n(await V.request(`/cache/benchmark`))}catch(e){o(e instanceof Error?e.message:L(`Benchmark failed`))}finally{i(!1)}},disabled:r,className:`flex items-center gap-1.5 text-[13px] px-3 py-1.5 rounded bg-accent text-white hover:bg-blue-700 transition-colors disabled:opacity-40 disabled:cursor-not-allowed`,children:[r?(0,F.jsx)(P,{size:13,className:`animate-spin`}):(0,F.jsx)(pt,{size:13}),L(t?`Re-run`:`Run benchmark`)]})]}),a&&(0,F.jsxs)(`div`,{className:`text-[13px] text-red-700 dark:text-red-300 bg-red-50 dark:bg-red-950/40 border border-red-200 dark:border-red-900/60 rounded p-2.5 flex items-start gap-2 mb-3`,children:[(0,F.jsx)(j,{size:14,className:`shrink-0 mt-0.5`}),a]}),t&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,F.jsx)(Ji,{label:L(`Without cache`),tone:`warn`,ms:t.without_cache.time_ms,bytes:t.without_cache.bytes}),(0,F.jsx)(Ji,{label:L(`With cache`),tone:`ok`,ms:t.with_cache.time_ms,bytes:t.with_cache.bytes})]}),t.savings_pct!==null&&t.savings_ms!==null&&(0,F.jsx)(`div`,{className:`mt-3 text-center text-[13px]`,children:t.savings_pct>5?(0,F.jsxs)(`span`,{className:`text-emerald-700 dark:text-emerald-300 font-medium`,children:[`⚡ `,L(`Cache is`),` `,(0,F.jsxs)(`span`,{className:`tabular-nums`,children:[t.savings_pct.toFixed(0),`%`]}),` `,L(`faster`),` `,`(`,t.savings_ms.toFixed(0),` ms `,L(`saved per request`),`)`]}):(0,F.jsx)(`span`,{className:`text-neutral-500 dark:text-neutral-400`,children:L(`Negligible difference — page is cheap to render or cache is cold.`)})}),!t.cache_enabled&&(0,F.jsx)(`div`,{className:`mt-3 text-[12px] text-amber-700 dark:text-amber-300 text-center`,children:L(`Cache is disabled — both runs hit the same uncached path. Enable Cache to see a real difference.`)}),!e&&(0,F.jsx)(`div`,{className:`mt-3 text-[11px] text-neutral-400 text-center font-mono truncate`,children:t.url})]}),!t&&!r&&!a&&(0,F.jsx)(`div`,{className:`text-[12px] text-neutral-500 dark:text-neutral-400 text-center py-3`,children:L(`Click "Run benchmark" to compare load times.`)})]})}function Ji({label:e,tone:t,ms:n,bytes:r}){return(0,F.jsxs)(`div`,{className:`border border-neutral-200 dark:border-neutral-800 rounded p-3`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2 mb-2`,children:[(0,F.jsx)(`span`,{className:`w-2 h-2 rounded-full ${t===`ok`?`bg-emerald-500`:`bg-amber-500`}`}),(0,F.jsx)(`span`,{className:`text-[11px] uppercase tracking-wider text-neutral-500 dark:text-neutral-400 font-medium`,children:e})]}),(0,F.jsxs)(`div`,{className:`text-2xl font-semibold tabular-nums ${t===`ok`?`text-emerald-600 dark:text-emerald-400`:`text-amber-600 dark:text-amber-400`}`,children:[Math.round(n),(0,F.jsx)(`span`,{className:`text-[13px] font-normal text-neutral-500 dark:text-neutral-400 ml-1`,children:`ms`})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2 mt-2 text-[11px] text-neutral-500 dark:text-neutral-400`,children:[(0,F.jsx)(M,{size:11}),(0,F.jsxs)(`span`,{className:`tabular-nums`,children:[Math.round(n),` ms`]}),(0,F.jsx)(`span`,{className:`text-neutral-300 dark:text-neutral-700`,children:`·`}),(0,F.jsx)(ce,{size:11}),(0,F.jsxs)(`span`,{className:`tabular-nums`,children:[(r/1024).toFixed(1),` KB`]})]})]})}function Yi(){let[e,t]=(0,y.useState)(null),[n,r]=(0,y.useState)(null),[i,a]=(0,y.useState)([]),[o,s]=(0,y.useState)(30),[c,l]=(0,y.useState)(!1),u=async()=>{l(!0);try{let[e,n]=await Promise.all([V.request(`/stats/hit-daily?days=30`),V.request(`/cache/benchmark/history`)]);t(e.days),r(n.runs),a(e.changes.length?e.changes:n.changes)}catch{t([]),r([])}finally{l(!1)}};(0,y.useEffect)(()=>{u()},[]);let d=(e??[]).slice(-o),f=d.length>=2,p=(n??[]).length>=2;return(0,F.jsxs)(`div`,{"data-xspeed-anchor":`hit-trend`,className:`border border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 rounded-lg p-4 sm:p-5 scroll-mt-6`,children:[(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 mb-3`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,F.jsx)(at,{size:18,className:`text-accent shrink-0`}),(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsx)(`div`,{className:`font-medium text-neutral-900 dark:text-neutral-50`,children:L(`Trends`)}),(0,F.jsx)(`div`,{className:`text-[12px] text-neutral-500 dark:text-neutral-400`,children:L(`Hit ratio and benchmark history, with your settings changes marked.`)})]})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(`div`,{className:`flex rounded border border-neutral-200 dark:border-neutral-700 overflow-hidden text-[12px]`,children:[7,30].map(e=>(0,F.jsxs)(`button`,{type:`button`,onClick:()=>s(e),className:o===e?`px-2.5 py-1 bg-accent text-white`:`px-2.5 py-1 text-neutral-600 dark:text-neutral-300 hover:bg-neutral-50 dark:hover:bg-neutral-800`,children:[e,`d`]},e))}),(0,F.jsx)(`button`,{type:`button`,onClick:u,disabled:c,"aria-label":L(`Refresh trends`),className:`p-1.5 rounded border border-neutral-200 dark:border-neutral-700 text-neutral-500 dark:text-neutral-400 hover:bg-neutral-50 dark:hover:bg-neutral-800 disabled:opacity-40`,children:(0,F.jsx)(P,{size:13,className:c?`animate-spin`:``})})]})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-3`,children:[(0,F.jsxs)(`div`,{className:`border border-neutral-200 dark:border-neutral-800 rounded p-3`,children:[(0,F.jsxs)(`div`,{className:`text-[11px] uppercase tracking-wider text-neutral-500 dark:text-neutral-400 font-medium mb-2`,children:[L(`Hit ratio`),` · `,o,`d`]}),f?(0,F.jsx)(ta,{rows:d,changes:i}):(0,F.jsx)(ra,{text:L(`Trends appear after a couple of days of traffic. The daily series is being collected now.`)})]}),(0,F.jsxs)(`div`,{className:`border border-neutral-200 dark:border-neutral-800 rounded p-3`,children:[(0,F.jsx)(`div`,{className:`text-[11px] uppercase tracking-wider text-neutral-500 dark:text-neutral-400 font-medium mb-2`,children:L(`Benchmark: cached vs uncached (ms)`)}),p?(0,F.jsx)(na,{rows:n??[],changes:i}):(0,F.jsx)(ra,{text:L(`Run the benchmark at least twice to see a trend.`)})]})]}),i.length>0&&(0,F.jsxs)(`div`,{className:`mt-3`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[11px] uppercase tracking-wider text-neutral-500 dark:text-neutral-400 font-medium mb-1.5`,children:[(0,F.jsx)(xe,{size:11}),` `,L(`Recent changes`)]}),(0,F.jsx)(`ul`,{className:`space-y-0.5`,children:i.slice(0,5).map(e=>(0,F.jsxs)(`li`,{className:`text-[12px] text-neutral-600 dark:text-neutral-300 truncate`,children:[(0,F.jsx)(`span`,{className:`text-neutral-400 dark:text-neutral-500 tabular-nums mr-2`,children:new Date(e.ts*1e3).toLocaleDateString()}),e.message]},`${e.ts}-${e.message}`))})]})]})}var Xi=280,Zi=80,Qi=4;function $i(e,t){return t<=1?Qi:Qi+e*(Xi-2*Qi)/(t-1)}function ea({changes:e,t0:t,t1:n}){return n<=t?null:(0,F.jsx)(F.Fragment,{children:e.filter(e=>e.ts>=t&&e.ts<=n).map(e=>{let r=Qi+(e.ts-t)/(n-t)*(Xi-2*Qi);return(0,F.jsx)(`line`,{x1:r,x2:r,y1:Qi,y2:Zi-Qi,className:`stroke-amber-500/70`,strokeWidth:`1`,strokeDasharray:`2 3`,children:(0,F.jsx)(`title`,{children:e.message})},`${e.ts}-${e.message}`)})})}function ta({rows:e,changes:t}){let n=e=>Zi-Qi-e*(Zi-2*Qi),r=e.map((t,r)=>`${$i(r,e.length)},${n(t.ratio)}`).join(` `),i=n(1),a=n(.8),o=Date.parse(e[0]?.date??``)/1e3,s=Date.parse(e[e.length-1]?.date??``)/1e3+86399,c=e[e.length-1];return(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`svg`,{viewBox:`0 0 ${Xi} ${Zi}`,className:`w-full h-20`,role:`img`,"aria-label":L(`Hit ratio trend`),children:[(0,F.jsx)(`rect`,{x:Qi,y:i,width:Xi-2*Qi,height:a-i,className:`fill-emerald-500/10`}),(0,F.jsx)(`line`,{x1:Qi,x2:Xi-Qi,y1:a,y2:a,className:`stroke-emerald-500/40`,strokeWidth:`1`,strokeDasharray:`3 3`}),Number.isFinite(o)&&Number.isFinite(s)&&(0,F.jsx)(ea,{changes:t,t0:o,t1:s}),(0,F.jsx)(`polyline`,{points:r,fill:`none`,className:`stroke-accent`,strokeWidth:`2`,strokeLinejoin:`round`,strokeLinecap:`round`}),e.map((t,r)=>(0,F.jsx)(`circle`,{cx:$i(r,e.length),cy:n(t.ratio),r:`2`,className:`fill-accent`,children:(0,F.jsx)(`title`,{children:`${t.date} — ${(t.ratio*100).toFixed(1)}% (${t.hits} hits / ${t.misses} misses)`})},t.date))]}),c&&(0,F.jsxs)(`div`,{className:`mt-1 text-[12px] text-neutral-500 dark:text-neutral-400`,children:[L(`Latest`),`:`,` `,(0,F.jsxs)(`span`,{className:c.ratio>=.8?`text-emerald-600 dark:text-emerald-400 font-medium`:`text-amber-600 dark:text-amber-400 font-medium`,children:[(c.ratio*100).toFixed(1),`%`]}),` `,`· `,L(`target ≥80%`)]})]})}function na({rows:e,changes:t}){let n=Math.max(...e.map(e=>e.uncached_ms),1),r=e=>Zi-Qi-e/n*(Zi-2*Qi),i=t=>e.map((n,i)=>`${$i(i,e.length)},${r(t(n))}`).join(` `),a=e[0]?.ts??0,o=e[e.length-1]?.ts??0,s=e[e.length-1];return(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`svg`,{viewBox:`0 0 ${Xi} ${Zi}`,className:`w-full h-20`,role:`img`,"aria-label":L(`Benchmark trend`),children:[o>a&&(0,F.jsx)(ea,{changes:t,t0:a,t1:o}),(0,F.jsx)(`polyline`,{points:i(e=>e.uncached_ms),fill:`none`,className:`stroke-amber-500`,strokeWidth:`1.5`,strokeDasharray:`4 3`}),(0,F.jsx)(`polyline`,{points:i(e=>e.cached_ms),fill:`none`,className:`stroke-emerald-500`,strokeWidth:`2`,strokeLinejoin:`round`,strokeLinecap:`round`}),e.map((t,n)=>(0,F.jsx)(`circle`,{cx:$i(n,e.length),cy:r(t.cached_ms),r:`2`,className:`fill-emerald-500`,children:(0,F.jsx)(`title`,{children:`${new Date(t.ts*1e3).toLocaleString()} — ${Math.round(t.cached_ms)}ms cached vs ${Math.round(t.uncached_ms)}ms uncached`})},t.ts))]}),(0,F.jsxs)(`div`,{className:`mt-1 flex items-center gap-3 text-[12px] text-neutral-500 dark:text-neutral-400`,children:[(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,F.jsx)(`span`,{className:`inline-block w-3 h-0.5 bg-emerald-500 rounded`}),` `,L(`cached`)]}),(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,F.jsx)(`span`,{className:`inline-block w-3 h-0.5 bg-amber-500 rounded`}),` `,L(`uncached`)]}),s?.savings_ms!=null&&(0,F.jsxs)(`span`,{className:`ml-auto tabular-nums`,children:[`−`,Math.round(s.savings_ms),`ms`]})]})]})}function ra({text:e}){return(0,F.jsx)(`div`,{className:`h-20 flex items-center justify-center text-center text-[12px] text-neutral-400 dark:text-neutral-500 px-4`,children:e})}function ia(){let e=H(),[t,n]=(0,y.useState)(!1),[r,i]=(0,y.useState)(null),[a,o]=(0,y.useState)(null),[s,c]=(0,y.useState)(!1);return e===`free`?(0,F.jsxs)(`div`,{className:`border border-amber-200 dark:border-amber-900/60 bg-gradient-to-br from-amber-50 to-white dark:from-amber-950/30 dark:to-neutral-900 rounded-lg p-4 sm:p-5`,children:[(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-3 min-w-0`,children:[(0,F.jsx)(`span`,{className:`shrink-0 w-9 h-9 rounded-full bg-amber-100 dark:bg-amber-950/60 border border-amber-200 dark:border-amber-900/60 flex items-center justify-center text-amber-600 dark:text-amber-400`,children:(0,F.jsx)(Qe,{size:18})}),(0,F.jsxs)(`div`,{className:`min-w-0`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,F.jsx)(`span`,{className:`font-medium text-neutral-900 dark:text-neutral-50`,children:L(`What would Pro do for your site?`)}),(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[10px] uppercase tracking-wider font-medium text-amber-700 dark:text-amber-300`,children:[(0,F.jsx)(se,{size:10}),L(`Pro`)]})]}),(0,F.jsx)(`div`,{className:`text-[12px] text-neutral-600 dark:text-neutral-400 mt-0.5`,children:L(`Scans your current settings + 24h cache stats and shows exactly which Pro features would help.`)})]})]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2 shrink-0`,children:[r&&(0,F.jsxs)(`button`,{type:`button`,onClick:()=>c(e=>!e),className:`flex items-center gap-1 text-[12px] text-neutral-600 dark:text-neutral-400 hover:text-neutral-900 dark:hover:text-neutral-200 transition-colors`,children:[(0,F.jsx)(O,{size:13,className:`transition-transform ${s?``:`rotate-180`}`}),L(s?`Hide`:`Show`)]}),(0,F.jsxs)(`button`,{type:`button`,onClick:async()=>{n(!0),o(null);try{i(await V.request(`/audit/pro`)),c(!0)}catch(e){o(e instanceof Error?e.message:L(`Audit failed`))}finally{n(!1)}},disabled:t,className:`flex items-center gap-1.5 text-[13px] px-3 py-1.5 rounded-md bg-amber-600 hover:bg-amber-700 dark:bg-amber-500 dark:hover:bg-amber-400 text-white dark:text-neutral-900 font-medium transition-colors disabled:opacity-50`,children:[t?(0,F.jsx)(P,{size:13,className:`animate-spin`}):(0,F.jsx)(Qe,{size:13}),L(r?`Re-run`:`Run Pro audit`)]})]})]}),a&&(0,F.jsx)(`div`,{className:`mt-3 text-[12px] text-red-700 dark:text-red-300`,children:a}),r&&s&&(0,F.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[r.suggestions.map(e=>(0,F.jsx)(oa,{suggestion:e},`${e.id}-${e.severity}`)),(0,F.jsx)(`div`,{className:`text-center pt-2`,children:(0,F.jsxs)(`a`,{href:`https://xspeedcache.com/pricing/`,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1.5 px-4 py-2 rounded-md bg-amber-600 hover:bg-amber-700 dark:bg-amber-500 dark:hover:bg-amber-400 text-white dark:text-neutral-900 text-[13px] font-medium transition-colors`,children:[L(`Upgrade to Pro`),(0,F.jsx)(C,{size:13})]})})]})]}):null}var aa={high:{dot:`bg-red-500`,chip:`bg-red-50 text-red-800 border-red-200 dark:bg-red-950/40 dark:text-red-200 dark:border-red-900/60`,label:`High`},med:{dot:`bg-amber-500`,chip:`bg-amber-50 text-amber-800 border-amber-200 dark:bg-amber-950/40 dark:text-amber-200 dark:border-amber-900/60`,label:`Medium`},low:{dot:`bg-blue-500`,chip:`bg-blue-50 text-blue-800 border-blue-200 dark:bg-blue-950/40 dark:text-blue-200 dark:border-blue-900/60`,label:`Low`}};function oa({suggestion:e}){let t=jn[e.id],n=aa[e.severity];return(0,F.jsxs)(`div`,{className:`border border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 rounded-md p-3 sm:p-4 flex items-start gap-3`,children:[(0,F.jsx)(`span`,{className:`shrink-0 w-2 h-2 rounded-full mt-2.5 ${n.dot}`,"aria-hidden":!0}),(0,F.jsx)(`span`,{className:`shrink-0 text-amber-600 dark:text-amber-400 mt-0.5`,children:t&&(0,F.jsx)(yt,{name:t.icon,size:16})}),(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,F.jsx)(`span`,{className:`text-[13px] font-medium text-neutral-900 dark:text-neutral-50`,children:t?.title??e.id}),(0,F.jsx)(`span`,{className:`text-[10px] uppercase tracking-wider px-1.5 py-0.5 rounded border ${n.chip}`,children:n.label}),e.fact&&(0,F.jsx)(`span`,{className:`text-[10px] font-mono px-1.5 py-0.5 rounded bg-neutral-100 dark:bg-neutral-800 text-neutral-600 dark:text-neutral-400`,children:e.fact})]}),(0,F.jsx)(`p`,{className:`text-[12px] text-neutral-600 dark:text-neutral-300 mt-1 leading-relaxed`,children:e.reason})]})]})}function sa(e){return Math.round(Number(e??0)).toLocaleString()}function ca(e){let t=Number(e??0),n=t<=1?t*100:t;return`${Math.round(n)}%`}function la(e){let t=Math.max(0,Math.floor(Date.now()/1e3)-Number(e||0));if(t<60)return`just now`;let n=Math.floor(t/60);if(n<60)return`${n}m ago`;let r=Math.floor(n/60);if(r<24)return`${r}h ago`;let i=Math.floor(r/24);return i<30?`${i}d ago`:`${Math.floor(i/30)}mo ago`}function ua(e){let t=Number(e??0);if(t<=0)return`0 KB`;let n=[`B`,`KB`,`MB`,`GB`,`TB`],r=Math.min(n.length-1,Math.floor(Math.log(t)/Math.log(1024))),i=t/1024**r;return`${r>=2?Math.round(i*10)/10:Math.round(i)} ${n[r]}`}function da({settings:e,stats:t,rewriteProbe:n,onPurge:r,showToast:i}){let[a,o]=(0,y.useState)(null),s=e.cache_enabled,c=(()=>{if(!s)return L(`Turn on the page cache to start serving pages instantly.`);let e=sa(t.cached_pages);if(n?.active){let t=n.server_type===`nginx`?`nginx`:L(`your web server`);return`${L(`Serving from`)} ${t}, ${L(`bypassing PHP`)} · ${e} ${L(`pages cached`)}`}return`${L(`Serving from the PHP cache`)} · ${e} ${L(`pages cached`)}`})();return(0,F.jsxs)(`section`,{className:`rounded-xl border border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 p-5 flex flex-col`,"aria-label":L(`Cache status`),children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,F.jsx)(`span`,{className:`w-2.5 h-2.5 rounded-full shrink-0 ${s?`bg-emerald-500`:`bg-neutral-400 dark:bg-neutral-600`}`,"aria-hidden":`true`}),(0,F.jsx)(`h2`,{className:`text-[18px] font-semibold text-neutral-900 dark:text-neutral-50`,children:L(s?`Cache active`:`Cache inactive`)})]}),(0,F.jsx)(`p`,{className:`mt-1.5 text-[13px] leading-relaxed text-neutral-500 dark:text-neutral-400`,children:c}),(0,F.jsxs)(`div`,{className:`mt-auto pt-4 flex flex-wrap gap-2`,children:[(0,F.jsxs)(`button`,{type:`button`,onClick:async()=>{if(!a){o(`purge`);try{await r()}finally{o(null)}}},disabled:a!==null,className:`inline-flex items-center gap-2 rounded border border-neutral-300 dark:border-neutral-700 px-3 py-1.5 text-[13px] font-medium text-neutral-700 dark:text-neutral-200 hover:bg-sidebar-hover dark:hover:bg-neutral-800 transition-colors disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,F.jsx)(P,{size:14,className:a===`purge`?`animate-spin`:``}),L(`Purge all`)]}),(0,F.jsxs)(`button`,{type:`button`,onClick:async()=>{if(!a){o(`preload`);try{await V.preload(),i(L(`Preload started`))}catch{i(L(`Preload could not start`))}finally{o(null)}}},disabled:a!==null||!s,title:s?void 0:L(`Enable the cache to preload pages.`),className:`inline-flex items-center gap-2 rounded border border-neutral-300 dark:border-neutral-700 px-3 py-1.5 text-[13px] font-medium text-neutral-700 dark:text-neutral-200 hover:bg-sidebar-hover dark:hover:bg-neutral-800 transition-colors disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,F.jsx)(Be,{size:14,className:a===`preload`?`animate-pulse`:``}),L(`Preload`)]})]})]})}function fa({onNavigate:e}){let[t,n]=(0,y.useState)(null),[r,i]=(0,y.useState)(!0),a=(e=!1)=>V.request(`/mcp/hub`,e?{headers:{"X-XSpeed-Reconcile":`1`}}:{}).then(e=>n(e)).catch(()=>void 0);(0,y.useEffect)(()=>{let e=!0;return V.request(`/mcp/hub`).then(t=>{e&&n(t)}).catch(()=>{e&&n(null)}).finally(()=>{e&&i(!1)}),()=>{e=!1}},[]),(0,y.useEffect)(()=>{let e=()=>{document.visibilityState===`visible`&&a(!0)};return document.addEventListener(`visibilitychange`,e),window.addEventListener(`focus`,e),()=>{document.removeEventListener(`visibilitychange`,e),window.removeEventListener(`focus`,e)}},[]);let o=`rounded-xl border border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 p-5 flex flex-col`,s=`inline-flex items-center gap-2 rounded border border-neutral-300 dark:border-neutral-700 px-3 py-1.5 text-[13px] font-medium text-neutral-700 dark:text-neutral-200 hover:bg-sidebar-hover dark:hover:bg-neutral-800 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`;if(r)return(0,F.jsxs)(`section`,{className:o,"aria-busy":`true`,"aria-label":L(`xSpeed Hub`),children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,F.jsx)(N,{size:18,className:`text-neutral-400 dark:text-neutral-500`,"aria-hidden":`true`}),(0,F.jsx)(`span`,{className:`h-4 w-28 rounded bg-neutral-200 dark:bg-neutral-800 animate-pulse`})]}),(0,F.jsxs)(`div`,{className:`mt-3 space-y-2`,children:[(0,F.jsx)(`span`,{className:`block h-3 w-full rounded bg-neutral-200 dark:bg-neutral-800 animate-pulse`}),(0,F.jsx)(`span`,{className:`block h-3 w-2/3 rounded bg-neutral-200 dark:bg-neutral-800 animate-pulse`})]})]});let c=t?.attached===!0;return(0,F.jsxs)(`section`,{className:o,"aria-label":L(`xSpeed Hub`),children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,F.jsx)(N,{size:18,className:`text-neutral-500 dark:text-neutral-400`,"aria-hidden":`true`}),(0,F.jsx)(`h2`,{className:`text-[15px] font-semibold text-neutral-900 dark:text-neutral-50`,children:L(`xSpeed Hub`)}),c&&(0,F.jsxs)(`span`,{className:`ml-auto inline-flex items-center gap-1.5 text-[12px] text-emerald-600 dark:text-emerald-400`,children:[(0,F.jsx)(`span`,{className:`w-2 h-2 rounded-full bg-emerald-500`,"aria-hidden":`true`}),L(`Connected`)]})]}),c?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`p`,{className:`mt-1.5 text-[13px] leading-relaxed text-neutral-500 dark:text-neutral-400`,children:t?.account_email?`${L(`Connected as`)} ${t.account_email}. ${L(`Control caching remotely and from AI agents.`)}`:L(`Control caching remotely, drive it from AI agents, and manage your sites in one place.`)}),(0,F.jsx)(`div`,{className:`mt-auto pt-4`,children:(0,F.jsxs)(`a`,{href:t?.hub_url,target:`_blank`,rel:`noopener noreferrer`,className:s,children:[L(`Open Hub dashboard`),(0,F.jsx)(ue,{size:14})]})})]}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`p`,{className:`mt-1.5 text-[13px] leading-relaxed text-neutral-500 dark:text-neutral-400`,children:L(`Connect to control caching remotely, drive it from AI agents, and manage all your sites in one place.`)}),(0,F.jsxs)(`div`,{className:`mt-auto pt-4 flex flex-wrap items-center gap-3`,children:[t?.attach_url?(0,F.jsxs)(`a`,{href:t.attach_url,target:`_blank`,rel:`noopener noreferrer`,className:s,children:[L(`Connect to Hub`),(0,F.jsx)(ue,{size:14})]}):(0,F.jsx)(`button`,{type:`button`,onClick:()=>e(`settings`),className:s,children:L(`Connect to Hub`)}),(0,F.jsx)(`button`,{type:`button`,onClick:()=>e(`settings`),className:`text-[13px] text-neutral-500 dark:text-neutral-400 hover:text-neutral-900 dark:hover:text-neutral-100 underline underline-offset-2`,children:L(`More options`)})]})]})]})}function pa({stats:e}){let t=[{label:L(`Hit ratio`),value:ca(e.hit_ratio),hint:L(`last 24 hours`)},{label:L(`Cached pages`),value:sa(e.cached_pages),hint:L(`served without PHP`)},{label:L(`Cache size`),value:ua(e.cache_size),hint:L(`on disk`)}];return(0,F.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-3 gap-4`,"aria-label":L(`Key metrics`),children:t.map(e=>(0,F.jsxs)(`div`,{className:`rounded-xl border border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 p-4`,children:[(0,F.jsx)(`p`,{className:`text-[13px] text-neutral-500 dark:text-neutral-400`,children:e.label}),(0,F.jsx)(`p`,{className:`mt-1 text-[24px] font-semibold text-neutral-900 dark:text-neutral-50 tabular-nums`,children:e.value}),(0,F.jsx)(`p`,{className:`mt-0.5 text-[11px] text-neutral-400 dark:text-neutral-500`,children:e.hint})]},e.label))})}var ma=`https://calendly.com/xspeed-cache/book-expert-setup`;function ha({settings:e,stats:t,rewriteProbe:n,onNavigate:r,showToast:i}){let a=H(),[o,s]=(0,y.useState)(null),[c,l]=(0,y.useState)([]),[u,d]=(0,y.useState)(!0),[f,p]=(0,y.useState)(null);(0,y.useEffect)(()=>{let e=!0,t=[V.getRecommendations().then(t=>{e&&s(t.recommendations??[])}).catch(()=>{e&&s([])})];return a===`free`&&t.push(V.getProAudit().then(t=>{e&&l(t.suggestions??[])}).catch(()=>void 0)),Promise.all(t).finally(()=>{e&&d(!1)}),()=>{e=!1}},[a]);let m=async e=>{let{action:t}=e;if(t.type===`link`&&t.hash){r(t.hash.replace(/^#/,``));return}if(t.type===`apply`){if(f)return;p(e.id);try{s((await V.applyRecommendation(e.id)).recommendations??[]),i(L(`Applied`))}catch{i(L(`Could not apply that fix`))}finally{p(null)}}},h=(t.hits_24h??0)+(t.misses_24h??0)>=50&&(t.hit_ratio??0)<.5,g=n?n.active===!1:!1,_=!e.cache_enabled||g||h,v=o&&o.length>0||c.length>0||_;return(0,F.jsxs)(`section`,{className:`rounded-xl border border-neutral-200 dark:border-neutral-800 bg-neutral-50 dark:bg-neutral-900/50 p-4 sm:p-5`,"aria-label":L(`Recommendations`),children:[(0,F.jsx)(`h2`,{className:`text-[14px] font-semibold text-neutral-900 dark:text-neutral-50 mb-3`,children:L(`Recommendations`)}),u?(0,F.jsxs)(`div`,{className:`space-y-2`,"aria-busy":`true`,children:[(0,F.jsx)(`span`,{className:`block h-10 rounded-lg bg-neutral-200/70 dark:bg-neutral-800 animate-pulse`}),(0,F.jsx)(`span`,{className:`block h-10 w-5/6 rounded-lg bg-neutral-200/70 dark:bg-neutral-800 animate-pulse`})]}):v?(0,F.jsxs)(`div`,{className:`space-y-2`,children:[(o??[]).map(e=>(0,F.jsxs)(`div`,{className:`flex items-start gap-3 rounded-lg border border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 px-3 py-2.5`,children:[(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsx)(`p`,{className:`text-[13px] font-medium text-neutral-900 dark:text-neutral-100`,children:e.title}),(0,F.jsx)(`p`,{className:`mt-0.5 text-[12px] leading-relaxed text-neutral-500 dark:text-neutral-400`,children:e.detail})]}),(0,F.jsxs)(`button`,{type:`button`,onClick:()=>m(e),disabled:f===e.id,className:`shrink-0 inline-flex items-center gap-1.5 rounded border border-neutral-300 dark:border-neutral-700 px-2.5 py-1 text-[12px] font-medium text-neutral-700 dark:text-neutral-200 hover:bg-sidebar-hover dark:hover:bg-neutral-800 transition-colors disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[e.action.type===`apply`?(0,F.jsx)(lt,{size:13,className:f===e.id?`animate-pulse`:``}):(0,F.jsx)(C,{size:13}),e.action.label]})]},e.id)),c.length>0&&(0,F.jsxs)(`div`,{className:`pt-1`,children:[(0,F.jsx)(`p`,{className:`px-1 pb-1 text-[11px] font-semibold uppercase tracking-wide text-neutral-400 dark:text-neutral-500`,children:L(`Also worth a look`)}),(0,F.jsx)(`div`,{className:`space-y-1.5`,children:c.map(e=>(0,F.jsxs)(`div`,{className:`flex items-start gap-2.5 px-1`,children:[(0,F.jsx)(`span`,{className:`mt-1.5 w-1.5 h-1.5 rounded-full shrink-0 ${e.severity===`high`?`bg-amber-500`:e.severity===`med`?`bg-amber-400`:`bg-neutral-300 dark:bg-neutral-600`}`,"aria-hidden":`true`}),(0,F.jsxs)(`p`,{className:`text-[12px] leading-relaxed text-neutral-500 dark:text-neutral-400`,children:[e.reason,e.fact&&(0,F.jsxs)(`span`,{className:`ml-1.5 text-neutral-400 dark:text-neutral-500`,children:[`· `,e.fact]})]})]},e.id))})]}),_&&(0,F.jsxs)(`div`,{className:`flex items-start gap-3 rounded-lg border border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 px-3 py-2.5`,children:[(0,F.jsx)(E,{size:16,className:`mt-0.5 shrink-0 text-neutral-500 dark:text-neutral-400`,"aria-hidden":`true`}),(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsx)(`p`,{className:`text-[13px] font-medium text-neutral-900 dark:text-neutral-100`,children:L(`Let our cache experts optimize your site`)}),(0,F.jsx)(`p`,{className:`mt-0.5 text-[12px] leading-relaxed text-neutral-500 dark:text-neutral-400`,children:L(`Book a free performance review and our engineers will hand-configure xSpeed Cache for your site, applying proven best practices for maximum speed, stability, and compatibility.`)})]}),(0,F.jsx)(`a`,{href:ma,target:`_blank`,rel:`noopener noreferrer`,className:`shrink-0 inline-flex items-center gap-1.5 rounded border border-neutral-300 dark:border-neutral-700 px-2.5 py-1 text-[12px] font-medium text-neutral-700 dark:text-neutral-200 hover:bg-sidebar-hover dark:hover:bg-neutral-800 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:L(`Book expert setup`)})]})]}):(0,F.jsxs)(`p`,{className:`flex items-center gap-2 text-[13px] text-neutral-500 dark:text-neutral-400`,children:[(0,F.jsx)(ie,{size:15,className:`text-emerald-500`,"aria-hidden":`true`}),L(`You're all set — no recommendations right now.`)]})]})}var ga=3;function _a(e){if(e.locked)return`locked`;let t=e.settings?.enabled;return typeof t==`boolean`?t?`on`:`off`:null}function va({state:e}){return e===`locked`?(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[11px] text-neutral-500 dark:text-neutral-400`,children:[(0,F.jsx)(Me,{size:11,"aria-hidden":`true`}),L(`Pro`)]}):e===`on`?(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-[11px] text-emerald-600 dark:text-emerald-400`,children:[(0,F.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full bg-emerald-500`,"aria-hidden":`true`}),L(`On`)]}):e===`off`?(0,F.jsx)(`span`,{className:`text-[11px] text-neutral-400 dark:text-neutral-500`,children:L(`Off`)}):null}function ya({modules:e,onNavigate:t}){let[n,r]=(0,y.useState)(!1),i=Bt(e),a=e.length;return(0,F.jsxs)(`section`,{"aria-label":L(`Features`),children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,F.jsx)(`h2`,{className:`text-[14px] font-semibold text-neutral-900 dark:text-neutral-50`,children:L(`Your features`)}),a>0&&(0,F.jsx)(`button`,{type:`button`,onClick:()=>r(e=>!e),className:`text-[12px] text-neutral-500 dark:text-neutral-400 hover:text-neutral-900 dark:hover:text-neutral-100 underline underline-offset-2`,"aria-expanded":n,children:n?L(`Show less`):`${L(`Browse all`)} ${a} ${L(`features`)}`})]}),(0,F.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-x-6 gap-y-5`,children:i.map(e=>{let r=n?e.modules:e.modules.slice(0,ga);return r.length===0?null:(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2 mb-1.5 px-1`,children:[(0,F.jsx)(yt,{name:e.icon,size:13,className:`text-neutral-400 dark:text-neutral-500`}),(0,F.jsx)(`span`,{className:`text-[11px] font-semibold uppercase tracking-wide text-neutral-400 dark:text-neutral-500`,children:e.label})]}),(0,F.jsx)(`div`,{className:`rounded-xl border border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 divide-y divide-neutral-100 dark:divide-neutral-800 overflow-hidden`,children:r.map(e=>(0,F.jsxs)(`button`,{type:`button`,onClick:()=>t(e.slug),className:`w-full flex items-center gap-3 px-3 py-2 text-left hover:bg-sidebar-hover dark:hover:bg-neutral-800 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-inset`,children:[(0,F.jsx)(yt,{name:e.icon,size:15,className:`shrink-0 text-neutral-500 dark:text-neutral-400`}),(0,F.jsx)(`span`,{className:`flex-1 min-w-0 truncate text-[13px] text-neutral-700 dark:text-neutral-200`,children:e.label}),(0,F.jsx)(va,{state:_a(e)})]},e.slug))})]},e.id)})})]})}var ba=6;function xa(e){switch(e){case`success`:return`bg-emerald-500`;case`warn`:return`bg-amber-500`;case`error`:return`bg-red-500`;default:return`bg-neutral-300 dark:bg-neutral-600`}}function q(){let[e,t]=(0,y.useState)(null);return(0,y.useEffect)(()=>{let e=!0;return V.getActivity().then(n=>{e&&t(n.activity??[])}).catch(()=>{e&&t([])}),()=>{e=!1}},[]),!e||e.length===0?null:(0,F.jsxs)(`section`,{"aria-label":L(`Recent activity`),children:[(0,F.jsx)(`h2`,{className:`text-[14px] font-semibold text-neutral-900 dark:text-neutral-50 mb-3`,children:L(`Recent activity`)}),(0,F.jsx)(`ul`,{className:`rounded-xl border border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 divide-y divide-neutral-100 dark:divide-neutral-800`,children:e.slice(0,ba).map((e,t)=>(0,F.jsxs)(`li`,{className:`flex items-center gap-3 px-3 py-2`,children:[(0,F.jsx)(`span`,{className:`w-1.5 h-1.5 rounded-full shrink-0 ${xa(e.severity)}`,"aria-hidden":`true`}),(0,F.jsx)(`span`,{className:`flex-1 min-w-0 truncate text-[13px] text-neutral-700 dark:text-neutral-200`,children:e.message}),(0,F.jsx)(`span`,{className:`shrink-0 text-[11px] text-neutral-400 dark:text-neutral-500 tabular-nums`,children:la(e.ts)})]},`${e.ts}-${t}`))})]})}var Sa=`https://xspeedcache.com/docs/`,Ca=`https://wpdeveloper.com/support/`,wa=`https://wordpress.org/support/plugin/xspeed/reviews/#new-post`;function Ta(){let e=`inline-flex items-center gap-2 text-neutral-500 dark:text-neutral-400 hover:text-neutral-900 dark:hover:text-neutral-100 transition-colors`;return(0,F.jsxs)(`section`,{className:`flex flex-wrap items-center gap-x-6 gap-y-2 pt-2 text-[13px]`,"aria-label":L(`Help and resources`),children:[(0,F.jsxs)(`a`,{href:Sa,target:`_blank`,rel:`noopener noreferrer`,className:e,children:[(0,F.jsx)(w,{size:14,"aria-hidden":`true`}),L(`Documentation`)]}),(0,F.jsxs)(`a`,{href:Ca,target:`_blank`,rel:`noopener noreferrer`,className:e,children:[(0,F.jsx)(ke,{size:14,"aria-hidden":`true`}),L(`Help and support`)]}),(0,F.jsxs)(`a`,{href:wa,target:`_blank`,rel:`noopener noreferrer`,className:e,children:[(0,F.jsx)(et,{size:14,"aria-hidden":`true`}),L(`Review us on WordPress.org`)]})]})}function Ea({settings:e,stats:t,rewriteProbe:n,modules:r,onPurge:i,onNavigate:a,showToast:o}){return(0,F.jsxs)(`div`,{className:`space-y-6`,children:[(0,F.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-4`,children:[(0,F.jsx)(da,{settings:e,stats:t,rewriteProbe:n,onPurge:i,showToast:o}),(0,F.jsx)(fa,{onNavigate:a})]}),(0,F.jsx)(pa,{stats:t}),(0,F.jsx)(ha,{settings:e,stats:t,rewriteProbe:n,onNavigate:a,showToast:o}),(0,F.jsx)(ya,{modules:r,onNavigate:a}),(0,F.jsx)(q,{}),(0,F.jsx)(Ta,{})]})}var Da=null,Oa=0,ka=`xspeed-field-blink`,Aa=40;function ja(e,t){if(Da!==e)return;let n=document.querySelector(`[data-field-anchor="${Na(e)}"]`);if(n&&n.offsetParent!==null){Da=null,n.scrollIntoView({block:`center`,behavior:`smooth`}),n.classList.remove(ka),n.offsetWidth,n.classList.add(ka);let e=()=>n.classList.remove(ka);n.addEventListener(`animationend`,e,{once:!0}),window.setTimeout(e,1500);return}t<Aa?Oa=window.requestAnimationFrame(()=>ja(e,t+1)):Da=null}function Ma(e,t){if(typeof window>`u`)return;let n=`${e}:${t}`;Da=n,window.cancelAnimationFrame(Oa),Oa=window.requestAnimationFrame(()=>ja(n,0))}function Na(e){return typeof CSS<`u`&&typeof CSS.escape==`function`?CSS.escape(e):e.replace(/["\\]/g,`\\$&`)}function Pa(e,t){if(t!==`free`)return e;let n=new Set(e.map(e=>e.slug)),r=It.filter(e=>!n.has(e.slug)&&!e.embedded).map(e=>({slug:e.slug,tier:`pro`,version:`0.0.0`,label:e.label,icon:e.icon,description:e.description,settings:{},schema:{},locked:!0}));return[...e,...r]}var Fa=`xspeed-theme`,Ia=`xspeed_theme`;function La(e){document.cookie=`${Ia}=${e}; path=/; max-age=31536000; SameSite=Lax`}function Ra(){let[e,t]=(0,y.useState)(()=>localStorage.getItem(Fa)===`dark`?`dark`:`light`);return(0,y.useEffect)(()=>{let t=document.getElementById(`xspeed-app`);t&&(t.classList.toggle(`dark`,e===`dark`),document.body.classList.toggle(`xspeed-dark`,e===`dark`),localStorage.setItem(Fa,e),La(e))},[e]),{theme:e,toggle:()=>t(e=>e===`dark`?`light`:`dark`)}}var za=`xspeed-sidebar-collapsed`;function Ba(){let[e,t]=(0,y.useState)(()=>localStorage.getItem(za)===`1`);return(0,y.useEffect)(()=>{localStorage.setItem(za,e?`1`:`0`)},[e]),{collapsed:e,toggle:()=>t(e=>!e)}}function Va(){let e=H(),[t,n]=(0,y.useState)({}),[r,i]=(0,y.useState)(()=>window.XSpeedConfig?.bootstrap?.modules??[]);(0,y.useEffect)(()=>{if(typeof window>`u`)return;let e=()=>{V.getModules().then(i).catch(()=>void 0)};return window.addEventListener(`xspeed:tier-changed`,e),()=>window.removeEventListener(`xspeed:tier-changed`,e)},[]);let a=(0,y.useMemo)(()=>Pa(r,e).map(e=>t[e.slug]?{...e,settings:t[e.slug]}:e),[e,t,r]),o=(0,y.useCallback)((e,t)=>{n(n=>({...n,[e]:t})),e===`white-label`&&V.getBranding().then(e=>{window.XSpeedPro?.setBranding?.(e)}).catch(()=>void 0)},[]),s=()=>{let e=sn(typeof window<`u`?window.location.hash:``);return{slug:e.module,subtab:e.subtab??``,focus:e.focus,suggest:e.suggest}},c=(e,t)=>{let n=cn(e);n&&(Ma(n.module,n.field),mi(t===void 0?null:{module:n.module,field:n.field,value:t}))},l=s(),u=l.slug===`overview`?Vt:l.slug&&a.some(e=>e.slug===l.slug)?l.slug:Vt,[d,f]=(0,y.useState)(u),[p,m]=(0,y.useState)(l.slug===u?l.subtab:``),[h,g]=(0,y.useState)(0),_=(0,y.useRef)(null);(0,y.useEffect)(()=>{_.current?.scrollTo({top:0})},[d]),(0,y.useEffect)(()=>{if(typeof window>`u`||!d)return;let e=`#`+d+(p?`/`+p:``);window.location.hash!==e&&history.replaceState(null,``,e)},[d,p]),(0,y.useEffect)(()=>{if(typeof window>`u`)return;let e=()=>{let{slug:e,subtab:t,focus:n,suggest:r}=s();!e||e!==`overview`&&!a.some(t=>t.slug===e)||(c(n,r),e!==d&&(f(e),g(e=>e+1)),m(t))};return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[a,d]),(0,y.useEffect)(()=>{(l.slug===`overview`||l.slug&&a.some(e=>e.slug===l.slug))&&(g(e=>e+1),c(l.focus,l.suggest))},[]);let v=(0,y.useCallback)((e,t=``)=>{f(e),m(t)},[]),b=(0,y.useMemo)(()=>a.find(e=>e.slug===d)??null,[a,d]),x=window.XSpeedConfig?.bootstrap,[S,C]=(0,y.useState)(x?.settings??null),[w,T]=(0,y.useState)(x?.status?.stats??null),[E,ee]=(0,y.useState)(x?.status?.rewrite_probe??null),[te,D]=(0,y.useState)(x?.status?.mobile_separate??null),[ne,re]=(0,y.useState)(x?.status?.nginx_server_block??null),[O,k]=(0,y.useState)(null),{theme:A,toggle:j}=Ra(),{collapsed:ie,toggle:ae}=Ba(),{query:M,setQuery:N,results:oe}=Ot(a),se=(0,y.useCallback)(e=>{v(e.module.slug,e.subtab??``),e.fieldKey&&Ma(e.fieldModuleSlug??e.module.slug,e.fieldKey)},[v]),ce=(0,y.useCallback)(()=>{let e=oe[0];e&&se(e)},[oe,se]),le=(0,y.useCallback)(e=>{k(e),setTimeout(()=>k(null),2e3)},[]);(0,y.useEffect)(()=>{S&&w||Promise.all([V.getSettings(),V.getStatus()]).then(([e,t])=>{C(e),T(t.stats),ee(t.rewrite_probe??null),D(t.mobile_separate??null),re(t.nginx_server_block??null)}).catch(()=>le(`Failed to load`))},[]);let ue=(0,y.useCallback)(async e=>{if(!S)return;let t=S;C({...S,cache_enabled:e});try{let t=await V.toggleCache(e);C(e=>e&&{...e,cache_enabled:t.enabled}),T(t.stats),re(t.install_state.nginx_server_block??null),e&&!t.install_state.wp_cache_constant&&t.install_state.manual_snippet?le(`Cache enabled. Add to wp-config.php: ${t.install_state.manual_snippet}`):e&&t.install_state.nginx_snippet?le(`Cache enabled. nginx detected — re-run the setup wizard to copy the server-block snippet for max speed.`):le(e?`Cache enabled`:`Cache disabled`)}catch{C(t),le(e?`Failed to enable cache`:`Failed to disable cache`)}},[S,le]),de=(0,y.useCallback)(async()=>{try{T((await V.purge()).stats),le(`Cache purged`)}catch{le(`Purge failed`)}},[le]),fe=(0,y.useCallback)(async()=>{try{let e=await V.getStatus();T(e.stats),ee(e.rewrite_probe??null),D(e.mobile_separate??null),re(e.nginx_server_block??null)}catch{}},[]);if(!S||!w)return(0,F.jsxs)(Tt,{query:M,children:[(0,F.jsx)(tn,{active:d,onChange:v,theme:A,onToggleTheme:j,collapsed:ie,onToggleCollapse:ae,modules:a,searchQuery:M,onSearchChange:N,onSearchSubmit:ce,visibleResults:oe,onResultClick:se,scrollToActiveTick:h}),(0,F.jsx)(`main`,{className:`flex-1 flex`,children:(0,F.jsx)(nn,{})})]});let pe=d===Vt,me=pe?L(`Overview`):b?.label??``,he=pe?L(`Your site at a glance`):b?.description??``;return(0,F.jsxs)(Tt,{query:M,children:[(0,F.jsx)(tn,{active:d,onChange:v,theme:A,onToggleTheme:j,collapsed:ie,onToggleCollapse:ae,modules:a,searchQuery:M,onSearchChange:N,onSearchSubmit:ce,visibleResults:oe,onResultClick:se,scrollToActiveTick:h}),(0,F.jsxs)(`main`,{ref:_,className:`flex-1 overflow-auto`,children:[(0,F.jsx)(`header`,{className:`sticky top-0 z-20 h-16 px-4 sm:px-6 lg:px-8 flex items-center border-b border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-950`,children:(0,F.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0 w-full`,children:[(0,F.jsx)(`h1`,{className:`text-[16px] sm:text-[18px] font-semibold text-neutral-900 dark:text-neutral-50 shrink-0 whitespace-nowrap`,children:me}),he&&(0,F.jsxs)(`p`,{className:`text-neutral-500 dark:text-neutral-400 text-[12px] sm:text-[13px] truncate min-w-0 inline-flex items-center`,children:[(0,F.jsx)(`span`,{"aria-hidden":`true`,className:`text-[22px] leading-none mr-2 shrink-0`,children:`·`}),(0,F.jsx)(`span`,{className:`truncate`,children:he})]})]})}),(0,F.jsx)(Nt,{query:M,children:(0,F.jsx)(`div`,{className:`px-4 sm:px-6 lg:px-8 py-4 sm:py-6 space-y-6`,children:pe?(0,F.jsx)(Ea,{settings:S,stats:w,rewriteProbe:E,modules:a,onPurge:de,onNavigate:v,showToast:le}):(0,F.jsxs)(F.Fragment,{children:[b?.slug===`cache`&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(Oi,{probe:E,onOpenHealth:()=>v(`health`)}),(0,F.jsx)(Ai,{mobile:te,onOpenCacheSettings:()=>v(`cache`)})]}),b&&b.slug===`cache`&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(Gi,{stats:w}),(0,F.jsx)(Ki,{}),(0,F.jsx)(K,{settings:S,stats:w,onToggle:ue,onPurge:de})]}),b&&b.slug===`cache`&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(Mi,{snippet:ne,topology:E?.topology}),(0,F.jsx)(ia,{}),(0,F.jsx)(qi,{}),(0,F.jsx)(Yi,{})]}),b&&(0,F.jsx)(Ci,{module:b,subtab:p,onSubtabChange:m,getModule:e=>a.find(t=>t.slug===e),onSaved:e=>{o(b.slug,e),fe()}})]})})})]}),O&&(0,F.jsx)(rn,{message:O}),(0,F.jsx)(`div`,{id:`xspeed-toast-host`})]})}var Ha=[{id:`review`,label:`Environment`},{id:`configure`,label:`Configure`},{id:`done`,label:`Summary`},{id:`connect`,label:`Connect`}];function Ua(){return typeof window>`u`?!1:!!window.XSpeedConfig?.bootstrap?.hub?.attached}function Wa({current:e,showConnect:t=!Ua()}){let n=t||e===`connect`?Ha:Ha.filter(e=>e.id!==`connect`).map(e=>e.id===`done`?{...e,label:`Done`}:e),r=n.findIndex(t=>t.id===e);return(0,F.jsx)(`div`,{className:`flex items-center justify-center gap-2 sm:gap-3 py-4 sm:py-5 border-b border-neutral-200 dark:border-neutral-800`,children:n.map((e,t)=>{let i=t<r,a=t===r;return(0,F.jsxs)(`div`,{className:`flex items-center gap-2 sm:gap-3`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(`span`,{className:`w-6 h-6 rounded-full flex items-center justify-center text-[11px] font-medium transition-colors ${a?`bg-accent text-white`:i?`bg-emerald-500 text-white`:`bg-neutral-200 dark:bg-neutral-800 text-neutral-500 dark:text-neutral-400`}`,children:i?(0,F.jsx)(D,{size:12}):t+1}),(0,F.jsx)(`span`,{className:`hidden sm:inline text-[13px] font-medium ${a?`text-neutral-900 dark:text-neutral-50`:i?`text-neutral-700 dark:text-neutral-300`:`text-neutral-400 dark:text-neutral-500`}`,children:e.label})]}),t<n.length-1&&(0,F.jsx)(`span`,{className:`w-8 sm:w-12 h-px ${i?`bg-emerald-500`:`bg-neutral-200 dark:bg-neutral-800`}`})]},e.id)})})}function Ga({step:e,hero:t,children:n,footer:r}){return(0,F.jsxs)(`div`,{className:`max-w-3xl mx-auto my-6 sm:my-10 bg-white dark:bg-neutral-900 border border-neutral-200 dark:border-neutral-800 rounded-lg overflow-hidden flex flex-col`,children:[(0,F.jsx)(Wa,{current:e}),t,(0,F.jsx)(`div`,{className:`px-4 sm:px-6 py-2 space-y-4`,children:n}),r&&(0,F.jsx)(`div`,{className:`border-t border-neutral-200 dark:border-neutral-800 px-4 sm:px-6 py-3 sm:py-4 flex items-center justify-between gap-3 bg-white dark:bg-neutral-900 mt-6`,children:r})]})}function Ka({icon:e,logo:t,title:n,subtitle:r}){return(0,F.jsxs)(`div`,{className:`text-center max-w-2xl mx-auto px-4 sm:px-6 py-6 sm:py-8`,children:[t?(0,F.jsx)(`div`,{className:`mb-3 flex justify-center`,children:t}):e&&(0,F.jsx)(`div`,{className:`mb-3 flex justify-center`,children:(0,F.jsx)(e,{size:28,className:`text-accent`})}),(0,F.jsx)(`h1`,{className:`text-[22px] sm:text-[24px] font-semibold text-neutral-900 dark:text-neutral-50 leading-tight`,children:n}),r&&(0,F.jsx)(`p`,{className:`text-[13px] text-neutral-500 dark:text-neutral-400 mt-2`,children:r})]})}function qa({children:e,onClick:t,disabled:n,type:r=`button`}){return(0,F.jsx)(`button`,{type:r,onClick:t,disabled:n,className:`px-4 py-2 rounded text-[13px] font-medium flex items-center gap-1.5 transition-colors ${n?`bg-accent text-white opacity-50 cursor-not-allowed`:`bg-accent text-white hover:bg-blue-700`}`,children:e})}function Ja({children:e,onClick:t}){return(0,F.jsx)(`button`,{type:`button`,onClick:t,className:`text-[13px] text-neutral-500 dark:text-neutral-400 hover:text-neutral-900 dark:hover:text-neutral-100 transition-colors`,children:e})}var Ya=typeof window<`u`?window.XSpeedConfig?.bootstrap?.hub??null:null,Xa=Ya,Za=Ya!=null,Qa=!1,$a=!1,eo=new Set;function to(e){Xa=e,Za=!0,eo.forEach(e=>e())}function no(e){return eo.add(e),()=>eo.delete(e)}function ro({active:e=!0,initial:t}={}){let n=(0,y.useSyncExternalStore)(no,()=>Xa),r=(0,y.useSyncExternalStore)(no,()=>Za),[i,a]=(0,y.useState)(null),[o,s]=(0,y.useState)(null),c=(0,y.useCallback)(async()=>{if(!Qa){Qa=!0,a(`load`),s(null);try{to(await V.request(`/mcp/hub`))}catch(e){s(e instanceof Error?e.message:`Failed to load xSpeed Hub status.`)}finally{Qa=!1,a(null)}}},[]),l=(0,y.useCallback)(async(e=!1)=>{try{let t=e?{headers:{"X-XSpeed-Reconcile":`1`}}:{};to(await V.request(`/mcp/hub`,t))}catch{}},[]),u=(0,y.useCallback)(async()=>{a(`token`),s(null);try{to(await V.request(`/mcp/hub/token`,{method:`POST`}))}catch(e){s(e instanceof Error?e.message:`Could not generate a token.`)}finally{a(null)}},[]),d=(0,y.useCallback)(async()=>{a(`disconnect`),s(null);try{to(await V.request(`/mcp/hub/disconnect`,{method:`POST`}))}catch(e){s(e instanceof Error?e.message:`Disconnect failed.`)}finally{a(null)}},[]);return(0,y.useEffect)(()=>{if(!($a||!e)){if($a=!0,t!=null&&!Za){to(t);return}c()}},[e]),(0,y.useEffect)(()=>{if(typeof window>`u`)return;let e=new URL(window.location.href);e.searchParams.get(`xspeed_connected`)===`1`&&(l(!0),e.searchParams.delete(`xspeed_connected`),e.searchParams.delete(`xspeed_hub_nonce`),e.searchParams.delete(`xspeed_hub_email`),window.history.replaceState(null,``,e.toString()))},[]),(0,y.useEffect)(()=>{let t=()=>{document.visibilityState===`visible`&&e&&r&&l(!0)};return document.addEventListener(`visibilitychange`,t),window.addEventListener(`focus`,t),()=>{document.removeEventListener(`visibilitychange`,t),window.removeEventListener(`focus`,t)}},[e,r,l]),{status:n,connectUrl:(()=>{let e=n?.attach_url;if(!e||typeof window>`u`)return e;try{let t=new URL(e),n=new URL(window.location.href);return n.searchParams.set(`xspeed_connected`,`1`),t.searchParams.set(`return_url`,n.toString()),t.toString()}catch{return e}})(),busy:i,error:o,loaded:r,attached:!!n?.attached,hasToken:!!n?.site_token,load:c,reload:l,generateToken:u,disconnect:d,setError:s}}function io({initialHub:e,onNext:t,onSkip:n}){let{status:r,connectUrl:i,error:a,attached:o,hasToken:s,busy:c,generateToken:l}=ro({active:!0,initial:e}),[u,d]=(0,y.useState)(!1);return o?(0,F.jsx)(Ga,{step:`connect`,hero:(0,F.jsx)(Ka,{icon:D,title:L(`Connected to xSpeed Hub`),subtitle:r?.account_email?Ct(L(`Connected as %s. Your caching is ready to manage from anywhere.`),r.account_email):L(`Your caching is ready to manage from anywhere.`)}),footer:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`span`,{className:`text-[12px] text-neutral-400 dark:text-neutral-500`,children:L(`You're all set`)}),(0,F.jsxs)(qa,{onClick:t,children:[L(`Go to Dashboard`),(0,F.jsx)(C,{size:14})]})]}),children:(0,F.jsxs)(`div`,{className:`rounded-lg border border-emerald-200 dark:border-emerald-900/60 bg-emerald-50/60 dark:bg-emerald-950/30 px-4 py-3.5`,children:[(0,F.jsx)(`p`,{className:`text-[11px] font-semibold uppercase tracking-wide text-emerald-700 dark:text-emerald-400 mb-2.5`,children:L(`Now unlocked`)}),(0,F.jsx)(`ul`,{className:`space-y-2`,children:[L(`One AI connection controls the cache on every site you connect`),L(`Purge, benchmark, preload and tune settings by asking your AI`),L(`Manage this site from the central xSpeed Hub dashboard`)].map(e=>(0,F.jsxs)(`li`,{className:`flex items-start gap-2 text-[12.5px] text-neutral-700 dark:text-neutral-200`,children:[(0,F.jsx)(D,{size:14,className:`text-emerald-600 dark:text-emerald-400 mt-0.5 shrink-0`}),e]},e))})]})}):(0,F.jsxs)(Ga,{step:`connect`,hero:(0,F.jsx)(Ka,{logo:(0,F.jsx)(en,{className:`w-11 h-11 rounded-lg`}),title:L(`Run your site just by asking`),subtitle:L(`Connect this site to your free xSpeed Hub — then manage caching here and on every other site straight from ChatGPT, Claude, or any AI assistant. Free, forever.`)}),footer:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(Ja,{onClick:n,children:L(`I'll connect later`)}),(0,F.jsxs)(qa,{onClick:t,children:[L(`Go to Dashboard`),(0,F.jsx)(C,{size:14})]})]}),children:[a&&(0,F.jsx)(z,{tone:`danger`,title:L(`xSpeed Hub error`),body:a}),(0,F.jsxs)(`div`,{className:`rounded-lg bg-neutral-50 dark:bg-neutral-950/40 border border-neutral-100 dark:border-neutral-800 px-5 sm:px-8 py-5 sm:py-6`,children:[(0,F.jsx)(`p`,{className:`text-[13px] font-medium text-neutral-800 dark:text-neutral-200 mb-4`,children:L(`Your Hub is home base for all your sites. Once connected, you can:`)}),(0,F.jsxs)(`ul`,{className:`space-y-3.5`,children:[(0,F.jsxs)(`li`,{className:`flex items-start gap-3`,children:[(0,F.jsx)(pt,{size:16,className:`text-accent mt-0.5 shrink-0`}),(0,F.jsxs)(`p`,{className:`text-[13px] leading-relaxed text-neutral-600 dark:text-neutral-300`,children:[(0,F.jsx)(`span`,{className:`font-medium text-neutral-800 dark:text-neutral-200`,children:L(`Just say what you want`)}),` — `,(0,F.jsx)(`em`,{className:`not-italic text-neutral-800 dark:text-neutral-200`,children:L(`“clear the cache on my store,” “warm up the homepage,” “how fast is my blog?”`)}),` — `,L(`and it happens.`)]})]}),(0,F.jsxs)(`li`,{className:`flex items-start gap-3`,children:[(0,F.jsx)(ve,{size:16,className:`text-accent mt-0.5 shrink-0`}),(0,F.jsxs)(`p`,{className:`text-[13px] leading-relaxed text-neutral-600 dark:text-neutral-300`,children:[(0,F.jsx)(`span`,{className:`font-medium text-neutral-800 dark:text-neutral-200`,children:L(`Run every site from one place`)}),` — `,L(`no logging into each dashboard separately.`)]})]}),(0,F.jsxs)(`li`,{className:`flex items-start gap-3`,children:[(0,F.jsx)(_e,{size:16,className:`text-accent mt-0.5 shrink-0`}),(0,F.jsxs)(`p`,{className:`text-[13px] leading-relaxed text-neutral-600 dark:text-neutral-300`,children:[(0,F.jsx)(`span`,{className:`font-medium text-neutral-800 dark:text-neutral-200`,children:L(`Get more over time`)}),` — `,L(`new Hub features arrive automatically, free.`)]})]})]}),(0,F.jsx)(`p`,{className:`text-[13px] mt-4`,children:(0,F.jsx)(`a`,{href:`${r?.hub_url??`https://xspeedcache.com`}`,target:`_blank`,rel:`noreferrer`,className:`text-accent hover:underline`,children:L(`See everything it does.`)})})]}),(0,F.jsxs)(`div`,{className:`flex flex-col items-center gap-3 pt-2`,children:[(0,F.jsxs)(`a`,{href:i,className:`inline-flex items-center justify-center gap-2 px-8 py-3 rounded-md text-[14px] font-semibold bg-accent text-white hover:bg-blue-700 transition-colors shadow-sm`,children:[(0,F.jsx)(Qe,{size:16}),L(`Connect to xSpeed Hub`)]}),(0,F.jsx)(`div`,{className:`flex flex-wrap items-center justify-center gap-x-4 gap-y-1`,children:[L(`Free forever`),L(`Under a minute`),L(`No card, no catch`)].map(e=>(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-[11.5px] text-neutral-500 dark:text-neutral-400`,children:[(0,F.jsx)(D,{size:13,className:`text-emerald-600 dark:text-emerald-400`}),e]},e))})]}),(0,F.jsxs)(`div`,{className:`border-t border-neutral-100 dark:border-neutral-800 pt-3 text-center`,children:[(0,F.jsxs)(`button`,{type:`button`,onClick:()=>{s||l(),d(e=>!e)},className:`inline-flex items-center gap-1.5 text-[11.5px] text-neutral-400 dark:text-neutral-500 hover:text-neutral-600 dark:hover:text-neutral-300 transition-colors`,children:[c===`token`?(0,F.jsx)(P,{size:12,className:`animate-spin`}):(0,F.jsx)(Ee,{size:12}),L(`No redirect? Connect with a token instead.`)]}),u&&(0,F.jsxs)(`div`,{className:`mt-3 space-y-2 text-left`,children:[(0,F.jsxs)(`p`,{className:`text-[12px] text-neutral-500 dark:text-neutral-400`,children:[L(`Paste this site’s URL + token into the`),` `,(0,F.jsxs)(`a`,{href:r?.add_site_url,target:`_blank`,rel:`noreferrer`,className:`text-accent hover:underline inline-flex items-center gap-0.5`,children:[L(`Add site form`),` `,(0,F.jsx)(ue,{size:11})]}),` `,L(`on your xSpeed Hub account.`)]}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`text-[11px] font-medium text-neutral-500 dark:text-neutral-400 mb-1`,children:L(`Site URL`)}),(0,F.jsx)(hn,{content:r?.site_url??``})]}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`text-[11px] font-medium text-neutral-500 dark:text-neutral-400 mb-1`,children:L(`Token`)}),(0,F.jsx)(hn,{content:r?.site_token??``,tone:`blue`})]})]})]})]})}var ao={apache:`Apache`,litespeed:`LiteSpeed`,nginx:`nginx`,iis:`IIS`,unknown:`Unknown`};function oo({env:e,onNext:t}){let n=Qt(),r=!!n.logo_svg?.trim(),i=e.conflicts.length>0,a=e.wp.ok?`ok`:`fail`,o=e.php.modern?`ok`:e.php.ok?`warn`:`fail`,s=e.cache_dir.writable?`ok`:`fail`,c=e.permalinks_ok?`ok`:`warn`,l=i?`warn`:`ok`,u=e.server.gzip_mode===`auto`?`GZIP can be auto-configured via .htaccess.`:`GZIP requires a manual server-config snippet (we'll show it).`;return(0,F.jsx)(Ga,{step:`review`,hero:(0,F.jsx)(Ka,{icon:Be,logo:r?(0,F.jsx)(en,{className:`w-8 h-8 rounded`}):void 0,title:`Let's review your setup`,subtitle:`A quick 30-second check of your environment before we turn on a sensible caching profile.`}),footer:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`span`,{}),(0,F.jsxs)(qa,{onClick:t,children:[`Get Started`,(0,F.jsx)(C,{size:14})]})]}),children:(0,F.jsxs)(`div`,{className:`border border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 rounded-lg overflow-hidden`,children:[(0,F.jsx)(mn,{first:!0,tone:a,label:`WordPress ${e.wp.version}`,detail:e.wp.ok?`Meets the 6.0+ minimum.`:`Upgrade to 6.0 or higher.`}),(0,F.jsx)(mn,{tone:o,label:`PHP ${e.php.version}`,detail:e.php.modern?`Modern PHP — full speed.`:e.php.ok?`Works, but 8.1+ is recommended for best performance.`:`Upgrade to PHP 7.4 or higher.`}),(0,F.jsx)(mn,{tone:`info`,label:`Server: ${ao[e.server.type]}`,detail:u}),(0,F.jsx)(mn,{tone:s,label:`Cache directory writable`,detail:e.cache_dir.writable?e.cache_dir.path:`Cannot write to ${e.cache_dir.path}. Adjust file permissions before continuing.`}),(0,F.jsx)(mn,{tone:c,label:`Permalinks`,detail:e.permalinks_ok?`Pretty permalinks active.`:`Set permalinks to anything other than "Plain" — required for page caching.`}),(0,F.jsx)(mn,{tone:l,label:`Caching plugin conflicts`,detail:i?`Detected: ${e.conflicts.join(`, `)}. Deactivate before enabling ${n.name} cache to avoid double-caching.`:`No other caching plugins detected.`})]})})}var so=[{value:12,label:`12 hours`},{value:24,label:`24 hours`},{value:168,label:`7 days`},{value:720,label:`30 days`}],co=[{id:`conservative`,label:`Conservative`,description:`Page cache + GZIP only. No minify, no lazy-load, no browser cache headers. Safest on themes with finicky CSS / JS.`,icon:Je,choices:{cache_enabled:!0,minify_html:!1,minify_css:!1,minify_js:!1,defer_js:!1,gzip_enabled:!0,lazy_images:!1,browser_cache:!1,cache_expiry:12}},{id:`balanced`,label:`Balanced`,description:`Cache + GZIP + safe minify (HTML/CSS only) + lazy images + browser cache headers + LCP image preload & font preconnect. Recommended for most sites.`,icon:pt,choices:{cache_enabled:!0,minify_html:!0,minify_css:!0,minify_js:!1,defer_js:!1,gzip_enabled:!0,lazy_images:!0,browser_cache:!0,resource_hints:!0,cache_expiry:24}},{id:`aggressive`,label:`Aggressive`,description:`Everything Balanced does, plus JS minify + defer non-critical JS, and a 7-day cache lifetime. Test after enabling — some themes break.`,icon:he,choices:{cache_enabled:!0,minify_html:!0,minify_css:!0,minify_js:!0,defer_js:!0,gzip_enabled:!0,lazy_images:!0,browser_cache:!0,resource_hints:!0,cache_expiry:168}}];function lo(e){let t=e;return co.find(e=>Object.entries(e.choices).every(([e,n])=>t[e]===n))?.id??`custom`}function uo({env:e,initial:t,onApply:n,onSkip:r,busy:i}){let[a,o]=(0,y.useState)(t),s=(e,t)=>o(n=>({...n,[e]:t})),c=e=>o(t=>({...t,...e.choices})),l=(0,y.useMemo)(()=>lo(a),[a]);return(0,F.jsxs)(Ga,{step:`configure`,hero:(0,F.jsx)(Ka,{icon:qe,title:`Pick a starting point`,subtitle:`Choose a preset to fill the toggles below — or skip and configure each one yourself. You can change everything later.`}),footer:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(Ja,{onClick:r,children:`Skip — I'll configure manually`}),(0,F.jsxs)(qa,{onClick:()=>n(a),disabled:i,children:[i?`Applying…`:`Apply & Continue`,!i&&(0,F.jsx)(C,{size:14})]})]}),children:[(0,F.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-3 gap-2.5`,children:co.map(e=>{let t=e.icon,n=l===e.id;return(0,F.jsxs)(`button`,{type:`button`,onClick:()=>c(e),className:`text-left rounded-lg p-3.5 border transition-colors ${n?`border-accent bg-blue-50 dark:bg-blue-950/30`:`border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 hover:border-neutral-300 dark:hover:border-neutral-700`}`,"aria-pressed":n,children:[(0,F.jsx)(t,{size:16,className:n?`text-accent`:`text-neutral-500 dark:text-neutral-400`}),(0,F.jsx)(`div`,{className:`text-[13px] font-medium mt-1.5 ${n?`text-accent`:`text-neutral-900 dark:text-neutral-50`}`,children:e.label}),(0,F.jsx)(`div`,{className:`text-[11px] text-neutral-500 dark:text-neutral-400 mt-0.5 leading-snug`,children:e.description})]},e.id)})}),(0,F.jsxs)(`div`,{className:`border border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 rounded-lg overflow-hidden`,children:[(0,F.jsx)(fo,{first:!0,label:`Enable Page Cache`,hint:`Serve static HTML to non-logged-in visitors. The single biggest speed win.`,checked:a.cache_enabled,onChange:e=>s(`cache_enabled`,e)}),(0,F.jsx)(fo,{label:`Minify HTML`,hint:`Strip whitespace and comments from HTML output.`,checked:a.minify_html,onChange:e=>s(`minify_html`,e)}),(0,F.jsx)(fo,{label:`Minify CSS`,hint:`Compress and rewrite enqueued local stylesheets.`,checked:a.minify_css,onChange:e=>s(`minify_css`,e)}),(0,F.jsx)(fo,{label:`Minify JS`,hint:`Compress enqueued local scripts. Higher conflict risk than HTML/CSS — turn off if scripts break.`,checked:a.minify_js,onChange:e=>s(`minify_js`,e)}),(0,F.jsx)(fo,{label:`Defer JavaScript`,hint:`Add defer to enqueued <script> tags so they don't block first paint. Safest paired with Minify JS off; flip on after testing.`,checked:a.defer_js,onChange:e=>s(`defer_js`,e)}),(0,F.jsx)(fo,{label:`Enable GZIP Compression`,hint:e.server.gzip_mode===`auto`?`Reduces transfer size. We will write the .htaccess rules.`:`Reduces transfer size. On ${e.server.type===`nginx`?`nginx`:`this server`} you'll need to paste a snippet into your server config — we'll show it after.`,checked:a.gzip_enabled,onChange:e=>s(`gzip_enabled`,e)}),(0,F.jsx)(fo,{label:`Lazy-load Images`,hint:`Defer off-screen images + iframes until they scroll into view. Keeps the first image eager so your LCP isn't deferred.`,checked:a.lazy_images,onChange:e=>s(`lazy_images`,e)}),(0,F.jsx)(fo,{label:`Browser cache headers`,hint:`Send Cache-Control + Expires so returning visitors fetch nothing. 1-year immutable for static assets, 1-hour for HTML.`,checked:a.browser_cache,onChange:e=>s(`browser_cache`,e)}),(0,F.jsx)(fo,{label:`LCP image preload + preconnect`,hint:`Preload the largest above-the-fold image and preconnect to font hosts so the main content paints sooner. Safe on every theme — only adds resource hints, never removes anything.`,checked:a.resource_hints??!0,onChange:e=>s(`resource_hints`,e)})]}),(0,F.jsxs)(`div`,{className:`border border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 rounded-lg p-4 sm:p-5`,children:[(0,F.jsx)(`label`,{htmlFor:`xspeed-onb-expiry`,className:`block text-[13px] font-medium text-neutral-900 dark:text-neutral-50 mb-1.5`,children:`Cache Expiry`}),(0,F.jsx)(`p`,{className:`text-[12px] text-neutral-500 dark:text-neutral-400 mb-2.5`,children:`How long cached pages live before regenerating.`}),(0,F.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:so.map(e=>(0,F.jsx)(`button`,{type:`button`,onClick:()=>s(`cache_expiry`,e.value),className:`text-[13px] px-3 py-1.5 rounded border transition-colors ${a.cache_expiry===e.value?`bg-accent border-accent text-white`:`border-neutral-200 dark:border-neutral-700 text-neutral-700 dark:text-neutral-300 hover:bg-neutral-50 dark:hover:bg-neutral-800`}`,children:e.label},e.value))})]}),(0,F.jsx)(`div`,{className:`border border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 rounded-lg p-4 sm:p-5`,children:(0,F.jsxs)(`div`,{className:`flex items-start justify-between gap-3 sm:gap-4`,children:[(0,F.jsxs)(`div`,{className:`min-w-0 pr-2`,children:[(0,F.jsx)(`div`,{className:`text-[13px] font-medium text-neutral-900 dark:text-neutral-50 mb-1.5`,children:`Help improve xSpeed`}),(0,F.jsx)(`p`,{className:`text-[12px] text-neutral-500 dark:text-neutral-400 leading-snug`,children:`Share a few anonymous basics — WordPress & PHP version, active theme & plugins, server type, and which features you enable. Never personal data or page content. Change it anytime from the dashboard.`})]}),(0,F.jsx)(`div`,{className:`shrink-0`,children:(0,F.jsx)(an,{checked:a.usage_tracking,onChange:e=>s(`usage_tracking`,e),label:`Share anonymous usage data`})})]})})]})}function fo({label:e,hint:t,checked:n,onChange:r,first:i=!1}){return(0,F.jsxs)(`div`,{className:`px-4 sm:px-5 py-4 flex items-center justify-between gap-3 sm:gap-4 ${i?``:`border-t border-neutral-200 dark:border-neutral-800`}`,children:[(0,F.jsxs)(`div`,{className:`min-w-0 pr-2`,children:[(0,F.jsx)(`div`,{className:`font-medium text-neutral-900 dark:text-neutral-50`,children:e}),(0,F.jsx)(`div`,{className:`text-[12px] text-neutral-500 dark:text-neutral-400 mt-0.5`,children:t})]}),(0,F.jsx)(`div`,{className:`shrink-0`,children:(0,F.jsx)(an,{checked:n,onChange:r,label:e})})]})}function po({choices:e,applyResult:t,onDashboard:n,onNext:r}){let i=Qt(),a=!!i.logo_svg?.trim(),o=t?.settings.cache_enabled??e.cache_enabled,s=t?.install_state,c=o&&s&&!s.wp_cache_constant&&s.manual_snippet,l=[];o&&l.push(`Page cache`),e.minify_html&&l.push(`HTML minify`),e.minify_css&&l.push(`CSS minify`),e.minify_js&&l.push(`JS minify`),e.defer_js&&l.push(`Defer JS`),e.gzip_enabled&&l.push(`GZIP`),e.lazy_images&&l.push(`Lazy images`),e.browser_cache&&l.push(`Browser cache`);let u=e.cache_expiry>=168?`${Math.round(e.cache_expiry/168)}-week`:e.cache_expiry>=24?`${Math.round(e.cache_expiry/24)}-day`:`${e.cache_expiry}-hour`;return(0,F.jsxs)(Ga,{step:`done`,hero:(0,F.jsx)(Ka,{icon:D,logo:a?(0,F.jsx)(en,{className:`w-8 h-8 rounded`}):void 0,title:`${i.name} is ready`,subtitle:o?`Caching is active. Your site is now faster for non-logged-in visitors.`:`Your preferences are saved. Enable cache from the dashboard whenever you are ready.`}),footer:(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`span`,{}),(0,F.jsxs)(qa,{onClick:r??n,children:[r?`Continue`:`Go to Dashboard`,(0,F.jsx)(C,{size:14})]})]}),children:[l.length>0&&(0,F.jsxs)(`div`,{className:`border border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 rounded-lg p-4 sm:p-5`,children:[(0,F.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 mb-3`,children:[(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`text-[11px] uppercase tracking-wider text-neutral-500 dark:text-neutral-400 font-medium`,children:`Optimizations active`}),(0,F.jsxs)(`div`,{className:`text-2xl font-semibold text-emerald-600 dark:text-emerald-400 tabular-nums mt-1`,children:[l.length,(0,F.jsxs)(`span`,{className:`text-neutral-400 text-[14px] font-normal`,children:[` / `,8]})]})]}),(0,F.jsxs)(`div`,{children:[(0,F.jsx)(`div`,{className:`text-[11px] uppercase tracking-wider text-neutral-500 dark:text-neutral-400 font-medium`,children:`Cache lifetime`}),(0,F.jsx)(`div`,{className:`text-2xl font-semibold text-neutral-900 dark:text-neutral-50 tabular-nums mt-1`,children:u})]})]}),(0,F.jsx)(`div`,{className:`text-[11px] uppercase tracking-wider text-neutral-500 dark:text-neutral-400 font-medium mb-2`,children:`Enabled`}),(0,F.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:l.map(e=>(0,F.jsx)(`span`,{className:`text-[12px] px-2 py-0.5 rounded bg-emerald-50 dark:bg-emerald-950/60 text-emerald-700 dark:text-emerald-300 border border-emerald-200 dark:border-emerald-800`,children:e},e))})]}),(0,F.jsx)(qi,{compact:!0}),c&&(0,F.jsxs)(`div`,{className:`border border-amber-200 dark:border-amber-900/60 bg-amber-50 dark:bg-amber-950/40 rounded-lg p-4 sm:p-5`,children:[(0,F.jsx)(`div`,{className:`text-[13px] font-medium text-amber-900 dark:text-amber-200 mb-1.5`,children:`One manual step`}),(0,F.jsxs)(`p`,{className:`text-[12px] text-amber-800/90 dark:text-amber-200/80 mb-2`,children:[`Your `,(0,F.jsx)(`code`,{children:`wp-config.php`}),` isn't writable, so we couldn't set `,(0,F.jsx)(`code`,{children:`WP_CACHE`}),`. Add this line above the "That's all, stop editing!" comment:`]}),(0,F.jsx)(hn,{content:s.manual_snippet,tone:`amber`})]}),o&&s?.nginx_server_block&&(0,F.jsxs)(`div`,{className:`space-y-3`,children:[(0,F.jsxs)(`div`,{className:`border border-blue-200 dark:border-blue-900/60 bg-blue-50 dark:bg-blue-950/40 rounded-lg p-4 sm:p-5`,children:[(0,F.jsx)(`div`,{className:`text-[13px] font-medium text-blue-900 dark:text-blue-200 mb-1.5`,children:`nginx detected — one-time server config`}),(0,F.jsxs)(`p`,{className:`text-[12px] text-blue-800/90 dark:text-blue-200/80`,children:[i.name,` can't write nginx config (it lives outside WordPress). Paste the snippet below into your site's `,(0,F.jsx)(`code`,{children:`server { }`}),` block, then reload nginx — cache hits will be served without booting PHP at all (~5-15ms TTFB). Without this you still get the PHP drop-in path (~85ms).`]})]}),(0,F.jsx)(Mi,{snippet:s.nginx_server_block})]}),(0,F.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 ${i.hide_help_links?`sm:grid-cols-1`:`sm:grid-cols-2`}`,children:[(0,F.jsx)(mo,{icon:Xe,title:`Fine-tune performance`,body:`HTML/CSS/JS minify, lazy-load, browser cache.`,onClick:()=>n(`minify`)}),!i.hide_help_links&&(0,F.jsx)(mo,{icon:w,title:`Read the docs`,body:`Per-module guides, troubleshooting, conflict matrix.`,href:`https://xspeedcache.com/docs`})]})]})}function mo({icon:e,title:t,body:n,onClick:r,href:i}){let a=`text-left border border-neutral-200 dark:border-neutral-800 bg-white dark:bg-neutral-900 rounded-lg p-4 sm:p-5 hover:border-accent dark:hover:border-accent transition-colors block`,o=(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(e,{size:16,className:`text-accent mb-2`}),(0,F.jsx)(`div`,{className:`text-[13px] font-medium text-neutral-900 dark:text-neutral-50`,children:t}),(0,F.jsx)(`div`,{className:`text-[12px] text-neutral-500 dark:text-neutral-400 mt-1`,children:n})]});return i?(0,F.jsx)(`a`,{href:i,target:`_blank`,rel:`noopener noreferrer`,className:a,children:o}):(0,F.jsx)(`button`,{type:`button`,onClick:r,className:a,children:o})}function ho(e,t){return{cache_enabled:!(e.conflicts.length>0),minify_html:!0,minify_css:!0,minify_js:!1,defer_js:!1,gzip_enabled:!0,lazy_images:!0,browser_cache:!0,resource_hints:!0,cache_expiry:24,usage_tracking:!0}}function go(){let e=window.XSpeedConfig,t=e.bootstrap?.env,n=e.bootstrap?.settings,r=e.bootstrap?.hub??null,[i,a]=(0,y.useState)(()=>typeof window>`u`?`review`:new URL(window.location.href).searchParams.get(`xspeed_step`)===`connect`?`connect`:`review`),[o,s]=(0,y.useState)(()=>ho(t,n)),[c,l]=(0,y.useState)(null),[u,d]=(0,y.useState)(!1),[f,p]=(0,y.useState)(null),m=e.dashboardUrl||``,h=async e=>{try{await V.onboardingComplete()}catch{}m&&(window.location.href=e?`${m}#${e}`:m)};return!t||!n?(0,F.jsxs)(`div`,{className:`max-w-3xl mx-auto my-10 text-center text-neutral-500 dark:text-neutral-400 text-[13px]`,children:[`Onboarding data missing — return to`,` `,(0,F.jsx)(`a`,{href:m,className:`text-accent hover:underline`,children:`the dashboard`}),`.`]}):(0,F.jsxs)(F.Fragment,{children:[i===`review`&&(0,F.jsx)(oo,{env:t,onNext:()=>a(`configure`)}),i===`configure`&&(0,F.jsx)(uo,{env:t,initial:o,onApply:async e=>{d(!0),p(null),s(e);try{l(await V.onboardingApply(e)),await V.onboardingComplete(),a(`done`)}catch(e){p(e instanceof Error?e.message:`Failed to apply settings`)}finally{d(!1)}},onSkip:async()=>{try{await V.onboardingComplete()}catch{}m&&(window.location.href=m)},busy:u}),i===`done`&&(0,F.jsx)(po,{choices:o,applyResult:c,onDashboard:h,onNext:r?.attached?void 0:()=>a(`connect`)}),i===`connect`&&(0,F.jsx)(io,{initialHub:r,onNext:h,onSkip:h}),f&&(0,F.jsx)(`div`,{className:`fixed bottom-6 left-1/2 -translate-x-1/2 bg-red-50 dark:bg-red-950/60 border border-red-200 dark:border-red-900 text-red-700 dark:text-red-300 text-[12px] px-4 py-2 rounded-full shadow-md z-50`,children:f})]})}window.React=y.default,window.ReactDOM=gt,Jt();var J=document.getElementById(`xspeed-app`);if(J){let e=window.XSpeedConfig?.mode===`onboarding`||J.classList.contains(`xspeed-onboarding-host`);(0,_t.createRoot)(J).render((0,F.jsx)(y.StrictMode,{children:e?(0,F.jsx)(go,{}):(0,F.jsx)(Va,{})}))}})(); |