shieldcortex 2.17.1 → 2.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -12
- package/dashboard/.next/standalone/dashboard/.next/BUILD_ID +1 -1
- package/dashboard/.next/standalone/dashboard/.next/build-manifest.json +2 -2
- package/dashboard/.next/standalone/dashboard/.next/prerender-manifest.json +3 -3
- package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.html +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.html +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/index.html +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/index.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/index.segments/_full.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/index.segments/_index.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/page_client-reference-manifest.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_25b1b286._.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/pages/404.html +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/pages/500.html +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/server-reference-manifest.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/server-reference-manifest.json +1 -1
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/{61a3c89b08347bc2.js → 8a1c0cc0ae709e3d.js} +1 -1
- package/dist/defence/iron-dome/index.d.ts.map +1 -1
- package/dist/defence/iron-dome/index.js +5 -0
- package/dist/defence/iron-dome/index.js.map +1 -1
- package/dist/defence/pipeline.d.ts.map +1 -1
- package/dist/defence/pipeline.js +9 -6
- package/dist/defence/pipeline.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -1
- package/dist/lib.d.ts +2 -0
- package/dist/lib.d.ts.map +1 -1
- package/dist/lib.js +2 -0
- package/dist/lib.js.map +1 -1
- package/dist/license/cli.d.ts +9 -0
- package/dist/license/cli.d.ts.map +1 -0
- package/dist/license/cli.js +141 -0
- package/dist/license/cli.js.map +1 -0
- package/dist/license/gate.d.ts +38 -0
- package/dist/license/gate.d.ts.map +1 -0
- package/dist/license/gate.js +84 -0
- package/dist/license/gate.js.map +1 -0
- package/dist/license/index.d.ts +12 -0
- package/dist/license/index.d.ts.map +1 -0
- package/dist/license/index.js +12 -0
- package/dist/license/index.js.map +1 -0
- package/dist/license/keys.d.ts +50 -0
- package/dist/license/keys.d.ts.map +1 -0
- package/dist/license/keys.js +30 -0
- package/dist/license/keys.js.map +1 -0
- package/dist/license/store.d.ts +45 -0
- package/dist/license/store.d.ts.map +1 -0
- package/dist/license/store.js +148 -0
- package/dist/license/store.js.map +1 -0
- package/dist/license/validate.d.ts +24 -0
- package/dist/license/validate.d.ts.map +1 -0
- package/dist/license/validate.js +86 -0
- package/dist/license/validate.js.map +1 -0
- package/dist/license/verify.d.ts +18 -0
- package/dist/license/verify.d.ts.map +1 -0
- package/dist/license/verify.js +126 -0
- package/dist/license/verify.js.map +1 -0
- package/dist/memory/store.d.ts.map +1 -1
- package/dist/memory/store.js +18 -16
- package/dist/memory/store.js.map +1 -1
- package/dist/tools/context.d.ts.map +1 -1
- package/dist/tools/context.js +2 -0
- package/dist/tools/context.js.map +1 -1
- package/dist/worker/brain-worker.d.ts.map +1 -1
- package/dist/worker/brain-worker.js +25 -18
- package/dist/worker/brain-worker.js.map +1 -1
- package/package.json +1 -1
- /package/dashboard/.next/standalone/dashboard/.next/static/{H-BGC5Yp6YmPEZGryV6bd → h890EBq1H-89xzeQf-gx5}/_buildManifest.js +0 -0
- /package/dashboard/.next/standalone/dashboard/.next/static/{H-BGC5Yp6YmPEZGryV6bd → h890EBq1H-89xzeQf-gx5}/_clientMiddlewareManifest.json +0 -0
- /package/dashboard/.next/standalone/dashboard/.next/static/{H-BGC5Yp6YmPEZGryV6bd → h890EBq1H-89xzeQf-gx5}/_ssgManifest.js +0 -0
package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_25b1b286._.js
CHANGED
|
@@ -6,6 +6,6 @@ module.exports=[59414,(a,b,c)=>{"use strict";c._=function(a){return a&&a.__esMod
|
|
|
6
6
|
${o}px !important;
|
|
7
7
|
${p}px !important;
|
|
8
8
|
}
|
|
9
|
-
`),()=>{r.contains(q)&&r.removeChild(q)}},[b]),(0,m.jsx)(x,{isPresent:b,childRef:g,sizeRef:h,children:u.cloneElement(a,{ref:j})})}let z=({children:a,initial:b,isPresent:c,onExitComplete:d,custom:e,presenceAffectsLayout:f,mode:g,anchorX:h,anchorY:i,root:j})=>{let k=p(A),l=(0,n.useId)(),o=!0,q=(0,n.useMemo)(()=>(o=!1,{id:l,initial:b,isPresent:c,custom:e,onExitComplete:a=>{for(let b of(k.set(a,!0),k.values()))if(!b)return;d&&d()},register:a=>(k.set(a,!1),()=>k.delete(a))}),[c,k,d]);return f&&o&&(q={...q}),(0,n.useMemo)(()=>{k.forEach((a,b)=>k.set(b,!1))},[c]),n.useEffect(()=>{c||k.size||!d||d()},[c]),"popLayout"===g&&(a=(0,m.jsx)(y,{isPresent:c,anchorX:h,anchorY:i,root:j,children:a})),(0,m.jsx)(r.Provider,{value:q,children:a})};function A(){return new Map}function B(a=!0){let b=(0,n.useContext)(r);if(null===b)return[!0,null];let{isPresent:c,onExitComplete:d,register:e}=b,f=(0,n.useId)();(0,n.useEffect)(()=>{if(a)return e(f)},[a]);let g=(0,n.useCallback)(()=>a&&d&&d(f),[f,d,a]);return!c&&d?[!1,g]:[!0]}let C=a=>a.key||"";function D(a){let b=[];return n.Children.forEach(a,a=>{(0,n.isValidElement)(a)&&b.push(a)}),b}let E=({children:a,custom:b,initial:c=!0,onExitComplete:d,presenceAffectsLayout:e=!0,mode:f="sync",propagate:g=!1,anchorX:h="left",anchorY:i="top",root:j})=>{let[k,l]=B(g),r=(0,n.useMemo)(()=>D(a),[a]),s=g&&!k?[]:r.map(C),t=(0,n.useRef)(!0),u=(0,n.useRef)(r),v=p(()=>new Map),w=(0,n.useRef)(new Set),[x,y]=(0,n.useState)(r),[A,E]=(0,n.useState)(r);q(()=>{t.current=!1,u.current=r;for(let a=0;a<A.length;a++){let b=C(A[a]);s.includes(b)?(v.delete(b),w.current.delete(b)):!0!==v.get(b)&&v.set(b,!1)}},[A,s.length,s.join("-")]);let F=[];if(r!==x){let a=[...r];for(let b=0;b<A.length;b++){let c=A[b],d=C(c);s.includes(d)||(a.splice(b,0,c),F.push(c))}return"wait"===f&&F.length&&(a=F),E(D(a)),y(r),null}let{forceRender:G}=(0,n.useContext)(o);return(0,m.jsx)(m.Fragment,{children:A.map(a=>{let n=C(a),o=(!g||!!k)&&(r===A||s.includes(n));return(0,m.jsx)(z,{isPresent:o,initial:(!t.current||!!c)&&void 0,custom:b,presenceAffectsLayout:e,mode:f,root:j,onExitComplete:o?void 0:()=>{if(w.current.has(n)||(w.current.add(n),!v.has(n)))return;v.set(n,!0);let a=!0;v.forEach(b=>{b||(a=!1)}),a&&(G?.(),E(u.current),g&&l?.(),d&&d())},anchorX:h,anchorY:i,children:a},n)})})},F=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],G=new Set(F),H=(a,b,c)=>c>b?b:c<a?a:c,I={test:a=>"number"==typeof a,parse:parseFloat,transform:a=>a},J={...I,transform:a=>H(0,1,a)},K={...I,default:1},L=a=>Math.round(1e5*a)/1e5,M=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu,N=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,O=(a,b)=>c=>!!("string"==typeof c&&N.test(c)&&c.startsWith(a)||b&&null!=c&&Object.prototype.hasOwnProperty.call(c,b)),P=(a,b,c)=>d=>{if("string"!=typeof d)return d;let[e,f,g,h]=d.match(M);return{[a]:parseFloat(e),[b]:parseFloat(f),[c]:parseFloat(g),alpha:void 0!==h?parseFloat(h):1}},Q={...I,transform:a=>Math.round(H(0,255,a))},R={test:O("rgb","red"),parse:P("red","green","blue"),transform:({red:a,green:b,blue:c,alpha:d=1})=>"rgba("+Q.transform(a)+", "+Q.transform(b)+", "+Q.transform(c)+", "+L(J.transform(d))+")"},S={test:O("#"),parse:function(a){let b="",c="",d="",e="";return a.length>5?(b=a.substring(1,3),c=a.substring(3,5),d=a.substring(5,7),e=a.substring(7,9)):(b=a.substring(1,2),c=a.substring(2,3),d=a.substring(3,4),e=a.substring(4,5),b+=b,c+=c,d+=d,e+=e),{red:parseInt(b,16),green:parseInt(c,16),blue:parseInt(d,16),alpha:e?parseInt(e,16)/255:1}},transform:R.transform},T=a=>({test:b=>"string"==typeof b&&b.endsWith(a)&&1===b.split(" ").length,parse:parseFloat,transform:b=>`${b}${a}`}),U=T("deg"),V=T("%"),W=T("px"),X=T("vh"),Y=T("vw"),Z={...V,parse:a=>V.parse(a)/100,transform:a=>V.transform(100*a)},$={test:O("hsl","hue"),parse:P("hue","saturation","lightness"),transform:({hue:a,saturation:b,lightness:c,alpha:d=1})=>"hsla("+Math.round(a)+", "+V.transform(L(b))+", "+V.transform(L(c))+", "+L(J.transform(d))+")"},_={test:a=>R.test(a)||S.test(a)||$.test(a),parse:a=>R.test(a)?R.parse(a):$.test(a)?$.parse(a):S.parse(a),transform:a=>"string"==typeof a?a:a.hasOwnProperty("red")?R.transform(a):$.transform(a),getAnimatableNone:a=>{let b=_.parse(a);return b.alpha=0,_.transform(b)}},aa=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,ab="number",ac="color",ad=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function ae(a){let b=a.toString(),c=[],d={color:[],number:[],var:[]},e=[],f=0,g=b.replace(ad,a=>(_.test(a)?(d.color.push(f),e.push(ac),c.push(_.parse(a))):a.startsWith("var(")?(d.var.push(f),e.push("var"),c.push(a)):(d.number.push(f),e.push(ab),c.push(parseFloat(a))),++f,"${}")).split("${}");return{values:c,split:g,indexes:d,types:e}}function af(a){return ae(a).values}function ag(a){let{split:b,types:c}=ae(a),d=b.length;return a=>{let e="";for(let f=0;f<d;f++)if(e+=b[f],void 0!==a[f]){let b=c[f];b===ab?e+=L(a[f]):b===ac?e+=_.transform(a[f]):e+=a[f]}return e}}let ah=a=>"number"==typeof a?0:_.test(a)?_.getAnimatableNone(a):a,ai={test:function(a){return isNaN(a)&&"string"==typeof a&&(a.match(M)?.length||0)+(a.match(aa)?.length||0)>0},parse:af,createTransformer:ag,getAnimatableNone:function(a){let b=af(a);return ag(a)(b.map(ah))}},aj=new Set(["brightness","contrast","saturate","opacity"]);function ak(a){let[b,c]=a.slice(0,-1).split("(");if("drop-shadow"===b)return a;let[d]=c.match(M)||[];if(!d)return a;let e=c.replace(d,""),f=+!!aj.has(b);return d!==c&&(f*=100),b+"("+f+e+")"}let al=/\b([a-z-]*)\(.*?\)/gu,am={...ai,getAnimatableNone:a=>{let b=a.match(al);return b?b.map(ak).join(" "):a}},an={...I,transform:Math.round},ao={borderWidth:W,borderTopWidth:W,borderRightWidth:W,borderBottomWidth:W,borderLeftWidth:W,borderRadius:W,borderTopLeftRadius:W,borderTopRightRadius:W,borderBottomRightRadius:W,borderBottomLeftRadius:W,width:W,maxWidth:W,height:W,maxHeight:W,top:W,right:W,bottom:W,left:W,inset:W,insetBlock:W,insetBlockStart:W,insetBlockEnd:W,insetInline:W,insetInlineStart:W,insetInlineEnd:W,padding:W,paddingTop:W,paddingRight:W,paddingBottom:W,paddingLeft:W,paddingBlock:W,paddingBlockStart:W,paddingBlockEnd:W,paddingInline:W,paddingInlineStart:W,paddingInlineEnd:W,margin:W,marginTop:W,marginRight:W,marginBottom:W,marginLeft:W,marginBlock:W,marginBlockStart:W,marginBlockEnd:W,marginInline:W,marginInlineStart:W,marginInlineEnd:W,fontSize:W,backgroundPositionX:W,backgroundPositionY:W,rotate:U,rotateX:U,rotateY:U,rotateZ:U,scale:K,scaleX:K,scaleY:K,scaleZ:K,skew:U,skewX:U,skewY:U,distance:W,translateX:W,translateY:W,translateZ:W,x:W,y:W,z:W,perspective:W,transformPerspective:W,opacity:J,originX:Z,originY:Z,originZ:W,zIndex:an,fillOpacity:J,strokeOpacity:J,numOctaves:an},ap={...ao,color:_,backgroundColor:_,outlineColor:_,fill:_,stroke:_,borderColor:_,borderTopColor:_,borderRightColor:_,borderBottomColor:_,borderLeftColor:_,filter:am,WebkitFilter:am},aq=a=>ap[a],ar=()=>({translate:0,scale:1,origin:0,originPoint:0}),as=()=>({x:ar(),y:ar()}),at=()=>({min:0,max:0}),au=()=>({x:at(),y:at()}),av=a=>!!(a&&a.getVelocity),aw=new Set(["width","height","top","left","right","bottom",...F]),ax=a=>b=>b.test(a),ay=[I,W,V,U,Y,X,{test:a=>"auto"===a,parse:a=>a}],az=a=>ay.find(ax(a)),aA=()=>{},aB=()=>{},aC=a=>b=>"string"==typeof b&&b.startsWith(a),aD=aC("--"),aE=aC("var(--"),aF=a=>!!aE(a)&&aG.test(a.split("/*")[0].trim()),aG=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function aH(a){return"string"==typeof a&&a.split("/*")[0].includes("var(--")}let aI=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u,aJ=a=>180*a/Math.PI,aK=a=>aM(aJ(Math.atan2(a[1],a[0]))),aL={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:a=>(Math.abs(a[0])+Math.abs(a[3]))/2,rotate:aK,rotateZ:aK,skewX:a=>aJ(Math.atan(a[1])),skewY:a=>aJ(Math.atan(a[2])),skew:a=>(Math.abs(a[1])+Math.abs(a[2]))/2},aM=a=>((a%=360)<0&&(a+=360),a),aN=a=>Math.sqrt(a[0]*a[0]+a[1]*a[1]),aO=a=>Math.sqrt(a[4]*a[4]+a[5]*a[5]),aP={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:aN,scaleY:aO,scale:a=>(aN(a)+aO(a))/2,rotateX:a=>aM(aJ(Math.atan2(a[6],a[5]))),rotateY:a=>aM(aJ(Math.atan2(-a[2],a[0]))),rotateZ:aK,rotate:aK,skewX:a=>aJ(Math.atan(a[4])),skewY:a=>aJ(Math.atan(a[1])),skew:a=>(Math.abs(a[1])+Math.abs(a[4]))/2};function aQ(a){return+!!a.includes("scale")}function aR(a,b){let c,d;if(!a||"none"===a)return aQ(b);let e=a.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);if(e)c=aP,d=e;else{let b=a.match(/^matrix\(([-\d.e\s,]+)\)$/u);c=aL,d=b}if(!d)return aQ(b);let f=c[b],g=d[1].split(",").map(aS);return"function"==typeof f?f(g):g[f]}function aS(a){return parseFloat(a.trim())}let aT=a=>a===I||a===W,aU=new Set(["x","y","z"]),aV=F.filter(a=>!aU.has(a)),aW={width:({x:a},{paddingLeft:b="0",paddingRight:c="0"})=>a.max-a.min-parseFloat(b)-parseFloat(c),height:({y:a},{paddingTop:b="0",paddingBottom:c="0"})=>a.max-a.min-parseFloat(b)-parseFloat(c),top:(a,{top:b})=>parseFloat(b),left:(a,{left:b})=>parseFloat(b),bottom:({y:a},{top:b})=>parseFloat(b)+(a.max-a.min),right:({x:a},{left:b})=>parseFloat(b)+(a.max-a.min),x:(a,{transform:b})=>aR(b,"x"),y:(a,{transform:b})=>aR(b,"y")};aW.translateX=aW.x,aW.translateY=aW.y;let aX=a=>a,aY={},aZ=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function a$(a,b){let c=!1,d=!0,e={delta:0,timestamp:0,isProcessing:!1},f=()=>c=!0,g=aZ.reduce((a,c)=>(a[c]=function(a,b){let c=new Set,d=new Set,e=!1,f=!1,g=new WeakSet,h={delta:0,timestamp:0,isProcessing:!1},i=0;function j(b){g.has(b)&&(k.schedule(b),a()),i++,b(h)}let k={schedule:(a,b=!1,f=!1)=>{let h=f&&e?c:d;return b&&g.add(a),h.has(a)||h.add(a),a},cancel:a=>{d.delete(a),g.delete(a)},process:a=>{if(h=a,e){f=!0;return}e=!0,[c,d]=[d,c],c.forEach(j),b,i=0,c.clear(),e=!1,f&&(f=!1,k.process(a))}};return k}(f,b?c:void 0),a),{}),{setup:h,read:i,resolveKeyframes:j,preUpdate:k,update:l,preRender:m,render:n,postRender:o}=g,p=()=>{let f=aY.useManualTiming?e.timestamp:performance.now();c=!1,aY.useManualTiming||(e.delta=d?1e3/60:Math.max(Math.min(f-e.timestamp,40),1)),e.timestamp=f,e.isProcessing=!0,h.process(e),i.process(e),j.process(e),k.process(e),l.process(e),m.process(e),n.process(e),o.process(e),e.isProcessing=!1,c&&b&&(d=!1,a(p))};return{schedule:aZ.reduce((b,f)=>{let h=g[f];return b[f]=(b,f=!1,g=!1)=>(!c&&(c=!0,d=!0,e.isProcessing||a(p)),h.schedule(b,f,g)),b},{}),cancel:a=>{for(let b=0;b<aZ.length;b++)g[aZ[b]].cancel(a)},state:e,steps:g}}let{schedule:a_,cancel:a0,state:a1,steps:a2}=a$("u">typeof requestAnimationFrame?requestAnimationFrame:aX,!0),a3=new Set,a4=!1,a5=!1,a6=!1;function a7(){if(a5){let a=Array.from(a3).filter(a=>a.needsMeasurement),b=new Set(a.map(a=>a.element)),c=new Map;b.forEach(a=>{let b,d=(b=[],aV.forEach(c=>{let d=a.getValue(c);void 0!==d&&(b.push([c,d.get()]),d.set(+!!c.startsWith("scale")))}),b);d.length&&(c.set(a,d),a.render())}),a.forEach(a=>a.measureInitialState()),b.forEach(a=>{a.render();let b=c.get(a);b&&b.forEach(([b,c])=>{a.getValue(b)?.set(c)})}),a.forEach(a=>a.measureEndState()),a.forEach(a=>{void 0!==a.suspendedScrollY&&window.scrollTo(0,a.suspendedScrollY)})}a5=!1,a4=!1,a3.forEach(a=>a.complete(a6)),a3.clear()}function a8(){a3.forEach(a=>{a.readKeyframes(),a.needsMeasurement&&(a5=!0)})}class a9{constructor(a,b,c,d,e,f=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...a],this.onComplete=b,this.name=c,this.motionValue=d,this.element=e,this.isAsync=f}scheduleResolve(){this.state="scheduled",this.isAsync?(a3.add(this),a4||(a4=!0,a_.read(a8),a_.resolveKeyframes(a7))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:a,name:b,element:c,motionValue:d}=this;if(null===a[0]){let e=d?.get(),f=a[a.length-1];if(void 0!==e)a[0]=e;else if(c&&b){let d=c.readValue(b,f);null!=d&&(a[0]=d)}void 0===a[0]&&(a[0]=f),d&&void 0===e&&d.set(a[0])}for(let b=1;b<a.length;b++)a[b]??(a[b]=a[b-1])}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(a=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,a),a3.delete(this)}cancel(){"scheduled"===this.state&&(a3.delete(this),this.state="pending")}resume(){"pending"===this.state&&this.scheduleResolve()}}function ba(a,b){let c=aq(a);return c!==am&&(c=ai),c.getAnimatableNone?c.getAnimatableNone(b):void 0}let bb=new Set(["auto","none","0"]);class bc extends a9{constructor(a,b,c,d,e){super(a,b,c,d,e,!0)}readKeyframes(){let{unresolvedKeyframes:a,element:b,name:c}=this;if(!b||!b.current)return;super.readKeyframes();for(let c=0;c<a.length;c++){let d=a[c];if("string"==typeof d&&aF(d=d.trim())){let e=function a(b,c,d=1){aB(d<=4,`Max CSS variable fallback depth detected in property "${b}". This may indicate a circular fallback dependency.`,"max-css-var-depth");let[e,f]=function(a){let b=aI.exec(a);if(!b)return[,];let[,c,d,e]=b;return[`--${c??d}`,e]}(b);if(!e)return;let g=window.getComputedStyle(c).getPropertyValue(e);if(g){let a=g.trim();return/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(a)?parseFloat(a):a}return aF(f)?a(f,c,d+1):f}(d,b.current);void 0!==e&&(a[c]=e),c===a.length-1&&(this.finalKeyframe=d)}}if(this.resolveNoneKeyframes(),!aw.has(c)||2!==a.length)return;let[d,e]=a,f=az(d),g=az(e);if(aH(d)!==aH(e)&&aW[c]){this.needsMeasurement=!0;return}if(f!==g)if(aT(f)&&aT(g))for(let b=0;b<a.length;b++){let c=a[b];"string"==typeof c&&(a[b]=parseFloat(c))}else aW[c]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){let{unresolvedKeyframes:a,name:b}=this,c=[];for(let b=0;b<a.length;b++)(null===a[b]||function(a){if("number"==typeof a)return 0===a;if(null===a)return!0;return"none"===a||"0"===a||/^0[^.\s]+$/u.test(a)}(a[b]))&&c.push(b);c.length&&function(a,b,c){let d,e=0;for(;e<a.length&&!d;){let b=a[e];"string"==typeof b&&!bb.has(b)&&ae(b).values.length&&(d=a[e]),e++}if(d&&c)for(let e of b)a[e]=ba(c,d)}(a,c,b)}measureInitialState(){let{element:a,unresolvedKeyframes:b,name:c}=this;if(!a||!a.current)return;"height"===c&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=aW[c](a.measureViewportBox(),window.getComputedStyle(a.current)),b[0]=this.measuredOrigin;let d=b[b.length-1];void 0!==d&&a.getValue(c,d).jump(d,!1)}measureEndState(){let{element:a,name:b,unresolvedKeyframes:c}=this;if(!a||!a.current)return;let d=a.getValue(b);d&&d.jump(this.measuredOrigin,!1);let e=c.length-1,f=c[e];c[e]=aW[b](a.measureViewportBox(),window.getComputedStyle(a.current)),null!==f&&void 0===this.finalKeyframe&&(this.finalKeyframe=f),this.removedTransforms?.length&&this.removedTransforms.forEach(([b,c])=>{a.getValue(b).set(c)}),this.resolveNoneKeyframes()}}function bd(a,b){-1===a.indexOf(b)&&a.push(b)}function be(a,b){let c=a.indexOf(b);c>-1&&a.splice(c,1)}class bf{constructor(){this.subscriptions=[]}add(a){return bd(this.subscriptions,a),()=>be(this.subscriptions,a)}notify(a,b,c){let d=this.subscriptions.length;if(d)if(1===d)this.subscriptions[0](a,b,c);else for(let e=0;e<d;e++){let d=this.subscriptions[e];d&&d(a,b,c)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}let{schedule:bg}=a$(queueMicrotask,!1);function bh(){b=void 0}let bi={now:()=>(void 0===b&&bi.set(a1.isProcessing||aY.useManualTiming?a1.timestamp:performance.now()),b),set:a=>{b=a,queueMicrotask(bh)}};class bj{constructor(a,b={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=a=>{let b=bi.now();if(this.updatedAt!==b&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(a),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(let a of this.dependents)a.dirty()},this.hasAnimated=!1,this.setCurrent(a),this.owner=b.owner}setCurrent(a){this.current=a,this.updatedAt=bi.now(),null===this.canTrackVelocity&&void 0!==a&&(this.canTrackVelocity=!isNaN(parseFloat(this.current)))}setPrevFrameValue(a=this.current){this.prevFrameValue=a,this.prevUpdatedAt=this.updatedAt}onChange(a){return this.on("change",a)}on(a,b){this.events[a]||(this.events[a]=new bf);let c=this.events[a].add(b);return"change"===a?()=>{c(),a_.read(()=>{this.events.change.getSize()||this.stop()})}:c}clearListeners(){for(let a in this.events)this.events[a].clear()}attach(a,b){this.passiveEffect=a,this.stopPassiveEffect=b}set(a){this.passiveEffect?this.passiveEffect(a,this.updateAndNotify):this.updateAndNotify(a)}setWithVelocity(a,b,c){this.set(b),this.prev=void 0,this.prevFrameValue=a,this.prevUpdatedAt=this.updatedAt-c}jump(a,b=!0){this.updateAndNotify(a),this.prev=a,this.prevUpdatedAt=this.prevFrameValue=void 0,b&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(a){this.dependents||(this.dependents=new Set),this.dependents.add(a)}removeDependent(a){this.dependents&&this.dependents.delete(a)}get(){return j&&j.push(this),this.current}getPrevious(){return this.prev}getVelocity(){var a;let b=bi.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||b-this.updatedAt>30)return 0;let c=Math.min(this.updatedAt-this.prevUpdatedAt,30);return a=parseFloat(this.current)-parseFloat(this.prevFrameValue),c?1e3/c*a:0}start(a){return this.stop(),new Promise(b=>{this.hasAnimated=!0,this.animation=a(b),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function bk(a,b){return new bj(a,b)}let bl=[...ay,_,ai],bm={current:!1},bn=new WeakMap;function bo(a){return null!==a&&"object"==typeof a&&"function"==typeof a.start}function bp(a){return"string"==typeof a||Array.isArray(a)}let bq=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],br=["initial",...bq];function bs(a){return bo(a.animate)||br.some(b=>bp(a[b]))}function bt(a){return!!(bs(a)||a.variants)}function bu(a){let b=[{},{}];return a?.values.forEach((a,c)=>{b[0][c]=a.get(),b[1][c]=a.getVelocity()}),b}function bv(a,b,c,d){if("function"==typeof b){let[e,f]=bu(d);b=b(void 0!==c?c:a.custom,e,f)}if("string"==typeof b&&(b=a.variants&&a.variants[b]),"function"==typeof b){let[e,f]=bu(d);b=b(void 0!==c?c:a.custom,e,f)}return b}let bw=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],bx={};class by{scrapeMotionValuesFromProps(a,b,c){return{}}constructor({parent:a,props:b,presenceContext:c,reducedMotionConfig:d,blockInitialAnimation:e,visualState:f},g={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=a9,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{let a=bi.now();this.renderScheduledAt<a&&(this.renderScheduledAt=a,a_.render(this.render,!1,!0))};const{latestValues:h,renderState:i}=f;this.latestValues=h,this.baseTarget={...h},this.initialValues=b.initial?{...h}:{},this.renderState=i,this.parent=a,this.props=b,this.presenceContext=c,this.depth=a?a.depth+1:0,this.reducedMotionConfig=d,this.options=g,this.blockInitialAnimation=!!e,this.isControllingVariants=bs(b),this.isVariantNode=bt(b),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(a&&a.current);const{willChange:j,...k}=this.scrapeMotionValuesFromProps(b,{},this);for(const a in k){const b=k[a];void 0!==h[a]&&av(b)&&b.set(h[a])}}mount(a){this.current=a,bn.set(a,this),this.projection&&!this.projection.instance&&this.projection.mount(a),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((a,b)=>this.bindToMotionValue(b,a)),"never"===this.reducedMotionConfig?this.shouldReduceMotion=!1:"always"===this.reducedMotionConfig?this.shouldReduceMotion=!0:(bm.current||(bm.current=!0),this.shouldReduceMotion=null),this.parent?.addChild(this),this.update(this.props,this.presenceContext)}unmount(){for(let a in this.projection&&this.projection.unmount(),a0(this.notifyUpdate),a0(this.render),this.valueSubscriptions.forEach(a=>a()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this),this.events)this.events[a].clear();for(let a in this.features){let b=this.features[a];b&&(b.unmount(),b.isMounted=!1)}this.current=null}addChild(a){this.children.add(a),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(a)}removeChild(a){this.children.delete(a),this.enteringChildren&&this.enteringChildren.delete(a)}bindToMotionValue(a,b){let c;this.valueSubscriptions.has(a)&&this.valueSubscriptions.get(a)();let d=G.has(a);d&&this.onBindTransform&&this.onBindTransform();let e=b.on("change",b=>{this.latestValues[a]=b,this.props.onUpdate&&a_.preRender(this.notifyUpdate),d&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});this.valueSubscriptions.set(a,()=>{e(),c&&c(),b.owner&&b.stop()})}sortNodePosition(a){return this.current&&this.sortInstanceNodePosition&&this.type===a.type?this.sortInstanceNodePosition(this.current,a.current):0}updateFeatures(){let a="animation";for(a in bx){let b=bx[a];if(!b)continue;let{isEnabled:c,Feature:d}=b;if(!this.features[a]&&d&&c(this.props)&&(this.features[a]=new d(this)),this.features[a]){let b=this.features[a];b.isMounted?b.update():(b.mount(),b.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):au()}getStaticValue(a){return this.latestValues[a]}setStaticValue(a,b){this.latestValues[a]=b}update(a,b){(a.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=a,this.prevPresenceContext=this.presenceContext,this.presenceContext=b;for(let b=0;b<bw.length;b++){let c=bw[b];this.propEventSubscriptions[c]&&(this.propEventSubscriptions[c](),delete this.propEventSubscriptions[c]);let d=a["on"+c];d&&(this.propEventSubscriptions[c]=this.on(c,d))}this.prevMotionValues=function(a,b,c){for(let d in b){let e=b[d],f=c[d];if(av(e))a.addValue(d,e);else if(av(f))a.addValue(d,bk(e,{owner:a}));else if(f!==e)if(a.hasValue(d)){let b=a.getValue(d);!0===b.liveStyle?b.jump(e):b.hasAnimated||b.set(e)}else{let b=a.getStaticValue(d);a.addValue(d,bk(void 0!==b?b:e,{owner:a}))}}for(let d in c)void 0===b[d]&&a.removeValue(d);return b}(this,this.scrapeMotionValuesFromProps(a,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(a){return this.props.variants?this.props.variants[a]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(a){let b=this.getClosestVariantNode();if(b)return b.variantChildren&&b.variantChildren.add(a),()=>b.variantChildren.delete(a)}addValue(a,b){let c=this.values.get(a);b!==c&&(c&&this.removeValue(a),this.bindToMotionValue(a,b),this.values.set(a,b),this.latestValues[a]=b.get())}removeValue(a){this.values.delete(a);let b=this.valueSubscriptions.get(a);b&&(b(),this.valueSubscriptions.delete(a)),delete this.latestValues[a],this.removeValueFromRenderState(a,this.renderState)}hasValue(a){return this.values.has(a)}getValue(a,b){if(this.props.values&&this.props.values[a])return this.props.values[a];let c=this.values.get(a);return void 0===c&&void 0!==b&&(c=bk(null===b?void 0:b,{owner:this}),this.addValue(a,c)),c}readValue(a,b){let c=void 0===this.latestValues[a]&&this.current?this.getBaseTargetFromProps(this.props,a)??this.readValueFromInstance(this.current,a,this.options):this.latestValues[a];if(null!=c){let d,e;if("string"==typeof c&&(d=c,/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(d)||(e=c,/^0[^.\s]+$/u.test(e))))c=parseFloat(c);else{let d;d=c,!bl.find(ax(d))&&ai.test(b)&&(c=ba(a,b))}this.setBaseTarget(a,av(c)?c.get():c)}return av(c)?c.get():c}setBaseTarget(a,b){this.baseTarget[a]=b}getBaseTarget(a){let b,{initial:c}=this.props;if("string"==typeof c||"object"==typeof c){let d=bv(this.props,c,this.presenceContext?.custom);d&&(b=d[a])}if(c&&void 0!==b)return b;let d=this.getBaseTargetFromProps(this.props,a);return void 0===d||av(d)?void 0!==this.initialValues[a]&&void 0===b?void 0:this.baseTarget[a]:d}on(a,b){return this.events[a]||(this.events[a]=new bf),this.events[a].add(b)}notify(a,...b){this.events[a]&&this.events[a].notify(...b)}scheduleRenderMicrotask(){bg.render(this.render)}}class bz extends by{constructor(){super(...arguments),this.KeyframeResolver=bc}sortInstanceNodePosition(a,b){return 2&a.compareDocumentPosition(b)?1:-1}getBaseTargetFromProps(a,b){let c=a.style;return c?c[b]:void 0}removeValueFromRenderState(a,{vars:b,style:c}){delete b[a],delete c[a]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);let{children:a}=this.props;av(a)&&(this.childSubscription=a.on("change",a=>{this.current&&(this.current.textContent=`${a}`)}))}}function bA(a){return a.replace(/([A-Z])/g,a=>`-${a.toLowerCase()}`)}let bB=(a,b)=>b&&"number"==typeof a?b.transform(a):a,bC={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},bD=F.length;function bE(a,b,c){let{style:d,vars:e,transformOrigin:f}=a,g=!1,h=!1;for(let a in b){let c=b[a];if(G.has(a)){g=!0;continue}if(aD(a)){e[a]=c;continue}{let b=bB(c,ao[a]);a.startsWith("origin")?(h=!0,f[a]=b):d[a]=b}}if(!b.transform&&(g||c?d.transform=function(a,b,c){let d="",e=!0;for(let f=0;f<bD;f++){let g=F[f],h=a[g];if(void 0===h)continue;let i=!0;if("number"==typeof h)i=h===+!!g.startsWith("scale");else{let a=parseFloat(h);i=g.startsWith("scale")?1===a:0===a}if(!i||c){let a=bB(h,ao[g]);if(!i){e=!1;let b=bC[g]||g;d+=`${b}(${a}) `}c&&(b[g]=a)}}return d=d.trim(),c?d=c(b,e?"":d):e&&(d="none"),d}(b,a.transform,c):d.transform&&(d.transform="none")),h){let{originX:a="50%",originY:b="50%",originZ:c=0}=f;d.transformOrigin=`${a} ${b} ${c}`}}let bF={offset:"stroke-dashoffset",array:"stroke-dasharray"},bG={offset:"strokeDashoffset",array:"strokeDasharray"},bH=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function bI(a,{attrX:b,attrY:c,attrScale:d,pathLength:e,pathSpacing:f=1,pathOffset:g=0,...h},i,j,k){if(bE(a,h,j),i){a.style.viewBox&&(a.attrs.viewBox=a.style.viewBox);return}a.attrs=a.style,a.style={};let{attrs:l,style:m}=a;for(let a of(l.transform&&(m.transform=l.transform,delete l.transform),(m.transform||l.transformOrigin)&&(m.transformOrigin=l.transformOrigin??"50% 50%",delete l.transformOrigin),m.transform&&(m.transformBox=k?.transformBox??"fill-box",delete l.transformBox),bH))void 0!==l[a]&&(m[a]=l[a],delete l[a]);void 0!==b&&(l.x=b),void 0!==c&&(l.y=c),void 0!==d&&(l.scale=d),void 0!==e&&function(a,b,c=1,d=0,e=!0){a.pathLength=1;let f=e?bF:bG;a[f.offset]=`${-d}`,a[f.array]=`${b} ${c}`}(l,e,f,g,!1)}let bJ=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),bK=a=>"string"==typeof a&&"svg"===a.toLowerCase();function bL(a,{style:b,vars:c},d,e){let f,g=a.style;for(f in b)g[f]=b[f];for(f in e?.applyProjectionStyles(g,d),c)g.setProperty(f,c[f])}function bM(a,b){return b.max===b.min?0:a/(b.max-b.min)*100}let bN={correct:(a,b)=>{if(!b.target)return a;if("string"==typeof a)if(!W.test(a))return a;else a=parseFloat(a);let c=bM(a,b.target.x),d=bM(a,b.target.y);return`${c}% ${d}%`}},bO=(a,b,c)=>a+(b-a)*c,bP={borderRadius:{...bN,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:bN,borderTopRightRadius:bN,borderBottomLeftRadius:bN,borderBottomRightRadius:bN,boxShadow:{correct:(a,{treeScale:b,projectionDelta:c})=>{let d=ai.parse(a);if(d.length>5)return a;let e=ai.createTransformer(a),f=+("number"!=typeof d[0]),g=c.x.scale*b.x,h=c.y.scale*b.y;d[0+f]/=g,d[1+f]/=h;let i=bO(g,h,.5);return"number"==typeof d[2+f]&&(d[2+f]/=i),"number"==typeof d[3+f]&&(d[3+f]/=i),e(d)}}};function bQ(a,{layout:b,layoutId:c}){return G.has(a)||a.startsWith("origin")||(b||void 0!==c)&&(!!bP[a]||"opacity"===a)}function bR(a,b,c){let d=a.style,e=b?.style,f={};if(!d)return f;for(let b in d)(av(d[b])||e&&av(e[b])||bQ(b,a)||c?.getValue(b)?.liveStyle!==void 0)&&(f[b]=d[b]);return f}function bS(a,b,c){let d=bR(a,b,c);for(let c in a)(av(a[c])||av(b[c]))&&(d[-1!==F.indexOf(c)?"attr"+c.charAt(0).toUpperCase()+c.substring(1):c]=a[c]);return d}class bT extends bz{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=au}getBaseTargetFromProps(a,b){return a[b]}readValueFromInstance(a,b){if(G.has(b)){let a=aq(b);return a&&a.default||0}return b=bJ.has(b)?b:bA(b),a.getAttribute(b)}scrapeMotionValuesFromProps(a,b,c){return bS(a,b,c)}build(a,b,c){bI(a,b,this.isSVGTag,c.transformTemplate,c.style)}renderInstance(a,b,c,d){for(let c in bL(a,b,void 0,d),b.attrs)a.setAttribute(bJ.has(c)?c:bA(c),b.attrs[c])}mount(a){this.isSVGTag=bK(a.tagName),super.mount(a)}}function bU({top:a,left:b,right:c,bottom:d}){return{x:{min:b,max:c},y:{min:a,max:d}}}function bV(a){return void 0===a||1===a}function bW({scale:a,scaleX:b,scaleY:c}){return!bV(a)||!bV(b)||!bV(c)}function bX(a){return bW(a)||bY(a)||a.z||a.rotate||a.rotateX||a.rotateY||a.skewX||a.skewY}function bY(a){var b,c;return(b=a.x)&&"0%"!==b||(c=a.y)&&"0%"!==c}function bZ(a,b,c,d,e){return void 0!==e&&(a=d+e*(a-d)),d+c*(a-d)+b}function b$(a,b=0,c=1,d,e){a.min=bZ(a.min,b,c,d,e),a.max=bZ(a.max,b,c,d,e)}function b_(a,{x:b,y:c}){b$(a.x,b.translate,b.scale,b.originPoint),b$(a.y,c.translate,c.scale,c.originPoint)}function b0(a,b){a.min=a.min+b,a.max=a.max+b}function b1(a,b,c,d,e=.5){let f=bO(a.min,a.max,e);b$(a,b,c,f,d)}function b2(a,b){b1(a.x,b.x,b.scaleX,b.scale,b.originX),b1(a.y,b.y,b.scaleY,b.scale,b.originY)}function b3(a,b){return bU(function(a,b){if(!b)return a;let c=b({x:a.left,y:a.top}),d=b({x:a.right,y:a.bottom});return{top:c.y,left:c.x,bottom:d.y,right:d.x}}(a.getBoundingClientRect(),b))}class b4 extends bz{constructor(){super(...arguments),this.type="html",this.renderInstance=bL}readValueFromInstance(a,b){if(G.has(b))return this.projection?.isProjecting?aQ(b):((a,b)=>{let{transform:c="none"}=getComputedStyle(a);return aR(c,b)})(a,b);{let c=window.getComputedStyle(a),d=(aD(b)?c.getPropertyValue(b):c[b])||0;return"string"==typeof d?d.trim():d}}measureInstanceViewportBox(a,{transformPagePoint:b}){return b3(a,b)}build(a,b,c){bE(a,b,c.transformTemplate)}scrapeMotionValuesFromProps(a,b,c){return bR(a,b,c)}}let b5=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function b6(a){if("string"!=typeof a||a.includes("-"));else if(b5.indexOf(a)>-1||/[A-Z]/u.test(a))return!0;return!1}(0,n.createContext)({strict:!1});let b7=(0,n.createContext)({});function b8(a){return Array.isArray(a)?a.join(" "):a}let b9=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function ca(a,b,c){for(let d in b)av(b[d])||bQ(d,c)||(a[d]=b[d])}let cb=()=>({...b9(),attrs:{}}),cc=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function cd(a){return a.startsWith("while")||a.startsWith("drag")&&"draggable"!==a||a.startsWith("layout")||a.startsWith("onTap")||a.startsWith("onPan")||a.startsWith("onLayout")||cc.has(a)}let ce=a=>!cd(a);try{l=(()=>{let a=Error("Cannot find module '@emotion/is-prop-valid'");throw a.code="MODULE_NOT_FOUND",a})().default,"function"==typeof l&&(ce=a=>a.startsWith("on")?!cd(a):l(a))}catch{}function cf(a){return av(a)?a.get():a}let cg=a=>(b,c)=>{let d=(0,n.useContext)(b7),e=(0,n.useContext)(r),f=()=>(function({scrapeMotionValuesFromProps:a,createRenderState:b},c,d,e){return{latestValues:function(a,b,c,d){let e={},f=d(a,{});for(let a in f)e[a]=cf(f[a]);let{initial:g,animate:h}=a,i=bs(a),j=bt(a);b&&j&&!i&&!1!==a.inherit&&(void 0===g&&(g=b.initial),void 0===h&&(h=b.animate));let k=!!c&&!1===c.initial,l=(k=k||!1===g)?h:g;if(l&&"boolean"!=typeof l&&!bo(l)){let b=Array.isArray(l)?l:[l];for(let c=0;c<b.length;c++){let d=bv(a,b[c]);if(d){let{transitionEnd:a,transition:b,...c}=d;for(let a in c){let b=c[a];if(Array.isArray(b)){let a=k?b.length-1:0;b=b[a]}null!==b&&(e[a]=b)}for(let b in a)e[b]=a[b]}}}return e}(c,d,e,a),renderState:b()}})(a,b,d,e);return c?f():p(f)},ch=cg({scrapeMotionValuesFromProps:bR,createRenderState:b9}),ci=cg({scrapeMotionValuesFromProps:bS,createRenderState:cb}),cj={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},ck=!1,cl=Symbol.for("motionComponentSymbol"),cm="data-"+bA("framerAppearId"),cn=(0,n.createContext)({});function co(a){return a&&"object"==typeof a&&Object.prototype.hasOwnProperty.call(a,"current")}function cp(a,{forwardMotionProps:b=!1,type:c}={},d,e){d&&function(a){let b=(!function(){if(ck)return;let a={};for(let b in cj)a[b]={isEnabled:a=>cj[b].some(b=>!!a[b])};bx=a,ck=!0}(),bx);for(let c in a)b[c]={...b[c],...a[c]};bx=b}(d);let f=c?"svg"===c:b6(a),g=f?ci:ch;function h(c,d){var e;let h,i,j,k={...(0,n.useContext)(v),...c,layoutId:function({layoutId:a}){let b=(0,n.useContext)(o).id;return b&&void 0!==a?b+"-"+a:a}(c)},{isStatic:l}=k,p=function(a){let{initial:b,animate:c}=function(a,b){if(bs(a)){let{initial:b,animate:c}=a;return{initial:!1===b||bp(b)?b:void 0,animate:bp(c)?c:void 0}}return!1!==a.inherit?b:{}}(a,(0,n.useContext)(b7));return(0,n.useMemo)(()=>({initial:b,animate:c}),[b8(b),b8(c)])}(c),q=g(c,l);return(0,m.jsxs)(b7.Provider,{value:p,children:[h&&p.visualElement?(0,m.jsx)(h,{visualElement:p.visualElement,...k}):null,function(a,b,c,{latestValues:d},e,f=!1,g){let h=(g??b6(a)?function(a,b,c,d){let e=(0,n.useMemo)(()=>{let c=cb();return bI(c,b,bK(d),a.transformTemplate,a.style),{...c.attrs,style:{...c.style}}},[b]);if(a.style){let b={};ca(b,a.style,a),e.style={...b,...e.style}}return e}:function(a,b){let c,d,e={},f=(c=a.style||{},ca(d={},c,a),Object.assign(d,function({transformTemplate:a},b){return(0,n.useMemo)(()=>{let c=b9();return bE(c,b,a),Object.assign({},c.vars,c.style)},[b])}(a,b)),d);return a.drag&&!1!==a.dragListener&&(e.draggable=!1,f.userSelect=f.WebkitUserSelect=f.WebkitTouchCallout="none",f.touchAction=!0===a.drag?"none":`pan-${"x"===a.drag?"y":"x"}`),void 0===a.tabIndex&&(a.onTap||a.onTapStart||a.whileTap)&&(e.tabIndex=0),e.style=f,e})(b,d,e,a),i=function(a,b,c){let d={};for(let e in a)("values"!==e||"object"!=typeof a.values)&&(ce(e)||!0===c&&cd(e)||!b&&!cd(e)||a.draggable&&e.startsWith("onDrag"))&&(d[e]=a[e]);return d}(b,"string"==typeof a,f),j=a!==n.Fragment?{...i,...h,ref:c}:{},{children:k}=b,l=(0,n.useMemo)(()=>av(k)?k.get():k,[k]);return(0,n.createElement)(a,{...j,children:l})}(a,c,(e=p.visualElement,i=(0,n.useRef)(d),(0,n.useInsertionEffect)(()=>{i.current=d}),j=(0,n.useRef)(null),(0,n.useCallback)(a=>{a&&q.onMount?.(a),e&&(a?e.mount(a):e.unmount());let b=i.current;if("function"==typeof b)if(a){let c=b(a);"function"==typeof c&&(j.current=c)}else j.current?(j.current(),j.current=null):b(a);else b&&(b.current=a)},[e])),q,l,b,f)]})}h.displayName=`motion.${"string"==typeof a?a:`create(${a.displayName??a.name??""})`}`;let i=(0,n.forwardRef)(h);return i[cl]=a,i}class cq{constructor(a){this.isMounted=!1,this.node=a}update(){}}function cr(a,b,c){let d=a.getProps();return bv(d,b,void 0!==c?c:d.custom,a)}function cs(a,b){return a?.[b]??a?.default??a}let ct=a=>Array.isArray(a);function cu(a,b){let c=a.getValue("willChange");if(av(c)&&c.add)return c.add(b);if(!c&&aY.WillChange){let c=new aY.WillChange("auto");a.addValue("willChange",c),c.add(b)}}let cv=a=>1e3*a,cw=(a,b)=>c=>b(a(c)),cx=(...a)=>a.reduce(cw),cy={layout:0,mainThread:0,waapi:0};function cz(a,b,c){return(c<0&&(c+=1),c>1&&(c-=1),c<1/6)?a+(b-a)*6*c:c<.5?b:c<2/3?a+(b-a)*(2/3-c)*6:a}function cA(a,b){return c=>c>0?b:a}let cB=(a,b,c)=>{let d=a*a,e=c*(b*b-d)+d;return e<0?0:Math.sqrt(e)},cC=[S,R,$];function cD(a){let b=cC.find(b=>b.test(a));if(aA(!!b,`'${a}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!b)return!1;let c=b.parse(a);return b===$&&(c=function({hue:a,saturation:b,lightness:c,alpha:d}){a/=360,c/=100;let e=0,f=0,g=0;if(b/=100){let d=c<.5?c*(1+b):c+b-c*b,h=2*c-d;e=cz(h,d,a+1/3),f=cz(h,d,a),g=cz(h,d,a-1/3)}else e=f=g=c;return{red:Math.round(255*e),green:Math.round(255*f),blue:Math.round(255*g),alpha:d}}(c)),c}let cE=(a,b)=>{let c=cD(a),d=cD(b);if(!c||!d)return cA(a,b);let e={...c};return a=>(e.red=cB(c.red,d.red,a),e.green=cB(c.green,d.green,a),e.blue=cB(c.blue,d.blue,a),e.alpha=bO(c.alpha,d.alpha,a),R.transform(e))},cF=new Set(["none","hidden"]);function cG(a,b){return c=>bO(a,b,c)}function cH(a){return"number"==typeof a?cG:"string"==typeof a?aF(a)?cA:_.test(a)?cE:cK:Array.isArray(a)?cI:"object"==typeof a?_.test(a)?cE:cJ:cA}function cI(a,b){let c=[...a],d=c.length,e=a.map((a,c)=>cH(a)(a,b[c]));return a=>{for(let b=0;b<d;b++)c[b]=e[b](a);return c}}function cJ(a,b){let c={...a,...b},d={};for(let e in c)void 0!==a[e]&&void 0!==b[e]&&(d[e]=cH(a[e])(a[e],b[e]));return a=>{for(let b in d)c[b]=d[b](a);return c}}let cK=(a,b)=>{let c=ai.createTransformer(b),d=ae(a),e=ae(b);if(!(d.indexes.var.length===e.indexes.var.length&&d.indexes.color.length===e.indexes.color.length&&d.indexes.number.length>=e.indexes.number.length))return aA(!0,`Complex values '${a}' and '${b}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,"complex-values-different"),cA(a,b);if(cF.has(a)&&!e.values.length||cF.has(b)&&!d.values.length)return cF.has(a)?c=>c<=0?a:b:c=>c>=1?b:a;return cx(cI(function(a,b){let c=[],d={color:0,var:0,number:0};for(let e=0;e<b.values.length;e++){let f=b.types[e],g=a.indexes[f][d[f]],h=a.values[g]??0;c[e]=h,d[f]++}return c}(d,e),e.values),c)};function cL(a,b,c){return"number"==typeof a&&"number"==typeof b&&"number"==typeof c?bO(a,b,c):cH(a)(a,b)}let cM=a=>{let b=({timestamp:b})=>a(b);return{start:(a=!0)=>a_.update(b,a),stop:()=>a0(b),now:()=>a1.isProcessing?a1.timestamp:bi.now()}},cN=(a,b,c=10)=>{let d="",e=Math.max(Math.round(b/c),2);for(let b=0;b<e;b++)d+=Math.round(1e4*a(b/(e-1)))/1e4+", ";return`linear(${d.substring(0,d.length-2)})`};function cO(a){let b=0,c=a.next(b);for(;!c.done&&b<2e4;)b+=50,c=a.next(b);return b>=2e4?1/0:b}function cP(a,b,c){var d,e;let f=Math.max(b-5,0);return d=c-a(f),(e=b-f)?1e3/e*d:0}let cQ=.01,cR=2,cS=.005,cT=.5;function cU(a,b){return a*Math.sqrt(1-b*b)}let cV=["duration","bounce"],cW=["stiffness","damping","mass"];function cX(a,b){return b.some(b=>void 0!==a[b])}function cY(a=.3,b=.3){let c,d="object"!=typeof a?{visualDuration:a,keyframes:[0,1],bounce:b}:a,{restSpeed:e,restDelta:f}=d,g=d.keyframes[0],h=d.keyframes[d.keyframes.length-1],i={done:!1,value:g},{stiffness:j,damping:k,mass:l,duration:m,velocity:n,isResolvedFromDuration:o}=function(a){let b={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...a};if(!cX(a,cW)&&cX(a,cV))if(a.visualDuration){let c=2*Math.PI/(1.2*a.visualDuration),d=c*c,e=2*H(.05,1,1-(a.bounce||0))*Math.sqrt(d);b={...b,mass:1,stiffness:d,damping:e}}else{let c=function({duration:a=800,bounce:b=.3,velocity:c=0,mass:d=1}){let e,f;aA(a<=cv(10),"Spring duration must be 10 seconds or less","spring-duration-limit");let g=1-b;g=H(.05,1,g),a=H(.01,10,a/1e3),g<1?(e=b=>{let d=b*g,e=d*a;return .001-(d-c)/cU(b,g)*Math.exp(-e)},f=b=>{let d=b*g*a,f=Math.pow(g,2)*Math.pow(b,2)*a,h=Math.exp(-d),i=cU(Math.pow(b,2),g);return(d*c+c-f)*h*(-e(b)+.001>0?-1:1)/i}):(e=b=>-.001+Math.exp(-b*a)*((b-c)*a+1),f=b=>a*a*(c-b)*Math.exp(-b*a));let h=function(a,b,c){let d=c;for(let c=1;c<12;c++)d-=a(d)/b(d);return d}(e,f,5/a);if(a=cv(a),isNaN(h))return{stiffness:100,damping:10,duration:a};{let b=Math.pow(h,2)*d;return{stiffness:b,damping:2*g*Math.sqrt(d*b),duration:a}}}(a);(b={...b,...c,mass:1}).isResolvedFromDuration=!0}return b}({...d,velocity:-((d.velocity||0)/1e3)}),p=n||0,q=k/(2*Math.sqrt(j*l)),r=h-g,s=Math.sqrt(j/l)/1e3,t=5>Math.abs(r);if(e||(e=t?cQ:cR),f||(f=t?cS:cT),q<1){let a=cU(s,q);c=b=>h-Math.exp(-q*s*b)*((p+q*s*r)/a*Math.sin(a*b)+r*Math.cos(a*b))}else if(1===q)c=a=>h-Math.exp(-s*a)*(r+(p+s*r)*a);else{let a=s*Math.sqrt(q*q-1);c=b=>{let c=Math.exp(-q*s*b),d=Math.min(a*b,300);return h-c*((p+q*s*r)*Math.sinh(d)+a*r*Math.cosh(d))/a}}let u={calculatedDuration:o&&m||null,next:a=>{let b=c(a);if(o)i.done=a>=m;else{let d=0===a?p:0;q<1&&(d=0===a?cv(p):cP(c,a,b));let g=Math.abs(h-b)<=f;i.done=Math.abs(d)<=e&&g}return i.value=i.done?h:b,i},toString:()=>{let a=Math.min(cO(u),2e4),b=cN(b=>u.next(a*b).value,a,30);return a+"ms "+b},toTransition:()=>{}};return u}function cZ({keyframes:a,velocity:b=0,power:c=.8,timeConstant:d=325,bounceDamping:e=10,bounceStiffness:f=500,modifyTarget:g,min:h,max:i,restDelta:j=.5,restSpeed:k}){let l,m,n=a[0],o={done:!1,value:n},p=c*b,q=n+p,r=void 0===g?q:g(q);r!==q&&(p=r-n);let s=a=>-p*Math.exp(-a/d),t=a=>r+s(a),u=a=>{let b=s(a),c=t(a);o.done=Math.abs(b)<=j,o.value=o.done?r:c},v=a=>{let b;if(b=o.value,void 0!==h&&b<h||void 0!==i&&b>i){var c;l=a,m=cY({keyframes:[o.value,(c=o.value,void 0===h?i:void 0===i||Math.abs(h-c)<Math.abs(i-c)?h:i)],velocity:cP(t,a,o.value),damping:e,stiffness:f,restDelta:j,restSpeed:k})}};return v(0),{calculatedDuration:null,next:a=>{let b=!1;return(m||void 0!==l||(b=!0,u(a),v(a)),void 0!==l&&a>=l)?m.next(a-l):(b||u(a),o)}}}cY.applyToOptions=a=>{let b=function(a,b=100,c){let d=c({...a,keyframes:[0,b]}),e=Math.min(cO(d),2e4);return{type:"keyframes",ease:a=>d.next(e*a).value/b,duration:e/1e3}}(a,100,cY);return a.ease=b.ease,a.duration=cv(b.duration),a.type="keyframes",a};let c$=(a,b,c)=>(((1-3*c+3*b)*a+(3*c-6*b))*a+3*b)*a;function c_(a,b,c,d){return a===b&&c===d?aX:e=>0===e||1===e?e:c$(function(a,b,c,d,e){let f,g,h=0;do(f=c$(g=b+(c-b)/2,d,e)-a)>0?c=g:b=g;while(Math.abs(f)>1e-7&&++h<12)return g}(e,0,1,a,c),b,d)}let c0=c_(.42,0,1,1),c1=c_(0,0,.58,1),c2=c_(.42,0,.58,1),c3=a=>b=>b<=.5?a(2*b)/2:(2-a(2*(1-b)))/2,c4=a=>b=>1-a(1-b),c5=c_(.33,1.53,.69,.99),c6=c4(c5),c7=c3(c6),c8=a=>(a*=2)<1?.5*c6(a):.5*(2-Math.pow(2,-10*(a-1))),c9=a=>1-Math.sin(Math.acos(a)),da=c4(c9),db=c3(c9),dc=a=>Array.isArray(a)&&"number"==typeof a[0],dd={linear:aX,easeIn:c0,easeInOut:c2,easeOut:c1,circIn:c9,circInOut:db,circOut:da,backIn:c6,backInOut:c7,backOut:c5,anticipate:c8},de=a=>{if(dc(a)){aB(4===a.length,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");let[b,c,d,e]=a;return c_(b,c,d,e)}return"string"==typeof a?(aB(void 0!==dd[a],`Invalid easing type '${a}'`,"invalid-easing-type"),dd[a]):a},df=(a,b,c)=>{let d=b-a;return 0===d?1:(c-a)/d};function dg({duration:a=300,keyframes:b,times:c,ease:d="easeInOut"}){var e;let f,g=Array.isArray(d)&&"number"!=typeof d[0]?d.map(de):de(d),h={done:!1,value:b[0]},i=function(a,b,{clamp:c=!0,ease:d,mixer:e}={}){let f=a.length;if(aB(f===b.length,"Both input and output ranges must be the same length","range-length"),1===f)return()=>b[0];if(2===f&&b[0]===b[1])return()=>b[1];let g=a[0]===a[1];a[0]>a[f-1]&&(a=[...a].reverse(),b=[...b].reverse());let h=function(a,b,c){let d=[],e=c||aY.mix||cL,f=a.length-1;for(let c=0;c<f;c++){let f=e(a[c],a[c+1]);b&&(f=cx(Array.isArray(b)?b[c]||aX:b,f)),d.push(f)}return d}(b,d,e),i=h.length,j=c=>{if(g&&c<a[0])return b[0];let d=0;if(i>1)for(;d<a.length-2&&!(c<a[d+1]);d++);let e=df(a[d],a[d+1],c);return h[d](e)};return c?b=>j(H(a[0],a[f-1],b)):j}((e=c&&c.length===b.length?c:(!function(a,b){let c=a[a.length-1];for(let d=1;d<=b;d++){let e=df(0,b,d);a.push(bO(c,1,e))}}(f=[0],b.length-1),f),e.map(b=>b*a)),b,{ease:Array.isArray(g)?g:b.map(()=>g||c2).splice(0,b.length-1)});return{calculatedDuration:a,next:b=>(h.value=i(b),h.done=b>=a,h)}}let dh=a=>null!==a;function di(a,{repeat:b,repeatType:c="loop"},d,e=1){let f=a.filter(dh),g=e<0||b&&"loop"!==c&&b%2==1?0:f.length-1;return g&&void 0!==d?d:f[g]}let dj={decay:cZ,inertia:cZ,tween:dg,keyframes:dg,spring:cY};function dk(a){"string"==typeof a.type&&(a.type=dj[a.type])}class dl{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(a=>{this.resolve=a})}notifyFinished(){this.resolve()}then(a,b){return this.finished.then(a,b)}}let dm=a=>a/100;class dn extends dl{constructor(a){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{let{motionValue:a}=this.options;a&&a.updatedAt!==bi.now()&&this.tick(bi.now()),this.isStopped=!0,"idle"!==this.state&&(this.teardown(),this.options.onStop?.())},cy.mainThread++,this.options=a,this.initAnimation(),this.play(),!1===a.autoplay&&this.pause()}initAnimation(){let{options:a}=this;dk(a);let{type:b=dg,repeat:c=0,repeatDelay:d=0,repeatType:e,velocity:f=0}=a,{keyframes:g}=a,h=b||dg;h!==dg&&"number"!=typeof g[0]&&(this.mixKeyframes=cx(dm,cL(g[0],g[1])),g=[0,100]);let i=h({...a,keyframes:g});"mirror"===e&&(this.mirroredGenerator=h({...a,keyframes:[...g].reverse(),velocity:-f})),null===i.calculatedDuration&&(i.calculatedDuration=cO(i));let{calculatedDuration:j}=i;this.calculatedDuration=j,this.resolvedDuration=j+d,this.totalDuration=this.resolvedDuration*(c+1)-d,this.generator=i}updateTime(a){let b=Math.round(a-this.startTime)*this.playbackSpeed;null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=b}tick(a,b=!1){let{generator:c,totalDuration:d,mixKeyframes:e,mirroredGenerator:f,resolvedDuration:g,calculatedDuration:h}=this;if(null===this.startTime)return c.next(0);let{delay:i=0,keyframes:j,repeat:k,repeatType:l,repeatDelay:m,type:n,onUpdate:o,finalKeyframe:p}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,a):this.speed<0&&(this.startTime=Math.min(a-d/this.speed,this.startTime)),b?this.currentTime=a:this.updateTime(a);let q=this.currentTime-i*(this.playbackSpeed>=0?1:-1),r=this.playbackSpeed>=0?q<0:q>d;this.currentTime=Math.max(q,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=d);let s=this.currentTime,t=c;if(k){let a=Math.min(this.currentTime,d)/g,b=Math.floor(a),c=a%1;!c&&a>=1&&(c=1),1===c&&b--,(b=Math.min(b,k+1))%2&&("reverse"===l?(c=1-c,m&&(c-=m/g)):"mirror"===l&&(t=f)),s=H(0,1,c)*g}let u=r?{done:!1,value:j[0]}:t.next(s);e&&(u.value=e(u.value));let{done:v}=u;r||null===h||(v=this.playbackSpeed>=0?this.currentTime>=d:this.currentTime<=0);let w=null===this.holdTime&&("finished"===this.state||"running"===this.state&&v);return w&&n!==cZ&&(u.value=di(j,this.options,p,this.speed)),o&&o(u.value),w&&this.finish(),u}then(a,b){return this.finished.then(a,b)}get duration(){return this.calculatedDuration/1e3}get iterationDuration(){let{delay:a=0}=this.options||{};return this.duration+a/1e3}get time(){return this.currentTime/1e3}set time(a){a=cv(a),this.currentTime=a,null===this.startTime||null!==this.holdTime||0===this.playbackSpeed?this.holdTime=a:this.driver&&(this.startTime=this.driver.now()-a/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(a){this.updateTime(bi.now());let b=this.playbackSpeed!==a;this.playbackSpeed=a,b&&(this.time=this.currentTime/1e3)}play(){if(this.isStopped)return;let{driver:a=cM,startTime:b}=this.options;this.driver||(this.driver=a(a=>this.tick(a))),this.options.onPlay?.();let c=this.driver.now();"finished"===this.state?(this.updateFinished(),this.startTime=c):null!==this.holdTime?this.startTime=c-this.holdTime:this.startTime||(this.startTime=b??c),"finished"===this.state&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(bi.now()),this.holdTime=this.currentTime}complete(){"running"!==this.state&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null,cy.mainThread--}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(a){return this.startTime=0,this.tick(a,!0)}attachTimeline(a){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),a.observe(this)}}function dp(a){let b;return()=>(void 0===b&&(b=a()),b)}let dq=dp(()=>void 0!==window.ScrollTimeline),dr={},ds=(c=dp(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(a){return!1}return!0}),()=>dr.linearEasing??c()),dt=([a,b,c,d])=>`cubic-bezier(${a}, ${b}, ${c}, ${d})`,du={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:dt([0,.65,.55,1]),circOut:dt([.55,0,1,.45]),backIn:dt([.31,.01,.66,-.59]),backOut:dt([.33,1.53,.69,.99])};function dv(a){return"function"==typeof a&&"applyToOptions"in a}class dw extends dl{constructor(a){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!a)return;const{element:b,name:c,keyframes:d,pseudoElement:e,allowFlatten:f=!1,finalKeyframe:g,onComplete:h}=a;this.isPseudoElement=!!e,this.allowFlatten=f,this.options=a,aB("string"!=typeof a.type,'Mini animate() doesn\'t support "type" as a string.',"mini-spring");const i=function({type:a,...b}){return dv(a)&&ds()?a.applyToOptions(b):(b.duration??(b.duration=300),b.ease??(b.ease="easeOut"),b)}(a);this.animation=function(a,b,c,{delay:d=0,duration:e=300,repeat:f=0,repeatType:g="loop",ease:h="easeOut",times:i}={},j){let k={[b]:c};i&&(k.offset=i);let l=function a(b,c){if(b)return"function"==typeof b?ds()?cN(b,c):"ease-out":dc(b)?dt(b):Array.isArray(b)?b.map(b=>a(b,c)||du.easeOut):du[b]}(h,e);Array.isArray(l)&&(k.easing=l);let m={delay:d,duration:e,easing:Array.isArray(l)?"linear":l,fill:"both",iterations:f+1,direction:"reverse"===g?"alternate":"normal"};j&&(m.pseudoElement=j);let n=a.animate(k,m);return n}(b,c,d,i,e),!1===i.autoplay&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!e){let a=di(d,this.options,g,this.speed);this.updateMotionValue?this.updateMotionValue(a):c.startsWith("--")?b.style.setProperty(c,a):b.style[c]=a,this.animation.cancel()}h?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),"finished"===this.state&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch(a){}}stop(){if(this.isStopped)return;this.isStopped=!0;let{state:a}=this;"idle"!==a&&"finished"!==a&&(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){this.isPseudoElement||this.animation.commitStyles?.()}get duration(){return Number(this.animation.effect?.getComputedTiming?.().duration||0)/1e3}get iterationDuration(){let{delay:a=0}=this.options||{};return this.duration+a/1e3}get time(){return(Number(this.animation.currentTime)||0)/1e3}set time(a){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=cv(a)}get speed(){return this.animation.playbackRate}set speed(a){a<0&&(this.finishedTime=null),this.animation.playbackRate=a}get state(){return null!==this.finishedTime?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(a){this.manualStartTime=this.animation.startTime=a}attachTimeline({timeline:a,observe:b}){return(this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,a&&dq())?(this.animation.timeline=a,aX):b(this)}}let dx={anticipate:c8,backInOut:c7,circInOut:db};class dy extends dw{constructor(a){!function(a){"string"==typeof a.ease&&a.ease in dx&&(a.ease=dx[a.ease])}(a),dk(a),super(a),void 0!==a.startTime&&(this.startTime=a.startTime),this.options=a}updateMotionValue(a){let{motionValue:b,onUpdate:c,onComplete:d,element:e,...f}=this.options;if(!b)return;if(void 0!==a)return void b.set(a);let g=new dn({...f,autoplay:!1}),h=Math.max(10,bi.now()-this.startTime),i=H(0,10,h-10);b.setWithVelocity(g.sample(Math.max(0,h-i)).value,g.sample(h).value,i),g.stop()}}let dz=(a,b)=>"zIndex"!==b&&!!("number"==typeof a||Array.isArray(a)||"string"==typeof a&&(ai.test(a)||"0"===a)&&!a.startsWith("url("));function dA(a){a.duration=0,a.type="keyframes"}let dB=new Set(["opacity","clipPath","filter","transform"]),dC=dp(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));class dD extends dl{constructor({autoplay:a=!0,delay:b=0,type:c="keyframes",repeat:d=0,repeatDelay:e=0,repeatType:f="loop",keyframes:g,name:h,motionValue:i,element:j,...k}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=bi.now();const l={autoplay:a,delay:b,type:c,repeat:d,repeatDelay:e,repeatType:f,name:h,motionValue:i,element:j,...k},m=j?.KeyframeResolver||a9;this.keyframeResolver=new m(g,(a,b,c)=>this.onKeyframesResolved(a,b,l,!c),h,i,j),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(a,b,c,d){this.keyframeResolver=void 0;let{name:e,type:f,velocity:g,delay:h,isHandoff:i,onUpdate:j}=c;this.resolvedAt=bi.now(),!function(a,b,c,d){let e=a[0];if(null===e)return!1;if("display"===b||"visibility"===b)return!0;let f=a[a.length-1],g=dz(e,b),h=dz(f,b);return aA(g===h,`You are trying to animate ${b} from "${e}" to "${f}". "${g?f:e}" is not an animatable value.`,"value-not-animatable"),!!g&&!!h&&(function(a){let b=a[0];if(1===a.length)return!0;for(let c=0;c<a.length;c++)if(a[c]!==b)return!0}(a)||("spring"===c||dv(c))&&d)}(a,e,f,g)&&((aY.instantAnimations||!h)&&j?.(di(a,c,b)),a[0]=a[a.length-1],dA(c),c.repeat=0);let k={startTime:d?this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt:void 0,finalKeyframe:b,...c,keyframes:a},l=!i&&function(a){let{motionValue:b,name:c,repeatDelay:d,repeatType:e,damping:f,type:g}=a;if(!(b?.owner?.current instanceof HTMLElement))return!1;let{onUpdate:h,transformTemplate:i}=b.owner.getProps();return dC()&&c&&dB.has(c)&&("transform"!==c||!i)&&!h&&!d&&"mirror"!==e&&0!==f&&"inertia"!==g}(k),m=k.motionValue?.owner?.current,n=l?new dy({...k,element:m}):new dn(k);n.finished.then(()=>{this.notifyFinished()}).catch(aX),this.pendingTimeline&&(this.stopTimeline=n.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=n}get finished(){return this._animation?this.animation.finished:this._finished}then(a,b){return this.finished.finally(a).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),a6=!0,a8(),a7(),a6=!1),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(a){this.animation.time=a}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(a){this.animation.speed=a}get startTime(){return this.animation.startTime}attachTimeline(a){return this._animation?this.stopTimeline=this.animation.attachTimeline(a):this.pendingTimeline=a,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}let dE={type:"spring",stiffness:500,damping:25,restSpeed:10},dF={type:"keyframes",duration:.8},dG={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},dH=a=>null!==a,dI=(a,b,c,d={},e,f)=>g=>{let h=cs(d,a)||{},i=h.delay||d.delay||0,{elapsed:j=0}=d;j-=cv(i);let k={keyframes:Array.isArray(c)?c:[null,c],ease:"easeOut",velocity:b.getVelocity(),...h,delay:-j,onUpdate:a=>{b.set(a),h.onUpdate&&h.onUpdate(a)},onComplete:()=>{g(),h.onComplete&&h.onComplete()},name:a,motionValue:b,element:f?void 0:e};!function({when:a,delay:b,delayChildren:c,staggerChildren:d,staggerDirection:e,repeat:f,repeatType:g,repeatDelay:h,from:i,elapsed:j,...k}){return!!Object.keys(k).length}(h)&&Object.assign(k,((a,{keyframes:b})=>b.length>2?dF:G.has(a)?a.startsWith("scale")?{type:"spring",stiffness:550,damping:0===b[1]?2*Math.sqrt(550):30,restSpeed:10}:dE:dG)(a,k)),k.duration&&(k.duration=cv(k.duration)),k.repeatDelay&&(k.repeatDelay=cv(k.repeatDelay)),void 0!==k.from&&(k.keyframes[0]=k.from);let l=!1;if(!1!==k.type&&(0!==k.duration||k.repeatDelay)||(dA(k),0===k.delay&&(l=!0)),(aY.instantAnimations||aY.skipAnimations)&&(l=!0,dA(k),k.delay=0),k.allowFlatten=!h.type&&!h.ease,l&&!f&&void 0!==b.get()){let a=function(a,{repeat:b,repeatType:c="loop"},d){let e=a.filter(dH),f=b&&"loop"!==c&&b%2==1?0:e.length-1;return e[f]}(k.keyframes,h);if(void 0!==a)return void a_.update(()=>{k.onUpdate(a),k.onComplete()})}return h.isSync?new dn(k):new dD(k)};function dJ(a,b,{delay:c=0,transitionOverride:d,type:e}={}){let{transition:f=a.getDefaultTransition(),transitionEnd:g,...h}=b;d&&(f=d);let i=[],j=e&&a.animationState&&a.animationState.getState()[e];for(let b in h){let d=a.getValue(b,a.latestValues[b]??null),e=h[b];if(void 0===e||j&&function({protectedKeys:a,needsAnimating:b},c){let d=a.hasOwnProperty(c)&&!0!==b[c];return b[c]=!1,d}(j,b))continue;let g={delay:c,...cs(f||{},b)},k=d.get();if(void 0!==k&&!d.isAnimating&&!Array.isArray(e)&&e===k&&!g.velocity)continue;let l=!1;if(window.MotionHandoffAnimation){let c=a.props[cm];if(c){let a=window.MotionHandoffAnimation(c,b,a_);null!==a&&(g.startTime=a,l=!0)}}cu(a,b),d.start(dI(b,d,e,a.shouldReduceMotion&&aw.has(b)?{type:!1}:g,a,l));let m=d.animation;m&&i.push(m)}return g&&Promise.all(i).then(()=>{a_.update(()=>{g&&function(a,b){let{transitionEnd:c={},transition:d={},...e}=cr(a,b)||{};for(let b in e={...e,...c}){var f;let c=ct(f=e[b])?f[f.length-1]||0:f;a.hasValue(b)?a.getValue(b).set(c):a.addValue(b,bk(c))}}(a,g)})}),i}function dK(a,b,c,d=0,e=1){let f=Array.from(a).sort((a,b)=>a.sortNodePosition(b)).indexOf(b),g=a.size,h=(g-1)*d;return"function"==typeof c?c(f,g):1===e?f*d:h-f*d}function dL(a,b,c={}){let d=cr(a,b,"exit"===c.type?a.presenceContext?.custom:void 0),{transition:e=a.getDefaultTransition()||{}}=d||{};c.transitionOverride&&(e=c.transitionOverride);let f=d?()=>Promise.all(dJ(a,d,c)):()=>Promise.resolve(),g=a.variantChildren&&a.variantChildren.size?(d=0)=>{let{delayChildren:f=0,staggerChildren:g,staggerDirection:h}=e;return function(a,b,c=0,d=0,e=0,f=1,g){let h=[];for(let i of a.variantChildren)i.notify("AnimationStart",b),h.push(dL(i,b,{...g,delay:c+("function"==typeof d?0:d)+dK(a.variantChildren,i,d,e,f)}).then(()=>i.notify("AnimationComplete",b)));return Promise.all(h)}(a,b,d,f,g,h,c)}:()=>Promise.resolve(),{when:h}=e;if(!h)return Promise.all([f(),g(c.delay)]);{let[a,b]="beforeChildren"===h?[f,g]:[g,f];return a().then(()=>b())}}let dM=br.length;function dN(a,b){if(!Array.isArray(b))return!1;let c=b.length;if(c!==a.length)return!1;for(let d=0;d<c;d++)if(b[d]!==a[d])return!1;return!0}let dO=[...bq].reverse(),dP=bq.length;function dQ(a=!1){return{isActive:a,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function dR(){return{animate:dQ(!0),whileInView:dQ(),whileHover:dQ(),whileTap:dQ(),whileDrag:dQ(),whileFocus:dQ(),exit:dQ()}}let dS=0;function dT(a){return[a("x"),a("y")]}let dU=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function dV(a){return dU.has(a.tagName)||!0===a.isContentEditable}function dW(a,b,c,d={passive:!0}){return a.addEventListener(b,c,d),()=>a.removeEventListener(b,c)}let dX={x:!1,y:!1};function dY(a){return a.max-a.min}function dZ(a,b,c,d=.5){a.origin=d,a.originPoint=bO(b.min,b.max,a.origin),a.scale=dY(c)/dY(b),a.translate=bO(c.min,c.max,a.origin)-a.originPoint,(a.scale>=.9999&&a.scale<=1.0001||isNaN(a.scale))&&(a.scale=1),(a.translate>=-.01&&a.translate<=.01||isNaN(a.translate))&&(a.translate=0)}function d$(a,b,c,d){dZ(a.x,b.x,c.x,d?d.originX:void 0),dZ(a.y,b.y,c.y,d?d.originY:void 0)}function d_(a,b,c){a.min=c.min+b.min,a.max=a.min+dY(b)}function d0(a,b,c){a.min=b.min-c.min,a.max=a.min+dY(b)}function d1(a,b,c){d0(a.x,b.x,c.x),d0(a.y,b.y,c.y)}let d2=a=>"mouse"===a.pointerType?"number"!=typeof a.button||a.button<=0:!1!==a.isPrimary;function d3(a){return{point:{x:a.pageX,y:a.pageY}}}function d4(a,b,c,d){return dW(a,b,a=>d2(a)&&c(a,d3(a)),d)}let d5=({current:a})=>a?a.ownerDocument.defaultView:null,d6=(a,b)=>Math.abs(a-b),d7=new Set(["auto","scroll"]);class d8{constructor(a,b,{transformPagePoint:c,contextWindow:d=window,dragSnapToOrigin:e=!1,distanceThreshold:f=3,element:g}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=a=>{this.handleScroll(a.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{var a,b;if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let c=eb(this.lastMoveEventInfo,this.history),d=null!==this.startEvent,e=(a=c.offset,b={x:0,y:0},Math.sqrt(d6(a.x,b.x)**2+d6(a.y,b.y)**2)>=this.distanceThreshold);if(!d&&!e)return;let{point:f}=c,{timestamp:g}=a1;this.history.push({...f,timestamp:g});let{onStart:h,onMove:i}=this.handlers;d||(h&&h(this.lastMoveEvent,c),this.startEvent=this.lastMoveEvent),i&&i(this.lastMoveEvent,c)},this.handlePointerMove=(a,b)=>{this.lastMoveEvent=a,this.lastMoveEventInfo=d9(b,this.transformPagePoint),a_.update(this.updatePoint,!0)},this.handlePointerUp=(a,b)=>{this.end();let{onEnd:c,onSessionEnd:d,resumeAnimation:e}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&e&&e(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let f=eb("pointercancel"===a.type?this.lastMoveEventInfo:d9(b,this.transformPagePoint),this.history);this.startEvent&&c&&c(a,f),d&&d(a,f)},!d2(a))return;this.dragSnapToOrigin=e,this.handlers=b,this.transformPagePoint=c,this.distanceThreshold=f,this.contextWindow=d||window;const h=d9(d3(a),this.transformPagePoint),{point:i}=h,{timestamp:j}=a1;this.history=[{...i,timestamp:j}];const{onSessionStart:k}=b;k&&k(a,eb(h,this.history)),this.removeListeners=cx(d4(this.contextWindow,"pointermove",this.handlePointerMove),d4(this.contextWindow,"pointerup",this.handlePointerUp),d4(this.contextWindow,"pointercancel",this.handlePointerUp)),g&&this.startScrollTracking(g)}startScrollTracking(a){let b=a.parentElement;for(;b;){let a=getComputedStyle(b);(d7.has(a.overflowX)||d7.has(a.overflowY))&&this.scrollPositions.set(b,{x:b.scrollLeft,y:b.scrollTop}),b=b.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0,passive:!0}),window.addEventListener("scroll",this.onWindowScroll,{passive:!0}),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(a){let b=this.scrollPositions.get(a);if(!b)return;let c=a===window,d=c?{x:window.scrollX,y:window.scrollY}:{x:a.scrollLeft,y:a.scrollTop},e={x:d.x-b.x,y:d.y-b.y};(0!==e.x||0!==e.y)&&(c?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=e.x,this.lastMoveEventInfo.point.y+=e.y):this.history.length>0&&(this.history[0].x-=e.x,this.history[0].y-=e.y),this.scrollPositions.set(a,d),a_.update(this.updatePoint,!0))}updateHandlers(a){this.handlers=a}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),a0(this.updatePoint)}}function d9(a,b){return b?{point:b(a.point)}:a}function ea(a,b){return{x:a.x-b.x,y:a.y-b.y}}function eb({point:a},b){return{point:a,delta:ea(a,ec(b)),offset:ea(a,b[0]),velocity:function(a,b){if(a.length<2)return{x:0,y:0};let c=a.length-1,d=null,e=ec(a);for(;c>=0&&(d=a[c],!(e.timestamp-d.timestamp>cv(.1)));)c--;if(!d)return{x:0,y:0};let f=(e.timestamp-d.timestamp)/1e3;if(0===f)return{x:0,y:0};let g={x:(e.x-d.x)/f,y:(e.y-d.y)/f};return g.x===1/0&&(g.x=0),g.y===1/0&&(g.y=0),g}(b,.1)}}function ec(a){return a[a.length-1]}function ed(a,b,c){return{min:void 0!==b?a.min+b:void 0,max:void 0!==c?a.max+c-(a.max-a.min):void 0}}function ee(a,b){let c=b.min-a.min,d=b.max-a.max;return b.max-b.min<a.max-a.min&&([c,d]=[d,c]),{min:c,max:d}}function ef(a,b,c){return{min:eg(a,b),max:eg(a,c)}}function eg(a,b){return"number"==typeof a?a:a[b]||0}let eh=new WeakMap;class ei{constructor(a){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=au(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=a}start(a,{snapToCursor:b=!1,distanceThreshold:c}={}){let{presenceContext:d}=this.visualElement;if(d&&!1===d.isPresent)return;let e=a=>{b?(this.stopAnimation(),this.snapToCursor(d3(a).point)):this.pauseAnimation()},f=(a,b)=>{this.stopAnimation();let{drag:c,dragPropagation:d,onDragStart:e}=this.getProps();if(c&&!d&&(this.openDragLock&&this.openDragLock(),this.openDragLock=function(a){if("x"===a||"y"===a)if(dX[a])return null;else return dX[a]=!0,()=>{dX[a]=!1};return dX.x||dX.y?null:(dX.x=dX.y=!0,()=>{dX.x=dX.y=!1})}(c),!this.openDragLock))return;this.latestPointerEvent=a,this.latestPanInfo=b,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),dT(a=>{let b=this.getAxisMotionValue(a).get()||0;if(V.test(b)){let{projection:c}=this.visualElement;if(c&&c.layout){let d=c.layout.layoutBox[a];d&&(b=dY(d)*(parseFloat(b)/100))}}this.originPoint[a]=b}),e&&a_.postRender(()=>e(a,b)),cu(this.visualElement,"transform");let{animationState:f}=this.visualElement;f&&f.setActive("whileDrag",!0)},g=(a,b)=>{this.latestPointerEvent=a,this.latestPanInfo=b;let{dragPropagation:c,dragDirectionLock:d,onDirectionLock:e,onDrag:f}=this.getProps();if(!c&&!this.openDragLock)return;let{offset:g}=b;if(d&&null===this.currentDirection){this.currentDirection=function(a,b=10){let c=null;return Math.abs(a.y)>b?c="y":Math.abs(a.x)>b&&(c="x"),c}(g),null!==this.currentDirection&&e&&e(this.currentDirection);return}this.updateAxis("x",b.point,g),this.updateAxis("y",b.point,g),this.visualElement.render(),f&&f(a,b)},h=(a,b)=>{this.latestPointerEvent=a,this.latestPanInfo=b,this.stop(a,b),this.latestPointerEvent=null,this.latestPanInfo=null},i=()=>dT(a=>"paused"===this.getAnimationState(a)&&this.getAxisMotionValue(a).animation?.play()),{dragSnapToOrigin:j}=this.getProps();this.panSession=new d8(a,{onSessionStart:e,onStart:f,onMove:g,onSessionEnd:h,resumeAnimation:i},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:j,distanceThreshold:c,contextWindow:d5(this.visualElement),element:this.visualElement.current})}stop(a,b){let c=a||this.latestPointerEvent,d=b||this.latestPanInfo,e=this.isDragging;if(this.cancel(),!e||!d||!c)return;let{velocity:f}=d;this.startAnimation(f);let{onDragEnd:g}=this.getProps();g&&a_.postRender(()=>g(c,d))}cancel(){this.isDragging=!1;let{projection:a,animationState:b}=this.visualElement;a&&(a.isAnimationBlocked=!1),this.endPanSession();let{dragPropagation:c}=this.getProps();!c&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),b&&b.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(a,b,c){let{drag:d}=this.getProps();if(!c||!ej(a,d,this.currentDirection))return;let e=this.getAxisMotionValue(a),f=this.originPoint[a]+c[a];this.constraints&&this.constraints[a]&&(f=function(a,{min:b,max:c},d){return void 0!==b&&a<b?a=d?bO(b,a,d.min):Math.max(a,b):void 0!==c&&a>c&&(a=d?bO(c,a,d.max):Math.min(a,c)),a}(f,this.constraints[a],this.elastic[a])),e.set(f)}resolveConstraints(){let{dragConstraints:a,dragElastic:b}=this.getProps(),c=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,d=this.constraints;a&&co(a)?this.constraints||(this.constraints=this.resolveRefConstraints()):a&&c?this.constraints=function(a,{top:b,left:c,bottom:d,right:e}){return{x:ed(a.x,c,e),y:ed(a.y,b,d)}}(c.layoutBox,a):this.constraints=!1,this.elastic=function(a=.35){return!1===a?a=0:!0===a&&(a=.35),{x:ef(a,"left","right"),y:ef(a,"top","bottom")}}(b),d!==this.constraints&&c&&this.constraints&&!this.hasMutatedConstraints&&dT(a=>{var b,d;let e;!1!==this.constraints&&this.getAxisMotionValue(a)&&(this.constraints[a]=(b=c.layoutBox[a],d=this.constraints[a],e={},void 0!==d.min&&(e.min=d.min-b.min),void 0!==d.max&&(e.max=d.max-b.min),e))})}resolveRefConstraints(){var a;let{dragConstraints:b,onMeasureDragConstraints:c}=this.getProps();if(!b||!co(b))return!1;let d=b.current;aB(null!==d,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.","drag-constraints-ref");let{projection:e}=this.visualElement;if(!e||!e.layout)return!1;let f=function(a,b,c){let d=b3(a,c),{scroll:e}=b;return e&&(b0(d.x,e.offset.x),b0(d.y,e.offset.y)),d}(d,e.root,this.visualElement.getTransformPagePoint()),g=(a=e.layout.layoutBox,{x:ee(a.x,f.x),y:ee(a.y,f.y)});if(c){let a=c(function({x:a,y:b}){return{top:b.min,right:a.max,bottom:b.max,left:a.min}}(g));this.hasMutatedConstraints=!!a,a&&(g=bU(a))}return g}startAnimation(a){let{drag:b,dragMomentum:c,dragElastic:d,dragTransition:e,dragSnapToOrigin:f,onDragTransitionEnd:g}=this.getProps(),h=this.constraints||{};return Promise.all(dT(g=>{if(!ej(g,b,this.currentDirection))return;let i=h&&h[g]||{};f&&(i={min:0,max:0});let j={type:"inertia",velocity:c?a[g]:0,bounceStiffness:d?200:1e6,bounceDamping:d?40:1e7,timeConstant:750,restDelta:1,restSpeed:10,...e,...i};return this.startAxisValueAnimation(g,j)})).then(g)}startAxisValueAnimation(a,b){let c=this.getAxisMotionValue(a);return cu(this.visualElement,a),c.start(dI(a,c,0,b,this.visualElement,!1))}stopAnimation(){dT(a=>this.getAxisMotionValue(a).stop())}pauseAnimation(){dT(a=>this.getAxisMotionValue(a).animation?.pause())}getAnimationState(a){return this.getAxisMotionValue(a).animation?.state}getAxisMotionValue(a){let b=`_drag${a.toUpperCase()}`,c=this.visualElement.getProps();return c[b]||this.visualElement.getValue(a,(c.initial?c.initial[a]:void 0)||0)}snapToCursor(a){dT(b=>{let{drag:c}=this.getProps();if(!ej(b,c,this.currentDirection))return;let{projection:d}=this.visualElement,e=this.getAxisMotionValue(b);if(d&&d.layout){let{min:c,max:f}=d.layout.layoutBox[b],g=e.get()||0;e.set(a[b]-bO(c,f,.5)+g)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;let{drag:a,dragConstraints:b}=this.getProps(),{projection:c}=this.visualElement;if(!co(b)||!c||!this.constraints)return;this.stopAnimation();let d={x:0,y:0};dT(a=>{let b=this.getAxisMotionValue(a);if(b&&!1!==this.constraints){var c,e;let f,g,h,i=b.get();d[a]=(c={min:i,max:i},e=this.constraints[a],f=.5,g=dY(c),(h=dY(e))>g?f=df(e.min,e.max-g,c.min):g>h&&(f=df(c.min,c.max-h,e.min)),H(0,1,f))}});let{transformTemplate:e}=this.visualElement.getProps();this.visualElement.current.style.transform=e?e({},""):"none",c.root&&c.root.updateScroll(),c.updateLayout(),this.resolveConstraints(),dT(b=>{if(!ej(b,a,null))return;let c=this.getAxisMotionValue(b),{min:e,max:f}=this.constraints[b];c.set(bO(e,f,d[b]))})}addListeners(){if(!this.visualElement.current)return;eh.set(this.visualElement,this);let a=this.visualElement.current,b=d4(a,"pointerdown",b=>{let{drag:c,dragListener:d=!0}=this.getProps(),e=b.target,f=e!==a&&dV(e);c&&d&&!f&&this.start(b)}),c=()=>{let{dragConstraints:a}=this.getProps();co(a)&&a.current&&(this.constraints=this.resolveRefConstraints())},{projection:d}=this.visualElement,e=d.addEventListener("measure",c);d&&!d.layout&&(d.root&&d.root.updateScroll(),d.updateLayout()),a_.read(c);let f=dW(window,"resize",()=>this.scalePositionWithinConstraints()),g=d.addEventListener("didUpdate",({delta:a,hasLayoutChanged:b})=>{this.isDragging&&b&&(dT(b=>{let c=this.getAxisMotionValue(b);c&&(this.originPoint[b]+=a[b].translate,c.set(c.get()+a[b].translate))}),this.visualElement.render())});return()=>{f(),b(),e(),g&&g()}}getProps(){let a=this.visualElement.getProps(),{drag:b=!1,dragDirectionLock:c=!1,dragPropagation:d=!1,dragConstraints:e=!1,dragElastic:f=.35,dragMomentum:g=!0}=a;return{...a,drag:b,dragDirectionLock:c,dragPropagation:d,dragConstraints:e,dragElastic:f,dragMomentum:g}}}function ej(a,b,c){return(!0===b||b===a)&&(null===c||c===a)}let ek=a=>(b,c)=>{a&&a_.postRender(()=>a(b,c))},el={hasAnimatedSinceResize:!0,hasEverUpdated:!1};var em=n;let en=!1;class eo extends em.Component{componentDidMount(){let{visualElement:a,layoutGroup:b,switchLayoutGroup:c,layoutId:d}=this.props,{projection:e}=a;e&&(b.group&&b.group.add(e),c&&c.register&&d&&c.register(e),en&&e.root.didUpdate(),e.addEventListener("animationComplete",()=>{this.safeToRemove()}),e.setOptions({...e.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),el.hasEverUpdated=!0}getSnapshotBeforeUpdate(a){let{layoutDependency:b,visualElement:c,drag:d,isPresent:e}=this.props,{projection:f}=c;return f&&(f.isPresent=e,a.layoutDependency!==b&&f.setOptions({...f.options,layoutDependency:b}),en=!0,d||a.layoutDependency!==b||void 0===b||a.isPresent!==e?f.willUpdate():this.safeToRemove(),a.isPresent!==e&&(e?f.promote():f.relegate()||a_.postRender(()=>{let a=f.getStack();a&&a.members.length||this.safeToRemove()}))),null}componentDidUpdate(){let{projection:a}=this.props.visualElement;a&&(a.root.didUpdate(),bg.postRender(()=>{!a.currentAnimation&&a.isLead()&&this.safeToRemove()}))}componentWillUnmount(){let{visualElement:a,layoutGroup:b,switchLayoutGroup:c}=this.props,{projection:d}=a;en=!0,d&&(d.scheduleCheckAfterUnmount(),b&&b.group&&b.group.remove(d),c&&c.deregister&&c.deregister(d))}safeToRemove(){let{safeToRemove:a}=this.props;a&&a()}render(){return null}}function ep(a){let[b,c]=B(),d=(0,em.useContext)(o);return(0,m.jsx)(eo,{...a,layoutGroup:d,switchLayoutGroup:(0,em.useContext)(cn),isPresent:b,safeToRemove:c})}function eq(a,b,c,d,e){return a-=b,a=d+1/c*(a-d),void 0!==e&&(a=d+1/e*(a-d)),a}function er(a,b,[c,d,e],f,g){!function(a,b=0,c=1,d=.5,e,f=a,g=a){if(V.test(b)&&(b=parseFloat(b),b=bO(g.min,g.max,b/100)-g.min),"number"!=typeof b)return;let h=bO(f.min,f.max,d);a===f&&(h-=b),a.min=eq(a.min,b,c,h,e),a.max=eq(a.max,b,c,h,e)}(a,b[c],b[d],b[e],b.scale,f,g)}let es=["x","scaleX","originX"],et=["y","scaleY","originY"];function eu(a,b,c,d){er(a.x,b,es,c?c.x:void 0,d?d.x:void 0),er(a.y,b,et,c?c.y:void 0,d?d.y:void 0)}function ev(a,b){a.min=b.min,a.max=b.max}function ew(a,b){ev(a.x,b.x),ev(a.y,b.y)}function ex(a,b){a.translate=b.translate,a.scale=b.scale,a.originPoint=b.originPoint,a.origin=b.origin}function ey(a){return 0===a.translate&&1===a.scale}function ez(a){return ey(a.x)&&ey(a.y)}function eA(a,b){return a.min===b.min&&a.max===b.max}function eB(a,b){return Math.round(a.min)===Math.round(b.min)&&Math.round(a.max)===Math.round(b.max)}function eC(a,b){return eB(a.x,b.x)&&eB(a.y,b.y)}function eD(a){return dY(a.x)/dY(a.y)}function eE(a,b){return a.translate===b.translate&&a.scale===b.scale&&a.originPoint===b.originPoint}let eF=["TopLeft","TopRight","BottomLeft","BottomRight"],eG=eF.length,eH=a=>"string"==typeof a?parseFloat(a):a,eI=a=>"number"==typeof a||W.test(a);function eJ(a,b){return void 0!==a[b]?a[b]:a.borderRadius}let eK=eM(0,.5,da),eL=eM(.5,.95,aX);function eM(a,b,c){return d=>d<a?0:d>b?1:c(df(a,b,d))}function eN(a){return s(a)&&"ownerSVGElement"in a}let eO=(a,b)=>a.depth-b.depth;class eP{constructor(){this.children=[],this.isDirty=!1}add(a){bd(this.children,a),this.isDirty=!0}remove(a){be(this.children,a),this.isDirty=!0}forEach(a){this.isDirty&&this.children.sort(eO),this.isDirty=!1,this.children.forEach(a)}}class eQ{constructor(){this.members=[]}add(a){bd(this.members,a),a.scheduleRender()}remove(a){if(be(this.members,a),a===this.prevLead&&(this.prevLead=void 0),a===this.lead){let a=this.members[this.members.length-1];a&&this.promote(a)}}relegate(a){let b,c=this.members.findIndex(b=>a===b);if(0===c)return!1;for(let a=c;a>=0;a--){let c=this.members[a];if(!1!==c.isPresent){b=c;break}}return!!b&&(this.promote(b),!0)}promote(a,b){let c=this.lead;if(a!==c&&(this.prevLead=c,this.lead=a,a.show(),c)){c.instance&&c.scheduleRender(),a.scheduleRender();let d=c.options.layoutDependency,e=a.options.layoutDependency;(void 0===d||void 0===e||d!==e)&&(a.resumeFrom=c,b&&(a.resumeFrom.preserveOpacity=!0),c.snapshot&&(a.snapshot=c.snapshot,a.snapshot.latestValues=c.animationValues||c.latestValues),a.root&&a.root.isUpdating&&(a.isLayoutDirty=!0));let{crossfade:f}=a.options;!1===f&&c.hide()}}exitAnimationComplete(){this.members.forEach(a=>{let{options:b,resumingFrom:c}=a;b.onExitComplete&&b.onExitComplete(),c&&c.options.onExitComplete&&c.options.onExitComplete()})}scheduleRender(){this.members.forEach(a=>{a.instance&&a.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}let eR=["","X","Y","Z"],eS=0;function eT(a,b,c,d){let{latestValues:e}=b;e[a]&&(c[a]=e[a],b.setStaticValue(a,0),d&&(d[a]=0))}function eU({attachResizeListener:a,defaultParent:b,measureScroll:c,checkIsScrollRoot:d,resetTransform:e}){return class{constructor(a={},c=b?.()){this.id=eS++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(eX),this.nodes.forEach(e2),this.nodes.forEach(e3),this.nodes.forEach(eY)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=a,this.root=c?c.root||c:this,this.path=c?[...c.path,c]:[],this.parent=c,this.depth=c?c.depth+1:0;for(let a=0;a<this.path.length;a++)this.path[a].shouldResetTransform=!0;this.root===this&&(this.nodes=new eP)}addEventListener(a,b){return this.eventHandlers.has(a)||this.eventHandlers.set(a,new bf),this.eventHandlers.get(a).add(b)}notifyListeners(a,...b){let c=this.eventHandlers.get(a);c&&c.notify(...b)}hasListeners(a){return this.eventHandlers.has(a)}mount(b){if(this.instance)return;this.isSVG=eN(b)&&!(eN(b)&&"svg"===b.tagName),this.instance=b;let{layoutId:c,layout:d,visualElement:e}=this.options;if(e&&!e.current&&e.mount(b),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(d||c)&&(this.isLayoutDirty=!0),a){let c,d=0,e=()=>this.root.updateBlockedByResize=!1;a_.read(()=>{d=window.innerWidth}),a(b,()=>{let a=window.innerWidth;if(a!==d){let b,f;d=a,this.root.updateBlockedByResize=!0,c&&c(),b=bi.now(),f=({timestamp:a})=>{let c=a-b;c>=250&&(a0(f),e(c-250))},a_.setup(f,!0),c=()=>a0(f),el.hasAnimatedSinceResize&&(el.hasAnimatedSinceResize=!1,this.nodes.forEach(e1))}})}c&&this.root.registerSharedNode(c,this),!1!==this.options.animate&&e&&(c||d)&&this.addEventListener("didUpdate",({delta:a,hasLayoutChanged:b,hasRelativeLayoutChanged:c,layout:d})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}let f=this.options.transition||e.getDefaultTransition()||e9,{onLayoutAnimationStart:g,onLayoutAnimationComplete:h}=e.getProps(),i=!this.targetLayout||!eC(this.targetLayout,d),j=!b&&c;if(this.options.layoutRoot||this.resumeFrom||j||b&&(i||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);let b={...cs(f,"layout"),onPlay:g,onComplete:h};(e.shouldReduceMotion||this.options.layoutRoot)&&(b.delay=0,b.type=!1),this.startAnimation(b),this.setAnimationOrigin(a,j)}else b||e1(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=d})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);let a=this.getStack();a&&a.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),a0(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){!this.isUpdateBlocked()&&(this.isUpdating=!0,this.nodes&&this.nodes.forEach(e4),this.animationId++)}getTransformTemplate(){let{visualElement:a}=this.options;return a&&a.getProps().transformTemplate}willUpdate(a=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&function a(b){if(b.hasCheckedOptimisedAppear=!0,b.root===b)return;let{visualElement:c}=b.options;if(!c)return;let d=c.props[cm];if(window.MotionHasOptimisedAnimation(d,"transform")){let{layout:a,layoutId:c}=b.options;window.MotionCancelOptimisedAnimation(d,"transform",a_,!(a||c))}let{parent:e}=b;e&&!e.hasCheckedOptimisedAppear&&a(e)}(this),this.root.isUpdating||this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let a=0;a<this.path.length;a++){let b=this.path[a];b.shouldResetTransform=!0,b.updateScroll("snapshot"),b.options.layoutRoot&&b.willUpdate(!1)}let{layoutId:b,layout:c}=this.options;if(void 0===b&&!c)return;let d=this.getTransformTemplate();this.prevTransformTemplateValue=d?d(this.latestValues,""):void 0,this.updateSnapshot(),a&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(e$);return}if(this.animationId<=this.animationCommitId)return void this.nodes.forEach(e_);this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(e0),this.nodes.forEach(eV),this.nodes.forEach(eW)):this.nodes.forEach(e_),this.clearAllSnapshots();let a=bi.now();a1.delta=H(0,1e3/60,a-a1.timestamp),a1.timestamp=a,a1.isProcessing=!0,a2.update.process(a1),a2.preRender.process(a1),a2.render.process(a1),a1.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,bg.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(eZ),this.sharedNodes.forEach(e5)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,a_.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){a_.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){!this.snapshot&&this.instance&&(this.snapshot=this.measure(),!this.snapshot||dY(this.snapshot.measuredBox.x)||dY(this.snapshot.measuredBox.y)||(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let a=0;a<this.path.length;a++)this.path[a].updateScroll();let a=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected=au(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);let{visualElement:b}=this.options;b&&b.notify("LayoutMeasure",this.layout.layoutBox,a?a.layoutBox:void 0)}updateScroll(a="measure"){let b=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===a&&(b=!1),b&&this.instance){let b=d(this.instance);this.scroll={animationId:this.root.animationId,phase:a,isRoot:b,offset:c(this.instance),wasRoot:this.scroll?this.scroll.isRoot:b}}}resetTransform(){if(!e)return;let a=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,b=this.projectionDelta&&!ez(this.projectionDelta),c=this.getTransformTemplate(),d=c?c(this.latestValues,""):void 0,f=d!==this.prevTransformTemplateValue;a&&this.instance&&(b||bX(this.latestValues)||f)&&(e(this.instance,d),this.shouldResetTransform=!1,this.scheduleRender())}measure(a=!0){var b;let c=this.measurePageBox(),d=this.removeElementScroll(c);return a&&(d=this.removeTransform(d)),fc((b=d).x),fc(b.y),{animationId:this.root.animationId,measuredBox:c,layoutBox:d,latestValues:{},source:this.id}}measurePageBox(){let{visualElement:a}=this.options;if(!a)return au();let b=a.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(fe))){let{scroll:a}=this.root;a&&(b0(b.x,a.offset.x),b0(b.y,a.offset.y))}return b}removeElementScroll(a){let b=au();if(ew(b,a),this.scroll?.wasRoot)return b;for(let c=0;c<this.path.length;c++){let d=this.path[c],{scroll:e,options:f}=d;d!==this.root&&e&&f.layoutScroll&&(e.wasRoot&&ew(b,a),b0(b.x,e.offset.x),b0(b.y,e.offset.y))}return b}applyTransform(a,b=!1){let c=au();ew(c,a);for(let a=0;a<this.path.length;a++){let d=this.path[a];!b&&d.options.layoutScroll&&d.scroll&&d!==d.root&&b2(c,{x:-d.scroll.offset.x,y:-d.scroll.offset.y}),bX(d.latestValues)&&b2(c,d.latestValues)}return bX(this.latestValues)&&b2(c,this.latestValues),c}removeTransform(a){let b=au();ew(b,a);for(let a=0;a<this.path.length;a++){let c=this.path[a];if(!c.instance||!bX(c.latestValues))continue;bW(c.latestValues)&&c.updateSnapshot();let d=au();ew(d,c.measurePageBox()),eu(b,c.latestValues,c.snapshot?c.snapshot.layoutBox:void 0,d)}return bX(this.latestValues)&&eu(b,this.latestValues),b}setTargetDelta(a){this.targetDelta=a,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(a){this.options={...this.options,...a,crossfade:void 0===a.crossfade||a.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==a1.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(a=!1){let b=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=b.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=b.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=b.isSharedProjectionDirty);let c=!!this.resumingFrom||this!==b;if(!(a||c&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;let{layout:d,layoutId:e}=this.options;if(!this.layout||!(d||e))return;this.resolvedRelativeTargetAt=a1.timestamp;let f=this.getClosestProjectingParent();if(f&&this.linkedParentVersion!==f.layoutVersion&&!f.options.layoutRoot&&this.removeRelativeTarget(),this.targetDelta||this.relativeTarget||(f&&f.layout?this.createRelativeTarget(f,this.layout.layoutBox,f.layout.layoutBox):this.removeRelativeTarget()),this.relativeTarget||this.targetDelta){if(this.target||(this.target=au(),this.targetWithTransforms=au()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target){var g,h,i;this.forceRelativeParentToResolveTarget(),g=this.target,h=this.relativeTarget,i=this.relativeParent.target,d_(g.x,h.x,i.x),d_(g.y,h.y,i.y)}else this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):ew(this.target,this.layout.layoutBox),b_(this.target,this.targetDelta)):ew(this.target,this.layout.layoutBox);this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,f&&!!f.resumingFrom==!!this.resumingFrom&&!f.options.layoutScroll&&f.target&&1!==this.animationProgress?this.createRelativeTarget(f,this.target,f.target):this.relativeParent=this.relativeTarget=void 0)}}getClosestProjectingParent(){if(!(!this.parent||bW(this.parent.latestValues)||bY(this.parent.latestValues)))if(this.parent.isProjecting())return this.parent;else return this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(a,b,c){this.relativeParent=a,this.linkedParentVersion=a.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=au(),this.relativeTargetOrigin=au(),d1(this.relativeTargetOrigin,b,c),ew(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){let a=this.getLead(),b=!!this.resumingFrom||this!==a,c=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(c=!1),b&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(c=!1),this.resolvedRelativeTargetAt===a1.timestamp&&(c=!1),c)return;let{layout:d,layoutId:e}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(d||e))return;ew(this.layoutCorrected,this.layout.layoutBox);let f=this.treeScale.x,g=this.treeScale.y;!function(a,b,c,d=!1){let e,f,g=c.length;if(g){b.x=b.y=1;for(let h=0;h<g;h++){f=(e=c[h]).projectionDelta;let{visualElement:g}=e.options;(!g||!g.props.style||"contents"!==g.props.style.display)&&(d&&e.options.layoutScroll&&e.scroll&&e!==e.root&&b2(a,{x:-e.scroll.offset.x,y:-e.scroll.offset.y}),f&&(b.x*=f.x.scale,b.y*=f.y.scale,b_(a,f)),d&&bX(e.latestValues)&&b2(a,e.latestValues))}b.x<1.0000000000001&&b.x>.999999999999&&(b.x=1),b.y<1.0000000000001&&b.y>.999999999999&&(b.y=1)}}(this.layoutCorrected,this.treeScale,this.path,b),a.layout&&!a.target&&(1!==this.treeScale.x||1!==this.treeScale.y)&&(a.target=a.layout.layoutBox,a.targetWithTransforms=au());let{target:h}=a;if(!h){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}this.projectionDelta&&this.prevProjectionDelta?(ex(this.prevProjectionDelta.x,this.projectionDelta.x),ex(this.prevProjectionDelta.y,this.projectionDelta.y)):this.createProjectionDeltas(),d$(this.projectionDelta,this.layoutCorrected,h,this.latestValues),this.treeScale.x===f&&this.treeScale.y===g&&eE(this.projectionDelta.x,this.prevProjectionDelta.x)&&eE(this.projectionDelta.y,this.prevProjectionDelta.y)||(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",h))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(a=!0){if(this.options.visualElement?.scheduleRender(),a){let a=this.getStack();a&&a.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=as(),this.projectionDelta=as(),this.projectionDeltaWithTransform=as()}setAnimationOrigin(a,b=!1){let c,d=this.snapshot,e=d?d.latestValues:{},f={...this.latestValues},g=as();this.relativeParent&&this.relativeParent.options.layoutRoot||(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!b;let h=au(),i=(d?d.source:void 0)!==(this.layout?this.layout.source:void 0),j=this.getStack(),k=!j||j.members.length<=1,l=!!(i&&!k&&!0===this.options.crossfade&&!this.path.some(e8));this.animationProgress=0,this.mixTargetDelta=b=>{let d=b/1e3;if(e6(g.x,a.x,d),e6(g.y,a.y,d),this.setTargetDelta(g),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout){var j,m,n,o,p,q;d1(h,this.layout.layoutBox,this.relativeParent.layout.layoutBox),n=this.relativeTarget,o=this.relativeTargetOrigin,p=h,q=d,e7(n.x,o.x,p.x,q),e7(n.y,o.y,p.y,q),c&&(j=this.relativeTarget,m=c,eA(j.x,m.x)&&eA(j.y,m.y))&&(this.isProjectionDirty=!1),c||(c=au()),ew(c,this.relativeTarget)}i&&(this.animationValues=f,function(a,b,c,d,e,f){e?(a.opacity=bO(0,c.opacity??1,eK(d)),a.opacityExit=bO(b.opacity??1,0,eL(d))):f&&(a.opacity=bO(b.opacity??1,c.opacity??1,d));for(let e=0;e<eG;e++){let f=`border${eF[e]}Radius`,g=eJ(b,f),h=eJ(c,f);(void 0!==g||void 0!==h)&&(g||(g=0),h||(h=0),0===g||0===h||eI(g)===eI(h)?(a[f]=Math.max(bO(eH(g),eH(h),d),0),(V.test(h)||V.test(g))&&(a[f]+="%")):a[f]=h)}(b.rotate||c.rotate)&&(a.rotate=bO(b.rotate||0,c.rotate||0,d))}(f,e,this.latestValues,d,l,k)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=d},this.mixTargetDelta(1e3*!!this.options.layoutRoot)}startAnimation(a){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(a0(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=a_.update(()=>{var b,c,d;let e;el.hasAnimatedSinceResize=!0,cy.layout++,this.motionValue||(this.motionValue=bk(0)),this.currentAnimation=(b=this.motionValue,c=[0,1e3],d={...a,velocity:0,isSync:!0,onUpdate:b=>{this.mixTargetDelta(b),a.onUpdate&&a.onUpdate(b)},onStop:()=>{cy.layout--},onComplete:()=>{cy.layout--,a.onComplete&&a.onComplete(),this.completeAnimation()}},(e=av(b)?b:bk(b)).start(dI("",e,c,d)),e.animation),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);let a=this.getStack();a&&a.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(1e3),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){let a=this.getLead(),{targetWithTransforms:b,target:c,layout:d,latestValues:e}=a;if(b&&c&&d){if(this!==a&&this.layout&&d&&fd(this.options.animationType,this.layout.layoutBox,d.layoutBox)){c=this.target||au();let b=dY(this.layout.layoutBox.x);c.x.min=a.target.x.min,c.x.max=c.x.min+b;let d=dY(this.layout.layoutBox.y);c.y.min=a.target.y.min,c.y.max=c.y.min+d}ew(b,c),b2(b,e),d$(this.projectionDeltaWithTransform,this.layoutCorrected,b,e)}}registerSharedNode(a,b){this.sharedNodes.has(a)||this.sharedNodes.set(a,new eQ),this.sharedNodes.get(a).add(b);let c=b.options.initialPromotionConfig;b.promote({transition:c?c.transition:void 0,preserveFollowOpacity:c&&c.shouldPreserveFollowOpacity?c.shouldPreserveFollowOpacity(b):void 0})}isLead(){let a=this.getStack();return!a||a.lead===this}getLead(){let{layoutId:a}=this.options;return a&&this.getStack()?.lead||this}getPrevLead(){let{layoutId:a}=this.options;return a?this.getStack()?.prevLead:void 0}getStack(){let{layoutId:a}=this.options;if(a)return this.root.sharedNodes.get(a)}promote({needsReset:a,transition:b,preserveFollowOpacity:c}={}){let d=this.getStack();d&&d.promote(this,c),a&&(this.projectionDelta=void 0,this.needsReset=!0),b&&this.setOptions({transition:b})}relegate(){let a=this.getStack();return!!a&&a.relegate(this)}resetSkewAndRotation(){let{visualElement:a}=this.options;if(!a)return;let b=!1,{latestValues:c}=a;if((c.z||c.rotate||c.rotateX||c.rotateY||c.rotateZ||c.skewX||c.skewY)&&(b=!0),!b)return;let d={};c.z&&eT("z",a,d,this.animationValues);for(let b=0;b<eR.length;b++)eT(`rotate${eR[b]}`,a,d,this.animationValues),eT(`skew${eR[b]}`,a,d,this.animationValues);for(let b in a.render(),d)a.setStaticValue(b,d[b]),this.animationValues&&(this.animationValues[b]=d[b]);a.scheduleRender()}applyProjectionStyles(a,b){if(!this.instance||this.isSVG)return;if(!this.isVisible){a.visibility="hidden";return}let c=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,a.visibility="",a.opacity="",a.pointerEvents=cf(b?.pointerEvents)||"",a.transform=c?c(this.latestValues,""):"none";return}let d=this.getLead();if(!this.projectionDelta||!this.layout||!d.target){this.options.layoutId&&(a.opacity=void 0!==this.latestValues.opacity?this.latestValues.opacity:1,a.pointerEvents=cf(b?.pointerEvents)||""),this.hasProjected&&!bX(this.latestValues)&&(a.transform=c?c({},""):"none",this.hasProjected=!1);return}a.visibility="";let e=d.animationValues||d.latestValues;this.applyTransformsToTarget();let f=function(a,b,c){let d="",e=a.x.translate/b.x,f=a.y.translate/b.y,g=c?.z||0;if((e||f||g)&&(d=`translate3d(${e}px, ${f}px, ${g}px) `),(1!==b.x||1!==b.y)&&(d+=`scale(${1/b.x}, ${1/b.y}) `),c){let{transformPerspective:a,rotate:b,rotateX:e,rotateY:f,skewX:g,skewY:h}=c;a&&(d=`perspective(${a}px) ${d}`),b&&(d+=`rotate(${b}deg) `),e&&(d+=`rotateX(${e}deg) `),f&&(d+=`rotateY(${f}deg) `),g&&(d+=`skewX(${g}deg) `),h&&(d+=`skewY(${h}deg) `)}let h=a.x.scale*b.x,i=a.y.scale*b.y;return(1!==h||1!==i)&&(d+=`scale(${h}, ${i})`),d||"none"}(this.projectionDeltaWithTransform,this.treeScale,e);c&&(f=c(e,f)),a.transform=f;let{x:g,y:h}=this.projectionDelta;for(let b in a.transformOrigin=`${100*g.origin}% ${100*h.origin}% 0`,d.animationValues?a.opacity=d===this?e.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:e.opacityExit:a.opacity=d===this?void 0!==e.opacity?e.opacity:"":void 0!==e.opacityExit?e.opacityExit:0,bP){if(void 0===e[b])continue;let{correct:c,applyTo:g,isCSSVariable:h}=bP[b],i="none"===f?e[b]:c(e[b],d);if(g){let b=g.length;for(let c=0;c<b;c++)a[g[c]]=i}else h?this.options.visualElement.renderState.vars[b]=i:a[b]=i}this.options.layoutId&&(a.pointerEvents=d===this?cf(b?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(a=>a.currentAnimation?.stop()),this.root.nodes.forEach(e$),this.root.sharedNodes.clear()}}}function eV(a){a.updateLayout()}function eW(a){let b=a.resumeFrom?.snapshot||a.snapshot;if(a.isLead()&&a.layout&&b&&a.hasListeners("didUpdate")){let{layoutBox:c,measuredBox:d}=a.layout,{animationType:e}=a.options,f=b.source!==a.layout.source;"size"===e?dT(a=>{let d=f?b.measuredBox[a]:b.layoutBox[a],e=dY(d);d.min=c[a].min,d.max=d.min+e}):fd(e,b.layoutBox,c)&&dT(d=>{let e=f?b.measuredBox[d]:b.layoutBox[d],g=dY(c[d]);e.max=e.min+g,a.relativeTarget&&!a.currentAnimation&&(a.isProjectionDirty=!0,a.relativeTarget[d].max=a.relativeTarget[d].min+g)});let g=as();d$(g,c,b.layoutBox);let h=as();f?d$(h,a.applyTransform(d,!0),b.measuredBox):d$(h,c,b.layoutBox);let i=!ez(g),j=!1;if(!a.resumeFrom){let d=a.getClosestProjectingParent();if(d&&!d.resumeFrom){let{snapshot:e,layout:f}=d;if(e&&f){let g=au();d1(g,b.layoutBox,e.layoutBox);let h=au();d1(h,c,f.layoutBox),eC(g,h)||(j=!0),d.options.layoutRoot&&(a.relativeTarget=h,a.relativeTargetOrigin=g,a.relativeParent=d)}}}a.notifyListeners("didUpdate",{layout:c,snapshot:b,delta:h,layoutDelta:g,hasLayoutChanged:i,hasRelativeLayoutChanged:j})}else if(a.isLead()){let{onExitComplete:b}=a.options;b&&b()}a.options.transition=void 0}function eX(a){a.parent&&(a.isProjecting()||(a.isProjectionDirty=a.parent.isProjectionDirty),a.isSharedProjectionDirty||(a.isSharedProjectionDirty=!!(a.isProjectionDirty||a.parent.isProjectionDirty||a.parent.isSharedProjectionDirty)),a.isTransformDirty||(a.isTransformDirty=a.parent.isTransformDirty))}function eY(a){a.isProjectionDirty=a.isSharedProjectionDirty=a.isTransformDirty=!1}function eZ(a){a.clearSnapshot()}function e$(a){a.clearMeasurements()}function e_(a){a.isLayoutDirty=!1}function e0(a){let{visualElement:b}=a.options;b&&b.getProps().onBeforeLayoutMeasure&&b.notify("BeforeLayoutMeasure"),a.resetTransform()}function e1(a){a.finishAnimation(),a.targetDelta=a.relativeTarget=a.target=void 0,a.isProjectionDirty=!0}function e2(a){a.resolveTargetDelta()}function e3(a){a.calcProjection()}function e4(a){a.resetSkewAndRotation()}function e5(a){a.removeLeadSnapshot()}function e6(a,b,c){a.translate=bO(b.translate,0,c),a.scale=bO(b.scale,1,c),a.origin=b.origin,a.originPoint=b.originPoint}function e7(a,b,c,d){a.min=bO(b.min,c.min,d),a.max=bO(b.max,c.max,d)}function e8(a){return a.animationValues&&void 0!==a.animationValues.opacityExit}let e9={duration:.45,ease:[.4,0,.1,1]},fa=a=>"u">typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(a),fb=fa("applewebkit/")&&!fa("chrome/")?Math.round:aX;function fc(a){a.min=fb(a.min),a.max=fb(a.max)}function fd(a,b,c){return"position"===a||"preserve-aspect"===a&&!(.2>=Math.abs(eD(b)-eD(c)))}function fe(a){return a!==a.root&&a.scroll?.wasRoot}let ff=eU({attachResizeListener:(a,b)=>dW(a,"resize",b),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),fg={current:void 0},fh=eU({measureScroll:a=>({x:a.scrollLeft,y:a.scrollTop}),defaultParent:()=>{if(!fg.current){let a=new ff({});a.mount(window),a.setOptions({layoutScroll:!0}),fg.current=a}return fg.current},resetTransform:(a,b)=>{a.style.transform=void 0!==b?b:"none"},checkIsScrollRoot:a=>"fixed"===window.getComputedStyle(a).position});function fi(a,b){let c=function(a,b,c){if(null==a)return[];if(a instanceof EventTarget)return[a];if("string"==typeof a){let b=document,c=(void 0)??b.querySelectorAll(a);return c?Array.from(c):[]}return Array.from(a).filter(a=>null!=a)}(a),d=new AbortController;return[c,{passive:!0,...b,signal:d.signal},()=>d.abort()]}function fj(a){return!("touch"===a.pointerType||dX.x||dX.y)}function fk(a,b,c){let{props:d}=a;a.animationState&&d.whileHover&&a.animationState.setActive("whileHover","Start"===c);let e=d["onHover"+c];e&&a_.postRender(()=>e(b,d3(b)))}let fl=(a,b)=>!!b&&(a===b||fl(a,b.parentElement)),fm=new WeakSet;function fn(a){return b=>{"Enter"===b.key&&a(b)}}function fo(a,b){a.dispatchEvent(new PointerEvent("pointer"+b,{isPrimary:!0,bubbles:!0}))}function fp(a){return d2(a)&&!(dX.x||dX.y)}function fq(a,b,c){let{props:d}=a;if(a.current instanceof HTMLButtonElement&&a.current.disabled)return;a.animationState&&d.whileTap&&a.animationState.setActive("whileTap","Start"===c);let e=d["onTap"+("End"===c?"":c)];e&&a_.postRender(()=>e(b,d3(b)))}let fr=new WeakMap,fs=new WeakMap,ft=a=>{let b=fr.get(a.target);b&&b(a)},fu=a=>{a.forEach(ft)},fv={some:0,all:1},fw=function(a,b){if("u"<typeof Proxy)return cp;let c=new Map,d=(c,d)=>cp(c,d,a,b);return new Proxy((a,b)=>d(a,b),{get:(e,f)=>"create"===f?d:(c.has(f)||c.set(f,cp(f,void 0,a,b)),c.get(f))})}({animation:{Feature:class extends cq{constructor(a){super(a),a.animationState||(a.animationState=function(a){let b=b=>Promise.all(b.map(({animation:b,options:c})=>(function(a,b,c={}){let d;if(a.notify("AnimationStart",b),Array.isArray(b))d=Promise.all(b.map(b=>dL(a,b,c)));else if("string"==typeof b)d=dL(a,b,c);else{let e="function"==typeof b?cr(a,b,c.custom):b;d=Promise.all(dJ(a,e,c))}return d.then(()=>{a.notify("AnimationComplete",b)})})(a,b,c))),c=dR(),d=!0,e=b=>(c,d)=>{let e=cr(a,d,"exit"===b?a.presenceContext?.custom:void 0);if(e){let{transition:a,transitionEnd:b,...d}=e;c={...c,...d,...b}}return c};function f(f){let{props:g}=a,h=function a(b){if(!b)return;if(!b.isControllingVariants){let c=b.parent&&a(b.parent)||{};return void 0!==b.props.initial&&(c.initial=b.props.initial),c}let c={};for(let a=0;a<dM;a++){let d=br[a],e=b.props[d];(bp(e)||!1===e)&&(c[d]=e)}return c}(a.parent)||{},i=[],j=new Set,k={},l=1/0;for(let b=0;b<dP;b++){var m,n;let o=dO[b],p=c[o],q=void 0!==g[o]?g[o]:h[o],r=bp(q),s=o===f?p.isActive:null;!1===s&&(l=b);let t=q===h[o]&&q!==g[o]&&r;if(t&&d&&a.manuallyAnimateOnMount&&(t=!1),p.protectedKeys={...k},!p.isActive&&null===s||!q&&!p.prevProp||bo(q)||"boolean"==typeof q)continue;let u=(m=p.prevProp,"string"==typeof(n=q)?n!==m:!!Array.isArray(n)&&!dN(n,m)),v=u||o===f&&p.isActive&&!t&&r||b>l&&r,w=!1,x=Array.isArray(q)?q:[q],y=x.reduce(e(o),{});!1===s&&(y={});let{prevResolvedValues:z={}}=p,A={...z,...y},B=b=>{v=!0,j.has(b)&&(w=!0,j.delete(b)),p.needsAnimating[b]=!0;let c=a.getValue(b);c&&(c.liveStyle=!1)};for(let a in A){let b=y[a],c=z[a];if(!k.hasOwnProperty(a))(ct(b)&&ct(c)?dN(b,c):b===c)?void 0!==b&&j.has(a)?B(a):p.protectedKeys[a]=!0:null!=b?B(a):j.add(a)}p.prevProp=q,p.prevResolvedValues=y,p.isActive&&(k={...k,...y}),d&&a.blockInitialAnimation&&(v=!1);let C=t&&u,D=!C||w;v&&D&&i.push(...x.map(b=>{let c={type:o};if("string"==typeof b&&d&&!C&&a.manuallyAnimateOnMount&&a.parent){let{parent:d}=a,e=cr(d,b);if(d.enteringChildren&&e){let{delayChildren:b}=e.transition||{};c.delay=dK(d.enteringChildren,a,b)}}return{animation:b,options:c}}))}if(j.size){let b={};if("boolean"!=typeof g.initial){let c=cr(a,Array.isArray(g.initial)?g.initial[0]:g.initial);c&&c.transition&&(b.transition=c.transition)}j.forEach(c=>{let d=a.getBaseTarget(c),e=a.getValue(c);e&&(e.liveStyle=!0),b[c]=d??null}),i.push({animation:b})}let o=!!i.length;return d&&(!1===g.initial||g.initial===g.animate)&&!a.manuallyAnimateOnMount&&(o=!1),d=!1,o?b(i):Promise.resolve()}return{animateChanges:f,setActive:function(b,d){if(c[b].isActive===d)return Promise.resolve();a.variantChildren?.forEach(a=>a.animationState?.setActive(b,d)),c[b].isActive=d;let e=f(b);for(let a in c)c[a].protectedKeys={};return e},setAnimateFunction:function(c){b=c(a)},getState:()=>c,reset:()=>{c=dR()}}}(a))}updateAnimationControlsSubscription(){let{animate:a}=this.node.getProps();bo(a)&&(this.unmountControls=a.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){let{animate:a}=this.node.getProps(),{animate:b}=this.node.prevProps||{};a!==b&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}},exit:{Feature:class extends cq{constructor(){super(...arguments),this.id=dS++}update(){if(!this.node.presenceContext)return;let{isPresent:a,onExitComplete:b}=this.node.presenceContext,{isPresent:c}=this.node.prevPresenceContext||{};if(!this.node.animationState||a===c)return;let d=this.node.animationState.setActive("exit",!a);b&&!a&&d.then(()=>{b(this.id)})}mount(){let{register:a,onExitComplete:b}=this.node.presenceContext||{};b&&b(this.id),a&&(this.unmount=a(this.id))}unmount(){}}},inView:{Feature:class extends cq{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){var a;let b;this.unmount();let{viewport:c={}}=this.node.getProps(),{root:d,margin:e,amount:f="some",once:g}=c,h={root:d?d.current:void 0,rootMargin:e,threshold:"number"==typeof f?f:fv[f]},i=a=>{let{isIntersecting:b}=a;if(this.isInView===b||(this.isInView=b,g&&!b&&this.hasEnteredView))return;b&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",b);let{onViewportEnter:c,onViewportLeave:d}=this.node.getProps(),e=b?c:d;e&&e(a)};return a=this.node.current,b=function({root:a,...b}){let c=a||document;fs.has(c)||fs.set(c,{});let d=fs.get(c),e=JSON.stringify(b);return d[e]||(d[e]=new IntersectionObserver(fu,{root:a,...b})),d[e]}(h),fr.set(a,i),b.observe(a),()=>{fr.delete(a),b.unobserve(a)}}mount(){this.startObserver()}update(){if("u"<typeof IntersectionObserver)return;let{props:a,prevProps:b}=this.node;["amount","margin","root"].some(function({viewport:a={}},{viewport:b={}}={}){return c=>a[c]!==b[c]}(a,b))&&this.startObserver()}unmount(){}}},tap:{Feature:class extends cq{mount(){let{current:a}=this.node;a&&(this.unmount=function(a,b,c={}){let[d,e,f]=fi(a,c),g=a=>{let d=a.currentTarget;if(!fp(a))return;fm.add(d);let f=b(d,a),g=(a,b)=>{window.removeEventListener("pointerup",h),window.removeEventListener("pointercancel",i),fm.has(d)&&fm.delete(d),fp(a)&&"function"==typeof f&&f(a,{success:b})},h=a=>{g(a,d===window||d===document||c.useGlobalTarget||fl(d,a.target))},i=a=>{g(a,!1)};window.addEventListener("pointerup",h,e),window.addEventListener("pointercancel",i,e)};return d.forEach(a=>{(c.useGlobalTarget?window:a).addEventListener("pointerdown",g,e),t(a)&&(a.addEventListener("focus",a=>((a,b)=>{let c=a.currentTarget;if(!c)return;let d=fn(()=>{if(fm.has(c))return;fo(c,"down");let a=fn(()=>{fo(c,"up")});c.addEventListener("keyup",a,b),c.addEventListener("blur",()=>fo(c,"cancel"),b)});c.addEventListener("keydown",d,b),c.addEventListener("blur",()=>c.removeEventListener("keydown",d),b)})(a,e)),dV(a)||a.hasAttribute("tabindex")||(a.tabIndex=0))}),f}(a,(a,b)=>(fq(this.node,b,"Start"),(a,{success:b})=>fq(this.node,a,b?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}},focus:{Feature:class extends cq{constructor(){super(...arguments),this.isActive=!1}onFocus(){let a=!1;try{a=this.node.current.matches(":focus-visible")}catch(b){a=!0}a&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){this.isActive&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=cx(dW(this.node.current,"focus",()=>this.onFocus()),dW(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}},hover:{Feature:class extends cq{mount(){let{current:a}=this.node;a&&(this.unmount=function(a,b,c={}){let[d,e,f]=fi(a,c),g=a=>{if(!fj(a))return;let{target:c}=a,d=b(c,a);if("function"!=typeof d||!c)return;let f=a=>{fj(a)&&(d(a),c.removeEventListener("pointerleave",f))};c.addEventListener("pointerleave",f,e)};return d.forEach(a=>{a.addEventListener("pointerenter",g,e)}),f}(a,(a,b)=>(fk(this.node,b,"Start"),a=>fk(this.node,a,"End"))))}unmount(){}}},pan:{Feature:class extends cq{constructor(){super(...arguments),this.removePointerDownListener=aX}onPointerDown(a){this.session=new d8(a,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:d5(this.node)})}createPanHandlers(){let{onPanSessionStart:a,onPanStart:b,onPan:c,onPanEnd:d}=this.node.getProps();return{onSessionStart:ek(a),onStart:ek(b),onMove:c,onEnd:(a,b)=>{delete this.session,d&&a_.postRender(()=>d(a,b))}}}mount(){this.removePointerDownListener=d4(this.node.current,"pointerdown",a=>this.onPointerDown(a))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}},drag:{Feature:class extends cq{constructor(a){super(a),this.removeGroupControls=aX,this.removeListeners=aX,this.controls=new ei(a)}mount(){let{dragControls:a}=this.node.getProps();a&&(this.removeGroupControls=a.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||aX}update(){let{dragControls:a}=this.node.getProps(),{dragControls:b}=this.node.prevProps||{};a!==b&&(this.removeGroupControls(),a&&(this.removeGroupControls=a.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}},ProjectionNode:fh,MeasureLayout:ep},layout:{ProjectionNode:fh,MeasureLayout:ep}},(a,b)=>b.isSVG??b6(a)?new bT(b):new b4(b,{allowProjection:a!==n.Fragment}));var fx=a.i(96924),fy=a.i(7903),fz=a.i(98416),fA=a.i(30112),fB=a.i(16347),fC=a.i(60087),fD=a.i(15896),fE=a.i(2655),fF=class extends fB.Subscribable{constructor(a,b){super(),this.options=b,this.#a=a,this.#b=null,this.#c=(0,fC.pendingThenable)(),this.bindMethods(),this.setOptions(b)}#a;#d=void 0;#e=void 0;#f=void 0;#g;#h;#c;#b;#i;#j;#k;#l;#m;#n;#o=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(this.#d.addObserver(this),fG(this.#d,this.options)?this.#p():this.updateResult(),this.#q())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return fH(this.#d,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return fH(this.#d,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#r(),this.#s(),this.#d.removeObserver(this)}setOptions(a){let b=this.options,c=this.#d;if(this.options=this.#a.defaultQueryOptions(a),void 0!==this.options.enabled&&"boolean"!=typeof this.options.enabled&&"function"!=typeof this.options.enabled&&"boolean"!=typeof(0,fD.resolveEnabled)(this.options.enabled,this.#d))throw Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#t(),this.#d.setOptions(this.options),b._defaulted&&!(0,fD.shallowEqualObjects)(this.options,b)&&this.#a.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#d,observer:this});let d=this.hasListeners();d&&fI(this.#d,c,this.options,b)&&this.#p(),this.updateResult(),d&&(this.#d!==c||(0,fD.resolveEnabled)(this.options.enabled,this.#d)!==(0,fD.resolveEnabled)(b.enabled,this.#d)||(0,fD.resolveStaleTime)(this.options.staleTime,this.#d)!==(0,fD.resolveStaleTime)(b.staleTime,this.#d))&&this.#u();let e=this.#v();d&&(this.#d!==c||(0,fD.resolveEnabled)(this.options.enabled,this.#d)!==(0,fD.resolveEnabled)(b.enabled,this.#d)||e!==this.#n)&&this.#w(e)}getOptimisticResult(a){var b,c;let d=this.#a.getQueryCache().build(this.#a,a),e=this.createResult(d,a);return b=this,c=e,(0,fD.shallowEqualObjects)(b.getCurrentResult(),c)||(this.#f=e,this.#h=this.options,this.#g=this.#d.state),e}getCurrentResult(){return this.#f}trackResult(a,b){return new Proxy(a,{get:(a,c)=>(this.trackProp(c),b?.(c),"promise"===c&&(this.trackProp("data"),this.options.experimental_prefetchInRender||"pending"!==this.#c.status||this.#c.reject(Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(a,c))})}trackProp(a){this.#o.add(a)}getCurrentQuery(){return this.#d}refetch({...a}={}){return this.fetch({...a})}fetchOptimistic(a){let b=this.#a.defaultQueryOptions(a),c=this.#a.getQueryCache().build(this.#a,b);return c.fetch().then(()=>this.createResult(c,b))}fetch(a){return this.#p({...a,cancelRefetch:a.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#f))}#p(a){this.#t();let b=this.#d.fetch(this.options,a);return a?.throwOnError||(b=b.catch(fD.noop)),b}#u(){this.#r();let a=(0,fD.resolveStaleTime)(this.options.staleTime,this.#d);if(fD.isServer||this.#f.isStale||!(0,fD.isValidTimeout)(a))return;let b=(0,fD.timeUntilStale)(this.#f.dataUpdatedAt,a);this.#l=fE.timeoutManager.setTimeout(()=>{this.#f.isStale||this.updateResult()},b+1)}#v(){return("function"==typeof this.options.refetchInterval?this.options.refetchInterval(this.#d):this.options.refetchInterval)??!1}#w(a){this.#s(),this.#n=a,!fD.isServer&&!1!==(0,fD.resolveEnabled)(this.options.enabled,this.#d)&&(0,fD.isValidTimeout)(this.#n)&&0!==this.#n&&(this.#m=fE.timeoutManager.setInterval(()=>{(this.options.refetchIntervalInBackground||fy.focusManager.isFocused())&&this.#p()},this.#n))}#q(){this.#u(),this.#w(this.#v())}#r(){this.#l&&(fE.timeoutManager.clearTimeout(this.#l),this.#l=void 0)}#s(){this.#m&&(fE.timeoutManager.clearInterval(this.#m),this.#m=void 0)}createResult(a,b){let c,d=this.#d,e=this.options,f=this.#f,g=this.#g,h=this.#h,i=a!==d?a.state:this.#e,{state:j}=a,k={...j},l=!1;if(b._optimisticResults){let c=this.hasListeners(),f=!c&&fG(a,b),g=c&&fI(a,d,b,e);(f||g)&&(k={...k,...(0,fA.fetchState)(j.data,a.options)}),"isRestoring"===b._optimisticResults&&(k.fetchStatus="idle")}let{error:m,errorUpdatedAt:n,status:o}=k;c=k.data;let p=!1;if(void 0!==b.placeholderData&&void 0===c&&"pending"===o){let a;f?.isPlaceholderData&&b.placeholderData===h?.placeholderData?(a=f.data,p=!0):a="function"==typeof b.placeholderData?b.placeholderData(this.#k?.state.data,this.#k):b.placeholderData,void 0!==a&&(o="success",c=(0,fD.replaceData)(f?.data,a,b),l=!0)}if(b.select&&void 0!==c&&!p)if(f&&c===g?.data&&b.select===this.#i)c=this.#j;else try{this.#i=b.select,c=b.select(c),c=(0,fD.replaceData)(f?.data,c,b),this.#j=c,this.#b=null}catch(a){this.#b=a}this.#b&&(m=this.#b,c=this.#j,n=Date.now(),o="error");let q="fetching"===k.fetchStatus,r="pending"===o,s="error"===o,t=r&&q,u=void 0!==c,v={status:o,fetchStatus:k.fetchStatus,isPending:r,isSuccess:"success"===o,isError:s,isInitialLoading:t,isLoading:t,data:c,dataUpdatedAt:k.dataUpdatedAt,error:m,errorUpdatedAt:n,failureCount:k.fetchFailureCount,failureReason:k.fetchFailureReason,errorUpdateCount:k.errorUpdateCount,isFetched:k.dataUpdateCount>0||k.errorUpdateCount>0,isFetchedAfterMount:k.dataUpdateCount>i.dataUpdateCount||k.errorUpdateCount>i.errorUpdateCount,isFetching:q,isRefetching:q&&!r,isLoadingError:s&&!u,isPaused:"paused"===k.fetchStatus,isPlaceholderData:l,isRefetchError:s&&u,isStale:fJ(a,b),refetch:this.refetch,promise:this.#c,isEnabled:!1!==(0,fD.resolveEnabled)(b.enabled,a)};if(this.options.experimental_prefetchInRender){let b=void 0!==v.data,c="error"===v.status&&!b,e=a=>{c?a.reject(v.error):b&&a.resolve(v.data)},f=()=>{e(this.#c=v.promise=(0,fC.pendingThenable)())},g=this.#c;switch(g.status){case"pending":a.queryHash===d.queryHash&&e(g);break;case"fulfilled":(c||v.data!==g.value)&&f();break;case"rejected":c&&v.error===g.reason||f()}}return v}updateResult(){let a=this.#f,b=this.createResult(this.#d,this.options);if(this.#g=this.#d.state,this.#h=this.options,void 0!==this.#g.data&&(this.#k=this.#d),(0,fD.shallowEqualObjects)(b,a))return;this.#f=b;let c=()=>{if(!a)return!0;let{notifyOnChangeProps:b}=this.options,c="function"==typeof b?b():b;if("all"===c||!c&&!this.#o.size)return!0;let d=new Set(c??this.#o);return this.options.throwOnError&&d.add("error"),Object.keys(this.#f).some(b=>this.#f[b]!==a[b]&&d.has(b))};this.#x({listeners:c()})}#t(){let a=this.#a.getQueryCache().build(this.#a,this.options);if(a===this.#d)return;let b=this.#d;this.#d=a,this.#e=a.state,this.hasListeners()&&(b?.removeObserver(this),a.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#q()}#x(a){fz.notifyManager.batch(()=>{a.listeners&&this.listeners.forEach(a=>{a(this.#f)}),this.#a.getQueryCache().notify({query:this.#d,type:"observerResultsUpdated"})})}};function fG(a,b){return!1!==(0,fD.resolveEnabled)(b.enabled,a)&&void 0===a.state.data&&("error"!==a.state.status||!1!==b.retryOnMount)||void 0!==a.state.data&&fH(a,b,b.refetchOnMount)}function fH(a,b,c){if(!1!==(0,fD.resolveEnabled)(b.enabled,a)&&"static"!==(0,fD.resolveStaleTime)(b.staleTime,a)){let d="function"==typeof c?c(a):c;return"always"===d||!1!==d&&fJ(a,b)}return!1}function fI(a,b,c,d){return(a!==b||!1===(0,fD.resolveEnabled)(d.enabled,a))&&(!c.suspense||"error"!==a.state.status)&&fJ(a,c)}function fJ(a,b){return!1!==(0,fD.resolveEnabled)(b.enabled,a)&&a.isStaleByTime((0,fD.resolveStaleTime)(b.staleTime,a))}var fK=a.i(14220),fL=n.createContext((d=!1,{clearReset:()=>{d=!1},reset:()=>{d=!0},isReset:()=>d})),fM=n.createContext(!1);fM.Provider;var fN=(a,b,c)=>b.fetchOptimistic(a).catch(()=>{c.clearReset()});function fO(a,b){return function(a,b,c){let d,e=n.useContext(fM),f=n.useContext(fL),g=(0,fK.useQueryClient)(c),h=g.defaultQueryOptions(a);g.getDefaultOptions().queries?._experimental_beforeQuery?.(h);let i=g.getQueryCache().get(h.queryHash);if(h._optimisticResults=e?"isRestoring":"optimistic",h.suspense){let a=a=>"static"===a?a:Math.max(a??1e3,1e3),b=h.staleTime;h.staleTime="function"==typeof b?(...c)=>a(b(...c)):a(b),"number"==typeof h.gcTime&&(h.gcTime=Math.max(h.gcTime,1e3))}d=i?.state.error&&"function"==typeof h.throwOnError?(0,fD.shouldThrowError)(h.throwOnError,[i.state.error,i]):h.throwOnError,(h.suspense||h.experimental_prefetchInRender||d)&&!f.isReset()&&(h.retryOnMount=!1),n.useEffect(()=>{f.clearReset()},[f]);let j=!g.getQueryCache().get(h.queryHash),[k]=n.useState(()=>new b(g,h)),l=k.getOptimisticResult(h),m=!e&&!1!==a.subscribed;if(n.useSyncExternalStore(n.useCallback(a=>{let b=m?k.subscribe(fz.notifyManager.batchCalls(a)):fD.noop;return k.updateResult(),b},[k,m]),()=>k.getCurrentResult(),()=>k.getCurrentResult()),n.useEffect(()=>{k.setOptions(h)},[h,k]),h?.suspense&&l.isPending)throw fN(h,k,f);if((({result:a,errorResetBoundary:b,throwOnError:c,query:d,suspense:e})=>a.isError&&!b.isReset()&&!a.isFetching&&d&&(e&&void 0===a.data||(0,fD.shouldThrowError)(c,[a.error,d])))({result:l,errorResetBoundary:f,throwOnError:h.throwOnError,query:i,suspense:h.suspense}))throw l.error;if(g.getDefaultOptions().queries?._experimental_afterQuery?.(h,l),h.experimental_prefetchInRender&&!fD.isServer&&l.isLoading&&l.isFetching&&!e){let a=j?fN(h,k,f):i?.promise;a?.catch(fD.noop).finally(()=>{k.updateResult()})}return h.notifyOnChangeProps?l:k.trackResult(l)}(a,fF,b)}var fP=a.i(46674),fQ=fB,fR=class extends fQ.Subscribable{#a;#f=void 0;#y;#z;constructor(a,b){super(),this.#a=a,this.setOptions(b),this.bindMethods(),this.#A()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(a){let b=this.options;this.options=this.#a.defaultMutationOptions(a),(0,fD.shallowEqualObjects)(this.options,b)||this.#a.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#y,observer:this}),b?.mutationKey&&this.options.mutationKey&&(0,fD.hashKey)(b.mutationKey)!==(0,fD.hashKey)(this.options.mutationKey)?this.reset():this.#y?.state.status==="pending"&&this.#y.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#y?.removeObserver(this)}onMutationUpdate(a){this.#A(),this.#x(a)}getCurrentResult(){return this.#f}reset(){this.#y?.removeObserver(this),this.#y=void 0,this.#A(),this.#x()}mutate(a,b){return this.#z=b,this.#y?.removeObserver(this),this.#y=this.#a.getMutationCache().build(this.#a,this.options),this.#y.addObserver(this),this.#y.execute(a)}#A(){let a=this.#y?.state??(0,fP.getDefaultState)();this.#f={...a,isPending:"pending"===a.status,isSuccess:"success"===a.status,isError:"error"===a.status,isIdle:"idle"===a.status,mutate:this.mutate,reset:this.reset}}#x(a){fz.notifyManager.batch(()=>{if(this.#z&&this.hasListeners()){let b=this.#f.variables,c=this.#f.context,d={client:this.#a,meta:this.options.meta,mutationKey:this.options.mutationKey};if(a?.type==="success"){try{this.#z.onSuccess?.(a.data,b,c,d)}catch(a){Promise.reject(a)}try{this.#z.onSettled?.(a.data,null,b,c,d)}catch(a){Promise.reject(a)}}else if(a?.type==="error"){try{this.#z.onError?.(a.error,b,c,d)}catch(a){Promise.reject(a)}try{this.#z.onSettled?.(void 0,a.error,b,c,d)}catch(a){Promise.reject(a)}}}this.listeners.forEach(a=>{a(this.#f)})})}};function fS(a,b){let c=(0,fK.useQueryClient)(b),[d]=n.useState(()=>new fR(c,a));n.useEffect(()=>{d.setOptions(a)},[d,a]);let e=n.useSyncExternalStore(n.useCallback(a=>d.subscribe(fz.notifyManager.batchCalls(a)),[d]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),f=n.useCallback((a,b)=>{d.mutate(a,b).catch(fD.noop)},[d]);if(e.error&&(0,fD.shouldThrowError)(d.options.throwOnError,[e.error]))throw e.error;return{...e,mutate:f,mutateAsync:e.mutate}}let fT=process.env.NEXT_PUBLIC_API_URL||"http://localhost:3001",fU=null,fV=null;async function fW(){if(fU)return fU;if(fV)return fV;fV=(async()=>{let a=await fetch(`${fT}/api/auth/session-token`);if(!a.ok)throw Error((await a.json().catch(()=>({}))).error||"Failed to fetch session token");let{token:b}=await a.json();return fU=b,b})();try{return await fV}finally{fV=null}}async function fX(a,b){let c=await fW(),d=new Headers(b?.headers);return d.set("Authorization",`Bearer ${c}`),fetch(a,{...b,headers:d})}let fY=process.env.NEXT_PUBLIC_WS_URL||"ws://localhost:3001/ws/events",fZ=process.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";async function f$(a){let b=new URLSearchParams;a?.project&&b.set("project",a.project),a?.type&&b.set("type",a.type),a?.category&&b.set("category",a.category),a?.limit&&b.set("limit",a.limit.toString()),a?.offset&&b.set("offset",a.offset.toString()),a?.mode&&b.set("mode",a.mode),a?.query&&b.set("query",a.query);let c=await fetch(`${fZ}/api/memories?${b}`);if(!c.ok)throw Error("Failed to fetch memories");return c.json()}async function f_(a){let b=a?`?project=${a}`:"",c=await fetch(`${fZ}/api/stats${b}`);if(!c.ok)throw Error("Failed to fetch stats");return c.json()}async function f0(a){let b=a?`?project=${a}`:"",c=await fetch(`${fZ}/api/links${b}`);if(!c.ok)throw Error("Failed to fetch links");return c.json()}async function f1(){let a=await fetch(`${fZ}/api/projects`);if(!a.ok)throw Error("Failed to fetch projects");return a.json()}async function f2(a){let b=await fX(`${fZ}/api/memories/${a}/access`,{method:"POST"});if(!b.ok)throw Error("Failed to access memory");return b.json()}async function f3(){let a=await fX(`${fZ}/api/consolidate`,{method:"POST"});if(!a.ok)throw Error("Failed to consolidate");return a.json()}function f4(a){return fO({queryKey:["stats",a],queryFn:()=>f_(a),refetchInterval:3e4})}async function f5(){let a=await fetch(`${fZ}/api/control/status`);if(!a.ok)throw Error("Failed to fetch control status");return a.json()}async function f6(){let a=await fX(`${fZ}/api/control/pause`,{method:"POST"});if(!a.ok)throw Error("Failed to pause");return a.json()}async function f7(){let a=await fX(`${fZ}/api/control/resume`,{method:"POST"});if(!a.ok)throw Error("Failed to resume");return a.json()}async function f8(){let a=await fetch(`${fZ}/api/version`);if(!a.ok)throw Error("Failed to fetch version");return a.json()}async function f9(a,b){let c=await fX(`${fZ}/api/memories/${a}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)});if(!c.ok)throw Error("Failed to edit memory");return c.json()}async function ga(a){let b=await fX(`${fZ}/api/memories/${a}`,{method:"DELETE"});if(!b.ok)throw Error("Failed to delete memory");return b.json()}let gb=a=>{let b,c=new Set,d=(a,d)=>{let e="function"==typeof a?a(b):a;if(!Object.is(e,b)){let a=b;b=(null!=d?d:"object"!=typeof e||null===e)?e:Object.assign({},b,e),c.forEach(c=>c(b,a))}},e=()=>b,f={setState:d,getState:e,getInitialState:()=>g,subscribe:a=>(c.add(a),()=>c.delete(a))},g=b=a(d,e,f);return f},gc=a=>{let b=a?gb(a):gb,c=a=>(function(a,b=a=>a){let c=n.default.useSyncExternalStore(a.subscribe,n.default.useCallback(()=>b(a.getState()),[a,b]),n.default.useCallback(()=>b(a.getInitialState()),[a,b]));return n.default.useDebugValue(c),c})(b,a);return Object.assign(c,b),c},gd=(e=a=>({selectedMemory:null,setSelectedMemory:b=>a({selectedMemory:b}),selectedAuditEntry:null,setSelectedAuditEntry:b=>a({selectedAuditEntry:b}),viewMode:"shield",setViewMode:b=>a({viewMode:b}),typeFilter:null,categoryFilter:null,projectFilter:null,setTypeFilter:b=>a({typeFilter:b}),setCategoryFilter:b=>a({categoryFilter:b}),setProjectFilter:b=>a({projectFilter:b}),recentEvents:[],addEvent:b=>a(a=>({recentEvents:[b,...a.recentEvents].slice(0,50)})),clearEvents:()=>a({recentEvents:[]}),cameraPosition:[0,0,12],setCameraPosition:b=>a({cameraPosition:b}),showLeftSidebar:!0,showRightSidebar:!0,toggleLeftSidebar:()=>a(a=>({showLeftSidebar:!a.showLeftSidebar})),toggleRightSidebar:()=>a(a=>({showRightSidebar:!a.showRightSidebar})),searchQuery:"",setSearchQuery:b=>a({searchQuery:b})}))?gc(e):gc;function ge(a,b=300){let[c,d]=(0,n.useState)(a);return(0,n.useEffect)(()=>{let c=setTimeout(()=>{d(a)},b);return()=>{clearTimeout(c)}},[a,b]),c}let gf=process.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";async function gg(a){if(!a||a.length<2)return[];let b=await fetch(`${gf}/api/suggestions?q=${encodeURIComponent(a)}&limit=8`);if(!b.ok)throw Error("Failed to fetch suggestions");return(await b.json()).suggestions}function gh(){for(var a,b,c=0,d="",e=arguments.length;c<e;c++)(a=arguments[c])&&(b=function a(b){var c,d,e="";if("string"==typeof b||"number"==typeof b)e+=b;else if("object"==typeof b)if(Array.isArray(b)){var f=b.length;for(c=0;c<f;c++)b[c]&&(d=a(b[c]))&&(e&&(e+=" "),e+=d)}else for(d in b)b[d]&&(e&&(e+=" "),e+=d);return e}(a))&&(d&&(d+=" "),d+=b);return d}let gi=(a=new Map,b=null,c)=>({nextPart:a,validators:b,classGroupId:c}),gj=[],gk=(a,b,c)=>{if(0==a.length-b)return c.classGroupId;let d=a[b],e=c.nextPart.get(d);if(e){let c=gk(a,b+1,e);if(c)return c}let f=c.validators;if(null===f)return;let g=0===b?a.join("-"):a.slice(b).join("-"),h=f.length;for(let a=0;a<h;a++){let b=f[a];if(b.validator(g))return b.classGroupId}},gl=(a,b)=>{let c=gi();for(let d in a)gm(a[d],c,d,b);return c},gm=(a,b,c,d)=>{let e=a.length;for(let f=0;f<e;f++)gn(a[f],b,c,d)},gn=(a,b,c,d)=>{"string"==typeof a?go(a,b,c):"function"==typeof a?gp(a,b,c,d):gq(a,b,c,d)},go=(a,b,c)=>{(""===a?b:gr(b,a)).classGroupId=c},gp=(a,b,c,d)=>{gs(a)?gm(a(d),b,c,d):(null===b.validators&&(b.validators=[]),b.validators.push({classGroupId:c,validator:a}))},gq=(a,b,c,d)=>{let e=Object.entries(a),f=e.length;for(let a=0;a<f;a++){let[f,g]=e[a];gm(g,gr(b,f),c,d)}},gr=(a,b)=>{let c=a,d=b.split("-"),e=d.length;for(let a=0;a<e;a++){let b=d[a],e=c.nextPart.get(b);e||(e=gi(),c.nextPart.set(b,e)),c=e}return c},gs=a=>"isThemeGetter"in a&&!0===a.isThemeGetter,gt=[],gu=(a,b,c,d,e)=>({modifiers:a,hasImportantModifier:b,baseClassName:c,maybePostfixModifierPosition:d,isExternal:e}),gv=/\s+/,gw=a=>{let b;if("string"==typeof a)return a;let c="";for(let d=0;d<a.length;d++)a[d]&&(b=gw(a[d]))&&(c&&(c+=" "),c+=b);return c},gx=[],gy=a=>{let b=b=>b[a]||gx;return b.isThemeGetter=!0,b},gz=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,gA=/^\((?:(\w[\w-]*):)?(.+)\)$/i,gB=/^\d+\/\d+$/,gC=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,gD=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,gE=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,gF=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,gG=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,gH=a=>gB.test(a),gI=a=>!!a&&!Number.isNaN(Number(a)),gJ=a=>!!a&&Number.isInteger(Number(a)),gK=a=>a.endsWith("%")&&gI(a.slice(0,-1)),gL=a=>gC.test(a),gM=()=>!0,gN=a=>gD.test(a)&&!gE.test(a),gO=()=>!1,gP=a=>gF.test(a),gQ=a=>gG.test(a),gR=a=>!gT(a)&&!gZ(a),gS=a=>g4(a,g8,gO),gT=a=>gz.test(a),gU=a=>g4(a,g9,gN),gV=a=>g4(a,ha,gI),gW=a=>g4(a,g6,gO),gX=a=>g4(a,g7,gQ),gY=a=>g4(a,hc,gP),gZ=a=>gA.test(a),g$=a=>g5(a,g9),g_=a=>g5(a,hb),g0=a=>g5(a,g6),g1=a=>g5(a,g8),g2=a=>g5(a,g7),g3=a=>g5(a,hc,!0),g4=(a,b,c)=>{let d=gz.exec(a);return!!d&&(d[1]?b(d[1]):c(d[2]))},g5=(a,b,c=!1)=>{let d=gA.exec(a);return!!d&&(d[1]?b(d[1]):c)},g6=a=>"position"===a||"percentage"===a,g7=a=>"image"===a||"url"===a,g8=a=>"length"===a||"size"===a||"bg-size"===a,g9=a=>"length"===a,ha=a=>"number"===a,hb=a=>"family-name"===a,hc=a=>"shadow"===a,hd=((a,...b)=>{let c,d,e,f,g=a=>{let b=d(a);if(b)return b;let f=((a,b)=>{let{parseClassName:c,getClassGroupId:d,getConflictingClassGroupIds:e,sortModifiers:f}=b,g=[],h=a.trim().split(gv),i="";for(let a=h.length-1;a>=0;a-=1){let b=h[a],{isExternal:j,modifiers:k,hasImportantModifier:l,baseClassName:m,maybePostfixModifierPosition:n}=c(b);if(j){i=b+(i.length>0?" "+i:i);continue}let o=!!n,p=d(o?m.substring(0,n):m);if(!p){if(!o||!(p=d(m))){i=b+(i.length>0?" "+i:i);continue}o=!1}let q=0===k.length?"":1===k.length?k[0]:f(k).join(":"),r=l?q+"!":q,s=r+p;if(g.indexOf(s)>-1)continue;g.push(s);let t=e(p,o);for(let a=0;a<t.length;++a){let b=t[a];g.push(r+b)}i=b+(i.length>0?" "+i:i)}return i})(a,c);return e(a,f),f};return f=h=>{var i;let j;return d=(c={cache:(a=>{if(a<1)return{get:()=>void 0,set:()=>{}};let b=0,c=Object.create(null),d=Object.create(null),e=(e,f)=>{c[e]=f,++b>a&&(b=0,d=c,c=Object.create(null))};return{get(a){let b=c[a];return void 0!==b?b:void 0!==(b=d[a])?(e(a,b),b):void 0},set(a,b){a in c?c[a]=b:e(a,b)}}})((i=b.reduce((a,b)=>b(a),a())).cacheSize),parseClassName:(a=>{let{prefix:b,experimentalParseClassName:c}=a,d=a=>{let b,c=[],d=0,e=0,f=0,g=a.length;for(let h=0;h<g;h++){let g=a[h];if(0===d&&0===e){if(":"===g){c.push(a.slice(f,h)),f=h+1;continue}if("/"===g){b=h;continue}}"["===g?d++:"]"===g?d--:"("===g?e++:")"===g&&e--}let h=0===c.length?a:a.slice(f),i=h,j=!1;return h.endsWith("!")?(i=h.slice(0,-1),j=!0):h.startsWith("!")&&(i=h.slice(1),j=!0),gu(c,j,i,b&&b>f?b-f:void 0)};if(b){let a=b+":",c=d;d=b=>b.startsWith(a)?c(b.slice(a.length)):gu(gt,!1,b,void 0,!0)}if(c){let a=d;d=b=>c({className:b,parseClassName:a})}return d})(i),sortModifiers:(j=new Map,i.orderSensitiveModifiers.forEach((a,b)=>{j.set(a,1e6+b)}),a=>{let b=[],c=[];for(let d=0;d<a.length;d++){let e=a[d],f="["===e[0],g=j.has(e);f||g?(c.length>0&&(c.sort(),b.push(...c),c=[]),b.push(e)):c.push(e)}return c.length>0&&(c.sort(),b.push(...c)),b}),...(a=>{let b=(a=>{let{theme:b,classGroups:c}=a;return gl(c,b)})(a),{conflictingClassGroups:c,conflictingClassGroupModifiers:d}=a;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]")){var c;let b,d,e;return -1===(c=a).slice(1,-1).indexOf(":")?void 0:(d=(b=c.slice(1,-1)).indexOf(":"),(e=b.slice(0,d))?"arbitrary.."+e:void 0)}let d=a.split("-"),e=+(""===d[0]&&d.length>1);return gk(d,e,b)},getConflictingClassGroupIds:(a,b)=>{if(b){let b=d[a],e=c[a];if(b){if(e){let a=Array(e.length+b.length);for(let b=0;b<e.length;b++)a[b]=e[b];for(let c=0;c<b.length;c++)a[e.length+c]=b[c];return a}return b}return e||gj}return c[a]||gj}}})(i)}).cache.get,e=c.cache.set,f=g,g(h)},(...a)=>f(((...a)=>{let b,c,d=0,e="";for(;d<a.length;)(b=a[d++])&&(c=gw(b))&&(e&&(e+=" "),e+=c);return e})(...a))})(()=>{let a=gy("color"),b=gy("font"),c=gy("text"),d=gy("font-weight"),e=gy("tracking"),f=gy("leading"),g=gy("breakpoint"),h=gy("container"),i=gy("spacing"),j=gy("radius"),k=gy("shadow"),l=gy("inset-shadow"),m=gy("text-shadow"),n=gy("drop-shadow"),o=gy("blur"),p=gy("perspective"),q=gy("aspect"),r=gy("ease"),s=gy("animate"),t=()=>["auto","avoid","all","avoid-page","page","left","right","column"],u=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],v=()=>[...u(),gZ,gT],w=()=>["auto","hidden","clip","visible","scroll"],x=()=>["auto","contain","none"],y=()=>[gZ,gT,i],z=()=>[gH,"full","auto",...y()],A=()=>[gJ,"none","subgrid",gZ,gT],B=()=>["auto",{span:["full",gJ,gZ,gT]},gJ,gZ,gT],C=()=>[gJ,"auto",gZ,gT],D=()=>["auto","min","max","fr",gZ,gT],E=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],F=()=>["start","end","center","stretch","center-safe","end-safe"],G=()=>["auto",...y()],H=()=>[gH,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...y()],I=()=>[a,gZ,gT],J=()=>[...u(),g0,gW,{position:[gZ,gT]}],K=()=>["no-repeat",{repeat:["","x","y","space","round"]}],L=()=>["auto","cover","contain",g1,gS,{size:[gZ,gT]}],M=()=>[gK,g$,gU],N=()=>["","none","full",j,gZ,gT],O=()=>["",gI,g$,gU],P=()=>["solid","dashed","dotted","double"],Q=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],R=()=>[gI,gK,g0,gW],S=()=>["","none",o,gZ,gT],T=()=>["none",gI,gZ,gT],U=()=>["none",gI,gZ,gT],V=()=>[gI,gZ,gT],W=()=>[gH,"full",...y()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[gL],breakpoint:[gL],color:[gM],container:[gL],"drop-shadow":[gL],ease:["in","out","in-out"],font:[gR],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[gL],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[gL],shadow:[gL],spacing:["px",gI],text:[gL],"text-shadow":[gL],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",gH,gT,gZ,q]}],container:["container"],columns:[{columns:[gI,gT,gZ,h]}],"break-after":[{"break-after":t()}],"break-before":[{"break-before":t()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:v()}],overflow:[{overflow:w()}],"overflow-x":[{"overflow-x":w()}],"overflow-y":[{"overflow-y":w()}],overscroll:[{overscroll:x()}],"overscroll-x":[{"overscroll-x":x()}],"overscroll-y":[{"overscroll-y":x()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:z()}],"inset-x":[{"inset-x":z()}],"inset-y":[{"inset-y":z()}],start:[{start:z()}],end:[{end:z()}],top:[{top:z()}],right:[{right:z()}],bottom:[{bottom:z()}],left:[{left:z()}],visibility:["visible","invisible","collapse"],z:[{z:[gJ,"auto",gZ,gT]}],basis:[{basis:[gH,"full","auto",h,...y()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[gI,gH,"auto","initial","none",gT]}],grow:[{grow:["",gI,gZ,gT]}],shrink:[{shrink:["",gI,gZ,gT]}],order:[{order:[gJ,"first","last","none",gZ,gT]}],"grid-cols":[{"grid-cols":A()}],"col-start-end":[{col:B()}],"col-start":[{"col-start":C()}],"col-end":[{"col-end":C()}],"grid-rows":[{"grid-rows":A()}],"row-start-end":[{row:B()}],"row-start":[{"row-start":C()}],"row-end":[{"row-end":C()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":D()}],"auto-rows":[{"auto-rows":D()}],gap:[{gap:y()}],"gap-x":[{"gap-x":y()}],"gap-y":[{"gap-y":y()}],"justify-content":[{justify:[...E(),"normal"]}],"justify-items":[{"justify-items":[...F(),"normal"]}],"justify-self":[{"justify-self":["auto",...F()]}],"align-content":[{content:["normal",...E()]}],"align-items":[{items:[...F(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...F(),{baseline:["","last"]}]}],"place-content":[{"place-content":E()}],"place-items":[{"place-items":[...F(),"baseline"]}],"place-self":[{"place-self":["auto",...F()]}],p:[{p:y()}],px:[{px:y()}],py:[{py:y()}],ps:[{ps:y()}],pe:[{pe:y()}],pt:[{pt:y()}],pr:[{pr:y()}],pb:[{pb:y()}],pl:[{pl:y()}],m:[{m:G()}],mx:[{mx:G()}],my:[{my:G()}],ms:[{ms:G()}],me:[{me:G()}],mt:[{mt:G()}],mr:[{mr:G()}],mb:[{mb:G()}],ml:[{ml:G()}],"space-x":[{"space-x":y()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":y()}],"space-y-reverse":["space-y-reverse"],size:[{size:H()}],w:[{w:[h,"screen",...H()]}],"min-w":[{"min-w":[h,"screen","none",...H()]}],"max-w":[{"max-w":[h,"screen","none","prose",{screen:[g]},...H()]}],h:[{h:["screen","lh",...H()]}],"min-h":[{"min-h":["screen","lh","none",...H()]}],"max-h":[{"max-h":["screen","lh",...H()]}],"font-size":[{text:["base",c,g$,gU]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[d,gZ,gV]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",gK,gT]}],"font-family":[{font:[g_,gT,b]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[e,gZ,gT]}],"line-clamp":[{"line-clamp":[gI,"none",gZ,gV]}],leading:[{leading:[f,...y()]}],"list-image":[{"list-image":["none",gZ,gT]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",gZ,gT]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:I()}],"text-color":[{text:I()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...P(),"wavy"]}],"text-decoration-thickness":[{decoration:[gI,"from-font","auto",gZ,gU]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[gI,"auto",gZ,gT]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:y()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",gZ,gT]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",gZ,gT]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:J()}],"bg-repeat":[{bg:K()}],"bg-size":[{bg:L()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},gJ,gZ,gT],radial:["",gZ,gT],conic:[gJ,gZ,gT]},g2,gX]}],"bg-color":[{bg:I()}],"gradient-from-pos":[{from:M()}],"gradient-via-pos":[{via:M()}],"gradient-to-pos":[{to:M()}],"gradient-from":[{from:I()}],"gradient-via":[{via:I()}],"gradient-to":[{to:I()}],rounded:[{rounded:N()}],"rounded-s":[{"rounded-s":N()}],"rounded-e":[{"rounded-e":N()}],"rounded-t":[{"rounded-t":N()}],"rounded-r":[{"rounded-r":N()}],"rounded-b":[{"rounded-b":N()}],"rounded-l":[{"rounded-l":N()}],"rounded-ss":[{"rounded-ss":N()}],"rounded-se":[{"rounded-se":N()}],"rounded-ee":[{"rounded-ee":N()}],"rounded-es":[{"rounded-es":N()}],"rounded-tl":[{"rounded-tl":N()}],"rounded-tr":[{"rounded-tr":N()}],"rounded-br":[{"rounded-br":N()}],"rounded-bl":[{"rounded-bl":N()}],"border-w":[{border:O()}],"border-w-x":[{"border-x":O()}],"border-w-y":[{"border-y":O()}],"border-w-s":[{"border-s":O()}],"border-w-e":[{"border-e":O()}],"border-w-t":[{"border-t":O()}],"border-w-r":[{"border-r":O()}],"border-w-b":[{"border-b":O()}],"border-w-l":[{"border-l":O()}],"divide-x":[{"divide-x":O()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":O()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...P(),"hidden","none"]}],"divide-style":[{divide:[...P(),"hidden","none"]}],"border-color":[{border:I()}],"border-color-x":[{"border-x":I()}],"border-color-y":[{"border-y":I()}],"border-color-s":[{"border-s":I()}],"border-color-e":[{"border-e":I()}],"border-color-t":[{"border-t":I()}],"border-color-r":[{"border-r":I()}],"border-color-b":[{"border-b":I()}],"border-color-l":[{"border-l":I()}],"divide-color":[{divide:I()}],"outline-style":[{outline:[...P(),"none","hidden"]}],"outline-offset":[{"outline-offset":[gI,gZ,gT]}],"outline-w":[{outline:["",gI,g$,gU]}],"outline-color":[{outline:I()}],shadow:[{shadow:["","none",k,g3,gY]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":["none",l,g3,gY]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:O()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[gI,gU]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":O()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":["none",m,g3,gY]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[gI,gZ,gT]}],"mix-blend":[{"mix-blend":[...Q(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Q()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[gI]}],"mask-image-linear-from-pos":[{"mask-linear-from":R()}],"mask-image-linear-to-pos":[{"mask-linear-to":R()}],"mask-image-linear-from-color":[{"mask-linear-from":I()}],"mask-image-linear-to-color":[{"mask-linear-to":I()}],"mask-image-t-from-pos":[{"mask-t-from":R()}],"mask-image-t-to-pos":[{"mask-t-to":R()}],"mask-image-t-from-color":[{"mask-t-from":I()}],"mask-image-t-to-color":[{"mask-t-to":I()}],"mask-image-r-from-pos":[{"mask-r-from":R()}],"mask-image-r-to-pos":[{"mask-r-to":R()}],"mask-image-r-from-color":[{"mask-r-from":I()}],"mask-image-r-to-color":[{"mask-r-to":I()}],"mask-image-b-from-pos":[{"mask-b-from":R()}],"mask-image-b-to-pos":[{"mask-b-to":R()}],"mask-image-b-from-color":[{"mask-b-from":I()}],"mask-image-b-to-color":[{"mask-b-to":I()}],"mask-image-l-from-pos":[{"mask-l-from":R()}],"mask-image-l-to-pos":[{"mask-l-to":R()}],"mask-image-l-from-color":[{"mask-l-from":I()}],"mask-image-l-to-color":[{"mask-l-to":I()}],"mask-image-x-from-pos":[{"mask-x-from":R()}],"mask-image-x-to-pos":[{"mask-x-to":R()}],"mask-image-x-from-color":[{"mask-x-from":I()}],"mask-image-x-to-color":[{"mask-x-to":I()}],"mask-image-y-from-pos":[{"mask-y-from":R()}],"mask-image-y-to-pos":[{"mask-y-to":R()}],"mask-image-y-from-color":[{"mask-y-from":I()}],"mask-image-y-to-color":[{"mask-y-to":I()}],"mask-image-radial":[{"mask-radial":[gZ,gT]}],"mask-image-radial-from-pos":[{"mask-radial-from":R()}],"mask-image-radial-to-pos":[{"mask-radial-to":R()}],"mask-image-radial-from-color":[{"mask-radial-from":I()}],"mask-image-radial-to-color":[{"mask-radial-to":I()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":u()}],"mask-image-conic-pos":[{"mask-conic":[gI]}],"mask-image-conic-from-pos":[{"mask-conic-from":R()}],"mask-image-conic-to-pos":[{"mask-conic-to":R()}],"mask-image-conic-from-color":[{"mask-conic-from":I()}],"mask-image-conic-to-color":[{"mask-conic-to":I()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:J()}],"mask-repeat":[{mask:K()}],"mask-size":[{mask:L()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",gZ,gT]}],filter:[{filter:["","none",gZ,gT]}],blur:[{blur:S()}],brightness:[{brightness:[gI,gZ,gT]}],contrast:[{contrast:[gI,gZ,gT]}],"drop-shadow":[{"drop-shadow":["","none",n,g3,gY]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:["",gI,gZ,gT]}],"hue-rotate":[{"hue-rotate":[gI,gZ,gT]}],invert:[{invert:["",gI,gZ,gT]}],saturate:[{saturate:[gI,gZ,gT]}],sepia:[{sepia:["",gI,gZ,gT]}],"backdrop-filter":[{"backdrop-filter":["","none",gZ,gT]}],"backdrop-blur":[{"backdrop-blur":S()}],"backdrop-brightness":[{"backdrop-brightness":[gI,gZ,gT]}],"backdrop-contrast":[{"backdrop-contrast":[gI,gZ,gT]}],"backdrop-grayscale":[{"backdrop-grayscale":["",gI,gZ,gT]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[gI,gZ,gT]}],"backdrop-invert":[{"backdrop-invert":["",gI,gZ,gT]}],"backdrop-opacity":[{"backdrop-opacity":[gI,gZ,gT]}],"backdrop-saturate":[{"backdrop-saturate":[gI,gZ,gT]}],"backdrop-sepia":[{"backdrop-sepia":["",gI,gZ,gT]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":y()}],"border-spacing-x":[{"border-spacing-x":y()}],"border-spacing-y":[{"border-spacing-y":y()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",gZ,gT]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[gI,"initial",gZ,gT]}],ease:[{ease:["linear","initial",r,gZ,gT]}],delay:[{delay:[gI,gZ,gT]}],animate:[{animate:["none",s,gZ,gT]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[p,gZ,gT]}],"perspective-origin":[{"perspective-origin":v()}],rotate:[{rotate:T()}],"rotate-x":[{"rotate-x":T()}],"rotate-y":[{"rotate-y":T()}],"rotate-z":[{"rotate-z":T()}],scale:[{scale:U()}],"scale-x":[{"scale-x":U()}],"scale-y":[{"scale-y":U()}],"scale-z":[{"scale-z":U()}],"scale-3d":["scale-3d"],skew:[{skew:V()}],"skew-x":[{"skew-x":V()}],"skew-y":[{"skew-y":V()}],transform:[{transform:[gZ,gT,"","none","gpu","cpu"]}],"transform-origin":[{origin:v()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:W()}],"translate-x":[{"translate-x":W()}],"translate-y":[{"translate-y":W()}],"translate-z":[{"translate-z":W()}],"translate-none":["translate-none"],accent:[{accent:I()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:I()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",gZ,gT]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":y()}],"scroll-mx":[{"scroll-mx":y()}],"scroll-my":[{"scroll-my":y()}],"scroll-ms":[{"scroll-ms":y()}],"scroll-me":[{"scroll-me":y()}],"scroll-mt":[{"scroll-mt":y()}],"scroll-mr":[{"scroll-mr":y()}],"scroll-mb":[{"scroll-mb":y()}],"scroll-ml":[{"scroll-ml":y()}],"scroll-p":[{"scroll-p":y()}],"scroll-px":[{"scroll-px":y()}],"scroll-py":[{"scroll-py":y()}],"scroll-ps":[{"scroll-ps":y()}],"scroll-pe":[{"scroll-pe":y()}],"scroll-pt":[{"scroll-pt":y()}],"scroll-pr":[{"scroll-pr":y()}],"scroll-pb":[{"scroll-pb":y()}],"scroll-pl":[{"scroll-pl":y()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",gZ,gT]}],fill:[{fill:["none",...I()]}],"stroke-w":[{stroke:[gI,g$,gU,gV]}],stroke:[{stroke:["none",...I()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});function he(...a){return hd(gh(a))}function hf({className:a,...b}){return(0,m.jsx)("div",{"data-slot":"card",className:he("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",a),...b})}function hg({className:a,...b}){return(0,m.jsx)("div",{"data-slot":"card-header",className:he("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",a),...b})}function hh({className:a,...b}){return(0,m.jsx)("div",{"data-slot":"card-title",className:he("leading-none font-semibold",a),...b})}function hi({className:a,...b}){return(0,m.jsx)("div",{"data-slot":"card-content",className:he("px-6",a),...b})}function hj(a,b){if("function"==typeof a)return a(b);null!=a&&(a.current=b)}var hk=Symbol.for("react.lazy"),hl=n[" use ".trim().toString()];function hm(a){var b;return null!=a&&"object"==typeof a&&"$$typeof"in a&&a.$$typeof===hk&&"_payload"in a&&"object"==typeof(b=a._payload)&&null!==b&&"then"in b}var hn=((k=n.forwardRef((a,b)=>{let{children:c,...d}=a;if(hm(c)&&"function"==typeof hl&&(c=hl(c._payload)),n.isValidElement(c)){var e;let a,f,g=(e=c,(f=(a=Object.getOwnPropertyDescriptor(e.props,"ref")?.get)&&"isReactWarning"in a&&a.isReactWarning)?e.ref:(f=(a=Object.getOwnPropertyDescriptor(e,"ref")?.get)&&"isReactWarning"in a&&a.isReactWarning)?e.props.ref:e.props.ref||e.ref),h=function(a,b){let c={...b};for(let d in b){let e=a[d],f=b[d];/^on[A-Z]/.test(d)?e&&f?c[d]=(...a)=>{let b=f(...a);return e(...a),b}:e&&(c[d]=e):"style"===d?c[d]={...e,...f}:"className"===d&&(c[d]=[e,f].filter(Boolean).join(" "))}return{...a,...c}}(d,c.props);return c.type!==n.Fragment&&(h.ref=b?function(...a){return b=>{let c=!1,d=a.map(a=>{let d=hj(a,b);return c||"function"!=typeof d||(c=!0),d});if(c)return()=>{for(let b=0;b<d.length;b++){let c=d[b];"function"==typeof c?c():hj(a[b],null)}}}}(b,g):g),n.cloneElement(c,h)}return n.Children.count(c)>1?n.Children.only(null):null})).displayName="Slot.SlotClone",f=k,(g=n.forwardRef((a,b)=>{let{children:c,...d}=a;hm(c)&&"function"==typeof hl&&(c=hl(c._payload));let e=n.Children.toArray(c),g=e.find(hp);if(g){let a=g.props.children,c=e.map(b=>b!==g?b:n.Children.count(a)>1?n.Children.only(null):n.isValidElement(a)?a.props.children:null);return(0,m.jsx)(f,{...d,ref:b,children:n.isValidElement(a)?n.cloneElement(a,void 0,c):null})}return(0,m.jsx)(f,{...d,ref:b,children:c})})).displayName="Slot.Slot",g),ho=Symbol("radix.slottable");function hp(a){return n.isValidElement(a)&&"function"==typeof a.type&&"__radixId"in a.type&&a.type.__radixId===ho}let hq=a=>"boolean"==typeof a?`${a}`:0===a?"0":a,hr=(h="inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",i={variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}},a=>{var b;if((null==i?void 0:i.variants)==null)return gh(h,null==a?void 0:a.class,null==a?void 0:a.className);let{variants:c,defaultVariants:d}=i,e=Object.keys(c).map(b=>{let e=null==a?void 0:a[b],f=null==d?void 0:d[b];if(null===e)return null;let g=hq(e)||hq(f);return c[b][g]}),f=a&&Object.entries(a).reduce((a,b)=>{let[c,d]=b;return void 0===d||(a[c]=d),a},{});return gh(h,e,null==i||null==(b=i.compoundVariants)?void 0:b.reduce((a,b)=>{let{class:c,className:e,...g}=b;return Object.entries(g).every(a=>{let[b,c]=a;return Array.isArray(c)?c.includes({...d,...f}[b]):({...d,...f})[b]===c})?[...a,c,e]:a},[]),null==a?void 0:a.class,null==a?void 0:a.className)});function hs({className:a,variant:b="default",size:c="default",asChild:d=!1,...e}){return(0,m.jsx)(d?hn:"button",{"data-slot":"button","data-variant":b,"data-size":c,className:he(hr({variant:b,size:c,className:a})),...e})}function ht({className:a,type:b,...c}){return(0,m.jsx)("input",{type:b,"data-slot":"input",className:he("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",a),...c})}let hu={architecture:"#FFD700",pattern:"#FFB347",preference:"#FFA500",error:"#FF6B6B",context:"#FFC080",learning:"#FFE4B5",todo:"#FF8C00",note:"#FFCC66",relationship:"#00D4FF",custom:"#FFB347"},hv={short_term:"#FFD700",episodic:"#FFB347",long_term:"#FF8C00"};function hw(a){return hu[a]||hu.custom}function hx(a){return hv[a]||hv.short_term}let hy={references:{color:"#60a5fa",label:"References",icon:"→"},extends:{color:"#34d399",label:"Extends",icon:"⊃"},contradicts:{color:"#f87171",label:"Contradicts",icon:"⊗"},related:{color:"#a78bfa",label:"Related",icon:"~"}},hz=["architecture","pattern","preference","error","context","learning","todo","note","relationship","custom"];function hA({memory:a,links:b=[],memories:c=[],onClose:d,onReinforce:e,onSelectMemory:f,isReinforcing:g=!1,reinforceSuccess:h=!1}){let i,j,[k,l]=(0,n.useState)(!1),[o,p]=(0,n.useState)(null),[q,r]=(0,n.useState)(!1),[s,t]=(0,n.useState)(a.title),[u,v]=(0,n.useState)(a.content),[w,x]=(0,n.useState)(a.category),[y,z]=(0,n.useState)((a.tags||[]).join(", ")),[A,B]=(0,n.useState)(!1),C=(i=(0,fK.useQueryClient)(),fS({mutationFn:({id:a,updates:b})=>f9(a,b),onSuccess:()=>{i.invalidateQueries({queryKey:["memories"]}),i.invalidateQueries({queryKey:["stats"]})}})),D=(j=(0,fK.useQueryClient)(),fS({mutationFn:ga,onSuccess:()=>{j.invalidateQueries({queryKey:["memories"]}),j.invalidateQueries({queryKey:["stats"]}),j.invalidateQueries({queryKey:["links"]})}})),[E,F]=(0,n.useState)(a.id);E!==a.id&&(F(a.id),r(!1),B(!1),t(a.title),v(a.content),x(a.category),z((a.tags||[]).join(", "))),(0,n.useEffect)(()=>{if(h&&o===a.id){let a=setTimeout(()=>l(!0),0),b=setTimeout(()=>l(!1),1500);return()=>{clearTimeout(a),clearTimeout(b)}}},[h,o,a.id]);let G=(0,n.useCallback)(()=>{let b=y.split(",").map(a=>a.trim()).filter(Boolean);C.mutate({id:a.id,updates:{title:s,content:u,category:w,tags:b}},{onSuccess:()=>{r(!1)}})},[a.id,s,u,w,y,C]),H=function(a){if(!a.lastAccessed)return 1;let b=Date.now(),c=new Date(a.lastAccessed).getTime();return Math.pow({short_term:.995,long_term:.9995,episodic:.998}[a.type]||.995,(b-c)/36e5)}(a),I=hw(a.category),J=hx(a.type),K=H>.7?{label:"Healthy",color:"#22C55E",bgColor:"rgba(34, 197, 94, 0.15)"}:H>.4?{label:"Fading",color:"#EAB308",bgColor:"rgba(234, 179, 8, 0.15)"}:{label:"Critical",color:"#EF4444",bgColor:"rgba(239, 68, 68, 0.15)"},L=(0,n.useMemo)(()=>{let d=[];for(let e of b)if(e.source_id===a.id){let a=c.find(a=>a.id===e.target_id);a&&d.push({memory:a,relationship:e.relationship,strength:e.strength,direction:"to"})}else if(e.target_id===a.id){let a=c.find(a=>a.id===e.source_id);a&&d.push({memory:a,relationship:e.relationship,strength:e.strength,direction:"from"})}return d.sort((a,b)=>b.strength-a.strength)},[a.id,b,c]);return(0,m.jsxs)(hf,{className:`bg-slate-900 border-slate-700 h-full overflow-auto transition-all duration-300 ${k?"ring-2 ring-green-500 ring-opacity-75":""}`,children:[(0,m.jsxs)(hg,{className:"border-b border-slate-700 pb-3",children:[(0,m.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[q?(0,m.jsx)(ht,{value:s,onChange:a=>t(a.target.value),className:"bg-slate-800 border-slate-600 text-white text-lg font-semibold"}):(0,m.jsx)(hh,{className:"text-lg font-semibold text-white leading-tight",children:a.title}),(0,m.jsx)(hs,{variant:"ghost",size:"sm",onClick:d,className:"text-slate-400 hover:text-white -mt-1 shrink-0",children:"✕"})]}),(0,m.jsxs)("div",{className:"flex items-center gap-2 mt-2",children:[q?(0,m.jsx)("select",{value:w,onChange:a=>x(a.target.value),className:"bg-slate-800 border border-slate-600 text-white text-xs rounded-lg px-2 py-1",children:hz.map(a=>(0,m.jsx)("option",{value:a,children:a},a))}):(0,m.jsx)("span",{className:"px-2 py-0.5 rounded text-xs font-medium",style:{backgroundColor:I+"20",color:I},children:a.category}),(0,m.jsx)("span",{className:"px-2 py-0.5 rounded text-xs font-medium",style:{backgroundColor:J+"20",color:J},children:a.type.replace("_","-")})]})]}),(0,m.jsxs)(hi,{className:"p-4 space-y-4",children:[(0,m.jsxs)("div",{children:[(0,m.jsx)("h4",{className:"text-xs font-medium text-slate-400 mb-1",children:"Content"}),q?(0,m.jsx)("textarea",{value:u,onChange:a=>v(a.target.value),rows:6,className:"w-full bg-slate-800 border border-slate-600 text-sm text-slate-200 rounded-lg p-3 resize-y focus:ring-cyan-500 focus:border-cyan-500"}):(0,m.jsx)("p",{className:"text-sm text-slate-200 whitespace-pre-wrap leading-relaxed",children:a.content})]}),q&&(0,m.jsxs)("div",{children:[(0,m.jsx)("h4",{className:"text-xs font-medium text-slate-400 mb-1",children:"Tags (comma-separated)"}),(0,m.jsx)(ht,{value:y,onChange:a=>z(a.target.value),placeholder:"tag1, tag2, tag3",className:"bg-slate-800 border-slate-600 text-white text-sm"})]}),q?(0,m.jsxs)("div",{className:"flex gap-2",children:[(0,m.jsx)(hs,{variant:"default",size:"sm",onClick:G,disabled:C.isPending,className:"flex-1 bg-emerald-600 hover:bg-emerald-700",children:C.isPending?"Saving...":"Save Changes"}),(0,m.jsx)(hs,{variant:"outline",size:"sm",onClick:()=>{r(!1),t(a.title),v(a.content),x(a.category),z((a.tags||[]).join(", "))},className:"flex-1 border-slate-600 text-slate-300 hover:text-white",children:"Cancel"})]}):null,!q&&(0,m.jsxs)("div",{className:"rounded-lg p-3 flex items-center gap-3",style:{backgroundColor:K.bgColor},children:[(0,m.jsx)("div",{className:"w-3 h-3 rounded-full animate-pulse",style:{backgroundColor:K.color}}),(0,m.jsxs)("div",{children:[(0,m.jsx)("div",{className:"text-sm font-medium",style:{color:K.color},children:K.label}),(0,m.jsx)("div",{className:"text-xs text-slate-400",children:H>.7?"Memory is strong and stable":H>.4?"Memory is fading - reinforce to preserve":"Memory at risk of deletion - reinforce now"})]})]}),!q&&(0,m.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,m.jsxs)("div",{className:"bg-slate-800 rounded-lg p-3",children:[(0,m.jsx)("div",{className:"text-xs text-slate-400",children:"Salience"}),(0,m.jsxs)("div",{className:"text-lg font-bold text-white",children:[(100*a.salience).toFixed(0),"%"]}),(0,m.jsx)("div",{className:"mt-1 h-1.5 bg-slate-700 rounded-full overflow-hidden",children:(0,m.jsx)("div",{className:"h-full bg-gradient-to-r from-red-500 via-yellow-500 to-green-500 rounded-full transition-all",style:{width:`${100*a.salience}%`}})})]}),(0,m.jsxs)("div",{className:"bg-slate-800 rounded-lg p-3",children:[(0,m.jsx)("div",{className:"text-xs text-slate-400",children:"Decay Factor"}),(0,m.jsxs)("div",{className:"text-lg font-bold text-white",children:[(100*H).toFixed(0),"%"]}),(0,m.jsx)("div",{className:"mt-1 h-1.5 bg-slate-700 rounded-full overflow-hidden",children:(0,m.jsx)("div",{className:"h-full rounded-full transition-all",style:{width:`${100*H}%`,backgroundColor:K.color}})})]})]}),!q&&(0,m.jsxs)("div",{className:`bg-slate-800 rounded-lg p-3 space-y-2 transition-all duration-300 ${k?"ring-1 ring-green-500/50":""}`,children:[(0,m.jsxs)("div",{className:"flex justify-between items-center",children:[(0,m.jsx)("span",{className:"text-xs text-slate-400",children:"Access Count"}),(0,m.jsxs)("span",{className:`text-sm font-medium transition-all duration-300 ${k?"text-green-400 scale-110":"text-white"}`,children:[a.accessCount," times"]})]}),(0,m.jsxs)("div",{className:"flex justify-between items-center",children:[(0,m.jsx)("span",{className:"text-xs text-slate-400",children:"Last Accessed"}),(0,m.jsx)("span",{className:`text-sm transition-all duration-300 ${k?"text-green-400":"text-white"}`,children:k?"Just now":(a=>{let b=new Date(a),c=Math.floor((new Date().getTime()-b.getTime())/36e5);if(c<1)return"Just now";if(c<24)return`${c}h ago`;let d=Math.floor(c/24);return d<7?`${d}d ago`:`${Math.floor(d/7)}w ago`})(a.lastAccessed)})]}),(0,m.jsxs)("div",{className:"flex justify-between items-center",children:[(0,m.jsx)("span",{className:"text-xs text-slate-400",children:"Created"}),(0,m.jsx)("span",{className:"text-sm text-white",children:new Date(a.createdAt).toLocaleString()})]})]}),!q&&L.length>0&&(0,m.jsxs)("div",{children:[(0,m.jsxs)("h4",{className:"text-xs font-medium text-slate-400 mb-2 flex items-center gap-2",children:[(0,m.jsx)("span",{className:"inline-block w-4 h-4",children:"🔗"}),"Related Memories (",L.length,")"]}),(0,m.jsx)("div",{className:"space-y-2 max-h-48 overflow-y-auto",children:L.map(({memory:a,relationship:b,strength:c,direction:d})=>{let e=hy[b]||hy.related,g=hw(a.category);return(0,m.jsxs)("button",{onClick:()=>f?.(a.id),className:"w-full text-left p-2 bg-slate-800 hover:bg-slate-750 rounded-lg transition-colors group",children:[(0,m.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,m.jsx)("span",{className:"w-1.5 h-1.5 rounded-full",style:{backgroundColor:e.color}}),(0,m.jsx)("span",{className:"text-[10px] font-medium",style:{color:e.color},children:"to"===d?`${e.icon} ${e.label}`:`${e.label} ${e.icon}`}),(0,m.jsxs)("span",{className:"text-[10px] text-slate-500 ml-auto",children:[(100*c).toFixed(0),"%"]})]}),(0,m.jsx)("div",{className:"text-sm text-white truncate group-hover:text-blue-400 transition-colors",children:a.title}),(0,m.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,m.jsx)("span",{className:"px-1.5 py-0.5 rounded text-[10px]",style:{backgroundColor:g+"20",color:g},children:a.category}),(0,m.jsxs)("span",{className:"text-[10px] text-slate-500",children:[(100*a.salience).toFixed(0),"% salience"]})]})]},`${a.id}-${d}`)})})]}),!q&&a.tags&&a.tags.length>0&&(0,m.jsxs)("div",{children:[(0,m.jsx)("h4",{className:"text-xs font-medium text-slate-400 mb-2",children:"Tags"}),(0,m.jsx)("div",{className:"flex flex-wrap gap-1",children:a.tags.map((a,b)=>(0,m.jsx)("span",{className:"px-2 py-0.5 bg-slate-700 text-slate-300 rounded text-xs",children:a},b))})]}),!q&&(0,m.jsxs)("div",{className:"space-y-2 pt-2",children:[(0,m.jsxs)("div",{className:"flex gap-2",children:[e&&(0,m.jsx)(hs,{variant:"default",size:"sm",onClick:()=>{p(a.id),e?.(a.id)},disabled:g,className:`flex-1 transition-all duration-300 ${k?"bg-green-600 hover:bg-green-600":"bg-blue-600 hover:bg-blue-700"}`,children:g?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("span",{className:"animate-spin mr-2",children:"⟳"}),"Reinforcing..."]}):k?(0,m.jsx)(m.Fragment,{children:"✓ Reinforced!"}):(0,m.jsx)(m.Fragment,{children:"⚡ Reinforce"})}),(0,m.jsx)(hs,{variant:"outline",size:"sm",onClick:()=>r(!0),className:"flex-1 border-slate-600 text-slate-300 hover:text-white hover:bg-slate-700",children:"Edit"})]}),A?(0,m.jsxs)("div",{className:"bg-red-500/10 border border-red-500/30 rounded-lg p-3",children:[(0,m.jsx)("p",{className:"text-xs text-red-400 mb-2",children:"Delete this memory permanently?"}),(0,m.jsxs)("div",{className:"flex gap-2",children:[(0,m.jsx)(hs,{variant:"default",size:"sm",onClick:()=>{D.mutate(a.id,{onSuccess:()=>{d()}})},disabled:D.isPending,className:"flex-1 bg-red-600 hover:bg-red-700",children:D.isPending?"Deleting...":"Confirm Delete"}),(0,m.jsx)(hs,{variant:"outline",size:"sm",onClick:()=>B(!1),className:"flex-1 border-slate-600 text-slate-300 hover:text-white",children:"Cancel"})]})]}):(0,m.jsx)(hs,{variant:"ghost",size:"sm",onClick:()=>B(!0),className:"w-full text-slate-500 hover:text-red-400 hover:bg-red-500/10",children:"Delete Memory"})]})]})]})}function hB(a){let b=Math.floor((Date.now()-new Date(a).getTime())/6e4);if(b<1)return"now";if(b<60)return`${b}m ago`;let c=Math.floor(b/60);if(c<24)return`${c}h ago`;let d=Math.floor(c/24);if(d<7)return`${d}d ago`;let e=Math.floor(d/7);return`${e}w ago`}function hC({memory:a,isSelected:b,onSelect:c,isChecked:d,onCheck:e}){let f=hw(a.category),g=hx(a.type);return(0,m.jsxs)("div",{onClick:()=>c(a),className:`bg-slate-900 border rounded-lg p-3 hover:border-slate-600 cursor-pointer transition-colors relative ${b?"border-cyan-500":"border-slate-800"}`,children:[(0,m.jsx)("div",{className:"h-0.5 rounded-full bg-slate-800 mb-2 overflow-hidden",children:(0,m.jsx)("div",{className:"h-full rounded-full",style:{width:`${100*a.salience}%`,backgroundColor:f}})}),e&&(0,m.jsx)("input",{type:"checkbox",checked:d??!1,onChange:b=>{b.stopPropagation(),e(a.id,b.target.checked)},onClick:a=>a.stopPropagation(),className:"absolute top-3 right-3 w-4 h-4 accent-blue-500"}),(0,m.jsx)("h3",{className:"text-sm font-semibold text-white truncate pr-6",children:a.title}),(0,m.jsxs)("div",{className:"flex items-center gap-1.5 mt-1",children:[(0,m.jsx)("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full font-medium",style:{backgroundColor:f+"22",color:f},children:a.category}),(0,m.jsx)("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full font-medium",style:{backgroundColor:g+"22",color:g},children:a.type.replace("_","-")})]}),(0,m.jsx)("p",{className:"text-[13px] text-slate-400 mt-1.5 line-clamp-3 leading-snug",children:a.content}),a.tags.length>0&&(0,m.jsxs)("div",{className:"flex items-center gap-1 mt-2 flex-wrap",children:[a.tags.slice(0,3).map(a=>(0,m.jsx)("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-slate-800 text-slate-400",children:a},a)),a.tags.length>3&&(0,m.jsxs)("span",{className:"text-[10px] text-slate-500",children:["+",a.tags.length-3," more"]})]}),(0,m.jsxs)("div",{className:"flex items-center justify-between mt-2 text-[11px] text-slate-500",children:[(0,m.jsxs)("span",{children:["Created ",hB(a.createdAt)]}),(0,m.jsxs)("span",{children:["Accessed ",hB(a.lastAccessed)]})]})]})}let hD=process.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";function hE({memories:a,selectedMemory:b,onSelectMemory:c}){let[d,e]=(0,n.useState)("salience"),[f,g]=(0,n.useState)("grid"),[h,i]=(0,n.useState)(!1),[j,k]=(0,n.useState)(new Set),[l,o]=(0,n.useState)(!1),p=(0,fK.useQueryClient)(),q=(0,n.useMemo)(()=>{let b=[...a];return b.sort((a,b)=>{switch(d){case"salience":return b.salience-a.salience;case"createdAt":return new Date(b.createdAt).getTime()-new Date(a.createdAt).getTime();case"lastAccessed":return new Date(b.lastAccessed).getTime()-new Date(a.lastAccessed).getTime();case"decayedScore":return(b.decayedScore??b.salience)-(a.decayedScore??a.salience);default:return 0}}),b},[a,d]),r=(0,n.useCallback)((a,b)=>{k(c=>{let d=new Set(c);return b?d.add(a):d.delete(a),d})},[]),s=async()=>{if(0!==j.size){o(!0);try{await Promise.all(Array.from(j).map(a=>fetch(`${hD}/api/memories/${a}`,{method:"DELETE"}))),k(new Set),p.invalidateQueries({queryKey:["memories"]})}finally{o(!1)}}};return(0,m.jsxs)("div",{className:"flex flex-col h-full",children:[(0,m.jsxs)("div",{className:"flex items-center gap-3 px-4 py-2 border-b border-slate-800 shrink-0",children:[(0,m.jsxs)("span",{className:"text-xs text-slate-400",children:[a.length," memories"]}),(0,m.jsx)("div",{className:"w-px h-5 bg-slate-700"}),(0,m.jsxs)("select",{value:d,onChange:a=>e(a.target.value),className:"bg-slate-800 border border-slate-700 text-white text-xs rounded px-2 py-1",children:[(0,m.jsx)("option",{value:"salience",children:"Salience"}),(0,m.jsx)("option",{value:"createdAt",children:"Created"}),(0,m.jsx)("option",{value:"lastAccessed",children:"Last Accessed"}),(0,m.jsx)("option",{value:"decayedScore",children:"Decay Score"})]}),(0,m.jsxs)("div",{className:"flex items-center border border-slate-700 rounded overflow-hidden",children:[(0,m.jsx)("button",{onClick:()=>g("grid"),className:`px-2 py-1 text-xs ${"grid"===f?"bg-slate-700 text-white":"text-slate-400 hover:text-white"}`,children:"Grid"}),(0,m.jsx)("button",{onClick:()=>g("list"),className:`px-2 py-1 text-xs ${"list"===f?"bg-slate-700 text-white":"text-slate-400 hover:text-white"}`,children:"List"})]}),(0,m.jsx)("div",{className:"w-px h-5 bg-slate-700"}),(0,m.jsx)("button",{onClick:()=>{i(!h),k(new Set)},className:`px-2 py-1 text-xs rounded ${h?"bg-blue-600 text-white":"bg-slate-800 text-slate-400 hover:text-white"}`,children:"Select"}),h&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("button",{onClick:()=>k(new Set(q.map(a=>a.id))),className:"px-2 py-1 text-xs text-slate-400 hover:text-white",children:"Select all"}),(0,m.jsx)("button",{onClick:s,disabled:0===j.size||l,className:"px-2 py-1 text-xs rounded bg-red-600/20 text-red-400 hover:bg-red-600/40 disabled:opacity-40",children:l?"Deleting...":`Delete (${j.size})`})]})]}),(0,m.jsx)("div",{className:"flex-1 overflow-y-auto p-4",children:(0,m.jsx)("div",{className:"grid"===f?"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-3":"flex flex-col gap-3 max-w-2xl",children:q.map(a=>(0,m.jsx)(hC,{memory:a,isSelected:b?.id===a.id,onSelect:c,isChecked:h?j.has(a.id):void 0,onCheck:h?r:void 0},a.id))})})]})}let hF=process.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";async function hG(a){let b=new URLSearchParams;a?.startTime&&b.set("startTime",a.startTime),a?.endTime&&b.set("endTime",a.endTime),a?.source&&b.set("source",a.source),a?.firewallResult&&b.set("firewallResult",a.firewallResult),a?.project&&b.set("project",a.project),a?.limit&&b.set("limit",a.limit.toString());let c=await fetch(`${hF}/api/v1/audit?${b}`);if(!c.ok)throw Error("Failed to fetch audit logs");return c.json()}async function hH(a,b){let c=new URLSearchParams({timeRange:a});b&&c.set("project",b);let d=await fetch(`${hF}/api/v1/audit/stats?${c}`);if(!d.ok)throw Error("Failed to fetch audit stats");return d.json()}async function hI(a="pending",b=50,c){let d=new URLSearchParams({status:a,limit:b.toString()});c&&d.set("project",c);let e=await fetch(`${hF}/api/v1/quarantine?${d}`);if(!e.ok)throw Error("Failed to fetch quarantine");return e.json()}async function hJ(a){let b=await fX(`${hF}/api/v1/quarantine/${a}/approve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reviewedBy:"dashboard"})});if(!b.ok)throw Error("Failed to approve");return b.json()}async function hK(a,b){let c=await fX(`${hF}/api/v1/quarantine/${a}/reject`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reviewedBy:"dashboard",notes:b})});if(!c.ok)throw Error("Failed to reject");return c.json()}function hL(a){return fO({queryKey:["audit-logs",a],queryFn:()=>hG(a),refetchInterval:3e4,retry:2})}function hM(a="24h",b){return fO({queryKey:["audit-stats",a,b],queryFn:()=>hH(a,b),refetchInterval:3e4,retry:2})}function hN(a="pending",b=50,c){return fO({queryKey:["quarantine",a,b,c],queryFn:()=>hI(a,b,c),refetchInterval:3e4,retry:2})}let hO=a=>{let b=a.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,b,c)=>c?c.toUpperCase():b.toLowerCase());return b.charAt(0).toUpperCase()+b.slice(1)},hP=(...a)=>a.filter((a,b,c)=>!!a&&""!==a.trim()&&c.indexOf(a)===b).join(" ").trim();var hQ={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"};let hR=(0,n.forwardRef)(({color:a="currentColor",size:b=24,strokeWidth:c=2,absoluteStrokeWidth:d,className:e="",children:f,iconNode:g,...h},i)=>(0,n.createElement)("svg",{ref:i,...hQ,width:b,height:b,stroke:a,strokeWidth:d?24*Number(c)/Number(b):c,className:hP("lucide",e),...!f&&!(a=>{for(let b in a)if(b.startsWith("aria-")||"role"===b||"title"===b)return!0})(h)&&{"aria-hidden":"true"},...h},[...g.map(([a,b])=>(0,n.createElement)(a,b)),...Array.isArray(f)?f:[f]])),hS=(a,b)=>{let c=(0,n.forwardRef)(({className:c,...d},e)=>(0,n.createElement)(hR,{ref:e,iconNode:b,className:hP(`lucide-${hO(a).replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${a}`,c),...d}));return c.displayName=hO(a),c},hT=hS("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"}]]),hU=hS("file-text",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]),hV=hS("triangle-alert",[["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"}]]),hW=hS("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"}]]),hX=hS("brain",[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]]),hY=hS("git-branch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]),hZ=hS("users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]),h$=hS("file-search",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["circle",{cx:"11.5",cy:"14.5",r:"2.5",key:"1bq0ko"}],["path",{d:"M13.3 16.3 15 18",key:"2quom7"}]]),h_=hS("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"}]]),h0=[{id:"shield",label:"Shield",icon:hT},{id:"audit",label:"Audit",icon:hU},{id:"quarantine",label:"Queue",icon:hV},{id:"agents",label:"Agents",icon:hZ},{id:"skills",label:"Skills",icon:h$},{id:"dome",label:"Dome",icon:h_},{id:"memories",label:"Memories",icon:hW},{id:"brain",label:"Brain",icon:hX},{id:"graph",label:"Graph",icon:hY}];function h1(){let{viewMode:a,setViewMode:b}=gd(),{data:c}=f4(),{data:d}=hM("24h"),{data:e}=fO({queryKey:["version"],queryFn:f8,refetchInterval:6e4,staleTime:3e4}),f=c?.decayDistribution?Math.round(c.decayDistribution.healthy/Math.max(1,c.total)*100):null,g=d?.blockedCount??0;return(0,m.jsxs)("nav",{className:"w-14 border-r border-slate-800 bg-slate-900/50 flex flex-col items-center py-3 shrink-0",children:[(0,m.jsx)("div",{className:"flex-1 flex flex-col items-center gap-1",children:h0.map(({id:c,label:d,icon:e})=>(0,m.jsxs)("button",{onClick:()=>b(c),className:`relative w-10 h-10 rounded-lg flex flex-col items-center justify-center gap-0.5 transition-colors ${a===c?"dome"===c?"bg-red-600/20 text-red-400":"bg-cyan-600/20 text-cyan-400":"text-slate-500 hover:text-slate-300 hover:bg-slate-800"}`,title:d,children:[(0,m.jsx)(e,{size:18}),(0,m.jsx)("span",{className:"text-[9px] leading-none",children:d}),"shield"===c&&g>0&&(0,m.jsx)("span",{className:"absolute -top-0.5 -right-0.5 min-w-[14px] h-[14px] rounded-full bg-red-500 text-white text-[8px] flex items-center justify-center px-0.5",children:g>99?"99+":g})]},c))}),(0,m.jsxs)("div",{className:"flex flex-col items-center gap-1 text-[10px] text-slate-500",children:[c&&(0,m.jsx)("span",{children:c.total}),null!==f&&(0,m.jsxs)("span",{children:[f,"%"]}),e?.version&&(0,m.jsxs)("span",{children:["v",e.version]})]})]})}let h2=hS("flame",[["path",{d:"M12 3q1 4 4 6.5t3 5.5a1 1 0 0 1-14 0 5 5 0 0 1 1-3 1 1 0 0 0 5 0c0-2-1.5-3-1.5-5q0-2 2.5-4",key:"1slcih"}]]),h3=hS("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"}]]),h4=hS("puzzle",[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]]),h5=hS("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),h6=[{key:"trust",label:"Trust",icon:hT,color:"text-blue-400",bg:"bg-blue-400/10"},{key:"firewall",label:"Firewall",icon:h2,color:"text-orange-400",bg:"bg-orange-400/10"},{key:"sensitivity",label:"Sensitivity",icon:h3,color:"text-purple-400",bg:"bg-purple-400/10"},{key:"fragmentation",label:"Fragment",icon:h4,color:"text-cyan-400",bg:"bg-cyan-400/10"},{key:"audit",label:"Audit",icon:hU,color:"text-green-400",bg:"bg-green-400/10"}],h7={strict:{color:"text-red-400",bg:"bg-red-400/10"},balanced:{color:"text-cyan-400",bg:"bg-cyan-400/10"},permissive:{color:"text-green-400",bg:"bg-green-400/10"}};function h8({timeRange:a}){let b,{projectFilter:c}=gd(),{data:d,isLoading:e,isError:f}=hM(a,c||void 0),{data:g}=fO({queryKey:["defence-config"],queryFn:()=>fetch(`${hF}/api/defence/config`).then(a=>a.json())}),h=(b=(0,fK.useQueryClient)(),fS({mutationFn:a=>fX(`${hF}/api/defence/config`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:a})}).then(a=>a.json()),onSuccess:()=>{b.invalidateQueries({queryKey:["defence-config"]})}})),[i,j]=(0,n.useState)(!1),k=(0,n.useRef)(null),l=g?.mode??"balanced",o=h7[l];return(0,n.useEffect)(()=>{function a(a){k.current&&!k.current.contains(a.target)&&j(!1)}return i&&document.addEventListener("mousedown",a),()=>document.removeEventListener("mousedown",a)},[i]),(0,m.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[g?.tampered&&(0,m.jsxs)("div",{className:"flex items-center gap-2 bg-red-500/10 border border-red-500/30 rounded-lg px-3 py-2 mb-3",children:[(0,m.jsx)(hV,{size:14,className:"text-red-400 shrink-0"}),(0,m.jsx)("span",{className:"text-xs text-red-400",children:"Config integrity check failed — running in strict mode"})]}),(0,m.jsx)("h3",{className:"text-sm font-medium text-slate-300 mb-4",children:"Defence Pipeline"}),(0,m.jsx)("div",{className:"flex items-center gap-1 mb-4",children:h6.map(({key:a,label:b,icon:c,color:d,bg:e},f)=>(0,m.jsxs)("div",{className:"flex items-center",children:[(0,m.jsxs)("div",{className:`flex items-center gap-1.5 px-3 py-2 rounded-lg ${e}`,children:[(0,m.jsx)(c,{size:14,className:d}),(0,m.jsx)("span",{className:`text-xs font-medium ${d}`,children:b})]}),f<h6.length-1&&(0,m.jsx)("div",{className:"w-4 h-px bg-slate-700 mx-0.5"})]},a))}),e?(0,m.jsx)("div",{className:"text-xs text-slate-500 animate-pulse",children:"Loading stats..."}):f?(0,m.jsx)("div",{className:"text-xs text-red-400",children:"Failed to load stats"}):d?(0,m.jsxs)("div",{className:"grid grid-cols-3 gap-3",children:[(0,m.jsxs)("div",{className:"text-center",children:[(0,m.jsx)("div",{className:"text-2xl font-bold text-green-400",children:d.allowedCount}),(0,m.jsx)("div",{className:"text-[10px] text-slate-500 uppercase",children:"Allowed"})]}),(0,m.jsxs)("div",{className:"text-center",children:[(0,m.jsx)("div",{className:"text-2xl font-bold text-red-400",children:d.blockedCount}),(0,m.jsx)("div",{className:"text-[10px] text-slate-500 uppercase",children:"Blocked"})]}),(0,m.jsxs)("div",{className:"text-center",children:[(0,m.jsx)("div",{className:"text-2xl font-bold text-yellow-400",children:d.quarantinedCount}),(0,m.jsx)("div",{className:"text-[10px] text-slate-500 uppercase",children:"Quarantined"})]})]}):(0,m.jsx)("div",{className:"text-xs text-slate-500",children:"No data"}),(0,m.jsx)("button",{onClick:()=>gd.getState().setViewMode("audit"),className:"mt-3 w-full text-center text-xs text-cyan-400 hover:text-cyan-300 transition-colors py-1",children:"View full audit log →"}),(0,m.jsxs)("div",{className:"mt-2 pt-3 border-t border-slate-800 flex items-center justify-between",children:[(0,m.jsx)("span",{className:"text-xs text-slate-500",children:"Firewall Mode"}),(0,m.jsxs)("div",{className:"relative",ref:k,children:[(0,m.jsxs)("button",{onClick:()=>j(!i),className:`text-xs font-medium ${o.color} ${o.bg} px-2 py-0.5 rounded flex items-center gap-1 hover:opacity-80 transition-opacity`,children:[l,(0,m.jsx)(h5,{size:10})]}),i&&(0,m.jsx)("div",{className:"absolute right-0 top-full mt-1 bg-slate-800 border border-slate-700 rounded-lg shadow-xl z-50 min-w-[120px] py-1",children:["strict","balanced","permissive"].map(a=>{let b=h7[a];return(0,m.jsxs)("button",{onClick:()=>{h.mutate(a),j(!1)},className:`w-full text-left px-3 py-1.5 text-xs hover:bg-slate-700/50 transition-colors flex items-center justify-between ${a===l?b.color+" font-medium":"text-slate-400"}`,children:[a,a===l&&(0,m.jsx)("span",{className:"text-[10px]",children:"✓"})]},a)})})]})]})]})}function h9(){let{setViewMode:a,projectFilter:b}=gd(),{data:c,isLoading:d,isError:e}=hN("pending",3,b||void 0),f=c?.total??0,g=c?.items??[];return(0,m.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,m.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,m.jsx)("h3",{className:"text-sm font-medium text-slate-300",children:"Quarantine Queue"}),f>0&&(0,m.jsxs)("span",{className:"text-xs font-medium text-yellow-400 bg-yellow-400/10 px-2 py-0.5 rounded-full",children:[f," pending"]})]}),d?(0,m.jsx)("div",{className:"text-xs text-slate-500 animate-pulse",children:"Loading..."}):e?(0,m.jsx)("div",{className:"text-xs text-red-400",children:"Failed to load quarantine"}):0===g.length?(0,m.jsxs)("div",{className:"flex flex-col items-center py-6 text-slate-500",children:[(0,m.jsx)(hV,{size:24,className:"mb-2 text-slate-600"}),(0,m.jsx)("span",{className:"text-xs",children:"No items in quarantine"})]}):(0,m.jsx)("div",{className:"space-y-2",children:g.map(a=>{let b=(()=>{try{return JSON.parse(a.threat_indicators)}catch{return[]}})();return(0,m.jsxs)("div",{className:"bg-slate-800/50 border border-slate-700 rounded-lg p-3",children:[(0,m.jsxs)("div",{className:"flex items-start justify-between",children:[(0,m.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,m.jsx)("div",{className:"text-xs font-medium text-white truncate",children:a.title||"Untitled"}),(0,m.jsxs)("div",{className:"text-[10px] text-slate-500 mt-0.5",children:[a.source_type," · ",new Date(a.created_at).toLocaleTimeString()]})]}),(0,m.jsx)("span",{className:"text-[10px] text-red-400 bg-red-400/10 px-1.5 py-0.5 rounded shrink-0 ml-2",children:a.reason?.slice(0,30)||"Threat detected"})]}),b.length>0&&(0,m.jsx)("div",{className:"flex gap-1 mt-1.5 flex-wrap",children:b.slice(0,3).map((a,b)=>(0,m.jsx)("span",{className:"text-[9px] text-yellow-400 bg-yellow-400/10 px-1 py-0.5 rounded",children:a},b))})]},a.id)})}),f>0&&(0,m.jsxs)("button",{onClick:()=>a("quarantine"),className:"w-full mt-3 text-xs text-cyan-400 hover:text-cyan-300 transition-colors",children:["Review all ",f," items →"]})]})}function ia({timeRange:a}){let{projectFilter:b}=gd(),c={"24h":24,"7d":168,"30d":720},[d,e]=(0,n.useState)(()=>Date.now());(0,n.useEffect)(()=>{e(Date.now())},[a]);let{data:f,isLoading:g,isError:h}=hL({startTime:(0,n.useMemo)(()=>new Date(6e4*Math.floor((d-36e5*c[a])/6e4)).toISOString(),[d,a]),project:b||void 0,limit:500}),i=(0,n.useMemo)(()=>{if(!f?.logs.length)return[];let b="24h"===a?36e5:"7d"===a?216e5:864e5,c="24h"===a?24:"7d"===a?28:30,e=Array.from({length:c},(a,e)=>({time:d-(c-1-e)*b,allowed:0,blocked:0,quarantined:0}));for(let a of f.logs){let f=Math.floor((new Date(a.timestamp).getTime()-(d-c*b))/b),g=Math.min(Math.max(f,0),c-1);f>=0&&f<=c&&("ALLOW"===a.firewall_result?e[g].allowed++:"BLOCK"===a.firewall_result?e[g].blocked++:"QUARANTINE"===a.firewall_result&&e[g].quarantined++)}return e},[f,a,d]),j=Math.max(1,...i.map(a=>a.allowed+a.blocked+a.quarantined));return(0,m.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,m.jsx)("h3",{className:"text-sm font-medium text-slate-300 mb-4",children:"Threat Timeline"}),g?(0,m.jsx)("div",{className:"h-32 flex items-center justify-center",children:(0,m.jsx)("div",{className:"text-xs text-slate-500 animate-pulse",children:"Loading timeline..."})}):h?(0,m.jsx)("div",{className:"h-32 flex items-center justify-center",children:(0,m.jsx)("div",{className:"text-xs text-red-400",children:"Failed to load timeline"})}):0===i.length?(0,m.jsx)("div",{className:"h-32 flex items-center justify-center",children:(0,m.jsx)("div",{className:"text-xs text-slate-500",children:"No audit data"})}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("div",{className:"flex gap-px h-32",children:i.map((a,b)=>{let c=a.allowed+a.blocked+a.quarantined,d=c>0?a.blocked/c*100:0,e=c>0?a.quarantined/c*100:0;return(0,m.jsx)("div",{className:"flex-1 flex flex-col justify-end",title:`${new Date(a.time).toLocaleString()}: ${a.allowed} allowed, ${a.blocked} blocked, ${a.quarantined} quarantined`,children:(0,m.jsx)("div",{className:"w-full rounded-t-sm overflow-hidden",style:{height:`${Math.max(c/j*100,2*(c>0))}%`},children:(0,m.jsxs)("div",{className:"w-full h-full flex flex-col-reverse",children:[a.blocked>0&&(0,m.jsx)("div",{className:"bg-red-500",style:{height:`${d}%`}}),a.quarantined>0&&(0,m.jsx)("div",{className:"bg-yellow-500",style:{height:`${e}%`}}),(0,m.jsx)("div",{className:"bg-emerald-500/60 flex-1"})]})})},b)})}),(0,m.jsxs)("div",{className:"flex gap-4 mt-3 justify-center",children:[(0,m.jsxs)("div",{className:"flex items-center gap-1",children:[(0,m.jsx)("div",{className:"w-2 h-2 rounded-full bg-emerald-500/60"}),(0,m.jsx)("span",{className:"text-[10px] text-slate-500",children:"Allowed"})]}),(0,m.jsxs)("div",{className:"flex items-center gap-1",children:[(0,m.jsx)("div",{className:"w-2 h-2 rounded-full bg-red-500"}),(0,m.jsx)("span",{className:"text-[10px] text-slate-500",children:"Blocked"})]}),(0,m.jsxs)("div",{className:"flex items-center gap-1",children:[(0,m.jsx)("div",{className:"w-2 h-2 rounded-full bg-yellow-500"}),(0,m.jsx)("span",{className:"text-[10px] text-slate-500",children:"Quarantined"})]})]}),(0,m.jsx)("button",{onClick:()=>gd.getState().setViewMode("audit"),className:"mt-3 w-full text-center text-xs text-cyan-400 hover:text-cyan-300 transition-colors py-1",children:"View detailed audit log →"})]})]})}function ib({timeRange:a}){let{projectFilter:b}=gd(),{data:c,isLoading:d,isError:e}=hM(a,b||void 0);if(d)return(0,m.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,m.jsx)("h3",{className:"text-sm font-medium text-slate-300 mb-4",children:"Stats Summary"}),(0,m.jsx)("div",{className:"text-xs text-slate-500 animate-pulse",children:"Loading..."})]});if(e)return(0,m.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,m.jsx)("h3",{className:"text-sm font-medium text-slate-300 mb-4",children:"Stats Summary"}),(0,m.jsx)("div",{className:"text-xs text-red-400",children:"Failed to load stats"})]});if(!c)return(0,m.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,m.jsx)("h3",{className:"text-sm font-medium text-slate-300 mb-4",children:"Stats Summary"}),(0,m.jsx)("div",{className:"text-xs text-slate-500",children:"No data"})]});let f=c.totalOperations||1,g=(c.blockedCount/f*100).toFixed(1),h=Object.entries(c.threatBreakdown||{}).sort((a,b)=>b[1]-a[1]).slice(0,5);return(0,m.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,m.jsx)("h3",{className:"text-sm font-medium text-slate-300 mb-4",children:"Stats Summary"}),(0,m.jsxs)("div",{className:"grid grid-cols-2 gap-3 mb-4",children:[(0,m.jsxs)("div",{className:"bg-slate-800/50 rounded-lg p-3 text-center",children:[(0,m.jsx)("div",{className:"text-2xl font-bold text-white",children:c.totalOperations}),(0,m.jsx)("div",{className:"text-[10px] text-slate-500 uppercase",children:"Total Scans"})]}),(0,m.jsxs)("div",{className:"bg-slate-800/50 rounded-lg p-3 text-center",children:[(0,m.jsxs)("div",{className:`text-2xl font-bold ${parseFloat(g)>10?"text-red-400":"text-green-400"}`,children:[g,"%"]}),(0,m.jsx)("div",{className:"text-[10px] text-slate-500 uppercase",children:"Block Rate"})]})]}),c.topSources.length>0&&(0,m.jsxs)("div",{className:"mb-4",children:[(0,m.jsx)("div",{className:"text-[10px] text-slate-500 uppercase mb-2",children:"Top Sources"}),(0,m.jsx)("div",{className:"space-y-1",children:c.topSources.slice(0,3).map(a=>(0,m.jsxs)("div",{className:"flex items-center justify-between",children:[(0,m.jsx)("span",{className:"text-xs text-slate-400",children:a.source}),(0,m.jsx)("span",{className:"text-xs text-slate-500",children:a.count})]},a.source))})]}),h.length>0&&(0,m.jsxs)("div",{children:[(0,m.jsx)("div",{className:"text-[10px] text-slate-500 uppercase mb-2",children:"Threat Types"}),(0,m.jsx)("div",{className:"space-y-1",children:h.map(([a,b])=>(0,m.jsxs)("div",{className:"flex items-center justify-between",children:[(0,m.jsx)("span",{className:"text-xs text-slate-400",children:a}),(0,m.jsx)("span",{className:"text-xs font-medium text-red-400",children:b})]},a))})]}),(0,m.jsx)("button",{onClick:()=>gd.getState().setViewMode("audit"),className:"mt-3 w-full text-center text-xs text-cyan-400 hover:text-cyan-300 transition-colors py-1",children:"View full audit log →"})]})}let ic=hS("cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]),id=hS("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),ie=hS("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),ig=hS("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),ih=hS("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function ii(){let{projectFilter:a}=gd(),{data:b}=hM("30d",a||void 0),[c,d]=(0,n.useState)("upsell"),[e,f]=(0,n.useState)(""),[g,h]=(0,n.useState)(null),[i,j]=(0,n.useState)(""),[k,l]=(0,n.useState)(!1);(0,n.useEffect)(()=>{let a=localStorage.getItem("shieldcortex_cloud_dismissed");if(a){let b=new Date(a);(Date.now()-b.getTime())/864e5<30&&d("hidden")}},[]),(0,n.useEffect)(()=>{fetch("http://localhost:3001/api/cloud/config").then(a=>a.json()).then(a=>{a.enabled&&a.apiKeySet&&d("hidden")}).catch(()=>{})},[]),(0,n.useEffect)(()=>{if("polling"!==c||!g)return;let a=setInterval(async()=>{try{let b=await fetch(`https://api.shieldcortex.ai/v1/auth/setup-status/${g}`),c=await b.json();"complete"===c.status&&c.api_key?(await fetch("http://localhost:3001/api/cloud/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cloudApiKey:c.api_key,cloudEnabled:!0,cloudBaseUrl:"https://api.shieldcortex.ai"})}),d("success"),clearInterval(a),setTimeout(()=>d("hidden"),5e3)):"expired"===c.status&&(j("Setup expired. Please try again."),d("upsell"),clearInterval(a))}catch{}},3e3);return()=>clearInterval(a)},[c,g]);let o=async a=>{if(a.preventDefault(),e&&!k){j(""),l(!0);try{let a=await fetch("https://api.shieldcortex.ai/v1/auth/cloud-setup",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:e})}),b=await a.json();b.setup_id?(h(b.setup_id),d("polling")):j(b.error||"Failed to start setup")}catch{j("Could not reach ShieldCortex Cloud. Check your connection.")}finally{l(!1)}}};if("hidden"===c)return null;let p=b?.blockedCount??0,q=b?.totalOperations??0;return(0,m.jsxs)("div",{className:"mt-4 bg-gradient-to-br from-slate-900 via-slate-900 to-cyan-950/30 border border-cyan-800/30 rounded-xl p-5 relative",children:["upsell"===c&&(0,m.jsx)("button",{onClick:()=>{localStorage.setItem("shieldcortex_cloud_dismissed",new Date().toISOString()),d("hidden")},className:"absolute top-3 right-3 text-slate-500 hover:text-slate-300 transition-colors",title:"Dismiss for 30 days",children:(0,m.jsx)(ih,{size:16})}),"upsell"===c&&(0,m.jsxs)("div",{className:"space-y-4",children:[(0,m.jsxs)("div",{className:"flex items-center gap-2",children:[(0,m.jsx)(ic,{size:20,className:"text-cyan-400"}),(0,m.jsx)("h3",{className:"text-sm font-semibold text-white",children:"ShieldCortex Cloud"})]}),(0,m.jsx)("p",{className:"text-sm text-slate-300",children:p>0?`You've blocked ${p} threats across ${q} scans — your team can't see them yet.`:"Sync your defence data to the cloud for team visibility, audit logs, and alerts."}),(0,m.jsxs)("form",{onSubmit:o,className:"flex gap-2",children:[(0,m.jsx)("input",{type:"email",placeholder:"Enter your email",value:e,onChange:a=>f(a.target.value),required:!0,className:"flex-1 bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-sm text-white placeholder:text-slate-500 focus:outline-none focus:ring-1 focus:ring-cyan-500 focus:border-cyan-500"}),(0,m.jsxs)("button",{type:"submit",disabled:k,className:"flex items-center gap-1.5 px-4 py-2 bg-cyan-600 hover:bg-cyan-500 disabled:opacity-50 rounded-lg text-sm font-medium text-white transition-colors",children:[k?(0,m.jsx)(ie,{size:14,className:"animate-spin"}):(0,m.jsx)(id,{size:14}),"Get Started"]})]}),i&&(0,m.jsx)("p",{className:"text-xs text-red-400",children:i}),(0,m.jsx)("p",{className:"text-[10px] text-slate-500",children:"Free tier: 500 scans/month, 7-day retention. No credit card required."})]}),"polling"===c&&(0,m.jsxs)("div",{className:"flex items-center gap-3 py-2",children:[(0,m.jsx)(ie,{size:20,className:"text-cyan-400 animate-spin"}),(0,m.jsxs)("div",{children:[(0,m.jsx)("p",{className:"text-sm text-white font-medium",children:"Check your email"}),(0,m.jsx)("p",{className:"text-xs text-slate-400",children:"Click the link in your inbox to complete setup. We'll auto-configure everything."})]})]}),"success"===c&&(0,m.jsxs)("div",{className:"flex items-center gap-3 py-2",children:[(0,m.jsx)(ig,{size:20,className:"text-emerald-400"}),(0,m.jsxs)("div",{children:[(0,m.jsx)("p",{className:"text-sm text-white font-medium",children:"Connected to ShieldCortex Cloud"}),(0,m.jsx)("p",{className:"text-xs text-slate-400",children:"Your defence data will now sync automatically."})]})]})]})}function ij(){let a,b,{data:c,isLoading:d}=fO({queryKey:["cloud-sync-status"],queryFn:async()=>{let a=await fetch("http://localhost:3001/api/cloud/sync-status");if(!a.ok)throw Error("Failed to fetch sync status");return a.json()},refetchInterval:1e4});if(d||!c)return null;let{enabled:e,apiKeySet:f,lastSyncAt:g,queue:h}=c;e&&f?h.failed>0?(a="bg-red-500",b=`${h.failed} event${1===h.failed?"":"s"} failed`):h.pending>0?(a="bg-amber-500",b=`${h.pending} event${1===h.pending?"":"s"} pending`):g?(a="bg-emerald-500",b="Cloud sync: OK"):(a="bg-emerald-500",b="Cloud sync: connected"):(a="bg-slate-500",b="Cloud sync: disabled");let i=g?function(a){let b=Math.floor((Date.now()-new Date(a).getTime())/1e3);if(b<60)return`${b}s ago`;let c=Math.floor(b/60);if(c<60)return`${c}m ago`;let d=Math.floor(c/60);if(d<24)return`${d}h ago`;let e=Math.floor(d/24);return`${e}d ago`}(g):null;return(0,m.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 mb-4 bg-slate-800 rounded-lg text-xs w-fit",children:[(0,m.jsx)("span",{className:`inline-block w-2 h-2 rounded-full ${a}`}),(0,m.jsx)("span",{className:"text-slate-300",children:b}),i&&(0,m.jsxs)("span",{className:"text-slate-500",children:["last sync ",i]})]})}let ik=hS("circle-x",[["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"}]]),il=process.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";async function im(a){let b=await fX(`${il}/api/skills/scan-all`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({dir:a})});if(!b.ok)throw Error("Failed to scan skills");return b.json()}async function io(a){let b=await fX(`${il}/api/skills/scan`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!b.ok)throw Error("Failed to scan skill content");return b.json()}function ip(){return fS({mutationFn:a=>im(a)})}async function iq(a){let b=await fX(`${il}/api/skills/trust`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:a})});if(!b.ok)throw Error("Failed to trust skill");return b.json()}async function ir(a){let b=await fX(`${il}/api/skills/trust`,{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:a})});if(!b.ok)throw Error("Failed to untrust skill");return b.json()}async function is(a){let b=await fX(`${il}/api/skills/file`,{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:a})});if(!b.ok)throw Error((await b.json().catch(()=>({}))).error||"Failed to delete skill file");return b.json()}function it(){let a=ip(),{setViewMode:b}=gd(),[c,d]=(0,n.useState)(null),e=c?c.files.filter(a=>a.safe).length:0,f=c?.threatCount??0;return(0,m.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,m.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,m.jsx)("h3",{className:"text-sm font-medium text-slate-300",children:"Skill Scanner"}),(0,m.jsxs)("button",{onClick:()=>{a.mutate(void 0,{onSuccess:a=>d(a)})},disabled:a.isPending,className:"flex items-center gap-1.5 px-3 py-1.5 bg-cyan-600 hover:bg-cyan-500 disabled:opacity-50 rounded-lg text-xs font-medium text-white transition-colors",children:[a.isPending?(0,m.jsx)(ie,{size:12,className:"animate-spin"}):(0,m.jsx)(h$,{size:12}),"Scan All"]})]}),c?(0,m.jsxs)("div",{children:[(0,m.jsxs)("div",{className:"flex items-center gap-4 mb-3",children:[(0,m.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,m.jsx)(ig,{size:14,className:"text-green-400"}),(0,m.jsx)("span",{className:"text-sm font-medium text-green-400",children:e}),(0,m.jsx)("span",{className:"text-[10px] text-slate-500",children:"safe"})]}),f>0&&(0,m.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,m.jsx)(ik,{size:14,className:"text-red-400"}),(0,m.jsx)("span",{className:"text-sm font-medium text-red-400",children:f}),(0,m.jsx)("span",{className:"text-[10px] text-slate-500",children:"threats"})]}),(0,m.jsx)("span",{className:"text-[10px] text-slate-600",children:new Date(c.scannedAt).toLocaleTimeString()})]}),(0,m.jsxs)("button",{onClick:()=>b("skills"),className:"flex items-center gap-1 text-xs text-cyan-400 hover:text-cyan-300 transition-colors",children:["View all results",(0,m.jsx)(id,{size:12})]})]}):a.isPending?(0,m.jsx)("div",{className:"flex items-center justify-center py-4",children:(0,m.jsx)(ie,{size:16,className:"text-cyan-400 animate-spin"})}):(0,m.jsxs)("div",{className:"text-center py-3",children:[(0,m.jsx)(h$,{size:20,className:"text-slate-600 mx-auto mb-1.5"}),(0,m.jsx)("p",{className:"text-[10px] text-slate-500",children:"Scan agent instruction files for threats"})]})]})}let iu=process.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";async function iv(){let a=await fetch(`${iu}/api/iron-dome/status`);if(!a.ok)throw Error("Failed to fetch Iron Dome status");return a.json()}async function iw(a){let b=await fX(`${iu}/api/iron-dome/activate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({profile:a})});if(!b.ok)throw Error("Failed to activate Iron Dome");return b.json()}async function ix(){let a=await fX(`${iu}/api/iron-dome/deactivate`,{method:"POST"});if(!a.ok)throw Error("Failed to deactivate Iron Dome");return a.json()}async function iy(a){let b=await fX(`${iu}/api/iron-dome/scan`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:a})});if(!b.ok)throw Error("Failed to scan text");return b.json()}async function iz(a){let b=new URLSearchParams;a&&b.set("limit",a.toString());let c=await fetch(`${iu}/api/iron-dome/audit?${b}`);if(!c.ok)throw Error("Failed to fetch Iron Dome audit");return c.json()}function iA(){return fO({queryKey:["iron-dome-status"],queryFn:iv,refetchInterval:3e4,retry:2})}function iB(a){return fO({queryKey:["iron-dome-audit",a],queryFn:()=>iz(a),refetchInterval:3e4,retry:2})}function iC(){let{data:a,isLoading:b}=iA(),{data:c}=iB(100),d=a?.enabled??!1,e=a?.profile??"custom",f=Date.now()-864e5,g=(c?.logs??[]).filter(a=>new Date(a.timestamp).getTime()>f),h=g.filter(a=>a.reason?.includes("[iron-dome:")&&"BLOCK"===a.firewall_result).length,i=g.length;return(0,m.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,m.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,m.jsx)("h3",{className:"text-sm font-medium text-slate-300",children:"Iron Dome"}),(0,m.jsx)("span",{className:`text-[10px] font-medium px-2 py-0.5 rounded-full ${d?"bg-red-500/20 text-red-400 border border-red-500/30":"bg-slate-700/50 text-slate-500"}`,children:d?"ACTIVE":"INACTIVE"})]}),b?(0,m.jsx)("div",{className:"text-xs text-slate-500 animate-pulse",children:"Loading..."}):d?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)("div",{className:"text-xs text-slate-500 mb-3",children:["Profile: ",(0,m.jsx)("span",{className:"text-red-400 font-medium",children:e})]}),(0,m.jsxs)("div",{className:"grid grid-cols-2 gap-3 mb-3",children:[(0,m.jsxs)("div",{className:"bg-slate-800/50 rounded-lg p-2 text-center",children:[(0,m.jsx)("div",{className:"text-lg font-bold text-red-400",children:h}),(0,m.jsx)("div",{className:"text-[10px] text-slate-500 uppercase",children:"Blocks"})]}),(0,m.jsxs)("div",{className:"bg-slate-800/50 rounded-lg p-2 text-center",children:[(0,m.jsx)("div",{className:"text-lg font-bold text-slate-300",children:i}),(0,m.jsx)("div",{className:"text-[10px] text-slate-500 uppercase",children:"Events"})]})]})]}):(0,m.jsxs)("div",{className:"text-center py-3",children:[(0,m.jsx)(hT,{size:20,className:"text-slate-600 mx-auto mb-1.5"}),(0,m.jsx)("p",{className:"text-[10px] text-slate-500",children:"Behaviour protection layer — not active"})]}),(0,m.jsx)("button",{onClick:()=>gd.getState().setViewMode("dome"),className:"w-full text-center text-xs text-red-400 hover:text-red-300 transition-colors py-1",children:"View Iron Dome →"})]})}let iD="http://localhost:3001";function iE(){return fO({queryKey:["cloud-config"],queryFn:async()=>{let a=await fX(`${iD}/api/cloud/config`);if(!a.ok)throw Error("Failed to fetch cloud config");return a.json()},refetchInterval:3e4})}function iF(a,b,c){return Math.max(b,Math.min(c,a))}function iG(){let a,{data:b,isLoading:c}=iE(),d=(a=(0,fK.useQueryClient)(),fS({mutationFn:async a=>{let b=await fX(`${iD}/api/cloud/config`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!b.ok)throw Error("Failed to update cloud config");return b.json()},onSuccess:()=>{a.invalidateQueries({queryKey:["cloud-config"]})}})),[e,f]=(0,n.useState)(!1),[g,h]=(0,n.useState)(!0),[i,j]=(0,n.useState)("0.88"),[k,l]=(0,n.useState)("300");(0,n.useEffect)(()=>{let a=b?.openclawMemory;a&&(f(a.autoMemory),h(a.dedupe),j(String(a.noveltyThreshold)),l(String(a.maxRecent)))},[b]);let o=d.isPending;return(0,m.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,m.jsx)("h3",{className:"text-sm font-medium text-slate-300",children:"OpenClaw Memory"}),(0,m.jsx)("p",{className:"text-xs text-slate-500 mt-1",children:"Configure how ShieldCortex complements native OpenClaw memory."}),(0,m.jsx)("p",{className:"text-[11px] text-slate-600 mt-1",children:"Changes apply on next OpenClaw gateway restart."}),c?(0,m.jsx)("div",{className:"text-xs text-slate-500 mt-4 animate-pulse",children:"Loading settings..."}):(0,m.jsxs)("div",{className:"mt-4 space-y-3",children:[(0,m.jsxs)("div",{className:"flex items-center justify-between",children:[(0,m.jsx)("span",{className:"text-xs text-slate-400",children:"Auto-memory extraction"}),(0,m.jsx)("button",{type:"button",onClick:()=>f(!e),className:`h-6 w-11 rounded-full transition-colors ${e?"bg-cyan-500":"bg-slate-700"}`,children:(0,m.jsx)("span",{className:`block h-5 w-5 rounded-full bg-white transition-transform ${e?"translate-x-5":"translate-x-0.5"}`})})]}),(0,m.jsxs)("div",{className:"flex items-center justify-between",children:[(0,m.jsx)("span",{className:"text-xs text-slate-400",children:"Novelty dedupe"}),(0,m.jsx)("button",{type:"button",onClick:()=>h(!g),disabled:!e,className:`h-6 w-11 rounded-full transition-colors ${g&&e?"bg-emerald-500":"bg-slate-700"} ${!e?"opacity-50 cursor-not-allowed":""}`,children:(0,m.jsx)("span",{className:`block h-5 w-5 rounded-full bg-white transition-transform ${g&&e?"translate-x-5":"translate-x-0.5"}`})})]}),(0,m.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,m.jsxs)("div",{children:[(0,m.jsx)("label",{className:"block text-[11px] text-slate-500 mb-1",children:"Novelty threshold"}),(0,m.jsx)(ht,{type:"number",step:"0.01",min:.6,max:.99,value:i,disabled:!e||!g,onChange:a=>j(a.target.value),className:"h-8 text-xs bg-slate-800 border-slate-700"})]}),(0,m.jsxs)("div",{children:[(0,m.jsx)("label",{className:"block text-[11px] text-slate-500 mb-1",children:"Max recent records"}),(0,m.jsx)(ht,{type:"number",step:"1",min:50,max:1e3,value:k,disabled:!e||!g,onChange:a=>l(a.target.value),className:"h-8 text-xs bg-slate-800 border-slate-700"})]})]}),(0,m.jsxs)("div",{className:"flex items-center justify-between pt-1",children:[(0,m.jsx)("span",{className:"text-[11px] text-slate-500",children:"Default: dedupe on, threshold 0.88, max 300"}),(0,m.jsxs)(hs,{size:"sm",onClick:()=>{let a=iF(Number.parseFloat(i),.6,.99),b=Math.floor(iF(Number.parseInt(k,10),50,1e3));d.mutate({openclawAutoMemory:e,openclawAutoMemoryDedupe:g,openclawAutoMemoryNoveltyThreshold:Number.isFinite(a)?a:.88,openclawAutoMemoryMaxRecent:Number.isFinite(b)?b:300})},disabled:o,className:"h-8 text-xs bg-cyan-600 hover:bg-cyan-500 text-white",children:[o?(0,m.jsx)(ie,{size:12,className:"animate-spin"}):null,"Save"]})]})]})]})}function iH(){let[a,b]=(0,n.useState)("24h");return(0,m.jsxs)("div",{className:"h-full overflow-y-auto p-6",children:[(0,m.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,m.jsx)("h2",{className:"text-lg font-semibold text-white",children:"Defence Overview"}),(0,m.jsx)("div",{className:"flex gap-1 bg-slate-800 rounded-lg p-0.5",children:["24h","7d","30d"].map(c=>(0,m.jsx)("button",{onClick:()=>b(c),className:`px-3 py-1 text-xs rounded-md transition-colors ${a===c?"bg-cyan-600 text-white":"text-slate-400 hover:text-white"}`,children:c},c))})]}),(0,m.jsx)(ij,{}),(0,m.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[(0,m.jsx)(h8,{timeRange:a}),(0,m.jsx)(h9,{}),(0,m.jsx)(ia,{timeRange:a}),(0,m.jsx)(ib,{timeRange:a})]}),(0,m.jsx)("div",{className:"mt-4",children:(0,m.jsx)(it,{})}),(0,m.jsx)("div",{className:"mt-4",children:(0,m.jsx)(iC,{})}),(0,m.jsx)("div",{className:"mt-4",children:(0,m.jsx)(iG,{})}),(0,m.jsx)(ii,{})]})}let iI={ALLOW:"bg-green-500/10 text-green-400",BLOCK:"bg-red-500/10 text-red-400",QUARANTINE:"bg-yellow-500/10 text-yellow-400"};function iJ(){let{projectFilter:a,selectedAuditEntry:b,setSelectedAuditEntry:c}=gd(),[d,e]=(0,n.useState)("24h"),[f,g]=(0,n.useState)(void 0),[h,i]=(0,n.useState)(void 0),j={"24h":24,"7d":168,"30d":720},[k,l]=(0,n.useState)(()=>Date.now());(0,n.useEffect)(()=>{l(Date.now())},[d]);let{data:o,isLoading:p}=hL({startTime:(0,n.useMemo)(()=>new Date(6e4*Math.floor((k-36e5*j[d])/6e4)).toISOString(),[k,d]),source:f,firewallResult:h,project:a||void 0,limit:200}),q=o?.logs??[],r=(0,n.useCallback)(a=>{if(!b||0===q.length)return;let d=q.findIndex(a=>a.id===b.id);"Escape"===a.key?c(null):"ArrowDown"===a.key&&d<q.length-1?(a.preventDefault(),c(q[d+1])):"ArrowUp"===a.key&&d>0&&(a.preventDefault(),c(q[d-1]))},[b,q,c]);return(0,n.useEffect)(()=>(window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)),[r]),(0,m.jsxs)("div",{className:"h-full flex flex-col overflow-hidden",children:[(0,m.jsxs)("div",{className:"p-4 border-b border-slate-800 shrink-0",children:[(0,m.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,m.jsx)("h2",{className:"text-lg font-semibold text-white",children:"Audit Log"}),(0,m.jsx)("div",{className:"flex gap-1 bg-slate-800 rounded-lg p-0.5",children:["24h","7d","30d"].map(a=>(0,m.jsx)("button",{onClick:()=>e(a),className:`px-3 py-1 text-xs rounded-md transition-colors ${d===a?"bg-cyan-600 text-white":"text-slate-400 hover:text-white"}`,children:a},a))})]}),(0,m.jsxs)("div",{className:"flex gap-2",children:[(0,m.jsxs)("select",{value:h||"",onChange:a=>i(a.target.value||void 0),className:"bg-slate-800 border border-slate-700 text-white text-xs rounded-lg px-2 py-1",children:[(0,m.jsx)("option",{value:"",children:"All Results"}),(0,m.jsx)("option",{value:"ALLOW",children:"Allowed"}),(0,m.jsx)("option",{value:"BLOCK",children:"Blocked"}),(0,m.jsx)("option",{value:"QUARANTINE",children:"Quarantined"})]}),(0,m.jsxs)("select",{value:f||"",onChange:a=>g(a.target.value||void 0),className:"bg-slate-800 border border-slate-700 text-white text-xs rounded-lg px-2 py-1",children:[(0,m.jsx)("option",{value:"",children:"All Sources"}),(0,m.jsx)("option",{value:"hook",children:"Hook"}),(0,m.jsx)("option",{value:"api",children:"API"}),(0,m.jsx)("option",{value:"agent",children:"Agent"}),(0,m.jsx)("option",{value:"user",children:"User"}),(0,m.jsx)("option",{value:"cli",children:"CLI"})]}),(0,m.jsxs)("span",{className:"text-xs text-slate-500 self-center ml-auto",children:[q.length," entries"]})]})]}),(0,m.jsx)("div",{className:"flex-1 overflow-y-auto",children:p?(0,m.jsx)("div",{className:"flex items-center justify-center h-32",children:(0,m.jsx)("div",{className:"text-xs text-slate-500 animate-pulse",children:"Loading audit logs..."})}):0===q.length?(0,m.jsx)("div",{className:"flex items-center justify-center h-32",children:(0,m.jsx)("div",{className:"text-xs text-slate-500",children:"No audit entries for this period"})}):(0,m.jsxs)("table",{className:"w-full text-xs",children:[(0,m.jsx)("thead",{className:"sticky top-0 bg-slate-900",children:(0,m.jsxs)("tr",{className:"border-b border-slate-800",children:[(0,m.jsx)("th",{className:"text-left text-slate-500 font-medium px-4 py-2",children:"Time"}),(0,m.jsx)("th",{className:"text-left text-slate-500 font-medium px-4 py-2",children:"Source"}),(0,m.jsx)("th",{className:"text-left text-slate-500 font-medium px-4 py-2",children:"Result"}),(0,m.jsx)("th",{className:"text-left text-slate-500 font-medium px-4 py-2",children:"Trust"}),(0,m.jsx)("th",{className:"text-left text-slate-500 font-medium px-4 py-2",children:"Anomaly"}),(0,m.jsx)("th",{className:"text-left text-slate-500 font-medium px-4 py-2",children:"Reason"})]})}),(0,m.jsx)("tbody",{children:q.map(a=>(0,m.jsxs)("tr",{onClick:()=>{c(b?.id===a.id?null:a)},className:`border-b border-slate-800/50 cursor-pointer transition-colors ${b?.id===a.id?"bg-cyan-500/10 hover:bg-cyan-500/15":"hover:bg-slate-800/30"}`,children:[(0,m.jsx)("td",{className:"px-4 py-2 text-slate-400 whitespace-nowrap",children:new Date(a.timestamp).toLocaleString()}),(0,m.jsx)("td",{className:"px-4 py-2 text-slate-300",children:a.source_type}),(0,m.jsx)("td",{className:"px-4 py-2",children:(0,m.jsx)("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-medium ${iI[a.firewall_result]||"text-slate-400"}`,children:a.firewall_result})}),(0,m.jsx)("td",{className:"px-4 py-2 text-slate-400",children:a.trust_score.toFixed(1)}),(0,m.jsx)("td",{className:"px-4 py-2",children:(0,m.jsx)("span",{className:a.anomaly_score>.5?"text-red-400":a.anomaly_score>.2?"text-yellow-400":"text-slate-400",children:a.anomaly_score.toFixed(2)})}),(0,m.jsx)("td",{className:"px-4 py-2 text-slate-400 max-w-xs truncate",children:a.reason||"—"})]},a.id))})]})})]})}let iK={ALLOW:{color:"#22C55E",bg:"rgba(34, 197, 94, 0.15)",label:"Allowed"},BLOCK:{color:"#EF4444",bg:"rgba(239, 68, 68, 0.15)",label:"Blocked"},QUARANTINE:{color:"#EAB308",bg:"rgba(234, 179, 8, 0.15)",label:"Quarantined"}},iL={PUBLIC:{color:"#94a3b8",bg:"rgba(148, 163, 184, 0.15)"},INTERNAL:{color:"#60a5fa",bg:"rgba(96, 165, 250, 0.15)"},CONFIDENTIAL:{color:"#f59e0b",bg:"rgba(245, 158, 11, 0.15)"},RESTRICTED:{color:"#ef4444",bg:"rgba(239, 68, 68, 0.15)"}},iM={instruction_injection:{color:"#ef4444",bg:"rgba(239, 68, 68, 0.15)"},privilege_escalation:{color:"#ef4444",bg:"rgba(239, 68, 68, 0.15)"},credential_leak:{color:"#ef4444",bg:"rgba(239, 68, 68, 0.15)"},encoding_obfuscation:{color:"#f59e0b",bg:"rgba(245, 158, 11, 0.15)"},fragmented_payload:{color:"#f59e0b",bg:"rgba(245, 158, 11, 0.15)"},external_url:{color:"#f59e0b",bg:"rgba(245, 158, 11, 0.15)"},pipeline_error:{color:"#94a3b8",bg:"rgba(148, 163, 184, 0.15)"}};function iN(a){return a>=.7?"#22C55E":a>=.4?"#EAB308":"#EF4444"}function iO(a){return a>.5?"#EF4444":a>.2?"#EAB308":"#94a3b8"}function iP({entry:a,onClose:b,onViewMemory:c}){let[d,e]=(0,n.useState)(!1),f=iK[a.firewall_result]||iK.ALLOW,g=iL[a.sensitivity_level]||iL.PUBLIC,h=function(a){try{let b=JSON.parse(a);return Array.isArray(b)?b:[]}catch{return[]}}(a.threat_indicators),i=function(a){try{let b=JSON.parse(a);return Array.isArray(b)?b:[]}catch{return[]}}(a.blocked_patterns),j=(0,n.useCallback)(()=>{let b=JSON.stringify(a,null,2);navigator.clipboard.writeText(b).then(()=>{e(!0),setTimeout(()=>e(!1),1500)})},[a]);return(0,m.jsxs)(hf,{className:"bg-slate-900 border-slate-700 h-full overflow-auto",children:[(0,m.jsxs)(hg,{className:"border-b border-slate-700 pb-3",children:[(0,m.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,m.jsxs)("div",{className:"flex items-center gap-3",children:[(0,m.jsx)("span",{className:"px-2.5 py-1 rounded-md text-xs font-bold",style:{backgroundColor:f.bg,color:f.color},children:f.label}),(0,m.jsx)("span",{className:"px-2 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:g.bg,color:g.color},children:a.sensitivity_level})]}),(0,m.jsx)(hs,{variant:"ghost",size:"sm",onClick:b,className:"text-slate-400 hover:text-white -mt-1",children:"✕"})]}),(0,m.jsx)("div",{className:"text-xs text-slate-400 mt-2",children:new Date(a.timestamp).toLocaleString()}),a.project&&(0,m.jsxs)("div",{className:"text-[10px] text-slate-500 mt-1",children:["Project: ",a.project]})]}),(0,m.jsxs)(hi,{className:"p-4 space-y-4",children:[(0,m.jsxs)("div",{children:[(0,m.jsx)("h4",{className:"text-xs font-medium text-slate-400 mb-2",children:"Source"}),(0,m.jsxs)("div",{className:"bg-slate-800 rounded-lg p-3",children:[(0,m.jsx)("div",{className:"flex items-center gap-2 mb-1",children:(0,m.jsx)("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium bg-cyan-500/10 text-cyan-400",children:a.source_type})}),a.source_identifier&&(0,m.jsx)("div",{className:"text-xs text-slate-300 mt-1 font-mono break-all",children:a.source_identifier})]})]}),(0,m.jsxs)("div",{children:[(0,m.jsx)("h4",{className:"text-xs font-medium text-slate-400 mb-2",children:"Scores"}),(0,m.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,m.jsxs)("div",{className:"bg-slate-800 rounded-lg p-3",children:[(0,m.jsx)("div",{className:"text-[10px] text-slate-500",children:"Trust"}),(0,m.jsxs)("div",{className:"text-lg font-bold",style:{color:iN(a.trust_score)},children:[(100*a.trust_score).toFixed(0),"%"]}),(0,m.jsx)("div",{className:"mt-1 h-1.5 bg-slate-700 rounded-full overflow-hidden",children:(0,m.jsx)("div",{className:"h-full rounded-full transition-all",style:{width:`${100*a.trust_score}%`,backgroundColor:iN(a.trust_score)}})})]}),(0,m.jsxs)("div",{className:"bg-slate-800 rounded-lg p-3",children:[(0,m.jsx)("div",{className:"text-[10px] text-slate-500",children:"Anomaly"}),(0,m.jsxs)("div",{className:"text-lg font-bold",style:{color:iO(a.anomaly_score)},children:[(100*a.anomaly_score).toFixed(0),"%"]}),(0,m.jsx)("div",{className:"mt-1 h-1.5 bg-slate-700 rounded-full overflow-hidden",children:(0,m.jsx)("div",{className:"h-full rounded-full transition-all",style:{width:`${100*a.anomaly_score}%`,backgroundColor:iO(a.anomaly_score)}})})]}),null!==a.fragmentation_score&&(0,m.jsxs)("div",{className:"bg-slate-800 rounded-lg p-3",children:[(0,m.jsx)("div",{className:"text-[10px] text-slate-500",children:"Fragmentation"}),(0,m.jsxs)("div",{className:"text-lg font-bold text-slate-300",children:[(100*a.fragmentation_score).toFixed(0),"%"]}),(0,m.jsx)("div",{className:"mt-1 h-1.5 bg-slate-700 rounded-full overflow-hidden",children:(0,m.jsx)("div",{className:"h-full rounded-full bg-purple-500 transition-all",style:{width:`${100*a.fragmentation_score}%`}})})]}),null!==a.pipeline_duration_ms&&(0,m.jsxs)("div",{className:"bg-slate-800 rounded-lg p-3",children:[(0,m.jsx)("div",{className:"text-[10px] text-slate-500",children:"Pipeline"}),(0,m.jsxs)("div",{className:"text-lg font-bold text-slate-300",children:[a.pipeline_duration_ms,"ms"]})]})]})]}),(0,m.jsxs)("div",{children:[(0,m.jsx)("h4",{className:"text-xs font-medium text-slate-400 mb-2",children:"Threat Indicators"}),h.length>0?(0,m.jsx)("div",{className:"flex flex-wrap gap-1.5",children:h.map((a,b)=>{let c=iM[a]||{color:"#94a3b8",bg:"rgba(148, 163, 184, 0.15)"};return(0,m.jsx)("span",{className:"px-2 py-1 rounded text-[11px] font-medium",style:{backgroundColor:c.bg,color:c.color},children:a.replace(/_/g," ")},b)})}):(0,m.jsx)("div",{className:"text-xs text-slate-600",children:"No threats detected"})]}),i.length>0&&(0,m.jsxs)("div",{children:[(0,m.jsx)("h4",{className:"text-xs font-medium text-slate-400 mb-2",children:"Blocked Patterns"}),(0,m.jsx)("div",{className:"bg-slate-800 rounded-lg p-3 max-h-32 overflow-y-auto",children:i.map((a,b)=>(0,m.jsx)("div",{className:"text-[11px] text-slate-300 font-mono break-all mb-1 last:mb-0",children:a},b))})]}),a.reason&&(0,m.jsxs)("div",{children:[(0,m.jsx)("h4",{className:"text-xs font-medium text-slate-400 mb-2",children:"Reason"}),(0,m.jsx)("div",{className:"bg-slate-800 rounded-lg p-3",children:(0,m.jsx)("p",{className:"text-xs text-slate-300 whitespace-pre-wrap leading-relaxed",children:a.reason})})]}),(0,m.jsxs)("div",{className:"flex gap-2 pt-2",children:[a.memory_id&&c&&(0,m.jsx)(hs,{variant:"default",size:"sm",onClick:()=>c(a.memory_id),className:"flex-1 bg-blue-600 hover:bg-blue-700",children:"View Memory"}),(0,m.jsx)(hs,{variant:"outline",size:"sm",onClick:j,className:`flex-1 border-slate-700 transition-all ${d?"bg-green-600/20 text-green-400 border-green-600/50":"text-slate-300 hover:text-white"}`,children:d?"Copied":"Copy JSON"})]})]})]})}let iQ=hS("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);function iR({action:a,item:b,onConfirm:c,onCancel:d}){let[e,f]=(0,n.useState)(""),g="yes"===e.trim().toLowerCase();return(0,m.jsx)("div",{className:"fixed inset-0 bg-black/60 flex items-center justify-center z-50",children:(0,m.jsxs)("div",{className:"bg-slate-900 border border-slate-700 rounded-xl p-6 max-w-md w-full mx-4",children:[(0,m.jsxs)("h3",{className:"text-sm font-semibold text-white mb-2",children:["approve"===a?"Approve":"Reject"," quarantined item?"]}),(0,m.jsx)("p",{className:"text-xs text-slate-400 mb-1",children:(0,m.jsx)("strong",{children:b.title||"Untitled"})}),(0,m.jsx)("p",{className:"text-xs text-slate-500 mb-4",children:"approve"===a?"This will store the memory in the database.":"This will permanently discard the memory."}),(0,m.jsxs)("div",{className:"mb-4",children:[(0,m.jsxs)("label",{className:"text-xs text-slate-400 block mb-1",children:["Type ",(0,m.jsx)("strong",{className:"text-white",children:"YES"})," to confirm:"]}),(0,m.jsx)("input",{type:"text",value:e,onChange:a=>f(a.target.value),className:"w-full bg-slate-800 border border-slate-700 text-white text-sm rounded-lg px-3 py-2 focus:ring-cyan-500 focus:border-cyan-500",autoFocus:!0,onKeyDown:a=>{"Enter"===a.key&&g&&c(),"Escape"===a.key&&d()}})]}),(0,m.jsxs)("div",{className:"flex gap-2 justify-end",children:[(0,m.jsx)("button",{onClick:d,className:"px-3 py-1.5 text-xs text-slate-400 hover:text-white transition-colors",children:"Cancel"}),(0,m.jsx)("button",{onClick:c,disabled:!g,className:`px-3 py-1.5 text-xs rounded-lg transition-colors ${g?"approve"===a?"bg-green-600 text-white hover:bg-green-500":"bg-red-600 text-white hover:bg-red-500":"bg-slate-700 text-slate-500 cursor-not-allowed"}`,children:"approve"===a?"Approve":"Reject"})]})]})})}function iS(){let a,b,{projectFilter:c}=gd(),[d,e]=(0,n.useState)("pending"),{data:f,isLoading:g}=hN(d,100,c||void 0),h=(a=(0,fK.useQueryClient)(),fS({mutationFn:hJ,onSuccess:()=>{a.invalidateQueries({queryKey:["quarantine"]}),a.invalidateQueries({queryKey:["audit-stats"]})}})),i=(b=(0,fK.useQueryClient)(),fS({mutationFn:({id:a,notes:b})=>hK(a,b),onSuccess:()=>{b.invalidateQueries({queryKey:["quarantine"]}),b.invalidateQueries({queryKey:["audit-stats"]})}})),[j,k]=(0,n.useState)(null),l=f?.items??[];return(0,m.jsxs)("div",{className:"h-full flex flex-col overflow-hidden",children:[j&&(0,m.jsx)(iR,{action:j.action,item:j.item,onConfirm:()=>{j&&("approve"===j.action?h.mutate(j.item.id):i.mutate({id:j.item.id}),k(null))},onCancel:()=>k(null)}),(0,m.jsx)("div",{className:"p-4 border-b border-slate-800 shrink-0",children:(0,m.jsxs)("div",{className:"flex items-center justify-between",children:[(0,m.jsx)("h2",{className:"text-lg font-semibold text-white",children:"Quarantine Review"}),(0,m.jsx)("div",{className:"flex gap-1 bg-slate-800 rounded-lg p-0.5",children:["pending","approved","rejected"].map(a=>(0,m.jsx)("button",{onClick:()=>e(a),className:`px-3 py-1 text-xs rounded-md transition-colors capitalize ${d===a?"bg-cyan-600 text-white":"text-slate-400 hover:text-white"}`,children:a},a))})]})}),(0,m.jsx)("div",{className:"flex-1 overflow-y-auto p-4",children:g?(0,m.jsx)("div",{className:"flex items-center justify-center h-32",children:(0,m.jsx)("div",{className:"text-xs text-slate-500 animate-pulse",children:"Loading quarantine items..."})}):0===l.length?(0,m.jsxs)("div",{className:"flex flex-col items-center justify-center h-32 text-slate-500",children:[(0,m.jsx)(hV,{size:24,className:"mb-2 text-slate-600"}),(0,m.jsxs)("span",{className:"text-xs",children:["No ",d," items"]})]}):(0,m.jsx)("div",{className:"space-y-3",children:l.map(a=>{let b=(()=>{try{return JSON.parse(a.threat_indicators)}catch{return[]}})();return(0,m.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,m.jsxs)("div",{className:"flex items-start justify-between mb-2",children:[(0,m.jsxs)("div",{children:[(0,m.jsx)("h4",{className:"text-sm font-medium text-white",children:a.title||"Untitled"}),(0,m.jsxs)("div",{className:"text-[10px] text-slate-500 mt-0.5",children:[a.source_type," · ",new Date(a.created_at).toLocaleString(),a.anomaly_score>0&&(0,m.jsxs)("span",{className:`ml-2 ${a.anomaly_score>.5?"text-red-400":"text-yellow-400"}`,children:["Anomaly: ",a.anomaly_score.toFixed(2)]})]})]}),(0,m.jsx)("span",{className:"text-[10px] text-red-400 bg-red-400/10 px-2 py-0.5 rounded",children:a.reason?.slice(0,50)||"Threat detected"})]}),(0,m.jsx)("div",{className:"bg-slate-800/50 rounded-lg p-3 mb-3 text-xs text-slate-300 max-h-24 overflow-y-auto whitespace-pre-wrap",children:a.content?.slice(0,500)||"No content"}),b.length>0&&(0,m.jsx)("div",{className:"flex gap-1 mb-3 flex-wrap",children:b.map((a,b)=>(0,m.jsx)("span",{className:"text-[9px] text-yellow-400 bg-yellow-400/10 px-1.5 py-0.5 rounded",children:a},b))}),"pending"===a.status&&(0,m.jsxs)("div",{className:"flex gap-2",children:[(0,m.jsxs)("button",{onClick:()=>k({action:"approve",item:a}),className:"flex items-center gap-1 px-3 py-1.5 text-xs bg-green-600/10 text-green-400 rounded-lg hover:bg-green-600/20 transition-colors",children:[(0,m.jsx)(iQ,{size:12})," Approve"]}),(0,m.jsxs)("button",{onClick:()=>k({action:"reject",item:a}),className:"flex items-center gap-1 px-3 py-1.5 text-xs bg-red-600/10 text-red-400 rounded-lg hover:bg-red-600/20 transition-colors",children:[(0,m.jsx)(ih,{size:12})," Reject"]})]}),a.reviewed_at&&(0,m.jsxs)("div",{className:"text-[10px] text-slate-500",children:["approved"===a.status?"Approved":"Rejected"," by ",a.reviewed_by," at ",new Date(a.reviewed_at).toLocaleString()]})]},a.id)})})})]})}let iT=hS("funnel",[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]]),iU=hS("arrow-up-down",[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]]),iV=hS("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),iW=process.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";async function iX(a,b){let c=new URLSearchParams({timeRange:a});b&&c.set("project",b);let d=await fetch(`${iW}/api/v1/agents?${c}`);if(!d.ok)throw Error("Failed to fetch agent registry");return d.json()}async function iY(a,b,c){let d=encodeURIComponent(a),e=new URLSearchParams({timeRange:b});c&&e.set("project",c);let f=await fetch(`${iW}/api/v1/agents/${d}/timeline?${e}`);if(!f.ok)throw Error("Failed to fetch agent timeline");return f.json()}async function iZ(a,b){let c=encodeURIComponent(a),d=new URLSearchParams;b?.limit&&d.set("limit",b.limit.toString()),b?.offset&&d.set("offset",b.offset.toString()),b?.firewallResult&&d.set("firewallResult",b.firewallResult),b?.project&&d.set("project",b.project);let e=await fetch(`${iW}/api/v1/agents/${c}/operations?${d}`);if(!e.ok)throw Error("Failed to fetch agent operations");return e.json()}function i$(a,b){return fO({queryKey:["agent-operations",a,b],queryFn:()=>iZ(a,b),enabled:!!a,refetchInterval:3e4,retry:2})}function i_(a){return a>=.7?"full":a>=.5?"limited":"restricted"}let i0={full:"text-green-400",limited:"text-yellow-400",restricted:"text-red-400"},i1={full:"bg-green-500/10",limited:"bg-yellow-500/10",restricted:"bg-red-500/10"},i2={full:"Full Access",limited:"Limited",restricted:"Restricted"},i3=460,i4=90;function i5({identifier:a,timeRange:b}){let{data:c,isLoading:d}=function(a,b="24h",c){return fO({queryKey:["agent-timeline",a,b,void 0],queryFn:()=>iY(a,b,void 0),enabled:!!a,refetchInterval:3e4,retry:2})}(a,b),e=c?.points??[],{linePath:f,dots:g,xLabels:h}=(0,n.useMemo)(()=>{if(0===e.length)return{linePath:"",dots:[],xLabels:[]};let a=e.map(a=>new Date(a.timestamp).getTime()),c=Math.min(...a),d=Math.max(...a)-c||1,f=a=>30+(a-c)/d*i3,g=a=>10+(1-a)*i4,h=e.map((b,c)=>{let d=f(a[c]),e=g(b.trust_score);return`${0===c?"M":"L"} ${d} ${e}`}),i=e.map((b,c)=>({x:f(a[c]),y:g(b.trust_score),result:b.firewall_result,score:b.trust_score,time:b.timestamp})).filter(a=>"ALLOW"!==a.result),j=Math.min(5,e.length),k=[];for(let a=0;a<j;a++){let e=c+d*a/(j-1||1),g=new Date(e);k.push({x:f(e),label:"24h"===b?g.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):g.toLocaleDateString([],{month:"short",day:"numeric"})})}return{linePath:h.join(" "),dots:i,xLabels:k}},[e,b]);return d?(0,m.jsx)("div",{className:"h-[120px] flex items-center justify-center text-slate-500 text-xs",children:"Loading timeline..."}):0===e.length?(0,m.jsx)("div",{className:"h-[120px] flex items-center justify-center text-slate-500 text-xs",children:"No data for this time range."}):(0,m.jsxs)("svg",{viewBox:"0 0 500 120",className:"w-full",preserveAspectRatio:"xMidYMid meet",children:[(0,m.jsx)("line",{x1:30,y1:10+(1-.7)*i4,x2:30+i3,y2:10+(1-.7)*i4,stroke:"#22c55e",strokeWidth:"0.5",strokeDasharray:"4 2",opacity:"0.3"}),(0,m.jsx)("line",{x1:30,y1:10+.5*i4,x2:30+i3,y2:10+.5*i4,stroke:"#eab308",strokeWidth:"0.5",strokeDasharray:"4 2",opacity:"0.3"}),(0,m.jsx)("text",{x:26,y:10+(1-.7)*i4+3,fill:"#64748b",fontSize:"8",textAnchor:"end",children:"0.7"}),(0,m.jsx)("text",{x:26,y:10+.5*i4+3,fill:"#64748b",fontSize:"8",textAnchor:"end",children:"0.5"}),(0,m.jsx)("text",{x:26,y:13,fill:"#64748b",fontSize:"8",textAnchor:"end",children:"1.0"}),(0,m.jsx)("text",{x:26,y:10+i4+3,fill:"#64748b",fontSize:"8",textAnchor:"end",children:"0.0"}),(0,m.jsx)("path",{d:f,fill:"none",stroke:"#06b6d4",strokeWidth:"1.5"}),g.map((a,b)=>(0,m.jsx)("circle",{cx:a.x,cy:a.y,r:"3",fill:"BLOCK"===a.result?"#ef4444":"#eab308",stroke:"#0f172a",strokeWidth:"1",children:(0,m.jsx)("title",{children:`${a.result} — trust: ${a.score.toFixed(2)} — ${new Date(a.time).toLocaleString()}`})},b)),h.map((a,b)=>(0,m.jsx)("text",{x:a.x,y:116,fill:"#64748b",fontSize:"8",textAnchor:"middle",children:a.label},b))]})}let i6={BLOCK:"text-red-400 bg-red-500/10",QUARANTINE:"text-yellow-400 bg-yellow-500/10"};function i7({identifier:a}){let{data:b,isLoading:c}=i$(a,{firewallResult:"BLOCK",limit:20}),{data:d}=i$(a,{firewallResult:"QUARANTINE",limit:20}),e=[...b?.entries??[],...d?.entries??[]].sort((a,b)=>new Date(b.timestamp).getTime()-new Date(a.timestamp).getTime());return c?(0,m.jsx)("div",{className:"text-slate-500 text-xs",children:"Loading..."}):0===e.length?(0,m.jsx)("div",{className:"text-slate-500 text-xs",children:"No flagged operations."}):(0,m.jsx)("div",{className:"space-y-1 max-h-60 overflow-y-auto",children:e.map(a=>{let b=[];try{b=JSON.parse(a.threat_indicators)}catch{}return(0,m.jsxs)("div",{className:"px-2 py-1.5 rounded bg-slate-800/50 border border-slate-800",children:[(0,m.jsxs)("div",{className:"flex items-center justify-between",children:[(0,m.jsx)("span",{className:`px-1 py-0.5 rounded text-[10px] font-medium ${i6[a.firewall_result]??"text-slate-400"}`,children:a.firewall_result}),(0,m.jsx)("span",{className:"text-[10px] text-slate-500",children:new Date(a.timestamp).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})})]}),a.reason&&(0,m.jsx)("p",{className:"text-[11px] text-slate-400 mt-0.5 truncate",children:a.reason}),b.length>0&&(0,m.jsx)("div",{className:"flex gap-1 mt-1 flex-wrap",children:b.map((a,b)=>(0,m.jsx)("span",{className:"px-1 py-0.5 rounded text-[9px] bg-red-500/10 text-red-400",children:a},b))}),(0,m.jsxs)("div",{className:"flex gap-3 mt-1 text-[10px] text-slate-500",children:[(0,m.jsxs)("span",{children:["Trust: ",a.trust_score.toFixed(2)]}),(0,m.jsxs)("span",{children:["Anomaly: ",a.anomaly_score.toFixed(2)]}),null!==a.pipeline_duration_ms&&(0,m.jsxs)("span",{children:[a.pipeline_duration_ms,"ms"]})]})]},a.id)})})}let i8=hS("bell",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]]),i9=process.env.NEXT_PUBLIC_WS_URL||"ws://localhost:3001/ws/events";function ja({agentFilter:a}){let[b,c]=(0,n.useState)([]),d=(0,n.useRef)(0),e=(0,n.useRef)(null),f=(0,n.useCallback)(b=>{try{let e=JSON.parse(b.data);if("defence_event"!==e.type)return;let f=e.data;if(a&&f.source_identifier!==a)return;c(a=>[{...f,id:++d.current},...a].slice(0,50))}catch{}},[a]);return((0,n.useEffect)(()=>{try{let a=new WebSocket(i9);return e.current=a,a.onmessage=f,a.onerror=()=>{},()=>{a.close(),e.current=null}}catch{return}},[f]),0===b.length)?(0,m.jsxs)("div",{className:"flex items-center gap-2 text-slate-500 text-xs py-2",children:[(0,m.jsx)(i8,{size:12}),(0,m.jsx)("span",{children:"Listening for defence events..."})]}):(0,m.jsx)("div",{className:"space-y-1 max-h-48 overflow-y-auto",children:(0,m.jsx)(E,{initial:!1,children:b.map(a=>(0,m.jsxs)(fw.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0},className:`px-2 py-1.5 rounded border text-xs ${"BLOCK"===a.firewall_result?"bg-red-500/5 border-red-500/20":"bg-yellow-500/5 border-yellow-500/20"}`,children:[(0,m.jsxs)("div",{className:"flex items-center justify-between",children:[(0,m.jsx)("span",{className:`font-medium ${"BLOCK"===a.firewall_result?"text-red-400":"text-yellow-400"}`,children:a.firewall_result}),(0,m.jsx)("span",{className:"text-[10px] text-slate-500",children:new Date(a.timestamp).toLocaleTimeString()})]}),(0,m.jsxs)("p",{className:"text-slate-400 text-[11px] truncate mt-0.5",children:[a.source_identifier," — ",a.reason??"No reason"]})]},a.id))})})}function jb({identifier:a,compact:b}){let c=a.split(">").map(a=>a.trim());return 1===c.length?(0,m.jsx)("span",{className:"font-mono text-sm text-white",children:a}):b?(0,m.jsxs)("span",{className:"font-mono text-sm",children:[(0,m.jsxs)("span",{className:"text-slate-500",children:[c.slice(0,-1).join(" › ")," › "]}),(0,m.jsx)("span",{className:"text-white",children:c[c.length-1]})]}):(0,m.jsx)("div",{className:"font-mono text-sm",children:c.map((a,b)=>(0,m.jsxs)("span",{children:[b>0&&(0,m.jsx)(iV,{size:12,className:"inline text-slate-600 mx-0.5"}),(0,m.jsx)("span",{className:b===c.length-1?"text-white":"text-slate-500",children:a})]},b))})}function jc({score:a}){let b=i_(a);return(0,m.jsxs)("span",{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-medium ${i0[b]} ${i1[b]}`,children:[a.toFixed(2)," · ",i2[b]]})}function jd({type:a}){let b={agent:"text-purple-400 bg-purple-500/10",cli:"text-cyan-400 bg-cyan-500/10",user:"text-green-400 bg-green-500/10",hook:"text-blue-400 bg-blue-500/10",api:"text-orange-400 bg-orange-500/10",web:"text-red-400 bg-red-500/10",file:"text-slate-400 bg-slate-500/10",email:"text-yellow-400 bg-yellow-500/10"}[a]??"text-slate-400 bg-slate-500/10";return(0,m.jsx)("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-medium ${b}`,children:a})}function je(){let{projectFilter:a}=gd(),[b,c]=(0,n.useState)("24h"),[d,e]=(0,n.useState)(null),[f,g]=(0,n.useState)("operation_count"),[h,i]=(0,n.useState)(!1),[j,k]=(0,n.useState)(null),[l,o]=(0,n.useState)(null),[p,q]=(0,n.useState)(!1),[r]=(0,n.useState)(()=>Date.now()),{data:s,isLoading:t}=function(a="24h",b){return fO({queryKey:["agents",a,b],queryFn:()=>iX(a,b),refetchInterval:3e4,retry:2})}(b,a??void 0),u=s?.agents??[],v=(0,n.useMemo)(()=>{let a=u;return j&&(a=a.filter(a=>a.source_type===j)),l&&(a=a.filter(a=>i_(a.avg_trust_score)===l)),p&&(a=a.filter(a=>a.flagged_count>0)),a},[u,j,l,p]),w=(0,n.useMemo)(()=>{let a=[...v];return a.sort((a,b)=>{let c=a[f],d=b[f];return"string"==typeof c&&"string"==typeof d?h?c.localeCompare(d):d.localeCompare(c):h?c-d:d-c}),a},[v,f,h]),x=(0,n.useMemo)(()=>[...new Set(u.map(a=>a.source_type))],[u]),y=a=>{f===a?i(!h):(g(a),i(!1))};return(0,m.jsxs)("div",{className:"flex h-full",children:[(0,m.jsxs)("div",{className:`${d?"w-1/2":"w-full"} border-r border-slate-800 flex flex-col`,children:[(0,m.jsxs)("div",{className:"p-3 border-b border-slate-800 flex items-center justify-between",children:[(0,m.jsxs)("div",{className:"flex items-center gap-2",children:[(0,m.jsx)(hZ,{size:16,className:"text-cyan-400"}),(0,m.jsx)("h2",{className:"text-sm font-medium text-white",children:"Agent Registry"}),(0,m.jsxs)("span",{className:"text-xs text-slate-500",children:[w.length," agents"]})]}),(0,m.jsx)("div",{className:"flex gap-1",children:["24h","7d","30d"].map(a=>(0,m.jsx)("button",{onClick:()=>c(a),className:`px-2 py-0.5 text-[10px] rounded transition-colors ${b===a?"bg-cyan-600 text-white":"text-slate-400 hover:text-white"}`,children:a},a))})]}),(0,m.jsxs)("div",{className:"px-3 py-2 border-b border-slate-800 flex items-center gap-2 flex-wrap",children:[(0,m.jsx)(iT,{size:12,className:"text-slate-500"}),x.map(a=>(0,m.jsx)("button",{onClick:()=>k(j===a?null:a),className:`px-1.5 py-0.5 text-[10px] rounded transition-colors ${j===a?"bg-cyan-600/20 text-cyan-400":"text-slate-500 hover:text-slate-300"}`,children:a},a)),(0,m.jsx)("span",{className:"text-slate-700",children:"|"}),["full","limited","restricted"].map(a=>(0,m.jsx)("button",{onClick:()=>o(l===a?null:a),className:`px-1.5 py-0.5 text-[10px] rounded transition-colors ${l===a?"bg-cyan-600/20 text-cyan-400":"text-slate-500 hover:text-slate-300"}`,children:a},a)),(0,m.jsx)("span",{className:"text-slate-700",children:"|"}),(0,m.jsxs)("button",{onClick:()=>q(!p),className:`px-1.5 py-0.5 text-[10px] rounded transition-colors flex items-center gap-0.5 ${p?"bg-red-600/20 text-red-400":"text-slate-500 hover:text-slate-300"}`,children:[(0,m.jsx)(hV,{size:10})," flagged"]})]}),(0,m.jsxs)("div",{className:"px-3 py-1.5 border-b border-slate-800 grid grid-cols-[1fr_80px_60px_60px_70px] gap-2 text-[10px] text-slate-500",children:[(0,m.jsx)("span",{children:"Agent"}),(0,m.jsxs)("button",{onClick:()=>y("avg_trust_score"),className:"flex items-center gap-0.5 hover:text-slate-300",children:["Trust ",(0,m.jsx)(iU,{size:8})]}),(0,m.jsxs)("button",{onClick:()=>y("operation_count"),className:"flex items-center gap-0.5 hover:text-slate-300",children:["Ops ",(0,m.jsx)(iU,{size:8})]}),(0,m.jsxs)("button",{onClick:()=>y("flagged_count"),className:"flex items-center gap-0.5 hover:text-slate-300",children:["Flagged ",(0,m.jsx)(iU,{size:8})]}),(0,m.jsxs)("button",{onClick:()=>y("last_seen"),className:"flex items-center gap-0.5 hover:text-slate-300",children:["Last seen ",(0,m.jsx)(iU,{size:8})]})]}),(0,m.jsxs)("div",{className:"flex-1 overflow-y-auto",children:[t&&(0,m.jsx)("div",{className:"p-4 text-center text-slate-500 text-xs",children:"Loading agents..."}),!t&&0===w.length&&(0,m.jsx)("div",{className:"p-4 text-center text-slate-500 text-xs",children:"No agents found in this time range."}),w.map(a=>{let b,c=d?.source_identifier===a.source_identifier&&d?.source_type===a.source_type;return(0,m.jsxs)("button",{onClick:()=>e(c?null:a),className:`w-full px-3 py-2 grid grid-cols-[1fr_80px_60px_60px_70px] gap-2 items-center text-left transition-colors border-b border-slate-800/50 ${c?"bg-cyan-600/10":"hover:bg-slate-800/50"}`,children:[(0,m.jsxs)("div",{className:"min-w-0",children:[(0,m.jsx)(jb,{identifier:a.source_identifier,compact:!0}),(0,m.jsx)("div",{className:"mt-0.5",children:(0,m.jsx)(jd,{type:a.source_type})})]}),(0,m.jsx)(jc,{score:a.avg_trust_score}),(0,m.jsx)("span",{className:"text-xs text-slate-300 tabular-nums",children:a.operation_count}),(0,m.jsx)("span",{className:`text-xs tabular-nums ${a.flagged_count>0?"text-red-400":"text-slate-500"}`,children:a.flagged_count}),(0,m.jsx)("span",{className:"text-[10px] text-slate-500",children:(b=r-new Date(a.last_seen).getTime())<6e4?"just now":b<36e5?`${Math.floor(b/6e4)}m ago`:b<864e5?`${Math.floor(b/36e5)}h ago`:`${Math.floor(b/864e5)}d ago`})]},`${a.source_type}:${a.source_identifier}`)})]})]}),(0,m.jsx)(E,{children:d&&(0,m.jsxs)(fw.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:20},className:"w-1/2 flex flex-col overflow-y-auto",children:[(0,m.jsxs)("div",{className:"p-3 border-b border-slate-800",children:[(0,m.jsxs)("div",{className:"flex items-center justify-between",children:[(0,m.jsx)(jb,{identifier:d.source_identifier}),(0,m.jsx)("button",{onClick:()=>e(null),className:"text-slate-500 hover:text-white text-xs",children:"Close"})]}),(0,m.jsxs)("div",{className:"flex items-center gap-2 mt-1.5",children:[(0,m.jsx)(jd,{type:d.source_type}),(0,m.jsx)(jc,{score:d.avg_trust_score}),(0,m.jsxs)("span",{className:"text-[10px] text-slate-500",children:[d.operation_count," ops · ",d.flagged_count," flagged"]})]})]}),(0,m.jsxs)("div",{className:"p-3 border-b border-slate-800",children:[(0,m.jsx)("h3",{className:"text-xs font-medium text-slate-400 mb-2",children:"Trust Score Timeline"}),(0,m.jsx)(i5,{identifier:d.source_identifier,timeRange:b})]}),(0,m.jsxs)("div",{className:"p-3 border-b border-slate-800",children:[(0,m.jsxs)("h3",{className:"text-xs font-medium text-slate-400 mb-2",children:["Flagged Operations",d.flagged_count>0&&(0,m.jsxs)("span",{className:"ml-1 text-red-400",children:["(",d.flagged_count,")"]})]}),(0,m.jsx)(i7,{identifier:d.source_identifier})]}),(0,m.jsxs)("div",{className:"p-3",children:[(0,m.jsx)("h3",{className:"text-xs font-medium text-slate-400 mb-2",children:"Live Alerts"}),(0,m.jsx)(ja,{agentFilter:d.source_identifier})]})]})})]})}let jf=hS("shield-check",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),jg=hS("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]),jh={critical:"text-red-400 bg-red-400/10",high:"text-red-400 bg-red-400/10",medium:"text-yellow-400 bg-yellow-400/10",low:"text-slate-400 bg-slate-400/10",safe:"text-green-400 bg-green-400/10"};function ji({level:a}){let b=jh[a]??jh.low;return(0,m.jsx)("span",{className:`text-[10px] font-medium px-1.5 py-0.5 rounded ${b}`,children:a.toUpperCase()})}function jj({findings:a}){return 0===a.length?null:(0,m.jsx)("div",{className:"mt-2 space-y-1.5 pl-6",children:a.map((a,b)=>(0,m.jsxs)("div",{className:"flex items-start gap-2",children:[(0,m.jsx)(ji,{level:a.severity}),(0,m.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,m.jsx)("span",{className:"text-xs text-slate-300",children:a.description}),a.matchedText&&(0,m.jsxs)("div",{className:"mt-0.5 text-[10px] text-slate-500 font-mono truncate",children:['Match: "',a.matchedText,'"']})]})]},`${a.pattern}-${b}`))})}function jk(a){let b=a.split(/[/\\]/);return b[b.length-1]||a}function jl({file:a,cloudConnected:b,onTrust:c,onUntrust:d,onRemove:e,onCloudUpsell:f}){let[g,h]=(0,n.useState)(!a.safe),[i,j]=(0,n.useState)(!1);return(0,m.jsxs)("div",{className:"bg-slate-800/50 border border-slate-700 rounded-lg overflow-hidden",children:[(0,m.jsxs)("div",{className:"flex items-center",children:[(0,m.jsxs)("button",{onClick:()=>h(!g),className:"flex-1 px-3 py-2.5 flex items-center gap-3 hover:bg-slate-800/80 transition-colors min-w-0",children:[a.trusted?(0,m.jsx)(jf,{size:16,className:"text-cyan-400 shrink-0"}):a.safe?(0,m.jsx)(ig,{size:16,className:"text-green-400 shrink-0"}):(0,m.jsx)(ik,{size:16,className:"text-red-400 shrink-0"}),(0,m.jsxs)("div",{className:"flex-1 min-w-0 text-left",children:[(0,m.jsx)("span",{className:"text-xs font-medium text-white truncate block",children:a.skillName||jk(a.path)}),(0,m.jsx)("span",{className:"text-[10px] text-slate-500 truncate block",children:a.path.replace(/^\/Users\/[^/]+/,"~")})]}),(0,m.jsx)("span",{className:"text-[10px] text-slate-500 shrink-0",children:a.format}),a.trusted?(0,m.jsx)("span",{className:"text-[10px] px-1.5 py-0.5 rounded font-medium bg-cyan-400/10 text-cyan-400",children:"TRUSTED"}):(0,m.jsx)(ji,{level:a.riskLevel}),(0,m.jsxs)("span",{className:"text-[10px] text-slate-600 shrink-0",children:[a.scanDurationMs,"ms"]}),a.findings.length>0?g?(0,m.jsx)(h5,{size:14,className:"text-slate-500 shrink-0"}):(0,m.jsx)(iV,{size:14,className:"text-slate-500 shrink-0"}):(0,m.jsx)("div",{className:"w-[14px] shrink-0"})]}),(0,m.jsxs)("div",{className:"flex items-center gap-0.5 pr-2 shrink-0",children:[a.trusted?(0,m.jsx)("button",{onClick:()=>d(a.path),title:"Remove trust",className:"p-1.5 rounded hover:bg-slate-700 transition-colors text-cyan-400 hover:text-cyan-300",children:(0,m.jsx)(jf,{size:14})}):(0,m.jsx)("button",{onClick:()=>c(a.path),title:"Mark as trusted",className:"p-1.5 rounded hover:bg-slate-700 transition-colors text-slate-500 hover:text-cyan-400",children:(0,m.jsx)(hT,{size:14})}),!a.safe&&!a.trusted&&(0,m.jsx)("button",{onClick:()=>b?j(!0):f(),title:b?"Remove skill file":"Connect to Cloud to remove",className:`p-1.5 rounded transition-colors ${b?"hover:bg-red-500/10 text-slate-500 hover:text-red-400":"text-slate-600 hover:text-slate-400 cursor-not-allowed"}`,children:(0,m.jsx)(jg,{size:14})})]})]}),i&&(0,m.jsxs)("div",{className:"border-t border-slate-700/50 px-3 py-2.5 bg-red-950/30 flex items-center gap-3",children:[(0,m.jsxs)("span",{className:"text-xs text-red-300 flex-1",children:["Remove ",(0,m.jsx)("span",{className:"font-medium",children:a.skillName||jk(a.path)}),"? This will delete the file from disk."]}),(0,m.jsx)("button",{onClick:()=>{e(a.path),j(!1)},className:"px-3 py-1 text-xs font-medium bg-red-600 hover:bg-red-500 text-white rounded transition-colors",children:"Delete"}),(0,m.jsx)("button",{onClick:()=>j(!1),className:"px-3 py-1 text-xs text-slate-400 hover:text-white transition-colors",children:"Cancel"})]}),g&&a.findings.length>0&&(0,m.jsx)("div",{className:"border-t border-slate-700/50 px-3 py-2 bg-slate-900/50",children:(0,m.jsx)(jj,{findings:a.findings})})]})}function jm({files:a,cloudConnected:b,onTrust:c,onUntrust:d,onRemove:e,onCloudUpsell:f}){return 0===a.length?null:(0,m.jsx)("div",{className:"space-y-1.5",children:a.map(a=>(0,m.jsx)(jl,{file:a,cloudConnected:b,onTrust:c,onUntrust:d,onRemove:e,onCloudUpsell:f},a.path))})}let jn=[{value:"",label:"Auto-detect"},{value:"skill-md",label:"SKILL.md (Claude Code)"},{value:"hook-md",label:"HOOK.md (OpenClaw)"},{value:"hook-js",label:"handler.js (OpenClaw)"},{value:"rules",label:".cursorrules / .windsurfrules / .clinerules"},{value:"claude-md",label:"CLAUDE.md"},{value:"copilot-md",label:"copilot-instructions.md"},{value:"aider-yml",label:".aider.conf.yml"},{value:"continue-json",label:".continue/config.json"}];function jo(){let a=ip(),b=fS({mutationFn:io}),c=fS({mutationFn:iq}),d=fS({mutationFn:ir}),e=fS({mutationFn:is}),{data:f}=iE(),[g,h]=(0,n.useState)(null),[i,j]=(0,n.useState)(null),[k,l]=(0,n.useState)(!1),[o,p]=(0,n.useState)(""),[q,r]=(0,n.useState)(""),[s,t]=(0,n.useState)(!1),u=!!(f?.enabled&&f?.apiKeySet);return(0,m.jsxs)("div",{className:"h-full overflow-y-auto p-6",children:[(0,m.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,m.jsxs)("div",{children:[(0,m.jsx)("h2",{className:"text-lg font-semibold text-white",children:"Skills Scanner"}),(0,m.jsx)("p",{className:"text-xs text-slate-400 mt-0.5",children:"Scan agent instruction files for hidden threats"})]}),(0,m.jsxs)("button",{onClick:()=>{a.mutate(void 0,{onSuccess:a=>h(a)})},disabled:a.isPending,className:"flex items-center gap-1.5 px-4 py-2 bg-cyan-600 hover:bg-cyan-500 disabled:opacity-50 rounded-lg text-sm font-medium text-white transition-colors",children:[a.isPending?(0,m.jsx)(ie,{size:14,className:"animate-spin"}):(0,m.jsx)(h$,{size:14}),"Scan All"]})]}),s&&(0,m.jsxs)("div",{className:"mb-4 bg-slate-900 border border-cyan-800/50 rounded-xl p-4 flex items-center gap-3",children:[(0,m.jsx)(ic,{size:20,className:"text-cyan-400 shrink-0"}),(0,m.jsxs)("div",{className:"flex-1",children:[(0,m.jsx)("p",{className:"text-sm font-medium text-white",children:"Connect to ShieldCortex Cloud"}),(0,m.jsx)("p",{className:"text-xs text-slate-400 mt-0.5",children:"Enable one-click skill removal and cloud-powered threat intelligence."})]}),(0,m.jsx)("button",{onClick:()=>t(!1),className:"text-xs text-slate-500 hover:text-slate-300 transition-colors",children:"Dismiss"})]}),g?(0,m.jsxs)("div",{className:"space-y-4",children:[(0,m.jsxs)("div",{className:"flex items-center gap-3 text-xs text-slate-400",children:[(0,m.jsxs)("span",{children:[(0,m.jsx)("span",{className:"text-white font-medium",children:g.totalScanned})," files scanned"]}),(0,m.jsx)("span",{className:"text-slate-600",children:"·"}),g.threatCount>0?(0,m.jsxs)("span",{children:[(0,m.jsx)("span",{className:"text-red-400 font-medium",children:g.threatCount})," with threats"]}):(0,m.jsx)("span",{className:"text-green-400",children:"All clean"}),(0,m.jsx)("span",{className:"text-slate-600",children:"·"}),(0,m.jsx)("span",{children:new Date(g.scannedAt).toLocaleTimeString()})]}),(0,m.jsx)(jm,{files:g.files,cloudConnected:u,onTrust:a=>{c.mutate(a,{onSuccess:()=>{g&&h({...g,files:g.files.map(b=>b.path===a?{...b,trusted:!0}:b),threatCount:g.files.filter(b=>!b.safe&&!b.trusted&&b.path!==a).length})}})},onUntrust:a=>{d.mutate(a,{onSuccess:()=>{g&&h({...g,files:g.files.map(b=>b.path===a?{...b,trusted:!1}:b),threatCount:g.files.filter(b=>{let c=b.path!==a&&b.trusted;return!b.safe&&!c}).length})}})},onRemove:a=>{e.mutate(a,{onSuccess:()=>{if(g){let b=g.files.filter(b=>b.path!==a);h({...g,files:b,totalScanned:b.length,threatCount:b.filter(a=>!a.safe&&!a.trusted).length})}}})},onCloudUpsell:()=>t(!0)})]}):a.isPending?(0,m.jsx)("div",{className:"flex items-center justify-center py-16",children:(0,m.jsx)(ie,{size:24,className:"text-cyan-400 animate-spin"})}):(0,m.jsxs)("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[(0,m.jsx)(h$,{size:32,className:"text-slate-600 mb-3"}),(0,m.jsx)("p",{className:"text-sm text-slate-400",children:"No skills scanned yet"}),(0,m.jsx)("p",{className:"text-xs text-slate-500 mt-1",children:'Click "Scan All" to discover and scan agent instruction files'})]}),(0,m.jsxs)("div",{className:"mt-6",children:[(0,m.jsxs)("button",{onClick:()=>l(!k),className:"flex items-center gap-1.5 text-xs text-slate-400 hover:text-slate-300 transition-colors",children:[k?(0,m.jsx)(h5,{size:14}):(0,m.jsx)(iV,{size:14}),"Paste & Scan"]}),k&&(0,m.jsxs)("div",{className:"mt-3 bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,m.jsx)("textarea",{value:o,onChange:a=>p(a.target.value),placeholder:"Paste skill/instruction file content here...",className:"w-full h-32 bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-sm text-white placeholder:text-slate-500 focus:ring-cyan-500 focus:border-cyan-500 resize-y font-mono"}),(0,m.jsxs)("div",{className:"flex items-center gap-3 mt-3",children:[(0,m.jsx)("select",{value:q,onChange:a=>r(a.target.value),className:"bg-slate-800 border border-slate-700 text-white text-xs rounded-lg px-3 py-2 focus:ring-cyan-500 focus:border-cyan-500",children:jn.map(a=>(0,m.jsx)("option",{value:a.value,children:a.label},a.value))}),(0,m.jsxs)("button",{onClick:()=>{o.trim()&&b.mutate({content:o,format:q||void 0},{onSuccess:a=>j(a)})},disabled:b.isPending||!o.trim(),className:"flex items-center gap-1.5 px-4 py-2 bg-cyan-600 hover:bg-cyan-500 disabled:opacity-50 rounded-lg text-xs font-medium text-white transition-colors",children:[b.isPending?(0,m.jsx)(ie,{size:12,className:"animate-spin"}):(0,m.jsx)(h$,{size:12}),"Scan Content"]})]}),i&&(0,m.jsxs)("div",{className:"mt-4 bg-slate-800/50 border border-slate-700 rounded-lg p-3",children:[(0,m.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,m.jsx)("span",{className:"text-xs font-medium text-white",children:i.skillName}),(0,m.jsx)(ji,{level:i.riskLevel}),(0,m.jsxs)("span",{className:"text-[10px] text-slate-500",children:[i.scanDurationMs,"ms"]})]}),(0,m.jsx)("p",{className:"text-xs text-slate-400",children:i.summary}),i.findings.length>0&&(0,m.jsx)(jj,{findings:i.findings})]})]})]})]})}let jp=hS("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"}]]),jq=hS("radio",[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]),jr=hS("shield-off",[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71",key:"1jlk70"}],["path",{d:"M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264",key:"18rp1v"}]]),js=hS("scan",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}]]),jt=[{id:"personal",label:"Personal",description:"Lighter touch for solo use",icon:hT},{id:"enterprise",label:"Enterprise",description:"Financial & data protection",icon:jp},{id:"school",label:"School",description:"GDPR strict, pupil data guarded",icon:hZ},{id:"paranoid",label:"Paranoid",description:"Everything requires approval",icon:hV}],ju=[{name:"Injection Scanner",description:"40+ patterns across 8 categories",icon:js},{name:"Instruction Gateway",description:"Trusted channel validation",icon:jq},{name:"Action Gate",description:"Approve / block external actions",icon:jp},{name:"PII Guard",description:"Block sensitive data output",icon:h3},{name:"Kill Switch",description:"Emergency stop phrase",icon:jr},{name:"Sub-Agent Control",description:"Restrict spawned agent operations",icon:hZ}],jv={critical:"bg-red-500/20 text-red-400 border-red-500/30",high:"bg-orange-500/20 text-orange-400 border-orange-500/30",medium:"bg-yellow-500/20 text-yellow-400 border-yellow-500/30",low:"bg-slate-500/20 text-slate-400 border-slate-500/30"},jw={CRITICAL:"bg-red-500/20 text-red-400",HIGH:"bg-orange-500/20 text-orange-400",MEDIUM:"bg-yellow-500/20 text-yellow-400",LOW:"bg-slate-500/20 text-slate-400",NONE:"bg-green-500/20 text-green-400"};function jx(){let a,b,{data:c,isLoading:d}=iA(),{data:e}=iB(50),f=(a=(0,fK.useQueryClient)(),fS({mutationFn:a=>iw(a),onSuccess:()=>{a.invalidateQueries({queryKey:["iron-dome-status"]}),a.invalidateQueries({queryKey:["iron-dome-audit"]})}})),g=(b=(0,fK.useQueryClient)(),fS({mutationFn:ix,onSuccess:()=>{b.invalidateQueries({queryKey:["iron-dome-status"]})}})),h=fS({mutationFn:iy}),[i,j]=(0,n.useState)(""),[k,l]=(0,n.useState)(null),o=c?.enabled??!1,p=c?.profile,q=c?.config,r=e?.logs??[],s=r.filter(a=>"BLOCK"===a.firewall_result).length,t=r.filter(a=>"ALLOW"===a.firewall_result).length;return(0,m.jsxs)("div",{className:"h-full overflow-y-auto p-6",children:[(0,m.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,m.jsxs)("div",{className:"flex items-center gap-3",children:[(0,m.jsx)(h_,{size:20,className:"text-red-400"}),(0,m.jsx)("h2",{className:"text-lg font-semibold text-white",children:"Iron Dome"}),d?(0,m.jsx)("span",{className:"text-[10px] text-slate-500 animate-pulse",children:"Loading..."}):(0,m.jsx)("span",{className:`text-[10px] font-medium px-2 py-0.5 rounded-full ${o?"bg-red-500/20 text-red-400 border border-red-500/30":"bg-slate-700/50 text-slate-500"}`,children:o?"ACTIVE":"INACTIVE"})]}),o&&(0,m.jsxs)("button",{onClick:()=>{g.mutate()},disabled:g.isPending,className:"flex items-center gap-1.5 px-3 py-1.5 bg-red-500/10 border border-red-500/30 hover:bg-red-500/20 disabled:opacity-50 rounded-lg text-xs font-medium text-red-400 transition-colors",children:[g.isPending?(0,m.jsx)(ie,{size:12,className:"animate-spin"}):(0,m.jsx)(jr,{size:12}),"Deactivate"]})]}),(0,m.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4 mb-6",children:[(0,m.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,m.jsx)("h3",{className:"text-sm font-medium text-slate-300 mb-3",children:"Security Profiles"}),(0,m.jsx)("div",{className:"grid grid-cols-2 gap-2",children:jt.map(({id:a,label:b,description:c,icon:d})=>(0,m.jsxs)("button",{onClick:()=>{f.mutate(a)},disabled:f.isPending,className:`text-left p-3 rounded-lg border transition-colors ${p===a?"border-red-500/50 bg-red-500/10 text-red-400":"border-slate-700 bg-slate-800/50 text-slate-400 hover:border-slate-600"}`,children:[(0,m.jsxs)("div",{className:"flex items-center gap-1.5 mb-1",children:[(0,m.jsx)(d,{size:12}),(0,m.jsx)("span",{className:"text-xs font-medium",children:b})]}),(0,m.jsx)("div",{className:"text-[10px] text-slate-500",children:c})]},a))})]}),(0,m.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,m.jsx)("h3",{className:"text-sm font-medium text-slate-300 mb-3",children:"Module Status"}),(0,m.jsx)("div",{className:"space-y-2",children:ju.map(({name:a,description:b,icon:c})=>(0,m.jsxs)("div",{className:"flex items-center gap-3 px-3 py-2 rounded-lg bg-slate-800/50",children:[(0,m.jsx)(c,{size:14,className:o?"text-red-400":"text-slate-600"}),(0,m.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,m.jsx)("div",{className:"text-xs font-medium text-slate-300",children:a}),(0,m.jsx)("div",{className:"text-[10px] text-slate-500 truncate",children:b})]}),(0,m.jsx)("span",{className:`w-2 h-2 rounded-full ${o?"bg-red-400":"bg-slate-600"}`})]},a))})]})]}),o&&q&&(0,m.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4 mb-6",children:[(0,m.jsx)("h3",{className:"text-sm font-medium text-slate-300 mb-3",children:"Active Configuration"}),(0,m.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 text-xs",children:[(0,m.jsxs)("div",{children:[(0,m.jsx)("div",{className:"text-[10px] text-slate-500 uppercase mb-1",children:"Trusted Channels"}),(0,m.jsx)("div",{className:"flex flex-wrap gap-1",children:q.trustedChannels.map(a=>(0,m.jsx)("span",{className:"px-1.5 py-0.5 bg-slate-800 rounded text-slate-400",children:a},a))})]}),(0,m.jsxs)("div",{children:[(0,m.jsx)("div",{className:"text-[10px] text-slate-500 uppercase mb-1",children:"Requires Approval"}),(0,m.jsx)("div",{className:"flex flex-wrap gap-1",children:q.requireApproval.map(a=>(0,m.jsx)("span",{className:"px-1.5 py-0.5 bg-red-500/10 border border-red-500/20 rounded text-red-400",children:a},a))})]}),(0,m.jsxs)("div",{children:[(0,m.jsx)("div",{className:"text-[10px] text-slate-500 uppercase mb-1",children:"Kill Phrase"}),(0,m.jsx)("span",{className:"px-1.5 py-0.5 bg-slate-800 rounded text-slate-400 font-mono",children:q.killPhrase})]})]})]}),(0,m.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[(0,m.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,m.jsxs)("h3",{className:"text-sm font-medium text-slate-300 mb-3",children:[(0,m.jsx)(js,{size:14,className:"inline mr-1.5 text-red-400"}),"Injection Scanner"]}),(0,m.jsx)("textarea",{value:i,onChange:a=>j(a.target.value),placeholder:"Paste suspicious text to scan for injection patterns...",className:"w-full h-28 bg-slate-800 border border-slate-700 rounded-lg p-3 text-sm text-white placeholder:text-slate-500 resize-none focus:outline-none focus:ring-1 focus:ring-red-500 focus:border-red-500"}),(0,m.jsxs)("button",{onClick:()=>{i.trim()&&h.mutate(i,{onSuccess:a=>l(a)})},disabled:h.isPending||!i.trim(),className:"mt-2 flex items-center gap-1.5 px-3 py-1.5 bg-red-600 hover:bg-red-500 disabled:opacity-50 rounded-lg text-xs font-medium text-white transition-colors",children:[h.isPending?(0,m.jsx)(ie,{size:12,className:"animate-spin"}):(0,m.jsx)(h_,{size:12}),"Scan"]}),k&&(0,m.jsxs)("div",{className:"mt-3 space-y-2",children:[(0,m.jsxs)("div",{className:"flex items-center gap-2",children:[k.clean?(0,m.jsx)(ig,{size:14,className:"text-green-400"}):(0,m.jsx)(ik,{size:14,className:"text-red-400"}),(0,m.jsx)("span",{className:`text-[10px] font-medium px-2 py-0.5 rounded-full ${jw[k.riskLevel]??"bg-slate-500/20 text-slate-400"}`,children:k.riskLevel}),(0,m.jsx)("span",{className:"text-xs text-slate-400",children:k.summary})]}),k.detections.map((a,b)=>(0,m.jsxs)("div",{className:`border rounded-lg p-3 ${jv[a.severity]??"border-slate-700"}`,children:[(0,m.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,m.jsx)("span",{className:"text-[10px] font-medium uppercase",children:a.severity}),(0,m.jsx)("span",{className:"text-xs text-slate-300",children:a.category.replace(/_/g," ")})]}),(0,m.jsx)("p",{className:"text-[11px] text-slate-400 mb-1",children:a.description}),(0,m.jsx)("code",{className:"text-[10px] text-slate-500 bg-slate-800 px-1.5 py-0.5 rounded block truncate",children:a.match})]},b))]})]}),(0,m.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,m.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,m.jsx)("h3",{className:"text-sm font-medium text-slate-300",children:"Event Feed"}),(0,m.jsxs)("span",{className:"text-[10px] text-slate-500",children:["Last ",r.length," events"]})]}),(0,m.jsxs)("div",{className:"grid grid-cols-3 gap-2 mb-3",children:[(0,m.jsxs)("div",{className:"bg-slate-800/50 rounded-lg p-2 text-center",children:[(0,m.jsx)("div",{className:"text-sm font-bold text-slate-300",children:r.length}),(0,m.jsx)("div",{className:"text-[10px] text-slate-500",children:"Total"})]}),(0,m.jsxs)("div",{className:"bg-slate-800/50 rounded-lg p-2 text-center",children:[(0,m.jsx)("div",{className:"text-sm font-bold text-red-400",children:s}),(0,m.jsx)("div",{className:"text-[10px] text-slate-500",children:"Blocked"})]}),(0,m.jsxs)("div",{className:"bg-slate-800/50 rounded-lg p-2 text-center",children:[(0,m.jsx)("div",{className:"text-sm font-bold text-green-400",children:t}),(0,m.jsx)("div",{className:"text-[10px] text-slate-500",children:"Allowed"})]})]}),(0,m.jsx)("div",{className:"space-y-1 max-h-72 overflow-y-auto",children:0===r.length?(0,m.jsxs)("div",{className:"text-center py-6",children:[(0,m.jsx)(hT,{size:20,className:"text-slate-600 mx-auto mb-1.5"}),(0,m.jsx)("p",{className:"text-[10px] text-slate-500",children:"No Iron Dome events yet"})]}):r.map((a,b)=>(0,m.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded-md bg-slate-800/50 text-xs",children:[(0,m.jsx)("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${"BLOCK"===a.firewall_result?"bg-red-400":"bg-green-400"}`}),(0,m.jsx)("span",{className:"text-slate-400 truncate flex-1",children:(a.reason??"").replace(/^\[iron-dome:\w+\]\s*/,"")}),(0,m.jsx)("span",{className:"text-[10px] text-slate-600 shrink-0",children:new Date(a.timestamp).toLocaleTimeString()})]},a.id??b))})]})]})]})}let jy=(0,fx.default)(async()=>{},{loadableGenerated:{modules:[11570]},ssr:!1,loading:()=>(0,m.jsx)("div",{className:"w-full h-full flex items-center justify-center bg-slate-950",children:(0,m.jsx)("div",{className:"text-slate-400 animate-pulse",children:"Loading Graph..."})})}),jz=(0,fx.default)(async()=>{},{loadableGenerated:{modules:[41740]},ssr:!1,loading:()=>(0,m.jsx)("div",{className:"w-full h-full flex items-center justify-center bg-slate-950",children:(0,m.jsx)("div",{className:"text-slate-400 animate-pulse",children:"Loading Brain Control Centre..."})})});function jA(){var a,b;let c,d,e,f,g,h,i,[j,k]=(0,n.useState)(""),[l,o]=(0,n.useState)(!1),[p,q]=(0,n.useState)(!1),[r,s]=(0,n.useState)(void 0),[t,u]=(0,n.useState)(void 0),v=(0,n.useRef)(null),w=(0,n.useRef)(null),x=ge(j,300),{viewMode:y,selectedMemory:z,setSelectedMemory:A,selectedAuditEntry:B,setSelectedAuditEntry:C,projectFilter:D,setProjectFilter:F,addEvent:G}=gd(),{data:H=[]}=fO({queryKey:["suggestions",c=ge(j,200)],queryFn:()=>gg(c),enabled:c.length>=2,staleTime:3e4,refetchOnWindowFocus:!1}),{data:I}=fO({queryKey:["projects"],queryFn:f1,refetchInterval:6e4});(0,n.useEffect)(()=>{let a=a=>{w.current&&!w.current.contains(a.target)&&v.current&&!v.current.contains(a.target)&&o(!1)};return document.addEventListener("mousedown",a),()=>document.removeEventListener("mousedown",a)},[]);let{data:J=[],isLoading:K,isConnected:L,lastEvent:M}=(a={limit:1e3,query:x||void 0,mode:x?"search":"recent",project:D||void 0,type:r,category:t},d=function(a={}){let{enabled:b=!0,onMessage:c}=a,d=(0,fK.useQueryClient)(),e=(0,n.useRef)(null),f=(0,n.useRef)(null),g=(0,n.useRef)(0),h=(0,n.useRef)(1e3),i=(0,n.useRef)(()=>{}),[j,k]=(0,n.useState)(!1),[l,m]=(0,n.useState)(null),o=(0,n.useRef)(c);(0,n.useEffect)(()=>{o.current=c},[c]);let p=(0,n.useCallback)(async()=>{if(b&&e.current?.readyState!==WebSocket.OPEN){f.current&&(clearTimeout(f.current),f.current=null);try{let a=await fW(),c=`${fY}?token=${encodeURIComponent(a)}`,j=new WebSocket(c);e.current=j,j.onopen=()=>{k(!0),g.current=0,h.current=1e3,console.log("[WebSocket] Connected to memory server")},j.onmessage=a=>{try{let b=JSON.parse(a.data);switch(m({type:b.type,data:b.data,timestamp:b.timestamp||new Date().toISOString()}),o.current?.(b),b.type){case"initial_state":case"consolidation_complete":case"predictive_consolidation":d.invalidateQueries({queryKey:["memories"]}),d.invalidateQueries({queryKey:["stats"]}),d.invalidateQueries({queryKey:["links"]});break;case"memory_created":case"memory_updated":case"memory_deleted":d.invalidateQueries({queryKey:["memories"]}),d.invalidateQueries({queryKey:["stats"]});break;case"decay_tick":case"worker_light_tick":case"worker_medium_tick":break;case"link_discovered":d.invalidateQueries({queryKey:["links"]});break;case"defence_event":d.invalidateQueries({queryKey:["agents"]}),d.invalidateQueries({queryKey:["agent-timeline"]}),d.invalidateQueries({queryKey:["audit-logs"]}),d.invalidateQueries({queryKey:["audit-stats"]});break;case"update_started":case"update_complete":case"update_failed":"update_complete"===b.type&&(d.invalidateQueries({queryKey:["version"]}),d.invalidateQueries({queryKey:["version-check"]}));break;case"server_restarting":console.log("[WebSocket] Server restarting, will reconnect shortly...")}}catch(a){console.error("[WebSocket] Failed to parse message:",a)}},j.onerror=()=>{console.warn("[WebSocket] Connection failed - is the API server running?")},j.onclose=()=>{if(k(!1),console.log("[WebSocket] Disconnected"),b&&g.current<10){let a=h.current;g.current++,h.current=Math.min(2*h.current,3e4),console.log(`[WebSocket] Reconnecting in ${a}ms (attempt ${g.current}/10)...`),f.current=setTimeout(()=>{i.current()},a)}else g.current>=10&&console.error("[WebSocket] Max reconnection attempts reached. Use reconnect() to try again.")}}catch(a){console.error("[WebSocket] Failed to connect:",a)}}},[b,d]);return(0,n.useEffect)(()=>{i.current=p}),(0,n.useEffect)(()=>(b&&p(),()=>{f.current&&clearTimeout(f.current),e.current&&(e.current.close(),e.current=null)}),[b,p]),{isConnected:j,lastEvent:l,reconnect:(0,n.useCallback)(()=>{g.current=0,h.current=1e3,p()},[p])}}(),{...{...e=fO({queryKey:["memories",a],queryFn:()=>f$(a),refetchInterval:3e4}),data:e.data?.memories,pagination:e.data?.pagination},isConnected:d.isConnected,lastEvent:d.lastEvent}),{data:N,isLoading:O}=f4(D||void 0),{data:P=[]}=fO({queryKey:["links",b=D||void 0],queryFn:()=>f0(b),refetchInterval:6e4}),Q=(0,n.useRef)(M);(0,n.useEffect)(()=>{!M||M===Q.current||(Q.current=M,new Set(["memory_created","memory_accessed","memory_updated","memory_deleted","consolidation_complete","decay_tick"]).has(M.type)&&G({type:M.type,timestamp:M.timestamp,data:M.data}))},[M,G]);let R=(f=(0,fK.useQueryClient)(),fS({mutationFn:f2,onSuccess:()=>{f.invalidateQueries({queryKey:["memories"]}),f.invalidateQueries({queryKey:["stats"]})}}));g=(0,fK.useQueryClient)(),fS({mutationFn:f3,onSuccess:()=>{g.invalidateQueries({queryKey:["memories"]}),g.invalidateQueries({queryKey:["stats"]})}});let{data:S}=fO({queryKey:["control-status"],queryFn:f5,refetchInterval:1e4});h=(0,fK.useQueryClient)(),fS({mutationFn:f6,onSuccess:()=>{h.invalidateQueries({queryKey:["control-status"]})}}),i=(0,fK.useQueryClient)(),fS({mutationFn:f7,onSuccess:()=>{i.invalidateQueries({queryKey:["control-status"]})}});let T=S?.paused??!1,{data:U}=iE(),V=U?.enabled&&U?.apiKeySet,W=a=>{A(a)},X=a=>{let b=J.find(b=>b.id===a);b&&A(b)},Y="shield"===y||"audit"===y||"quarantine"===y||"agents"===y||"skills"===y||"dome"===y;return(0,m.jsxs)("div",{className:"h-screen w-screen bg-slate-950 text-white overflow-hidden flex flex-col",children:[(0,m.jsxs)("header",{className:"h-14 border-b border-slate-800 flex items-center justify-between px-4 bg-slate-900/50 backdrop-blur-sm shrink-0",children:[(0,m.jsxs)("div",{className:"flex items-center gap-4",children:[(0,m.jsxs)("div",{className:"flex items-center gap-2",children:[(0,m.jsx)(hT,{size:20,className:"text-cyan-400"}),(0,m.jsx)("h1",{className:"text-xl font-bold bg-gradient-to-r from-cyan-400 via-blue-400 to-emerald-400 bg-clip-text text-transparent",children:"ShieldCortex"}),(0,m.jsx)("div",{title:V?"Connected to ShieldCortex Cloud":"Cloud sync not configured",children:(0,m.jsx)(ic,{size:16,className:V?"text-emerald-400":"text-slate-600"})})]}),(0,m.jsx)("select",{value:D||"",onChange:a=>F(a.target.value||null),className:"bg-slate-800 border border-slate-700 text-white text-sm rounded-lg px-3 py-1.5 focus:ring-cyan-500 focus:border-cyan-500",children:I?.projects.map(a=>(0,m.jsxs)("option",{value:a.project||"",children:[a.label," (",a.memory_count,")"]},a.project||"all"))}),(0,m.jsxs)("div",{className:"relative",children:[(0,m.jsx)(ht,{ref:v,type:"text",placeholder:"Search memories...",value:j,onChange:a=>{k(a.target.value),o(!0)},onFocus:()=>o(!0),onKeyDown:a=>{"Escape"===a.key&&o(!1)},className:"w-64 bg-slate-800 border-slate-700 text-white placeholder:text-slate-400 focus:ring-cyan-500"}),l&&H.length>0&&(0,m.jsx)("div",{ref:w,className:"absolute top-full left-0 right-0 mt-1 bg-slate-800 border border-slate-700 rounded-lg shadow-xl overflow-hidden z-50",children:H.map((a,b)=>(0,m.jsxs)("button",{onClick:()=>{k(a.text),o(!1),v.current?.focus()},className:"w-full px-3 py-2 text-left hover:bg-slate-700 transition-colors flex items-center gap-2",children:[(0,m.jsx)("span",{className:"text-white text-sm truncate flex-1",children:a.text}),(0,m.jsx)("span",{className:"text-xs px-1.5 py-0.5 rounded bg-slate-600 text-slate-300",children:a.type})]},`${a.type}-${a.text}-${b}`))})]}),(0,m.jsxs)(hs,{variant:"outline",size:"sm",onClick:()=>q(!p),className:`border-slate-600 text-slate-300 hover:text-white hover:bg-slate-700 ${p?"bg-slate-700":""}`,title:"Filter memories by type and category",children:["Filters ",(r||t)&&"•"]})]}),(0,m.jsx)("div",{className:"flex items-center gap-2",children:(0,m.jsxs)("div",{className:"flex items-center gap-2 text-xs text-slate-400 px-2",children:[(0,m.jsx)("span",{className:`w-2 h-2 rounded-full ${T?"bg-orange-500 animate-pulse":L?"bg-green-500":"bg-yellow-500"}`,title:T?"Memory creation paused":L?"Real-time connected":"Polling mode"}),N?.total??J.length," memories"]})})]}),p&&(0,m.jsxs)("div",{className:"h-12 border-b border-slate-800 flex items-center gap-4 px-4 bg-slate-900/30",children:[(0,m.jsxs)("div",{className:"flex items-center gap-2",children:[(0,m.jsx)("span",{className:"text-xs text-slate-400",children:"Type:"}),["short_term","long_term","episodic"].map(a=>(0,m.jsx)("button",{onClick:()=>s(r===a?void 0:a),className:`px-2 py-1 text-xs rounded-full transition-colors ${r===a?"bg-blue-600 text-white":"bg-slate-800 text-slate-300 hover:bg-slate-700"}`,children:a.replace("_","-")},a))]}),(0,m.jsx)("div",{className:"w-px h-6 bg-slate-700"}),(0,m.jsxs)("div",{className:"flex items-center gap-2",children:[(0,m.jsx)("span",{className:"text-xs text-slate-400",children:"Category:"}),["architecture","pattern","error","learning","preference","context"].map(a=>(0,m.jsx)("button",{onClick:()=>u(t===a?void 0:a),className:`px-2 py-1 text-xs rounded-full transition-colors ${t===a?"bg-purple-600 text-white":"bg-slate-800 text-slate-300 hover:bg-slate-700"}`,children:a},a))]}),(r||t)&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("div",{className:"w-px h-6 bg-slate-700"}),(0,m.jsx)("button",{onClick:()=>{s(void 0),u(void 0)},className:"px-2 py-1 text-xs text-red-400 hover:text-red-300",children:"Clear all"})]})]}),(0,m.jsxs)("div",{className:"flex-1 flex overflow-hidden",children:[(0,m.jsx)(h1,{}),(0,m.jsx)(E,{mode:"wait",children:(0,m.jsxs)(fw.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},className:"flex-1 relative overflow-hidden",children:["shield"===y&&(0,m.jsx)(iH,{}),"audit"===y&&(0,m.jsx)(iJ,{}),"quarantine"===y&&(0,m.jsx)(iS,{}),"brain"===y&&(0,m.jsx)(jz,{memories:J,links:P,stats:N,isLoading:K}),"graph"===y&&(0,m.jsx)(jy,{memories:J,links:P,selectedMemory:z,onSelectMemory:W}),"agents"===y&&(0,m.jsx)(je,{}),"skills"===y&&(0,m.jsx)(jo,{}),"dome"===y&&(0,m.jsx)(jx,{}),"memories"===y&&(0,m.jsx)(hE,{memories:J,selectedMemory:z,onSelectMemory:W})]},y)}),z&&!Y&&"brain"!==y&&(0,m.jsx)("div",{className:"w-80 border-l border-slate-800 overflow-y-auto shrink-0",children:(0,m.jsx)(hA,{memory:z,links:P,memories:J,onClose:()=>A(null),onReinforce:a=>{R.mutate(a)},onSelectMemory:X,isReinforcing:R.isPending,reinforceSuccess:R.isSuccess})}),B&&"audit"===y&&(0,m.jsx)("div",{className:"w-80 border-l border-slate-800 overflow-y-auto shrink-0",children:(0,m.jsx)(iP,{entry:B,onClose:()=>C(null),onViewMemory:a=>{C(null),X(a),gd.getState().setViewMode("memories")}})})]})]})}a.s(["default",()=>jA],86344)}];
|
|
9
|
+
`),()=>{r.contains(q)&&r.removeChild(q)}},[b]),(0,m.jsx)(x,{isPresent:b,childRef:g,sizeRef:h,children:u.cloneElement(a,{ref:j})})}let z=({children:a,initial:b,isPresent:c,onExitComplete:d,custom:e,presenceAffectsLayout:f,mode:g,anchorX:h,anchorY:i,root:j})=>{let k=p(A),l=(0,n.useId)(),o=!0,q=(0,n.useMemo)(()=>(o=!1,{id:l,initial:b,isPresent:c,custom:e,onExitComplete:a=>{for(let b of(k.set(a,!0),k.values()))if(!b)return;d&&d()},register:a=>(k.set(a,!1),()=>k.delete(a))}),[c,k,d]);return f&&o&&(q={...q}),(0,n.useMemo)(()=>{k.forEach((a,b)=>k.set(b,!1))},[c]),n.useEffect(()=>{c||k.size||!d||d()},[c]),"popLayout"===g&&(a=(0,m.jsx)(y,{isPresent:c,anchorX:h,anchorY:i,root:j,children:a})),(0,m.jsx)(r.Provider,{value:q,children:a})};function A(){return new Map}function B(a=!0){let b=(0,n.useContext)(r);if(null===b)return[!0,null];let{isPresent:c,onExitComplete:d,register:e}=b,f=(0,n.useId)();(0,n.useEffect)(()=>{if(a)return e(f)},[a]);let g=(0,n.useCallback)(()=>a&&d&&d(f),[f,d,a]);return!c&&d?[!1,g]:[!0]}let C=a=>a.key||"";function D(a){let b=[];return n.Children.forEach(a,a=>{(0,n.isValidElement)(a)&&b.push(a)}),b}let E=({children:a,custom:b,initial:c=!0,onExitComplete:d,presenceAffectsLayout:e=!0,mode:f="sync",propagate:g=!1,anchorX:h="left",anchorY:i="top",root:j})=>{let[k,l]=B(g),r=(0,n.useMemo)(()=>D(a),[a]),s=g&&!k?[]:r.map(C),t=(0,n.useRef)(!0),u=(0,n.useRef)(r),v=p(()=>new Map),w=(0,n.useRef)(new Set),[x,y]=(0,n.useState)(r),[A,E]=(0,n.useState)(r);q(()=>{t.current=!1,u.current=r;for(let a=0;a<A.length;a++){let b=C(A[a]);s.includes(b)?(v.delete(b),w.current.delete(b)):!0!==v.get(b)&&v.set(b,!1)}},[A,s.length,s.join("-")]);let F=[];if(r!==x){let a=[...r];for(let b=0;b<A.length;b++){let c=A[b],d=C(c);s.includes(d)||(a.splice(b,0,c),F.push(c))}return"wait"===f&&F.length&&(a=F),E(D(a)),y(r),null}let{forceRender:G}=(0,n.useContext)(o);return(0,m.jsx)(m.Fragment,{children:A.map(a=>{let n=C(a),o=(!g||!!k)&&(r===A||s.includes(n));return(0,m.jsx)(z,{isPresent:o,initial:(!t.current||!!c)&&void 0,custom:b,presenceAffectsLayout:e,mode:f,root:j,onExitComplete:o?void 0:()=>{if(w.current.has(n)||(w.current.add(n),!v.has(n)))return;v.set(n,!0);let a=!0;v.forEach(b=>{b||(a=!1)}),a&&(G?.(),E(u.current),g&&l?.(),d&&d())},anchorX:h,anchorY:i,children:a},n)})})},F=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],G=new Set(F),H=(a,b,c)=>c>b?b:c<a?a:c,I={test:a=>"number"==typeof a,parse:parseFloat,transform:a=>a},J={...I,transform:a=>H(0,1,a)},K={...I,default:1},L=a=>Math.round(1e5*a)/1e5,M=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu,N=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,O=(a,b)=>c=>!!("string"==typeof c&&N.test(c)&&c.startsWith(a)||b&&null!=c&&Object.prototype.hasOwnProperty.call(c,b)),P=(a,b,c)=>d=>{if("string"!=typeof d)return d;let[e,f,g,h]=d.match(M);return{[a]:parseFloat(e),[b]:parseFloat(f),[c]:parseFloat(g),alpha:void 0!==h?parseFloat(h):1}},Q={...I,transform:a=>Math.round(H(0,255,a))},R={test:O("rgb","red"),parse:P("red","green","blue"),transform:({red:a,green:b,blue:c,alpha:d=1})=>"rgba("+Q.transform(a)+", "+Q.transform(b)+", "+Q.transform(c)+", "+L(J.transform(d))+")"},S={test:O("#"),parse:function(a){let b="",c="",d="",e="";return a.length>5?(b=a.substring(1,3),c=a.substring(3,5),d=a.substring(5,7),e=a.substring(7,9)):(b=a.substring(1,2),c=a.substring(2,3),d=a.substring(3,4),e=a.substring(4,5),b+=b,c+=c,d+=d,e+=e),{red:parseInt(b,16),green:parseInt(c,16),blue:parseInt(d,16),alpha:e?parseInt(e,16)/255:1}},transform:R.transform},T=a=>({test:b=>"string"==typeof b&&b.endsWith(a)&&1===b.split(" ").length,parse:parseFloat,transform:b=>`${b}${a}`}),U=T("deg"),V=T("%"),W=T("px"),X=T("vh"),Y=T("vw"),Z={...V,parse:a=>V.parse(a)/100,transform:a=>V.transform(100*a)},$={test:O("hsl","hue"),parse:P("hue","saturation","lightness"),transform:({hue:a,saturation:b,lightness:c,alpha:d=1})=>"hsla("+Math.round(a)+", "+V.transform(L(b))+", "+V.transform(L(c))+", "+L(J.transform(d))+")"},_={test:a=>R.test(a)||S.test(a)||$.test(a),parse:a=>R.test(a)?R.parse(a):$.test(a)?$.parse(a):S.parse(a),transform:a=>"string"==typeof a?a:a.hasOwnProperty("red")?R.transform(a):$.transform(a),getAnimatableNone:a=>{let b=_.parse(a);return b.alpha=0,_.transform(b)}},aa=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,ab="number",ac="color",ad=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function ae(a){let b=a.toString(),c=[],d={color:[],number:[],var:[]},e=[],f=0,g=b.replace(ad,a=>(_.test(a)?(d.color.push(f),e.push(ac),c.push(_.parse(a))):a.startsWith("var(")?(d.var.push(f),e.push("var"),c.push(a)):(d.number.push(f),e.push(ab),c.push(parseFloat(a))),++f,"${}")).split("${}");return{values:c,split:g,indexes:d,types:e}}function af(a){return ae(a).values}function ag(a){let{split:b,types:c}=ae(a),d=b.length;return a=>{let e="";for(let f=0;f<d;f++)if(e+=b[f],void 0!==a[f]){let b=c[f];b===ab?e+=L(a[f]):b===ac?e+=_.transform(a[f]):e+=a[f]}return e}}let ah=a=>"number"==typeof a?0:_.test(a)?_.getAnimatableNone(a):a,ai={test:function(a){return isNaN(a)&&"string"==typeof a&&(a.match(M)?.length||0)+(a.match(aa)?.length||0)>0},parse:af,createTransformer:ag,getAnimatableNone:function(a){let b=af(a);return ag(a)(b.map(ah))}},aj=new Set(["brightness","contrast","saturate","opacity"]);function ak(a){let[b,c]=a.slice(0,-1).split("(");if("drop-shadow"===b)return a;let[d]=c.match(M)||[];if(!d)return a;let e=c.replace(d,""),f=+!!aj.has(b);return d!==c&&(f*=100),b+"("+f+e+")"}let al=/\b([a-z-]*)\(.*?\)/gu,am={...ai,getAnimatableNone:a=>{let b=a.match(al);return b?b.map(ak).join(" "):a}},an={...I,transform:Math.round},ao={borderWidth:W,borderTopWidth:W,borderRightWidth:W,borderBottomWidth:W,borderLeftWidth:W,borderRadius:W,borderTopLeftRadius:W,borderTopRightRadius:W,borderBottomRightRadius:W,borderBottomLeftRadius:W,width:W,maxWidth:W,height:W,maxHeight:W,top:W,right:W,bottom:W,left:W,inset:W,insetBlock:W,insetBlockStart:W,insetBlockEnd:W,insetInline:W,insetInlineStart:W,insetInlineEnd:W,padding:W,paddingTop:W,paddingRight:W,paddingBottom:W,paddingLeft:W,paddingBlock:W,paddingBlockStart:W,paddingBlockEnd:W,paddingInline:W,paddingInlineStart:W,paddingInlineEnd:W,margin:W,marginTop:W,marginRight:W,marginBottom:W,marginLeft:W,marginBlock:W,marginBlockStart:W,marginBlockEnd:W,marginInline:W,marginInlineStart:W,marginInlineEnd:W,fontSize:W,backgroundPositionX:W,backgroundPositionY:W,rotate:U,rotateX:U,rotateY:U,rotateZ:U,scale:K,scaleX:K,scaleY:K,scaleZ:K,skew:U,skewX:U,skewY:U,distance:W,translateX:W,translateY:W,translateZ:W,x:W,y:W,z:W,perspective:W,transformPerspective:W,opacity:J,originX:Z,originY:Z,originZ:W,zIndex:an,fillOpacity:J,strokeOpacity:J,numOctaves:an},ap={...ao,color:_,backgroundColor:_,outlineColor:_,fill:_,stroke:_,borderColor:_,borderTopColor:_,borderRightColor:_,borderBottomColor:_,borderLeftColor:_,filter:am,WebkitFilter:am},aq=a=>ap[a],ar=()=>({translate:0,scale:1,origin:0,originPoint:0}),as=()=>({x:ar(),y:ar()}),at=()=>({min:0,max:0}),au=()=>({x:at(),y:at()}),av=a=>!!(a&&a.getVelocity),aw=new Set(["width","height","top","left","right","bottom",...F]),ax=a=>b=>b.test(a),ay=[I,W,V,U,Y,X,{test:a=>"auto"===a,parse:a=>a}],az=a=>ay.find(ax(a)),aA=()=>{},aB=()=>{},aC=a=>b=>"string"==typeof b&&b.startsWith(a),aD=aC("--"),aE=aC("var(--"),aF=a=>!!aE(a)&&aG.test(a.split("/*")[0].trim()),aG=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function aH(a){return"string"==typeof a&&a.split("/*")[0].includes("var(--")}let aI=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u,aJ=a=>180*a/Math.PI,aK=a=>aM(aJ(Math.atan2(a[1],a[0]))),aL={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:a=>(Math.abs(a[0])+Math.abs(a[3]))/2,rotate:aK,rotateZ:aK,skewX:a=>aJ(Math.atan(a[1])),skewY:a=>aJ(Math.atan(a[2])),skew:a=>(Math.abs(a[1])+Math.abs(a[2]))/2},aM=a=>((a%=360)<0&&(a+=360),a),aN=a=>Math.sqrt(a[0]*a[0]+a[1]*a[1]),aO=a=>Math.sqrt(a[4]*a[4]+a[5]*a[5]),aP={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:aN,scaleY:aO,scale:a=>(aN(a)+aO(a))/2,rotateX:a=>aM(aJ(Math.atan2(a[6],a[5]))),rotateY:a=>aM(aJ(Math.atan2(-a[2],a[0]))),rotateZ:aK,rotate:aK,skewX:a=>aJ(Math.atan(a[4])),skewY:a=>aJ(Math.atan(a[1])),skew:a=>(Math.abs(a[1])+Math.abs(a[4]))/2};function aQ(a){return+!!a.includes("scale")}function aR(a,b){let c,d;if(!a||"none"===a)return aQ(b);let e=a.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);if(e)c=aP,d=e;else{let b=a.match(/^matrix\(([-\d.e\s,]+)\)$/u);c=aL,d=b}if(!d)return aQ(b);let f=c[b],g=d[1].split(",").map(aS);return"function"==typeof f?f(g):g[f]}function aS(a){return parseFloat(a.trim())}let aT=a=>a===I||a===W,aU=new Set(["x","y","z"]),aV=F.filter(a=>!aU.has(a)),aW={width:({x:a},{paddingLeft:b="0",paddingRight:c="0"})=>a.max-a.min-parseFloat(b)-parseFloat(c),height:({y:a},{paddingTop:b="0",paddingBottom:c="0"})=>a.max-a.min-parseFloat(b)-parseFloat(c),top:(a,{top:b})=>parseFloat(b),left:(a,{left:b})=>parseFloat(b),bottom:({y:a},{top:b})=>parseFloat(b)+(a.max-a.min),right:({x:a},{left:b})=>parseFloat(b)+(a.max-a.min),x:(a,{transform:b})=>aR(b,"x"),y:(a,{transform:b})=>aR(b,"y")};aW.translateX=aW.x,aW.translateY=aW.y;let aX=a=>a,aY={},aZ=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function a$(a,b){let c=!1,d=!0,e={delta:0,timestamp:0,isProcessing:!1},f=()=>c=!0,g=aZ.reduce((a,c)=>(a[c]=function(a,b){let c=new Set,d=new Set,e=!1,f=!1,g=new WeakSet,h={delta:0,timestamp:0,isProcessing:!1},i=0;function j(b){g.has(b)&&(k.schedule(b),a()),i++,b(h)}let k={schedule:(a,b=!1,f=!1)=>{let h=f&&e?c:d;return b&&g.add(a),h.has(a)||h.add(a),a},cancel:a=>{d.delete(a),g.delete(a)},process:a=>{if(h=a,e){f=!0;return}e=!0,[c,d]=[d,c],c.forEach(j),b,i=0,c.clear(),e=!1,f&&(f=!1,k.process(a))}};return k}(f,b?c:void 0),a),{}),{setup:h,read:i,resolveKeyframes:j,preUpdate:k,update:l,preRender:m,render:n,postRender:o}=g,p=()=>{let f=aY.useManualTiming?e.timestamp:performance.now();c=!1,aY.useManualTiming||(e.delta=d?1e3/60:Math.max(Math.min(f-e.timestamp,40),1)),e.timestamp=f,e.isProcessing=!0,h.process(e),i.process(e),j.process(e),k.process(e),l.process(e),m.process(e),n.process(e),o.process(e),e.isProcessing=!1,c&&b&&(d=!1,a(p))};return{schedule:aZ.reduce((b,f)=>{let h=g[f];return b[f]=(b,f=!1,g=!1)=>(!c&&(c=!0,d=!0,e.isProcessing||a(p)),h.schedule(b,f,g)),b},{}),cancel:a=>{for(let b=0;b<aZ.length;b++)g[aZ[b]].cancel(a)},state:e,steps:g}}let{schedule:a_,cancel:a0,state:a1,steps:a2}=a$("u">typeof requestAnimationFrame?requestAnimationFrame:aX,!0),a3=new Set,a4=!1,a5=!1,a6=!1;function a7(){if(a5){let a=Array.from(a3).filter(a=>a.needsMeasurement),b=new Set(a.map(a=>a.element)),c=new Map;b.forEach(a=>{let b,d=(b=[],aV.forEach(c=>{let d=a.getValue(c);void 0!==d&&(b.push([c,d.get()]),d.set(+!!c.startsWith("scale")))}),b);d.length&&(c.set(a,d),a.render())}),a.forEach(a=>a.measureInitialState()),b.forEach(a=>{a.render();let b=c.get(a);b&&b.forEach(([b,c])=>{a.getValue(b)?.set(c)})}),a.forEach(a=>a.measureEndState()),a.forEach(a=>{void 0!==a.suspendedScrollY&&window.scrollTo(0,a.suspendedScrollY)})}a5=!1,a4=!1,a3.forEach(a=>a.complete(a6)),a3.clear()}function a8(){a3.forEach(a=>{a.readKeyframes(),a.needsMeasurement&&(a5=!0)})}class a9{constructor(a,b,c,d,e,f=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...a],this.onComplete=b,this.name=c,this.motionValue=d,this.element=e,this.isAsync=f}scheduleResolve(){this.state="scheduled",this.isAsync?(a3.add(this),a4||(a4=!0,a_.read(a8),a_.resolveKeyframes(a7))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:a,name:b,element:c,motionValue:d}=this;if(null===a[0]){let e=d?.get(),f=a[a.length-1];if(void 0!==e)a[0]=e;else if(c&&b){let d=c.readValue(b,f);null!=d&&(a[0]=d)}void 0===a[0]&&(a[0]=f),d&&void 0===e&&d.set(a[0])}for(let b=1;b<a.length;b++)a[b]??(a[b]=a[b-1])}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(a=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,a),a3.delete(this)}cancel(){"scheduled"===this.state&&(a3.delete(this),this.state="pending")}resume(){"pending"===this.state&&this.scheduleResolve()}}function ba(a,b){let c=aq(a);return c!==am&&(c=ai),c.getAnimatableNone?c.getAnimatableNone(b):void 0}let bb=new Set(["auto","none","0"]);class bc extends a9{constructor(a,b,c,d,e){super(a,b,c,d,e,!0)}readKeyframes(){let{unresolvedKeyframes:a,element:b,name:c}=this;if(!b||!b.current)return;super.readKeyframes();for(let c=0;c<a.length;c++){let d=a[c];if("string"==typeof d&&aF(d=d.trim())){let e=function a(b,c,d=1){aB(d<=4,`Max CSS variable fallback depth detected in property "${b}". This may indicate a circular fallback dependency.`,"max-css-var-depth");let[e,f]=function(a){let b=aI.exec(a);if(!b)return[,];let[,c,d,e]=b;return[`--${c??d}`,e]}(b);if(!e)return;let g=window.getComputedStyle(c).getPropertyValue(e);if(g){let a=g.trim();return/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(a)?parseFloat(a):a}return aF(f)?a(f,c,d+1):f}(d,b.current);void 0!==e&&(a[c]=e),c===a.length-1&&(this.finalKeyframe=d)}}if(this.resolveNoneKeyframes(),!aw.has(c)||2!==a.length)return;let[d,e]=a,f=az(d),g=az(e);if(aH(d)!==aH(e)&&aW[c]){this.needsMeasurement=!0;return}if(f!==g)if(aT(f)&&aT(g))for(let b=0;b<a.length;b++){let c=a[b];"string"==typeof c&&(a[b]=parseFloat(c))}else aW[c]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){let{unresolvedKeyframes:a,name:b}=this,c=[];for(let b=0;b<a.length;b++)(null===a[b]||function(a){if("number"==typeof a)return 0===a;if(null===a)return!0;return"none"===a||"0"===a||/^0[^.\s]+$/u.test(a)}(a[b]))&&c.push(b);c.length&&function(a,b,c){let d,e=0;for(;e<a.length&&!d;){let b=a[e];"string"==typeof b&&!bb.has(b)&&ae(b).values.length&&(d=a[e]),e++}if(d&&c)for(let e of b)a[e]=ba(c,d)}(a,c,b)}measureInitialState(){let{element:a,unresolvedKeyframes:b,name:c}=this;if(!a||!a.current)return;"height"===c&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=aW[c](a.measureViewportBox(),window.getComputedStyle(a.current)),b[0]=this.measuredOrigin;let d=b[b.length-1];void 0!==d&&a.getValue(c,d).jump(d,!1)}measureEndState(){let{element:a,name:b,unresolvedKeyframes:c}=this;if(!a||!a.current)return;let d=a.getValue(b);d&&d.jump(this.measuredOrigin,!1);let e=c.length-1,f=c[e];c[e]=aW[b](a.measureViewportBox(),window.getComputedStyle(a.current)),null!==f&&void 0===this.finalKeyframe&&(this.finalKeyframe=f),this.removedTransforms?.length&&this.removedTransforms.forEach(([b,c])=>{a.getValue(b).set(c)}),this.resolveNoneKeyframes()}}function bd(a,b){-1===a.indexOf(b)&&a.push(b)}function be(a,b){let c=a.indexOf(b);c>-1&&a.splice(c,1)}class bf{constructor(){this.subscriptions=[]}add(a){return bd(this.subscriptions,a),()=>be(this.subscriptions,a)}notify(a,b,c){let d=this.subscriptions.length;if(d)if(1===d)this.subscriptions[0](a,b,c);else for(let e=0;e<d;e++){let d=this.subscriptions[e];d&&d(a,b,c)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}let{schedule:bg}=a$(queueMicrotask,!1);function bh(){b=void 0}let bi={now:()=>(void 0===b&&bi.set(a1.isProcessing||aY.useManualTiming?a1.timestamp:performance.now()),b),set:a=>{b=a,queueMicrotask(bh)}};class bj{constructor(a,b={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=a=>{let b=bi.now();if(this.updatedAt!==b&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(a),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(let a of this.dependents)a.dirty()},this.hasAnimated=!1,this.setCurrent(a),this.owner=b.owner}setCurrent(a){this.current=a,this.updatedAt=bi.now(),null===this.canTrackVelocity&&void 0!==a&&(this.canTrackVelocity=!isNaN(parseFloat(this.current)))}setPrevFrameValue(a=this.current){this.prevFrameValue=a,this.prevUpdatedAt=this.updatedAt}onChange(a){return this.on("change",a)}on(a,b){this.events[a]||(this.events[a]=new bf);let c=this.events[a].add(b);return"change"===a?()=>{c(),a_.read(()=>{this.events.change.getSize()||this.stop()})}:c}clearListeners(){for(let a in this.events)this.events[a].clear()}attach(a,b){this.passiveEffect=a,this.stopPassiveEffect=b}set(a){this.passiveEffect?this.passiveEffect(a,this.updateAndNotify):this.updateAndNotify(a)}setWithVelocity(a,b,c){this.set(b),this.prev=void 0,this.prevFrameValue=a,this.prevUpdatedAt=this.updatedAt-c}jump(a,b=!0){this.updateAndNotify(a),this.prev=a,this.prevUpdatedAt=this.prevFrameValue=void 0,b&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(a){this.dependents||(this.dependents=new Set),this.dependents.add(a)}removeDependent(a){this.dependents&&this.dependents.delete(a)}get(){return j&&j.push(this),this.current}getPrevious(){return this.prev}getVelocity(){var a;let b=bi.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||b-this.updatedAt>30)return 0;let c=Math.min(this.updatedAt-this.prevUpdatedAt,30);return a=parseFloat(this.current)-parseFloat(this.prevFrameValue),c?1e3/c*a:0}start(a){return this.stop(),new Promise(b=>{this.hasAnimated=!0,this.animation=a(b),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function bk(a,b){return new bj(a,b)}let bl=[...ay,_,ai],bm={current:!1},bn=new WeakMap;function bo(a){return null!==a&&"object"==typeof a&&"function"==typeof a.start}function bp(a){return"string"==typeof a||Array.isArray(a)}let bq=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],br=["initial",...bq];function bs(a){return bo(a.animate)||br.some(b=>bp(a[b]))}function bt(a){return!!(bs(a)||a.variants)}function bu(a){let b=[{},{}];return a?.values.forEach((a,c)=>{b[0][c]=a.get(),b[1][c]=a.getVelocity()}),b}function bv(a,b,c,d){if("function"==typeof b){let[e,f]=bu(d);b=b(void 0!==c?c:a.custom,e,f)}if("string"==typeof b&&(b=a.variants&&a.variants[b]),"function"==typeof b){let[e,f]=bu(d);b=b(void 0!==c?c:a.custom,e,f)}return b}let bw=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],bx={};class by{scrapeMotionValuesFromProps(a,b,c){return{}}constructor({parent:a,props:b,presenceContext:c,reducedMotionConfig:d,blockInitialAnimation:e,visualState:f},g={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=a9,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{let a=bi.now();this.renderScheduledAt<a&&(this.renderScheduledAt=a,a_.render(this.render,!1,!0))};const{latestValues:h,renderState:i}=f;this.latestValues=h,this.baseTarget={...h},this.initialValues=b.initial?{...h}:{},this.renderState=i,this.parent=a,this.props=b,this.presenceContext=c,this.depth=a?a.depth+1:0,this.reducedMotionConfig=d,this.options=g,this.blockInitialAnimation=!!e,this.isControllingVariants=bs(b),this.isVariantNode=bt(b),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(a&&a.current);const{willChange:j,...k}=this.scrapeMotionValuesFromProps(b,{},this);for(const a in k){const b=k[a];void 0!==h[a]&&av(b)&&b.set(h[a])}}mount(a){this.current=a,bn.set(a,this),this.projection&&!this.projection.instance&&this.projection.mount(a),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((a,b)=>this.bindToMotionValue(b,a)),"never"===this.reducedMotionConfig?this.shouldReduceMotion=!1:"always"===this.reducedMotionConfig?this.shouldReduceMotion=!0:(bm.current||(bm.current=!0),this.shouldReduceMotion=null),this.parent?.addChild(this),this.update(this.props,this.presenceContext)}unmount(){for(let a in this.projection&&this.projection.unmount(),a0(this.notifyUpdate),a0(this.render),this.valueSubscriptions.forEach(a=>a()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this),this.events)this.events[a].clear();for(let a in this.features){let b=this.features[a];b&&(b.unmount(),b.isMounted=!1)}this.current=null}addChild(a){this.children.add(a),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(a)}removeChild(a){this.children.delete(a),this.enteringChildren&&this.enteringChildren.delete(a)}bindToMotionValue(a,b){let c;this.valueSubscriptions.has(a)&&this.valueSubscriptions.get(a)();let d=G.has(a);d&&this.onBindTransform&&this.onBindTransform();let e=b.on("change",b=>{this.latestValues[a]=b,this.props.onUpdate&&a_.preRender(this.notifyUpdate),d&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});this.valueSubscriptions.set(a,()=>{e(),c&&c(),b.owner&&b.stop()})}sortNodePosition(a){return this.current&&this.sortInstanceNodePosition&&this.type===a.type?this.sortInstanceNodePosition(this.current,a.current):0}updateFeatures(){let a="animation";for(a in bx){let b=bx[a];if(!b)continue;let{isEnabled:c,Feature:d}=b;if(!this.features[a]&&d&&c(this.props)&&(this.features[a]=new d(this)),this.features[a]){let b=this.features[a];b.isMounted?b.update():(b.mount(),b.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):au()}getStaticValue(a){return this.latestValues[a]}setStaticValue(a,b){this.latestValues[a]=b}update(a,b){(a.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=a,this.prevPresenceContext=this.presenceContext,this.presenceContext=b;for(let b=0;b<bw.length;b++){let c=bw[b];this.propEventSubscriptions[c]&&(this.propEventSubscriptions[c](),delete this.propEventSubscriptions[c]);let d=a["on"+c];d&&(this.propEventSubscriptions[c]=this.on(c,d))}this.prevMotionValues=function(a,b,c){for(let d in b){let e=b[d],f=c[d];if(av(e))a.addValue(d,e);else if(av(f))a.addValue(d,bk(e,{owner:a}));else if(f!==e)if(a.hasValue(d)){let b=a.getValue(d);!0===b.liveStyle?b.jump(e):b.hasAnimated||b.set(e)}else{let b=a.getStaticValue(d);a.addValue(d,bk(void 0!==b?b:e,{owner:a}))}}for(let d in c)void 0===b[d]&&a.removeValue(d);return b}(this,this.scrapeMotionValuesFromProps(a,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(a){return this.props.variants?this.props.variants[a]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(a){let b=this.getClosestVariantNode();if(b)return b.variantChildren&&b.variantChildren.add(a),()=>b.variantChildren.delete(a)}addValue(a,b){let c=this.values.get(a);b!==c&&(c&&this.removeValue(a),this.bindToMotionValue(a,b),this.values.set(a,b),this.latestValues[a]=b.get())}removeValue(a){this.values.delete(a);let b=this.valueSubscriptions.get(a);b&&(b(),this.valueSubscriptions.delete(a)),delete this.latestValues[a],this.removeValueFromRenderState(a,this.renderState)}hasValue(a){return this.values.has(a)}getValue(a,b){if(this.props.values&&this.props.values[a])return this.props.values[a];let c=this.values.get(a);return void 0===c&&void 0!==b&&(c=bk(null===b?void 0:b,{owner:this}),this.addValue(a,c)),c}readValue(a,b){let c=void 0===this.latestValues[a]&&this.current?this.getBaseTargetFromProps(this.props,a)??this.readValueFromInstance(this.current,a,this.options):this.latestValues[a];if(null!=c){let d,e;if("string"==typeof c&&(d=c,/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(d)||(e=c,/^0[^.\s]+$/u.test(e))))c=parseFloat(c);else{let d;d=c,!bl.find(ax(d))&&ai.test(b)&&(c=ba(a,b))}this.setBaseTarget(a,av(c)?c.get():c)}return av(c)?c.get():c}setBaseTarget(a,b){this.baseTarget[a]=b}getBaseTarget(a){let b,{initial:c}=this.props;if("string"==typeof c||"object"==typeof c){let d=bv(this.props,c,this.presenceContext?.custom);d&&(b=d[a])}if(c&&void 0!==b)return b;let d=this.getBaseTargetFromProps(this.props,a);return void 0===d||av(d)?void 0!==this.initialValues[a]&&void 0===b?void 0:this.baseTarget[a]:d}on(a,b){return this.events[a]||(this.events[a]=new bf),this.events[a].add(b)}notify(a,...b){this.events[a]&&this.events[a].notify(...b)}scheduleRenderMicrotask(){bg.render(this.render)}}class bz extends by{constructor(){super(...arguments),this.KeyframeResolver=bc}sortInstanceNodePosition(a,b){return 2&a.compareDocumentPosition(b)?1:-1}getBaseTargetFromProps(a,b){let c=a.style;return c?c[b]:void 0}removeValueFromRenderState(a,{vars:b,style:c}){delete b[a],delete c[a]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);let{children:a}=this.props;av(a)&&(this.childSubscription=a.on("change",a=>{this.current&&(this.current.textContent=`${a}`)}))}}function bA(a){return a.replace(/([A-Z])/g,a=>`-${a.toLowerCase()}`)}let bB=(a,b)=>b&&"number"==typeof a?b.transform(a):a,bC={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},bD=F.length;function bE(a,b,c){let{style:d,vars:e,transformOrigin:f}=a,g=!1,h=!1;for(let a in b){let c=b[a];if(G.has(a)){g=!0;continue}if(aD(a)){e[a]=c;continue}{let b=bB(c,ao[a]);a.startsWith("origin")?(h=!0,f[a]=b):d[a]=b}}if(!b.transform&&(g||c?d.transform=function(a,b,c){let d="",e=!0;for(let f=0;f<bD;f++){let g=F[f],h=a[g];if(void 0===h)continue;let i=!0;if("number"==typeof h)i=h===+!!g.startsWith("scale");else{let a=parseFloat(h);i=g.startsWith("scale")?1===a:0===a}if(!i||c){let a=bB(h,ao[g]);if(!i){e=!1;let b=bC[g]||g;d+=`${b}(${a}) `}c&&(b[g]=a)}}return d=d.trim(),c?d=c(b,e?"":d):e&&(d="none"),d}(b,a.transform,c):d.transform&&(d.transform="none")),h){let{originX:a="50%",originY:b="50%",originZ:c=0}=f;d.transformOrigin=`${a} ${b} ${c}`}}let bF={offset:"stroke-dashoffset",array:"stroke-dasharray"},bG={offset:"strokeDashoffset",array:"strokeDasharray"},bH=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function bI(a,{attrX:b,attrY:c,attrScale:d,pathLength:e,pathSpacing:f=1,pathOffset:g=0,...h},i,j,k){if(bE(a,h,j),i){a.style.viewBox&&(a.attrs.viewBox=a.style.viewBox);return}a.attrs=a.style,a.style={};let{attrs:l,style:m}=a;for(let a of(l.transform&&(m.transform=l.transform,delete l.transform),(m.transform||l.transformOrigin)&&(m.transformOrigin=l.transformOrigin??"50% 50%",delete l.transformOrigin),m.transform&&(m.transformBox=k?.transformBox??"fill-box",delete l.transformBox),bH))void 0!==l[a]&&(m[a]=l[a],delete l[a]);void 0!==b&&(l.x=b),void 0!==c&&(l.y=c),void 0!==d&&(l.scale=d),void 0!==e&&function(a,b,c=1,d=0,e=!0){a.pathLength=1;let f=e?bF:bG;a[f.offset]=`${-d}`,a[f.array]=`${b} ${c}`}(l,e,f,g,!1)}let bJ=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),bK=a=>"string"==typeof a&&"svg"===a.toLowerCase();function bL(a,{style:b,vars:c},d,e){let f,g=a.style;for(f in b)g[f]=b[f];for(f in e?.applyProjectionStyles(g,d),c)g.setProperty(f,c[f])}function bM(a,b){return b.max===b.min?0:a/(b.max-b.min)*100}let bN={correct:(a,b)=>{if(!b.target)return a;if("string"==typeof a)if(!W.test(a))return a;else a=parseFloat(a);let c=bM(a,b.target.x),d=bM(a,b.target.y);return`${c}% ${d}%`}},bO=(a,b,c)=>a+(b-a)*c,bP={borderRadius:{...bN,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:bN,borderTopRightRadius:bN,borderBottomLeftRadius:bN,borderBottomRightRadius:bN,boxShadow:{correct:(a,{treeScale:b,projectionDelta:c})=>{let d=ai.parse(a);if(d.length>5)return a;let e=ai.createTransformer(a),f=+("number"!=typeof d[0]),g=c.x.scale*b.x,h=c.y.scale*b.y;d[0+f]/=g,d[1+f]/=h;let i=bO(g,h,.5);return"number"==typeof d[2+f]&&(d[2+f]/=i),"number"==typeof d[3+f]&&(d[3+f]/=i),e(d)}}};function bQ(a,{layout:b,layoutId:c}){return G.has(a)||a.startsWith("origin")||(b||void 0!==c)&&(!!bP[a]||"opacity"===a)}function bR(a,b,c){let d=a.style,e=b?.style,f={};if(!d)return f;for(let b in d)(av(d[b])||e&&av(e[b])||bQ(b,a)||c?.getValue(b)?.liveStyle!==void 0)&&(f[b]=d[b]);return f}function bS(a,b,c){let d=bR(a,b,c);for(let c in a)(av(a[c])||av(b[c]))&&(d[-1!==F.indexOf(c)?"attr"+c.charAt(0).toUpperCase()+c.substring(1):c]=a[c]);return d}class bT extends bz{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=au}getBaseTargetFromProps(a,b){return a[b]}readValueFromInstance(a,b){if(G.has(b)){let a=aq(b);return a&&a.default||0}return b=bJ.has(b)?b:bA(b),a.getAttribute(b)}scrapeMotionValuesFromProps(a,b,c){return bS(a,b,c)}build(a,b,c){bI(a,b,this.isSVGTag,c.transformTemplate,c.style)}renderInstance(a,b,c,d){for(let c in bL(a,b,void 0,d),b.attrs)a.setAttribute(bJ.has(c)?c:bA(c),b.attrs[c])}mount(a){this.isSVGTag=bK(a.tagName),super.mount(a)}}function bU({top:a,left:b,right:c,bottom:d}){return{x:{min:b,max:c},y:{min:a,max:d}}}function bV(a){return void 0===a||1===a}function bW({scale:a,scaleX:b,scaleY:c}){return!bV(a)||!bV(b)||!bV(c)}function bX(a){return bW(a)||bY(a)||a.z||a.rotate||a.rotateX||a.rotateY||a.skewX||a.skewY}function bY(a){var b,c;return(b=a.x)&&"0%"!==b||(c=a.y)&&"0%"!==c}function bZ(a,b,c,d,e){return void 0!==e&&(a=d+e*(a-d)),d+c*(a-d)+b}function b$(a,b=0,c=1,d,e){a.min=bZ(a.min,b,c,d,e),a.max=bZ(a.max,b,c,d,e)}function b_(a,{x:b,y:c}){b$(a.x,b.translate,b.scale,b.originPoint),b$(a.y,c.translate,c.scale,c.originPoint)}function b0(a,b){a.min=a.min+b,a.max=a.max+b}function b1(a,b,c,d,e=.5){let f=bO(a.min,a.max,e);b$(a,b,c,f,d)}function b2(a,b){b1(a.x,b.x,b.scaleX,b.scale,b.originX),b1(a.y,b.y,b.scaleY,b.scale,b.originY)}function b3(a,b){return bU(function(a,b){if(!b)return a;let c=b({x:a.left,y:a.top}),d=b({x:a.right,y:a.bottom});return{top:c.y,left:c.x,bottom:d.y,right:d.x}}(a.getBoundingClientRect(),b))}class b4 extends bz{constructor(){super(...arguments),this.type="html",this.renderInstance=bL}readValueFromInstance(a,b){if(G.has(b))return this.projection?.isProjecting?aQ(b):((a,b)=>{let{transform:c="none"}=getComputedStyle(a);return aR(c,b)})(a,b);{let c=window.getComputedStyle(a),d=(aD(b)?c.getPropertyValue(b):c[b])||0;return"string"==typeof d?d.trim():d}}measureInstanceViewportBox(a,{transformPagePoint:b}){return b3(a,b)}build(a,b,c){bE(a,b,c.transformTemplate)}scrapeMotionValuesFromProps(a,b,c){return bR(a,b,c)}}let b5=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function b6(a){if("string"!=typeof a||a.includes("-"));else if(b5.indexOf(a)>-1||/[A-Z]/u.test(a))return!0;return!1}(0,n.createContext)({strict:!1});let b7=(0,n.createContext)({});function b8(a){return Array.isArray(a)?a.join(" "):a}let b9=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function ca(a,b,c){for(let d in b)av(b[d])||bQ(d,c)||(a[d]=b[d])}let cb=()=>({...b9(),attrs:{}}),cc=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function cd(a){return a.startsWith("while")||a.startsWith("drag")&&"draggable"!==a||a.startsWith("layout")||a.startsWith("onTap")||a.startsWith("onPan")||a.startsWith("onLayout")||cc.has(a)}let ce=a=>!cd(a);try{l=(()=>{let a=Error("Cannot find module '@emotion/is-prop-valid'");throw a.code="MODULE_NOT_FOUND",a})().default,"function"==typeof l&&(ce=a=>a.startsWith("on")?!cd(a):l(a))}catch{}function cf(a){return av(a)?a.get():a}let cg=a=>(b,c)=>{let d=(0,n.useContext)(b7),e=(0,n.useContext)(r),f=()=>(function({scrapeMotionValuesFromProps:a,createRenderState:b},c,d,e){return{latestValues:function(a,b,c,d){let e={},f=d(a,{});for(let a in f)e[a]=cf(f[a]);let{initial:g,animate:h}=a,i=bs(a),j=bt(a);b&&j&&!i&&!1!==a.inherit&&(void 0===g&&(g=b.initial),void 0===h&&(h=b.animate));let k=!!c&&!1===c.initial,l=(k=k||!1===g)?h:g;if(l&&"boolean"!=typeof l&&!bo(l)){let b=Array.isArray(l)?l:[l];for(let c=0;c<b.length;c++){let d=bv(a,b[c]);if(d){let{transitionEnd:a,transition:b,...c}=d;for(let a in c){let b=c[a];if(Array.isArray(b)){let a=k?b.length-1:0;b=b[a]}null!==b&&(e[a]=b)}for(let b in a)e[b]=a[b]}}}return e}(c,d,e,a),renderState:b()}})(a,b,d,e);return c?f():p(f)},ch=cg({scrapeMotionValuesFromProps:bR,createRenderState:b9}),ci=cg({scrapeMotionValuesFromProps:bS,createRenderState:cb}),cj={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},ck=!1,cl=Symbol.for("motionComponentSymbol"),cm="data-"+bA("framerAppearId"),cn=(0,n.createContext)({});function co(a){return a&&"object"==typeof a&&Object.prototype.hasOwnProperty.call(a,"current")}function cp(a,{forwardMotionProps:b=!1,type:c}={},d,e){d&&function(a){let b=(!function(){if(ck)return;let a={};for(let b in cj)a[b]={isEnabled:a=>cj[b].some(b=>!!a[b])};bx=a,ck=!0}(),bx);for(let c in a)b[c]={...b[c],...a[c]};bx=b}(d);let f=c?"svg"===c:b6(a),g=f?ci:ch;function h(c,d){var e;let h,i,j,k={...(0,n.useContext)(v),...c,layoutId:function({layoutId:a}){let b=(0,n.useContext)(o).id;return b&&void 0!==a?b+"-"+a:a}(c)},{isStatic:l}=k,p=function(a){let{initial:b,animate:c}=function(a,b){if(bs(a)){let{initial:b,animate:c}=a;return{initial:!1===b||bp(b)?b:void 0,animate:bp(c)?c:void 0}}return!1!==a.inherit?b:{}}(a,(0,n.useContext)(b7));return(0,n.useMemo)(()=>({initial:b,animate:c}),[b8(b),b8(c)])}(c),q=g(c,l);return(0,m.jsxs)(b7.Provider,{value:p,children:[h&&p.visualElement?(0,m.jsx)(h,{visualElement:p.visualElement,...k}):null,function(a,b,c,{latestValues:d},e,f=!1,g){let h=(g??b6(a)?function(a,b,c,d){let e=(0,n.useMemo)(()=>{let c=cb();return bI(c,b,bK(d),a.transformTemplate,a.style),{...c.attrs,style:{...c.style}}},[b]);if(a.style){let b={};ca(b,a.style,a),e.style={...b,...e.style}}return e}:function(a,b){let c,d,e={},f=(c=a.style||{},ca(d={},c,a),Object.assign(d,function({transformTemplate:a},b){return(0,n.useMemo)(()=>{let c=b9();return bE(c,b,a),Object.assign({},c.vars,c.style)},[b])}(a,b)),d);return a.drag&&!1!==a.dragListener&&(e.draggable=!1,f.userSelect=f.WebkitUserSelect=f.WebkitTouchCallout="none",f.touchAction=!0===a.drag?"none":`pan-${"x"===a.drag?"y":"x"}`),void 0===a.tabIndex&&(a.onTap||a.onTapStart||a.whileTap)&&(e.tabIndex=0),e.style=f,e})(b,d,e,a),i=function(a,b,c){let d={};for(let e in a)("values"!==e||"object"!=typeof a.values)&&(ce(e)||!0===c&&cd(e)||!b&&!cd(e)||a.draggable&&e.startsWith("onDrag"))&&(d[e]=a[e]);return d}(b,"string"==typeof a,f),j=a!==n.Fragment?{...i,...h,ref:c}:{},{children:k}=b,l=(0,n.useMemo)(()=>av(k)?k.get():k,[k]);return(0,n.createElement)(a,{...j,children:l})}(a,c,(e=p.visualElement,i=(0,n.useRef)(d),(0,n.useInsertionEffect)(()=>{i.current=d}),j=(0,n.useRef)(null),(0,n.useCallback)(a=>{a&&q.onMount?.(a),e&&(a?e.mount(a):e.unmount());let b=i.current;if("function"==typeof b)if(a){let c=b(a);"function"==typeof c&&(j.current=c)}else j.current?(j.current(),j.current=null):b(a);else b&&(b.current=a)},[e])),q,l,b,f)]})}h.displayName=`motion.${"string"==typeof a?a:`create(${a.displayName??a.name??""})`}`;let i=(0,n.forwardRef)(h);return i[cl]=a,i}class cq{constructor(a){this.isMounted=!1,this.node=a}update(){}}function cr(a,b,c){let d=a.getProps();return bv(d,b,void 0!==c?c:d.custom,a)}function cs(a,b){return a?.[b]??a?.default??a}let ct=a=>Array.isArray(a);function cu(a,b){let c=a.getValue("willChange");if(av(c)&&c.add)return c.add(b);if(!c&&aY.WillChange){let c=new aY.WillChange("auto");a.addValue("willChange",c),c.add(b)}}let cv=a=>1e3*a,cw=(a,b)=>c=>b(a(c)),cx=(...a)=>a.reduce(cw),cy={layout:0,mainThread:0,waapi:0};function cz(a,b,c){return(c<0&&(c+=1),c>1&&(c-=1),c<1/6)?a+(b-a)*6*c:c<.5?b:c<2/3?a+(b-a)*(2/3-c)*6:a}function cA(a,b){return c=>c>0?b:a}let cB=(a,b,c)=>{let d=a*a,e=c*(b*b-d)+d;return e<0?0:Math.sqrt(e)},cC=[S,R,$];function cD(a){let b=cC.find(b=>b.test(a));if(aA(!!b,`'${a}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!b)return!1;let c=b.parse(a);return b===$&&(c=function({hue:a,saturation:b,lightness:c,alpha:d}){a/=360,c/=100;let e=0,f=0,g=0;if(b/=100){let d=c<.5?c*(1+b):c+b-c*b,h=2*c-d;e=cz(h,d,a+1/3),f=cz(h,d,a),g=cz(h,d,a-1/3)}else e=f=g=c;return{red:Math.round(255*e),green:Math.round(255*f),blue:Math.round(255*g),alpha:d}}(c)),c}let cE=(a,b)=>{let c=cD(a),d=cD(b);if(!c||!d)return cA(a,b);let e={...c};return a=>(e.red=cB(c.red,d.red,a),e.green=cB(c.green,d.green,a),e.blue=cB(c.blue,d.blue,a),e.alpha=bO(c.alpha,d.alpha,a),R.transform(e))},cF=new Set(["none","hidden"]);function cG(a,b){return c=>bO(a,b,c)}function cH(a){return"number"==typeof a?cG:"string"==typeof a?aF(a)?cA:_.test(a)?cE:cK:Array.isArray(a)?cI:"object"==typeof a?_.test(a)?cE:cJ:cA}function cI(a,b){let c=[...a],d=c.length,e=a.map((a,c)=>cH(a)(a,b[c]));return a=>{for(let b=0;b<d;b++)c[b]=e[b](a);return c}}function cJ(a,b){let c={...a,...b},d={};for(let e in c)void 0!==a[e]&&void 0!==b[e]&&(d[e]=cH(a[e])(a[e],b[e]));return a=>{for(let b in d)c[b]=d[b](a);return c}}let cK=(a,b)=>{let c=ai.createTransformer(b),d=ae(a),e=ae(b);if(!(d.indexes.var.length===e.indexes.var.length&&d.indexes.color.length===e.indexes.color.length&&d.indexes.number.length>=e.indexes.number.length))return aA(!0,`Complex values '${a}' and '${b}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,"complex-values-different"),cA(a,b);if(cF.has(a)&&!e.values.length||cF.has(b)&&!d.values.length)return cF.has(a)?c=>c<=0?a:b:c=>c>=1?b:a;return cx(cI(function(a,b){let c=[],d={color:0,var:0,number:0};for(let e=0;e<b.values.length;e++){let f=b.types[e],g=a.indexes[f][d[f]],h=a.values[g]??0;c[e]=h,d[f]++}return c}(d,e),e.values),c)};function cL(a,b,c){return"number"==typeof a&&"number"==typeof b&&"number"==typeof c?bO(a,b,c):cH(a)(a,b)}let cM=a=>{let b=({timestamp:b})=>a(b);return{start:(a=!0)=>a_.update(b,a),stop:()=>a0(b),now:()=>a1.isProcessing?a1.timestamp:bi.now()}},cN=(a,b,c=10)=>{let d="",e=Math.max(Math.round(b/c),2);for(let b=0;b<e;b++)d+=Math.round(1e4*a(b/(e-1)))/1e4+", ";return`linear(${d.substring(0,d.length-2)})`};function cO(a){let b=0,c=a.next(b);for(;!c.done&&b<2e4;)b+=50,c=a.next(b);return b>=2e4?1/0:b}function cP(a,b,c){var d,e;let f=Math.max(b-5,0);return d=c-a(f),(e=b-f)?1e3/e*d:0}let cQ=.01,cR=2,cS=.005,cT=.5;function cU(a,b){return a*Math.sqrt(1-b*b)}let cV=["duration","bounce"],cW=["stiffness","damping","mass"];function cX(a,b){return b.some(b=>void 0!==a[b])}function cY(a=.3,b=.3){let c,d="object"!=typeof a?{visualDuration:a,keyframes:[0,1],bounce:b}:a,{restSpeed:e,restDelta:f}=d,g=d.keyframes[0],h=d.keyframes[d.keyframes.length-1],i={done:!1,value:g},{stiffness:j,damping:k,mass:l,duration:m,velocity:n,isResolvedFromDuration:o}=function(a){let b={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...a};if(!cX(a,cW)&&cX(a,cV))if(a.visualDuration){let c=2*Math.PI/(1.2*a.visualDuration),d=c*c,e=2*H(.05,1,1-(a.bounce||0))*Math.sqrt(d);b={...b,mass:1,stiffness:d,damping:e}}else{let c=function({duration:a=800,bounce:b=.3,velocity:c=0,mass:d=1}){let e,f;aA(a<=cv(10),"Spring duration must be 10 seconds or less","spring-duration-limit");let g=1-b;g=H(.05,1,g),a=H(.01,10,a/1e3),g<1?(e=b=>{let d=b*g,e=d*a;return .001-(d-c)/cU(b,g)*Math.exp(-e)},f=b=>{let d=b*g*a,f=Math.pow(g,2)*Math.pow(b,2)*a,h=Math.exp(-d),i=cU(Math.pow(b,2),g);return(d*c+c-f)*h*(-e(b)+.001>0?-1:1)/i}):(e=b=>-.001+Math.exp(-b*a)*((b-c)*a+1),f=b=>a*a*(c-b)*Math.exp(-b*a));let h=function(a,b,c){let d=c;for(let c=1;c<12;c++)d-=a(d)/b(d);return d}(e,f,5/a);if(a=cv(a),isNaN(h))return{stiffness:100,damping:10,duration:a};{let b=Math.pow(h,2)*d;return{stiffness:b,damping:2*g*Math.sqrt(d*b),duration:a}}}(a);(b={...b,...c,mass:1}).isResolvedFromDuration=!0}return b}({...d,velocity:-((d.velocity||0)/1e3)}),p=n||0,q=k/(2*Math.sqrt(j*l)),r=h-g,s=Math.sqrt(j/l)/1e3,t=5>Math.abs(r);if(e||(e=t?cQ:cR),f||(f=t?cS:cT),q<1){let a=cU(s,q);c=b=>h-Math.exp(-q*s*b)*((p+q*s*r)/a*Math.sin(a*b)+r*Math.cos(a*b))}else if(1===q)c=a=>h-Math.exp(-s*a)*(r+(p+s*r)*a);else{let a=s*Math.sqrt(q*q-1);c=b=>{let c=Math.exp(-q*s*b),d=Math.min(a*b,300);return h-c*((p+q*s*r)*Math.sinh(d)+a*r*Math.cosh(d))/a}}let u={calculatedDuration:o&&m||null,next:a=>{let b=c(a);if(o)i.done=a>=m;else{let d=0===a?p:0;q<1&&(d=0===a?cv(p):cP(c,a,b));let g=Math.abs(h-b)<=f;i.done=Math.abs(d)<=e&&g}return i.value=i.done?h:b,i},toString:()=>{let a=Math.min(cO(u),2e4),b=cN(b=>u.next(a*b).value,a,30);return a+"ms "+b},toTransition:()=>{}};return u}function cZ({keyframes:a,velocity:b=0,power:c=.8,timeConstant:d=325,bounceDamping:e=10,bounceStiffness:f=500,modifyTarget:g,min:h,max:i,restDelta:j=.5,restSpeed:k}){let l,m,n=a[0],o={done:!1,value:n},p=c*b,q=n+p,r=void 0===g?q:g(q);r!==q&&(p=r-n);let s=a=>-p*Math.exp(-a/d),t=a=>r+s(a),u=a=>{let b=s(a),c=t(a);o.done=Math.abs(b)<=j,o.value=o.done?r:c},v=a=>{let b;if(b=o.value,void 0!==h&&b<h||void 0!==i&&b>i){var c;l=a,m=cY({keyframes:[o.value,(c=o.value,void 0===h?i:void 0===i||Math.abs(h-c)<Math.abs(i-c)?h:i)],velocity:cP(t,a,o.value),damping:e,stiffness:f,restDelta:j,restSpeed:k})}};return v(0),{calculatedDuration:null,next:a=>{let b=!1;return(m||void 0!==l||(b=!0,u(a),v(a)),void 0!==l&&a>=l)?m.next(a-l):(b||u(a),o)}}}cY.applyToOptions=a=>{let b=function(a,b=100,c){let d=c({...a,keyframes:[0,b]}),e=Math.min(cO(d),2e4);return{type:"keyframes",ease:a=>d.next(e*a).value/b,duration:e/1e3}}(a,100,cY);return a.ease=b.ease,a.duration=cv(b.duration),a.type="keyframes",a};let c$=(a,b,c)=>(((1-3*c+3*b)*a+(3*c-6*b))*a+3*b)*a;function c_(a,b,c,d){return a===b&&c===d?aX:e=>0===e||1===e?e:c$(function(a,b,c,d,e){let f,g,h=0;do(f=c$(g=b+(c-b)/2,d,e)-a)>0?c=g:b=g;while(Math.abs(f)>1e-7&&++h<12)return g}(e,0,1,a,c),b,d)}let c0=c_(.42,0,1,1),c1=c_(0,0,.58,1),c2=c_(.42,0,.58,1),c3=a=>b=>b<=.5?a(2*b)/2:(2-a(2*(1-b)))/2,c4=a=>b=>1-a(1-b),c5=c_(.33,1.53,.69,.99),c6=c4(c5),c7=c3(c6),c8=a=>(a*=2)<1?.5*c6(a):.5*(2-Math.pow(2,-10*(a-1))),c9=a=>1-Math.sin(Math.acos(a)),da=c4(c9),db=c3(c9),dc=a=>Array.isArray(a)&&"number"==typeof a[0],dd={linear:aX,easeIn:c0,easeInOut:c2,easeOut:c1,circIn:c9,circInOut:db,circOut:da,backIn:c6,backInOut:c7,backOut:c5,anticipate:c8},de=a=>{if(dc(a)){aB(4===a.length,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");let[b,c,d,e]=a;return c_(b,c,d,e)}return"string"==typeof a?(aB(void 0!==dd[a],`Invalid easing type '${a}'`,"invalid-easing-type"),dd[a]):a},df=(a,b,c)=>{let d=b-a;return 0===d?1:(c-a)/d};function dg({duration:a=300,keyframes:b,times:c,ease:d="easeInOut"}){var e;let f,g=Array.isArray(d)&&"number"!=typeof d[0]?d.map(de):de(d),h={done:!1,value:b[0]},i=function(a,b,{clamp:c=!0,ease:d,mixer:e}={}){let f=a.length;if(aB(f===b.length,"Both input and output ranges must be the same length","range-length"),1===f)return()=>b[0];if(2===f&&b[0]===b[1])return()=>b[1];let g=a[0]===a[1];a[0]>a[f-1]&&(a=[...a].reverse(),b=[...b].reverse());let h=function(a,b,c){let d=[],e=c||aY.mix||cL,f=a.length-1;for(let c=0;c<f;c++){let f=e(a[c],a[c+1]);b&&(f=cx(Array.isArray(b)?b[c]||aX:b,f)),d.push(f)}return d}(b,d,e),i=h.length,j=c=>{if(g&&c<a[0])return b[0];let d=0;if(i>1)for(;d<a.length-2&&!(c<a[d+1]);d++);let e=df(a[d],a[d+1],c);return h[d](e)};return c?b=>j(H(a[0],a[f-1],b)):j}((e=c&&c.length===b.length?c:(!function(a,b){let c=a[a.length-1];for(let d=1;d<=b;d++){let e=df(0,b,d);a.push(bO(c,1,e))}}(f=[0],b.length-1),f),e.map(b=>b*a)),b,{ease:Array.isArray(g)?g:b.map(()=>g||c2).splice(0,b.length-1)});return{calculatedDuration:a,next:b=>(h.value=i(b),h.done=b>=a,h)}}let dh=a=>null!==a;function di(a,{repeat:b,repeatType:c="loop"},d,e=1){let f=a.filter(dh),g=e<0||b&&"loop"!==c&&b%2==1?0:f.length-1;return g&&void 0!==d?d:f[g]}let dj={decay:cZ,inertia:cZ,tween:dg,keyframes:dg,spring:cY};function dk(a){"string"==typeof a.type&&(a.type=dj[a.type])}class dl{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(a=>{this.resolve=a})}notifyFinished(){this.resolve()}then(a,b){return this.finished.then(a,b)}}let dm=a=>a/100;class dn extends dl{constructor(a){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{let{motionValue:a}=this.options;a&&a.updatedAt!==bi.now()&&this.tick(bi.now()),this.isStopped=!0,"idle"!==this.state&&(this.teardown(),this.options.onStop?.())},cy.mainThread++,this.options=a,this.initAnimation(),this.play(),!1===a.autoplay&&this.pause()}initAnimation(){let{options:a}=this;dk(a);let{type:b=dg,repeat:c=0,repeatDelay:d=0,repeatType:e,velocity:f=0}=a,{keyframes:g}=a,h=b||dg;h!==dg&&"number"!=typeof g[0]&&(this.mixKeyframes=cx(dm,cL(g[0],g[1])),g=[0,100]);let i=h({...a,keyframes:g});"mirror"===e&&(this.mirroredGenerator=h({...a,keyframes:[...g].reverse(),velocity:-f})),null===i.calculatedDuration&&(i.calculatedDuration=cO(i));let{calculatedDuration:j}=i;this.calculatedDuration=j,this.resolvedDuration=j+d,this.totalDuration=this.resolvedDuration*(c+1)-d,this.generator=i}updateTime(a){let b=Math.round(a-this.startTime)*this.playbackSpeed;null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=b}tick(a,b=!1){let{generator:c,totalDuration:d,mixKeyframes:e,mirroredGenerator:f,resolvedDuration:g,calculatedDuration:h}=this;if(null===this.startTime)return c.next(0);let{delay:i=0,keyframes:j,repeat:k,repeatType:l,repeatDelay:m,type:n,onUpdate:o,finalKeyframe:p}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,a):this.speed<0&&(this.startTime=Math.min(a-d/this.speed,this.startTime)),b?this.currentTime=a:this.updateTime(a);let q=this.currentTime-i*(this.playbackSpeed>=0?1:-1),r=this.playbackSpeed>=0?q<0:q>d;this.currentTime=Math.max(q,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=d);let s=this.currentTime,t=c;if(k){let a=Math.min(this.currentTime,d)/g,b=Math.floor(a),c=a%1;!c&&a>=1&&(c=1),1===c&&b--,(b=Math.min(b,k+1))%2&&("reverse"===l?(c=1-c,m&&(c-=m/g)):"mirror"===l&&(t=f)),s=H(0,1,c)*g}let u=r?{done:!1,value:j[0]}:t.next(s);e&&(u.value=e(u.value));let{done:v}=u;r||null===h||(v=this.playbackSpeed>=0?this.currentTime>=d:this.currentTime<=0);let w=null===this.holdTime&&("finished"===this.state||"running"===this.state&&v);return w&&n!==cZ&&(u.value=di(j,this.options,p,this.speed)),o&&o(u.value),w&&this.finish(),u}then(a,b){return this.finished.then(a,b)}get duration(){return this.calculatedDuration/1e3}get iterationDuration(){let{delay:a=0}=this.options||{};return this.duration+a/1e3}get time(){return this.currentTime/1e3}set time(a){a=cv(a),this.currentTime=a,null===this.startTime||null!==this.holdTime||0===this.playbackSpeed?this.holdTime=a:this.driver&&(this.startTime=this.driver.now()-a/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(a){this.updateTime(bi.now());let b=this.playbackSpeed!==a;this.playbackSpeed=a,b&&(this.time=this.currentTime/1e3)}play(){if(this.isStopped)return;let{driver:a=cM,startTime:b}=this.options;this.driver||(this.driver=a(a=>this.tick(a))),this.options.onPlay?.();let c=this.driver.now();"finished"===this.state?(this.updateFinished(),this.startTime=c):null!==this.holdTime?this.startTime=c-this.holdTime:this.startTime||(this.startTime=b??c),"finished"===this.state&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(bi.now()),this.holdTime=this.currentTime}complete(){"running"!==this.state&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null,cy.mainThread--}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(a){return this.startTime=0,this.tick(a,!0)}attachTimeline(a){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),a.observe(this)}}function dp(a){let b;return()=>(void 0===b&&(b=a()),b)}let dq=dp(()=>void 0!==window.ScrollTimeline),dr={},ds=(c=dp(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(a){return!1}return!0}),()=>dr.linearEasing??c()),dt=([a,b,c,d])=>`cubic-bezier(${a}, ${b}, ${c}, ${d})`,du={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:dt([0,.65,.55,1]),circOut:dt([.55,0,1,.45]),backIn:dt([.31,.01,.66,-.59]),backOut:dt([.33,1.53,.69,.99])};function dv(a){return"function"==typeof a&&"applyToOptions"in a}class dw extends dl{constructor(a){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!a)return;const{element:b,name:c,keyframes:d,pseudoElement:e,allowFlatten:f=!1,finalKeyframe:g,onComplete:h}=a;this.isPseudoElement=!!e,this.allowFlatten=f,this.options=a,aB("string"!=typeof a.type,'Mini animate() doesn\'t support "type" as a string.',"mini-spring");const i=function({type:a,...b}){return dv(a)&&ds()?a.applyToOptions(b):(b.duration??(b.duration=300),b.ease??(b.ease="easeOut"),b)}(a);this.animation=function(a,b,c,{delay:d=0,duration:e=300,repeat:f=0,repeatType:g="loop",ease:h="easeOut",times:i}={},j){let k={[b]:c};i&&(k.offset=i);let l=function a(b,c){if(b)return"function"==typeof b?ds()?cN(b,c):"ease-out":dc(b)?dt(b):Array.isArray(b)?b.map(b=>a(b,c)||du.easeOut):du[b]}(h,e);Array.isArray(l)&&(k.easing=l);let m={delay:d,duration:e,easing:Array.isArray(l)?"linear":l,fill:"both",iterations:f+1,direction:"reverse"===g?"alternate":"normal"};j&&(m.pseudoElement=j);let n=a.animate(k,m);return n}(b,c,d,i,e),!1===i.autoplay&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!e){let a=di(d,this.options,g,this.speed);this.updateMotionValue?this.updateMotionValue(a):c.startsWith("--")?b.style.setProperty(c,a):b.style[c]=a,this.animation.cancel()}h?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),"finished"===this.state&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch(a){}}stop(){if(this.isStopped)return;this.isStopped=!0;let{state:a}=this;"idle"!==a&&"finished"!==a&&(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){this.isPseudoElement||this.animation.commitStyles?.()}get duration(){return Number(this.animation.effect?.getComputedTiming?.().duration||0)/1e3}get iterationDuration(){let{delay:a=0}=this.options||{};return this.duration+a/1e3}get time(){return(Number(this.animation.currentTime)||0)/1e3}set time(a){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=cv(a)}get speed(){return this.animation.playbackRate}set speed(a){a<0&&(this.finishedTime=null),this.animation.playbackRate=a}get state(){return null!==this.finishedTime?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(a){this.manualStartTime=this.animation.startTime=a}attachTimeline({timeline:a,observe:b}){return(this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,a&&dq())?(this.animation.timeline=a,aX):b(this)}}let dx={anticipate:c8,backInOut:c7,circInOut:db};class dy extends dw{constructor(a){!function(a){"string"==typeof a.ease&&a.ease in dx&&(a.ease=dx[a.ease])}(a),dk(a),super(a),void 0!==a.startTime&&(this.startTime=a.startTime),this.options=a}updateMotionValue(a){let{motionValue:b,onUpdate:c,onComplete:d,element:e,...f}=this.options;if(!b)return;if(void 0!==a)return void b.set(a);let g=new dn({...f,autoplay:!1}),h=Math.max(10,bi.now()-this.startTime),i=H(0,10,h-10);b.setWithVelocity(g.sample(Math.max(0,h-i)).value,g.sample(h).value,i),g.stop()}}let dz=(a,b)=>"zIndex"!==b&&!!("number"==typeof a||Array.isArray(a)||"string"==typeof a&&(ai.test(a)||"0"===a)&&!a.startsWith("url("));function dA(a){a.duration=0,a.type="keyframes"}let dB=new Set(["opacity","clipPath","filter","transform"]),dC=dp(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));class dD extends dl{constructor({autoplay:a=!0,delay:b=0,type:c="keyframes",repeat:d=0,repeatDelay:e=0,repeatType:f="loop",keyframes:g,name:h,motionValue:i,element:j,...k}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=bi.now();const l={autoplay:a,delay:b,type:c,repeat:d,repeatDelay:e,repeatType:f,name:h,motionValue:i,element:j,...k},m=j?.KeyframeResolver||a9;this.keyframeResolver=new m(g,(a,b,c)=>this.onKeyframesResolved(a,b,l,!c),h,i,j),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(a,b,c,d){this.keyframeResolver=void 0;let{name:e,type:f,velocity:g,delay:h,isHandoff:i,onUpdate:j}=c;this.resolvedAt=bi.now(),!function(a,b,c,d){let e=a[0];if(null===e)return!1;if("display"===b||"visibility"===b)return!0;let f=a[a.length-1],g=dz(e,b),h=dz(f,b);return aA(g===h,`You are trying to animate ${b} from "${e}" to "${f}". "${g?f:e}" is not an animatable value.`,"value-not-animatable"),!!g&&!!h&&(function(a){let b=a[0];if(1===a.length)return!0;for(let c=0;c<a.length;c++)if(a[c]!==b)return!0}(a)||("spring"===c||dv(c))&&d)}(a,e,f,g)&&((aY.instantAnimations||!h)&&j?.(di(a,c,b)),a[0]=a[a.length-1],dA(c),c.repeat=0);let k={startTime:d?this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt:void 0,finalKeyframe:b,...c,keyframes:a},l=!i&&function(a){let{motionValue:b,name:c,repeatDelay:d,repeatType:e,damping:f,type:g}=a;if(!(b?.owner?.current instanceof HTMLElement))return!1;let{onUpdate:h,transformTemplate:i}=b.owner.getProps();return dC()&&c&&dB.has(c)&&("transform"!==c||!i)&&!h&&!d&&"mirror"!==e&&0!==f&&"inertia"!==g}(k),m=k.motionValue?.owner?.current,n=l?new dy({...k,element:m}):new dn(k);n.finished.then(()=>{this.notifyFinished()}).catch(aX),this.pendingTimeline&&(this.stopTimeline=n.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=n}get finished(){return this._animation?this.animation.finished:this._finished}then(a,b){return this.finished.finally(a).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),a6=!0,a8(),a7(),a6=!1),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(a){this.animation.time=a}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(a){this.animation.speed=a}get startTime(){return this.animation.startTime}attachTimeline(a){return this._animation?this.stopTimeline=this.animation.attachTimeline(a):this.pendingTimeline=a,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}let dE={type:"spring",stiffness:500,damping:25,restSpeed:10},dF={type:"keyframes",duration:.8},dG={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},dH=a=>null!==a,dI=(a,b,c,d={},e,f)=>g=>{let h=cs(d,a)||{},i=h.delay||d.delay||0,{elapsed:j=0}=d;j-=cv(i);let k={keyframes:Array.isArray(c)?c:[null,c],ease:"easeOut",velocity:b.getVelocity(),...h,delay:-j,onUpdate:a=>{b.set(a),h.onUpdate&&h.onUpdate(a)},onComplete:()=>{g(),h.onComplete&&h.onComplete()},name:a,motionValue:b,element:f?void 0:e};!function({when:a,delay:b,delayChildren:c,staggerChildren:d,staggerDirection:e,repeat:f,repeatType:g,repeatDelay:h,from:i,elapsed:j,...k}){return!!Object.keys(k).length}(h)&&Object.assign(k,((a,{keyframes:b})=>b.length>2?dF:G.has(a)?a.startsWith("scale")?{type:"spring",stiffness:550,damping:0===b[1]?2*Math.sqrt(550):30,restSpeed:10}:dE:dG)(a,k)),k.duration&&(k.duration=cv(k.duration)),k.repeatDelay&&(k.repeatDelay=cv(k.repeatDelay)),void 0!==k.from&&(k.keyframes[0]=k.from);let l=!1;if(!1!==k.type&&(0!==k.duration||k.repeatDelay)||(dA(k),0===k.delay&&(l=!0)),(aY.instantAnimations||aY.skipAnimations)&&(l=!0,dA(k),k.delay=0),k.allowFlatten=!h.type&&!h.ease,l&&!f&&void 0!==b.get()){let a=function(a,{repeat:b,repeatType:c="loop"},d){let e=a.filter(dH),f=b&&"loop"!==c&&b%2==1?0:e.length-1;return e[f]}(k.keyframes,h);if(void 0!==a)return void a_.update(()=>{k.onUpdate(a),k.onComplete()})}return h.isSync?new dn(k):new dD(k)};function dJ(a,b,{delay:c=0,transitionOverride:d,type:e}={}){let{transition:f=a.getDefaultTransition(),transitionEnd:g,...h}=b;d&&(f=d);let i=[],j=e&&a.animationState&&a.animationState.getState()[e];for(let b in h){let d=a.getValue(b,a.latestValues[b]??null),e=h[b];if(void 0===e||j&&function({protectedKeys:a,needsAnimating:b},c){let d=a.hasOwnProperty(c)&&!0!==b[c];return b[c]=!1,d}(j,b))continue;let g={delay:c,...cs(f||{},b)},k=d.get();if(void 0!==k&&!d.isAnimating&&!Array.isArray(e)&&e===k&&!g.velocity)continue;let l=!1;if(window.MotionHandoffAnimation){let c=a.props[cm];if(c){let a=window.MotionHandoffAnimation(c,b,a_);null!==a&&(g.startTime=a,l=!0)}}cu(a,b),d.start(dI(b,d,e,a.shouldReduceMotion&&aw.has(b)?{type:!1}:g,a,l));let m=d.animation;m&&i.push(m)}return g&&Promise.all(i).then(()=>{a_.update(()=>{g&&function(a,b){let{transitionEnd:c={},transition:d={},...e}=cr(a,b)||{};for(let b in e={...e,...c}){var f;let c=ct(f=e[b])?f[f.length-1]||0:f;a.hasValue(b)?a.getValue(b).set(c):a.addValue(b,bk(c))}}(a,g)})}),i}function dK(a,b,c,d=0,e=1){let f=Array.from(a).sort((a,b)=>a.sortNodePosition(b)).indexOf(b),g=a.size,h=(g-1)*d;return"function"==typeof c?c(f,g):1===e?f*d:h-f*d}function dL(a,b,c={}){let d=cr(a,b,"exit"===c.type?a.presenceContext?.custom:void 0),{transition:e=a.getDefaultTransition()||{}}=d||{};c.transitionOverride&&(e=c.transitionOverride);let f=d?()=>Promise.all(dJ(a,d,c)):()=>Promise.resolve(),g=a.variantChildren&&a.variantChildren.size?(d=0)=>{let{delayChildren:f=0,staggerChildren:g,staggerDirection:h}=e;return function(a,b,c=0,d=0,e=0,f=1,g){let h=[];for(let i of a.variantChildren)i.notify("AnimationStart",b),h.push(dL(i,b,{...g,delay:c+("function"==typeof d?0:d)+dK(a.variantChildren,i,d,e,f)}).then(()=>i.notify("AnimationComplete",b)));return Promise.all(h)}(a,b,d,f,g,h,c)}:()=>Promise.resolve(),{when:h}=e;if(!h)return Promise.all([f(),g(c.delay)]);{let[a,b]="beforeChildren"===h?[f,g]:[g,f];return a().then(()=>b())}}let dM=br.length;function dN(a,b){if(!Array.isArray(b))return!1;let c=b.length;if(c!==a.length)return!1;for(let d=0;d<c;d++)if(b[d]!==a[d])return!1;return!0}let dO=[...bq].reverse(),dP=bq.length;function dQ(a=!1){return{isActive:a,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function dR(){return{animate:dQ(!0),whileInView:dQ(),whileHover:dQ(),whileTap:dQ(),whileDrag:dQ(),whileFocus:dQ(),exit:dQ()}}let dS=0;function dT(a){return[a("x"),a("y")]}let dU=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function dV(a){return dU.has(a.tagName)||!0===a.isContentEditable}function dW(a,b,c,d={passive:!0}){return a.addEventListener(b,c,d),()=>a.removeEventListener(b,c)}let dX={x:!1,y:!1};function dY(a){return a.max-a.min}function dZ(a,b,c,d=.5){a.origin=d,a.originPoint=bO(b.min,b.max,a.origin),a.scale=dY(c)/dY(b),a.translate=bO(c.min,c.max,a.origin)-a.originPoint,(a.scale>=.9999&&a.scale<=1.0001||isNaN(a.scale))&&(a.scale=1),(a.translate>=-.01&&a.translate<=.01||isNaN(a.translate))&&(a.translate=0)}function d$(a,b,c,d){dZ(a.x,b.x,c.x,d?d.originX:void 0),dZ(a.y,b.y,c.y,d?d.originY:void 0)}function d_(a,b,c){a.min=c.min+b.min,a.max=a.min+dY(b)}function d0(a,b,c){a.min=b.min-c.min,a.max=a.min+dY(b)}function d1(a,b,c){d0(a.x,b.x,c.x),d0(a.y,b.y,c.y)}let d2=a=>"mouse"===a.pointerType?"number"!=typeof a.button||a.button<=0:!1!==a.isPrimary;function d3(a){return{point:{x:a.pageX,y:a.pageY}}}function d4(a,b,c,d){return dW(a,b,a=>d2(a)&&c(a,d3(a)),d)}let d5=({current:a})=>a?a.ownerDocument.defaultView:null,d6=(a,b)=>Math.abs(a-b),d7=new Set(["auto","scroll"]);class d8{constructor(a,b,{transformPagePoint:c,contextWindow:d=window,dragSnapToOrigin:e=!1,distanceThreshold:f=3,element:g}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=a=>{this.handleScroll(a.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{var a,b;if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let c=eb(this.lastMoveEventInfo,this.history),d=null!==this.startEvent,e=(a=c.offset,b={x:0,y:0},Math.sqrt(d6(a.x,b.x)**2+d6(a.y,b.y)**2)>=this.distanceThreshold);if(!d&&!e)return;let{point:f}=c,{timestamp:g}=a1;this.history.push({...f,timestamp:g});let{onStart:h,onMove:i}=this.handlers;d||(h&&h(this.lastMoveEvent,c),this.startEvent=this.lastMoveEvent),i&&i(this.lastMoveEvent,c)},this.handlePointerMove=(a,b)=>{this.lastMoveEvent=a,this.lastMoveEventInfo=d9(b,this.transformPagePoint),a_.update(this.updatePoint,!0)},this.handlePointerUp=(a,b)=>{this.end();let{onEnd:c,onSessionEnd:d,resumeAnimation:e}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&e&&e(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let f=eb("pointercancel"===a.type?this.lastMoveEventInfo:d9(b,this.transformPagePoint),this.history);this.startEvent&&c&&c(a,f),d&&d(a,f)},!d2(a))return;this.dragSnapToOrigin=e,this.handlers=b,this.transformPagePoint=c,this.distanceThreshold=f,this.contextWindow=d||window;const h=d9(d3(a),this.transformPagePoint),{point:i}=h,{timestamp:j}=a1;this.history=[{...i,timestamp:j}];const{onSessionStart:k}=b;k&&k(a,eb(h,this.history)),this.removeListeners=cx(d4(this.contextWindow,"pointermove",this.handlePointerMove),d4(this.contextWindow,"pointerup",this.handlePointerUp),d4(this.contextWindow,"pointercancel",this.handlePointerUp)),g&&this.startScrollTracking(g)}startScrollTracking(a){let b=a.parentElement;for(;b;){let a=getComputedStyle(b);(d7.has(a.overflowX)||d7.has(a.overflowY))&&this.scrollPositions.set(b,{x:b.scrollLeft,y:b.scrollTop}),b=b.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0,passive:!0}),window.addEventListener("scroll",this.onWindowScroll,{passive:!0}),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(a){let b=this.scrollPositions.get(a);if(!b)return;let c=a===window,d=c?{x:window.scrollX,y:window.scrollY}:{x:a.scrollLeft,y:a.scrollTop},e={x:d.x-b.x,y:d.y-b.y};(0!==e.x||0!==e.y)&&(c?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=e.x,this.lastMoveEventInfo.point.y+=e.y):this.history.length>0&&(this.history[0].x-=e.x,this.history[0].y-=e.y),this.scrollPositions.set(a,d),a_.update(this.updatePoint,!0))}updateHandlers(a){this.handlers=a}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),a0(this.updatePoint)}}function d9(a,b){return b?{point:b(a.point)}:a}function ea(a,b){return{x:a.x-b.x,y:a.y-b.y}}function eb({point:a},b){return{point:a,delta:ea(a,ec(b)),offset:ea(a,b[0]),velocity:function(a,b){if(a.length<2)return{x:0,y:0};let c=a.length-1,d=null,e=ec(a);for(;c>=0&&(d=a[c],!(e.timestamp-d.timestamp>cv(.1)));)c--;if(!d)return{x:0,y:0};let f=(e.timestamp-d.timestamp)/1e3;if(0===f)return{x:0,y:0};let g={x:(e.x-d.x)/f,y:(e.y-d.y)/f};return g.x===1/0&&(g.x=0),g.y===1/0&&(g.y=0),g}(b,.1)}}function ec(a){return a[a.length-1]}function ed(a,b,c){return{min:void 0!==b?a.min+b:void 0,max:void 0!==c?a.max+c-(a.max-a.min):void 0}}function ee(a,b){let c=b.min-a.min,d=b.max-a.max;return b.max-b.min<a.max-a.min&&([c,d]=[d,c]),{min:c,max:d}}function ef(a,b,c){return{min:eg(a,b),max:eg(a,c)}}function eg(a,b){return"number"==typeof a?a:a[b]||0}let eh=new WeakMap;class ei{constructor(a){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=au(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=a}start(a,{snapToCursor:b=!1,distanceThreshold:c}={}){let{presenceContext:d}=this.visualElement;if(d&&!1===d.isPresent)return;let e=a=>{b?(this.stopAnimation(),this.snapToCursor(d3(a).point)):this.pauseAnimation()},f=(a,b)=>{this.stopAnimation();let{drag:c,dragPropagation:d,onDragStart:e}=this.getProps();if(c&&!d&&(this.openDragLock&&this.openDragLock(),this.openDragLock=function(a){if("x"===a||"y"===a)if(dX[a])return null;else return dX[a]=!0,()=>{dX[a]=!1};return dX.x||dX.y?null:(dX.x=dX.y=!0,()=>{dX.x=dX.y=!1})}(c),!this.openDragLock))return;this.latestPointerEvent=a,this.latestPanInfo=b,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),dT(a=>{let b=this.getAxisMotionValue(a).get()||0;if(V.test(b)){let{projection:c}=this.visualElement;if(c&&c.layout){let d=c.layout.layoutBox[a];d&&(b=dY(d)*(parseFloat(b)/100))}}this.originPoint[a]=b}),e&&a_.postRender(()=>e(a,b)),cu(this.visualElement,"transform");let{animationState:f}=this.visualElement;f&&f.setActive("whileDrag",!0)},g=(a,b)=>{this.latestPointerEvent=a,this.latestPanInfo=b;let{dragPropagation:c,dragDirectionLock:d,onDirectionLock:e,onDrag:f}=this.getProps();if(!c&&!this.openDragLock)return;let{offset:g}=b;if(d&&null===this.currentDirection){this.currentDirection=function(a,b=10){let c=null;return Math.abs(a.y)>b?c="y":Math.abs(a.x)>b&&(c="x"),c}(g),null!==this.currentDirection&&e&&e(this.currentDirection);return}this.updateAxis("x",b.point,g),this.updateAxis("y",b.point,g),this.visualElement.render(),f&&f(a,b)},h=(a,b)=>{this.latestPointerEvent=a,this.latestPanInfo=b,this.stop(a,b),this.latestPointerEvent=null,this.latestPanInfo=null},i=()=>dT(a=>"paused"===this.getAnimationState(a)&&this.getAxisMotionValue(a).animation?.play()),{dragSnapToOrigin:j}=this.getProps();this.panSession=new d8(a,{onSessionStart:e,onStart:f,onMove:g,onSessionEnd:h,resumeAnimation:i},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:j,distanceThreshold:c,contextWindow:d5(this.visualElement),element:this.visualElement.current})}stop(a,b){let c=a||this.latestPointerEvent,d=b||this.latestPanInfo,e=this.isDragging;if(this.cancel(),!e||!d||!c)return;let{velocity:f}=d;this.startAnimation(f);let{onDragEnd:g}=this.getProps();g&&a_.postRender(()=>g(c,d))}cancel(){this.isDragging=!1;let{projection:a,animationState:b}=this.visualElement;a&&(a.isAnimationBlocked=!1),this.endPanSession();let{dragPropagation:c}=this.getProps();!c&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),b&&b.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(a,b,c){let{drag:d}=this.getProps();if(!c||!ej(a,d,this.currentDirection))return;let e=this.getAxisMotionValue(a),f=this.originPoint[a]+c[a];this.constraints&&this.constraints[a]&&(f=function(a,{min:b,max:c},d){return void 0!==b&&a<b?a=d?bO(b,a,d.min):Math.max(a,b):void 0!==c&&a>c&&(a=d?bO(c,a,d.max):Math.min(a,c)),a}(f,this.constraints[a],this.elastic[a])),e.set(f)}resolveConstraints(){let{dragConstraints:a,dragElastic:b}=this.getProps(),c=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,d=this.constraints;a&&co(a)?this.constraints||(this.constraints=this.resolveRefConstraints()):a&&c?this.constraints=function(a,{top:b,left:c,bottom:d,right:e}){return{x:ed(a.x,c,e),y:ed(a.y,b,d)}}(c.layoutBox,a):this.constraints=!1,this.elastic=function(a=.35){return!1===a?a=0:!0===a&&(a=.35),{x:ef(a,"left","right"),y:ef(a,"top","bottom")}}(b),d!==this.constraints&&c&&this.constraints&&!this.hasMutatedConstraints&&dT(a=>{var b,d;let e;!1!==this.constraints&&this.getAxisMotionValue(a)&&(this.constraints[a]=(b=c.layoutBox[a],d=this.constraints[a],e={},void 0!==d.min&&(e.min=d.min-b.min),void 0!==d.max&&(e.max=d.max-b.min),e))})}resolveRefConstraints(){var a;let{dragConstraints:b,onMeasureDragConstraints:c}=this.getProps();if(!b||!co(b))return!1;let d=b.current;aB(null!==d,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.","drag-constraints-ref");let{projection:e}=this.visualElement;if(!e||!e.layout)return!1;let f=function(a,b,c){let d=b3(a,c),{scroll:e}=b;return e&&(b0(d.x,e.offset.x),b0(d.y,e.offset.y)),d}(d,e.root,this.visualElement.getTransformPagePoint()),g=(a=e.layout.layoutBox,{x:ee(a.x,f.x),y:ee(a.y,f.y)});if(c){let a=c(function({x:a,y:b}){return{top:b.min,right:a.max,bottom:b.max,left:a.min}}(g));this.hasMutatedConstraints=!!a,a&&(g=bU(a))}return g}startAnimation(a){let{drag:b,dragMomentum:c,dragElastic:d,dragTransition:e,dragSnapToOrigin:f,onDragTransitionEnd:g}=this.getProps(),h=this.constraints||{};return Promise.all(dT(g=>{if(!ej(g,b,this.currentDirection))return;let i=h&&h[g]||{};f&&(i={min:0,max:0});let j={type:"inertia",velocity:c?a[g]:0,bounceStiffness:d?200:1e6,bounceDamping:d?40:1e7,timeConstant:750,restDelta:1,restSpeed:10,...e,...i};return this.startAxisValueAnimation(g,j)})).then(g)}startAxisValueAnimation(a,b){let c=this.getAxisMotionValue(a);return cu(this.visualElement,a),c.start(dI(a,c,0,b,this.visualElement,!1))}stopAnimation(){dT(a=>this.getAxisMotionValue(a).stop())}pauseAnimation(){dT(a=>this.getAxisMotionValue(a).animation?.pause())}getAnimationState(a){return this.getAxisMotionValue(a).animation?.state}getAxisMotionValue(a){let b=`_drag${a.toUpperCase()}`,c=this.visualElement.getProps();return c[b]||this.visualElement.getValue(a,(c.initial?c.initial[a]:void 0)||0)}snapToCursor(a){dT(b=>{let{drag:c}=this.getProps();if(!ej(b,c,this.currentDirection))return;let{projection:d}=this.visualElement,e=this.getAxisMotionValue(b);if(d&&d.layout){let{min:c,max:f}=d.layout.layoutBox[b],g=e.get()||0;e.set(a[b]-bO(c,f,.5)+g)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;let{drag:a,dragConstraints:b}=this.getProps(),{projection:c}=this.visualElement;if(!co(b)||!c||!this.constraints)return;this.stopAnimation();let d={x:0,y:0};dT(a=>{let b=this.getAxisMotionValue(a);if(b&&!1!==this.constraints){var c,e;let f,g,h,i=b.get();d[a]=(c={min:i,max:i},e=this.constraints[a],f=.5,g=dY(c),(h=dY(e))>g?f=df(e.min,e.max-g,c.min):g>h&&(f=df(c.min,c.max-h,e.min)),H(0,1,f))}});let{transformTemplate:e}=this.visualElement.getProps();this.visualElement.current.style.transform=e?e({},""):"none",c.root&&c.root.updateScroll(),c.updateLayout(),this.resolveConstraints(),dT(b=>{if(!ej(b,a,null))return;let c=this.getAxisMotionValue(b),{min:e,max:f}=this.constraints[b];c.set(bO(e,f,d[b]))})}addListeners(){if(!this.visualElement.current)return;eh.set(this.visualElement,this);let a=this.visualElement.current,b=d4(a,"pointerdown",b=>{let{drag:c,dragListener:d=!0}=this.getProps(),e=b.target,f=e!==a&&dV(e);c&&d&&!f&&this.start(b)}),c=()=>{let{dragConstraints:a}=this.getProps();co(a)&&a.current&&(this.constraints=this.resolveRefConstraints())},{projection:d}=this.visualElement,e=d.addEventListener("measure",c);d&&!d.layout&&(d.root&&d.root.updateScroll(),d.updateLayout()),a_.read(c);let f=dW(window,"resize",()=>this.scalePositionWithinConstraints()),g=d.addEventListener("didUpdate",({delta:a,hasLayoutChanged:b})=>{this.isDragging&&b&&(dT(b=>{let c=this.getAxisMotionValue(b);c&&(this.originPoint[b]+=a[b].translate,c.set(c.get()+a[b].translate))}),this.visualElement.render())});return()=>{f(),b(),e(),g&&g()}}getProps(){let a=this.visualElement.getProps(),{drag:b=!1,dragDirectionLock:c=!1,dragPropagation:d=!1,dragConstraints:e=!1,dragElastic:f=.35,dragMomentum:g=!0}=a;return{...a,drag:b,dragDirectionLock:c,dragPropagation:d,dragConstraints:e,dragElastic:f,dragMomentum:g}}}function ej(a,b,c){return(!0===b||b===a)&&(null===c||c===a)}let ek=a=>(b,c)=>{a&&a_.postRender(()=>a(b,c))},el={hasAnimatedSinceResize:!0,hasEverUpdated:!1};var em=n;let en=!1;class eo extends em.Component{componentDidMount(){let{visualElement:a,layoutGroup:b,switchLayoutGroup:c,layoutId:d}=this.props,{projection:e}=a;e&&(b.group&&b.group.add(e),c&&c.register&&d&&c.register(e),en&&e.root.didUpdate(),e.addEventListener("animationComplete",()=>{this.safeToRemove()}),e.setOptions({...e.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),el.hasEverUpdated=!0}getSnapshotBeforeUpdate(a){let{layoutDependency:b,visualElement:c,drag:d,isPresent:e}=this.props,{projection:f}=c;return f&&(f.isPresent=e,a.layoutDependency!==b&&f.setOptions({...f.options,layoutDependency:b}),en=!0,d||a.layoutDependency!==b||void 0===b||a.isPresent!==e?f.willUpdate():this.safeToRemove(),a.isPresent!==e&&(e?f.promote():f.relegate()||a_.postRender(()=>{let a=f.getStack();a&&a.members.length||this.safeToRemove()}))),null}componentDidUpdate(){let{projection:a}=this.props.visualElement;a&&(a.root.didUpdate(),bg.postRender(()=>{!a.currentAnimation&&a.isLead()&&this.safeToRemove()}))}componentWillUnmount(){let{visualElement:a,layoutGroup:b,switchLayoutGroup:c}=this.props,{projection:d}=a;en=!0,d&&(d.scheduleCheckAfterUnmount(),b&&b.group&&b.group.remove(d),c&&c.deregister&&c.deregister(d))}safeToRemove(){let{safeToRemove:a}=this.props;a&&a()}render(){return null}}function ep(a){let[b,c]=B(),d=(0,em.useContext)(o);return(0,m.jsx)(eo,{...a,layoutGroup:d,switchLayoutGroup:(0,em.useContext)(cn),isPresent:b,safeToRemove:c})}function eq(a,b,c,d,e){return a-=b,a=d+1/c*(a-d),void 0!==e&&(a=d+1/e*(a-d)),a}function er(a,b,[c,d,e],f,g){!function(a,b=0,c=1,d=.5,e,f=a,g=a){if(V.test(b)&&(b=parseFloat(b),b=bO(g.min,g.max,b/100)-g.min),"number"!=typeof b)return;let h=bO(f.min,f.max,d);a===f&&(h-=b),a.min=eq(a.min,b,c,h,e),a.max=eq(a.max,b,c,h,e)}(a,b[c],b[d],b[e],b.scale,f,g)}let es=["x","scaleX","originX"],et=["y","scaleY","originY"];function eu(a,b,c,d){er(a.x,b,es,c?c.x:void 0,d?d.x:void 0),er(a.y,b,et,c?c.y:void 0,d?d.y:void 0)}function ev(a,b){a.min=b.min,a.max=b.max}function ew(a,b){ev(a.x,b.x),ev(a.y,b.y)}function ex(a,b){a.translate=b.translate,a.scale=b.scale,a.originPoint=b.originPoint,a.origin=b.origin}function ey(a){return 0===a.translate&&1===a.scale}function ez(a){return ey(a.x)&&ey(a.y)}function eA(a,b){return a.min===b.min&&a.max===b.max}function eB(a,b){return Math.round(a.min)===Math.round(b.min)&&Math.round(a.max)===Math.round(b.max)}function eC(a,b){return eB(a.x,b.x)&&eB(a.y,b.y)}function eD(a){return dY(a.x)/dY(a.y)}function eE(a,b){return a.translate===b.translate&&a.scale===b.scale&&a.originPoint===b.originPoint}let eF=["TopLeft","TopRight","BottomLeft","BottomRight"],eG=eF.length,eH=a=>"string"==typeof a?parseFloat(a):a,eI=a=>"number"==typeof a||W.test(a);function eJ(a,b){return void 0!==a[b]?a[b]:a.borderRadius}let eK=eM(0,.5,da),eL=eM(.5,.95,aX);function eM(a,b,c){return d=>d<a?0:d>b?1:c(df(a,b,d))}function eN(a){return s(a)&&"ownerSVGElement"in a}let eO=(a,b)=>a.depth-b.depth;class eP{constructor(){this.children=[],this.isDirty=!1}add(a){bd(this.children,a),this.isDirty=!0}remove(a){be(this.children,a),this.isDirty=!0}forEach(a){this.isDirty&&this.children.sort(eO),this.isDirty=!1,this.children.forEach(a)}}class eQ{constructor(){this.members=[]}add(a){bd(this.members,a),a.scheduleRender()}remove(a){if(be(this.members,a),a===this.prevLead&&(this.prevLead=void 0),a===this.lead){let a=this.members[this.members.length-1];a&&this.promote(a)}}relegate(a){let b,c=this.members.findIndex(b=>a===b);if(0===c)return!1;for(let a=c;a>=0;a--){let c=this.members[a];if(!1!==c.isPresent){b=c;break}}return!!b&&(this.promote(b),!0)}promote(a,b){let c=this.lead;if(a!==c&&(this.prevLead=c,this.lead=a,a.show(),c)){c.instance&&c.scheduleRender(),a.scheduleRender();let d=c.options.layoutDependency,e=a.options.layoutDependency;(void 0===d||void 0===e||d!==e)&&(a.resumeFrom=c,b&&(a.resumeFrom.preserveOpacity=!0),c.snapshot&&(a.snapshot=c.snapshot,a.snapshot.latestValues=c.animationValues||c.latestValues),a.root&&a.root.isUpdating&&(a.isLayoutDirty=!0));let{crossfade:f}=a.options;!1===f&&c.hide()}}exitAnimationComplete(){this.members.forEach(a=>{let{options:b,resumingFrom:c}=a;b.onExitComplete&&b.onExitComplete(),c&&c.options.onExitComplete&&c.options.onExitComplete()})}scheduleRender(){this.members.forEach(a=>{a.instance&&a.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}let eR=["","X","Y","Z"],eS=0;function eT(a,b,c,d){let{latestValues:e}=b;e[a]&&(c[a]=e[a],b.setStaticValue(a,0),d&&(d[a]=0))}function eU({attachResizeListener:a,defaultParent:b,measureScroll:c,checkIsScrollRoot:d,resetTransform:e}){return class{constructor(a={},c=b?.()){this.id=eS++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(eX),this.nodes.forEach(e2),this.nodes.forEach(e3),this.nodes.forEach(eY)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=a,this.root=c?c.root||c:this,this.path=c?[...c.path,c]:[],this.parent=c,this.depth=c?c.depth+1:0;for(let a=0;a<this.path.length;a++)this.path[a].shouldResetTransform=!0;this.root===this&&(this.nodes=new eP)}addEventListener(a,b){return this.eventHandlers.has(a)||this.eventHandlers.set(a,new bf),this.eventHandlers.get(a).add(b)}notifyListeners(a,...b){let c=this.eventHandlers.get(a);c&&c.notify(...b)}hasListeners(a){return this.eventHandlers.has(a)}mount(b){if(this.instance)return;this.isSVG=eN(b)&&!(eN(b)&&"svg"===b.tagName),this.instance=b;let{layoutId:c,layout:d,visualElement:e}=this.options;if(e&&!e.current&&e.mount(b),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(d||c)&&(this.isLayoutDirty=!0),a){let c,d=0,e=()=>this.root.updateBlockedByResize=!1;a_.read(()=>{d=window.innerWidth}),a(b,()=>{let a=window.innerWidth;if(a!==d){let b,f;d=a,this.root.updateBlockedByResize=!0,c&&c(),b=bi.now(),f=({timestamp:a})=>{let c=a-b;c>=250&&(a0(f),e(c-250))},a_.setup(f,!0),c=()=>a0(f),el.hasAnimatedSinceResize&&(el.hasAnimatedSinceResize=!1,this.nodes.forEach(e1))}})}c&&this.root.registerSharedNode(c,this),!1!==this.options.animate&&e&&(c||d)&&this.addEventListener("didUpdate",({delta:a,hasLayoutChanged:b,hasRelativeLayoutChanged:c,layout:d})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}let f=this.options.transition||e.getDefaultTransition()||e9,{onLayoutAnimationStart:g,onLayoutAnimationComplete:h}=e.getProps(),i=!this.targetLayout||!eC(this.targetLayout,d),j=!b&&c;if(this.options.layoutRoot||this.resumeFrom||j||b&&(i||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);let b={...cs(f,"layout"),onPlay:g,onComplete:h};(e.shouldReduceMotion||this.options.layoutRoot)&&(b.delay=0,b.type=!1),this.startAnimation(b),this.setAnimationOrigin(a,j)}else b||e1(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=d})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);let a=this.getStack();a&&a.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),a0(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){!this.isUpdateBlocked()&&(this.isUpdating=!0,this.nodes&&this.nodes.forEach(e4),this.animationId++)}getTransformTemplate(){let{visualElement:a}=this.options;return a&&a.getProps().transformTemplate}willUpdate(a=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&function a(b){if(b.hasCheckedOptimisedAppear=!0,b.root===b)return;let{visualElement:c}=b.options;if(!c)return;let d=c.props[cm];if(window.MotionHasOptimisedAnimation(d,"transform")){let{layout:a,layoutId:c}=b.options;window.MotionCancelOptimisedAnimation(d,"transform",a_,!(a||c))}let{parent:e}=b;e&&!e.hasCheckedOptimisedAppear&&a(e)}(this),this.root.isUpdating||this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let a=0;a<this.path.length;a++){let b=this.path[a];b.shouldResetTransform=!0,b.updateScroll("snapshot"),b.options.layoutRoot&&b.willUpdate(!1)}let{layoutId:b,layout:c}=this.options;if(void 0===b&&!c)return;let d=this.getTransformTemplate();this.prevTransformTemplateValue=d?d(this.latestValues,""):void 0,this.updateSnapshot(),a&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(e$);return}if(this.animationId<=this.animationCommitId)return void this.nodes.forEach(e_);this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(e0),this.nodes.forEach(eV),this.nodes.forEach(eW)):this.nodes.forEach(e_),this.clearAllSnapshots();let a=bi.now();a1.delta=H(0,1e3/60,a-a1.timestamp),a1.timestamp=a,a1.isProcessing=!0,a2.update.process(a1),a2.preRender.process(a1),a2.render.process(a1),a1.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,bg.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(eZ),this.sharedNodes.forEach(e5)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,a_.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){a_.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){!this.snapshot&&this.instance&&(this.snapshot=this.measure(),!this.snapshot||dY(this.snapshot.measuredBox.x)||dY(this.snapshot.measuredBox.y)||(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let a=0;a<this.path.length;a++)this.path[a].updateScroll();let a=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected=au(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);let{visualElement:b}=this.options;b&&b.notify("LayoutMeasure",this.layout.layoutBox,a?a.layoutBox:void 0)}updateScroll(a="measure"){let b=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===a&&(b=!1),b&&this.instance){let b=d(this.instance);this.scroll={animationId:this.root.animationId,phase:a,isRoot:b,offset:c(this.instance),wasRoot:this.scroll?this.scroll.isRoot:b}}}resetTransform(){if(!e)return;let a=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,b=this.projectionDelta&&!ez(this.projectionDelta),c=this.getTransformTemplate(),d=c?c(this.latestValues,""):void 0,f=d!==this.prevTransformTemplateValue;a&&this.instance&&(b||bX(this.latestValues)||f)&&(e(this.instance,d),this.shouldResetTransform=!1,this.scheduleRender())}measure(a=!0){var b;let c=this.measurePageBox(),d=this.removeElementScroll(c);return a&&(d=this.removeTransform(d)),fc((b=d).x),fc(b.y),{animationId:this.root.animationId,measuredBox:c,layoutBox:d,latestValues:{},source:this.id}}measurePageBox(){let{visualElement:a}=this.options;if(!a)return au();let b=a.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(fe))){let{scroll:a}=this.root;a&&(b0(b.x,a.offset.x),b0(b.y,a.offset.y))}return b}removeElementScroll(a){let b=au();if(ew(b,a),this.scroll?.wasRoot)return b;for(let c=0;c<this.path.length;c++){let d=this.path[c],{scroll:e,options:f}=d;d!==this.root&&e&&f.layoutScroll&&(e.wasRoot&&ew(b,a),b0(b.x,e.offset.x),b0(b.y,e.offset.y))}return b}applyTransform(a,b=!1){let c=au();ew(c,a);for(let a=0;a<this.path.length;a++){let d=this.path[a];!b&&d.options.layoutScroll&&d.scroll&&d!==d.root&&b2(c,{x:-d.scroll.offset.x,y:-d.scroll.offset.y}),bX(d.latestValues)&&b2(c,d.latestValues)}return bX(this.latestValues)&&b2(c,this.latestValues),c}removeTransform(a){let b=au();ew(b,a);for(let a=0;a<this.path.length;a++){let c=this.path[a];if(!c.instance||!bX(c.latestValues))continue;bW(c.latestValues)&&c.updateSnapshot();let d=au();ew(d,c.measurePageBox()),eu(b,c.latestValues,c.snapshot?c.snapshot.layoutBox:void 0,d)}return bX(this.latestValues)&&eu(b,this.latestValues),b}setTargetDelta(a){this.targetDelta=a,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(a){this.options={...this.options,...a,crossfade:void 0===a.crossfade||a.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==a1.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(a=!1){let b=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=b.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=b.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=b.isSharedProjectionDirty);let c=!!this.resumingFrom||this!==b;if(!(a||c&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;let{layout:d,layoutId:e}=this.options;if(!this.layout||!(d||e))return;this.resolvedRelativeTargetAt=a1.timestamp;let f=this.getClosestProjectingParent();if(f&&this.linkedParentVersion!==f.layoutVersion&&!f.options.layoutRoot&&this.removeRelativeTarget(),this.targetDelta||this.relativeTarget||(f&&f.layout?this.createRelativeTarget(f,this.layout.layoutBox,f.layout.layoutBox):this.removeRelativeTarget()),this.relativeTarget||this.targetDelta){if(this.target||(this.target=au(),this.targetWithTransforms=au()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target){var g,h,i;this.forceRelativeParentToResolveTarget(),g=this.target,h=this.relativeTarget,i=this.relativeParent.target,d_(g.x,h.x,i.x),d_(g.y,h.y,i.y)}else this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):ew(this.target,this.layout.layoutBox),b_(this.target,this.targetDelta)):ew(this.target,this.layout.layoutBox);this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,f&&!!f.resumingFrom==!!this.resumingFrom&&!f.options.layoutScroll&&f.target&&1!==this.animationProgress?this.createRelativeTarget(f,this.target,f.target):this.relativeParent=this.relativeTarget=void 0)}}getClosestProjectingParent(){if(!(!this.parent||bW(this.parent.latestValues)||bY(this.parent.latestValues)))if(this.parent.isProjecting())return this.parent;else return this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(a,b,c){this.relativeParent=a,this.linkedParentVersion=a.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=au(),this.relativeTargetOrigin=au(),d1(this.relativeTargetOrigin,b,c),ew(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){let a=this.getLead(),b=!!this.resumingFrom||this!==a,c=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(c=!1),b&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(c=!1),this.resolvedRelativeTargetAt===a1.timestamp&&(c=!1),c)return;let{layout:d,layoutId:e}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(d||e))return;ew(this.layoutCorrected,this.layout.layoutBox);let f=this.treeScale.x,g=this.treeScale.y;!function(a,b,c,d=!1){let e,f,g=c.length;if(g){b.x=b.y=1;for(let h=0;h<g;h++){f=(e=c[h]).projectionDelta;let{visualElement:g}=e.options;(!g||!g.props.style||"contents"!==g.props.style.display)&&(d&&e.options.layoutScroll&&e.scroll&&e!==e.root&&b2(a,{x:-e.scroll.offset.x,y:-e.scroll.offset.y}),f&&(b.x*=f.x.scale,b.y*=f.y.scale,b_(a,f)),d&&bX(e.latestValues)&&b2(a,e.latestValues))}b.x<1.0000000000001&&b.x>.999999999999&&(b.x=1),b.y<1.0000000000001&&b.y>.999999999999&&(b.y=1)}}(this.layoutCorrected,this.treeScale,this.path,b),a.layout&&!a.target&&(1!==this.treeScale.x||1!==this.treeScale.y)&&(a.target=a.layout.layoutBox,a.targetWithTransforms=au());let{target:h}=a;if(!h){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}this.projectionDelta&&this.prevProjectionDelta?(ex(this.prevProjectionDelta.x,this.projectionDelta.x),ex(this.prevProjectionDelta.y,this.projectionDelta.y)):this.createProjectionDeltas(),d$(this.projectionDelta,this.layoutCorrected,h,this.latestValues),this.treeScale.x===f&&this.treeScale.y===g&&eE(this.projectionDelta.x,this.prevProjectionDelta.x)&&eE(this.projectionDelta.y,this.prevProjectionDelta.y)||(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",h))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(a=!0){if(this.options.visualElement?.scheduleRender(),a){let a=this.getStack();a&&a.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=as(),this.projectionDelta=as(),this.projectionDeltaWithTransform=as()}setAnimationOrigin(a,b=!1){let c,d=this.snapshot,e=d?d.latestValues:{},f={...this.latestValues},g=as();this.relativeParent&&this.relativeParent.options.layoutRoot||(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!b;let h=au(),i=(d?d.source:void 0)!==(this.layout?this.layout.source:void 0),j=this.getStack(),k=!j||j.members.length<=1,l=!!(i&&!k&&!0===this.options.crossfade&&!this.path.some(e8));this.animationProgress=0,this.mixTargetDelta=b=>{let d=b/1e3;if(e6(g.x,a.x,d),e6(g.y,a.y,d),this.setTargetDelta(g),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout){var j,m,n,o,p,q;d1(h,this.layout.layoutBox,this.relativeParent.layout.layoutBox),n=this.relativeTarget,o=this.relativeTargetOrigin,p=h,q=d,e7(n.x,o.x,p.x,q),e7(n.y,o.y,p.y,q),c&&(j=this.relativeTarget,m=c,eA(j.x,m.x)&&eA(j.y,m.y))&&(this.isProjectionDirty=!1),c||(c=au()),ew(c,this.relativeTarget)}i&&(this.animationValues=f,function(a,b,c,d,e,f){e?(a.opacity=bO(0,c.opacity??1,eK(d)),a.opacityExit=bO(b.opacity??1,0,eL(d))):f&&(a.opacity=bO(b.opacity??1,c.opacity??1,d));for(let e=0;e<eG;e++){let f=`border${eF[e]}Radius`,g=eJ(b,f),h=eJ(c,f);(void 0!==g||void 0!==h)&&(g||(g=0),h||(h=0),0===g||0===h||eI(g)===eI(h)?(a[f]=Math.max(bO(eH(g),eH(h),d),0),(V.test(h)||V.test(g))&&(a[f]+="%")):a[f]=h)}(b.rotate||c.rotate)&&(a.rotate=bO(b.rotate||0,c.rotate||0,d))}(f,e,this.latestValues,d,l,k)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=d},this.mixTargetDelta(1e3*!!this.options.layoutRoot)}startAnimation(a){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(a0(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=a_.update(()=>{var b,c,d;let e;el.hasAnimatedSinceResize=!0,cy.layout++,this.motionValue||(this.motionValue=bk(0)),this.currentAnimation=(b=this.motionValue,c=[0,1e3],d={...a,velocity:0,isSync:!0,onUpdate:b=>{this.mixTargetDelta(b),a.onUpdate&&a.onUpdate(b)},onStop:()=>{cy.layout--},onComplete:()=>{cy.layout--,a.onComplete&&a.onComplete(),this.completeAnimation()}},(e=av(b)?b:bk(b)).start(dI("",e,c,d)),e.animation),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);let a=this.getStack();a&&a.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(1e3),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){let a=this.getLead(),{targetWithTransforms:b,target:c,layout:d,latestValues:e}=a;if(b&&c&&d){if(this!==a&&this.layout&&d&&fd(this.options.animationType,this.layout.layoutBox,d.layoutBox)){c=this.target||au();let b=dY(this.layout.layoutBox.x);c.x.min=a.target.x.min,c.x.max=c.x.min+b;let d=dY(this.layout.layoutBox.y);c.y.min=a.target.y.min,c.y.max=c.y.min+d}ew(b,c),b2(b,e),d$(this.projectionDeltaWithTransform,this.layoutCorrected,b,e)}}registerSharedNode(a,b){this.sharedNodes.has(a)||this.sharedNodes.set(a,new eQ),this.sharedNodes.get(a).add(b);let c=b.options.initialPromotionConfig;b.promote({transition:c?c.transition:void 0,preserveFollowOpacity:c&&c.shouldPreserveFollowOpacity?c.shouldPreserveFollowOpacity(b):void 0})}isLead(){let a=this.getStack();return!a||a.lead===this}getLead(){let{layoutId:a}=this.options;return a&&this.getStack()?.lead||this}getPrevLead(){let{layoutId:a}=this.options;return a?this.getStack()?.prevLead:void 0}getStack(){let{layoutId:a}=this.options;if(a)return this.root.sharedNodes.get(a)}promote({needsReset:a,transition:b,preserveFollowOpacity:c}={}){let d=this.getStack();d&&d.promote(this,c),a&&(this.projectionDelta=void 0,this.needsReset=!0),b&&this.setOptions({transition:b})}relegate(){let a=this.getStack();return!!a&&a.relegate(this)}resetSkewAndRotation(){let{visualElement:a}=this.options;if(!a)return;let b=!1,{latestValues:c}=a;if((c.z||c.rotate||c.rotateX||c.rotateY||c.rotateZ||c.skewX||c.skewY)&&(b=!0),!b)return;let d={};c.z&&eT("z",a,d,this.animationValues);for(let b=0;b<eR.length;b++)eT(`rotate${eR[b]}`,a,d,this.animationValues),eT(`skew${eR[b]}`,a,d,this.animationValues);for(let b in a.render(),d)a.setStaticValue(b,d[b]),this.animationValues&&(this.animationValues[b]=d[b]);a.scheduleRender()}applyProjectionStyles(a,b){if(!this.instance||this.isSVG)return;if(!this.isVisible){a.visibility="hidden";return}let c=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,a.visibility="",a.opacity="",a.pointerEvents=cf(b?.pointerEvents)||"",a.transform=c?c(this.latestValues,""):"none";return}let d=this.getLead();if(!this.projectionDelta||!this.layout||!d.target){this.options.layoutId&&(a.opacity=void 0!==this.latestValues.opacity?this.latestValues.opacity:1,a.pointerEvents=cf(b?.pointerEvents)||""),this.hasProjected&&!bX(this.latestValues)&&(a.transform=c?c({},""):"none",this.hasProjected=!1);return}a.visibility="";let e=d.animationValues||d.latestValues;this.applyTransformsToTarget();let f=function(a,b,c){let d="",e=a.x.translate/b.x,f=a.y.translate/b.y,g=c?.z||0;if((e||f||g)&&(d=`translate3d(${e}px, ${f}px, ${g}px) `),(1!==b.x||1!==b.y)&&(d+=`scale(${1/b.x}, ${1/b.y}) `),c){let{transformPerspective:a,rotate:b,rotateX:e,rotateY:f,skewX:g,skewY:h}=c;a&&(d=`perspective(${a}px) ${d}`),b&&(d+=`rotate(${b}deg) `),e&&(d+=`rotateX(${e}deg) `),f&&(d+=`rotateY(${f}deg) `),g&&(d+=`skewX(${g}deg) `),h&&(d+=`skewY(${h}deg) `)}let h=a.x.scale*b.x,i=a.y.scale*b.y;return(1!==h||1!==i)&&(d+=`scale(${h}, ${i})`),d||"none"}(this.projectionDeltaWithTransform,this.treeScale,e);c&&(f=c(e,f)),a.transform=f;let{x:g,y:h}=this.projectionDelta;for(let b in a.transformOrigin=`${100*g.origin}% ${100*h.origin}% 0`,d.animationValues?a.opacity=d===this?e.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:e.opacityExit:a.opacity=d===this?void 0!==e.opacity?e.opacity:"":void 0!==e.opacityExit?e.opacityExit:0,bP){if(void 0===e[b])continue;let{correct:c,applyTo:g,isCSSVariable:h}=bP[b],i="none"===f?e[b]:c(e[b],d);if(g){let b=g.length;for(let c=0;c<b;c++)a[g[c]]=i}else h?this.options.visualElement.renderState.vars[b]=i:a[b]=i}this.options.layoutId&&(a.pointerEvents=d===this?cf(b?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(a=>a.currentAnimation?.stop()),this.root.nodes.forEach(e$),this.root.sharedNodes.clear()}}}function eV(a){a.updateLayout()}function eW(a){let b=a.resumeFrom?.snapshot||a.snapshot;if(a.isLead()&&a.layout&&b&&a.hasListeners("didUpdate")){let{layoutBox:c,measuredBox:d}=a.layout,{animationType:e}=a.options,f=b.source!==a.layout.source;"size"===e?dT(a=>{let d=f?b.measuredBox[a]:b.layoutBox[a],e=dY(d);d.min=c[a].min,d.max=d.min+e}):fd(e,b.layoutBox,c)&&dT(d=>{let e=f?b.measuredBox[d]:b.layoutBox[d],g=dY(c[d]);e.max=e.min+g,a.relativeTarget&&!a.currentAnimation&&(a.isProjectionDirty=!0,a.relativeTarget[d].max=a.relativeTarget[d].min+g)});let g=as();d$(g,c,b.layoutBox);let h=as();f?d$(h,a.applyTransform(d,!0),b.measuredBox):d$(h,c,b.layoutBox);let i=!ez(g),j=!1;if(!a.resumeFrom){let d=a.getClosestProjectingParent();if(d&&!d.resumeFrom){let{snapshot:e,layout:f}=d;if(e&&f){let g=au();d1(g,b.layoutBox,e.layoutBox);let h=au();d1(h,c,f.layoutBox),eC(g,h)||(j=!0),d.options.layoutRoot&&(a.relativeTarget=h,a.relativeTargetOrigin=g,a.relativeParent=d)}}}a.notifyListeners("didUpdate",{layout:c,snapshot:b,delta:h,layoutDelta:g,hasLayoutChanged:i,hasRelativeLayoutChanged:j})}else if(a.isLead()){let{onExitComplete:b}=a.options;b&&b()}a.options.transition=void 0}function eX(a){a.parent&&(a.isProjecting()||(a.isProjectionDirty=a.parent.isProjectionDirty),a.isSharedProjectionDirty||(a.isSharedProjectionDirty=!!(a.isProjectionDirty||a.parent.isProjectionDirty||a.parent.isSharedProjectionDirty)),a.isTransformDirty||(a.isTransformDirty=a.parent.isTransformDirty))}function eY(a){a.isProjectionDirty=a.isSharedProjectionDirty=a.isTransformDirty=!1}function eZ(a){a.clearSnapshot()}function e$(a){a.clearMeasurements()}function e_(a){a.isLayoutDirty=!1}function e0(a){let{visualElement:b}=a.options;b&&b.getProps().onBeforeLayoutMeasure&&b.notify("BeforeLayoutMeasure"),a.resetTransform()}function e1(a){a.finishAnimation(),a.targetDelta=a.relativeTarget=a.target=void 0,a.isProjectionDirty=!0}function e2(a){a.resolveTargetDelta()}function e3(a){a.calcProjection()}function e4(a){a.resetSkewAndRotation()}function e5(a){a.removeLeadSnapshot()}function e6(a,b,c){a.translate=bO(b.translate,0,c),a.scale=bO(b.scale,1,c),a.origin=b.origin,a.originPoint=b.originPoint}function e7(a,b,c,d){a.min=bO(b.min,c.min,d),a.max=bO(b.max,c.max,d)}function e8(a){return a.animationValues&&void 0!==a.animationValues.opacityExit}let e9={duration:.45,ease:[.4,0,.1,1]},fa=a=>"u">typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(a),fb=fa("applewebkit/")&&!fa("chrome/")?Math.round:aX;function fc(a){a.min=fb(a.min),a.max=fb(a.max)}function fd(a,b,c){return"position"===a||"preserve-aspect"===a&&!(.2>=Math.abs(eD(b)-eD(c)))}function fe(a){return a!==a.root&&a.scroll?.wasRoot}let ff=eU({attachResizeListener:(a,b)=>dW(a,"resize",b),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),fg={current:void 0},fh=eU({measureScroll:a=>({x:a.scrollLeft,y:a.scrollTop}),defaultParent:()=>{if(!fg.current){let a=new ff({});a.mount(window),a.setOptions({layoutScroll:!0}),fg.current=a}return fg.current},resetTransform:(a,b)=>{a.style.transform=void 0!==b?b:"none"},checkIsScrollRoot:a=>"fixed"===window.getComputedStyle(a).position});function fi(a,b){let c=function(a,b,c){if(null==a)return[];if(a instanceof EventTarget)return[a];if("string"==typeof a){let b=document,c=(void 0)??b.querySelectorAll(a);return c?Array.from(c):[]}return Array.from(a).filter(a=>null!=a)}(a),d=new AbortController;return[c,{passive:!0,...b,signal:d.signal},()=>d.abort()]}function fj(a){return!("touch"===a.pointerType||dX.x||dX.y)}function fk(a,b,c){let{props:d}=a;a.animationState&&d.whileHover&&a.animationState.setActive("whileHover","Start"===c);let e=d["onHover"+c];e&&a_.postRender(()=>e(b,d3(b)))}let fl=(a,b)=>!!b&&(a===b||fl(a,b.parentElement)),fm=new WeakSet;function fn(a){return b=>{"Enter"===b.key&&a(b)}}function fo(a,b){a.dispatchEvent(new PointerEvent("pointer"+b,{isPrimary:!0,bubbles:!0}))}function fp(a){return d2(a)&&!(dX.x||dX.y)}function fq(a,b,c){let{props:d}=a;if(a.current instanceof HTMLButtonElement&&a.current.disabled)return;a.animationState&&d.whileTap&&a.animationState.setActive("whileTap","Start"===c);let e=d["onTap"+("End"===c?"":c)];e&&a_.postRender(()=>e(b,d3(b)))}let fr=new WeakMap,fs=new WeakMap,ft=a=>{let b=fr.get(a.target);b&&b(a)},fu=a=>{a.forEach(ft)},fv={some:0,all:1},fw=function(a,b){if("u"<typeof Proxy)return cp;let c=new Map,d=(c,d)=>cp(c,d,a,b);return new Proxy((a,b)=>d(a,b),{get:(e,f)=>"create"===f?d:(c.has(f)||c.set(f,cp(f,void 0,a,b)),c.get(f))})}({animation:{Feature:class extends cq{constructor(a){super(a),a.animationState||(a.animationState=function(a){let b=b=>Promise.all(b.map(({animation:b,options:c})=>(function(a,b,c={}){let d;if(a.notify("AnimationStart",b),Array.isArray(b))d=Promise.all(b.map(b=>dL(a,b,c)));else if("string"==typeof b)d=dL(a,b,c);else{let e="function"==typeof b?cr(a,b,c.custom):b;d=Promise.all(dJ(a,e,c))}return d.then(()=>{a.notify("AnimationComplete",b)})})(a,b,c))),c=dR(),d=!0,e=b=>(c,d)=>{let e=cr(a,d,"exit"===b?a.presenceContext?.custom:void 0);if(e){let{transition:a,transitionEnd:b,...d}=e;c={...c,...d,...b}}return c};function f(f){let{props:g}=a,h=function a(b){if(!b)return;if(!b.isControllingVariants){let c=b.parent&&a(b.parent)||{};return void 0!==b.props.initial&&(c.initial=b.props.initial),c}let c={};for(let a=0;a<dM;a++){let d=br[a],e=b.props[d];(bp(e)||!1===e)&&(c[d]=e)}return c}(a.parent)||{},i=[],j=new Set,k={},l=1/0;for(let b=0;b<dP;b++){var m,n;let o=dO[b],p=c[o],q=void 0!==g[o]?g[o]:h[o],r=bp(q),s=o===f?p.isActive:null;!1===s&&(l=b);let t=q===h[o]&&q!==g[o]&&r;if(t&&d&&a.manuallyAnimateOnMount&&(t=!1),p.protectedKeys={...k},!p.isActive&&null===s||!q&&!p.prevProp||bo(q)||"boolean"==typeof q)continue;let u=(m=p.prevProp,"string"==typeof(n=q)?n!==m:!!Array.isArray(n)&&!dN(n,m)),v=u||o===f&&p.isActive&&!t&&r||b>l&&r,w=!1,x=Array.isArray(q)?q:[q],y=x.reduce(e(o),{});!1===s&&(y={});let{prevResolvedValues:z={}}=p,A={...z,...y},B=b=>{v=!0,j.has(b)&&(w=!0,j.delete(b)),p.needsAnimating[b]=!0;let c=a.getValue(b);c&&(c.liveStyle=!1)};for(let a in A){let b=y[a],c=z[a];if(!k.hasOwnProperty(a))(ct(b)&&ct(c)?dN(b,c):b===c)?void 0!==b&&j.has(a)?B(a):p.protectedKeys[a]=!0:null!=b?B(a):j.add(a)}p.prevProp=q,p.prevResolvedValues=y,p.isActive&&(k={...k,...y}),d&&a.blockInitialAnimation&&(v=!1);let C=t&&u,D=!C||w;v&&D&&i.push(...x.map(b=>{let c={type:o};if("string"==typeof b&&d&&!C&&a.manuallyAnimateOnMount&&a.parent){let{parent:d}=a,e=cr(d,b);if(d.enteringChildren&&e){let{delayChildren:b}=e.transition||{};c.delay=dK(d.enteringChildren,a,b)}}return{animation:b,options:c}}))}if(j.size){let b={};if("boolean"!=typeof g.initial){let c=cr(a,Array.isArray(g.initial)?g.initial[0]:g.initial);c&&c.transition&&(b.transition=c.transition)}j.forEach(c=>{let d=a.getBaseTarget(c),e=a.getValue(c);e&&(e.liveStyle=!0),b[c]=d??null}),i.push({animation:b})}let o=!!i.length;return d&&(!1===g.initial||g.initial===g.animate)&&!a.manuallyAnimateOnMount&&(o=!1),d=!1,o?b(i):Promise.resolve()}return{animateChanges:f,setActive:function(b,d){if(c[b].isActive===d)return Promise.resolve();a.variantChildren?.forEach(a=>a.animationState?.setActive(b,d)),c[b].isActive=d;let e=f(b);for(let a in c)c[a].protectedKeys={};return e},setAnimateFunction:function(c){b=c(a)},getState:()=>c,reset:()=>{c=dR()}}}(a))}updateAnimationControlsSubscription(){let{animate:a}=this.node.getProps();bo(a)&&(this.unmountControls=a.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){let{animate:a}=this.node.getProps(),{animate:b}=this.node.prevProps||{};a!==b&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}},exit:{Feature:class extends cq{constructor(){super(...arguments),this.id=dS++}update(){if(!this.node.presenceContext)return;let{isPresent:a,onExitComplete:b}=this.node.presenceContext,{isPresent:c}=this.node.prevPresenceContext||{};if(!this.node.animationState||a===c)return;let d=this.node.animationState.setActive("exit",!a);b&&!a&&d.then(()=>{b(this.id)})}mount(){let{register:a,onExitComplete:b}=this.node.presenceContext||{};b&&b(this.id),a&&(this.unmount=a(this.id))}unmount(){}}},inView:{Feature:class extends cq{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){var a;let b;this.unmount();let{viewport:c={}}=this.node.getProps(),{root:d,margin:e,amount:f="some",once:g}=c,h={root:d?d.current:void 0,rootMargin:e,threshold:"number"==typeof f?f:fv[f]},i=a=>{let{isIntersecting:b}=a;if(this.isInView===b||(this.isInView=b,g&&!b&&this.hasEnteredView))return;b&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",b);let{onViewportEnter:c,onViewportLeave:d}=this.node.getProps(),e=b?c:d;e&&e(a)};return a=this.node.current,b=function({root:a,...b}){let c=a||document;fs.has(c)||fs.set(c,{});let d=fs.get(c),e=JSON.stringify(b);return d[e]||(d[e]=new IntersectionObserver(fu,{root:a,...b})),d[e]}(h),fr.set(a,i),b.observe(a),()=>{fr.delete(a),b.unobserve(a)}}mount(){this.startObserver()}update(){if("u"<typeof IntersectionObserver)return;let{props:a,prevProps:b}=this.node;["amount","margin","root"].some(function({viewport:a={}},{viewport:b={}}={}){return c=>a[c]!==b[c]}(a,b))&&this.startObserver()}unmount(){}}},tap:{Feature:class extends cq{mount(){let{current:a}=this.node;a&&(this.unmount=function(a,b,c={}){let[d,e,f]=fi(a,c),g=a=>{let d=a.currentTarget;if(!fp(a))return;fm.add(d);let f=b(d,a),g=(a,b)=>{window.removeEventListener("pointerup",h),window.removeEventListener("pointercancel",i),fm.has(d)&&fm.delete(d),fp(a)&&"function"==typeof f&&f(a,{success:b})},h=a=>{g(a,d===window||d===document||c.useGlobalTarget||fl(d,a.target))},i=a=>{g(a,!1)};window.addEventListener("pointerup",h,e),window.addEventListener("pointercancel",i,e)};return d.forEach(a=>{(c.useGlobalTarget?window:a).addEventListener("pointerdown",g,e),t(a)&&(a.addEventListener("focus",a=>((a,b)=>{let c=a.currentTarget;if(!c)return;let d=fn(()=>{if(fm.has(c))return;fo(c,"down");let a=fn(()=>{fo(c,"up")});c.addEventListener("keyup",a,b),c.addEventListener("blur",()=>fo(c,"cancel"),b)});c.addEventListener("keydown",d,b),c.addEventListener("blur",()=>c.removeEventListener("keydown",d),b)})(a,e)),dV(a)||a.hasAttribute("tabindex")||(a.tabIndex=0))}),f}(a,(a,b)=>(fq(this.node,b,"Start"),(a,{success:b})=>fq(this.node,a,b?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}},focus:{Feature:class extends cq{constructor(){super(...arguments),this.isActive=!1}onFocus(){let a=!1;try{a=this.node.current.matches(":focus-visible")}catch(b){a=!0}a&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){this.isActive&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=cx(dW(this.node.current,"focus",()=>this.onFocus()),dW(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}},hover:{Feature:class extends cq{mount(){let{current:a}=this.node;a&&(this.unmount=function(a,b,c={}){let[d,e,f]=fi(a,c),g=a=>{if(!fj(a))return;let{target:c}=a,d=b(c,a);if("function"!=typeof d||!c)return;let f=a=>{fj(a)&&(d(a),c.removeEventListener("pointerleave",f))};c.addEventListener("pointerleave",f,e)};return d.forEach(a=>{a.addEventListener("pointerenter",g,e)}),f}(a,(a,b)=>(fk(this.node,b,"Start"),a=>fk(this.node,a,"End"))))}unmount(){}}},pan:{Feature:class extends cq{constructor(){super(...arguments),this.removePointerDownListener=aX}onPointerDown(a){this.session=new d8(a,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:d5(this.node)})}createPanHandlers(){let{onPanSessionStart:a,onPanStart:b,onPan:c,onPanEnd:d}=this.node.getProps();return{onSessionStart:ek(a),onStart:ek(b),onMove:c,onEnd:(a,b)=>{delete this.session,d&&a_.postRender(()=>d(a,b))}}}mount(){this.removePointerDownListener=d4(this.node.current,"pointerdown",a=>this.onPointerDown(a))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}},drag:{Feature:class extends cq{constructor(a){super(a),this.removeGroupControls=aX,this.removeListeners=aX,this.controls=new ei(a)}mount(){let{dragControls:a}=this.node.getProps();a&&(this.removeGroupControls=a.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||aX}update(){let{dragControls:a}=this.node.getProps(),{dragControls:b}=this.node.prevProps||{};a!==b&&(this.removeGroupControls(),a&&(this.removeGroupControls=a.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}},ProjectionNode:fh,MeasureLayout:ep},layout:{ProjectionNode:fh,MeasureLayout:ep}},(a,b)=>b.isSVG??b6(a)?new bT(b):new b4(b,{allowProjection:a!==n.Fragment}));var fx=a.i(96924),fy=a.i(7903),fz=a.i(98416),fA=a.i(30112),fB=a.i(16347),fC=a.i(60087),fD=a.i(15896),fE=a.i(2655),fF=class extends fB.Subscribable{constructor(a,b){super(),this.options=b,this.#a=a,this.#b=null,this.#c=(0,fC.pendingThenable)(),this.bindMethods(),this.setOptions(b)}#a;#d=void 0;#e=void 0;#f=void 0;#g;#h;#c;#b;#i;#j;#k;#l;#m;#n;#o=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(this.#d.addObserver(this),fG(this.#d,this.options)?this.#p():this.updateResult(),this.#q())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return fH(this.#d,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return fH(this.#d,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#r(),this.#s(),this.#d.removeObserver(this)}setOptions(a){let b=this.options,c=this.#d;if(this.options=this.#a.defaultQueryOptions(a),void 0!==this.options.enabled&&"boolean"!=typeof this.options.enabled&&"function"!=typeof this.options.enabled&&"boolean"!=typeof(0,fD.resolveEnabled)(this.options.enabled,this.#d))throw Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#t(),this.#d.setOptions(this.options),b._defaulted&&!(0,fD.shallowEqualObjects)(this.options,b)&&this.#a.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#d,observer:this});let d=this.hasListeners();d&&fI(this.#d,c,this.options,b)&&this.#p(),this.updateResult(),d&&(this.#d!==c||(0,fD.resolveEnabled)(this.options.enabled,this.#d)!==(0,fD.resolveEnabled)(b.enabled,this.#d)||(0,fD.resolveStaleTime)(this.options.staleTime,this.#d)!==(0,fD.resolveStaleTime)(b.staleTime,this.#d))&&this.#u();let e=this.#v();d&&(this.#d!==c||(0,fD.resolveEnabled)(this.options.enabled,this.#d)!==(0,fD.resolveEnabled)(b.enabled,this.#d)||e!==this.#n)&&this.#w(e)}getOptimisticResult(a){var b,c;let d=this.#a.getQueryCache().build(this.#a,a),e=this.createResult(d,a);return b=this,c=e,(0,fD.shallowEqualObjects)(b.getCurrentResult(),c)||(this.#f=e,this.#h=this.options,this.#g=this.#d.state),e}getCurrentResult(){return this.#f}trackResult(a,b){return new Proxy(a,{get:(a,c)=>(this.trackProp(c),b?.(c),"promise"===c&&(this.trackProp("data"),this.options.experimental_prefetchInRender||"pending"!==this.#c.status||this.#c.reject(Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(a,c))})}trackProp(a){this.#o.add(a)}getCurrentQuery(){return this.#d}refetch({...a}={}){return this.fetch({...a})}fetchOptimistic(a){let b=this.#a.defaultQueryOptions(a),c=this.#a.getQueryCache().build(this.#a,b);return c.fetch().then(()=>this.createResult(c,b))}fetch(a){return this.#p({...a,cancelRefetch:a.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#f))}#p(a){this.#t();let b=this.#d.fetch(this.options,a);return a?.throwOnError||(b=b.catch(fD.noop)),b}#u(){this.#r();let a=(0,fD.resolveStaleTime)(this.options.staleTime,this.#d);if(fD.isServer||this.#f.isStale||!(0,fD.isValidTimeout)(a))return;let b=(0,fD.timeUntilStale)(this.#f.dataUpdatedAt,a);this.#l=fE.timeoutManager.setTimeout(()=>{this.#f.isStale||this.updateResult()},b+1)}#v(){return("function"==typeof this.options.refetchInterval?this.options.refetchInterval(this.#d):this.options.refetchInterval)??!1}#w(a){this.#s(),this.#n=a,!fD.isServer&&!1!==(0,fD.resolveEnabled)(this.options.enabled,this.#d)&&(0,fD.isValidTimeout)(this.#n)&&0!==this.#n&&(this.#m=fE.timeoutManager.setInterval(()=>{(this.options.refetchIntervalInBackground||fy.focusManager.isFocused())&&this.#p()},this.#n))}#q(){this.#u(),this.#w(this.#v())}#r(){this.#l&&(fE.timeoutManager.clearTimeout(this.#l),this.#l=void 0)}#s(){this.#m&&(fE.timeoutManager.clearInterval(this.#m),this.#m=void 0)}createResult(a,b){let c,d=this.#d,e=this.options,f=this.#f,g=this.#g,h=this.#h,i=a!==d?a.state:this.#e,{state:j}=a,k={...j},l=!1;if(b._optimisticResults){let c=this.hasListeners(),f=!c&&fG(a,b),g=c&&fI(a,d,b,e);(f||g)&&(k={...k,...(0,fA.fetchState)(j.data,a.options)}),"isRestoring"===b._optimisticResults&&(k.fetchStatus="idle")}let{error:m,errorUpdatedAt:n,status:o}=k;c=k.data;let p=!1;if(void 0!==b.placeholderData&&void 0===c&&"pending"===o){let a;f?.isPlaceholderData&&b.placeholderData===h?.placeholderData?(a=f.data,p=!0):a="function"==typeof b.placeholderData?b.placeholderData(this.#k?.state.data,this.#k):b.placeholderData,void 0!==a&&(o="success",c=(0,fD.replaceData)(f?.data,a,b),l=!0)}if(b.select&&void 0!==c&&!p)if(f&&c===g?.data&&b.select===this.#i)c=this.#j;else try{this.#i=b.select,c=b.select(c),c=(0,fD.replaceData)(f?.data,c,b),this.#j=c,this.#b=null}catch(a){this.#b=a}this.#b&&(m=this.#b,c=this.#j,n=Date.now(),o="error");let q="fetching"===k.fetchStatus,r="pending"===o,s="error"===o,t=r&&q,u=void 0!==c,v={status:o,fetchStatus:k.fetchStatus,isPending:r,isSuccess:"success"===o,isError:s,isInitialLoading:t,isLoading:t,data:c,dataUpdatedAt:k.dataUpdatedAt,error:m,errorUpdatedAt:n,failureCount:k.fetchFailureCount,failureReason:k.fetchFailureReason,errorUpdateCount:k.errorUpdateCount,isFetched:k.dataUpdateCount>0||k.errorUpdateCount>0,isFetchedAfterMount:k.dataUpdateCount>i.dataUpdateCount||k.errorUpdateCount>i.errorUpdateCount,isFetching:q,isRefetching:q&&!r,isLoadingError:s&&!u,isPaused:"paused"===k.fetchStatus,isPlaceholderData:l,isRefetchError:s&&u,isStale:fJ(a,b),refetch:this.refetch,promise:this.#c,isEnabled:!1!==(0,fD.resolveEnabled)(b.enabled,a)};if(this.options.experimental_prefetchInRender){let b=void 0!==v.data,c="error"===v.status&&!b,e=a=>{c?a.reject(v.error):b&&a.resolve(v.data)},f=()=>{e(this.#c=v.promise=(0,fC.pendingThenable)())},g=this.#c;switch(g.status){case"pending":a.queryHash===d.queryHash&&e(g);break;case"fulfilled":(c||v.data!==g.value)&&f();break;case"rejected":c&&v.error===g.reason||f()}}return v}updateResult(){let a=this.#f,b=this.createResult(this.#d,this.options);if(this.#g=this.#d.state,this.#h=this.options,void 0!==this.#g.data&&(this.#k=this.#d),(0,fD.shallowEqualObjects)(b,a))return;this.#f=b;let c=()=>{if(!a)return!0;let{notifyOnChangeProps:b}=this.options,c="function"==typeof b?b():b;if("all"===c||!c&&!this.#o.size)return!0;let d=new Set(c??this.#o);return this.options.throwOnError&&d.add("error"),Object.keys(this.#f).some(b=>this.#f[b]!==a[b]&&d.has(b))};this.#x({listeners:c()})}#t(){let a=this.#a.getQueryCache().build(this.#a,this.options);if(a===this.#d)return;let b=this.#d;this.#d=a,this.#e=a.state,this.hasListeners()&&(b?.removeObserver(this),a.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#q()}#x(a){fz.notifyManager.batch(()=>{a.listeners&&this.listeners.forEach(a=>{a(this.#f)}),this.#a.getQueryCache().notify({query:this.#d,type:"observerResultsUpdated"})})}};function fG(a,b){return!1!==(0,fD.resolveEnabled)(b.enabled,a)&&void 0===a.state.data&&("error"!==a.state.status||!1!==b.retryOnMount)||void 0!==a.state.data&&fH(a,b,b.refetchOnMount)}function fH(a,b,c){if(!1!==(0,fD.resolveEnabled)(b.enabled,a)&&"static"!==(0,fD.resolveStaleTime)(b.staleTime,a)){let d="function"==typeof c?c(a):c;return"always"===d||!1!==d&&fJ(a,b)}return!1}function fI(a,b,c,d){return(a!==b||!1===(0,fD.resolveEnabled)(d.enabled,a))&&(!c.suspense||"error"!==a.state.status)&&fJ(a,c)}function fJ(a,b){return!1!==(0,fD.resolveEnabled)(b.enabled,a)&&a.isStaleByTime((0,fD.resolveStaleTime)(b.staleTime,a))}var fK=a.i(14220),fL=n.createContext((d=!1,{clearReset:()=>{d=!1},reset:()=>{d=!0},isReset:()=>d})),fM=n.createContext(!1);fM.Provider;var fN=(a,b,c)=>b.fetchOptimistic(a).catch(()=>{c.clearReset()});function fO(a,b){return function(a,b,c){let d,e=n.useContext(fM),f=n.useContext(fL),g=(0,fK.useQueryClient)(c),h=g.defaultQueryOptions(a);g.getDefaultOptions().queries?._experimental_beforeQuery?.(h);let i=g.getQueryCache().get(h.queryHash);if(h._optimisticResults=e?"isRestoring":"optimistic",h.suspense){let a=a=>"static"===a?a:Math.max(a??1e3,1e3),b=h.staleTime;h.staleTime="function"==typeof b?(...c)=>a(b(...c)):a(b),"number"==typeof h.gcTime&&(h.gcTime=Math.max(h.gcTime,1e3))}d=i?.state.error&&"function"==typeof h.throwOnError?(0,fD.shouldThrowError)(h.throwOnError,[i.state.error,i]):h.throwOnError,(h.suspense||h.experimental_prefetchInRender||d)&&!f.isReset()&&(h.retryOnMount=!1),n.useEffect(()=>{f.clearReset()},[f]);let j=!g.getQueryCache().get(h.queryHash),[k]=n.useState(()=>new b(g,h)),l=k.getOptimisticResult(h),m=!e&&!1!==a.subscribed;if(n.useSyncExternalStore(n.useCallback(a=>{let b=m?k.subscribe(fz.notifyManager.batchCalls(a)):fD.noop;return k.updateResult(),b},[k,m]),()=>k.getCurrentResult(),()=>k.getCurrentResult()),n.useEffect(()=>{k.setOptions(h)},[h,k]),h?.suspense&&l.isPending)throw fN(h,k,f);if((({result:a,errorResetBoundary:b,throwOnError:c,query:d,suspense:e})=>a.isError&&!b.isReset()&&!a.isFetching&&d&&(e&&void 0===a.data||(0,fD.shouldThrowError)(c,[a.error,d])))({result:l,errorResetBoundary:f,throwOnError:h.throwOnError,query:i,suspense:h.suspense}))throw l.error;if(g.getDefaultOptions().queries?._experimental_afterQuery?.(h,l),h.experimental_prefetchInRender&&!fD.isServer&&l.isLoading&&l.isFetching&&!e){let a=j?fN(h,k,f):i?.promise;a?.catch(fD.noop).finally(()=>{k.updateResult()})}return h.notifyOnChangeProps?l:k.trackResult(l)}(a,fF,b)}var fP=a.i(46674),fQ=fB,fR=class extends fQ.Subscribable{#a;#f=void 0;#y;#z;constructor(a,b){super(),this.#a=a,this.setOptions(b),this.bindMethods(),this.#A()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(a){let b=this.options;this.options=this.#a.defaultMutationOptions(a),(0,fD.shallowEqualObjects)(this.options,b)||this.#a.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#y,observer:this}),b?.mutationKey&&this.options.mutationKey&&(0,fD.hashKey)(b.mutationKey)!==(0,fD.hashKey)(this.options.mutationKey)?this.reset():this.#y?.state.status==="pending"&&this.#y.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#y?.removeObserver(this)}onMutationUpdate(a){this.#A(),this.#x(a)}getCurrentResult(){return this.#f}reset(){this.#y?.removeObserver(this),this.#y=void 0,this.#A(),this.#x()}mutate(a,b){return this.#z=b,this.#y?.removeObserver(this),this.#y=this.#a.getMutationCache().build(this.#a,this.options),this.#y.addObserver(this),this.#y.execute(a)}#A(){let a=this.#y?.state??(0,fP.getDefaultState)();this.#f={...a,isPending:"pending"===a.status,isSuccess:"success"===a.status,isError:"error"===a.status,isIdle:"idle"===a.status,mutate:this.mutate,reset:this.reset}}#x(a){fz.notifyManager.batch(()=>{if(this.#z&&this.hasListeners()){let b=this.#f.variables,c=this.#f.context,d={client:this.#a,meta:this.options.meta,mutationKey:this.options.mutationKey};if(a?.type==="success"){try{this.#z.onSuccess?.(a.data,b,c,d)}catch(a){Promise.reject(a)}try{this.#z.onSettled?.(a.data,null,b,c,d)}catch(a){Promise.reject(a)}}else if(a?.type==="error"){try{this.#z.onError?.(a.error,b,c,d)}catch(a){Promise.reject(a)}try{this.#z.onSettled?.(void 0,a.error,b,c,d)}catch(a){Promise.reject(a)}}}this.listeners.forEach(a=>{a(this.#f)})})}};function fS(a,b){let c=(0,fK.useQueryClient)(b),[d]=n.useState(()=>new fR(c,a));n.useEffect(()=>{d.setOptions(a)},[d,a]);let e=n.useSyncExternalStore(n.useCallback(a=>d.subscribe(fz.notifyManager.batchCalls(a)),[d]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),f=n.useCallback((a,b)=>{d.mutate(a,b).catch(fD.noop)},[d]);if(e.error&&(0,fD.shouldThrowError)(d.options.throwOnError,[e.error]))throw e.error;return{...e,mutate:f,mutateAsync:e.mutate}}let fT=process.env.NEXT_PUBLIC_API_URL||"http://localhost:3001",fU=null,fV=null;async function fW(){if(fU)return fU;if(fV)return fV;fV=(async()=>{let a=await fetch(`${fT}/api/auth/session-token`);if(!a.ok)throw Error((await a.json().catch(()=>({}))).error||"Failed to fetch session token");let{token:b}=await a.json();return fU=b,b})();try{return await fV}finally{fV=null}}async function fX(a,b){let c=await fW(),d=new Headers(b?.headers);return d.set("Authorization",`Bearer ${c}`),fetch(a,{...b,headers:d})}let fY=process.env.NEXT_PUBLIC_WS_URL||"ws://localhost:3001/ws/events",fZ=process.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";async function f$(a){let b=new URLSearchParams;a?.project&&b.set("project",a.project),a?.type&&b.set("type",a.type),a?.category&&b.set("category",a.category),a?.limit&&b.set("limit",a.limit.toString()),a?.offset&&b.set("offset",a.offset.toString()),a?.mode&&b.set("mode",a.mode),a?.query&&b.set("query",a.query);let c=await fetch(`${fZ}/api/memories?${b}`);if(!c.ok)throw Error("Failed to fetch memories");return c.json()}async function f_(a){let b=a?`?project=${a}`:"",c=await fetch(`${fZ}/api/stats${b}`);if(!c.ok)throw Error("Failed to fetch stats");return c.json()}async function f0(a){let b=a?`?project=${a}`:"",c=await fetch(`${fZ}/api/links${b}`);if(!c.ok)throw Error("Failed to fetch links");return c.json()}async function f1(){let a=await fetch(`${fZ}/api/projects`);if(!a.ok)throw Error("Failed to fetch projects");return a.json()}async function f2(a){let b=await fX(`${fZ}/api/memories/${a}/access`,{method:"POST"});if(!b.ok)throw Error("Failed to access memory");return b.json()}async function f3(){let a=await fX(`${fZ}/api/consolidate`,{method:"POST"});if(!a.ok)throw Error("Failed to consolidate");return a.json()}function f4(a){return fO({queryKey:["stats",a],queryFn:()=>f_(a),refetchInterval:3e4})}async function f5(){let a=await fetch(`${fZ}/api/control/status`);if(!a.ok)throw Error("Failed to fetch control status");return a.json()}async function f6(){let a=await fX(`${fZ}/api/control/pause`,{method:"POST"});if(!a.ok)throw Error("Failed to pause");return a.json()}async function f7(){let a=await fX(`${fZ}/api/control/resume`,{method:"POST"});if(!a.ok)throw Error("Failed to resume");return a.json()}async function f8(){let a=await fetch(`${fZ}/api/version`);if(!a.ok)throw Error("Failed to fetch version");return a.json()}async function f9(a,b){let c=await fX(`${fZ}/api/memories/${a}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)});if(!c.ok)throw Error("Failed to edit memory");return c.json()}async function ga(a){let b=await fX(`${fZ}/api/memories/${a}`,{method:"DELETE"});if(!b.ok)throw Error("Failed to delete memory");return b.json()}let gb=a=>{let b,c=new Set,d=(a,d)=>{let e="function"==typeof a?a(b):a;if(!Object.is(e,b)){let a=b;b=(null!=d?d:"object"!=typeof e||null===e)?e:Object.assign({},b,e),c.forEach(c=>c(b,a))}},e=()=>b,f={setState:d,getState:e,getInitialState:()=>g,subscribe:a=>(c.add(a),()=>c.delete(a))},g=b=a(d,e,f);return f},gc=a=>{let b=a?gb(a):gb,c=a=>(function(a,b=a=>a){let c=n.default.useSyncExternalStore(a.subscribe,n.default.useCallback(()=>b(a.getState()),[a,b]),n.default.useCallback(()=>b(a.getInitialState()),[a,b]));return n.default.useDebugValue(c),c})(b,a);return Object.assign(c,b),c},gd=(e=a=>({selectedMemory:null,setSelectedMemory:b=>a({selectedMemory:b}),selectedAuditEntry:null,setSelectedAuditEntry:b=>a({selectedAuditEntry:b}),viewMode:"shield",setViewMode:b=>a({viewMode:b}),typeFilter:null,categoryFilter:null,projectFilter:null,setTypeFilter:b=>a({typeFilter:b}),setCategoryFilter:b=>a({categoryFilter:b}),setProjectFilter:b=>a({projectFilter:b}),recentEvents:[],addEvent:b=>a(a=>({recentEvents:[b,...a.recentEvents].slice(0,50)})),clearEvents:()=>a({recentEvents:[]}),cameraPosition:[0,0,12],setCameraPosition:b=>a({cameraPosition:b}),showLeftSidebar:!0,showRightSidebar:!0,toggleLeftSidebar:()=>a(a=>({showLeftSidebar:!a.showLeftSidebar})),toggleRightSidebar:()=>a(a=>({showRightSidebar:!a.showRightSidebar})),searchQuery:"",setSearchQuery:b=>a({searchQuery:b})}))?gc(e):gc;function ge(a,b=300){let[c,d]=(0,n.useState)(a);return(0,n.useEffect)(()=>{let c=setTimeout(()=>{d(a)},b);return()=>{clearTimeout(c)}},[a,b]),c}let gf=process.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";async function gg(a){if(!a||a.length<2)return[];let b=await fetch(`${gf}/api/suggestions?q=${encodeURIComponent(a)}&limit=8`);if(!b.ok)throw Error("Failed to fetch suggestions");return(await b.json()).suggestions}function gh(){for(var a,b,c=0,d="",e=arguments.length;c<e;c++)(a=arguments[c])&&(b=function a(b){var c,d,e="";if("string"==typeof b||"number"==typeof b)e+=b;else if("object"==typeof b)if(Array.isArray(b)){var f=b.length;for(c=0;c<f;c++)b[c]&&(d=a(b[c]))&&(e&&(e+=" "),e+=d)}else for(d in b)b[d]&&(e&&(e+=" "),e+=d);return e}(a))&&(d&&(d+=" "),d+=b);return d}let gi=(a=new Map,b=null,c)=>({nextPart:a,validators:b,classGroupId:c}),gj=[],gk=(a,b,c)=>{if(0==a.length-b)return c.classGroupId;let d=a[b],e=c.nextPart.get(d);if(e){let c=gk(a,b+1,e);if(c)return c}let f=c.validators;if(null===f)return;let g=0===b?a.join("-"):a.slice(b).join("-"),h=f.length;for(let a=0;a<h;a++){let b=f[a];if(b.validator(g))return b.classGroupId}},gl=(a,b)=>{let c=gi();for(let d in a)gm(a[d],c,d,b);return c},gm=(a,b,c,d)=>{let e=a.length;for(let f=0;f<e;f++)gn(a[f],b,c,d)},gn=(a,b,c,d)=>{"string"==typeof a?go(a,b,c):"function"==typeof a?gp(a,b,c,d):gq(a,b,c,d)},go=(a,b,c)=>{(""===a?b:gr(b,a)).classGroupId=c},gp=(a,b,c,d)=>{gs(a)?gm(a(d),b,c,d):(null===b.validators&&(b.validators=[]),b.validators.push({classGroupId:c,validator:a}))},gq=(a,b,c,d)=>{let e=Object.entries(a),f=e.length;for(let a=0;a<f;a++){let[f,g]=e[a];gm(g,gr(b,f),c,d)}},gr=(a,b)=>{let c=a,d=b.split("-"),e=d.length;for(let a=0;a<e;a++){let b=d[a],e=c.nextPart.get(b);e||(e=gi(),c.nextPart.set(b,e)),c=e}return c},gs=a=>"isThemeGetter"in a&&!0===a.isThemeGetter,gt=[],gu=(a,b,c,d,e)=>({modifiers:a,hasImportantModifier:b,baseClassName:c,maybePostfixModifierPosition:d,isExternal:e}),gv=/\s+/,gw=a=>{let b;if("string"==typeof a)return a;let c="";for(let d=0;d<a.length;d++)a[d]&&(b=gw(a[d]))&&(c&&(c+=" "),c+=b);return c},gx=[],gy=a=>{let b=b=>b[a]||gx;return b.isThemeGetter=!0,b},gz=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,gA=/^\((?:(\w[\w-]*):)?(.+)\)$/i,gB=/^\d+\/\d+$/,gC=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,gD=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,gE=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,gF=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,gG=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,gH=a=>gB.test(a),gI=a=>!!a&&!Number.isNaN(Number(a)),gJ=a=>!!a&&Number.isInteger(Number(a)),gK=a=>a.endsWith("%")&&gI(a.slice(0,-1)),gL=a=>gC.test(a),gM=()=>!0,gN=a=>gD.test(a)&&!gE.test(a),gO=()=>!1,gP=a=>gF.test(a),gQ=a=>gG.test(a),gR=a=>!gT(a)&&!gZ(a),gS=a=>g4(a,g8,gO),gT=a=>gz.test(a),gU=a=>g4(a,g9,gN),gV=a=>g4(a,ha,gI),gW=a=>g4(a,g6,gO),gX=a=>g4(a,g7,gQ),gY=a=>g4(a,hc,gP),gZ=a=>gA.test(a),g$=a=>g5(a,g9),g_=a=>g5(a,hb),g0=a=>g5(a,g6),g1=a=>g5(a,g8),g2=a=>g5(a,g7),g3=a=>g5(a,hc,!0),g4=(a,b,c)=>{let d=gz.exec(a);return!!d&&(d[1]?b(d[1]):c(d[2]))},g5=(a,b,c=!1)=>{let d=gA.exec(a);return!!d&&(d[1]?b(d[1]):c)},g6=a=>"position"===a||"percentage"===a,g7=a=>"image"===a||"url"===a,g8=a=>"length"===a||"size"===a||"bg-size"===a,g9=a=>"length"===a,ha=a=>"number"===a,hb=a=>"family-name"===a,hc=a=>"shadow"===a,hd=((a,...b)=>{let c,d,e,f,g=a=>{let b=d(a);if(b)return b;let f=((a,b)=>{let{parseClassName:c,getClassGroupId:d,getConflictingClassGroupIds:e,sortModifiers:f}=b,g=[],h=a.trim().split(gv),i="";for(let a=h.length-1;a>=0;a-=1){let b=h[a],{isExternal:j,modifiers:k,hasImportantModifier:l,baseClassName:m,maybePostfixModifierPosition:n}=c(b);if(j){i=b+(i.length>0?" "+i:i);continue}let o=!!n,p=d(o?m.substring(0,n):m);if(!p){if(!o||!(p=d(m))){i=b+(i.length>0?" "+i:i);continue}o=!1}let q=0===k.length?"":1===k.length?k[0]:f(k).join(":"),r=l?q+"!":q,s=r+p;if(g.indexOf(s)>-1)continue;g.push(s);let t=e(p,o);for(let a=0;a<t.length;++a){let b=t[a];g.push(r+b)}i=b+(i.length>0?" "+i:i)}return i})(a,c);return e(a,f),f};return f=h=>{var i;let j;return d=(c={cache:(a=>{if(a<1)return{get:()=>void 0,set:()=>{}};let b=0,c=Object.create(null),d=Object.create(null),e=(e,f)=>{c[e]=f,++b>a&&(b=0,d=c,c=Object.create(null))};return{get(a){let b=c[a];return void 0!==b?b:void 0!==(b=d[a])?(e(a,b),b):void 0},set(a,b){a in c?c[a]=b:e(a,b)}}})((i=b.reduce((a,b)=>b(a),a())).cacheSize),parseClassName:(a=>{let{prefix:b,experimentalParseClassName:c}=a,d=a=>{let b,c=[],d=0,e=0,f=0,g=a.length;for(let h=0;h<g;h++){let g=a[h];if(0===d&&0===e){if(":"===g){c.push(a.slice(f,h)),f=h+1;continue}if("/"===g){b=h;continue}}"["===g?d++:"]"===g?d--:"("===g?e++:")"===g&&e--}let h=0===c.length?a:a.slice(f),i=h,j=!1;return h.endsWith("!")?(i=h.slice(0,-1),j=!0):h.startsWith("!")&&(i=h.slice(1),j=!0),gu(c,j,i,b&&b>f?b-f:void 0)};if(b){let a=b+":",c=d;d=b=>b.startsWith(a)?c(b.slice(a.length)):gu(gt,!1,b,void 0,!0)}if(c){let a=d;d=b=>c({className:b,parseClassName:a})}return d})(i),sortModifiers:(j=new Map,i.orderSensitiveModifiers.forEach((a,b)=>{j.set(a,1e6+b)}),a=>{let b=[],c=[];for(let d=0;d<a.length;d++){let e=a[d],f="["===e[0],g=j.has(e);f||g?(c.length>0&&(c.sort(),b.push(...c),c=[]),b.push(e)):c.push(e)}return c.length>0&&(c.sort(),b.push(...c)),b}),...(a=>{let b=(a=>{let{theme:b,classGroups:c}=a;return gl(c,b)})(a),{conflictingClassGroups:c,conflictingClassGroupModifiers:d}=a;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]")){var c;let b,d,e;return -1===(c=a).slice(1,-1).indexOf(":")?void 0:(d=(b=c.slice(1,-1)).indexOf(":"),(e=b.slice(0,d))?"arbitrary.."+e:void 0)}let d=a.split("-"),e=+(""===d[0]&&d.length>1);return gk(d,e,b)},getConflictingClassGroupIds:(a,b)=>{if(b){let b=d[a],e=c[a];if(b){if(e){let a=Array(e.length+b.length);for(let b=0;b<e.length;b++)a[b]=e[b];for(let c=0;c<b.length;c++)a[e.length+c]=b[c];return a}return b}return e||gj}return c[a]||gj}}})(i)}).cache.get,e=c.cache.set,f=g,g(h)},(...a)=>f(((...a)=>{let b,c,d=0,e="";for(;d<a.length;)(b=a[d++])&&(c=gw(b))&&(e&&(e+=" "),e+=c);return e})(...a))})(()=>{let a=gy("color"),b=gy("font"),c=gy("text"),d=gy("font-weight"),e=gy("tracking"),f=gy("leading"),g=gy("breakpoint"),h=gy("container"),i=gy("spacing"),j=gy("radius"),k=gy("shadow"),l=gy("inset-shadow"),m=gy("text-shadow"),n=gy("drop-shadow"),o=gy("blur"),p=gy("perspective"),q=gy("aspect"),r=gy("ease"),s=gy("animate"),t=()=>["auto","avoid","all","avoid-page","page","left","right","column"],u=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],v=()=>[...u(),gZ,gT],w=()=>["auto","hidden","clip","visible","scroll"],x=()=>["auto","contain","none"],y=()=>[gZ,gT,i],z=()=>[gH,"full","auto",...y()],A=()=>[gJ,"none","subgrid",gZ,gT],B=()=>["auto",{span:["full",gJ,gZ,gT]},gJ,gZ,gT],C=()=>[gJ,"auto",gZ,gT],D=()=>["auto","min","max","fr",gZ,gT],E=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],F=()=>["start","end","center","stretch","center-safe","end-safe"],G=()=>["auto",...y()],H=()=>[gH,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...y()],I=()=>[a,gZ,gT],J=()=>[...u(),g0,gW,{position:[gZ,gT]}],K=()=>["no-repeat",{repeat:["","x","y","space","round"]}],L=()=>["auto","cover","contain",g1,gS,{size:[gZ,gT]}],M=()=>[gK,g$,gU],N=()=>["","none","full",j,gZ,gT],O=()=>["",gI,g$,gU],P=()=>["solid","dashed","dotted","double"],Q=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],R=()=>[gI,gK,g0,gW],S=()=>["","none",o,gZ,gT],T=()=>["none",gI,gZ,gT],U=()=>["none",gI,gZ,gT],V=()=>[gI,gZ,gT],W=()=>[gH,"full",...y()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[gL],breakpoint:[gL],color:[gM],container:[gL],"drop-shadow":[gL],ease:["in","out","in-out"],font:[gR],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[gL],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[gL],shadow:[gL],spacing:["px",gI],text:[gL],"text-shadow":[gL],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",gH,gT,gZ,q]}],container:["container"],columns:[{columns:[gI,gT,gZ,h]}],"break-after":[{"break-after":t()}],"break-before":[{"break-before":t()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:v()}],overflow:[{overflow:w()}],"overflow-x":[{"overflow-x":w()}],"overflow-y":[{"overflow-y":w()}],overscroll:[{overscroll:x()}],"overscroll-x":[{"overscroll-x":x()}],"overscroll-y":[{"overscroll-y":x()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:z()}],"inset-x":[{"inset-x":z()}],"inset-y":[{"inset-y":z()}],start:[{start:z()}],end:[{end:z()}],top:[{top:z()}],right:[{right:z()}],bottom:[{bottom:z()}],left:[{left:z()}],visibility:["visible","invisible","collapse"],z:[{z:[gJ,"auto",gZ,gT]}],basis:[{basis:[gH,"full","auto",h,...y()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[gI,gH,"auto","initial","none",gT]}],grow:[{grow:["",gI,gZ,gT]}],shrink:[{shrink:["",gI,gZ,gT]}],order:[{order:[gJ,"first","last","none",gZ,gT]}],"grid-cols":[{"grid-cols":A()}],"col-start-end":[{col:B()}],"col-start":[{"col-start":C()}],"col-end":[{"col-end":C()}],"grid-rows":[{"grid-rows":A()}],"row-start-end":[{row:B()}],"row-start":[{"row-start":C()}],"row-end":[{"row-end":C()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":D()}],"auto-rows":[{"auto-rows":D()}],gap:[{gap:y()}],"gap-x":[{"gap-x":y()}],"gap-y":[{"gap-y":y()}],"justify-content":[{justify:[...E(),"normal"]}],"justify-items":[{"justify-items":[...F(),"normal"]}],"justify-self":[{"justify-self":["auto",...F()]}],"align-content":[{content:["normal",...E()]}],"align-items":[{items:[...F(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...F(),{baseline:["","last"]}]}],"place-content":[{"place-content":E()}],"place-items":[{"place-items":[...F(),"baseline"]}],"place-self":[{"place-self":["auto",...F()]}],p:[{p:y()}],px:[{px:y()}],py:[{py:y()}],ps:[{ps:y()}],pe:[{pe:y()}],pt:[{pt:y()}],pr:[{pr:y()}],pb:[{pb:y()}],pl:[{pl:y()}],m:[{m:G()}],mx:[{mx:G()}],my:[{my:G()}],ms:[{ms:G()}],me:[{me:G()}],mt:[{mt:G()}],mr:[{mr:G()}],mb:[{mb:G()}],ml:[{ml:G()}],"space-x":[{"space-x":y()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":y()}],"space-y-reverse":["space-y-reverse"],size:[{size:H()}],w:[{w:[h,"screen",...H()]}],"min-w":[{"min-w":[h,"screen","none",...H()]}],"max-w":[{"max-w":[h,"screen","none","prose",{screen:[g]},...H()]}],h:[{h:["screen","lh",...H()]}],"min-h":[{"min-h":["screen","lh","none",...H()]}],"max-h":[{"max-h":["screen","lh",...H()]}],"font-size":[{text:["base",c,g$,gU]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[d,gZ,gV]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",gK,gT]}],"font-family":[{font:[g_,gT,b]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[e,gZ,gT]}],"line-clamp":[{"line-clamp":[gI,"none",gZ,gV]}],leading:[{leading:[f,...y()]}],"list-image":[{"list-image":["none",gZ,gT]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",gZ,gT]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:I()}],"text-color":[{text:I()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...P(),"wavy"]}],"text-decoration-thickness":[{decoration:[gI,"from-font","auto",gZ,gU]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[gI,"auto",gZ,gT]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:y()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",gZ,gT]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",gZ,gT]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:J()}],"bg-repeat":[{bg:K()}],"bg-size":[{bg:L()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},gJ,gZ,gT],radial:["",gZ,gT],conic:[gJ,gZ,gT]},g2,gX]}],"bg-color":[{bg:I()}],"gradient-from-pos":[{from:M()}],"gradient-via-pos":[{via:M()}],"gradient-to-pos":[{to:M()}],"gradient-from":[{from:I()}],"gradient-via":[{via:I()}],"gradient-to":[{to:I()}],rounded:[{rounded:N()}],"rounded-s":[{"rounded-s":N()}],"rounded-e":[{"rounded-e":N()}],"rounded-t":[{"rounded-t":N()}],"rounded-r":[{"rounded-r":N()}],"rounded-b":[{"rounded-b":N()}],"rounded-l":[{"rounded-l":N()}],"rounded-ss":[{"rounded-ss":N()}],"rounded-se":[{"rounded-se":N()}],"rounded-ee":[{"rounded-ee":N()}],"rounded-es":[{"rounded-es":N()}],"rounded-tl":[{"rounded-tl":N()}],"rounded-tr":[{"rounded-tr":N()}],"rounded-br":[{"rounded-br":N()}],"rounded-bl":[{"rounded-bl":N()}],"border-w":[{border:O()}],"border-w-x":[{"border-x":O()}],"border-w-y":[{"border-y":O()}],"border-w-s":[{"border-s":O()}],"border-w-e":[{"border-e":O()}],"border-w-t":[{"border-t":O()}],"border-w-r":[{"border-r":O()}],"border-w-b":[{"border-b":O()}],"border-w-l":[{"border-l":O()}],"divide-x":[{"divide-x":O()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":O()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...P(),"hidden","none"]}],"divide-style":[{divide:[...P(),"hidden","none"]}],"border-color":[{border:I()}],"border-color-x":[{"border-x":I()}],"border-color-y":[{"border-y":I()}],"border-color-s":[{"border-s":I()}],"border-color-e":[{"border-e":I()}],"border-color-t":[{"border-t":I()}],"border-color-r":[{"border-r":I()}],"border-color-b":[{"border-b":I()}],"border-color-l":[{"border-l":I()}],"divide-color":[{divide:I()}],"outline-style":[{outline:[...P(),"none","hidden"]}],"outline-offset":[{"outline-offset":[gI,gZ,gT]}],"outline-w":[{outline:["",gI,g$,gU]}],"outline-color":[{outline:I()}],shadow:[{shadow:["","none",k,g3,gY]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":["none",l,g3,gY]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:O()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[gI,gU]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":O()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":["none",m,g3,gY]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[gI,gZ,gT]}],"mix-blend":[{"mix-blend":[...Q(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Q()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[gI]}],"mask-image-linear-from-pos":[{"mask-linear-from":R()}],"mask-image-linear-to-pos":[{"mask-linear-to":R()}],"mask-image-linear-from-color":[{"mask-linear-from":I()}],"mask-image-linear-to-color":[{"mask-linear-to":I()}],"mask-image-t-from-pos":[{"mask-t-from":R()}],"mask-image-t-to-pos":[{"mask-t-to":R()}],"mask-image-t-from-color":[{"mask-t-from":I()}],"mask-image-t-to-color":[{"mask-t-to":I()}],"mask-image-r-from-pos":[{"mask-r-from":R()}],"mask-image-r-to-pos":[{"mask-r-to":R()}],"mask-image-r-from-color":[{"mask-r-from":I()}],"mask-image-r-to-color":[{"mask-r-to":I()}],"mask-image-b-from-pos":[{"mask-b-from":R()}],"mask-image-b-to-pos":[{"mask-b-to":R()}],"mask-image-b-from-color":[{"mask-b-from":I()}],"mask-image-b-to-color":[{"mask-b-to":I()}],"mask-image-l-from-pos":[{"mask-l-from":R()}],"mask-image-l-to-pos":[{"mask-l-to":R()}],"mask-image-l-from-color":[{"mask-l-from":I()}],"mask-image-l-to-color":[{"mask-l-to":I()}],"mask-image-x-from-pos":[{"mask-x-from":R()}],"mask-image-x-to-pos":[{"mask-x-to":R()}],"mask-image-x-from-color":[{"mask-x-from":I()}],"mask-image-x-to-color":[{"mask-x-to":I()}],"mask-image-y-from-pos":[{"mask-y-from":R()}],"mask-image-y-to-pos":[{"mask-y-to":R()}],"mask-image-y-from-color":[{"mask-y-from":I()}],"mask-image-y-to-color":[{"mask-y-to":I()}],"mask-image-radial":[{"mask-radial":[gZ,gT]}],"mask-image-radial-from-pos":[{"mask-radial-from":R()}],"mask-image-radial-to-pos":[{"mask-radial-to":R()}],"mask-image-radial-from-color":[{"mask-radial-from":I()}],"mask-image-radial-to-color":[{"mask-radial-to":I()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":u()}],"mask-image-conic-pos":[{"mask-conic":[gI]}],"mask-image-conic-from-pos":[{"mask-conic-from":R()}],"mask-image-conic-to-pos":[{"mask-conic-to":R()}],"mask-image-conic-from-color":[{"mask-conic-from":I()}],"mask-image-conic-to-color":[{"mask-conic-to":I()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:J()}],"mask-repeat":[{mask:K()}],"mask-size":[{mask:L()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",gZ,gT]}],filter:[{filter:["","none",gZ,gT]}],blur:[{blur:S()}],brightness:[{brightness:[gI,gZ,gT]}],contrast:[{contrast:[gI,gZ,gT]}],"drop-shadow":[{"drop-shadow":["","none",n,g3,gY]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:["",gI,gZ,gT]}],"hue-rotate":[{"hue-rotate":[gI,gZ,gT]}],invert:[{invert:["",gI,gZ,gT]}],saturate:[{saturate:[gI,gZ,gT]}],sepia:[{sepia:["",gI,gZ,gT]}],"backdrop-filter":[{"backdrop-filter":["","none",gZ,gT]}],"backdrop-blur":[{"backdrop-blur":S()}],"backdrop-brightness":[{"backdrop-brightness":[gI,gZ,gT]}],"backdrop-contrast":[{"backdrop-contrast":[gI,gZ,gT]}],"backdrop-grayscale":[{"backdrop-grayscale":["",gI,gZ,gT]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[gI,gZ,gT]}],"backdrop-invert":[{"backdrop-invert":["",gI,gZ,gT]}],"backdrop-opacity":[{"backdrop-opacity":[gI,gZ,gT]}],"backdrop-saturate":[{"backdrop-saturate":[gI,gZ,gT]}],"backdrop-sepia":[{"backdrop-sepia":["",gI,gZ,gT]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":y()}],"border-spacing-x":[{"border-spacing-x":y()}],"border-spacing-y":[{"border-spacing-y":y()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",gZ,gT]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[gI,"initial",gZ,gT]}],ease:[{ease:["linear","initial",r,gZ,gT]}],delay:[{delay:[gI,gZ,gT]}],animate:[{animate:["none",s,gZ,gT]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[p,gZ,gT]}],"perspective-origin":[{"perspective-origin":v()}],rotate:[{rotate:T()}],"rotate-x":[{"rotate-x":T()}],"rotate-y":[{"rotate-y":T()}],"rotate-z":[{"rotate-z":T()}],scale:[{scale:U()}],"scale-x":[{"scale-x":U()}],"scale-y":[{"scale-y":U()}],"scale-z":[{"scale-z":U()}],"scale-3d":["scale-3d"],skew:[{skew:V()}],"skew-x":[{"skew-x":V()}],"skew-y":[{"skew-y":V()}],transform:[{transform:[gZ,gT,"","none","gpu","cpu"]}],"transform-origin":[{origin:v()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:W()}],"translate-x":[{"translate-x":W()}],"translate-y":[{"translate-y":W()}],"translate-z":[{"translate-z":W()}],"translate-none":["translate-none"],accent:[{accent:I()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:I()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",gZ,gT]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":y()}],"scroll-mx":[{"scroll-mx":y()}],"scroll-my":[{"scroll-my":y()}],"scroll-ms":[{"scroll-ms":y()}],"scroll-me":[{"scroll-me":y()}],"scroll-mt":[{"scroll-mt":y()}],"scroll-mr":[{"scroll-mr":y()}],"scroll-mb":[{"scroll-mb":y()}],"scroll-ml":[{"scroll-ml":y()}],"scroll-p":[{"scroll-p":y()}],"scroll-px":[{"scroll-px":y()}],"scroll-py":[{"scroll-py":y()}],"scroll-ps":[{"scroll-ps":y()}],"scroll-pe":[{"scroll-pe":y()}],"scroll-pt":[{"scroll-pt":y()}],"scroll-pr":[{"scroll-pr":y()}],"scroll-pb":[{"scroll-pb":y()}],"scroll-pl":[{"scroll-pl":y()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",gZ,gT]}],fill:[{fill:["none",...I()]}],"stroke-w":[{stroke:[gI,g$,gU,gV]}],stroke:[{stroke:["none",...I()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});function he(...a){return hd(gh(a))}function hf({className:a,...b}){return(0,m.jsx)("div",{"data-slot":"card",className:he("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",a),...b})}function hg({className:a,...b}){return(0,m.jsx)("div",{"data-slot":"card-header",className:he("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",a),...b})}function hh({className:a,...b}){return(0,m.jsx)("div",{"data-slot":"card-title",className:he("leading-none font-semibold",a),...b})}function hi({className:a,...b}){return(0,m.jsx)("div",{"data-slot":"card-content",className:he("px-6",a),...b})}function hj(a,b){if("function"==typeof a)return a(b);null!=a&&(a.current=b)}var hk=Symbol.for("react.lazy"),hl=n[" use ".trim().toString()];function hm(a){var b;return null!=a&&"object"==typeof a&&"$$typeof"in a&&a.$$typeof===hk&&"_payload"in a&&"object"==typeof(b=a._payload)&&null!==b&&"then"in b}var hn=((k=n.forwardRef((a,b)=>{let{children:c,...d}=a;if(hm(c)&&"function"==typeof hl&&(c=hl(c._payload)),n.isValidElement(c)){var e;let a,f,g=(e=c,(f=(a=Object.getOwnPropertyDescriptor(e.props,"ref")?.get)&&"isReactWarning"in a&&a.isReactWarning)?e.ref:(f=(a=Object.getOwnPropertyDescriptor(e,"ref")?.get)&&"isReactWarning"in a&&a.isReactWarning)?e.props.ref:e.props.ref||e.ref),h=function(a,b){let c={...b};for(let d in b){let e=a[d],f=b[d];/^on[A-Z]/.test(d)?e&&f?c[d]=(...a)=>{let b=f(...a);return e(...a),b}:e&&(c[d]=e):"style"===d?c[d]={...e,...f}:"className"===d&&(c[d]=[e,f].filter(Boolean).join(" "))}return{...a,...c}}(d,c.props);return c.type!==n.Fragment&&(h.ref=b?function(...a){return b=>{let c=!1,d=a.map(a=>{let d=hj(a,b);return c||"function"!=typeof d||(c=!0),d});if(c)return()=>{for(let b=0;b<d.length;b++){let c=d[b];"function"==typeof c?c():hj(a[b],null)}}}}(b,g):g),n.cloneElement(c,h)}return n.Children.count(c)>1?n.Children.only(null):null})).displayName="Slot.SlotClone",f=k,(g=n.forwardRef((a,b)=>{let{children:c,...d}=a;hm(c)&&"function"==typeof hl&&(c=hl(c._payload));let e=n.Children.toArray(c),g=e.find(hp);if(g){let a=g.props.children,c=e.map(b=>b!==g?b:n.Children.count(a)>1?n.Children.only(null):n.isValidElement(a)?a.props.children:null);return(0,m.jsx)(f,{...d,ref:b,children:n.isValidElement(a)?n.cloneElement(a,void 0,c):null})}return(0,m.jsx)(f,{...d,ref:b,children:c})})).displayName="Slot.Slot",g),ho=Symbol("radix.slottable");function hp(a){return n.isValidElement(a)&&"function"==typeof a.type&&"__radixId"in a.type&&a.type.__radixId===ho}let hq=a=>"boolean"==typeof a?`${a}`:0===a?"0":a,hr=(h="inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",i={variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}},a=>{var b;if((null==i?void 0:i.variants)==null)return gh(h,null==a?void 0:a.class,null==a?void 0:a.className);let{variants:c,defaultVariants:d}=i,e=Object.keys(c).map(b=>{let e=null==a?void 0:a[b],f=null==d?void 0:d[b];if(null===e)return null;let g=hq(e)||hq(f);return c[b][g]}),f=a&&Object.entries(a).reduce((a,b)=>{let[c,d]=b;return void 0===d||(a[c]=d),a},{});return gh(h,e,null==i||null==(b=i.compoundVariants)?void 0:b.reduce((a,b)=>{let{class:c,className:e,...g}=b;return Object.entries(g).every(a=>{let[b,c]=a;return Array.isArray(c)?c.includes({...d,...f}[b]):({...d,...f})[b]===c})?[...a,c,e]:a},[]),null==a?void 0:a.class,null==a?void 0:a.className)});function hs({className:a,variant:b="default",size:c="default",asChild:d=!1,...e}){return(0,m.jsx)(d?hn:"button",{"data-slot":"button","data-variant":b,"data-size":c,className:he(hr({variant:b,size:c,className:a})),...e})}function ht({className:a,type:b,...c}){return(0,m.jsx)("input",{type:b,"data-slot":"input",className:he("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",a),...c})}let hu={architecture:"#FFD700",pattern:"#FFB347",preference:"#FFA500",error:"#FF6B6B",context:"#FFC080",learning:"#FFE4B5",todo:"#FF8C00",note:"#FFCC66",relationship:"#00D4FF",custom:"#FFB347"},hv={short_term:"#FFD700",episodic:"#FFB347",long_term:"#FF8C00"};function hw(a){return hu[a]||hu.custom}function hx(a){return hv[a]||hv.short_term}let hy={references:{color:"#60a5fa",label:"References",icon:"→"},extends:{color:"#34d399",label:"Extends",icon:"⊃"},contradicts:{color:"#f87171",label:"Contradicts",icon:"⊗"},related:{color:"#a78bfa",label:"Related",icon:"~"}},hz=["architecture","pattern","preference","error","context","learning","todo","note","relationship","custom"];function hA({memory:a,links:b=[],memories:c=[],onClose:d,onReinforce:e,onSelectMemory:f,isReinforcing:g=!1,reinforceSuccess:h=!1}){let i,j,[k,l]=(0,n.useState)(!1),[o,p]=(0,n.useState)(null),[q,r]=(0,n.useState)(!1),[s,t]=(0,n.useState)(a.title),[u,v]=(0,n.useState)(a.content),[w,x]=(0,n.useState)(a.category),[y,z]=(0,n.useState)((a.tags||[]).join(", ")),[A,B]=(0,n.useState)(!1),C=(i=(0,fK.useQueryClient)(),fS({mutationFn:({id:a,updates:b})=>f9(a,b),onSuccess:()=>{i.invalidateQueries({queryKey:["memories"]}),i.invalidateQueries({queryKey:["stats"]})}})),D=(j=(0,fK.useQueryClient)(),fS({mutationFn:ga,onSuccess:()=>{j.invalidateQueries({queryKey:["memories"]}),j.invalidateQueries({queryKey:["stats"]}),j.invalidateQueries({queryKey:["links"]})}})),[E,F]=(0,n.useState)(a.id);E!==a.id&&(F(a.id),r(!1),B(!1),t(a.title),v(a.content),x(a.category),z((a.tags||[]).join(", "))),(0,n.useEffect)(()=>{if(h&&o===a.id){let a=setTimeout(()=>l(!0),0),b=setTimeout(()=>l(!1),1500);return()=>{clearTimeout(a),clearTimeout(b)}}},[h,o,a.id]);let G=(0,n.useCallback)(()=>{let b=y.split(",").map(a=>a.trim()).filter(Boolean);C.mutate({id:a.id,updates:{title:s,content:u,category:w,tags:b}},{onSuccess:()=>{r(!1)}})},[a.id,s,u,w,y,C]),H=function(a){if(!a.lastAccessed)return 1;let b=Date.now(),c=new Date(a.lastAccessed).getTime();return Math.pow({short_term:.995,long_term:.9995,episodic:.998}[a.type]||.995,(b-c)/36e5)}(a),I=hw(a.category),J=hx(a.type),K=H>.7?{label:"Healthy",color:"#22C55E",bgColor:"rgba(34, 197, 94, 0.15)"}:H>.4?{label:"Fading",color:"#EAB308",bgColor:"rgba(234, 179, 8, 0.15)"}:{label:"Critical",color:"#EF4444",bgColor:"rgba(239, 68, 68, 0.15)"},L=(0,n.useMemo)(()=>{let d=[];for(let e of b)if(e.source_id===a.id){let a=c.find(a=>a.id===e.target_id);a&&d.push({memory:a,relationship:e.relationship,strength:e.strength,direction:"to"})}else if(e.target_id===a.id){let a=c.find(a=>a.id===e.source_id);a&&d.push({memory:a,relationship:e.relationship,strength:e.strength,direction:"from"})}return d.sort((a,b)=>b.strength-a.strength)},[a.id,b,c]);return(0,m.jsxs)(hf,{className:`bg-slate-900 border-slate-700 h-full overflow-auto transition-all duration-300 ${k?"ring-2 ring-green-500 ring-opacity-75":""}`,children:[(0,m.jsxs)(hg,{className:"border-b border-slate-700 pb-3",children:[(0,m.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[q?(0,m.jsx)(ht,{value:s,onChange:a=>t(a.target.value),className:"bg-slate-800 border-slate-600 text-white text-lg font-semibold"}):(0,m.jsx)(hh,{className:"text-lg font-semibold text-white leading-tight",children:a.title}),(0,m.jsx)(hs,{variant:"ghost",size:"sm",onClick:d,className:"text-slate-400 hover:text-white -mt-1 shrink-0",children:"✕"})]}),(0,m.jsxs)("div",{className:"flex items-center gap-2 mt-2",children:[q?(0,m.jsx)("select",{value:w,onChange:a=>x(a.target.value),className:"bg-slate-800 border border-slate-600 text-white text-xs rounded-lg px-2 py-1",children:hz.map(a=>(0,m.jsx)("option",{value:a,children:a},a))}):(0,m.jsx)("span",{className:"px-2 py-0.5 rounded text-xs font-medium",style:{backgroundColor:I+"20",color:I},children:a.category}),(0,m.jsx)("span",{className:"px-2 py-0.5 rounded text-xs font-medium",style:{backgroundColor:J+"20",color:J},children:a.type.replace("_","-")})]})]}),(0,m.jsxs)(hi,{className:"p-4 space-y-4",children:[(0,m.jsxs)("div",{children:[(0,m.jsx)("h4",{className:"text-xs font-medium text-slate-400 mb-1",children:"Content"}),q?(0,m.jsx)("textarea",{value:u,onChange:a=>v(a.target.value),rows:6,className:"w-full bg-slate-800 border border-slate-600 text-sm text-slate-200 rounded-lg p-3 resize-y focus:ring-cyan-500 focus:border-cyan-500"}):(0,m.jsx)("p",{className:"text-sm text-slate-200 whitespace-pre-wrap leading-relaxed",children:a.content})]}),q&&(0,m.jsxs)("div",{children:[(0,m.jsx)("h4",{className:"text-xs font-medium text-slate-400 mb-1",children:"Tags (comma-separated)"}),(0,m.jsx)(ht,{value:y,onChange:a=>z(a.target.value),placeholder:"tag1, tag2, tag3",className:"bg-slate-800 border-slate-600 text-white text-sm"})]}),q?(0,m.jsxs)("div",{className:"flex gap-2",children:[(0,m.jsx)(hs,{variant:"default",size:"sm",onClick:G,disabled:C.isPending,className:"flex-1 bg-emerald-600 hover:bg-emerald-700",children:C.isPending?"Saving...":"Save Changes"}),(0,m.jsx)(hs,{variant:"outline",size:"sm",onClick:()=>{r(!1),t(a.title),v(a.content),x(a.category),z((a.tags||[]).join(", "))},className:"flex-1 border-slate-600 text-slate-300 hover:text-white",children:"Cancel"})]}):null,!q&&(0,m.jsxs)("div",{className:"rounded-lg p-3 flex items-center gap-3",style:{backgroundColor:K.bgColor},children:[(0,m.jsx)("div",{className:"w-3 h-3 rounded-full animate-pulse",style:{backgroundColor:K.color}}),(0,m.jsxs)("div",{children:[(0,m.jsx)("div",{className:"text-sm font-medium",style:{color:K.color},children:K.label}),(0,m.jsx)("div",{className:"text-xs text-slate-400",children:H>.7?"Memory is strong and stable":H>.4?"Memory is fading - reinforce to preserve":"Memory at risk of deletion - reinforce now"})]})]}),!q&&(0,m.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,m.jsxs)("div",{className:"bg-slate-800 rounded-lg p-3",children:[(0,m.jsx)("div",{className:"text-xs text-slate-400",children:"Salience"}),(0,m.jsxs)("div",{className:"text-lg font-bold text-white",children:[(100*a.salience).toFixed(0),"%"]}),(0,m.jsx)("div",{className:"mt-1 h-1.5 bg-slate-700 rounded-full overflow-hidden",children:(0,m.jsx)("div",{className:"h-full bg-gradient-to-r from-red-500 via-yellow-500 to-green-500 rounded-full transition-all",style:{width:`${100*a.salience}%`}})})]}),(0,m.jsxs)("div",{className:"bg-slate-800 rounded-lg p-3",children:[(0,m.jsx)("div",{className:"text-xs text-slate-400",children:"Decay Factor"}),(0,m.jsxs)("div",{className:"text-lg font-bold text-white",children:[(100*H).toFixed(0),"%"]}),(0,m.jsx)("div",{className:"mt-1 h-1.5 bg-slate-700 rounded-full overflow-hidden",children:(0,m.jsx)("div",{className:"h-full rounded-full transition-all",style:{width:`${100*H}%`,backgroundColor:K.color}})})]})]}),!q&&(0,m.jsxs)("div",{className:`bg-slate-800 rounded-lg p-3 space-y-2 transition-all duration-300 ${k?"ring-1 ring-green-500/50":""}`,children:[(0,m.jsxs)("div",{className:"flex justify-between items-center",children:[(0,m.jsx)("span",{className:"text-xs text-slate-400",children:"Access Count"}),(0,m.jsxs)("span",{className:`text-sm font-medium transition-all duration-300 ${k?"text-green-400 scale-110":"text-white"}`,children:[a.accessCount," times"]})]}),(0,m.jsxs)("div",{className:"flex justify-between items-center",children:[(0,m.jsx)("span",{className:"text-xs text-slate-400",children:"Last Accessed"}),(0,m.jsx)("span",{className:`text-sm transition-all duration-300 ${k?"text-green-400":"text-white"}`,children:k?"Just now":(a=>{let b=new Date(a),c=Math.floor((new Date().getTime()-b.getTime())/36e5);if(c<1)return"Just now";if(c<24)return`${c}h ago`;let d=Math.floor(c/24);return d<7?`${d}d ago`:`${Math.floor(d/7)}w ago`})(a.lastAccessed)})]}),(0,m.jsxs)("div",{className:"flex justify-between items-center",children:[(0,m.jsx)("span",{className:"text-xs text-slate-400",children:"Created"}),(0,m.jsx)("span",{className:"text-sm text-white",children:new Date(a.createdAt).toLocaleString()})]})]}),!q&&L.length>0&&(0,m.jsxs)("div",{children:[(0,m.jsxs)("h4",{className:"text-xs font-medium text-slate-400 mb-2 flex items-center gap-2",children:[(0,m.jsx)("span",{className:"inline-block w-4 h-4",children:"🔗"}),"Related Memories (",L.length,")"]}),(0,m.jsx)("div",{className:"space-y-2 max-h-48 overflow-y-auto",children:L.map(({memory:a,relationship:b,strength:c,direction:d})=>{let e=hy[b]||hy.related,g=hw(a.category);return(0,m.jsxs)("button",{onClick:()=>f?.(a.id),className:"w-full text-left p-2 bg-slate-800 hover:bg-slate-750 rounded-lg transition-colors group",children:[(0,m.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,m.jsx)("span",{className:"w-1.5 h-1.5 rounded-full",style:{backgroundColor:e.color}}),(0,m.jsx)("span",{className:"text-[10px] font-medium",style:{color:e.color},children:"to"===d?`${e.icon} ${e.label}`:`${e.label} ${e.icon}`}),(0,m.jsxs)("span",{className:"text-[10px] text-slate-500 ml-auto",children:[(100*c).toFixed(0),"%"]})]}),(0,m.jsx)("div",{className:"text-sm text-white truncate group-hover:text-blue-400 transition-colors",children:a.title}),(0,m.jsxs)("div",{className:"flex items-center gap-2 mt-1",children:[(0,m.jsx)("span",{className:"px-1.5 py-0.5 rounded text-[10px]",style:{backgroundColor:g+"20",color:g},children:a.category}),(0,m.jsxs)("span",{className:"text-[10px] text-slate-500",children:[(100*a.salience).toFixed(0),"% salience"]})]})]},`${a.id}-${d}`)})})]}),!q&&a.tags&&a.tags.length>0&&(0,m.jsxs)("div",{children:[(0,m.jsx)("h4",{className:"text-xs font-medium text-slate-400 mb-2",children:"Tags"}),(0,m.jsx)("div",{className:"flex flex-wrap gap-1",children:a.tags.map((a,b)=>(0,m.jsx)("span",{className:"px-2 py-0.5 bg-slate-700 text-slate-300 rounded text-xs",children:a},b))})]}),!q&&(0,m.jsxs)("div",{className:"space-y-2 pt-2",children:[(0,m.jsxs)("div",{className:"flex gap-2",children:[e&&(0,m.jsx)(hs,{variant:"default",size:"sm",onClick:()=>{p(a.id),e?.(a.id)},disabled:g,className:`flex-1 transition-all duration-300 ${k?"bg-green-600 hover:bg-green-600":"bg-blue-600 hover:bg-blue-700"}`,children:g?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("span",{className:"animate-spin mr-2",children:"⟳"}),"Reinforcing..."]}):k?(0,m.jsx)(m.Fragment,{children:"✓ Reinforced!"}):(0,m.jsx)(m.Fragment,{children:"⚡ Reinforce"})}),(0,m.jsx)(hs,{variant:"outline",size:"sm",onClick:()=>r(!0),className:"flex-1 border-slate-600 text-slate-300 hover:text-white hover:bg-slate-700",children:"Edit"})]}),A?(0,m.jsxs)("div",{className:"bg-red-500/10 border border-red-500/30 rounded-lg p-3",children:[(0,m.jsx)("p",{className:"text-xs text-red-400 mb-2",children:"Delete this memory permanently?"}),(0,m.jsxs)("div",{className:"flex gap-2",children:[(0,m.jsx)(hs,{variant:"default",size:"sm",onClick:()=>{D.mutate(a.id,{onSuccess:()=>{d()}})},disabled:D.isPending,className:"flex-1 bg-red-600 hover:bg-red-700",children:D.isPending?"Deleting...":"Confirm Delete"}),(0,m.jsx)(hs,{variant:"outline",size:"sm",onClick:()=>B(!1),className:"flex-1 border-slate-600 text-slate-300 hover:text-white",children:"Cancel"})]})]}):(0,m.jsx)(hs,{variant:"ghost",size:"sm",onClick:()=>B(!0),className:"w-full text-slate-500 hover:text-red-400 hover:bg-red-500/10",children:"Delete Memory"})]})]})]})}function hB(a){let b=Math.floor((Date.now()-new Date(a).getTime())/6e4);if(b<1)return"now";if(b<60)return`${b}m ago`;let c=Math.floor(b/60);if(c<24)return`${c}h ago`;let d=Math.floor(c/24);if(d<7)return`${d}d ago`;let e=Math.floor(d/7);return`${e}w ago`}function hC({memory:a,isSelected:b,onSelect:c,isChecked:d,onCheck:e}){let f=hw(a.category),g=hx(a.type);return(0,m.jsxs)("div",{onClick:()=>c(a),className:`bg-slate-900 border rounded-lg p-3 hover:border-slate-600 cursor-pointer transition-colors relative ${b?"border-cyan-500":"border-slate-800"}`,children:[(0,m.jsx)("div",{className:"h-0.5 rounded-full bg-slate-800 mb-2 overflow-hidden",children:(0,m.jsx)("div",{className:"h-full rounded-full",style:{width:`${100*a.salience}%`,backgroundColor:f}})}),e&&(0,m.jsx)("input",{type:"checkbox",checked:d??!1,onChange:b=>{b.stopPropagation(),e(a.id,b.target.checked)},onClick:a=>a.stopPropagation(),className:"absolute top-3 right-3 w-4 h-4 accent-blue-500"}),(0,m.jsx)("h3",{className:"text-sm font-semibold text-white truncate pr-6",children:a.title}),(0,m.jsxs)("div",{className:"flex items-center gap-1.5 mt-1",children:[(0,m.jsx)("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full font-medium",style:{backgroundColor:f+"22",color:f},children:a.category}),(0,m.jsx)("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full font-medium",style:{backgroundColor:g+"22",color:g},children:a.type.replace("_","-")})]}),(0,m.jsx)("p",{className:"text-[13px] text-slate-400 mt-1.5 line-clamp-3 leading-snug",children:a.content}),a.tags.length>0&&(0,m.jsxs)("div",{className:"flex items-center gap-1 mt-2 flex-wrap",children:[a.tags.slice(0,3).map(a=>(0,m.jsx)("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-slate-800 text-slate-400",children:a},a)),a.tags.length>3&&(0,m.jsxs)("span",{className:"text-[10px] text-slate-500",children:["+",a.tags.length-3," more"]})]}),(0,m.jsxs)("div",{className:"flex items-center justify-between mt-2 text-[11px] text-slate-500",children:[(0,m.jsxs)("span",{children:["Created ",hB(a.createdAt)]}),(0,m.jsxs)("span",{children:["Accessed ",hB(a.lastAccessed)]})]})]})}let hD=process.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";function hE({memories:a,selectedMemory:b,onSelectMemory:c}){let[d,e]=(0,n.useState)("salience"),[f,g]=(0,n.useState)("grid"),[h,i]=(0,n.useState)(!1),[j,k]=(0,n.useState)(new Set),[l,o]=(0,n.useState)(!1),p=(0,fK.useQueryClient)(),q=(0,n.useMemo)(()=>{let b=[...a];return b.sort((a,b)=>{switch(d){case"salience":return b.salience-a.salience;case"createdAt":return new Date(b.createdAt).getTime()-new Date(a.createdAt).getTime();case"lastAccessed":return new Date(b.lastAccessed).getTime()-new Date(a.lastAccessed).getTime();case"decayedScore":return(b.decayedScore??b.salience)-(a.decayedScore??a.salience);default:return 0}}),b},[a,d]),r=(0,n.useCallback)((a,b)=>{k(c=>{let d=new Set(c);return b?d.add(a):d.delete(a),d})},[]),s=async()=>{if(0!==j.size){o(!0);try{await Promise.all(Array.from(j).map(a=>fetch(`${hD}/api/memories/${a}`,{method:"DELETE"}))),k(new Set),p.invalidateQueries({queryKey:["memories"]})}finally{o(!1)}}};return(0,m.jsxs)("div",{className:"flex flex-col h-full",children:[(0,m.jsxs)("div",{className:"flex items-center gap-3 px-4 py-2 border-b border-slate-800 shrink-0",children:[(0,m.jsxs)("span",{className:"text-xs text-slate-400",children:[a.length," memories"]}),(0,m.jsx)("div",{className:"w-px h-5 bg-slate-700"}),(0,m.jsxs)("select",{value:d,onChange:a=>e(a.target.value),className:"bg-slate-800 border border-slate-700 text-white text-xs rounded px-2 py-1",children:[(0,m.jsx)("option",{value:"salience",children:"Salience"}),(0,m.jsx)("option",{value:"createdAt",children:"Created"}),(0,m.jsx)("option",{value:"lastAccessed",children:"Last Accessed"}),(0,m.jsx)("option",{value:"decayedScore",children:"Decay Score"})]}),(0,m.jsxs)("div",{className:"flex items-center border border-slate-700 rounded overflow-hidden",children:[(0,m.jsx)("button",{onClick:()=>g("grid"),className:`px-2 py-1 text-xs ${"grid"===f?"bg-slate-700 text-white":"text-slate-400 hover:text-white"}`,children:"Grid"}),(0,m.jsx)("button",{onClick:()=>g("list"),className:`px-2 py-1 text-xs ${"list"===f?"bg-slate-700 text-white":"text-slate-400 hover:text-white"}`,children:"List"})]}),(0,m.jsx)("div",{className:"w-px h-5 bg-slate-700"}),(0,m.jsx)("button",{onClick:()=>{i(!h),k(new Set)},className:`px-2 py-1 text-xs rounded ${h?"bg-blue-600 text-white":"bg-slate-800 text-slate-400 hover:text-white"}`,children:"Select"}),h&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("button",{onClick:()=>k(new Set(q.map(a=>a.id))),className:"px-2 py-1 text-xs text-slate-400 hover:text-white",children:"Select all"}),(0,m.jsx)("button",{onClick:s,disabled:0===j.size||l,className:"px-2 py-1 text-xs rounded bg-red-600/20 text-red-400 hover:bg-red-600/40 disabled:opacity-40",children:l?"Deleting...":`Delete (${j.size})`})]})]}),(0,m.jsx)("div",{className:"flex-1 overflow-y-auto p-4",children:(0,m.jsx)("div",{className:"grid"===f?"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-3":"flex flex-col gap-3 max-w-2xl",children:q.map(a=>(0,m.jsx)(hC,{memory:a,isSelected:b?.id===a.id,onSelect:c,isChecked:h?j.has(a.id):void 0,onCheck:h?r:void 0},a.id))})})]})}let hF=process.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";async function hG(a){let b=new URLSearchParams;a?.startTime&&b.set("startTime",a.startTime),a?.endTime&&b.set("endTime",a.endTime),a?.source&&b.set("source",a.source),a?.firewallResult&&b.set("firewallResult",a.firewallResult),a?.project&&b.set("project",a.project),a?.limit&&b.set("limit",a.limit.toString());let c=await fetch(`${hF}/api/v1/audit?${b}`);if(!c.ok)throw Error("Failed to fetch audit logs");return c.json()}async function hH(a,b){let c=new URLSearchParams({timeRange:a});b&&c.set("project",b);let d=await fetch(`${hF}/api/v1/audit/stats?${c}`);if(!d.ok)throw Error("Failed to fetch audit stats");return d.json()}async function hI(a="pending",b=50,c){let d=new URLSearchParams({status:a,limit:b.toString()});c&&d.set("project",c);let e=await fetch(`${hF}/api/v1/quarantine?${d}`);if(!e.ok)throw Error("Failed to fetch quarantine");return e.json()}async function hJ(a){let b=await fX(`${hF}/api/v1/quarantine/${a}/approve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reviewedBy:"dashboard"})});if(!b.ok)throw Error("Failed to approve");return b.json()}async function hK(a,b){let c=await fX(`${hF}/api/v1/quarantine/${a}/reject`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reviewedBy:"dashboard",notes:b})});if(!c.ok)throw Error("Failed to reject");return c.json()}function hL(a){return fO({queryKey:["audit-logs",a],queryFn:()=>hG(a),refetchInterval:3e4,retry:2})}function hM(a="24h",b){return fO({queryKey:["audit-stats",a,b],queryFn:()=>hH(a,b),refetchInterval:3e4,retry:2})}function hN(a="pending",b=50,c){return fO({queryKey:["quarantine",a,b,c],queryFn:()=>hI(a,b,c),refetchInterval:3e4,retry:2})}let hO=a=>{let b=a.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,b,c)=>c?c.toUpperCase():b.toLowerCase());return b.charAt(0).toUpperCase()+b.slice(1)},hP=(...a)=>a.filter((a,b,c)=>!!a&&""!==a.trim()&&c.indexOf(a)===b).join(" ").trim();var hQ={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"};let hR=(0,n.forwardRef)(({color:a="currentColor",size:b=24,strokeWidth:c=2,absoluteStrokeWidth:d,className:e="",children:f,iconNode:g,...h},i)=>(0,n.createElement)("svg",{ref:i,...hQ,width:b,height:b,stroke:a,strokeWidth:d?24*Number(c)/Number(b):c,className:hP("lucide",e),...!f&&!(a=>{for(let b in a)if(b.startsWith("aria-")||"role"===b||"title"===b)return!0})(h)&&{"aria-hidden":"true"},...h},[...g.map(([a,b])=>(0,n.createElement)(a,b)),...Array.isArray(f)?f:[f]])),hS=(a,b)=>{let c=(0,n.forwardRef)(({className:c,...d},e)=>(0,n.createElement)(hR,{ref:e,iconNode:b,className:hP(`lucide-${hO(a).replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${a}`,c),...d}));return c.displayName=hO(a),c},hT=hS("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"}]]),hU=hS("file-text",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]),hV=hS("triangle-alert",[["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"}]]),hW=hS("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"}]]),hX=hS("brain",[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]]),hY=hS("git-branch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]),hZ=hS("users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]),h$=hS("file-search",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["circle",{cx:"11.5",cy:"14.5",r:"2.5",key:"1bq0ko"}],["path",{d:"M13.3 16.3 15 18",key:"2quom7"}]]),h_=hS("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"}]]),h0=[{id:"shield",label:"Shield",icon:hT},{id:"audit",label:"Audit",icon:hU},{id:"quarantine",label:"Queue",icon:hV},{id:"agents",label:"Agents",icon:hZ},{id:"skills",label:"Skills",icon:h$},{id:"dome",label:"Dome",icon:h_},{id:"memories",label:"Memories",icon:hW},{id:"brain",label:"Brain",icon:hX},{id:"graph",label:"Graph",icon:hY}];function h1(){let{viewMode:a,setViewMode:b}=gd(),{data:c}=f4(),{data:d}=hM("24h"),{data:e}=fO({queryKey:["version"],queryFn:f8,refetchInterval:6e4,staleTime:3e4}),f=c?.decayDistribution?Math.round(c.decayDistribution.healthy/Math.max(1,c.total)*100):null,g=d?.blockedCount??0;return(0,m.jsxs)("nav",{className:"w-14 border-r border-slate-800 bg-slate-900/50 flex flex-col items-center py-3 shrink-0",children:[(0,m.jsx)("div",{className:"flex-1 flex flex-col items-center gap-1",children:h0.map(({id:c,label:d,icon:e})=>(0,m.jsxs)("button",{onClick:()=>b(c),className:`relative w-10 h-10 rounded-lg flex flex-col items-center justify-center gap-0.5 transition-colors ${a===c?"dome"===c?"bg-red-600/20 text-red-400":"bg-cyan-600/20 text-cyan-400":"text-slate-500 hover:text-slate-300 hover:bg-slate-800"}`,title:d,children:[(0,m.jsx)(e,{size:18}),(0,m.jsx)("span",{className:"text-[9px] leading-none",children:d}),"shield"===c&&g>0&&(0,m.jsx)("span",{className:"absolute -top-0.5 -right-0.5 min-w-[14px] h-[14px] rounded-full bg-red-500 text-white text-[8px] flex items-center justify-center px-0.5",children:g>99?"99+":g})]},c))}),(0,m.jsxs)("div",{className:"flex flex-col items-center gap-1 text-[10px] text-slate-500",children:[c&&(0,m.jsx)("span",{children:c.total}),null!==f&&(0,m.jsxs)("span",{children:[f,"%"]}),e?.version&&(0,m.jsxs)("span",{children:["v",e.version]})]})]})}let h2=hS("flame",[["path",{d:"M12 3q1 4 4 6.5t3 5.5a1 1 0 0 1-14 0 5 5 0 0 1 1-3 1 1 0 0 0 5 0c0-2-1.5-3-1.5-5q0-2 2.5-4",key:"1slcih"}]]),h3=hS("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"}]]),h4=hS("puzzle",[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]]),h5=hS("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]),h6=[{key:"trust",label:"Trust",icon:hT,color:"text-blue-400",bg:"bg-blue-400/10"},{key:"firewall",label:"Firewall",icon:h2,color:"text-orange-400",bg:"bg-orange-400/10"},{key:"sensitivity",label:"Sensitivity",icon:h3,color:"text-purple-400",bg:"bg-purple-400/10"},{key:"fragmentation",label:"Fragment",icon:h4,color:"text-cyan-400",bg:"bg-cyan-400/10"},{key:"audit",label:"Audit",icon:hU,color:"text-green-400",bg:"bg-green-400/10"}],h7={strict:{color:"text-red-400",bg:"bg-red-400/10"},balanced:{color:"text-cyan-400",bg:"bg-cyan-400/10"},permissive:{color:"text-green-400",bg:"bg-green-400/10"}};function h8({timeRange:a}){let b,{projectFilter:c}=gd(),{data:d,isLoading:e,isError:f}=hM(a,c||void 0),{data:g}=fO({queryKey:["defence-config"],queryFn:()=>fetch(`${hF}/api/defence/config`).then(a=>a.json())}),h=(b=(0,fK.useQueryClient)(),fS({mutationFn:a=>fX(`${hF}/api/defence/config`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:a})}).then(a=>a.json()),onSuccess:()=>{b.invalidateQueries({queryKey:["defence-config"]})}})),[i,j]=(0,n.useState)(!1),k=(0,n.useRef)(null),l=g?.mode??"balanced",o=h7[l];return(0,n.useEffect)(()=>{function a(a){k.current&&!k.current.contains(a.target)&&j(!1)}return i&&document.addEventListener("mousedown",a),()=>document.removeEventListener("mousedown",a)},[i]),(0,m.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[g?.tampered&&(0,m.jsxs)("div",{className:"flex items-center gap-2 bg-red-500/10 border border-red-500/30 rounded-lg px-3 py-2 mb-3",children:[(0,m.jsx)(hV,{size:14,className:"text-red-400 shrink-0"}),(0,m.jsx)("span",{className:"text-xs text-red-400",children:"Config integrity check failed — running in strict mode"})]}),(0,m.jsx)("h3",{className:"text-sm font-medium text-slate-300 mb-4",children:"Defence Pipeline"}),(0,m.jsx)("div",{className:"flex items-center gap-1 mb-4",children:h6.map(({key:a,label:b,icon:c,color:d,bg:e},f)=>(0,m.jsxs)("div",{className:"flex items-center",children:[(0,m.jsxs)("div",{className:`flex items-center gap-1.5 px-3 py-2 rounded-lg ${e}`,children:[(0,m.jsx)(c,{size:14,className:d}),(0,m.jsx)("span",{className:`text-xs font-medium ${d}`,children:b})]}),f<h6.length-1&&(0,m.jsx)("div",{className:"w-4 h-px bg-slate-700 mx-0.5"})]},a))}),e?(0,m.jsx)("div",{className:"text-xs text-slate-500 animate-pulse",children:"Loading stats..."}):f?(0,m.jsx)("div",{className:"text-xs text-red-400",children:"Failed to load stats"}):d?(0,m.jsxs)("div",{className:"grid grid-cols-3 gap-3",children:[(0,m.jsxs)("div",{className:"text-center",children:[(0,m.jsx)("div",{className:"text-2xl font-bold text-green-400",children:d.allowedCount}),(0,m.jsx)("div",{className:"text-[10px] text-slate-500 uppercase",children:"Allowed"})]}),(0,m.jsxs)("div",{className:"text-center",children:[(0,m.jsx)("div",{className:"text-2xl font-bold text-red-400",children:d.blockedCount}),(0,m.jsx)("div",{className:"text-[10px] text-slate-500 uppercase",children:"Blocked"})]}),(0,m.jsxs)("div",{className:"text-center",children:[(0,m.jsx)("div",{className:"text-2xl font-bold text-yellow-400",children:d.quarantinedCount}),(0,m.jsx)("div",{className:"text-[10px] text-slate-500 uppercase",children:"Quarantined"})]})]}):(0,m.jsx)("div",{className:"text-xs text-slate-500",children:"No data"}),(0,m.jsx)("button",{onClick:()=>gd.getState().setViewMode("audit"),className:"mt-3 w-full text-center text-xs text-cyan-400 hover:text-cyan-300 transition-colors py-1",children:"View full audit log →"}),(0,m.jsxs)("div",{className:"mt-2 pt-3 border-t border-slate-800 flex items-center justify-between",children:[(0,m.jsx)("span",{className:"text-xs text-slate-500",children:"Firewall Mode"}),(0,m.jsxs)("div",{className:"relative",ref:k,children:[(0,m.jsxs)("button",{onClick:()=>j(!i),className:`text-xs font-medium ${o.color} ${o.bg} px-2 py-0.5 rounded flex items-center gap-1 hover:opacity-80 transition-opacity`,children:[l,(0,m.jsx)(h5,{size:10})]}),i&&(0,m.jsx)("div",{className:"absolute right-0 top-full mt-1 bg-slate-800 border border-slate-700 rounded-lg shadow-xl z-50 min-w-[120px] py-1",children:["strict","balanced","permissive"].map(a=>{let b=h7[a];return(0,m.jsxs)("button",{onClick:()=>{h.mutate(a),j(!1)},className:`w-full text-left px-3 py-1.5 text-xs hover:bg-slate-700/50 transition-colors flex items-center justify-between ${a===l?b.color+" font-medium":"text-slate-400"}`,children:[a,a===l&&(0,m.jsx)("span",{className:"text-[10px]",children:"✓"})]},a)})})]})]})]})}function h9(){let{setViewMode:a,projectFilter:b}=gd(),{data:c,isLoading:d,isError:e}=hN("pending",3,b||void 0),f=c?.total??0,g=c?.items??[];return(0,m.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,m.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,m.jsx)("h3",{className:"text-sm font-medium text-slate-300",children:"Quarantine Queue"}),f>0&&(0,m.jsxs)("span",{className:"text-xs font-medium text-yellow-400 bg-yellow-400/10 px-2 py-0.5 rounded-full",children:[f," pending"]})]}),d?(0,m.jsx)("div",{className:"text-xs text-slate-500 animate-pulse",children:"Loading..."}):e?(0,m.jsx)("div",{className:"text-xs text-red-400",children:"Failed to load quarantine"}):0===g.length?(0,m.jsxs)("div",{className:"flex flex-col items-center py-6 text-slate-500",children:[(0,m.jsx)(hV,{size:24,className:"mb-2 text-slate-600"}),(0,m.jsx)("span",{className:"text-xs",children:"No items in quarantine"})]}):(0,m.jsx)("div",{className:"space-y-2",children:g.map(a=>{let b=(()=>{try{return JSON.parse(a.threat_indicators)}catch{return[]}})();return(0,m.jsxs)("div",{className:"bg-slate-800/50 border border-slate-700 rounded-lg p-3",children:[(0,m.jsxs)("div",{className:"flex items-start justify-between",children:[(0,m.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,m.jsx)("div",{className:"text-xs font-medium text-white truncate",children:a.title||"Untitled"}),(0,m.jsxs)("div",{className:"text-[10px] text-slate-500 mt-0.5",children:[a.source_type," · ",new Date(a.created_at).toLocaleTimeString()]})]}),(0,m.jsx)("span",{className:"text-[10px] text-red-400 bg-red-400/10 px-1.5 py-0.5 rounded shrink-0 ml-2",children:a.reason?.slice(0,30)||"Threat detected"})]}),b.length>0&&(0,m.jsx)("div",{className:"flex gap-1 mt-1.5 flex-wrap",children:b.slice(0,3).map((a,b)=>(0,m.jsx)("span",{className:"text-[9px] text-yellow-400 bg-yellow-400/10 px-1 py-0.5 rounded",children:a},b))})]},a.id)})}),f>0&&(0,m.jsxs)("button",{onClick:()=>a("quarantine"),className:"w-full mt-3 text-xs text-cyan-400 hover:text-cyan-300 transition-colors",children:["Review all ",f," items →"]})]})}function ia({timeRange:a}){let{projectFilter:b}=gd(),c={"24h":24,"7d":168,"30d":720},[d,e]=(0,n.useState)(()=>Date.now());(0,n.useEffect)(()=>{e(Date.now())},[a]);let{data:f,isLoading:g,isError:h}=hL({startTime:(0,n.useMemo)(()=>new Date(6e4*Math.floor((d-36e5*c[a])/6e4)).toISOString(),[d,a]),project:b||void 0,limit:500}),i=(0,n.useMemo)(()=>{if(!f?.logs.length)return[];let b="24h"===a?36e5:"7d"===a?216e5:864e5,c="24h"===a?24:"7d"===a?28:30,e=Array.from({length:c},(a,e)=>({time:d-(c-1-e)*b,allowed:0,blocked:0,quarantined:0}));for(let a of f.logs){let f=Math.floor((new Date(a.timestamp).getTime()-(d-c*b))/b),g=Math.min(Math.max(f,0),c-1);f>=0&&f<=c&&("ALLOW"===a.firewall_result?e[g].allowed++:"BLOCK"===a.firewall_result?e[g].blocked++:"QUARANTINE"===a.firewall_result&&e[g].quarantined++)}return e},[f,a,d]),j=Math.max(1,...i.map(a=>a.allowed+a.blocked+a.quarantined));return(0,m.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,m.jsx)("h3",{className:"text-sm font-medium text-slate-300 mb-4",children:"Threat Timeline"}),g?(0,m.jsx)("div",{className:"h-32 flex items-center justify-center",children:(0,m.jsx)("div",{className:"text-xs text-slate-500 animate-pulse",children:"Loading timeline..."})}):h?(0,m.jsx)("div",{className:"h-32 flex items-center justify-center",children:(0,m.jsx)("div",{className:"text-xs text-red-400",children:"Failed to load timeline"})}):0===i.length?(0,m.jsx)("div",{className:"h-32 flex items-center justify-center",children:(0,m.jsx)("div",{className:"text-xs text-slate-500",children:"No audit data"})}):(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("div",{className:"flex gap-px h-32",children:i.map((a,b)=>{let c=a.allowed+a.blocked+a.quarantined,d=c>0?a.blocked/c*100:0,e=c>0?a.quarantined/c*100:0;return(0,m.jsx)("div",{className:"flex-1 flex flex-col justify-end",title:`${new Date(a.time).toLocaleString()}: ${a.allowed} allowed, ${a.blocked} blocked, ${a.quarantined} quarantined`,children:(0,m.jsx)("div",{className:"w-full rounded-t-sm overflow-hidden",style:{height:`${Math.max(c/j*100,2*(c>0))}%`},children:(0,m.jsxs)("div",{className:"w-full h-full flex flex-col-reverse",children:[a.blocked>0&&(0,m.jsx)("div",{className:"bg-red-500",style:{height:`${d}%`}}),a.quarantined>0&&(0,m.jsx)("div",{className:"bg-yellow-500",style:{height:`${e}%`}}),(0,m.jsx)("div",{className:"bg-emerald-500/60 flex-1"})]})})},b)})}),(0,m.jsxs)("div",{className:"flex gap-4 mt-3 justify-center",children:[(0,m.jsxs)("div",{className:"flex items-center gap-1",children:[(0,m.jsx)("div",{className:"w-2 h-2 rounded-full bg-emerald-500/60"}),(0,m.jsx)("span",{className:"text-[10px] text-slate-500",children:"Allowed"})]}),(0,m.jsxs)("div",{className:"flex items-center gap-1",children:[(0,m.jsx)("div",{className:"w-2 h-2 rounded-full bg-red-500"}),(0,m.jsx)("span",{className:"text-[10px] text-slate-500",children:"Blocked"})]}),(0,m.jsxs)("div",{className:"flex items-center gap-1",children:[(0,m.jsx)("div",{className:"w-2 h-2 rounded-full bg-yellow-500"}),(0,m.jsx)("span",{className:"text-[10px] text-slate-500",children:"Quarantined"})]})]}),(0,m.jsx)("button",{onClick:()=>gd.getState().setViewMode("audit"),className:"mt-3 w-full text-center text-xs text-cyan-400 hover:text-cyan-300 transition-colors py-1",children:"View detailed audit log →"})]})]})}function ib({timeRange:a}){let{projectFilter:b}=gd(),{data:c,isLoading:d,isError:e}=hM(a,b||void 0);if(d)return(0,m.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,m.jsx)("h3",{className:"text-sm font-medium text-slate-300 mb-4",children:"Stats Summary"}),(0,m.jsx)("div",{className:"text-xs text-slate-500 animate-pulse",children:"Loading..."})]});if(e)return(0,m.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,m.jsx)("h3",{className:"text-sm font-medium text-slate-300 mb-4",children:"Stats Summary"}),(0,m.jsx)("div",{className:"text-xs text-red-400",children:"Failed to load stats"})]});if(!c)return(0,m.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,m.jsx)("h3",{className:"text-sm font-medium text-slate-300 mb-4",children:"Stats Summary"}),(0,m.jsx)("div",{className:"text-xs text-slate-500",children:"No data"})]});let f=c.totalOperations||1,g=(c.blockedCount/f*100).toFixed(1),h=Object.entries(c.threatBreakdown||{}).sort((a,b)=>b[1]-a[1]).slice(0,5);return(0,m.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,m.jsx)("h3",{className:"text-sm font-medium text-slate-300 mb-4",children:"Stats Summary"}),(0,m.jsxs)("div",{className:"grid grid-cols-2 gap-3 mb-4",children:[(0,m.jsxs)("div",{className:"bg-slate-800/50 rounded-lg p-3 text-center",children:[(0,m.jsx)("div",{className:"text-2xl font-bold text-white",children:c.totalOperations}),(0,m.jsx)("div",{className:"text-[10px] text-slate-500 uppercase",children:"Total Scans"})]}),(0,m.jsxs)("div",{className:"bg-slate-800/50 rounded-lg p-3 text-center",children:[(0,m.jsxs)("div",{className:`text-2xl font-bold ${parseFloat(g)>10?"text-red-400":"text-green-400"}`,children:[g,"%"]}),(0,m.jsx)("div",{className:"text-[10px] text-slate-500 uppercase",children:"Block Rate"})]})]}),c.topSources.length>0&&(0,m.jsxs)("div",{className:"mb-4",children:[(0,m.jsx)("div",{className:"text-[10px] text-slate-500 uppercase mb-2",children:"Top Sources"}),(0,m.jsx)("div",{className:"space-y-1",children:c.topSources.slice(0,3).map(a=>(0,m.jsxs)("div",{className:"flex items-center justify-between",children:[(0,m.jsx)("span",{className:"text-xs text-slate-400",children:a.source}),(0,m.jsx)("span",{className:"text-xs text-slate-500",children:a.count})]},a.source))})]}),h.length>0&&(0,m.jsxs)("div",{children:[(0,m.jsx)("div",{className:"text-[10px] text-slate-500 uppercase mb-2",children:"Threat Types"}),(0,m.jsx)("div",{className:"space-y-1",children:h.map(([a,b])=>(0,m.jsxs)("div",{className:"flex items-center justify-between",children:[(0,m.jsx)("span",{className:"text-xs text-slate-400",children:a}),(0,m.jsx)("span",{className:"text-xs font-medium text-red-400",children:b})]},a))})]}),(0,m.jsx)("button",{onClick:()=>gd.getState().setViewMode("audit"),className:"mt-3 w-full text-center text-xs text-cyan-400 hover:text-cyan-300 transition-colors py-1",children:"View full audit log →"})]})}let ic=hS("cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]),id=hS("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]),ie=hS("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),ig=hS("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),ih=hS("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function ii(){let{projectFilter:a}=gd(),{data:b}=hM("30d",a||void 0),[c,d]=(0,n.useState)("upsell"),[e,f]=(0,n.useState)(""),[g,h]=(0,n.useState)(null),[i,j]=(0,n.useState)(""),[k,l]=(0,n.useState)(!1);(0,n.useEffect)(()=>{let a=localStorage.getItem("shieldcortex_cloud_dismissed");if(a){let b=new Date(a);(Date.now()-b.getTime())/864e5<30&&d("hidden")}},[]),(0,n.useEffect)(()=>{fetch("http://localhost:3001/api/cloud/config").then(a=>a.json()).then(a=>{a.enabled&&a.apiKeySet&&d("hidden")}).catch(()=>{})},[]),(0,n.useEffect)(()=>{if("polling"!==c||!g)return;let a=setInterval(async()=>{try{let b=await fetch(`https://api.shieldcortex.ai/v1/auth/setup-status/${g}`),c=await b.json();"complete"===c.status&&c.api_key?(await fetch("http://localhost:3001/api/cloud/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cloudApiKey:c.api_key,cloudEnabled:!0,cloudBaseUrl:"https://api.shieldcortex.ai"})}),d("success"),clearInterval(a),setTimeout(()=>d("hidden"),5e3)):"expired"===c.status&&(j("Setup expired. Please try again."),d("upsell"),clearInterval(a))}catch{}},3e3);return()=>clearInterval(a)},[c,g]);let o=async a=>{if(a.preventDefault(),e&&!k){j(""),l(!0);try{let a=await fetch("https://api.shieldcortex.ai/v1/auth/cloud-setup",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:e})}),b=await a.json();b.setup_id?(h(b.setup_id),d("polling")):j(b.error||"Failed to start setup")}catch{j("Could not reach ShieldCortex Cloud. Check your connection.")}finally{l(!1)}}};if("hidden"===c)return null;let p=b?.blockedCount??0,q=b?.totalOperations??0;return(0,m.jsxs)("div",{className:"mt-4 bg-gradient-to-br from-slate-900 via-slate-900 to-cyan-950/30 border border-cyan-800/30 rounded-xl p-5 relative",children:["upsell"===c&&(0,m.jsx)("button",{onClick:()=>{localStorage.setItem("shieldcortex_cloud_dismissed",new Date().toISOString()),d("hidden")},className:"absolute top-3 right-3 text-slate-500 hover:text-slate-300 transition-colors",title:"Dismiss for 30 days",children:(0,m.jsx)(ih,{size:16})}),"upsell"===c&&(0,m.jsxs)("div",{className:"space-y-4",children:[(0,m.jsxs)("div",{className:"flex items-center gap-2",children:[(0,m.jsx)(ic,{size:20,className:"text-cyan-400"}),(0,m.jsx)("h3",{className:"text-sm font-semibold text-white",children:"ShieldCortex Cloud"})]}),(0,m.jsx)("p",{className:"text-sm text-slate-300",children:p>0?`You've blocked ${p} threats across ${q} scans — your team can't see them yet.`:"Sync your defence data to the cloud for team visibility, audit logs, and alerts."}),(0,m.jsxs)("form",{onSubmit:o,className:"flex gap-2",children:[(0,m.jsx)("input",{type:"email",placeholder:"Enter your email",value:e,onChange:a=>f(a.target.value),required:!0,className:"flex-1 bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-sm text-white placeholder:text-slate-500 focus:outline-none focus:ring-1 focus:ring-cyan-500 focus:border-cyan-500"}),(0,m.jsxs)("button",{type:"submit",disabled:k,className:"flex items-center gap-1.5 px-4 py-2 bg-cyan-600 hover:bg-cyan-500 disabled:opacity-50 rounded-lg text-sm font-medium text-white transition-colors",children:[k?(0,m.jsx)(ie,{size:14,className:"animate-spin"}):(0,m.jsx)(id,{size:14}),"Get Started"]})]}),i&&(0,m.jsx)("p",{className:"text-xs text-red-400",children:i}),(0,m.jsx)("p",{className:"text-[10px] text-slate-500",children:"Free tier: 500 scans/month, 7-day retention. No credit card required."})]}),"polling"===c&&(0,m.jsxs)("div",{className:"flex items-center gap-3 py-2",children:[(0,m.jsx)(ie,{size:20,className:"text-cyan-400 animate-spin"}),(0,m.jsxs)("div",{children:[(0,m.jsx)("p",{className:"text-sm text-white font-medium",children:"Check your email"}),(0,m.jsx)("p",{className:"text-xs text-slate-400",children:"Click the link in your inbox to complete setup. We'll auto-configure everything."})]})]}),"success"===c&&(0,m.jsxs)("div",{className:"flex items-center gap-3 py-2",children:[(0,m.jsx)(ig,{size:20,className:"text-emerald-400"}),(0,m.jsxs)("div",{children:[(0,m.jsx)("p",{className:"text-sm text-white font-medium",children:"Connected to ShieldCortex Cloud"}),(0,m.jsx)("p",{className:"text-xs text-slate-400",children:"Your defence data will now sync automatically."})]})]})]})}function ij(){let a,b,{data:c,isLoading:d}=fO({queryKey:["cloud-sync-status"],queryFn:async()=>{let a=await fetch("http://localhost:3001/api/cloud/sync-status");if(!a.ok)throw Error("Failed to fetch sync status");return a.json()},refetchInterval:1e4});if(d||!c)return null;let{enabled:e,apiKeySet:f,lastSyncAt:g,queue:h}=c;e&&f?h.failed>0?(a="bg-red-500",b=`${h.failed} event${1===h.failed?"":"s"} failed`):h.pending>0?(a="bg-amber-500",b=`${h.pending} event${1===h.pending?"":"s"} pending`):g?(a="bg-emerald-500",b="Cloud sync: OK"):(a="bg-emerald-500",b="Cloud sync: connected"):(a="bg-slate-500",b="Cloud sync: disabled");let i=g?function(a){let b=Math.floor((Date.now()-new Date(a).getTime())/1e3);if(b<60)return`${b}s ago`;let c=Math.floor(b/60);if(c<60)return`${c}m ago`;let d=Math.floor(c/60);if(d<24)return`${d}h ago`;let e=Math.floor(d/24);return`${e}d ago`}(g):null;return(0,m.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 mb-4 bg-slate-800 rounded-lg text-xs w-fit",children:[(0,m.jsx)("span",{className:`inline-block w-2 h-2 rounded-full ${a}`}),(0,m.jsx)("span",{className:"text-slate-300",children:b}),i&&(0,m.jsxs)("span",{className:"text-slate-500",children:["last sync ",i]})]})}let ik=hS("circle-x",[["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"}]]),il=process.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";async function im(a){let b=await fX(`${il}/api/skills/scan-all`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({dir:a})});if(!b.ok)throw Error("Failed to scan skills");return b.json()}async function io(a){let b=await fX(`${il}/api/skills/scan`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!b.ok)throw Error("Failed to scan skill content");return b.json()}function ip(){return fS({mutationFn:a=>im(a)})}async function iq(a){let b=await fX(`${il}/api/skills/trust`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:a})});if(!b.ok)throw Error("Failed to trust skill");return b.json()}async function ir(a){let b=await fX(`${il}/api/skills/trust`,{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:a})});if(!b.ok)throw Error("Failed to untrust skill");return b.json()}async function is(a){let b=await fX(`${il}/api/skills/file`,{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:a})});if(!b.ok)throw Error((await b.json().catch(()=>({}))).error||"Failed to delete skill file");return b.json()}function it(){let a=ip(),{setViewMode:b}=gd(),[c,d]=(0,n.useState)(null),e=c?c.files.filter(a=>a.safe).length:0,f=c?.threatCount??0;return(0,m.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,m.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,m.jsx)("h3",{className:"text-sm font-medium text-slate-300",children:"Skill Scanner"}),(0,m.jsxs)("button",{onClick:()=>{a.mutate(void 0,{onSuccess:a=>d(a)})},disabled:a.isPending,className:"flex items-center gap-1.5 px-3 py-1.5 bg-cyan-600 hover:bg-cyan-500 disabled:opacity-50 rounded-lg text-xs font-medium text-white transition-colors",children:[a.isPending?(0,m.jsx)(ie,{size:12,className:"animate-spin"}):(0,m.jsx)(h$,{size:12}),"Scan All"]})]}),c?(0,m.jsxs)("div",{children:[(0,m.jsxs)("div",{className:"flex items-center gap-4 mb-3",children:[(0,m.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,m.jsx)(ig,{size:14,className:"text-green-400"}),(0,m.jsx)("span",{className:"text-sm font-medium text-green-400",children:e}),(0,m.jsx)("span",{className:"text-[10px] text-slate-500",children:"safe"})]}),f>0&&(0,m.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,m.jsx)(ik,{size:14,className:"text-red-400"}),(0,m.jsx)("span",{className:"text-sm font-medium text-red-400",children:f}),(0,m.jsx)("span",{className:"text-[10px] text-slate-500",children:"threats"})]}),(0,m.jsx)("span",{className:"text-[10px] text-slate-600",children:new Date(c.scannedAt).toLocaleTimeString()})]}),(0,m.jsxs)("button",{onClick:()=>b("skills"),className:"flex items-center gap-1 text-xs text-cyan-400 hover:text-cyan-300 transition-colors",children:["View all results",(0,m.jsx)(id,{size:12})]})]}):a.isPending?(0,m.jsx)("div",{className:"flex items-center justify-center py-4",children:(0,m.jsx)(ie,{size:16,className:"text-cyan-400 animate-spin"})}):(0,m.jsxs)("div",{className:"text-center py-3",children:[(0,m.jsx)(h$,{size:20,className:"text-slate-600 mx-auto mb-1.5"}),(0,m.jsx)("p",{className:"text-[10px] text-slate-500",children:"Scan agent instruction files for threats"})]})]})}let iu=process.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";async function iv(){let a=await fetch(`${iu}/api/iron-dome/status`);if(!a.ok)throw Error("Failed to fetch Iron Dome status");return a.json()}async function iw(a){let b=await fX(`${iu}/api/iron-dome/activate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({profile:a})});if(!b.ok)throw Error("Failed to activate Iron Dome");return b.json()}async function ix(){let a=await fX(`${iu}/api/iron-dome/deactivate`,{method:"POST"});if(!a.ok)throw Error("Failed to deactivate Iron Dome");return a.json()}async function iy(a){let b=await fX(`${iu}/api/iron-dome/scan`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:a})});if(!b.ok)throw Error("Failed to scan text");return b.json()}async function iz(a){let b=new URLSearchParams;a&&b.set("limit",a.toString());let c=await fetch(`${iu}/api/iron-dome/audit?${b}`);if(!c.ok)throw Error("Failed to fetch Iron Dome audit");return c.json()}function iA(){return fO({queryKey:["iron-dome-status"],queryFn:iv,refetchInterval:3e4,retry:2})}function iB(a){return fO({queryKey:["iron-dome-audit",a],queryFn:()=>iz(a),refetchInterval:3e4,retry:2})}function iC(){let{data:a,isLoading:b}=iA(),{data:c}=iB(100),d=a?.enabled??!1,e=a?.profile??"custom",f=c?.logs??[],g=f.filter(a=>a.reason?.includes("[iron-dome:")&&"BLOCK"===a.firewall_result).length,h=f.length;return(0,m.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,m.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,m.jsx)("h3",{className:"text-sm font-medium text-slate-300",children:"Iron Dome"}),(0,m.jsx)("span",{className:`text-[10px] font-medium px-2 py-0.5 rounded-full ${d?"bg-red-500/20 text-red-400 border border-red-500/30":"bg-slate-700/50 text-slate-500"}`,children:d?"ACTIVE":"INACTIVE"})]}),b?(0,m.jsx)("div",{className:"text-xs text-slate-500 animate-pulse",children:"Loading..."}):d?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)("div",{className:"text-xs text-slate-500 mb-3",children:["Profile: ",(0,m.jsx)("span",{className:"text-red-400 font-medium",children:e})]}),(0,m.jsxs)("div",{className:"grid grid-cols-2 gap-3 mb-3",children:[(0,m.jsxs)("div",{className:"bg-slate-800/50 rounded-lg p-2 text-center",children:[(0,m.jsx)("div",{className:"text-lg font-bold text-red-400",children:g}),(0,m.jsx)("div",{className:"text-[10px] text-slate-500 uppercase",children:"Blocks"})]}),(0,m.jsxs)("div",{className:"bg-slate-800/50 rounded-lg p-2 text-center",children:[(0,m.jsx)("div",{className:"text-lg font-bold text-slate-300",children:h}),(0,m.jsx)("div",{className:"text-[10px] text-slate-500 uppercase",children:"Events"})]})]})]}):(0,m.jsxs)("div",{className:"text-center py-3",children:[(0,m.jsx)(hT,{size:20,className:"text-slate-600 mx-auto mb-1.5"}),(0,m.jsx)("p",{className:"text-[10px] text-slate-500",children:"Behaviour protection layer — not active"})]}),(0,m.jsx)("button",{onClick:()=>gd.getState().setViewMode("dome"),className:"w-full text-center text-xs text-red-400 hover:text-red-300 transition-colors py-1",children:"View Iron Dome →"})]})}let iD="http://localhost:3001";function iE(){return fO({queryKey:["cloud-config"],queryFn:async()=>{let a=await fX(`${iD}/api/cloud/config`);if(!a.ok)throw Error("Failed to fetch cloud config");return a.json()},refetchInterval:3e4})}function iF(a,b,c){return Math.max(b,Math.min(c,a))}function iG({initialAutoMemory:a,initialDedupe:b,initialNoveltyThreshold:c,initialMaxRecent:d}){let e,f=(e=(0,fK.useQueryClient)(),fS({mutationFn:async a=>{let b=await fX(`${iD}/api/cloud/config`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!b.ok)throw Error("Failed to update cloud config");return b.json()},onSuccess:()=>{e.invalidateQueries({queryKey:["cloud-config"]})}})),[g,h]=(0,n.useState)(a),[i,j]=(0,n.useState)(b),[k,l]=(0,n.useState)(String(c)),[o,p]=(0,n.useState)(String(d)),q=f.isPending;return(0,m.jsxs)("div",{className:"mt-4 space-y-3",children:[(0,m.jsxs)("div",{className:"flex items-center justify-between",children:[(0,m.jsx)("span",{className:"text-xs text-slate-400",children:"Auto-memory extraction"}),(0,m.jsx)("button",{type:"button",onClick:()=>h(!g),className:`h-6 w-11 rounded-full transition-colors ${g?"bg-cyan-500":"bg-slate-700"}`,children:(0,m.jsx)("span",{className:`block h-5 w-5 rounded-full bg-white transition-transform ${g?"translate-x-5":"translate-x-0.5"}`})})]}),(0,m.jsxs)("div",{className:"flex items-center justify-between",children:[(0,m.jsx)("span",{className:"text-xs text-slate-400",children:"Novelty dedupe"}),(0,m.jsx)("button",{type:"button",onClick:()=>j(!i),disabled:!g,className:`h-6 w-11 rounded-full transition-colors ${i&&g?"bg-emerald-500":"bg-slate-700"} ${!g?"opacity-50 cursor-not-allowed":""}`,children:(0,m.jsx)("span",{className:`block h-5 w-5 rounded-full bg-white transition-transform ${i&&g?"translate-x-5":"translate-x-0.5"}`})})]}),(0,m.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,m.jsxs)("div",{children:[(0,m.jsx)("label",{className:"block text-[11px] text-slate-500 mb-1",children:"Novelty threshold"}),(0,m.jsx)(ht,{type:"number",step:"0.01",min:.6,max:.99,value:k,disabled:!g||!i,onChange:a=>l(a.target.value),className:"h-8 text-xs bg-slate-800 border-slate-700"})]}),(0,m.jsxs)("div",{children:[(0,m.jsx)("label",{className:"block text-[11px] text-slate-500 mb-1",children:"Max recent records"}),(0,m.jsx)(ht,{type:"number",step:"1",min:50,max:1e3,value:o,disabled:!g||!i,onChange:a=>p(a.target.value),className:"h-8 text-xs bg-slate-800 border-slate-700"})]})]}),(0,m.jsxs)("div",{className:"flex items-center justify-between pt-1",children:[(0,m.jsx)("span",{className:"text-[11px] text-slate-500",children:"Default: dedupe on, threshold 0.88, max 300"}),(0,m.jsxs)(hs,{size:"sm",onClick:()=>{let a=iF(Number.parseFloat(k),.6,.99),b=Math.floor(iF(Number.parseInt(o,10),50,1e3));f.mutate({openclawAutoMemory:g,openclawAutoMemoryDedupe:i,openclawAutoMemoryNoveltyThreshold:Number.isFinite(a)?a:.88,openclawAutoMemoryMaxRecent:Number.isFinite(b)?b:300})},disabled:q,className:"h-8 text-xs bg-cyan-600 hover:bg-cyan-500 text-white",children:[q?(0,m.jsx)(ie,{size:12,className:"animate-spin"}):null,"Save"]})]})]})}function iH(){let{data:a,isLoading:b}=iE(),c=a?.openclawMemory,d=c?`${c.autoMemory}-${c.dedupe}-${c.noveltyThreshold}-${c.maxRecent}`:"default";return(0,m.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,m.jsx)("h3",{className:"text-sm font-medium text-slate-300",children:"OpenClaw Memory"}),(0,m.jsx)("p",{className:"text-xs text-slate-500 mt-1",children:"Configure how ShieldCortex complements native OpenClaw memory."}),(0,m.jsx)("p",{className:"text-[11px] text-slate-600 mt-1",children:"Changes apply on next OpenClaw gateway restart."}),b?(0,m.jsx)("div",{className:"text-xs text-slate-500 mt-4 animate-pulse",children:"Loading settings..."}):(0,m.jsx)(iG,{initialAutoMemory:c?.autoMemory??!1,initialDedupe:c?.dedupe??!0,initialNoveltyThreshold:c?.noveltyThreshold??.88,initialMaxRecent:c?.maxRecent??300},d)]})}function iI(){let[a,b]=(0,n.useState)("24h");return(0,m.jsxs)("div",{className:"h-full overflow-y-auto p-6",children:[(0,m.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,m.jsx)("h2",{className:"text-lg font-semibold text-white",children:"Defence Overview"}),(0,m.jsx)("div",{className:"flex gap-1 bg-slate-800 rounded-lg p-0.5",children:["24h","7d","30d"].map(c=>(0,m.jsx)("button",{onClick:()=>b(c),className:`px-3 py-1 text-xs rounded-md transition-colors ${a===c?"bg-cyan-600 text-white":"text-slate-400 hover:text-white"}`,children:c},c))})]}),(0,m.jsx)(ij,{}),(0,m.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[(0,m.jsx)(h8,{timeRange:a}),(0,m.jsx)(h9,{}),(0,m.jsx)(ia,{timeRange:a}),(0,m.jsx)(ib,{timeRange:a})]}),(0,m.jsx)("div",{className:"mt-4",children:(0,m.jsx)(it,{})}),(0,m.jsx)("div",{className:"mt-4",children:(0,m.jsx)(iC,{})}),(0,m.jsx)("div",{className:"mt-4",children:(0,m.jsx)(iH,{})}),(0,m.jsx)(ii,{})]})}let iJ={ALLOW:"bg-green-500/10 text-green-400",BLOCK:"bg-red-500/10 text-red-400",QUARANTINE:"bg-yellow-500/10 text-yellow-400"};function iK(){let{projectFilter:a,selectedAuditEntry:b,setSelectedAuditEntry:c}=gd(),[d,e]=(0,n.useState)("24h"),[f,g]=(0,n.useState)(void 0),[h,i]=(0,n.useState)(void 0),j={"24h":24,"7d":168,"30d":720},[k,l]=(0,n.useState)(()=>Date.now());(0,n.useEffect)(()=>{l(Date.now())},[d]);let{data:o,isLoading:p}=hL({startTime:(0,n.useMemo)(()=>new Date(6e4*Math.floor((k-36e5*j[d])/6e4)).toISOString(),[k,d]),source:f,firewallResult:h,project:a||void 0,limit:200}),q=o?.logs??[],r=(0,n.useCallback)(a=>{if(!b||0===q.length)return;let d=q.findIndex(a=>a.id===b.id);"Escape"===a.key?c(null):"ArrowDown"===a.key&&d<q.length-1?(a.preventDefault(),c(q[d+1])):"ArrowUp"===a.key&&d>0&&(a.preventDefault(),c(q[d-1]))},[b,q,c]);return(0,n.useEffect)(()=>(window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)),[r]),(0,m.jsxs)("div",{className:"h-full flex flex-col overflow-hidden",children:[(0,m.jsxs)("div",{className:"p-4 border-b border-slate-800 shrink-0",children:[(0,m.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,m.jsx)("h2",{className:"text-lg font-semibold text-white",children:"Audit Log"}),(0,m.jsx)("div",{className:"flex gap-1 bg-slate-800 rounded-lg p-0.5",children:["24h","7d","30d"].map(a=>(0,m.jsx)("button",{onClick:()=>e(a),className:`px-3 py-1 text-xs rounded-md transition-colors ${d===a?"bg-cyan-600 text-white":"text-slate-400 hover:text-white"}`,children:a},a))})]}),(0,m.jsxs)("div",{className:"flex gap-2",children:[(0,m.jsxs)("select",{value:h||"",onChange:a=>i(a.target.value||void 0),className:"bg-slate-800 border border-slate-700 text-white text-xs rounded-lg px-2 py-1",children:[(0,m.jsx)("option",{value:"",children:"All Results"}),(0,m.jsx)("option",{value:"ALLOW",children:"Allowed"}),(0,m.jsx)("option",{value:"BLOCK",children:"Blocked"}),(0,m.jsx)("option",{value:"QUARANTINE",children:"Quarantined"})]}),(0,m.jsxs)("select",{value:f||"",onChange:a=>g(a.target.value||void 0),className:"bg-slate-800 border border-slate-700 text-white text-xs rounded-lg px-2 py-1",children:[(0,m.jsx)("option",{value:"",children:"All Sources"}),(0,m.jsx)("option",{value:"hook",children:"Hook"}),(0,m.jsx)("option",{value:"api",children:"API"}),(0,m.jsx)("option",{value:"agent",children:"Agent"}),(0,m.jsx)("option",{value:"user",children:"User"}),(0,m.jsx)("option",{value:"cli",children:"CLI"})]}),(0,m.jsxs)("span",{className:"text-xs text-slate-500 self-center ml-auto",children:[q.length," entries"]})]})]}),(0,m.jsx)("div",{className:"flex-1 overflow-y-auto",children:p?(0,m.jsx)("div",{className:"flex items-center justify-center h-32",children:(0,m.jsx)("div",{className:"text-xs text-slate-500 animate-pulse",children:"Loading audit logs..."})}):0===q.length?(0,m.jsx)("div",{className:"flex items-center justify-center h-32",children:(0,m.jsx)("div",{className:"text-xs text-slate-500",children:"No audit entries for this period"})}):(0,m.jsxs)("table",{className:"w-full text-xs",children:[(0,m.jsx)("thead",{className:"sticky top-0 bg-slate-900",children:(0,m.jsxs)("tr",{className:"border-b border-slate-800",children:[(0,m.jsx)("th",{className:"text-left text-slate-500 font-medium px-4 py-2",children:"Time"}),(0,m.jsx)("th",{className:"text-left text-slate-500 font-medium px-4 py-2",children:"Source"}),(0,m.jsx)("th",{className:"text-left text-slate-500 font-medium px-4 py-2",children:"Result"}),(0,m.jsx)("th",{className:"text-left text-slate-500 font-medium px-4 py-2",children:"Trust"}),(0,m.jsx)("th",{className:"text-left text-slate-500 font-medium px-4 py-2",children:"Anomaly"}),(0,m.jsx)("th",{className:"text-left text-slate-500 font-medium px-4 py-2",children:"Reason"})]})}),(0,m.jsx)("tbody",{children:q.map(a=>(0,m.jsxs)("tr",{onClick:()=>{c(b?.id===a.id?null:a)},className:`border-b border-slate-800/50 cursor-pointer transition-colors ${b?.id===a.id?"bg-cyan-500/10 hover:bg-cyan-500/15":"hover:bg-slate-800/30"}`,children:[(0,m.jsx)("td",{className:"px-4 py-2 text-slate-400 whitespace-nowrap",children:new Date(a.timestamp).toLocaleString()}),(0,m.jsx)("td",{className:"px-4 py-2 text-slate-300",children:a.source_type}),(0,m.jsx)("td",{className:"px-4 py-2",children:(0,m.jsx)("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-medium ${iJ[a.firewall_result]||"text-slate-400"}`,children:a.firewall_result})}),(0,m.jsx)("td",{className:"px-4 py-2 text-slate-400",children:a.trust_score.toFixed(1)}),(0,m.jsx)("td",{className:"px-4 py-2",children:(0,m.jsx)("span",{className:a.anomaly_score>.5?"text-red-400":a.anomaly_score>.2?"text-yellow-400":"text-slate-400",children:a.anomaly_score.toFixed(2)})}),(0,m.jsx)("td",{className:"px-4 py-2 text-slate-400 max-w-xs truncate",children:a.reason||"—"})]},a.id))})]})})]})}let iL={ALLOW:{color:"#22C55E",bg:"rgba(34, 197, 94, 0.15)",label:"Allowed"},BLOCK:{color:"#EF4444",bg:"rgba(239, 68, 68, 0.15)",label:"Blocked"},QUARANTINE:{color:"#EAB308",bg:"rgba(234, 179, 8, 0.15)",label:"Quarantined"}},iM={PUBLIC:{color:"#94a3b8",bg:"rgba(148, 163, 184, 0.15)"},INTERNAL:{color:"#60a5fa",bg:"rgba(96, 165, 250, 0.15)"},CONFIDENTIAL:{color:"#f59e0b",bg:"rgba(245, 158, 11, 0.15)"},RESTRICTED:{color:"#ef4444",bg:"rgba(239, 68, 68, 0.15)"}},iN={instruction_injection:{color:"#ef4444",bg:"rgba(239, 68, 68, 0.15)"},privilege_escalation:{color:"#ef4444",bg:"rgba(239, 68, 68, 0.15)"},credential_leak:{color:"#ef4444",bg:"rgba(239, 68, 68, 0.15)"},encoding_obfuscation:{color:"#f59e0b",bg:"rgba(245, 158, 11, 0.15)"},fragmented_payload:{color:"#f59e0b",bg:"rgba(245, 158, 11, 0.15)"},external_url:{color:"#f59e0b",bg:"rgba(245, 158, 11, 0.15)"},pipeline_error:{color:"#94a3b8",bg:"rgba(148, 163, 184, 0.15)"}};function iO(a){return a>=.7?"#22C55E":a>=.4?"#EAB308":"#EF4444"}function iP(a){return a>.5?"#EF4444":a>.2?"#EAB308":"#94a3b8"}function iQ({entry:a,onClose:b,onViewMemory:c}){let[d,e]=(0,n.useState)(!1),f=iL[a.firewall_result]||iL.ALLOW,g=iM[a.sensitivity_level]||iM.PUBLIC,h=function(a){try{let b=JSON.parse(a);return Array.isArray(b)?b:[]}catch{return[]}}(a.threat_indicators),i=function(a){try{let b=JSON.parse(a);return Array.isArray(b)?b:[]}catch{return[]}}(a.blocked_patterns),j=(0,n.useCallback)(()=>{let b=JSON.stringify(a,null,2);navigator.clipboard.writeText(b).then(()=>{e(!0),setTimeout(()=>e(!1),1500)})},[a]);return(0,m.jsxs)(hf,{className:"bg-slate-900 border-slate-700 h-full overflow-auto",children:[(0,m.jsxs)(hg,{className:"border-b border-slate-700 pb-3",children:[(0,m.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,m.jsxs)("div",{className:"flex items-center gap-3",children:[(0,m.jsx)("span",{className:"px-2.5 py-1 rounded-md text-xs font-bold",style:{backgroundColor:f.bg,color:f.color},children:f.label}),(0,m.jsx)("span",{className:"px-2 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:g.bg,color:g.color},children:a.sensitivity_level})]}),(0,m.jsx)(hs,{variant:"ghost",size:"sm",onClick:b,className:"text-slate-400 hover:text-white -mt-1",children:"✕"})]}),(0,m.jsx)("div",{className:"text-xs text-slate-400 mt-2",children:new Date(a.timestamp).toLocaleString()}),a.project&&(0,m.jsxs)("div",{className:"text-[10px] text-slate-500 mt-1",children:["Project: ",a.project]})]}),(0,m.jsxs)(hi,{className:"p-4 space-y-4",children:[(0,m.jsxs)("div",{children:[(0,m.jsx)("h4",{className:"text-xs font-medium text-slate-400 mb-2",children:"Source"}),(0,m.jsxs)("div",{className:"bg-slate-800 rounded-lg p-3",children:[(0,m.jsx)("div",{className:"flex items-center gap-2 mb-1",children:(0,m.jsx)("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium bg-cyan-500/10 text-cyan-400",children:a.source_type})}),a.source_identifier&&(0,m.jsx)("div",{className:"text-xs text-slate-300 mt-1 font-mono break-all",children:a.source_identifier})]})]}),(0,m.jsxs)("div",{children:[(0,m.jsx)("h4",{className:"text-xs font-medium text-slate-400 mb-2",children:"Scores"}),(0,m.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,m.jsxs)("div",{className:"bg-slate-800 rounded-lg p-3",children:[(0,m.jsx)("div",{className:"text-[10px] text-slate-500",children:"Trust"}),(0,m.jsxs)("div",{className:"text-lg font-bold",style:{color:iO(a.trust_score)},children:[(100*a.trust_score).toFixed(0),"%"]}),(0,m.jsx)("div",{className:"mt-1 h-1.5 bg-slate-700 rounded-full overflow-hidden",children:(0,m.jsx)("div",{className:"h-full rounded-full transition-all",style:{width:`${100*a.trust_score}%`,backgroundColor:iO(a.trust_score)}})})]}),(0,m.jsxs)("div",{className:"bg-slate-800 rounded-lg p-3",children:[(0,m.jsx)("div",{className:"text-[10px] text-slate-500",children:"Anomaly"}),(0,m.jsxs)("div",{className:"text-lg font-bold",style:{color:iP(a.anomaly_score)},children:[(100*a.anomaly_score).toFixed(0),"%"]}),(0,m.jsx)("div",{className:"mt-1 h-1.5 bg-slate-700 rounded-full overflow-hidden",children:(0,m.jsx)("div",{className:"h-full rounded-full transition-all",style:{width:`${100*a.anomaly_score}%`,backgroundColor:iP(a.anomaly_score)}})})]}),null!==a.fragmentation_score&&(0,m.jsxs)("div",{className:"bg-slate-800 rounded-lg p-3",children:[(0,m.jsx)("div",{className:"text-[10px] text-slate-500",children:"Fragmentation"}),(0,m.jsxs)("div",{className:"text-lg font-bold text-slate-300",children:[(100*a.fragmentation_score).toFixed(0),"%"]}),(0,m.jsx)("div",{className:"mt-1 h-1.5 bg-slate-700 rounded-full overflow-hidden",children:(0,m.jsx)("div",{className:"h-full rounded-full bg-purple-500 transition-all",style:{width:`${100*a.fragmentation_score}%`}})})]}),null!==a.pipeline_duration_ms&&(0,m.jsxs)("div",{className:"bg-slate-800 rounded-lg p-3",children:[(0,m.jsx)("div",{className:"text-[10px] text-slate-500",children:"Pipeline"}),(0,m.jsxs)("div",{className:"text-lg font-bold text-slate-300",children:[a.pipeline_duration_ms,"ms"]})]})]})]}),(0,m.jsxs)("div",{children:[(0,m.jsx)("h4",{className:"text-xs font-medium text-slate-400 mb-2",children:"Threat Indicators"}),h.length>0?(0,m.jsx)("div",{className:"flex flex-wrap gap-1.5",children:h.map((a,b)=>{let c=iN[a]||{color:"#94a3b8",bg:"rgba(148, 163, 184, 0.15)"};return(0,m.jsx)("span",{className:"px-2 py-1 rounded text-[11px] font-medium",style:{backgroundColor:c.bg,color:c.color},children:a.replace(/_/g," ")},b)})}):(0,m.jsx)("div",{className:"text-xs text-slate-600",children:"No threats detected"})]}),i.length>0&&(0,m.jsxs)("div",{children:[(0,m.jsx)("h4",{className:"text-xs font-medium text-slate-400 mb-2",children:"Blocked Patterns"}),(0,m.jsx)("div",{className:"bg-slate-800 rounded-lg p-3 max-h-32 overflow-y-auto",children:i.map((a,b)=>(0,m.jsx)("div",{className:"text-[11px] text-slate-300 font-mono break-all mb-1 last:mb-0",children:a},b))})]}),a.reason&&(0,m.jsxs)("div",{children:[(0,m.jsx)("h4",{className:"text-xs font-medium text-slate-400 mb-2",children:"Reason"}),(0,m.jsx)("div",{className:"bg-slate-800 rounded-lg p-3",children:(0,m.jsx)("p",{className:"text-xs text-slate-300 whitespace-pre-wrap leading-relaxed",children:a.reason})})]}),(0,m.jsxs)("div",{className:"flex gap-2 pt-2",children:[a.memory_id&&c&&(0,m.jsx)(hs,{variant:"default",size:"sm",onClick:()=>c(a.memory_id),className:"flex-1 bg-blue-600 hover:bg-blue-700",children:"View Memory"}),(0,m.jsx)(hs,{variant:"outline",size:"sm",onClick:j,className:`flex-1 border-slate-700 transition-all ${d?"bg-green-600/20 text-green-400 border-green-600/50":"text-slate-300 hover:text-white"}`,children:d?"Copied":"Copy JSON"})]})]})]})}let iR=hS("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);function iS({action:a,item:b,onConfirm:c,onCancel:d}){let[e,f]=(0,n.useState)(""),g="yes"===e.trim().toLowerCase();return(0,m.jsx)("div",{className:"fixed inset-0 bg-black/60 flex items-center justify-center z-50",children:(0,m.jsxs)("div",{className:"bg-slate-900 border border-slate-700 rounded-xl p-6 max-w-md w-full mx-4",children:[(0,m.jsxs)("h3",{className:"text-sm font-semibold text-white mb-2",children:["approve"===a?"Approve":"Reject"," quarantined item?"]}),(0,m.jsx)("p",{className:"text-xs text-slate-400 mb-1",children:(0,m.jsx)("strong",{children:b.title||"Untitled"})}),(0,m.jsx)("p",{className:"text-xs text-slate-500 mb-4",children:"approve"===a?"This will store the memory in the database.":"This will permanently discard the memory."}),(0,m.jsxs)("div",{className:"mb-4",children:[(0,m.jsxs)("label",{className:"text-xs text-slate-400 block mb-1",children:["Type ",(0,m.jsx)("strong",{className:"text-white",children:"YES"})," to confirm:"]}),(0,m.jsx)("input",{type:"text",value:e,onChange:a=>f(a.target.value),className:"w-full bg-slate-800 border border-slate-700 text-white text-sm rounded-lg px-3 py-2 focus:ring-cyan-500 focus:border-cyan-500",autoFocus:!0,onKeyDown:a=>{"Enter"===a.key&&g&&c(),"Escape"===a.key&&d()}})]}),(0,m.jsxs)("div",{className:"flex gap-2 justify-end",children:[(0,m.jsx)("button",{onClick:d,className:"px-3 py-1.5 text-xs text-slate-400 hover:text-white transition-colors",children:"Cancel"}),(0,m.jsx)("button",{onClick:c,disabled:!g,className:`px-3 py-1.5 text-xs rounded-lg transition-colors ${g?"approve"===a?"bg-green-600 text-white hover:bg-green-500":"bg-red-600 text-white hover:bg-red-500":"bg-slate-700 text-slate-500 cursor-not-allowed"}`,children:"approve"===a?"Approve":"Reject"})]})]})})}function iT(){let a,b,{projectFilter:c}=gd(),[d,e]=(0,n.useState)("pending"),{data:f,isLoading:g}=hN(d,100,c||void 0),h=(a=(0,fK.useQueryClient)(),fS({mutationFn:hJ,onSuccess:()=>{a.invalidateQueries({queryKey:["quarantine"]}),a.invalidateQueries({queryKey:["audit-stats"]})}})),i=(b=(0,fK.useQueryClient)(),fS({mutationFn:({id:a,notes:b})=>hK(a,b),onSuccess:()=>{b.invalidateQueries({queryKey:["quarantine"]}),b.invalidateQueries({queryKey:["audit-stats"]})}})),[j,k]=(0,n.useState)(null),l=f?.items??[];return(0,m.jsxs)("div",{className:"h-full flex flex-col overflow-hidden",children:[j&&(0,m.jsx)(iS,{action:j.action,item:j.item,onConfirm:()=>{j&&("approve"===j.action?h.mutate(j.item.id):i.mutate({id:j.item.id}),k(null))},onCancel:()=>k(null)}),(0,m.jsx)("div",{className:"p-4 border-b border-slate-800 shrink-0",children:(0,m.jsxs)("div",{className:"flex items-center justify-between",children:[(0,m.jsx)("h2",{className:"text-lg font-semibold text-white",children:"Quarantine Review"}),(0,m.jsx)("div",{className:"flex gap-1 bg-slate-800 rounded-lg p-0.5",children:["pending","approved","rejected"].map(a=>(0,m.jsx)("button",{onClick:()=>e(a),className:`px-3 py-1 text-xs rounded-md transition-colors capitalize ${d===a?"bg-cyan-600 text-white":"text-slate-400 hover:text-white"}`,children:a},a))})]})}),(0,m.jsx)("div",{className:"flex-1 overflow-y-auto p-4",children:g?(0,m.jsx)("div",{className:"flex items-center justify-center h-32",children:(0,m.jsx)("div",{className:"text-xs text-slate-500 animate-pulse",children:"Loading quarantine items..."})}):0===l.length?(0,m.jsxs)("div",{className:"flex flex-col items-center justify-center h-32 text-slate-500",children:[(0,m.jsx)(hV,{size:24,className:"mb-2 text-slate-600"}),(0,m.jsxs)("span",{className:"text-xs",children:["No ",d," items"]})]}):(0,m.jsx)("div",{className:"space-y-3",children:l.map(a=>{let b=(()=>{try{return JSON.parse(a.threat_indicators)}catch{return[]}})();return(0,m.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,m.jsxs)("div",{className:"flex items-start justify-between mb-2",children:[(0,m.jsxs)("div",{children:[(0,m.jsx)("h4",{className:"text-sm font-medium text-white",children:a.title||"Untitled"}),(0,m.jsxs)("div",{className:"text-[10px] text-slate-500 mt-0.5",children:[a.source_type," · ",new Date(a.created_at).toLocaleString(),a.anomaly_score>0&&(0,m.jsxs)("span",{className:`ml-2 ${a.anomaly_score>.5?"text-red-400":"text-yellow-400"}`,children:["Anomaly: ",a.anomaly_score.toFixed(2)]})]})]}),(0,m.jsx)("span",{className:"text-[10px] text-red-400 bg-red-400/10 px-2 py-0.5 rounded",children:a.reason?.slice(0,50)||"Threat detected"})]}),(0,m.jsx)("div",{className:"bg-slate-800/50 rounded-lg p-3 mb-3 text-xs text-slate-300 max-h-24 overflow-y-auto whitespace-pre-wrap",children:a.content?.slice(0,500)||"No content"}),b.length>0&&(0,m.jsx)("div",{className:"flex gap-1 mb-3 flex-wrap",children:b.map((a,b)=>(0,m.jsx)("span",{className:"text-[9px] text-yellow-400 bg-yellow-400/10 px-1.5 py-0.5 rounded",children:a},b))}),"pending"===a.status&&(0,m.jsxs)("div",{className:"flex gap-2",children:[(0,m.jsxs)("button",{onClick:()=>k({action:"approve",item:a}),className:"flex items-center gap-1 px-3 py-1.5 text-xs bg-green-600/10 text-green-400 rounded-lg hover:bg-green-600/20 transition-colors",children:[(0,m.jsx)(iR,{size:12})," Approve"]}),(0,m.jsxs)("button",{onClick:()=>k({action:"reject",item:a}),className:"flex items-center gap-1 px-3 py-1.5 text-xs bg-red-600/10 text-red-400 rounded-lg hover:bg-red-600/20 transition-colors",children:[(0,m.jsx)(ih,{size:12})," Reject"]})]}),a.reviewed_at&&(0,m.jsxs)("div",{className:"text-[10px] text-slate-500",children:["approved"===a.status?"Approved":"Rejected"," by ",a.reviewed_by," at ",new Date(a.reviewed_at).toLocaleString()]})]},a.id)})})})]})}let iU=hS("funnel",[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]]),iV=hS("arrow-up-down",[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]]),iW=hS("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),iX=process.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";async function iY(a,b){let c=new URLSearchParams({timeRange:a});b&&c.set("project",b);let d=await fetch(`${iX}/api/v1/agents?${c}`);if(!d.ok)throw Error("Failed to fetch agent registry");return d.json()}async function iZ(a,b,c){let d=encodeURIComponent(a),e=new URLSearchParams({timeRange:b});c&&e.set("project",c);let f=await fetch(`${iX}/api/v1/agents/${d}/timeline?${e}`);if(!f.ok)throw Error("Failed to fetch agent timeline");return f.json()}async function i$(a,b){let c=encodeURIComponent(a),d=new URLSearchParams;b?.limit&&d.set("limit",b.limit.toString()),b?.offset&&d.set("offset",b.offset.toString()),b?.firewallResult&&d.set("firewallResult",b.firewallResult),b?.project&&d.set("project",b.project);let e=await fetch(`${iX}/api/v1/agents/${c}/operations?${d}`);if(!e.ok)throw Error("Failed to fetch agent operations");return e.json()}function i_(a,b){return fO({queryKey:["agent-operations",a,b],queryFn:()=>i$(a,b),enabled:!!a,refetchInterval:3e4,retry:2})}function i0(a){return a>=.7?"full":a>=.5?"limited":"restricted"}let i1={full:"text-green-400",limited:"text-yellow-400",restricted:"text-red-400"},i2={full:"bg-green-500/10",limited:"bg-yellow-500/10",restricted:"bg-red-500/10"},i3={full:"Full Access",limited:"Limited",restricted:"Restricted"},i4=460,i5=90;function i6({identifier:a,timeRange:b}){let{data:c,isLoading:d}=function(a,b="24h",c){return fO({queryKey:["agent-timeline",a,b,void 0],queryFn:()=>iZ(a,b,void 0),enabled:!!a,refetchInterval:3e4,retry:2})}(a,b),e=c?.points??[],{linePath:f,dots:g,xLabels:h}=(0,n.useMemo)(()=>{if(0===e.length)return{linePath:"",dots:[],xLabels:[]};let a=e.map(a=>new Date(a.timestamp).getTime()),c=Math.min(...a),d=Math.max(...a)-c||1,f=a=>30+(a-c)/d*i4,g=a=>10+(1-a)*i5,h=e.map((b,c)=>{let d=f(a[c]),e=g(b.trust_score);return`${0===c?"M":"L"} ${d} ${e}`}),i=e.map((b,c)=>({x:f(a[c]),y:g(b.trust_score),result:b.firewall_result,score:b.trust_score,time:b.timestamp})).filter(a=>"ALLOW"!==a.result),j=Math.min(5,e.length),k=[];for(let a=0;a<j;a++){let e=c+d*a/(j-1||1),g=new Date(e);k.push({x:f(e),label:"24h"===b?g.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):g.toLocaleDateString([],{month:"short",day:"numeric"})})}return{linePath:h.join(" "),dots:i,xLabels:k}},[e,b]);return d?(0,m.jsx)("div",{className:"h-[120px] flex items-center justify-center text-slate-500 text-xs",children:"Loading timeline..."}):0===e.length?(0,m.jsx)("div",{className:"h-[120px] flex items-center justify-center text-slate-500 text-xs",children:"No data for this time range."}):(0,m.jsxs)("svg",{viewBox:"0 0 500 120",className:"w-full",preserveAspectRatio:"xMidYMid meet",children:[(0,m.jsx)("line",{x1:30,y1:10+(1-.7)*i5,x2:30+i4,y2:10+(1-.7)*i5,stroke:"#22c55e",strokeWidth:"0.5",strokeDasharray:"4 2",opacity:"0.3"}),(0,m.jsx)("line",{x1:30,y1:10+.5*i5,x2:30+i4,y2:10+.5*i5,stroke:"#eab308",strokeWidth:"0.5",strokeDasharray:"4 2",opacity:"0.3"}),(0,m.jsx)("text",{x:26,y:10+(1-.7)*i5+3,fill:"#64748b",fontSize:"8",textAnchor:"end",children:"0.7"}),(0,m.jsx)("text",{x:26,y:10+.5*i5+3,fill:"#64748b",fontSize:"8",textAnchor:"end",children:"0.5"}),(0,m.jsx)("text",{x:26,y:13,fill:"#64748b",fontSize:"8",textAnchor:"end",children:"1.0"}),(0,m.jsx)("text",{x:26,y:10+i5+3,fill:"#64748b",fontSize:"8",textAnchor:"end",children:"0.0"}),(0,m.jsx)("path",{d:f,fill:"none",stroke:"#06b6d4",strokeWidth:"1.5"}),g.map((a,b)=>(0,m.jsx)("circle",{cx:a.x,cy:a.y,r:"3",fill:"BLOCK"===a.result?"#ef4444":"#eab308",stroke:"#0f172a",strokeWidth:"1",children:(0,m.jsx)("title",{children:`${a.result} — trust: ${a.score.toFixed(2)} — ${new Date(a.time).toLocaleString()}`})},b)),h.map((a,b)=>(0,m.jsx)("text",{x:a.x,y:116,fill:"#64748b",fontSize:"8",textAnchor:"middle",children:a.label},b))]})}let i7={BLOCK:"text-red-400 bg-red-500/10",QUARANTINE:"text-yellow-400 bg-yellow-500/10"};function i8({identifier:a}){let{data:b,isLoading:c}=i_(a,{firewallResult:"BLOCK",limit:20}),{data:d}=i_(a,{firewallResult:"QUARANTINE",limit:20}),e=[...b?.entries??[],...d?.entries??[]].sort((a,b)=>new Date(b.timestamp).getTime()-new Date(a.timestamp).getTime());return c?(0,m.jsx)("div",{className:"text-slate-500 text-xs",children:"Loading..."}):0===e.length?(0,m.jsx)("div",{className:"text-slate-500 text-xs",children:"No flagged operations."}):(0,m.jsx)("div",{className:"space-y-1 max-h-60 overflow-y-auto",children:e.map(a=>{let b=[];try{b=JSON.parse(a.threat_indicators)}catch{}return(0,m.jsxs)("div",{className:"px-2 py-1.5 rounded bg-slate-800/50 border border-slate-800",children:[(0,m.jsxs)("div",{className:"flex items-center justify-between",children:[(0,m.jsx)("span",{className:`px-1 py-0.5 rounded text-[10px] font-medium ${i7[a.firewall_result]??"text-slate-400"}`,children:a.firewall_result}),(0,m.jsx)("span",{className:"text-[10px] text-slate-500",children:new Date(a.timestamp).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})})]}),a.reason&&(0,m.jsx)("p",{className:"text-[11px] text-slate-400 mt-0.5 truncate",children:a.reason}),b.length>0&&(0,m.jsx)("div",{className:"flex gap-1 mt-1 flex-wrap",children:b.map((a,b)=>(0,m.jsx)("span",{className:"px-1 py-0.5 rounded text-[9px] bg-red-500/10 text-red-400",children:a},b))}),(0,m.jsxs)("div",{className:"flex gap-3 mt-1 text-[10px] text-slate-500",children:[(0,m.jsxs)("span",{children:["Trust: ",a.trust_score.toFixed(2)]}),(0,m.jsxs)("span",{children:["Anomaly: ",a.anomaly_score.toFixed(2)]}),null!==a.pipeline_duration_ms&&(0,m.jsxs)("span",{children:[a.pipeline_duration_ms,"ms"]})]})]},a.id)})})}let i9=hS("bell",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]]),ja=process.env.NEXT_PUBLIC_WS_URL||"ws://localhost:3001/ws/events";function jb({agentFilter:a}){let[b,c]=(0,n.useState)([]),d=(0,n.useRef)(0),e=(0,n.useRef)(null),f=(0,n.useCallback)(b=>{try{let e=JSON.parse(b.data);if("defence_event"!==e.type)return;let f=e.data;if(a&&f.source_identifier!==a)return;c(a=>[{...f,id:++d.current},...a].slice(0,50))}catch{}},[a]);return((0,n.useEffect)(()=>{try{let a=new WebSocket(ja);return e.current=a,a.onmessage=f,a.onerror=()=>{},()=>{a.close(),e.current=null}}catch{return}},[f]),0===b.length)?(0,m.jsxs)("div",{className:"flex items-center gap-2 text-slate-500 text-xs py-2",children:[(0,m.jsx)(i9,{size:12}),(0,m.jsx)("span",{children:"Listening for defence events..."})]}):(0,m.jsx)("div",{className:"space-y-1 max-h-48 overflow-y-auto",children:(0,m.jsx)(E,{initial:!1,children:b.map(a=>(0,m.jsxs)(fw.div,{initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0},className:`px-2 py-1.5 rounded border text-xs ${"BLOCK"===a.firewall_result?"bg-red-500/5 border-red-500/20":"bg-yellow-500/5 border-yellow-500/20"}`,children:[(0,m.jsxs)("div",{className:"flex items-center justify-between",children:[(0,m.jsx)("span",{className:`font-medium ${"BLOCK"===a.firewall_result?"text-red-400":"text-yellow-400"}`,children:a.firewall_result}),(0,m.jsx)("span",{className:"text-[10px] text-slate-500",children:new Date(a.timestamp).toLocaleTimeString()})]}),(0,m.jsxs)("p",{className:"text-slate-400 text-[11px] truncate mt-0.5",children:[a.source_identifier," — ",a.reason??"No reason"]})]},a.id))})})}function jc({identifier:a,compact:b}){let c=a.split(">").map(a=>a.trim());return 1===c.length?(0,m.jsx)("span",{className:"font-mono text-sm text-white",children:a}):b?(0,m.jsxs)("span",{className:"font-mono text-sm",children:[(0,m.jsxs)("span",{className:"text-slate-500",children:[c.slice(0,-1).join(" › ")," › "]}),(0,m.jsx)("span",{className:"text-white",children:c[c.length-1]})]}):(0,m.jsx)("div",{className:"font-mono text-sm",children:c.map((a,b)=>(0,m.jsxs)("span",{children:[b>0&&(0,m.jsx)(iW,{size:12,className:"inline text-slate-600 mx-0.5"}),(0,m.jsx)("span",{className:b===c.length-1?"text-white":"text-slate-500",children:a})]},b))})}function jd({score:a}){let b=i0(a);return(0,m.jsxs)("span",{className:`inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-medium ${i1[b]} ${i2[b]}`,children:[a.toFixed(2)," · ",i3[b]]})}function je({type:a}){let b={agent:"text-purple-400 bg-purple-500/10",cli:"text-cyan-400 bg-cyan-500/10",user:"text-green-400 bg-green-500/10",hook:"text-blue-400 bg-blue-500/10",api:"text-orange-400 bg-orange-500/10",web:"text-red-400 bg-red-500/10",file:"text-slate-400 bg-slate-500/10",email:"text-yellow-400 bg-yellow-500/10"}[a]??"text-slate-400 bg-slate-500/10";return(0,m.jsx)("span",{className:`px-1.5 py-0.5 rounded text-[10px] font-medium ${b}`,children:a})}function jf(){let{projectFilter:a}=gd(),[b,c]=(0,n.useState)("24h"),[d,e]=(0,n.useState)(null),[f,g]=(0,n.useState)("operation_count"),[h,i]=(0,n.useState)(!1),[j,k]=(0,n.useState)(null),[l,o]=(0,n.useState)(null),[p,q]=(0,n.useState)(!1),[r]=(0,n.useState)(()=>Date.now()),{data:s,isLoading:t}=function(a="24h",b){return fO({queryKey:["agents",a,b],queryFn:()=>iY(a,b),refetchInterval:3e4,retry:2})}(b,a??void 0),u=s?.agents??[],v=(0,n.useMemo)(()=>{let a=u;return j&&(a=a.filter(a=>a.source_type===j)),l&&(a=a.filter(a=>i0(a.avg_trust_score)===l)),p&&(a=a.filter(a=>a.flagged_count>0)),a},[u,j,l,p]),w=(0,n.useMemo)(()=>{let a=[...v];return a.sort((a,b)=>{let c=a[f],d=b[f];return"string"==typeof c&&"string"==typeof d?h?c.localeCompare(d):d.localeCompare(c):h?c-d:d-c}),a},[v,f,h]),x=(0,n.useMemo)(()=>[...new Set(u.map(a=>a.source_type))],[u]),y=a=>{f===a?i(!h):(g(a),i(!1))};return(0,m.jsxs)("div",{className:"flex h-full",children:[(0,m.jsxs)("div",{className:`${d?"w-1/2":"w-full"} border-r border-slate-800 flex flex-col`,children:[(0,m.jsxs)("div",{className:"p-3 border-b border-slate-800 flex items-center justify-between",children:[(0,m.jsxs)("div",{className:"flex items-center gap-2",children:[(0,m.jsx)(hZ,{size:16,className:"text-cyan-400"}),(0,m.jsx)("h2",{className:"text-sm font-medium text-white",children:"Agent Registry"}),(0,m.jsxs)("span",{className:"text-xs text-slate-500",children:[w.length," agents"]})]}),(0,m.jsx)("div",{className:"flex gap-1",children:["24h","7d","30d"].map(a=>(0,m.jsx)("button",{onClick:()=>c(a),className:`px-2 py-0.5 text-[10px] rounded transition-colors ${b===a?"bg-cyan-600 text-white":"text-slate-400 hover:text-white"}`,children:a},a))})]}),(0,m.jsxs)("div",{className:"px-3 py-2 border-b border-slate-800 flex items-center gap-2 flex-wrap",children:[(0,m.jsx)(iU,{size:12,className:"text-slate-500"}),x.map(a=>(0,m.jsx)("button",{onClick:()=>k(j===a?null:a),className:`px-1.5 py-0.5 text-[10px] rounded transition-colors ${j===a?"bg-cyan-600/20 text-cyan-400":"text-slate-500 hover:text-slate-300"}`,children:a},a)),(0,m.jsx)("span",{className:"text-slate-700",children:"|"}),["full","limited","restricted"].map(a=>(0,m.jsx)("button",{onClick:()=>o(l===a?null:a),className:`px-1.5 py-0.5 text-[10px] rounded transition-colors ${l===a?"bg-cyan-600/20 text-cyan-400":"text-slate-500 hover:text-slate-300"}`,children:a},a)),(0,m.jsx)("span",{className:"text-slate-700",children:"|"}),(0,m.jsxs)("button",{onClick:()=>q(!p),className:`px-1.5 py-0.5 text-[10px] rounded transition-colors flex items-center gap-0.5 ${p?"bg-red-600/20 text-red-400":"text-slate-500 hover:text-slate-300"}`,children:[(0,m.jsx)(hV,{size:10})," flagged"]})]}),(0,m.jsxs)("div",{className:"px-3 py-1.5 border-b border-slate-800 grid grid-cols-[1fr_80px_60px_60px_70px] gap-2 text-[10px] text-slate-500",children:[(0,m.jsx)("span",{children:"Agent"}),(0,m.jsxs)("button",{onClick:()=>y("avg_trust_score"),className:"flex items-center gap-0.5 hover:text-slate-300",children:["Trust ",(0,m.jsx)(iV,{size:8})]}),(0,m.jsxs)("button",{onClick:()=>y("operation_count"),className:"flex items-center gap-0.5 hover:text-slate-300",children:["Ops ",(0,m.jsx)(iV,{size:8})]}),(0,m.jsxs)("button",{onClick:()=>y("flagged_count"),className:"flex items-center gap-0.5 hover:text-slate-300",children:["Flagged ",(0,m.jsx)(iV,{size:8})]}),(0,m.jsxs)("button",{onClick:()=>y("last_seen"),className:"flex items-center gap-0.5 hover:text-slate-300",children:["Last seen ",(0,m.jsx)(iV,{size:8})]})]}),(0,m.jsxs)("div",{className:"flex-1 overflow-y-auto",children:[t&&(0,m.jsx)("div",{className:"p-4 text-center text-slate-500 text-xs",children:"Loading agents..."}),!t&&0===w.length&&(0,m.jsx)("div",{className:"p-4 text-center text-slate-500 text-xs",children:"No agents found in this time range."}),w.map(a=>{let b,c=d?.source_identifier===a.source_identifier&&d?.source_type===a.source_type;return(0,m.jsxs)("button",{onClick:()=>e(c?null:a),className:`w-full px-3 py-2 grid grid-cols-[1fr_80px_60px_60px_70px] gap-2 items-center text-left transition-colors border-b border-slate-800/50 ${c?"bg-cyan-600/10":"hover:bg-slate-800/50"}`,children:[(0,m.jsxs)("div",{className:"min-w-0",children:[(0,m.jsx)(jc,{identifier:a.source_identifier,compact:!0}),(0,m.jsx)("div",{className:"mt-0.5",children:(0,m.jsx)(je,{type:a.source_type})})]}),(0,m.jsx)(jd,{score:a.avg_trust_score}),(0,m.jsx)("span",{className:"text-xs text-slate-300 tabular-nums",children:a.operation_count}),(0,m.jsx)("span",{className:`text-xs tabular-nums ${a.flagged_count>0?"text-red-400":"text-slate-500"}`,children:a.flagged_count}),(0,m.jsx)("span",{className:"text-[10px] text-slate-500",children:(b=r-new Date(a.last_seen).getTime())<6e4?"just now":b<36e5?`${Math.floor(b/6e4)}m ago`:b<864e5?`${Math.floor(b/36e5)}h ago`:`${Math.floor(b/864e5)}d ago`})]},`${a.source_type}:${a.source_identifier}`)})]})]}),(0,m.jsx)(E,{children:d&&(0,m.jsxs)(fw.div,{initial:{opacity:0,x:20},animate:{opacity:1,x:0},exit:{opacity:0,x:20},className:"w-1/2 flex flex-col overflow-y-auto",children:[(0,m.jsxs)("div",{className:"p-3 border-b border-slate-800",children:[(0,m.jsxs)("div",{className:"flex items-center justify-between",children:[(0,m.jsx)(jc,{identifier:d.source_identifier}),(0,m.jsx)("button",{onClick:()=>e(null),className:"text-slate-500 hover:text-white text-xs",children:"Close"})]}),(0,m.jsxs)("div",{className:"flex items-center gap-2 mt-1.5",children:[(0,m.jsx)(je,{type:d.source_type}),(0,m.jsx)(jd,{score:d.avg_trust_score}),(0,m.jsxs)("span",{className:"text-[10px] text-slate-500",children:[d.operation_count," ops · ",d.flagged_count," flagged"]})]})]}),(0,m.jsxs)("div",{className:"p-3 border-b border-slate-800",children:[(0,m.jsx)("h3",{className:"text-xs font-medium text-slate-400 mb-2",children:"Trust Score Timeline"}),(0,m.jsx)(i6,{identifier:d.source_identifier,timeRange:b})]}),(0,m.jsxs)("div",{className:"p-3 border-b border-slate-800",children:[(0,m.jsxs)("h3",{className:"text-xs font-medium text-slate-400 mb-2",children:["Flagged Operations",d.flagged_count>0&&(0,m.jsxs)("span",{className:"ml-1 text-red-400",children:["(",d.flagged_count,")"]})]}),(0,m.jsx)(i8,{identifier:d.source_identifier})]}),(0,m.jsxs)("div",{className:"p-3",children:[(0,m.jsx)("h3",{className:"text-xs font-medium text-slate-400 mb-2",children:"Live Alerts"}),(0,m.jsx)(jb,{agentFilter:d.source_identifier})]})]})})]})}let jg=hS("shield-check",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),jh=hS("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]),ji={critical:"text-red-400 bg-red-400/10",high:"text-red-400 bg-red-400/10",medium:"text-yellow-400 bg-yellow-400/10",low:"text-slate-400 bg-slate-400/10",safe:"text-green-400 bg-green-400/10"};function jj({level:a}){let b=ji[a]??ji.low;return(0,m.jsx)("span",{className:`text-[10px] font-medium px-1.5 py-0.5 rounded ${b}`,children:a.toUpperCase()})}function jk({findings:a}){return 0===a.length?null:(0,m.jsx)("div",{className:"mt-2 space-y-1.5 pl-6",children:a.map((a,b)=>(0,m.jsxs)("div",{className:"flex items-start gap-2",children:[(0,m.jsx)(jj,{level:a.severity}),(0,m.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,m.jsx)("span",{className:"text-xs text-slate-300",children:a.description}),a.matchedText&&(0,m.jsxs)("div",{className:"mt-0.5 text-[10px] text-slate-500 font-mono truncate",children:['Match: "',a.matchedText,'"']})]})]},`${a.pattern}-${b}`))})}function jl(a){let b=a.split(/[/\\]/);return b[b.length-1]||a}function jm({file:a,cloudConnected:b,onTrust:c,onUntrust:d,onRemove:e,onCloudUpsell:f}){let[g,h]=(0,n.useState)(!a.safe),[i,j]=(0,n.useState)(!1);return(0,m.jsxs)("div",{className:"bg-slate-800/50 border border-slate-700 rounded-lg overflow-hidden",children:[(0,m.jsxs)("div",{className:"flex items-center",children:[(0,m.jsxs)("button",{onClick:()=>h(!g),className:"flex-1 px-3 py-2.5 flex items-center gap-3 hover:bg-slate-800/80 transition-colors min-w-0",children:[a.trusted?(0,m.jsx)(jg,{size:16,className:"text-cyan-400 shrink-0"}):a.safe?(0,m.jsx)(ig,{size:16,className:"text-green-400 shrink-0"}):(0,m.jsx)(ik,{size:16,className:"text-red-400 shrink-0"}),(0,m.jsxs)("div",{className:"flex-1 min-w-0 text-left",children:[(0,m.jsx)("span",{className:"text-xs font-medium text-white truncate block",children:a.skillName||jl(a.path)}),(0,m.jsx)("span",{className:"text-[10px] text-slate-500 truncate block",children:a.path.replace(/^\/Users\/[^/]+/,"~")})]}),(0,m.jsx)("span",{className:"text-[10px] text-slate-500 shrink-0",children:a.format}),a.trusted?(0,m.jsx)("span",{className:"text-[10px] px-1.5 py-0.5 rounded font-medium bg-cyan-400/10 text-cyan-400",children:"TRUSTED"}):(0,m.jsx)(jj,{level:a.riskLevel}),(0,m.jsxs)("span",{className:"text-[10px] text-slate-600 shrink-0",children:[a.scanDurationMs,"ms"]}),a.findings.length>0?g?(0,m.jsx)(h5,{size:14,className:"text-slate-500 shrink-0"}):(0,m.jsx)(iW,{size:14,className:"text-slate-500 shrink-0"}):(0,m.jsx)("div",{className:"w-[14px] shrink-0"})]}),(0,m.jsxs)("div",{className:"flex items-center gap-0.5 pr-2 shrink-0",children:[a.trusted?(0,m.jsx)("button",{onClick:()=>d(a.path),title:"Remove trust",className:"p-1.5 rounded hover:bg-slate-700 transition-colors text-cyan-400 hover:text-cyan-300",children:(0,m.jsx)(jg,{size:14})}):(0,m.jsx)("button",{onClick:()=>c(a.path),title:"Mark as trusted",className:"p-1.5 rounded hover:bg-slate-700 transition-colors text-slate-500 hover:text-cyan-400",children:(0,m.jsx)(hT,{size:14})}),!a.safe&&!a.trusted&&(0,m.jsx)("button",{onClick:()=>b?j(!0):f(),title:b?"Remove skill file":"Connect to Cloud to remove",className:`p-1.5 rounded transition-colors ${b?"hover:bg-red-500/10 text-slate-500 hover:text-red-400":"text-slate-600 hover:text-slate-400 cursor-not-allowed"}`,children:(0,m.jsx)(jh,{size:14})})]})]}),i&&(0,m.jsxs)("div",{className:"border-t border-slate-700/50 px-3 py-2.5 bg-red-950/30 flex items-center gap-3",children:[(0,m.jsxs)("span",{className:"text-xs text-red-300 flex-1",children:["Remove ",(0,m.jsx)("span",{className:"font-medium",children:a.skillName||jl(a.path)}),"? This will delete the file from disk."]}),(0,m.jsx)("button",{onClick:()=>{e(a.path),j(!1)},className:"px-3 py-1 text-xs font-medium bg-red-600 hover:bg-red-500 text-white rounded transition-colors",children:"Delete"}),(0,m.jsx)("button",{onClick:()=>j(!1),className:"px-3 py-1 text-xs text-slate-400 hover:text-white transition-colors",children:"Cancel"})]}),g&&a.findings.length>0&&(0,m.jsx)("div",{className:"border-t border-slate-700/50 px-3 py-2 bg-slate-900/50",children:(0,m.jsx)(jk,{findings:a.findings})})]})}function jn({files:a,cloudConnected:b,onTrust:c,onUntrust:d,onRemove:e,onCloudUpsell:f}){return 0===a.length?null:(0,m.jsx)("div",{className:"space-y-1.5",children:a.map(a=>(0,m.jsx)(jm,{file:a,cloudConnected:b,onTrust:c,onUntrust:d,onRemove:e,onCloudUpsell:f},a.path))})}let jo=[{value:"",label:"Auto-detect"},{value:"skill-md",label:"SKILL.md (Claude Code)"},{value:"hook-md",label:"HOOK.md (OpenClaw)"},{value:"hook-js",label:"handler.js (OpenClaw)"},{value:"rules",label:".cursorrules / .windsurfrules / .clinerules"},{value:"claude-md",label:"CLAUDE.md"},{value:"copilot-md",label:"copilot-instructions.md"},{value:"aider-yml",label:".aider.conf.yml"},{value:"continue-json",label:".continue/config.json"}];function jp(){let a=ip(),b=fS({mutationFn:io}),c=fS({mutationFn:iq}),d=fS({mutationFn:ir}),e=fS({mutationFn:is}),{data:f}=iE(),[g,h]=(0,n.useState)(null),[i,j]=(0,n.useState)(null),[k,l]=(0,n.useState)(!1),[o,p]=(0,n.useState)(""),[q,r]=(0,n.useState)(""),[s,t]=(0,n.useState)(!1),u=!!(f?.enabled&&f?.apiKeySet);return(0,m.jsxs)("div",{className:"h-full overflow-y-auto p-6",children:[(0,m.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,m.jsxs)("div",{children:[(0,m.jsx)("h2",{className:"text-lg font-semibold text-white",children:"Skills Scanner"}),(0,m.jsx)("p",{className:"text-xs text-slate-400 mt-0.5",children:"Scan agent instruction files for hidden threats"})]}),(0,m.jsxs)("button",{onClick:()=>{a.mutate(void 0,{onSuccess:a=>h(a)})},disabled:a.isPending,className:"flex items-center gap-1.5 px-4 py-2 bg-cyan-600 hover:bg-cyan-500 disabled:opacity-50 rounded-lg text-sm font-medium text-white transition-colors",children:[a.isPending?(0,m.jsx)(ie,{size:14,className:"animate-spin"}):(0,m.jsx)(h$,{size:14}),"Scan All"]})]}),s&&(0,m.jsxs)("div",{className:"mb-4 bg-slate-900 border border-cyan-800/50 rounded-xl p-4 flex items-center gap-3",children:[(0,m.jsx)(ic,{size:20,className:"text-cyan-400 shrink-0"}),(0,m.jsxs)("div",{className:"flex-1",children:[(0,m.jsx)("p",{className:"text-sm font-medium text-white",children:"Connect to ShieldCortex Cloud"}),(0,m.jsx)("p",{className:"text-xs text-slate-400 mt-0.5",children:"Enable one-click skill removal and cloud-powered threat intelligence."})]}),(0,m.jsx)("button",{onClick:()=>t(!1),className:"text-xs text-slate-500 hover:text-slate-300 transition-colors",children:"Dismiss"})]}),g?(0,m.jsxs)("div",{className:"space-y-4",children:[(0,m.jsxs)("div",{className:"flex items-center gap-3 text-xs text-slate-400",children:[(0,m.jsxs)("span",{children:[(0,m.jsx)("span",{className:"text-white font-medium",children:g.totalScanned})," files scanned"]}),(0,m.jsx)("span",{className:"text-slate-600",children:"·"}),g.threatCount>0?(0,m.jsxs)("span",{children:[(0,m.jsx)("span",{className:"text-red-400 font-medium",children:g.threatCount})," with threats"]}):(0,m.jsx)("span",{className:"text-green-400",children:"All clean"}),(0,m.jsx)("span",{className:"text-slate-600",children:"·"}),(0,m.jsx)("span",{children:new Date(g.scannedAt).toLocaleTimeString()})]}),(0,m.jsx)(jn,{files:g.files,cloudConnected:u,onTrust:a=>{c.mutate(a,{onSuccess:()=>{g&&h({...g,files:g.files.map(b=>b.path===a?{...b,trusted:!0}:b),threatCount:g.files.filter(b=>!b.safe&&!b.trusted&&b.path!==a).length})}})},onUntrust:a=>{d.mutate(a,{onSuccess:()=>{g&&h({...g,files:g.files.map(b=>b.path===a?{...b,trusted:!1}:b),threatCount:g.files.filter(b=>{let c=b.path!==a&&b.trusted;return!b.safe&&!c}).length})}})},onRemove:a=>{e.mutate(a,{onSuccess:()=>{if(g){let b=g.files.filter(b=>b.path!==a);h({...g,files:b,totalScanned:b.length,threatCount:b.filter(a=>!a.safe&&!a.trusted).length})}}})},onCloudUpsell:()=>t(!0)})]}):a.isPending?(0,m.jsx)("div",{className:"flex items-center justify-center py-16",children:(0,m.jsx)(ie,{size:24,className:"text-cyan-400 animate-spin"})}):(0,m.jsxs)("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[(0,m.jsx)(h$,{size:32,className:"text-slate-600 mb-3"}),(0,m.jsx)("p",{className:"text-sm text-slate-400",children:"No skills scanned yet"}),(0,m.jsx)("p",{className:"text-xs text-slate-500 mt-1",children:'Click "Scan All" to discover and scan agent instruction files'})]}),(0,m.jsxs)("div",{className:"mt-6",children:[(0,m.jsxs)("button",{onClick:()=>l(!k),className:"flex items-center gap-1.5 text-xs text-slate-400 hover:text-slate-300 transition-colors",children:[k?(0,m.jsx)(h5,{size:14}):(0,m.jsx)(iW,{size:14}),"Paste & Scan"]}),k&&(0,m.jsxs)("div",{className:"mt-3 bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,m.jsx)("textarea",{value:o,onChange:a=>p(a.target.value),placeholder:"Paste skill/instruction file content here...",className:"w-full h-32 bg-slate-800 border border-slate-700 rounded-lg px-3 py-2 text-sm text-white placeholder:text-slate-500 focus:ring-cyan-500 focus:border-cyan-500 resize-y font-mono"}),(0,m.jsxs)("div",{className:"flex items-center gap-3 mt-3",children:[(0,m.jsx)("select",{value:q,onChange:a=>r(a.target.value),className:"bg-slate-800 border border-slate-700 text-white text-xs rounded-lg px-3 py-2 focus:ring-cyan-500 focus:border-cyan-500",children:jo.map(a=>(0,m.jsx)("option",{value:a.value,children:a.label},a.value))}),(0,m.jsxs)("button",{onClick:()=>{o.trim()&&b.mutate({content:o,format:q||void 0},{onSuccess:a=>j(a)})},disabled:b.isPending||!o.trim(),className:"flex items-center gap-1.5 px-4 py-2 bg-cyan-600 hover:bg-cyan-500 disabled:opacity-50 rounded-lg text-xs font-medium text-white transition-colors",children:[b.isPending?(0,m.jsx)(ie,{size:12,className:"animate-spin"}):(0,m.jsx)(h$,{size:12}),"Scan Content"]})]}),i&&(0,m.jsxs)("div",{className:"mt-4 bg-slate-800/50 border border-slate-700 rounded-lg p-3",children:[(0,m.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,m.jsx)("span",{className:"text-xs font-medium text-white",children:i.skillName}),(0,m.jsx)(jj,{level:i.riskLevel}),(0,m.jsxs)("span",{className:"text-[10px] text-slate-500",children:[i.scanDurationMs,"ms"]})]}),(0,m.jsx)("p",{className:"text-xs text-slate-400",children:i.summary}),i.findings.length>0&&(0,m.jsx)(jk,{findings:i.findings})]})]})]})]})}let jq=hS("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"}]]),jr=hS("radio",[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]),js=hS("shield-off",[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71",key:"1jlk70"}],["path",{d:"M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264",key:"18rp1v"}]]),jt=hS("scan",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}]]),ju=[{id:"personal",label:"Personal",description:"Lighter touch for solo use",icon:hT},{id:"enterprise",label:"Enterprise",description:"Financial & data protection",icon:jq},{id:"school",label:"School",description:"GDPR strict, pupil data guarded",icon:hZ},{id:"paranoid",label:"Paranoid",description:"Everything requires approval",icon:hV}],jv=[{name:"Injection Scanner",description:"40+ patterns across 8 categories",icon:jt},{name:"Instruction Gateway",description:"Trusted channel validation",icon:jr},{name:"Action Gate",description:"Approve / block external actions",icon:jq},{name:"PII Guard",description:"Block sensitive data output",icon:h3},{name:"Kill Switch",description:"Emergency stop phrase",icon:js},{name:"Sub-Agent Control",description:"Restrict spawned agent operations",icon:hZ}],jw={critical:"bg-red-500/20 text-red-400 border-red-500/30",high:"bg-orange-500/20 text-orange-400 border-orange-500/30",medium:"bg-yellow-500/20 text-yellow-400 border-yellow-500/30",low:"bg-slate-500/20 text-slate-400 border-slate-500/30"},jx={CRITICAL:"bg-red-500/20 text-red-400",HIGH:"bg-orange-500/20 text-orange-400",MEDIUM:"bg-yellow-500/20 text-yellow-400",LOW:"bg-slate-500/20 text-slate-400",NONE:"bg-green-500/20 text-green-400"};function jy(){let a,b,{data:c,isLoading:d}=iA(),{data:e}=iB(50),f=(a=(0,fK.useQueryClient)(),fS({mutationFn:a=>iw(a),onSuccess:()=>{a.invalidateQueries({queryKey:["iron-dome-status"]}),a.invalidateQueries({queryKey:["iron-dome-audit"]})}})),g=(b=(0,fK.useQueryClient)(),fS({mutationFn:ix,onSuccess:()=>{b.invalidateQueries({queryKey:["iron-dome-status"]})}})),h=fS({mutationFn:iy}),[i,j]=(0,n.useState)(""),[k,l]=(0,n.useState)(null),o=c?.enabled??!1,p=c?.profile,q=c?.config,r=e?.logs??[],s=r.filter(a=>"BLOCK"===a.firewall_result).length,t=r.filter(a=>"ALLOW"===a.firewall_result).length;return(0,m.jsxs)("div",{className:"h-full overflow-y-auto p-6",children:[(0,m.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,m.jsxs)("div",{className:"flex items-center gap-3",children:[(0,m.jsx)(h_,{size:20,className:"text-red-400"}),(0,m.jsx)("h2",{className:"text-lg font-semibold text-white",children:"Iron Dome"}),d?(0,m.jsx)("span",{className:"text-[10px] text-slate-500 animate-pulse",children:"Loading..."}):(0,m.jsx)("span",{className:`text-[10px] font-medium px-2 py-0.5 rounded-full ${o?"bg-red-500/20 text-red-400 border border-red-500/30":"bg-slate-700/50 text-slate-500"}`,children:o?"ACTIVE":"INACTIVE"})]}),o&&(0,m.jsxs)("button",{onClick:()=>{g.mutate()},disabled:g.isPending,className:"flex items-center gap-1.5 px-3 py-1.5 bg-red-500/10 border border-red-500/30 hover:bg-red-500/20 disabled:opacity-50 rounded-lg text-xs font-medium text-red-400 transition-colors",children:[g.isPending?(0,m.jsx)(ie,{size:12,className:"animate-spin"}):(0,m.jsx)(js,{size:12}),"Deactivate"]})]}),(0,m.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4 mb-6",children:[(0,m.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,m.jsx)("h3",{className:"text-sm font-medium text-slate-300 mb-3",children:"Security Profiles"}),(0,m.jsx)("div",{className:"grid grid-cols-2 gap-2",children:ju.map(({id:a,label:b,description:c,icon:d})=>(0,m.jsxs)("button",{onClick:()=>{f.mutate(a)},disabled:f.isPending,className:`text-left p-3 rounded-lg border transition-colors ${p===a?"border-red-500/50 bg-red-500/10 text-red-400":"border-slate-700 bg-slate-800/50 text-slate-400 hover:border-slate-600"}`,children:[(0,m.jsxs)("div",{className:"flex items-center gap-1.5 mb-1",children:[(0,m.jsx)(d,{size:12}),(0,m.jsx)("span",{className:"text-xs font-medium",children:b})]}),(0,m.jsx)("div",{className:"text-[10px] text-slate-500",children:c})]},a))})]}),(0,m.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,m.jsx)("h3",{className:"text-sm font-medium text-slate-300 mb-3",children:"Module Status"}),(0,m.jsx)("div",{className:"space-y-2",children:jv.map(({name:a,description:b,icon:c})=>(0,m.jsxs)("div",{className:"flex items-center gap-3 px-3 py-2 rounded-lg bg-slate-800/50",children:[(0,m.jsx)(c,{size:14,className:o?"text-red-400":"text-slate-600"}),(0,m.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,m.jsx)("div",{className:"text-xs font-medium text-slate-300",children:a}),(0,m.jsx)("div",{className:"text-[10px] text-slate-500 truncate",children:b})]}),(0,m.jsx)("span",{className:`w-2 h-2 rounded-full ${o?"bg-red-400":"bg-slate-600"}`})]},a))})]})]}),o&&q&&(0,m.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4 mb-6",children:[(0,m.jsx)("h3",{className:"text-sm font-medium text-slate-300 mb-3",children:"Active Configuration"}),(0,m.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 text-xs",children:[(0,m.jsxs)("div",{children:[(0,m.jsx)("div",{className:"text-[10px] text-slate-500 uppercase mb-1",children:"Trusted Channels"}),(0,m.jsx)("div",{className:"flex flex-wrap gap-1",children:q.trustedChannels.map(a=>(0,m.jsx)("span",{className:"px-1.5 py-0.5 bg-slate-800 rounded text-slate-400",children:a},a))})]}),(0,m.jsxs)("div",{children:[(0,m.jsx)("div",{className:"text-[10px] text-slate-500 uppercase mb-1",children:"Requires Approval"}),(0,m.jsx)("div",{className:"flex flex-wrap gap-1",children:q.requireApproval.map(a=>(0,m.jsx)("span",{className:"px-1.5 py-0.5 bg-red-500/10 border border-red-500/20 rounded text-red-400",children:a},a))})]}),(0,m.jsxs)("div",{children:[(0,m.jsx)("div",{className:"text-[10px] text-slate-500 uppercase mb-1",children:"Kill Phrase"}),(0,m.jsx)("span",{className:"px-1.5 py-0.5 bg-slate-800 rounded text-slate-400 font-mono",children:q.killPhrase})]})]})]}),(0,m.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-4",children:[(0,m.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,m.jsxs)("h3",{className:"text-sm font-medium text-slate-300 mb-3",children:[(0,m.jsx)(jt,{size:14,className:"inline mr-1.5 text-red-400"}),"Injection Scanner"]}),(0,m.jsx)("textarea",{value:i,onChange:a=>j(a.target.value),placeholder:"Paste suspicious text to scan for injection patterns...",className:"w-full h-28 bg-slate-800 border border-slate-700 rounded-lg p-3 text-sm text-white placeholder:text-slate-500 resize-none focus:outline-none focus:ring-1 focus:ring-red-500 focus:border-red-500"}),(0,m.jsxs)("button",{onClick:()=>{i.trim()&&h.mutate(i,{onSuccess:a=>l(a)})},disabled:h.isPending||!i.trim(),className:"mt-2 flex items-center gap-1.5 px-3 py-1.5 bg-red-600 hover:bg-red-500 disabled:opacity-50 rounded-lg text-xs font-medium text-white transition-colors",children:[h.isPending?(0,m.jsx)(ie,{size:12,className:"animate-spin"}):(0,m.jsx)(h_,{size:12}),"Scan"]}),k&&(0,m.jsxs)("div",{className:"mt-3 space-y-2",children:[(0,m.jsxs)("div",{className:"flex items-center gap-2",children:[k.clean?(0,m.jsx)(ig,{size:14,className:"text-green-400"}):(0,m.jsx)(ik,{size:14,className:"text-red-400"}),(0,m.jsx)("span",{className:`text-[10px] font-medium px-2 py-0.5 rounded-full ${jx[k.riskLevel]??"bg-slate-500/20 text-slate-400"}`,children:k.riskLevel}),(0,m.jsx)("span",{className:"text-xs text-slate-400",children:k.summary})]}),k.detections.map((a,b)=>(0,m.jsxs)("div",{className:`border rounded-lg p-3 ${jw[a.severity]??"border-slate-700"}`,children:[(0,m.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,m.jsx)("span",{className:"text-[10px] font-medium uppercase",children:a.severity}),(0,m.jsx)("span",{className:"text-xs text-slate-300",children:a.category.replace(/_/g," ")})]}),(0,m.jsx)("p",{className:"text-[11px] text-slate-400 mb-1",children:a.description}),(0,m.jsx)("code",{className:"text-[10px] text-slate-500 bg-slate-800 px-1.5 py-0.5 rounded block truncate",children:a.match})]},b))]})]}),(0,m.jsxs)("div",{className:"bg-slate-900 border border-slate-800 rounded-xl p-4",children:[(0,m.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,m.jsx)("h3",{className:"text-sm font-medium text-slate-300",children:"Event Feed"}),(0,m.jsxs)("span",{className:"text-[10px] text-slate-500",children:["Last ",r.length," events"]})]}),(0,m.jsxs)("div",{className:"grid grid-cols-3 gap-2 mb-3",children:[(0,m.jsxs)("div",{className:"bg-slate-800/50 rounded-lg p-2 text-center",children:[(0,m.jsx)("div",{className:"text-sm font-bold text-slate-300",children:r.length}),(0,m.jsx)("div",{className:"text-[10px] text-slate-500",children:"Total"})]}),(0,m.jsxs)("div",{className:"bg-slate-800/50 rounded-lg p-2 text-center",children:[(0,m.jsx)("div",{className:"text-sm font-bold text-red-400",children:s}),(0,m.jsx)("div",{className:"text-[10px] text-slate-500",children:"Blocked"})]}),(0,m.jsxs)("div",{className:"bg-slate-800/50 rounded-lg p-2 text-center",children:[(0,m.jsx)("div",{className:"text-sm font-bold text-green-400",children:t}),(0,m.jsx)("div",{className:"text-[10px] text-slate-500",children:"Allowed"})]})]}),(0,m.jsx)("div",{className:"space-y-1 max-h-72 overflow-y-auto",children:0===r.length?(0,m.jsxs)("div",{className:"text-center py-6",children:[(0,m.jsx)(hT,{size:20,className:"text-slate-600 mx-auto mb-1.5"}),(0,m.jsx)("p",{className:"text-[10px] text-slate-500",children:"No Iron Dome events yet"})]}):r.map((a,b)=>(0,m.jsxs)("div",{className:"flex items-center gap-2 px-2 py-1.5 rounded-md bg-slate-800/50 text-xs",children:[(0,m.jsx)("span",{className:`w-1.5 h-1.5 rounded-full shrink-0 ${"BLOCK"===a.firewall_result?"bg-red-400":"bg-green-400"}`}),(0,m.jsx)("span",{className:"text-slate-400 truncate flex-1",children:(a.reason??"").replace(/^\[iron-dome:\w+\]\s*/,"")}),(0,m.jsx)("span",{className:"text-[10px] text-slate-600 shrink-0",children:new Date(a.timestamp).toLocaleTimeString()})]},a.id??b))})]})]})]})}let jz=(0,fx.default)(async()=>{},{loadableGenerated:{modules:[11570]},ssr:!1,loading:()=>(0,m.jsx)("div",{className:"w-full h-full flex items-center justify-center bg-slate-950",children:(0,m.jsx)("div",{className:"text-slate-400 animate-pulse",children:"Loading Graph..."})})}),jA=(0,fx.default)(async()=>{},{loadableGenerated:{modules:[41740]},ssr:!1,loading:()=>(0,m.jsx)("div",{className:"w-full h-full flex items-center justify-center bg-slate-950",children:(0,m.jsx)("div",{className:"text-slate-400 animate-pulse",children:"Loading Brain Control Centre..."})})});function jB(){var a,b;let c,d,e,f,g,h,i,[j,k]=(0,n.useState)(""),[l,o]=(0,n.useState)(!1),[p,q]=(0,n.useState)(!1),[r,s]=(0,n.useState)(void 0),[t,u]=(0,n.useState)(void 0),v=(0,n.useRef)(null),w=(0,n.useRef)(null),x=ge(j,300),{viewMode:y,selectedMemory:z,setSelectedMemory:A,selectedAuditEntry:B,setSelectedAuditEntry:C,projectFilter:D,setProjectFilter:F,addEvent:G}=gd(),{data:H=[]}=fO({queryKey:["suggestions",c=ge(j,200)],queryFn:()=>gg(c),enabled:c.length>=2,staleTime:3e4,refetchOnWindowFocus:!1}),{data:I}=fO({queryKey:["projects"],queryFn:f1,refetchInterval:6e4});(0,n.useEffect)(()=>{let a=a=>{w.current&&!w.current.contains(a.target)&&v.current&&!v.current.contains(a.target)&&o(!1)};return document.addEventListener("mousedown",a),()=>document.removeEventListener("mousedown",a)},[]);let{data:J=[],isLoading:K,isConnected:L,lastEvent:M}=(a={limit:1e3,query:x||void 0,mode:x?"search":"recent",project:D||void 0,type:r,category:t},d=function(a={}){let{enabled:b=!0,onMessage:c}=a,d=(0,fK.useQueryClient)(),e=(0,n.useRef)(null),f=(0,n.useRef)(null),g=(0,n.useRef)(0),h=(0,n.useRef)(1e3),i=(0,n.useRef)(()=>{}),[j,k]=(0,n.useState)(!1),[l,m]=(0,n.useState)(null),o=(0,n.useRef)(c);(0,n.useEffect)(()=>{o.current=c},[c]);let p=(0,n.useCallback)(async()=>{if(b&&e.current?.readyState!==WebSocket.OPEN){f.current&&(clearTimeout(f.current),f.current=null);try{let a=await fW(),c=`${fY}?token=${encodeURIComponent(a)}`,j=new WebSocket(c);e.current=j,j.onopen=()=>{k(!0),g.current=0,h.current=1e3,console.log("[WebSocket] Connected to memory server")},j.onmessage=a=>{try{let b=JSON.parse(a.data);switch(m({type:b.type,data:b.data,timestamp:b.timestamp||new Date().toISOString()}),o.current?.(b),b.type){case"initial_state":case"consolidation_complete":case"predictive_consolidation":d.invalidateQueries({queryKey:["memories"]}),d.invalidateQueries({queryKey:["stats"]}),d.invalidateQueries({queryKey:["links"]});break;case"memory_created":case"memory_updated":case"memory_deleted":d.invalidateQueries({queryKey:["memories"]}),d.invalidateQueries({queryKey:["stats"]});break;case"decay_tick":case"worker_light_tick":case"worker_medium_tick":break;case"link_discovered":d.invalidateQueries({queryKey:["links"]});break;case"defence_event":d.invalidateQueries({queryKey:["agents"]}),d.invalidateQueries({queryKey:["agent-timeline"]}),d.invalidateQueries({queryKey:["audit-logs"]}),d.invalidateQueries({queryKey:["audit-stats"]});break;case"update_started":case"update_complete":case"update_failed":"update_complete"===b.type&&(d.invalidateQueries({queryKey:["version"]}),d.invalidateQueries({queryKey:["version-check"]}));break;case"server_restarting":console.log("[WebSocket] Server restarting, will reconnect shortly...")}}catch(a){console.error("[WebSocket] Failed to parse message:",a)}},j.onerror=()=>{console.warn("[WebSocket] Connection failed - is the API server running?")},j.onclose=()=>{if(k(!1),console.log("[WebSocket] Disconnected"),b&&g.current<10){let a=h.current;g.current++,h.current=Math.min(2*h.current,3e4),console.log(`[WebSocket] Reconnecting in ${a}ms (attempt ${g.current}/10)...`),f.current=setTimeout(()=>{i.current()},a)}else g.current>=10&&console.error("[WebSocket] Max reconnection attempts reached. Use reconnect() to try again.")}}catch(a){console.error("[WebSocket] Failed to connect:",a)}}},[b,d]);return(0,n.useEffect)(()=>{i.current=p}),(0,n.useEffect)(()=>(b&&p(),()=>{f.current&&clearTimeout(f.current),e.current&&(e.current.close(),e.current=null)}),[b,p]),{isConnected:j,lastEvent:l,reconnect:(0,n.useCallback)(()=>{g.current=0,h.current=1e3,p()},[p])}}(),{...{...e=fO({queryKey:["memories",a],queryFn:()=>f$(a),refetchInterval:3e4}),data:e.data?.memories,pagination:e.data?.pagination},isConnected:d.isConnected,lastEvent:d.lastEvent}),{data:N,isLoading:O}=f4(D||void 0),{data:P=[]}=fO({queryKey:["links",b=D||void 0],queryFn:()=>f0(b),refetchInterval:6e4}),Q=(0,n.useRef)(M);(0,n.useEffect)(()=>{!M||M===Q.current||(Q.current=M,new Set(["memory_created","memory_accessed","memory_updated","memory_deleted","consolidation_complete","decay_tick"]).has(M.type)&&G({type:M.type,timestamp:M.timestamp,data:M.data}))},[M,G]);let R=(f=(0,fK.useQueryClient)(),fS({mutationFn:f2,onSuccess:()=>{f.invalidateQueries({queryKey:["memories"]}),f.invalidateQueries({queryKey:["stats"]})}}));g=(0,fK.useQueryClient)(),fS({mutationFn:f3,onSuccess:()=>{g.invalidateQueries({queryKey:["memories"]}),g.invalidateQueries({queryKey:["stats"]})}});let{data:S}=fO({queryKey:["control-status"],queryFn:f5,refetchInterval:1e4});h=(0,fK.useQueryClient)(),fS({mutationFn:f6,onSuccess:()=>{h.invalidateQueries({queryKey:["control-status"]})}}),i=(0,fK.useQueryClient)(),fS({mutationFn:f7,onSuccess:()=>{i.invalidateQueries({queryKey:["control-status"]})}});let T=S?.paused??!1,{data:U}=iE(),V=U?.enabled&&U?.apiKeySet,W=a=>{A(a)},X=a=>{let b=J.find(b=>b.id===a);b&&A(b)},Y="shield"===y||"audit"===y||"quarantine"===y||"agents"===y||"skills"===y||"dome"===y;return(0,m.jsxs)("div",{className:"h-screen w-screen bg-slate-950 text-white overflow-hidden flex flex-col",children:[(0,m.jsxs)("header",{className:"h-14 border-b border-slate-800 flex items-center justify-between px-4 bg-slate-900/50 backdrop-blur-sm shrink-0",children:[(0,m.jsxs)("div",{className:"flex items-center gap-4",children:[(0,m.jsxs)("div",{className:"flex items-center gap-2",children:[(0,m.jsx)(hT,{size:20,className:"text-cyan-400"}),(0,m.jsx)("h1",{className:"text-xl font-bold bg-gradient-to-r from-cyan-400 via-blue-400 to-emerald-400 bg-clip-text text-transparent",children:"ShieldCortex"}),(0,m.jsx)("div",{title:V?"Connected to ShieldCortex Cloud":"Cloud sync not configured",children:(0,m.jsx)(ic,{size:16,className:V?"text-emerald-400":"text-slate-600"})})]}),(0,m.jsx)("select",{value:D||"",onChange:a=>F(a.target.value||null),className:"bg-slate-800 border border-slate-700 text-white text-sm rounded-lg px-3 py-1.5 focus:ring-cyan-500 focus:border-cyan-500",children:I?.projects.map(a=>(0,m.jsxs)("option",{value:a.project||"",children:[a.label," (",a.memory_count,")"]},a.project||"all"))}),(0,m.jsxs)("div",{className:"relative",children:[(0,m.jsx)(ht,{ref:v,type:"text",placeholder:"Search memories...",value:j,onChange:a=>{k(a.target.value),o(!0)},onFocus:()=>o(!0),onKeyDown:a=>{"Escape"===a.key&&o(!1)},className:"w-64 bg-slate-800 border-slate-700 text-white placeholder:text-slate-400 focus:ring-cyan-500"}),l&&H.length>0&&(0,m.jsx)("div",{ref:w,className:"absolute top-full left-0 right-0 mt-1 bg-slate-800 border border-slate-700 rounded-lg shadow-xl overflow-hidden z-50",children:H.map((a,b)=>(0,m.jsxs)("button",{onClick:()=>{k(a.text),o(!1),v.current?.focus()},className:"w-full px-3 py-2 text-left hover:bg-slate-700 transition-colors flex items-center gap-2",children:[(0,m.jsx)("span",{className:"text-white text-sm truncate flex-1",children:a.text}),(0,m.jsx)("span",{className:"text-xs px-1.5 py-0.5 rounded bg-slate-600 text-slate-300",children:a.type})]},`${a.type}-${a.text}-${b}`))})]}),(0,m.jsxs)(hs,{variant:"outline",size:"sm",onClick:()=>q(!p),className:`border-slate-600 text-slate-300 hover:text-white hover:bg-slate-700 ${p?"bg-slate-700":""}`,title:"Filter memories by type and category",children:["Filters ",(r||t)&&"•"]})]}),(0,m.jsx)("div",{className:"flex items-center gap-2",children:(0,m.jsxs)("div",{className:"flex items-center gap-2 text-xs text-slate-400 px-2",children:[(0,m.jsx)("span",{className:`w-2 h-2 rounded-full ${T?"bg-orange-500 animate-pulse":L?"bg-green-500":"bg-yellow-500"}`,title:T?"Memory creation paused":L?"Real-time connected":"Polling mode"}),N?.total??J.length," memories"]})})]}),p&&(0,m.jsxs)("div",{className:"h-12 border-b border-slate-800 flex items-center gap-4 px-4 bg-slate-900/30",children:[(0,m.jsxs)("div",{className:"flex items-center gap-2",children:[(0,m.jsx)("span",{className:"text-xs text-slate-400",children:"Type:"}),["short_term","long_term","episodic"].map(a=>(0,m.jsx)("button",{onClick:()=>s(r===a?void 0:a),className:`px-2 py-1 text-xs rounded-full transition-colors ${r===a?"bg-blue-600 text-white":"bg-slate-800 text-slate-300 hover:bg-slate-700"}`,children:a.replace("_","-")},a))]}),(0,m.jsx)("div",{className:"w-px h-6 bg-slate-700"}),(0,m.jsxs)("div",{className:"flex items-center gap-2",children:[(0,m.jsx)("span",{className:"text-xs text-slate-400",children:"Category:"}),["architecture","pattern","error","learning","preference","context"].map(a=>(0,m.jsx)("button",{onClick:()=>u(t===a?void 0:a),className:`px-2 py-1 text-xs rounded-full transition-colors ${t===a?"bg-purple-600 text-white":"bg-slate-800 text-slate-300 hover:bg-slate-700"}`,children:a},a))]}),(r||t)&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)("div",{className:"w-px h-6 bg-slate-700"}),(0,m.jsx)("button",{onClick:()=>{s(void 0),u(void 0)},className:"px-2 py-1 text-xs text-red-400 hover:text-red-300",children:"Clear all"})]})]}),(0,m.jsxs)("div",{className:"flex-1 flex overflow-hidden",children:[(0,m.jsx)(h1,{}),(0,m.jsx)(E,{mode:"wait",children:(0,m.jsxs)(fw.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},className:"flex-1 relative overflow-hidden",children:["shield"===y&&(0,m.jsx)(iI,{}),"audit"===y&&(0,m.jsx)(iK,{}),"quarantine"===y&&(0,m.jsx)(iT,{}),"brain"===y&&(0,m.jsx)(jA,{memories:J,links:P,stats:N,isLoading:K}),"graph"===y&&(0,m.jsx)(jz,{memories:J,links:P,selectedMemory:z,onSelectMemory:W}),"agents"===y&&(0,m.jsx)(jf,{}),"skills"===y&&(0,m.jsx)(jp,{}),"dome"===y&&(0,m.jsx)(jy,{}),"memories"===y&&(0,m.jsx)(hE,{memories:J,selectedMemory:z,onSelectMemory:W})]},y)}),z&&!Y&&"brain"!==y&&(0,m.jsx)("div",{className:"w-80 border-l border-slate-800 overflow-y-auto shrink-0",children:(0,m.jsx)(hA,{memory:z,links:P,memories:J,onClose:()=>A(null),onReinforce:a=>{R.mutate(a)},onSelectMemory:X,isReinforcing:R.isPending,reinforceSuccess:R.isSuccess})}),B&&"audit"===y&&(0,m.jsx)("div",{className:"w-80 border-l border-slate-800 overflow-y-auto shrink-0",children:(0,m.jsx)(iQ,{entry:B,onClose:()=>C(null),onViewMemory:a=>{C(null),X(a),gd.getState().setViewMode("memories")}})})]})]})}a.s(["default",()=>jB],86344)}];
|
|
10
10
|
|
|
11
11
|
//# sourceMappingURL=dashboard_25b1b286._.js.map
|